diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneTaikoScroller.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneTaikoScroller.cs index 19661bbcbb..3d1ccadd6e 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneTaikoScroller.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneTaikoScroller.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning public TestSceneTaikoScroller() { AddStep("Load scroller", () => SetContents(() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.TaikoScroller), _ => Empty()))); - AddToggleStep("Toggle passing", passing => this.ChildrenOfType().ForEach(s => s.Passing = !passing)); + AddToggleStep("Toggle passing", passing => this.ChildrenOfType().ForEach(s => s.Passing.Value = !passing)); } } } diff --git a/osu.Game.Rulesets.Taiko/Skinning/LegacyTaikoScroller.cs b/osu.Game.Rulesets.Taiko/Skinning/LegacyTaikoScroller.cs index 90fb1934df..f61ee0301d 100644 --- a/osu.Game.Rulesets.Taiko/Skinning/LegacyTaikoScroller.cs +++ b/osu.Game.Rulesets.Taiko/Skinning/LegacyTaikoScroller.cs @@ -3,9 +3,11 @@ using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Game.Screens.Play; using osu.Game.Skinning; using osuTK; @@ -18,23 +20,26 @@ namespace osu.Game.Rulesets.Taiko.Skinning RelativeSizeAxes = Axes.Both; } - private bool passing = true; - - public bool Passing + [BackgroundDependencyLoader(true)] + private void load(GameplayBeatmap gameplayBeatmap) { - get => passing; - set - { - if (value == passing) - return; - - passing = value; - - foreach (var sprite in InternalChildren.OfType()) - sprite.Passing = passing; - } + if (gameplayBeatmap != null) + ((IBindable)Passing).BindTo(gameplayBeatmap.Passing); } + protected override void LoadComplete() + { + base.LoadComplete(); + + Passing.BindValueChanged(passing => + { + foreach (var sprite in InternalChildren.OfType()) + sprite.Passing = passing.NewValue; + }, true); + } + + public Bindable Passing = new BindableBool(true); + protected override void Update() { base.Update(); diff --git a/osu.Game/Screens/Play/GameplayBeatmap.cs b/osu.Game/Screens/Play/GameplayBeatmap.cs index d7f939a883..0afa189e66 100644 --- a/osu.Game/Screens/Play/GameplayBeatmap.cs +++ b/osu.Game/Screens/Play/GameplayBeatmap.cs @@ -2,11 +2,14 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.Timing; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Screens.Play { @@ -38,5 +41,14 @@ namespace osu.Game.Screens.Play public IEnumerable GetStatistics() => PlayableBeatmap.GetStatistics(); public IBeatmap Clone() => PlayableBeatmap.Clone(); + + public IBindable Passing => passing; + + private readonly BindableBool passing = new BindableBool(true); + + public void OnNewResult(JudgementResult result) + { + passing.Value = result.Type > HitResult.Miss; + } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index ece4c6307e..eeb514b4be 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -193,6 +193,7 @@ namespace osu.Game.Screens.Play { HealthProcessor.ApplyResult(r); ScoreProcessor.ApplyResult(r); + gameplayBeatmap.OnNewResult(r); }; DrawableRuleset.OnRevertResult += r =>