mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 16:43:52 +09:00
Split out consumption and creation into two separate code paths
This commit is contained in:
@ -10,6 +10,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Connections;
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Connections;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Osu.UI.Cursor;
|
using osu.Game.Rulesets.Osu.UI.Cursor;
|
||||||
|
|
||||||
@ -23,6 +24,12 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
|
|
||||||
public static readonly Vector2 BASE_SIZE = new Vector2(512, 384);
|
public static readonly Vector2 BASE_SIZE = new Vector2(512, 384);
|
||||||
|
|
||||||
|
private readonly PlayfieldAdjustmentContainer adjustmentContainer;
|
||||||
|
|
||||||
|
protected override Container CursorTargetContainer => adjustmentContainer;
|
||||||
|
|
||||||
|
protected override CursorContainer CreateCursor() => new GameplayCursorContainer();
|
||||||
|
|
||||||
public OsuPlayfield()
|
public OsuPlayfield()
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
@ -30,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
|
|
||||||
Size = new Vector2(0.75f);
|
Size = new Vector2(0.75f);
|
||||||
|
|
||||||
InternalChild = new PlayfieldAdjustmentContainer
|
InternalChild = adjustmentContainer = new PlayfieldAdjustmentContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -51,7 +58,6 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Depth = -1,
|
Depth = -1,
|
||||||
},
|
},
|
||||||
Cursor = new GameplayCursorContainer(),
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,10 @@ namespace osu.Game.Rulesets.UI
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
hitObjectContainerLazy = new Lazy<HitObjectContainer>(CreateHitObjectContainer);
|
hitObjectContainerLazy = new Lazy<HitObjectContainer>(CreateHitObjectContainer);
|
||||||
|
|
||||||
|
Cursor = CreateCursor();
|
||||||
|
if (Cursor != null)
|
||||||
|
CursorTargetContainer.Add(Cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorkingBeatmap beatmap;
|
private WorkingBeatmap beatmap;
|
||||||
@ -86,7 +90,19 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The cursor currently being used by this <see cref="Playfield"/>. May be null if no cursor is provided.
|
/// The cursor currently being used by this <see cref="Playfield"/>. May be null if no cursor is provided.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CursorContainer Cursor { get; protected set; }
|
public CursorContainer Cursor { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provide an optional cursor which is to be used for gameplay.
|
||||||
|
/// If providing a cursor, <see cref="CursorTargetContainer"/> must also point to a valid target container.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The cursor, or null if a cursor is not rqeuired.</returns>
|
||||||
|
protected virtual CursorContainer CreateCursor() => null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The target container to add the cursor after it is created.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual Container CursorTargetContainer => null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers a <see cref="Playfield"/> as a nested <see cref="Playfield"/>.
|
/// Registers a <see cref="Playfield"/> as a nested <see cref="Playfield"/>.
|
||||||
|
Reference in New Issue
Block a user