mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Expose as JudgementResult instead of "passing" state
This commit is contained in:
parent
ff1d63060d
commit
cea6be5e52
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.Taiko.Skinning;
|
using osu.Game.Rulesets.Taiko.Skinning;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
@ -13,7 +15,8 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
public TestSceneTaikoScroller()
|
public TestSceneTaikoScroller()
|
||||||
{
|
{
|
||||||
AddStep("Load scroller", () => SetContents(() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.TaikoScroller), _ => Empty())));
|
AddStep("Load scroller", () => SetContents(() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.TaikoScroller), _ => Empty())));
|
||||||
AddToggleStep("Toggle passing", passing => this.ChildrenOfType<LegacyTaikoScroller>().ForEach(s => s.Passing.Value = !passing));
|
AddToggleStep("Toggle passing", passing => this.ChildrenOfType<LegacyTaikoScroller>().ForEach(s => s.LastResult.Value =
|
||||||
|
new JudgementResult(null, new Judgement()) { Type = passing ? HitResult.Perfect : HitResult.Miss }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -24,21 +26,21 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
|||||||
private void load(GameplayBeatmap gameplayBeatmap)
|
private void load(GameplayBeatmap gameplayBeatmap)
|
||||||
{
|
{
|
||||||
if (gameplayBeatmap != null)
|
if (gameplayBeatmap != null)
|
||||||
((IBindable<bool>)Passing).BindTo(gameplayBeatmap.Passing);
|
((IBindable<JudgementResult>)LastResult).BindTo(gameplayBeatmap.LastJudgementResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
Passing.BindValueChanged(passing =>
|
LastResult.BindValueChanged(result =>
|
||||||
{
|
{
|
||||||
foreach (var sprite in InternalChildren.OfType<ScrollerSprite>())
|
foreach (var sprite in InternalChildren.OfType<ScrollerSprite>())
|
||||||
sprite.Passing = passing.NewValue;
|
sprite.Passing = result.NewValue == null || result.NewValue.Type > HitResult.Miss;
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bindable<bool> Passing = new BindableBool(true);
|
public Bindable<JudgementResult> LastResult = new Bindable<JudgementResult>();
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,6 @@ using osu.Game.Beatmaps.ControlPoints;
|
|||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
@ -42,13 +41,10 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public IBeatmap Clone() => PlayableBeatmap.Clone();
|
public IBeatmap Clone() => PlayableBeatmap.Clone();
|
||||||
|
|
||||||
public IBindable<bool> Passing => passing;
|
private readonly Bindable<JudgementResult> lastJudgementResult = new Bindable<JudgementResult>();
|
||||||
|
|
||||||
private readonly BindableBool passing = new BindableBool(true);
|
public IBindable<JudgementResult> LastJudgementResult => lastJudgementResult;
|
||||||
|
|
||||||
public void OnNewResult(JudgementResult result)
|
public void ApplyResult(JudgementResult result) => lastJudgementResult.Value = result;
|
||||||
{
|
|
||||||
passing.Value = result.Type > HitResult.Miss;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
HealthProcessor.ApplyResult(r);
|
HealthProcessor.ApplyResult(r);
|
||||||
ScoreProcessor.ApplyResult(r);
|
ScoreProcessor.ApplyResult(r);
|
||||||
gameplayBeatmap.OnNewResult(r);
|
gameplayBeatmap.ApplyResult(r);
|
||||||
};
|
};
|
||||||
|
|
||||||
DrawableRuleset.OnRevertResult += r =>
|
DrawableRuleset.OnRevertResult += r =>
|
||||||
|
Loading…
Reference in New Issue
Block a user