Move osu!catch combo counter display to inside CatcherArea

This commit is contained in:
Salman Ahmed
2020-08-29 23:14:29 +03:00
parent 0e9242ee9a
commit ba8a4eb6f0
2 changed files with 18 additions and 18 deletions

View File

@ -28,7 +28,8 @@ namespace osu.Game.Rulesets.Catch.UI
public const float CENTER_X = WIDTH / 2;
internal readonly CatcherArea CatcherArea;
private readonly CatchComboDisplay comboDisplay;
private CatchComboDisplay comboDisplay => CatcherArea.ComboDisplay;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
// only check the X position; handle all vertical space.
@ -49,22 +50,12 @@ namespace osu.Game.Rulesets.Catch.UI
Origin = Anchor.TopLeft,
};
comboDisplay = new CatchComboDisplay
{
RelativeSizeAxes = Axes.None,
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.Centre,
Y = 30f,
};
InternalChildren = new[]
{
explodingFruitContainer,
CatcherArea.MovableCatcher.CreateProxiedContent(),
HitObjectContainer,
CatcherArea,
comboDisplay,
};
}
@ -81,12 +72,6 @@ namespace osu.Game.Rulesets.Catch.UI
fruit.CheckPosition = CheckIfWeCanCatch;
}
protected override void Update()
{
base.Update();
comboDisplay.X = CatcherArea.MovableCatcher.X;
}
private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
{
var catchObject = (DrawableCatchHitObject)judgedObject;

View File

@ -23,6 +23,7 @@ namespace osu.Game.Rulesets.Catch.UI
public Func<CatchHitObject, DrawableHitObject<CatchHitObject>> CreateDrawableRepresentation;
public readonly Catcher MovableCatcher;
internal readonly CatchComboDisplay ComboDisplay;
public Container ExplodingFruitTarget
{
@ -34,7 +35,19 @@ namespace osu.Game.Rulesets.Catch.UI
public CatcherArea(BeatmapDifficulty difficulty = null)
{
Size = new Vector2(CatchPlayfield.WIDTH, CATCHER_SIZE);
Child = MovableCatcher = new Catcher(this, difficulty) { X = CatchPlayfield.CENTER_X };
Children = new Drawable[]
{
ComboDisplay = new CatchComboDisplay
{
RelativeSizeAxes = Axes.None,
AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopLeft,
Origin = Anchor.Centre,
Margin = new MarginPadding { Bottom = 350f },
X = CatchPlayfield.CENTER_X
},
MovableCatcher = new Catcher(this, difficulty) { X = CatchPlayfield.CENTER_X },
};
}
public void OnResult(DrawableCatchHitObject fruit, JudgementResult result)
@ -105,6 +118,8 @@ namespace osu.Game.Rulesets.Catch.UI
if (state?.CatcherX != null)
MovableCatcher.X = state.CatcherX.Value;
ComboDisplay.X = MovableCatcher.X;
}
}
}