mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Hook up full save/load flow
This commit is contained in:
@ -11,6 +11,8 @@ using osu.Framework.Testing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
|
||||
namespace osu.Game.Skinning.Editor
|
||||
{
|
||||
@ -24,6 +26,9 @@ namespace osu.Game.Skinning.Editor
|
||||
|
||||
protected override bool StartHidden => true;
|
||||
|
||||
[Resolved]
|
||||
private SkinManager skins { get; set; }
|
||||
|
||||
public SkinEditor(Drawable target)
|
||||
{
|
||||
this.target = target;
|
||||
@ -53,7 +58,24 @@ namespace osu.Game.Skinning.Editor
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
RequestPlacement = placeComponent
|
||||
}
|
||||
},
|
||||
new TriangleButton
|
||||
{
|
||||
Text = "Save Changes",
|
||||
Width = 140,
|
||||
Height = 50,
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Top = 10,
|
||||
Left = 10,
|
||||
},
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Right = 10,
|
||||
Bottom = 10,
|
||||
},
|
||||
Action = save,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
@ -71,7 +93,7 @@ namespace osu.Game.Skinning.Editor
|
||||
|
||||
var targetContainer = target.ChildrenOfType<IDefaultSkinnableTarget>().FirstOrDefault();
|
||||
|
||||
targetContainer?.Add(instance);
|
||||
(targetContainer as Container)?.Add(instance);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -80,6 +102,23 @@ namespace osu.Game.Skinning.Editor
|
||||
Show();
|
||||
}
|
||||
|
||||
private void save()
|
||||
{
|
||||
var currentSkin = skins.CurrentSkin.Value;
|
||||
|
||||
var legacySkin = currentSkin as LegacySkin;
|
||||
|
||||
if (legacySkin == null)
|
||||
return;
|
||||
|
||||
SkinnableElementTargetContainer[] targetContainers = target.ChildrenOfType<SkinnableElementTargetContainer>().ToArray();
|
||||
|
||||
foreach (var t in targetContainers)
|
||||
legacySkin.UpdateDrawableTarget(t);
|
||||
|
||||
skins.Save(skins.CurrentSkin.Value);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e) => true;
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e) => true;
|
||||
|
Reference in New Issue
Block a user