mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Create Catcher
in CatchPlayfield
This commit is contained in:
@ -123,8 +123,11 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
private readonly DroppedObjectContainer droppedObjectContainer;
|
private readonly DroppedObjectContainer droppedObjectContainer;
|
||||||
|
|
||||||
public TestCatcherArea(BeatmapDifficulty beatmapDifficulty)
|
public TestCatcherArea(BeatmapDifficulty beatmapDifficulty)
|
||||||
: base(beatmapDifficulty)
|
|
||||||
{
|
{
|
||||||
|
MovableCatcher = new Catcher(this, beatmapDifficulty)
|
||||||
|
{
|
||||||
|
X = CatchPlayfield.CENTER_X
|
||||||
|
};
|
||||||
AddInternal(droppedObjectContainer = new DroppedObjectContainer());
|
AddInternal(droppedObjectContainer = new DroppedObjectContainer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,8 +213,11 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
|
|
||||||
public TestCatcherArea()
|
public TestCatcherArea()
|
||||||
{
|
{
|
||||||
Scale = new Vector2(4f);
|
MovableCatcher = new Catcher(this, new BeatmapDifficulty())
|
||||||
|
{
|
||||||
|
X = CatchPlayfield.CENTER_X,
|
||||||
|
Scale = new Vector2(4)
|
||||||
|
};
|
||||||
AddInternal(droppedObjectContainer = new DroppedObjectContainer());
|
AddInternal(droppedObjectContainer = new DroppedObjectContainer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||||
@ -26,31 +27,40 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const float CENTER_X = WIDTH / 2;
|
public const float CENTER_X = WIDTH / 2;
|
||||||
|
|
||||||
[Cached]
|
|
||||||
private readonly DroppedObjectContainer droppedObjectContainer;
|
|
||||||
|
|
||||||
internal readonly CatcherArea CatcherArea;
|
|
||||||
|
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
|
||||||
// only check the X position; handle all vertical space.
|
// only check the X position; handle all vertical space.
|
||||||
base.ReceivePositionalInputAt(new Vector2(screenSpacePos.X, ScreenSpaceDrawQuad.Centre.Y));
|
base.ReceivePositionalInputAt(new Vector2(screenSpacePos.X, ScreenSpaceDrawQuad.Centre.Y));
|
||||||
|
|
||||||
|
internal readonly Catcher Catcher;
|
||||||
|
|
||||||
|
internal readonly CatcherArea CatcherArea;
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private readonly DroppedObjectContainer droppedObjectContainer;
|
||||||
|
|
||||||
public CatchPlayfield(BeatmapDifficulty difficulty)
|
public CatchPlayfield(BeatmapDifficulty difficulty)
|
||||||
{
|
{
|
||||||
CatcherArea = new CatcherArea(difficulty)
|
var trailContainer = new Container();
|
||||||
|
|
||||||
|
Catcher = new Catcher(trailContainer, difficulty)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
X = CENTER_X
|
||||||
Origin = Anchor.TopLeft,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
InternalChildren = new[]
|
InternalChildren = new[]
|
||||||
{
|
{
|
||||||
droppedObjectContainer = new DroppedObjectContainer(),
|
droppedObjectContainer = new DroppedObjectContainer(),
|
||||||
CatcherArea.MovableCatcher.CreateProxiedContent(),
|
Catcher.CreateProxiedContent(),
|
||||||
HitObjectContainer.CreateProxy(),
|
HitObjectContainer.CreateProxy(),
|
||||||
// This ordering (`CatcherArea` before `HitObjectContainer`) is important to
|
// This ordering (`CatcherArea` before `HitObjectContainer`) is important to
|
||||||
// make sure the up-to-date catcher position is used for the catcher catching logic of hit objects.
|
// make sure the up-to-date catcher position is used for the catcher catching logic of hit objects.
|
||||||
CatcherArea,
|
CatcherArea = new CatcherArea
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.TopLeft,
|
||||||
|
MovableCatcher = Catcher
|
||||||
|
},
|
||||||
|
trailContainer,
|
||||||
HitObjectContainer,
|
HitObjectContainer,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ using System;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Rulesets.Catch.Judgements;
|
using osu.Game.Rulesets.Catch.Judgements;
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Catch.Replays;
|
using osu.Game.Rulesets.Catch.Replays;
|
||||||
@ -20,9 +19,22 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
{
|
{
|
||||||
public const float CATCHER_SIZE = 106.75f;
|
public const float CATCHER_SIZE = 106.75f;
|
||||||
|
|
||||||
public readonly Catcher MovableCatcher;
|
public Catcher MovableCatcher
|
||||||
|
{
|
||||||
|
get => catcher;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (catcher != null)
|
||||||
|
Remove(catcher);
|
||||||
|
|
||||||
|
Add(catcher = value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private readonly CatchComboDisplay comboDisplay;
|
private readonly CatchComboDisplay comboDisplay;
|
||||||
|
|
||||||
|
private Catcher catcher;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <c>-1</c> when only left button is pressed.
|
/// <c>-1</c> when only left button is pressed.
|
||||||
/// <c>1</c> when only right button is pressed.
|
/// <c>1</c> when only right button is pressed.
|
||||||
@ -30,21 +42,17 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private int currentDirection;
|
private int currentDirection;
|
||||||
|
|
||||||
public CatcherArea(BeatmapDifficulty difficulty = null)
|
public CatcherArea()
|
||||||
{
|
{
|
||||||
Size = new Vector2(CatchPlayfield.WIDTH, CATCHER_SIZE);
|
Size = new Vector2(CatchPlayfield.WIDTH, CATCHER_SIZE);
|
||||||
Children = new Drawable[]
|
Child = comboDisplay = new CatchComboDisplay
|
||||||
{
|
{
|
||||||
comboDisplay = new CatchComboDisplay
|
RelativeSizeAxes = Axes.None,
|
||||||
{
|
AutoSizeAxes = Axes.Both,
|
||||||
RelativeSizeAxes = Axes.None,
|
Anchor = Anchor.TopLeft,
|
||||||
AutoSizeAxes = Axes.Both,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.TopLeft,
|
Margin = new MarginPadding { Bottom = 350f },
|
||||||
Origin = Anchor.Centre,
|
X = CatchPlayfield.CENTER_X
|
||||||
Margin = new MarginPadding { Bottom = 350f },
|
|
||||||
X = CatchPlayfield.CENTER_X
|
|
||||||
},
|
|
||||||
MovableCatcher = new Catcher(this, difficulty) { X = CatchPlayfield.CENTER_X },
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user