1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 16:12:54 +08:00

Encapsulate combo display better

This commit is contained in:
Bartłomiej Dach 2020-09-12 22:39:06 +02:00
parent 3db0e7cd75
commit fcf3a1d13c
3 changed files with 12 additions and 16 deletions

View File

@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Catch.Tests
Schedule(() =>
{
area.AttemptCatch(fruit);
area.OnResult(drawable, new JudgementResult(fruit, new CatchJudgement()) { Type = miss ? HitResult.Miss : HitResult.Great });
area.OnNewResult(drawable, new JudgementResult(fruit, new CatchJudgement()) { Type = miss ? HitResult.Miss : HitResult.Great });
drawable.Expire();
});

View File

@ -29,8 +29,6 @@ namespace osu.Game.Rulesets.Catch.UI
internal readonly CatcherArea CatcherArea;
private CatchComboDisplay comboDisplay => CatcherArea.ComboDisplay;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
// only check the X position; handle all vertical space.
base.ReceivePositionalInputAt(new Vector2(screenSpacePos.X, ScreenSpaceDrawQuad.Centre.Y));
@ -73,16 +71,9 @@ namespace osu.Game.Rulesets.Catch.UI
}
private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
{
var catchObject = (DrawableCatchHitObject)judgedObject;
CatcherArea.OnResult(catchObject, result);
comboDisplay.OnNewResult(catchObject, result);
}
=> CatcherArea.OnNewResult((DrawableCatchHitObject)judgedObject, result);
private void onRevertResult(DrawableHitObject judgedObject, JudgementResult result)
{
comboDisplay.OnRevertResult((DrawableCatchHitObject)judgedObject, result);
}
=> CatcherArea.OnRevertResult((DrawableCatchHitObject)judgedObject, result);
}
}

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Catch.UI
public Func<CatchHitObject, DrawableHitObject<CatchHitObject>> CreateDrawableRepresentation;
public readonly Catcher MovableCatcher;
internal readonly CatchComboDisplay ComboDisplay;
private readonly CatchComboDisplay comboDisplay;
public Container ExplodingFruitTarget
{
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Catch.UI
Size = new Vector2(CatchPlayfield.WIDTH, CATCHER_SIZE);
Children = new Drawable[]
{
ComboDisplay = new CatchComboDisplay
comboDisplay = new CatchComboDisplay
{
RelativeSizeAxes = Axes.None,
AutoSizeAxes = Axes.Both,
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Catch.UI
};
}
public void OnResult(DrawableCatchHitObject fruit, JudgementResult result)
public void OnNewResult(DrawableCatchHitObject fruit, JudgementResult result)
{
if (result.Judgement is IgnoreJudgement)
return;
@ -99,8 +99,13 @@ namespace osu.Game.Rulesets.Catch.UI
else
MovableCatcher.Drop();
}
comboDisplay.OnNewResult(fruit, result);
}
public void OnRevertResult(DrawableCatchHitObject fruit, JudgementResult result)
=> comboDisplay.OnRevertResult(fruit, result);
public void OnReleased(CatchAction action)
{
}
@ -119,7 +124,7 @@ namespace osu.Game.Rulesets.Catch.UI
if (state?.CatcherX != null)
MovableCatcher.X = state.CatcherX.Value;
ComboDisplay.X = MovableCatcher.X;
comboDisplay.X = MovableCatcher.X;
}
}
}