mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 00:12:55 +08:00
Fix SkinEditor
's initial target not being a Screen
This commit is contained in:
parent
7e8aa77b2b
commit
99e3161cf0
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -49,16 +48,20 @@ namespace osu.Game.Skinning.Editor
|
|||||||
|
|
||||||
private EditorToolboxGroup settingsToolbox;
|
private EditorToolboxGroup settingsToolbox;
|
||||||
|
|
||||||
|
public SkinEditor()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public SkinEditor(Drawable targetScreen)
|
public SkinEditor(Drawable targetScreen)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
|
|
||||||
UpdateTargetScreen(targetScreen);
|
UpdateTargetScreen(targetScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
InternalChild = new OsuContextMenuContainer
|
InternalChild = new OsuContextMenuContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -155,7 +158,7 @@ namespace osu.Game.Skinning.Editor
|
|||||||
Scheduler.AddOnce(skinChanged);
|
Scheduler.AddOnce(skinChanged);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
SelectedComponents.BindCollectionChanged(selectionChanged);
|
SelectedComponents.BindCollectionChanged((_, __) => Scheduler.AddOnce(populateSettings), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateTargetScreen(Drawable targetScreen)
|
public void UpdateTargetScreen(Drawable targetScreen)
|
||||||
@ -163,6 +166,7 @@ namespace osu.Game.Skinning.Editor
|
|||||||
this.targetScreen = targetScreen;
|
this.targetScreen = targetScreen;
|
||||||
|
|
||||||
SelectedComponents.Clear();
|
SelectedComponents.Clear();
|
||||||
|
|
||||||
Scheduler.AddOnce(loadBlueprintContainer);
|
Scheduler.AddOnce(loadBlueprintContainer);
|
||||||
|
|
||||||
void loadBlueprintContainer()
|
void loadBlueprintContainer()
|
||||||
@ -224,7 +228,7 @@ namespace osu.Game.Skinning.Editor
|
|||||||
SelectedComponents.Add(component);
|
SelectedComponents.Add(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
private void populateSettings()
|
||||||
{
|
{
|
||||||
settingsToolbox.Clear();
|
settingsToolbox.Clear();
|
||||||
|
|
||||||
|
@ -21,16 +21,18 @@ namespace osu.Game.Skinning.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class SkinEditorOverlay : CompositeDrawable, IKeyBindingHandler<GlobalAction>
|
public class SkinEditorOverlay : CompositeDrawable, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
private readonly ScalingContainer target;
|
private readonly ScalingContainer scalingContainer;
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private SkinEditor skinEditor;
|
private SkinEditor skinEditor;
|
||||||
|
|
||||||
public const float VISIBLE_TARGET_SCALE = 0.8f;
|
public const float VISIBLE_TARGET_SCALE = 0.8f;
|
||||||
|
|
||||||
public SkinEditorOverlay(ScalingContainer target)
|
private Screen lastTargetScreen;
|
||||||
|
|
||||||
|
public SkinEditorOverlay(ScalingContainer scalingContainer)
|
||||||
{
|
{
|
||||||
this.target = target;
|
this.scalingContainer = scalingContainer;
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +79,7 @@ namespace osu.Game.Skinning.Editor
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var editor = new SkinEditor(target);
|
var editor = new SkinEditor();
|
||||||
editor.State.BindValueChanged(editorVisibilityChanged);
|
editor.State.BindValueChanged(editorVisibilityChanged);
|
||||||
|
|
||||||
skinEditor = editor;
|
skinEditor = editor;
|
||||||
@ -95,6 +97,8 @@ namespace osu.Game.Skinning.Editor
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
AddInternal(editor);
|
AddInternal(editor);
|
||||||
|
|
||||||
|
SetTarget(lastTargetScreen);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -105,11 +109,11 @@ namespace osu.Game.Skinning.Editor
|
|||||||
|
|
||||||
if (visibility.NewValue == Visibility.Visible)
|
if (visibility.NewValue == Visibility.Visible)
|
||||||
{
|
{
|
||||||
target.SetCustomRect(new RectangleF(toolbar_padding_requirement, 0.1f, 0.8f - toolbar_padding_requirement, 0.7f), true);
|
scalingContainer.SetCustomRect(new RectangleF(toolbar_padding_requirement, 0.1f, 0.8f - toolbar_padding_requirement, 0.7f), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
target.SetCustomRect(null);
|
scalingContainer.SetCustomRect(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,6 +126,8 @@ namespace osu.Game.Skinning.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetTarget(Screen screen)
|
public void SetTarget(Screen screen)
|
||||||
{
|
{
|
||||||
|
lastTargetScreen = screen;
|
||||||
|
|
||||||
if (skinEditor == null) return;
|
if (skinEditor == null) return;
|
||||||
|
|
||||||
skinEditor.Save();
|
skinEditor.Save();
|
||||||
|
Loading…
Reference in New Issue
Block a user