mirror of
https://github.com/osukey/osukey.git
synced 2025-06-29 23:28:00 +09:00
Merge pull request #2637 from HoutarouOreki/CursorOverrideContainer-rename
Rename CursorOverrideContainer to MenuCursorContainer
This commit is contained in:
commit
18c3339cd2
@ -19,12 +19,12 @@ namespace osu.Game.Tests.Visual
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestCaseCursors : ManualInputManagerTestCase
|
public class TestCaseCursors : ManualInputManagerTestCase
|
||||||
{
|
{
|
||||||
private readonly CursorOverrideContainer cursorOverrideContainer;
|
private readonly MenuCursorContainer menuCursorContainer;
|
||||||
private readonly CustomCursorBox[] cursorBoxes = new CustomCursorBox[6];
|
private readonly CustomCursorBox[] cursorBoxes = new CustomCursorBox[6];
|
||||||
|
|
||||||
public TestCaseCursors()
|
public TestCaseCursors()
|
||||||
{
|
{
|
||||||
Child = cursorOverrideContainer = new CursorOverrideContainer
|
Child = menuCursorContainer = new MenuCursorContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddAssert("Check green cursor at mouse", () => checkAtMouse(cursorBoxes[0].Cursor));
|
AddAssert("Check green cursor at mouse", () => checkAtMouse(cursorBoxes[0].Cursor));
|
||||||
AddStep("Move out", moveOut);
|
AddStep("Move out", moveOut);
|
||||||
AddAssert("Check green cursor invisible", () => !checkVisible(cursorBoxes[0].Cursor));
|
AddAssert("Check green cursor invisible", () => !checkVisible(cursorBoxes[0].Cursor));
|
||||||
AddAssert("Check global cursor visible", () => checkVisible(cursorOverrideContainer.Cursor));
|
AddAssert("Check global cursor visible", () => checkVisible(menuCursorContainer.Cursor));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -112,11 +112,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddStep("Move to purple area", () => InputManager.MoveMouseTo(cursorBoxes[3]));
|
AddStep("Move to purple area", () => InputManager.MoveMouseTo(cursorBoxes[3]));
|
||||||
AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].Cursor));
|
AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].Cursor));
|
||||||
AddAssert("Check purple cursor at mouse", () => checkAtMouse(cursorBoxes[3].Cursor));
|
AddAssert("Check purple cursor at mouse", () => checkAtMouse(cursorBoxes[3].Cursor));
|
||||||
AddAssert("Check global cursor visible", () => checkVisible(cursorOverrideContainer.Cursor));
|
AddAssert("Check global cursor visible", () => checkVisible(menuCursorContainer.Cursor));
|
||||||
AddAssert("Check global cursor at mouse", () => checkAtMouse(cursorOverrideContainer.Cursor));
|
AddAssert("Check global cursor at mouse", () => checkAtMouse(menuCursorContainer.Cursor));
|
||||||
AddStep("Move out", moveOut);
|
AddStep("Move out", moveOut);
|
||||||
AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].Cursor));
|
AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].Cursor));
|
||||||
AddAssert("Check global cursor visible", () => checkVisible(cursorOverrideContainer.Cursor));
|
AddAssert("Check global cursor visible", () => checkVisible(menuCursorContainer.Cursor));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A container which provides a <see cref="MenuCursor"/> which can be overridden by hovered <see cref="Drawable"/>s.
|
/// A container which provides a <see cref="MenuCursor"/> which can be overridden by hovered <see cref="Drawable"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CursorOverrideContainer : Container, IProvideCursor
|
public class MenuCursorContainer : Container, IProvideCursor
|
||||||
{
|
{
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
@ -25,7 +25,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
public CursorContainer Cursor { get; }
|
public CursorContainer Cursor { get; }
|
||||||
public bool ProvidingUserCursor => true;
|
public bool ProvidingUserCursor => true;
|
||||||
|
|
||||||
public CursorOverrideContainer()
|
public MenuCursorContainer()
|
||||||
{
|
{
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
@ -212,7 +212,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
// this needs to be cached before base.LoadComplete as it is used by CursorOverrideContainer.
|
// this needs to be cached before base.LoadComplete as it is used by MenuCursorContainer.
|
||||||
dependencies.Cache(screenshotManager = new ScreenshotManager());
|
dependencies.Cache(screenshotManager = new ScreenshotManager());
|
||||||
|
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -220,7 +220,7 @@ namespace osu.Game
|
|||||||
// The next time this is updated is in UpdateAfterChildren, which occurs too late and results
|
// The next time this is updated is in UpdateAfterChildren, which occurs too late and results
|
||||||
// in the cursor being shown for a few frames during the intro.
|
// in the cursor being shown for a few frames during the intro.
|
||||||
// This prevents the cursor from showing until we have a screen with CursorVisible = true
|
// This prevents the cursor from showing until we have a screen with CursorVisible = true
|
||||||
CursorOverrideContainer.CanShowCursor = currentScreen?.CursorVisible ?? false;
|
MenuCursorContainer.CanShowCursor = currentScreen?.CursorVisible ?? false;
|
||||||
|
|
||||||
// hook up notifications to components.
|
// hook up notifications to components.
|
||||||
SkinManager.PostNotification = n => notifications?.Post(n);
|
SkinManager.PostNotification = n => notifications?.Post(n);
|
||||||
@ -548,7 +548,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
mainContent.Padding = new MarginPadding { Top = ToolbarOffset };
|
mainContent.Padding = new MarginPadding { Top = ToolbarOffset };
|
||||||
|
|
||||||
CursorOverrideContainer.CanShowCursor = currentScreen?.CursorVisible ?? false;
|
MenuCursorContainer.CanShowCursor = currentScreen?.CursorVisible ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void screenAdded(Screen newScreen)
|
private void screenAdded(Screen newScreen)
|
||||||
|
@ -57,7 +57,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
protected SettingsStore SettingsStore;
|
protected SettingsStore SettingsStore;
|
||||||
|
|
||||||
protected CursorOverrideContainer CursorOverrideContainer;
|
protected MenuCursorContainer MenuCursorContainer;
|
||||||
|
|
||||||
protected override string MainResourceFile => @"osu.Game.Resources.dll";
|
protected override string MainResourceFile => @"osu.Game.Resources.dll";
|
||||||
|
|
||||||
@ -191,14 +191,14 @@ namespace osu.Game
|
|||||||
|
|
||||||
GlobalActionContainer globalBinding;
|
GlobalActionContainer globalBinding;
|
||||||
|
|
||||||
CursorOverrideContainer = new CursorOverrideContainer { RelativeSizeAxes = Axes.Both };
|
MenuCursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both };
|
||||||
CursorOverrideContainer.Child = globalBinding = new GlobalActionContainer(this)
|
MenuCursorContainer.Child = globalBinding = new GlobalActionContainer(this)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = content = new OsuTooltipContainer(CursorOverrideContainer.Cursor) { RelativeSizeAxes = Axes.Both }
|
Child = content = new OsuTooltipContainer(MenuCursorContainer.Cursor) { RelativeSizeAxes = Axes.Both }
|
||||||
};
|
};
|
||||||
|
|
||||||
base.Content.Add(new DrawSizePreservingFillContainer { Child = CursorOverrideContainer });
|
base.Content.Add(new DrawSizePreservingFillContainer { Child = MenuCursorContainer });
|
||||||
|
|
||||||
KeyBindingStore.Register(globalBinding);
|
KeyBindingStore.Register(globalBinding);
|
||||||
dependencies.Cache(globalBinding);
|
dependencies.Cache(globalBinding);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user