Simplify inward bindings

This commit is contained in:
Dean Herbert 2019-03-07 12:16:17 +09:00
parent 58ef397f4f
commit 64b6eaa844
1 changed files with 6 additions and 10 deletions

View File

@ -118,9 +118,10 @@ private void load(AudioManager audio, APIAccess api, OsuConfigManager config)
OnQuit = performUserRequestedExit,
Start = gameplayClockContainer.Start,
Stop = gameplayClockContainer.Stop,
IsPaused = { BindTarget = gameplayClockContainer.IsPaused },
CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded.Value,
Children = new Container[]
Children = new[]
{
StoryboardContainer = CreateStoryboardContainer(),
new ScalingContainer(ScalingMode.Gameplay)
@ -137,12 +138,12 @@ private void load(AudioManager audio, APIAccess api, OsuConfigManager config)
Origin = Anchor.Centre,
Breaks = working.Beatmap.Breaks
},
new ScalingContainer(ScalingMode.Gameplay)
{
Child = RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
},
RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
HUDOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working)
{
HoldToQuit = { Action = performUserRequestedExit },
PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = gameplayClockContainer.UserPlaybackRate } } },
KeyCounter = { Visible = { BindTarget = RulesetContainer.HasReplayLoaded } },
RequestSeek = gameplayClockContainer.Seek,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
@ -171,12 +172,7 @@ private void load(AudioManager audio, APIAccess api, OsuConfigManager config)
};
// bind clock into components that require it
PausableGameplayContainer.IsPaused.BindTo(gameplayClockContainer.IsPaused);
RulesetContainer.IsPaused.BindTo(gameplayClockContainer.IsPaused);
HUDOverlay.PlayerSettingsOverlay.PlaybackSettings.UserPlaybackRate.BindTo(gameplayClockContainer.UserPlaybackRate);
HUDOverlay.HoldToQuit.Action = performUserRequestedExit;
HUDOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded);
if (ShowStoryboard.Value)
initializeStoryboard(false);