Rename various cursor symbols

- `IProvideCursor.MenuCursor` -> `IProvideCursor.Cursor`
 - `MenuCursor` -> `MenuCursorContainer
This commit is contained in:
Salman Ahmed 2022-10-11 16:20:57 +03:00
parent cc0ca470f1
commit 9b45a9cf76
7 changed files with 43 additions and 41 deletions

View File

@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Editing
}
}
},
new MenuCursor()
new MenuCursorContainer()
};
scrollContainer.Add(innerBox = new Box

View File

@ -96,10 +96,10 @@ namespace osu.Game.Tests.Visual.UserInterface
private void testUserCursor()
{
AddStep("Move to green area", () => InputManager.MoveMouseTo(cursorBoxes[0]));
AddAssert("Check green cursor visible", () => checkVisible(cursorBoxes[0].MenuCursor));
AddAssert("Check green cursor at mouse", () => checkAtMouse(cursorBoxes[0].MenuCursor));
AddAssert("Check green cursor visible", () => checkVisible(cursorBoxes[0].Cursor));
AddAssert("Check green cursor at mouse", () => checkAtMouse(cursorBoxes[0].Cursor));
AddStep("Move out", moveOut);
AddAssert("Check green cursor invisible", () => !checkVisible(cursorBoxes[0].MenuCursor));
AddAssert("Check green cursor invisible", () => !checkVisible(cursorBoxes[0].Cursor));
AddAssert("Check global cursor visible", () => checkVisible(globalCursorDisplay.MenuCursor));
}
@ -111,12 +111,12 @@ namespace osu.Game.Tests.Visual.UserInterface
private void testLocalCursor()
{
AddStep("Move to purple area", () => InputManager.MoveMouseTo(cursorBoxes[3]));
AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].MenuCursor));
AddAssert("Check purple cursor at mouse", () => checkAtMouse(cursorBoxes[3].MenuCursor));
AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].Cursor));
AddAssert("Check purple cursor at mouse", () => checkAtMouse(cursorBoxes[3].Cursor));
AddAssert("Check global cursor visible", () => checkVisible(globalCursorDisplay.MenuCursor));
AddAssert("Check global cursor at mouse", () => checkAtMouse(globalCursorDisplay.MenuCursor));
AddStep("Move out", moveOut);
AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].MenuCursor));
AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].Cursor));
AddAssert("Check global cursor visible", () => checkVisible(globalCursorDisplay.MenuCursor));
}
@ -128,12 +128,12 @@ namespace osu.Game.Tests.Visual.UserInterface
private void testUserCursorOverride()
{
AddStep("Move to blue-green boundary", () => InputManager.MoveMouseTo(cursorBoxes[1].ScreenSpaceDrawQuad.BottomRight - new Vector2(10)));
AddAssert("Check blue cursor visible", () => checkVisible(cursorBoxes[1].MenuCursor));
AddAssert("Check green cursor invisible", () => !checkVisible(cursorBoxes[0].MenuCursor));
AddAssert("Check blue cursor at mouse", () => checkAtMouse(cursorBoxes[1].MenuCursor));
AddAssert("Check blue cursor visible", () => checkVisible(cursorBoxes[1].Cursor));
AddAssert("Check green cursor invisible", () => !checkVisible(cursorBoxes[0].Cursor));
AddAssert("Check blue cursor at mouse", () => checkAtMouse(cursorBoxes[1].Cursor));
AddStep("Move out", moveOut);
AddAssert("Check blue cursor not visible", () => !checkVisible(cursorBoxes[1].MenuCursor));
AddAssert("Check green cursor not visible", () => !checkVisible(cursorBoxes[0].MenuCursor));
AddAssert("Check blue cursor not visible", () => !checkVisible(cursorBoxes[1].Cursor));
AddAssert("Check green cursor not visible", () => !checkVisible(cursorBoxes[0].Cursor));
}
/// <summary>
@ -143,13 +143,13 @@ namespace osu.Game.Tests.Visual.UserInterface
private void testMultipleLocalCursors()
{
AddStep("Move to yellow-purple boundary", () => InputManager.MoveMouseTo(cursorBoxes[5].ScreenSpaceDrawQuad.BottomRight - new Vector2(10)));
AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].MenuCursor));
AddAssert("Check purple cursor at mouse", () => checkAtMouse(cursorBoxes[3].MenuCursor));
AddAssert("Check yellow cursor visible", () => checkVisible(cursorBoxes[5].MenuCursor));
AddAssert("Check yellow cursor at mouse", () => checkAtMouse(cursorBoxes[5].MenuCursor));
AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].Cursor));
AddAssert("Check purple cursor at mouse", () => checkAtMouse(cursorBoxes[3].Cursor));
AddAssert("Check yellow cursor visible", () => checkVisible(cursorBoxes[5].Cursor));
AddAssert("Check yellow cursor at mouse", () => checkAtMouse(cursorBoxes[5].Cursor));
AddStep("Move out", moveOut);
AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].MenuCursor));
AddAssert("Check yellow cursor visible", () => checkVisible(cursorBoxes[5].MenuCursor));
AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].Cursor));
AddAssert("Check yellow cursor visible", () => checkVisible(cursorBoxes[5].Cursor));
}
/// <summary>
@ -159,13 +159,13 @@ namespace osu.Game.Tests.Visual.UserInterface
private void testUserOverrideWithLocal()
{
AddStep("Move to yellow-blue boundary", () => InputManager.MoveMouseTo(cursorBoxes[5].ScreenSpaceDrawQuad.TopRight - new Vector2(10)));
AddAssert("Check blue cursor visible", () => checkVisible(cursorBoxes[1].MenuCursor));
AddAssert("Check blue cursor at mouse", () => checkAtMouse(cursorBoxes[1].MenuCursor));
AddAssert("Check yellow cursor visible", () => checkVisible(cursorBoxes[5].MenuCursor));
AddAssert("Check yellow cursor at mouse", () => checkAtMouse(cursorBoxes[5].MenuCursor));
AddAssert("Check blue cursor visible", () => checkVisible(cursorBoxes[1].Cursor));
AddAssert("Check blue cursor at mouse", () => checkAtMouse(cursorBoxes[1].Cursor));
AddAssert("Check yellow cursor visible", () => checkVisible(cursorBoxes[5].Cursor));
AddAssert("Check yellow cursor at mouse", () => checkAtMouse(cursorBoxes[5].Cursor));
AddStep("Move out", moveOut);
AddAssert("Check blue cursor invisible", () => !checkVisible(cursorBoxes[1].MenuCursor));
AddAssert("Check yellow cursor visible", () => checkVisible(cursorBoxes[5].MenuCursor));
AddAssert("Check blue cursor invisible", () => !checkVisible(cursorBoxes[1].Cursor));
AddAssert("Check yellow cursor visible", () => checkVisible(cursorBoxes[5].Cursor));
}
/// <summary>
@ -191,7 +191,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{
public bool SmoothTransition;
public CursorContainer MenuCursor { get; }
public CursorContainer Cursor { get; }
public bool ProvidingUserCursor { get; }
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) || (SmoothTransition && !ProvidingUserCursor);
@ -218,7 +218,7 @@ namespace osu.Game.Tests.Visual.UserInterface
Origin = Anchor.Centre,
Text = providesUserCursor ? "User cursor" : "Local cursor"
},
MenuCursor = new TestCursorContainer
Cursor = new TestCursorContainer
{
State = { Value = providesUserCursor ? Visibility.Hidden : Visibility.Visible },
}

View File

@ -13,7 +13,7 @@ using osu.Game.Configuration;
namespace osu.Game.Graphics.Cursor
{
/// <summary>
/// A container which provides the main <see cref="Cursor.MenuCursor"/>.
/// A container which provides the main <see cref="MenuCursorContainer"/>.
/// Also handles cases where a more localised cursor is provided by another component (via <see cref="IProvideCursor"/>).
/// </summary>
public class GlobalCursorDisplay : Container, IProvideCursor
@ -23,7 +23,9 @@ namespace osu.Game.Graphics.Cursor
/// </summary>
internal bool ShowCursor = true;
public CursorContainer MenuCursor { get; }
CursorContainer IProvideCursor.Cursor => MenuCursor;
public MenuCursorContainer MenuCursor { get; }
public bool ProvidingUserCursor => true;
@ -42,8 +44,8 @@ namespace osu.Game.Graphics.Cursor
{
AddRangeInternal(new Drawable[]
{
MenuCursor = new MenuCursor { State = { Value = Visibility.Hidden } },
Content = new Container { RelativeSizeAxes = Axes.Both }
Content = new Container { RelativeSizeAxes = Axes.Both },
MenuCursor = new MenuCursorContainer { State = { Value = Visibility.Hidden } }
});
}
@ -64,7 +66,7 @@ namespace osu.Game.Graphics.Cursor
if (!hasValidInput || !ShowCursor)
{
currentOverrideProvider?.MenuCursor?.Hide();
currentOverrideProvider?.Cursor?.Hide();
currentOverrideProvider = null;
return;
}
@ -83,8 +85,8 @@ namespace osu.Game.Graphics.Cursor
if (currentOverrideProvider == newOverrideProvider)
return;
currentOverrideProvider?.MenuCursor?.Hide();
newOverrideProvider.MenuCursor?.Show();
currentOverrideProvider?.Cursor?.Hide();
newOverrideProvider.Cursor?.Show();
currentOverrideProvider = newOverrideProvider;
}

View File

@ -17,10 +17,10 @@ namespace osu.Game.Graphics.Cursor
/// The cursor provided by this <see cref="IDrawable"/>.
/// May be null if no cursor should be visible.
/// </summary>
CursorContainer MenuCursor { get; }
CursorContainer Cursor { get; }
/// <summary>
/// Whether <see cref="MenuCursor"/> should be displayed as the singular user cursor. This will temporarily hide any other user cursor.
/// Whether <see cref="Cursor"/> should be displayed as the singular user cursor. This will temporarily hide any other user cursor.
/// This value is checked every frame and may be used to control whether multiple cursors are displayed (e.g. watching replays).
/// </summary>
bool ProvidingUserCursor { get; }

View File

@ -21,7 +21,7 @@ using osuTK;
namespace osu.Game.Graphics.Cursor
{
public class MenuCursor : CursorContainer
public class MenuCursorContainer : CursorContainer
{
private readonly IBindable<bool> screenshotCursorVisibility = new Bindable<bool>(true);
public override bool IsPresent => screenshotCursorVisibility.Value && base.IsPresent;

View File

@ -384,7 +384,7 @@ namespace osu.Game.Rulesets.UI
// only show the cursor when within the playfield, by default.
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Playfield.ReceivePositionalInputAt(screenSpacePos);
CursorContainer IProvideCursor.MenuCursor => Playfield.Cursor;
CursorContainer IProvideCursor.Cursor => Playfield.Cursor;
public override GameplayCursorContainer Cursor => Playfield.Cursor;

View File

@ -36,7 +36,7 @@ namespace osu.Game.Screens.Utility
public readonly Bindable<LatencyVisualMode> VisualMode = new Bindable<LatencyVisualMode>();
public CursorContainer? MenuCursor { get; private set; }
public CursorContainer? Cursor { get; private set; }
public bool ProvidingUserCursor => IsActiveArea.Value;
@ -91,7 +91,7 @@ namespace osu.Game.Screens.Utility
{
RelativeSizeAxes = Axes.Both,
},
MenuCursor = new LatencyCursorContainer
Cursor = new LatencyCursorContainer
{
RelativeSizeAxes = Axes.Both,
},
@ -105,7 +105,7 @@ namespace osu.Game.Screens.Utility
{
RelativeSizeAxes = Axes.Both,
},
MenuCursor = new LatencyCursorContainer
Cursor = new LatencyCursorContainer
{
RelativeSizeAxes = Axes.Both,
},
@ -119,7 +119,7 @@ namespace osu.Game.Screens.Utility
{
RelativeSizeAxes = Axes.Both,
},
MenuCursor = new LatencyCursorContainer
Cursor = new LatencyCursorContainer
{
RelativeSizeAxes = Axes.Both,
},