mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 10:17:19 +08:00
Merge branch 'master' into editor-regex
This commit is contained in:
commit
7ab12959a0
@ -1,8 +1,12 @@
|
|||||||
// 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;
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Menus
|
namespace osu.Game.Tests.Visual.Menus
|
||||||
@ -21,21 +25,48 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestScreenOffsettingOnSettingsOverlay()
|
public void TestScreenOffsettingOnSettingsOverlay()
|
||||||
{
|
{
|
||||||
AddStep("open settings", () => Game.Settings.Show());
|
foreach (var scalingMode in Enum.GetValues(typeof(ScalingMode)).Cast<ScalingMode>())
|
||||||
AddUntilStep("right screen offset applied", () => Game.ScreenOffsetContainer.X == SettingsPanel.WIDTH * TestOsuGame.SIDE_OVERLAY_OFFSET_RATIO);
|
{
|
||||||
|
AddStep($"set scaling mode to {scalingMode}", () =>
|
||||||
|
{
|
||||||
|
Game.LocalConfig.SetValue(OsuSetting.Scaling, scalingMode);
|
||||||
|
|
||||||
AddStep("hide settings", () => Game.Settings.Hide());
|
if (scalingMode != ScalingMode.Off)
|
||||||
AddUntilStep("screen offset removed", () => Game.ScreenOffsetContainer.X == 0f);
|
{
|
||||||
|
Game.LocalConfig.SetValue(OsuSetting.ScalingSizeX, 0.5f);
|
||||||
|
Game.LocalConfig.SetValue(OsuSetting.ScalingSizeY, 0.5f);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("open settings", () => Game.Settings.Show());
|
||||||
|
AddUntilStep("right screen offset applied", () => Precision.AlmostEquals(Game.ScreenOffsetContainer.X, SettingsPanel.WIDTH * TestOsuGame.SIDE_OVERLAY_OFFSET_RATIO));
|
||||||
|
|
||||||
|
AddStep("hide settings", () => Game.Settings.Hide());
|
||||||
|
AddUntilStep("screen offset removed", () => Game.ScreenOffsetContainer.X == 0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestScreenOffsettingOnNotificationOverlay()
|
public void TestScreenOffsettingOnNotificationOverlay()
|
||||||
{
|
{
|
||||||
AddStep("open notifications", () => Game.Notifications.Show());
|
foreach (var scalingMode in Enum.GetValues(typeof(ScalingMode)).Cast<ScalingMode>())
|
||||||
AddUntilStep("right screen offset applied", () => Game.ScreenOffsetContainer.X == -NotificationOverlay.WIDTH * TestOsuGame.SIDE_OVERLAY_OFFSET_RATIO);
|
{
|
||||||
|
if (scalingMode != ScalingMode.Off)
|
||||||
|
{
|
||||||
|
AddStep($"set scaling mode to {scalingMode}", () =>
|
||||||
|
{
|
||||||
|
Game.LocalConfig.SetValue(OsuSetting.Scaling, scalingMode);
|
||||||
|
Game.LocalConfig.SetValue(OsuSetting.ScalingSizeX, 0.5f);
|
||||||
|
Game.LocalConfig.SetValue(OsuSetting.ScalingSizeY, 0.5f);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
AddStep("hide notifications", () => Game.Notifications.Hide());
|
AddStep("open notifications", () => Game.Notifications.Show());
|
||||||
AddUntilStep("screen offset removed", () => Game.ScreenOffsetContainer.X == 0f);
|
AddUntilStep("right screen offset applied", () => Precision.AlmostEquals(Game.ScreenOffsetContainer.X, -NotificationOverlay.WIDTH * TestOsuGame.SIDE_OVERLAY_OFFSET_RATIO));
|
||||||
|
|
||||||
|
AddStep("hide notifications", () => Game.Notifications.Hide());
|
||||||
|
AddUntilStep("screen offset removed", () => Game.ScreenOffsetContainer.X == 0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1018,10 +1018,13 @@ namespace osu.Game
|
|||||||
|
|
||||||
var horizontalOffset = 0f;
|
var horizontalOffset = 0f;
|
||||||
|
|
||||||
|
// Content.ToLocalSpace() is used instead of this.ToLocalSpace() to correctly calculate the offset with scaling modes active.
|
||||||
|
// Content is a child of a scaling container with ScalingMode.Everything set, while the game itself is never scaled.
|
||||||
|
// this avoids a visible jump in the positioning of the screen offset container.
|
||||||
if (Settings.IsLoaded && Settings.IsPresent)
|
if (Settings.IsLoaded && Settings.IsPresent)
|
||||||
horizontalOffset += ToLocalSpace(Settings.ScreenSpaceDrawQuad.TopRight).X * SIDE_OVERLAY_OFFSET_RATIO;
|
horizontalOffset += Content.ToLocalSpace(Settings.ScreenSpaceDrawQuad.TopRight).X * SIDE_OVERLAY_OFFSET_RATIO;
|
||||||
if (Notifications.IsLoaded && Notifications.IsPresent)
|
if (Notifications.IsLoaded && Notifications.IsPresent)
|
||||||
horizontalOffset += (ToLocalSpace(Notifications.ScreenSpaceDrawQuad.TopLeft).X - DrawWidth) * SIDE_OVERLAY_OFFSET_RATIO;
|
horizontalOffset += (Content.ToLocalSpace(Notifications.ScreenSpaceDrawQuad.TopLeft).X - Content.DrawWidth) * SIDE_OVERLAY_OFFSET_RATIO;
|
||||||
|
|
||||||
ScreenOffsetContainer.X = horizontalOffset;
|
ScreenOffsetContainer.X = horizontalOffset;
|
||||||
|
|
||||||
|
@ -110,15 +110,15 @@ namespace osu.Game.Overlays.Chat
|
|||||||
EdgeEffect = new EdgeEffectParameters
|
EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Roundness = 1,
|
Roundness = 1,
|
||||||
Offset = new Vector2(0, 3),
|
Radius = 1,
|
||||||
Radius = 3,
|
|
||||||
Colour = Color4.Black.Opacity(0.3f),
|
Colour = Color4.Black.Opacity(0.3f),
|
||||||
|
Offset = new Vector2(0, 1),
|
||||||
Type = EdgeEffectType.Shadow,
|
Type = EdgeEffectType.Shadow,
|
||||||
},
|
},
|
||||||
Child = new Container
|
Child = new Container
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Y = 3,
|
Y = 0,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
CornerRadius = 4,
|
CornerRadius = 4,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
|
@ -47,7 +47,6 @@ namespace osu.Game.Overlays.Settings
|
|||||||
|
|
||||||
protected SettingsSection()
|
protected SettingsSection()
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = margin };
|
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
@ -80,7 +79,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Top = margin + border_size,
|
Top = margin + border_size,
|
||||||
Bottom = 10,
|
Bottom = margin + 10,
|
||||||
},
|
},
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
@ -5,6 +5,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Screens.OnlinePlay.Match.Components;
|
using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
@ -38,6 +39,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
Textbox.FocusLost = () => expandedFromTextboxFocus.Value = false;
|
Textbox.FocusLost = () => expandedFromTextboxFocus.Value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e) => true; // use UI mouse cursor.
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user