mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:57:52 +08:00
Convert top level skin editor layout to use grid container
Fix `SkinEditor`'s initial target not being a `Screen`
This commit is contained in:
parent
4525ed645c
commit
54e351efe9
@ -17,7 +17,6 @@ using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Screens.Edit.Components;
|
||||
using osu.Game.Screens.Edit.Components.Menus;
|
||||
|
||||
@ -51,7 +50,7 @@ namespace osu.Game.Skinning.Editor
|
||||
|
||||
private Container content;
|
||||
|
||||
private EditorToolboxGroup settingsToolbox;
|
||||
private EditorSidebarSection settingsToolbox;
|
||||
|
||||
public SkinEditor()
|
||||
{
|
||||
@ -72,92 +71,111 @@ namespace osu.Game.Skinning.Editor
|
||||
InternalChild = new OsuContextMenuContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
Child = new GridContainer
|
||||
{
|
||||
new Container
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RowDimensions = new[]
|
||||
{
|
||||
Name = "Menu container",
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Depth = float.MinValue,
|
||||
Height = menu_height,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new EditorMenuBar
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Items = new[]
|
||||
{
|
||||
new MenuItem("File")
|
||||
{
|
||||
Items = new[]
|
||||
{
|
||||
new EditorMenuItem("Save", MenuItemType.Standard, Save),
|
||||
new EditorMenuItem("Revert to default", MenuItemType.Destructive, revert),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Exit", MenuItemType.Standard, Hide),
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
headerText = new OsuTextFlowContainer
|
||||
{
|
||||
TextAnchor = Anchor.TopRight,
|
||||
Padding = new MarginPadding(5),
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
AutoSizeAxes = Axes.X,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
},
|
||||
},
|
||||
},
|
||||
new SkinEditorSceneLibrary
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Y = menu_height,
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension(),
|
||||
},
|
||||
|
||||
new GridContainer
|
||||
Content = new[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ColumnDimensions = new[]
|
||||
new Drawable[]
|
||||
{
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
},
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
new Container
|
||||
{
|
||||
new EditorSidebar
|
||||
Name = "Menu container",
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Depth = float.MinValue,
|
||||
Height = menu_height,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Children = new[]
|
||||
new EditorMenuBar
|
||||
{
|
||||
new SkinComponentToolbox
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Items = new[]
|
||||
{
|
||||
RequestPlacement = placeComponent
|
||||
new MenuItem("File")
|
||||
{
|
||||
Items = new[]
|
||||
{
|
||||
new EditorMenuItem("Save", MenuItemType.Standard, Save),
|
||||
new EditorMenuItem("Revert to default", MenuItemType.Destructive, revert),
|
||||
new EditorMenuItemSpacer(),
|
||||
new EditorMenuItem("Exit", MenuItemType.Standard, Hide),
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
headerText = new OsuTextFlowContainer
|
||||
{
|
||||
TextAnchor = Anchor.TopRight,
|
||||
Padding = new MarginPadding(5),
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
AutoSizeAxes = Axes.X,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
new SkinEditorSceneLibrary
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
},
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ColumnDimensions = new[]
|
||||
{
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
},
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
new EditorSidebar
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new SkinComponentToolbox
|
||||
{
|
||||
RequestPlacement = placeComponent
|
||||
},
|
||||
}
|
||||
},
|
||||
content = new Container
|
||||
{
|
||||
Depth = float.MaxValue,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new EditorSidebar
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
settingsToolbox = new SkinSettingsToolbox
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new EditorSidebar
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
settingsToolbox = new SkinSettingsToolbox
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -191,17 +209,9 @@ namespace osu.Game.Skinning.Editor
|
||||
SelectedComponents.Clear();
|
||||
|
||||
Scheduler.AddOnce(loadBlueprintContainer);
|
||||
Scheduler.AddOnce(populateSettings);
|
||||
|
||||
void loadBlueprintContainer()
|
||||
{
|
||||
content.Children = new Drawable[]
|
||||
{
|
||||
new SkinBlueprintContainer(targetScreen)
|
||||
{
|
||||
Margin = new MarginPadding { Top = 100 },
|
||||
}
|
||||
};
|
||||
}
|
||||
void loadBlueprintContainer() => content.Child = new SkinBlueprintContainer(targetScreen);
|
||||
}
|
||||
|
||||
private void skinChanged()
|
||||
|
Loading…
Reference in New Issue
Block a user