1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 13:23:22 +08:00

Close overlays and toolbar on entering the skin editor

This commit is contained in:
Dean Herbert 2022-03-15 18:10:30 +09:00
parent 99e3161cf0
commit 86960c791f
2 changed files with 17 additions and 5 deletions

View File

@ -1184,7 +1184,7 @@ namespace osu.Game
BackButton.Hide();
}
skinEditor.SetTarget((Screen)newScreen);
skinEditor.SetTarget((OsuScreen)newScreen);
}
private void screenPushed(IScreen lastScreen, IScreen newScreen) => screenChanged(lastScreen, newScreen);

View File

@ -3,15 +3,16 @@
using System.Diagnostics;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Screens;
using osu.Game.Graphics.Containers;
using osu.Game.Input.Bindings;
using osu.Game.Screens;
namespace osu.Game.Skinning.Editor
{
@ -28,7 +29,10 @@ namespace osu.Game.Skinning.Editor
public const float VISIBLE_TARGET_SCALE = 0.8f;
private Screen lastTargetScreen;
[Resolved(canBeNull: true)]
private OsuGame game { get; set; }
private OsuScreen lastTargetScreen;
public SkinEditorOverlay(ScalingContainer scalingContainer)
{
@ -105,15 +109,23 @@ namespace osu.Game.Skinning.Editor
private void editorVisibilityChanged(ValueChangedEvent<Visibility> visibility)
{
Debug.Assert(skinEditor != null);
const float toolbar_padding_requirement = 0.18f;
if (visibility.NewValue == Visibility.Visible)
{
scalingContainer.SetCustomRect(new RectangleF(toolbar_padding_requirement, 0.1f, 0.8f - toolbar_padding_requirement, 0.7f), true);
game?.Toolbar.Hide();
game?.CloseAllOverlays();
}
else
{
scalingContainer.SetCustomRect(null);
if (lastTargetScreen?.HideOverlaysOnEnter != true)
game?.Toolbar.Show();
}
}
@ -124,7 +136,7 @@ namespace osu.Game.Skinning.Editor
/// <summary>
/// Set a new target screen which will be used to find skinnable components.
/// </summary>
public void SetTarget(Screen screen)
public void SetTarget(OsuScreen screen)
{
lastTargetScreen = screen;
@ -136,7 +148,7 @@ namespace osu.Game.Skinning.Editor
Scheduler.AddOnce(setTarget, screen);
}
private void setTarget(Screen target)
private void setTarget(OsuScreen target)
{
Debug.Assert(skinEditor != null);