mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 20:53:04 +08:00
Move cursor inside playfield
This commit is contained in:
parent
5411c63093
commit
acf518c208
@ -16,8 +16,11 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override CursorContainer CreateCursor() => null;
|
protected override Playfield CreatePlayfield() => new OsuPlayfieldNoCursor { Size = Vector2.One };
|
||||||
|
|
||||||
protected override Playfield CreatePlayfield() => new OsuPlayfield { Size = Vector2.One };
|
private class OsuPlayfieldNoCursor : OsuPlayfield
|
||||||
|
{
|
||||||
|
protected override CursorContainer CreateCursor() => null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,9 @@ 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;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.UI
|
namespace osu.Game.Rulesets.Osu.UI
|
||||||
{
|
{
|
||||||
@ -34,6 +36,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
Cursor,
|
||||||
connectionLayer = new FollowPointRenderer
|
connectionLayer = new FollowPointRenderer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -54,6 +57,8 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override CursorContainer CreateCursor() => new GameplayCursorContainer();
|
||||||
|
|
||||||
public override void Add(DrawableHitObject h)
|
public override void Add(DrawableHitObject h)
|
||||||
{
|
{
|
||||||
h.OnNewResult += onNewResult;
|
h.OnNewResult += onNewResult;
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics.Cursor;
|
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Input.Handlers;
|
using osu.Game.Input.Handlers;
|
||||||
@ -13,7 +12,6 @@ using osu.Game.Rulesets.Osu.Objects;
|
|||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.Replays;
|
using osu.Game.Rulesets.Osu.Replays;
|
||||||
using osu.Game.Rulesets.Osu.Scoring;
|
using osu.Game.Rulesets.Osu.Scoring;
|
||||||
using osu.Game.Rulesets.Osu.UI.Cursor;
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
@ -59,7 +57,5 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
return first.StartTime - first.TimePreempt;
|
return first.StartTime - first.TimePreempt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override CursorContainer CreateCursor() => new GameplayCursorContainer();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -47,6 +48,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly BindableBool DisplayJudgements = new BindableBool(true);
|
public readonly BindableBool DisplayJudgements = new BindableBool(true);
|
||||||
|
|
||||||
|
public readonly BindableBool HasReplayLoaded = new BindableBool();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="Playfield"/>.
|
/// Creates a new <see cref="Playfield"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -55,6 +58,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
hitObjectContainerLazy = new Lazy<HitObjectContainer>(CreateHitObjectContainer);
|
hitObjectContainerLazy = new Lazy<HitObjectContainer>(CreateHitObjectContainer);
|
||||||
|
|
||||||
|
Cursor = CreateCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorkingBeatmap beatmap;
|
private WorkingBeatmap beatmap;
|
||||||
@ -82,6 +87,16 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <param name="h">The DrawableHitObject to remove.</param>
|
/// <param name="h">The DrawableHitObject to remove.</param>
|
||||||
public virtual bool Remove(DrawableHitObject h) => HitObjectContainer.Remove(h);
|
public virtual bool Remove(DrawableHitObject h) => HitObjectContainer.Remove(h);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates the cursor. May be null if no cursor is required.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual CursorContainer CreateCursor() => null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The cursor provided by this <see cref="RulesetContainer"/>. May be null if no cursor is provided.
|
||||||
|
/// </summary>
|
||||||
|
public CursorContainer Cursor { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers a <see cref="Playfield"/> as a nested <see cref="Playfield"/>.
|
/// Registers a <see cref="Playfield"/> as a nested <see cref="Playfield"/>.
|
||||||
/// This does not add the <see cref="Playfield"/> to the draw hierarchy.
|
/// This does not add the <see cref="Playfield"/> to the draw hierarchy.
|
||||||
|
@ -76,12 +76,9 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Container Overlays { get; protected set; }
|
public Container Overlays { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
public CursorContainer Cursor => Playfield.Cursor;
|
||||||
/// The cursor provided by this <see cref="RulesetContainer"/>. May be null if no cursor is provided.
|
|
||||||
/// </summary>
|
|
||||||
public CursorContainer Cursor { get; }
|
|
||||||
|
|
||||||
public bool ProvidingUserCursor => Cursor != null && !HasReplayLoaded.Value;
|
public bool ProvidingUserCursor => Playfield.Cursor != null && !HasReplayLoaded.Value;
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e) => true; // required for IProvideCursor
|
protected override bool OnHover(HoverEvent e) => true; // required for IProvideCursor
|
||||||
|
|
||||||
@ -107,8 +104,6 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
KeyBindingInputManager.UseParentInput = !paused.NewValue;
|
KeyBindingInputManager.UseParentInput = !paused.NewValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
Cursor = CreateCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
@ -265,9 +260,6 @@ namespace osu.Game.Rulesets.UI
|
|||||||
Playfield
|
Playfield
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Cursor != null)
|
|
||||||
KeyBindingInputManager.Add(Cursor);
|
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
KeyBindingInputManager,
|
KeyBindingInputManager,
|
||||||
|
@ -193,10 +193,6 @@ namespace osu.Game.Screens.Play
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Breaks = beatmap.Breaks
|
Breaks = beatmap.Breaks
|
||||||
},
|
},
|
||||||
new ScalingContainer(ScalingMode.Gameplay)
|
|
||||||
{
|
|
||||||
Child = RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
|
|
||||||
},
|
|
||||||
HUDOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working, adjustableClock)
|
HUDOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working, adjustableClock)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
|
Loading…
Reference in New Issue
Block a user