mirror of
https://github.com/ppy/osu
synced 2024-12-24 15:53:37 +00:00
Merge pull request #13948 from peppy/skin-editor-button-access
Add the ability to enter and exit the skin editor via on-screen buttons
This commit is contained in:
commit
b650d0d17c
@ -757,7 +757,7 @@ namespace osu.Game
|
||||
loadComponentSingleFile(userProfile = new UserProfileOverlay(), overlayContent.Add, true);
|
||||
loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay(), overlayContent.Add, true);
|
||||
loadComponentSingleFile(wikiOverlay = new WikiOverlay(), overlayContent.Add, true);
|
||||
loadComponentSingleFile(skinEditor = new SkinEditorOverlay(screenContainer), overlayContent.Add);
|
||||
loadComponentSingleFile(skinEditor = new SkinEditorOverlay(screenContainer), overlayContent.Add, true);
|
||||
|
||||
loadComponentSingleFile(new LoginOverlay
|
||||
{
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -13,6 +14,7 @@ using osu.Framework.Logging;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Skinning.Editor;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections
|
||||
@ -57,14 +59,19 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
private IBindable<WeakReference<SkinInfo>> managerUpdated;
|
||||
private IBindable<WeakReference<SkinInfo>> managerRemoved;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuConfigManager config, [CanBeNull] SkinEditorOverlay skinEditor)
|
||||
{
|
||||
FlowContent.Spacing = new Vector2(0, 5);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
skinDropdown = new SkinSettingsDropdown(),
|
||||
new SettingsButton
|
||||
{
|
||||
Text = "Skin layout editor",
|
||||
Action = () => skinEditor?.Toggle(),
|
||||
},
|
||||
new ExportSkinButton(),
|
||||
new SettingsSlider<float, SizeSlider>
|
||||
{
|
||||
|
@ -14,6 +14,7 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning.Editor
|
||||
@ -88,6 +89,13 @@ namespace osu.Game.Skinning.Editor
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SkinBlueprintContainer(targetScreen),
|
||||
new TriangleButton
|
||||
{
|
||||
Margin = new MarginPadding(10),
|
||||
Text = CommonStrings.ButtonsClose,
|
||||
Width = 100,
|
||||
Action = Hide,
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Direction = FillDirection.Horizontal,
|
||||
|
@ -37,29 +37,46 @@ namespace osu.Game.Skinning.Editor
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.Back:
|
||||
if (skinEditor?.State.Value == Visibility.Visible)
|
||||
{
|
||||
skinEditor.ToggleVisibility();
|
||||
return true;
|
||||
}
|
||||
if (skinEditor?.State.Value != Visibility.Visible)
|
||||
break;
|
||||
|
||||
break;
|
||||
Hide();
|
||||
return true;
|
||||
|
||||
case GlobalAction.ToggleSkinEditor:
|
||||
if (skinEditor == null)
|
||||
{
|
||||
LoadComponentAsync(skinEditor = new SkinEditor(target), AddInternal);
|
||||
skinEditor.State.BindValueChanged(editorVisibilityChanged);
|
||||
}
|
||||
else
|
||||
skinEditor.ToggleVisibility();
|
||||
|
||||
Toggle();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
if (skinEditor == null)
|
||||
Show();
|
||||
else
|
||||
skinEditor.ToggleVisibility();
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
// base call intentionally omitted.
|
||||
skinEditor.Hide();
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
// base call intentionally omitted.
|
||||
if (skinEditor == null)
|
||||
{
|
||||
LoadComponentAsync(skinEditor = new SkinEditor(target), AddInternal);
|
||||
skinEditor.State.BindValueChanged(editorVisibilityChanged);
|
||||
}
|
||||
else
|
||||
skinEditor.Show();
|
||||
}
|
||||
|
||||
private void editorVisibilityChanged(ValueChangedEvent<Visibility> visibility)
|
||||
{
|
||||
if (visibility.NewValue == Visibility.Visible)
|
||||
|
Loading…
Reference in New Issue
Block a user