-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
121 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
using System; | ||
using fluXis.Game.Database.Maps; | ||
using fluXis.Game.Input; | ||
using fluXis.Shared.Components.Users; | ||
using fluXis.Shared.Scoring; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Input.Bindings; | ||
using osu.Framework.Input.Events; | ||
using osu.Framework.Screens; | ||
|
||
namespace fluXis.Game.Screens.Result; | ||
|
||
public partial class Results : FluXisScreen, IKeyBindingHandler<FluXisGlobalKeybind> | ||
{ | ||
public override float Zoom => 1.2f; | ||
public override float BackgroundDim => 0.75f; | ||
public override float BackgroundBlur => 0.2f; | ||
|
||
public ScoreInfo ComparisonScore { get; set; } | ||
|
||
protected ScoreInfo Score { get; } | ||
protected RealmMap Map { get; } | ||
protected APIUser Player { get; } | ||
|
||
protected DependencyContainer ExtraDependencies { get; set; } | ||
|
||
protected virtual bool PlayEnterAnimation => false; | ||
|
||
public Action OnRestart; | ||
|
||
private ResultsContent content; | ||
private ResultsFooter footer; | ||
|
||
public Results(RealmMap map, ScoreInfo score, APIUser player) | ||
{ | ||
Map = map; | ||
Score = score; | ||
Player = player; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
ExtraDependencies.CacheAs(this); | ||
ExtraDependencies.CacheAs(Score); | ||
ExtraDependencies.CacheAs(Map); | ||
ExtraDependencies.CacheAs(Player ?? APIUser.Default); | ||
|
||
InternalChildren = new Drawable[] | ||
{ | ||
content = new ResultsContent(CreateRightContent()), | ||
footer = new ResultsFooter | ||
{ | ||
BackAction = this.Exit, | ||
RestartAction = OnRestart | ||
} | ||
}; | ||
} | ||
|
||
protected virtual Drawable[] CreateRightContent() => Array.Empty<Drawable>(); | ||
|
||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => ExtraDependencies = new DependencyContainer(base.CreateChildDependencies(parent)); | ||
|
||
public override void OnEntering(ScreenTransitionEvent e) | ||
{ | ||
this.FadeOut(); | ||
|
||
using (BeginDelayedSequence(ENTER_DELAY)) | ||
{ | ||
this.FadeInFromZero(FADE_DURATION); | ||
content.Show(PlayEnterAnimation); | ||
footer.Show(); | ||
} | ||
} | ||
|
||
public override bool OnExiting(ScreenExitEvent e) | ||
{ | ||
this.FadeOut(FADE_DURATION); | ||
content.Hide(); | ||
footer.Hide(); | ||
return base.OnExiting(e); | ||
} | ||
|
||
public bool OnPressed(KeyBindingPressEvent<FluXisGlobalKeybind> e) | ||
{ | ||
switch (e.Action) | ||
{ | ||
case FluXisGlobalKeybind.Back: | ||
this.Exit(); | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public void OnReleased(KeyBindingReleaseEvent<FluXisGlobalKeybind> e) { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,32 @@ | ||
using System; | ||
using fluXis.Game.Database.Maps; | ||
using fluXis.Game.Input; | ||
using fluXis.Game.Database.Maps; | ||
using fluXis.Game.Online.API.Requests.Scores; | ||
using fluXis.Game.Screens.Gameplay; | ||
using fluXis.Game.Screens.Result.Sides.Types; | ||
using fluXis.Shared.Components.Users; | ||
using fluXis.Shared.Scoring; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Input.Bindings; | ||
using osu.Framework.Input.Events; | ||
using osu.Framework.Screens; | ||
|
||
namespace fluXis.Game.Screens.Result; | ||
|
||
public partial class SoloResults : FluXisScreen, IKeyBindingHandler<FluXisGlobalKeybind> | ||
public partial class SoloResults : Results | ||
{ | ||
public override float Zoom => 1.2f; | ||
public override float BackgroundDim => 0.75f; | ||
public override float BackgroundBlur => 0.2f; | ||
protected override bool PlayEnterAnimation => true; | ||
|
||
public bool ForceFromGameplay { get; init; } | ||
|
||
public ScoreInfo Score { get; } | ||
public RealmMap Map { get; } | ||
public APIUser Player { get; } | ||
|
||
public ScoreInfo ComparisonScore { get; set; } | ||
public ScoreSubmitRequest SubmitRequest { get; set; } | ||
|
||
private DependencyContainer dependencies; | ||
|
||
public Action OnRestart; | ||
|
||
private ResultsContent content; | ||
private ResultsFooter footer; | ||
|
||
public SoloResults(RealmMap map, ScoreInfo score, APIUser player) | ||
: base(map, score, player) | ||
{ | ||
Map = map; | ||
Score = score; | ||
Player = player; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
dependencies.CacheAs(this); | ||
dependencies.CacheAs(Score); | ||
dependencies.CacheAs(Map); | ||
dependencies.CacheAs(Player ?? APIUser.Default); | ||
|
||
InternalChildren = new Drawable[] | ||
{ | ||
content = new ResultsContent(), | ||
footer = new ResultsFooter | ||
{ | ||
BackAction = this.Exit, | ||
RestartAction = OnRestart | ||
} | ||
}; | ||
ExtraDependencies.CacheAs(this); | ||
} | ||
|
||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); | ||
|
||
public override void OnEntering(ScreenTransitionEvent e) | ||
protected override Drawable[] CreateRightContent() => new Drawable[] | ||
{ | ||
this.FadeOut(); | ||
|
||
using (BeginDelayedSequence(ENTER_DELAY)) | ||
{ | ||
this.FadeInFromZero(FADE_DURATION); | ||
content.Show(e.Last is GameplayScreen || ForceFromGameplay); | ||
footer.Show(); | ||
} | ||
} | ||
|
||
public override bool OnExiting(ScreenExitEvent e) | ||
{ | ||
this.FadeOut(FADE_DURATION); | ||
content.Hide(); | ||
footer.Hide(); | ||
return base.OnExiting(e); | ||
} | ||
|
||
public bool OnPressed(KeyBindingPressEvent<FluXisGlobalKeybind> e) | ||
{ | ||
switch (e.Action) | ||
{ | ||
case FluXisGlobalKeybind.Back: | ||
this.Exit(); | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public void OnReleased(KeyBindingReleaseEvent<FluXisGlobalKeybind> e) { } | ||
new ResultsSideRankings(SubmitRequest) | ||
}; | ||
} |