Remove GotoRanking

This commit is contained in:
smoogipoo
2020-12-18 17:47:33 +09:00
parent 97ff500b0d
commit 2958cab239
2 changed files with 23 additions and 8 deletions

View File

@ -11,6 +11,7 @@ using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Scoring;
using osu.Game.Screens.Ranking;
using osu.Game.Storyboards;
using osuTK;
@ -51,7 +52,7 @@ namespace osu.Game.Tests.Visual.Gameplay
cancel();
complete();
AddUntilStep("attempted to push ranking", () => ((FakeRankingPushPlayer)Player).GotoRankingInvoked);
AddUntilStep("attempted to push ranking", () => ((FakeRankingPushPlayer)Player).ResultsCreated);
}
/// <summary>
@ -85,7 +86,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{
// wait to ensure there was no attempt of pushing the results screen.
AddWaitStep("wait", resultsDisplayWaitCount);
AddAssert("no attempt to push ranking", () => !((FakeRankingPushPlayer)Player).GotoRankingInvoked);
AddAssert("no attempt to push ranking", () => !((FakeRankingPushPlayer)Player).ResultsCreated);
}
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
@ -111,16 +112,18 @@ namespace osu.Game.Tests.Visual.Gameplay
public class FakeRankingPushPlayer : TestPlayer
{
public bool GotoRankingInvoked;
public bool ResultsCreated { get; private set; }
public FakeRankingPushPlayer()
: base(true, true)
{
}
protected override void GotoRanking(ScoreInfo score)
protected override ResultsScreen CreateResults(ScoreInfo score)
{
GotoRankingInvoked = true;
var results = base.CreateResults(score);
ResultsCreated = true;
return results;
}
}
}

View File

@ -536,7 +536,7 @@ namespace osu.Game.Screens.Play
{
// screen may be in the exiting transition phase.
if (this.IsCurrentScreen())
GotoRanking(t.Result);
this.Push(CreateResults(t.Result));
});
}
}));
@ -738,6 +738,10 @@ namespace osu.Game.Screens.Play
return base.OnExiting(next);
}
/// <summary>
/// Creates the player's <see cref="Score"/>.
/// </summary>
/// <returns>The <see cref="Score"/>.</returns>
protected virtual Score CreateScore()
{
var score = new Score
@ -767,6 +771,11 @@ namespace osu.Game.Screens.Play
return score;
}
/// <summary>
/// Submits the player's <see cref="Score"/>.
/// </summary>
/// <param name="score">The <see cref="Score"/> to submit.</param>
/// <returns>The submitted score.</returns>
protected virtual async Task<ScoreInfo> SubmitScore(Score score)
{
// Replays are already populated and present in the game's database, so should not be re-imported.
@ -784,10 +793,13 @@ namespace osu.Game.Screens.Play
return await scoreManager.Import(score.ScoreInfo, replayReader);
}
/// <summary>
/// Creates the <see cref="ResultsScreen"/> for a <see cref="ScoreInfo"/>.
/// </summary>
/// <param name="score">The <see cref="ScoreInfo"/> to be displayed in the results screen.</param>
/// <returns>The <see cref="ResultsScreen"/>.</returns>
protected virtual ResultsScreen CreateResults(ScoreInfo score) => new SoloResultsScreen(score, true);
protected virtual void GotoRanking(ScoreInfo score) => this.Push(CreateResults(score));
private void fadeOut(bool instant = false)
{
float fadeOutDuration = instant ? 0 : 250;