mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 10:02:59 +08:00
Convert remaining two flags to ctor parameters
This commit is contained in:
parent
83863d35c3
commit
a88f23e555
@ -330,11 +330,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
},
|
},
|
||||||
}, Clock);
|
}, Clock);
|
||||||
|
|
||||||
var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } })
|
var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } });
|
||||||
{
|
|
||||||
AllowPause = false,
|
|
||||||
AllowResults = false
|
|
||||||
};
|
|
||||||
|
|
||||||
p.OnLoadComplete += _ =>
|
p.OnLoadComplete += _ =>
|
||||||
{
|
{
|
||||||
@ -363,7 +359,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
||||||
|
|
||||||
public ScoreAccessibleReplayPlayer(Score score)
|
public ScoreAccessibleReplayPlayer(Score score)
|
||||||
: base(score)
|
: base(score, false, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,9 +257,8 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
|
|
||||||
AddStep("Start player loader", () =>
|
AddStep("Start player loader", () =>
|
||||||
{
|
{
|
||||||
songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer
|
songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer(allowPause)
|
||||||
{
|
{
|
||||||
AllowPause = allowPause,
|
|
||||||
Ready = true,
|
Ready = true,
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
@ -357,6 +356,11 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
public readonly Bindable<bool> ReplacesBackground = new Bindable<bool>();
|
public readonly Bindable<bool> ReplacesBackground = new Bindable<bool>();
|
||||||
public readonly Bindable<bool> IsPaused = new Bindable<bool>();
|
public readonly Bindable<bool> IsPaused = new Bindable<bool>();
|
||||||
|
|
||||||
|
public TestPlayer(bool allowPause = true)
|
||||||
|
: base(allowPause)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsStoryboardVisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha == 1;
|
public bool IsStoryboardVisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha == 1;
|
||||||
|
|
||||||
public bool IsStoryboardInvisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha <= 1;
|
public bool IsStoryboardInvisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha <= 1;
|
||||||
|
@ -15,11 +15,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
protected override Player CreatePlayer(Ruleset ruleset)
|
protected override Player CreatePlayer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
|
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
|
||||||
return new ScoreAccessiblePlayer
|
return new ScoreAccessiblePlayer();
|
||||||
{
|
|
||||||
AllowPause = false,
|
|
||||||
AllowResults = false,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void AddCheckSteps()
|
protected override void AddCheckSteps()
|
||||||
@ -32,6 +28,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
||||||
public new HUDOverlay HUDOverlay => base.HUDOverlay;
|
public new HUDOverlay HUDOverlay => base.HUDOverlay;
|
||||||
|
|
||||||
|
public ScoreAccessiblePlayer()
|
||||||
|
: base(false, false)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,11 +26,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
Beatmap.Value = new DummyWorkingBeatmap(game);
|
Beatmap.Value = new DummyWorkingBeatmap(game);
|
||||||
|
|
||||||
AddStep("load dummy beatmap", () => stack.Push(loader = new PlayerLoader(() => new Player
|
AddStep("load dummy beatmap", () => stack.Push(loader = new PlayerLoader(() => new Player(false, false))));
|
||||||
{
|
|
||||||
AllowPause = false,
|
|
||||||
AllowResults = false,
|
|
||||||
})));
|
|
||||||
|
|
||||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
|
|
||||||
@ -46,11 +42,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
SlowLoadPlayer slow = null;
|
SlowLoadPlayer slow = null;
|
||||||
|
|
||||||
stack.Push(loader = new PlayerLoader(() => slow = new SlowLoadPlayer
|
stack.Push(loader = new PlayerLoader(() => slow = new SlowLoadPlayer(false, false)));
|
||||||
{
|
|
||||||
AllowPause = false,
|
|
||||||
AllowResults = false,
|
|
||||||
}));
|
|
||||||
|
|
||||||
Scheduler.AddDelayed(() => slow.Ready = true, 5000);
|
Scheduler.AddDelayed(() => slow.Ready = true, 5000);
|
||||||
});
|
});
|
||||||
@ -62,6 +54,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
public bool Ready;
|
public bool Ready;
|
||||||
|
|
||||||
|
public SlowLoadPlayer(bool allowPause = true, bool showResults = true)
|
||||||
|
: base(allowPause, showResults)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
@ -43,9 +43,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public bool HasFailed { get; private set; }
|
public bool HasFailed { get; private set; }
|
||||||
|
|
||||||
public bool AllowPause { get; set; } = true;
|
|
||||||
public bool AllowResults { get; set; } = true;
|
|
||||||
|
|
||||||
private Bindable<bool> mouseWheelDisabled;
|
private Bindable<bool> mouseWheelDisabled;
|
||||||
|
|
||||||
private readonly Bindable<bool> storyboardReplacesBackground = new Bindable<bool>();
|
private readonly Bindable<bool> storyboardReplacesBackground = new Bindable<bool>();
|
||||||
@ -70,6 +67,20 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected GameplayClockContainer GameplayClockContainer { get; private set; }
|
protected GameplayClockContainer GameplayClockContainer { get; private set; }
|
||||||
|
|
||||||
|
private readonly bool allowPause;
|
||||||
|
private readonly bool showResults;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new player instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="allowPause">Whether pausing should be allowed. If not allowed, attempting to pause will quit.</param>
|
||||||
|
/// <param name="showResults">Whether results screen should be pushed on completion.</param>
|
||||||
|
public Player(bool allowPause = true, bool showResults = true)
|
||||||
|
{
|
||||||
|
this.allowPause = allowPause;
|
||||||
|
this.showResults = showResults;
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, IAPIProvider api, OsuConfigManager config)
|
private void load(AudioManager audio, IAPIProvider api, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
@ -233,7 +244,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
ValidForResume = false;
|
ValidForResume = false;
|
||||||
|
|
||||||
if (!AllowResults) return;
|
if (!showResults) return;
|
||||||
|
|
||||||
using (BeginDelayedSequence(1000))
|
using (BeginDelayedSequence(1000))
|
||||||
{
|
{
|
||||||
@ -347,7 +358,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private bool canPause =>
|
private bool canPause =>
|
||||||
// must pass basic screen conditions (beatmap loaded, instance allows pause)
|
// must pass basic screen conditions (beatmap loaded, instance allows pause)
|
||||||
LoadedBeatmapSuccessfully && AllowPause && ValidForResume
|
LoadedBeatmapSuccessfully && allowPause && ValidForResume
|
||||||
// replays cannot be paused and exit immediately
|
// replays cannot be paused and exit immediately
|
||||||
&& !DrawableRuleset.HasReplayLoaded.Value
|
&& !DrawableRuleset.HasReplayLoaded.Value
|
||||||
// cannot pause if we are already in a fail state
|
// cannot pause if we are already in a fail state
|
||||||
|
@ -9,7 +9,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
private readonly Score score;
|
private readonly Score score;
|
||||||
|
|
||||||
public ReplayPlayer(Score score)
|
public ReplayPlayer(Score score, bool allowPause = true, bool showResults = true)
|
||||||
|
: base(allowPause, showResults)
|
||||||
{
|
{
|
||||||
this.score = score;
|
this.score = score;
|
||||||
}
|
}
|
||||||
|
@ -80,10 +80,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
return Player;
|
return Player;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Player CreatePlayer(Ruleset ruleset) => new Player
|
protected virtual Player CreatePlayer(Ruleset ruleset) => new Player(false, false);
|
||||||
{
|
|
||||||
AllowPause = false,
|
|
||||||
AllowResults = false,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,10 +56,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
LoadScreen(Player);
|
LoadScreen(Player);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Player CreatePlayer(Ruleset ruleset) => new Player
|
protected virtual Player CreatePlayer(Ruleset ruleset) => new Player(false, false);
|
||||||
{
|
|
||||||
AllowPause = false,
|
|
||||||
AllowResults = false,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user