mirror of
https://github.com/osukey/osukey.git
synced 2025-05-08 07:07:18 +09:00
Calculate offsets from overlay ScreenSpaceDrawQuad
s instead
This commit is contained in:
parent
19a19f915c
commit
d099bb8ab6
@ -1,12 +1,9 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// 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 NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Settings.Sections.Input;
|
|
||||||
using osu.Game.Tests.Visual.Navigation;
|
using osu.Game.Tests.Visual.Navigation;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Menus
|
namespace osu.Game.Tests.Visual.Menus
|
||||||
@ -32,24 +29,6 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
AddUntilStep("screen offset removed", () => Game.ScreenOffsetContainer.X == 0f);
|
AddUntilStep("screen offset removed", () => Game.ScreenOffsetContainer.X == 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestScreenOffsettingAccountsForKeyBindingPanel()
|
|
||||||
{
|
|
||||||
AddStep("open settings", () => Game.Settings.Show());
|
|
||||||
AddStep("open key binding panel", () => Game.Settings.ChildrenOfType<KeyBindingPanel>().Single().Show());
|
|
||||||
AddUntilStep("right screen offset applied", () => Game.ScreenOffsetContainer.X == SettingsPanel.WIDTH * OsuGame.SCREEN_OFFSET_RATIO);
|
|
||||||
|
|
||||||
AddStep("hide key binding", () => Game.Settings.ChildrenOfType<KeyBindingPanel>().Single().Show());
|
|
||||||
AddUntilStep("right screen offset still applied", () => Game.ScreenOffsetContainer.X == SettingsPanel.WIDTH * OsuGame.SCREEN_OFFSET_RATIO);
|
|
||||||
|
|
||||||
AddStep("open key binding", () => Game.Settings.Show());
|
|
||||||
AddUntilStep("right screen offset still applied", () => Game.ScreenOffsetContainer.X == SettingsPanel.WIDTH * OsuGame.SCREEN_OFFSET_RATIO);
|
|
||||||
|
|
||||||
AddStep("hide settings", () => Game.Settings.Hide());
|
|
||||||
AddAssert("key binding panel still open", () => Game.Settings.ChildrenOfType<KeyBindingPanel>().Single().State.Value == Visibility.Visible);
|
|
||||||
AddUntilStep("screen offset removed", () => Game.ScreenOffsetContainer.X == 0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestScreenOffsettingOnNotificationOverlay()
|
public void TestScreenOffsettingOnNotificationOverlay()
|
||||||
{
|
{
|
||||||
|
@ -1013,9 +1013,10 @@ namespace osu.Game
|
|||||||
ScreenOffsetContainer.Padding = new MarginPadding { Top = ToolbarOffset };
|
ScreenOffsetContainer.Padding = new MarginPadding { Top = ToolbarOffset };
|
||||||
overlayContent.Padding = new MarginPadding { Top = ToolbarOffset };
|
overlayContent.Padding = new MarginPadding { Top = ToolbarOffset };
|
||||||
|
|
||||||
var settingsOffset = Settings.HorizontalScreenOffset * SCREEN_OFFSET_RATIO;
|
ScreenOffsetContainer.X = 0f;
|
||||||
var notificationsOffset = Notifications.HorizontalScreenOffset * SCREEN_OFFSET_RATIO;
|
|
||||||
ScreenOffsetContainer.X = settingsOffset + notificationsOffset;
|
if (Settings.IsLoaded) ScreenOffsetContainer.X += (ToLocalSpace(Settings.ScreenSpaceDrawQuad.TopRight).X) * SCREEN_OFFSET_RATIO;
|
||||||
|
if (Notifications.IsLoaded) ScreenOffsetContainer.X += (ToLocalSpace(Notifications.ScreenSpaceDrawQuad.TopLeft).X - DrawWidth) * SCREEN_OFFSET_RATIO;
|
||||||
|
|
||||||
MenuCursorContainer.CanShowCursor = (ScreenStack.CurrentScreen as IOsuScreen)?.CursorVisible ?? false;
|
MenuCursorContainer.CanShowCursor = (ScreenStack.CurrentScreen as IOsuScreen)?.CursorVisible ?? false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user