mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 00:02:54 +08:00
Add and consume passing state in GameplayBeatmap
This commit is contained in:
parent
3033ab80ce
commit
ff1d63060d
@ -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<LegacyTaikoScroller>().ForEach(s => s.Passing = !passing));
|
||||
AddToggleStep("Toggle passing", passing => this.ChildrenOfType<LegacyTaikoScroller>().ForEach(s => s.Passing.Value = !passing));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<ScrollerSprite>())
|
||||
sprite.Passing = passing;
|
||||
}
|
||||
if (gameplayBeatmap != null)
|
||||
((IBindable<bool>)Passing).BindTo(gameplayBeatmap.Passing);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Passing.BindValueChanged(passing =>
|
||||
{
|
||||
foreach (var sprite in InternalChildren.OfType<ScrollerSprite>())
|
||||
sprite.Passing = passing.NewValue;
|
||||
}, true);
|
||||
}
|
||||
|
||||
public Bindable<bool> Passing = new BindableBool(true);
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
@ -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<BeatmapStatistic> GetStatistics() => PlayableBeatmap.GetStatistics();
|
||||
|
||||
public IBeatmap Clone() => PlayableBeatmap.Clone();
|
||||
|
||||
public IBindable<bool> Passing => passing;
|
||||
|
||||
private readonly BindableBool passing = new BindableBool(true);
|
||||
|
||||
public void OnNewResult(JudgementResult result)
|
||||
{
|
||||
passing.Value = result.Type > HitResult.Miss;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -193,6 +193,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
HealthProcessor.ApplyResult(r);
|
||||
ScoreProcessor.ApplyResult(r);
|
||||
gameplayBeatmap.OnNewResult(r);
|
||||
};
|
||||
|
||||
DrawableRuleset.OnRevertResult += r =>
|
||||
|
Loading…
Reference in New Issue
Block a user