From 603527d72d09eaf0e727cf075e98fb9cdc78d51c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 16 Mar 2022 18:38:01 +0900 Subject: [PATCH 01/13] Fix potential crash when highlighting chat messages Test failed locally in `TestPublicChannelMention`. This test seems to specify that the same message may arrive twice with the same ID, so rather than overthinking this one I propose we just use `FirstOrDefault`. ```csharp TearDown : System.AggregateException : One or more errors occurred. (Sequence contains more than one matching element) ----> System.InvalidOperationException : Sequence contains more than one matching element --TearDown at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at osu.Framework.Extensions.TaskExtensions.WaitSafely(Task task) at osu.Framework.Testing.TestScene.checkForErrors() --InvalidOperationException at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException() at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found) at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) at osu.Game.Overlays.Chat.DrawableChannel.b__14_0() in /Users/dean/Projects/osu/osu.Game/Overlays/Chat/DrawableChannel.cs:line 102 at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal() ``` --- osu.Game/Overlays/Chat/DrawableChannel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index 632517aa31..161fe1d5be 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -99,7 +99,7 @@ namespace osu.Game.Overlays.Chat if (highlightedMessage.Value == null) return; - var chatLine = chatLines.SingleOrDefault(c => c.Message.Equals(highlightedMessage.Value)); + var chatLine = chatLines.FirstOrDefault(c => c.Message.Equals(highlightedMessage.Value)); if (chatLine == null) return; From 2452d84e98fab4a975caef4af19fac619143047d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 16 Mar 2022 18:44:30 +0900 Subject: [PATCH 02/13] Add missing `Schedule` call to allow individual tests from `TestSceneMessageNotifier` to pass --- osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs index 175d2ea36b..2c253650d5 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs @@ -30,7 +30,7 @@ namespace osu.Game.Tests.Visual.Online private int messageIdCounter; [SetUp] - public void Setup() + public void Setup() => Schedule(() => { if (API is DummyAPIAccess daa) { @@ -50,7 +50,7 @@ namespace osu.Game.Tests.Visual.Online testContainer.ChatOverlay.Show(); }); - } + }); private bool dummyAPIHandleRequest(APIRequest request) { From 99e3161cf0a40e6e6bfc70d201a967df29f2bcf2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 15 Mar 2022 18:00:32 +0900 Subject: [PATCH 03/13] Fix `SkinEditor`'s initial target not being a `Screen` --- osu.Game/Skinning/Editor/SkinEditor.cs | 14 +++++++++----- osu.Game/Skinning/Editor/SkinEditorOverlay.cs | 18 ++++++++++++------ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index ef26682c03..19c39d23d5 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Collections.Specialized; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -49,16 +48,20 @@ namespace osu.Game.Skinning.Editor private EditorToolboxGroup settingsToolbox; + public SkinEditor() + { + } + public SkinEditor(Drawable targetScreen) { - RelativeSizeAxes = Axes.Both; - UpdateTargetScreen(targetScreen); } [BackgroundDependencyLoader] private void load() { + RelativeSizeAxes = Axes.Both; + InternalChild = new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, @@ -155,7 +158,7 @@ namespace osu.Game.Skinning.Editor Scheduler.AddOnce(skinChanged); }, true); - SelectedComponents.BindCollectionChanged(selectionChanged); + SelectedComponents.BindCollectionChanged((_, __) => Scheduler.AddOnce(populateSettings), true); } public void UpdateTargetScreen(Drawable targetScreen) @@ -163,6 +166,7 @@ namespace osu.Game.Skinning.Editor this.targetScreen = targetScreen; SelectedComponents.Clear(); + Scheduler.AddOnce(loadBlueprintContainer); void loadBlueprintContainer() @@ -224,7 +228,7 @@ namespace osu.Game.Skinning.Editor SelectedComponents.Add(component); } - private void selectionChanged(object sender, NotifyCollectionChangedEventArgs e) + private void populateSettings() { settingsToolbox.Clear(); diff --git a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs index 08cdbf0aa9..1bab499979 100644 --- a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs +++ b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs @@ -21,16 +21,18 @@ namespace osu.Game.Skinning.Editor /// public class SkinEditorOverlay : CompositeDrawable, IKeyBindingHandler { - private readonly ScalingContainer target; + private readonly ScalingContainer scalingContainer; [CanBeNull] private SkinEditor skinEditor; 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; } @@ -77,7 +79,7 @@ namespace osu.Game.Skinning.Editor return; } - var editor = new SkinEditor(target); + var editor = new SkinEditor(); editor.State.BindValueChanged(editorVisibilityChanged); skinEditor = editor; @@ -95,6 +97,8 @@ namespace osu.Game.Skinning.Editor return; AddInternal(editor); + + SetTarget(lastTargetScreen); }); }); } @@ -105,11 +109,11 @@ namespace osu.Game.Skinning.Editor 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 { - target.SetCustomRect(null); + scalingContainer.SetCustomRect(null); } } @@ -122,6 +126,8 @@ namespace osu.Game.Skinning.Editor /// public void SetTarget(Screen screen) { + lastTargetScreen = screen; + if (skinEditor == null) return; skinEditor.Save(); From 86960c791f783c614ada963bc105f065f42e3cfb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 15 Mar 2022 18:10:30 +0900 Subject: [PATCH 04/13] Close overlays and toolbar on entering the skin editor --- osu.Game/OsuGame.cs | 2 +- osu.Game/Skinning/Editor/SkinEditorOverlay.cs | 20 +++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index ae117d03d2..25bd3d71de 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -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); diff --git a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs index 1bab499979..2fdb16abfc 100644 --- a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs +++ b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs @@ -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) { + 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 /// /// Set a new target screen which will be used to find skinnable components. /// - 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); From c807ad7e4ee131563ed45079bfde1e00d4226ae3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 16 Mar 2022 19:11:17 +0900 Subject: [PATCH 05/13] Ensure toolbar is hidden even when the active screen is changed while the editor is open --- osu.Game/Skinning/Editor/SkinEditorOverlay.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs index 2fdb16abfc..780e3d5b67 100644 --- a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs +++ b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs @@ -4,7 +4,6 @@ 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; @@ -84,7 +83,7 @@ namespace osu.Game.Skinning.Editor } var editor = new SkinEditor(); - editor.State.BindValueChanged(editorVisibilityChanged); + editor.State.BindValueChanged(visibility => updateComponentVisibility()); skinEditor = editor; @@ -107,13 +106,13 @@ namespace osu.Game.Skinning.Editor }); } - private void editorVisibilityChanged(ValueChangedEvent visibility) + private void updateComponentVisibility() { Debug.Assert(skinEditor != null); const float toolbar_padding_requirement = 0.18f; - if (visibility.NewValue == Visibility.Visible) + if (skinEditor.State.Value == Visibility.Visible) { scalingContainer.SetCustomRect(new RectangleF(toolbar_padding_requirement, 0.1f, 0.8f - toolbar_padding_requirement, 0.7f), true); @@ -144,6 +143,9 @@ namespace osu.Game.Skinning.Editor skinEditor.Save(); + // ensure the toolbar is re-hidden even if a new screen decides to try and show it. + updateComponentVisibility(); + // AddOnce with parameter will ensure the newest target is loaded if there is any overlap. Scheduler.AddOnce(setTarget, screen); } From d062810ff2b4c04019f2523faa58e2d3cecca758 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 11 Mar 2022 23:30:46 +0900 Subject: [PATCH 06/13] Add basic scene selector --- .../Visual/Gameplay/TestSceneSkinEditor.cs | 2 +- osu.Game/Skinning/Editor/SkinEditor.cs | 53 +++++++++++++++++++ osu.Game/Skinning/Editor/SkinEditorOverlay.cs | 2 +- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs index a0602e21b9..9012492028 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Gameplay AddStep("reload skin editor", () => { skinEditor?.Expire(); - Player.ScaleTo(SkinEditorOverlay.VISIBLE_TARGET_SCALE); + Player.ScaleTo(0.8f); LoadComponentAsync(skinEditor = new SkinEditor(Player), Add); }); } diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index 19c39d23d5..37900d9920 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -10,14 +10,20 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; +using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; +using osu.Game.Rulesets; using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit.Components.Menus; +using osu.Game.Screens.OnlinePlay.Match.Components; +using osu.Game.Screens.Play; +using osu.Game.Screens.Select; +using osuTK; namespace osu.Game.Skinning.Editor { @@ -42,6 +48,12 @@ namespace osu.Game.Skinning.Editor [Resolved] private OsuColour colours { get; set; } + [Resolved] + private IBindable ruleset { get; set; } + + [Resolved(canBeNull: true)] + private OsuGame game { get; set; } + private bool hasBegunMutating; private Container content; @@ -105,6 +117,47 @@ namespace osu.Game.Skinning.Editor }, }, }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + Y = 45, + Height = 30, + Name = "Scene library", + Spacing = new Vector2(10), + Padding = new MarginPadding(10), + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + new PurpleTriangleButton + { + Text = "Song Select", + Width = 100, + Height = 30, + Action = () => game?.PerformFromScreen(screen => + { + if (screen is SongSelect) + return; + + screen.Push(new PlaySongSelect()); + }, new[] { typeof(SongSelect) }) + }, + new PurpleTriangleButton + { + Text = "Gameplay", + Width = 100, + Height = 30, + Action = () => game?.PerformFromScreen(screen => + { + if (screen is Player) + return; + + var replayGeneratingMod = ruleset.Value.CreateInstance().GetAutoplayMod(); + if (replayGeneratingMod != null) + screen.Push(new ReplayPlayer((beatmap, mods) => replayGeneratingMod.CreateReplayScore(beatmap, mods))); + }, new[] { typeof(Player) }) + }, + } + }, new GridContainer { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs index 780e3d5b67..9fc233d3e3 100644 --- a/osu.Game/Skinning/Editor/SkinEditorOverlay.cs +++ b/osu.Game/Skinning/Editor/SkinEditorOverlay.cs @@ -114,7 +114,7 @@ namespace osu.Game.Skinning.Editor if (skinEditor.State.Value == Visibility.Visible) { - scalingContainer.SetCustomRect(new RectangleF(toolbar_padding_requirement, 0.1f, 0.8f - toolbar_padding_requirement, 0.7f), true); + scalingContainer.SetCustomRect(new RectangleF(toolbar_padding_requirement, 0.2f, 0.8f - toolbar_padding_requirement, 0.7f), true); game?.Toolbar.Hide(); game?.CloseAllOverlays(); From 8d85723a62f1e0ad3f0d6b9e2e2480ce877b0b72 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 7 Mar 2022 19:23:57 +0900 Subject: [PATCH 07/13] Split out `SceneLibrary` into its own component --- osu.Game/Skinning/Editor/SkinEditor.cs | 126 ++++++++++++++++--------- 1 file changed, 82 insertions(+), 44 deletions(-) diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index 37900d9920..9d5d496837 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -6,8 +6,10 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Framework.Screens; @@ -24,6 +26,7 @@ using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Screens.Play; using osu.Game.Screens.Select; using osuTK; +using osuTK.Graphics; namespace osu.Game.Skinning.Editor { @@ -48,12 +51,6 @@ namespace osu.Game.Skinning.Editor [Resolved] private OsuColour colours { get; set; } - [Resolved] - private IBindable ruleset { get; set; } - - [Resolved(canBeNull: true)] - private OsuGame game { get; set; } - private bool hasBegunMutating; private Container content; @@ -117,47 +114,12 @@ namespace osu.Game.Skinning.Editor }, }, }, - new FillFlowContainer + new SceneLibrary { RelativeSizeAxes = Axes.X, Y = 45, - Height = 30, - Name = "Scene library", - Spacing = new Vector2(10), - Padding = new MarginPadding(10), - Direction = FillDirection.Horizontal, - Children = new Drawable[] - { - new PurpleTriangleButton - { - Text = "Song Select", - Width = 100, - Height = 30, - Action = () => game?.PerformFromScreen(screen => - { - if (screen is SongSelect) - return; - - screen.Push(new PlaySongSelect()); - }, new[] { typeof(SongSelect) }) - }, - new PurpleTriangleButton - { - Text = "Gameplay", - Width = 100, - Height = 30, - Action = () => game?.PerformFromScreen(screen => - { - if (screen is Player) - return; - - var replayGeneratingMod = ruleset.Value.CreateInstance().GetAutoplayMod(); - if (replayGeneratingMod != null) - screen.Push(new ReplayPlayer((beatmap, mods) => replayGeneratingMod.CreateReplayScore(beatmap, mods))); - }, new[] { typeof(Player) }) - }, - } }, + new GridContainer { RelativeSizeAxes = Axes.Both, @@ -226,7 +188,10 @@ namespace osu.Game.Skinning.Editor { content.Children = new Drawable[] { - new SkinBlueprintContainer(targetScreen), + new SkinBlueprintContainer(targetScreen) + { + Margin = new MarginPadding { Top = 100 }, + } }; } } @@ -345,5 +310,78 @@ namespace osu.Game.Skinning.Editor foreach (var item in items) availableTargets.FirstOrDefault(t => t.Components.Contains(item))?.Remove(item); } + + private class SceneLibrary : CompositeDrawable + { + public const float HEIGHT = 30; + private const float padding = 10; + + [Resolved(canBeNull: true)] + private OsuGame game { get; set; } + + [Resolved] + private IBindable ruleset { get; set; } + + [BackgroundDependencyLoader] + private void load() + { + InternalChildren = new Drawable[] + { + new OsuScrollContainer(Direction.Horizontal) + { + RelativeSizeAxes = Axes.X, + Height = HEIGHT + padding * 2, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black.Opacity(0.5f) + }, + new FillFlowContainer + { + Name = "Scene library", + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + Spacing = new Vector2(padding), + Padding = new MarginPadding(padding), + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + new PurpleTriangleButton + { + Text = "Song Select", + Width = 100, + Height = HEIGHT, + Action = () => game?.PerformFromScreen(screen => + { + if (screen is SongSelect) + return; + + screen.Push(new PlaySongSelect()); + }, new[] { typeof(SongSelect) }) + }, + new PurpleTriangleButton + { + Text = "Gameplay", + Width = 100, + Height = HEIGHT, + Action = () => game?.PerformFromScreen(screen => + { + if (screen is Player) + return; + + var replayGeneratingMod = ruleset.Value.CreateInstance().GetAutoplayMod(); + if (replayGeneratingMod != null) + screen.Push(new ReplayPlayer((beatmap, mods) => replayGeneratingMod.CreateReplayScore(beatmap, mods))); + }, new[] { typeof(Player), typeof(SongSelect) }) + }, + } + }, + } + } + }; + } + } } } From c6aa32a003925fcde04c258409e7685016e9b95e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 7 Mar 2022 23:26:27 +0900 Subject: [PATCH 08/13] Add basic song select setup for skinnability --- osu.Game/Screens/Select/SongSelect.cs | 5 +++++ osu.Game/Skinning/DefaultSkin.cs | 8 ++++++++ osu.Game/Skinning/SkinnableTarget.cs | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index f5b11448f8..2d1a2bce4e 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -37,6 +37,7 @@ using osu.Game.Graphics.UserInterface; using System.Diagnostics; using osu.Game.Screens.Play; using osu.Game.Database; +using osu.Game.Skinning; namespace osu.Game.Screens.Select { @@ -235,6 +236,10 @@ namespace osu.Game.Screens.Select } } }, + new SkinnableTargetContainer(SkinnableTarget.SongSelect) + { + RelativeSizeAxes = Axes.Both, + }, }); if (ShowFooter) diff --git a/osu.Game/Skinning/DefaultSkin.cs b/osu.Game/Skinning/DefaultSkin.cs index 951e3f9cc5..7c6d138f4c 100644 --- a/osu.Game/Skinning/DefaultSkin.cs +++ b/osu.Game/Skinning/DefaultSkin.cs @@ -70,6 +70,14 @@ namespace osu.Game.Skinning case SkinnableTargetComponent target: switch (target.Target) { + case SkinnableTarget.SongSelect: + var songSelectComponents = new SkinnableTargetComponentsContainer(container => + { + // do stuff when we need to. + }); + + return songSelectComponents; + case SkinnableTarget.MainHUDComponents: var skinnableTargetWrapper = new SkinnableTargetComponentsContainer(container => { diff --git a/osu.Game/Skinning/SkinnableTarget.cs b/osu.Game/Skinning/SkinnableTarget.cs index 7b1eae126c..09de8a5d71 100644 --- a/osu.Game/Skinning/SkinnableTarget.cs +++ b/osu.Game/Skinning/SkinnableTarget.cs @@ -5,6 +5,7 @@ namespace osu.Game.Skinning { public enum SkinnableTarget { - MainHUDComponents + MainHUDComponents, + SongSelect } } From aff6a5a428d6ff232835d844066161b45b0f7f45 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 15 Mar 2022 15:11:47 +0900 Subject: [PATCH 09/13] Better align scene selector with menu bar --- osu.Game/Skinning/Editor/SkinEditor.cs | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index 9d5d496837..921849c0aa 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -26,7 +26,6 @@ using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Screens.Play; using osu.Game.Screens.Select; using osuTK; -using osuTK.Graphics; namespace osu.Game.Skinning.Editor { @@ -71,6 +70,8 @@ namespace osu.Game.Skinning.Editor { RelativeSizeAxes = Axes.Both; + const float menu_height = 40; + InternalChild = new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, @@ -78,10 +79,10 @@ namespace osu.Game.Skinning.Editor { new Container { - Name = "Top bar", + Name = "Menu container", RelativeSizeAxes = Axes.X, Depth = float.MinValue, - Height = 40, + Height = menu_height, Children = new Drawable[] { new EditorMenuBar @@ -117,7 +118,7 @@ namespace osu.Game.Skinning.Editor new SceneLibrary { RelativeSizeAxes = Axes.X, - Y = 45, + Y = menu_height, }, new GridContainer @@ -322,22 +323,26 @@ namespace osu.Game.Skinning.Editor [Resolved] private IBindable ruleset { get; set; } + public SceneLibrary() + { + Height = HEIGHT + padding * 2; + } + [BackgroundDependencyLoader] private void load() { InternalChildren = new Drawable[] { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4Extensions.FromHex("222") + }, new OsuScrollContainer(Direction.Horizontal) { - RelativeSizeAxes = Axes.X, - Height = HEIGHT + padding * 2, + RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black.Opacity(0.5f) - }, new FillFlowContainer { Name = "Scene library", From ee3715f5cfe7e10f1f44d4a564ea0977aebc7bbf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 15 Mar 2022 15:33:01 +0900 Subject: [PATCH 10/13] Use `OverlayColourProvider` and adjust metrics to roughly match new designs --- osu.Game/Skinning/Editor/SkinEditor.cs | 52 ++++++++++++++++++++------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index 921849c0aa..b891d63da3 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -4,9 +4,9 @@ using System; using System.Collections.Generic; using System.Linq; +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -18,11 +18,12 @@ using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; +using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; using osu.Game.Rulesets; using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit.Components.Menus; -using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Screens.Play; using osu.Game.Screens.Select; using osuTK; @@ -50,6 +51,9 @@ namespace osu.Game.Skinning.Editor [Resolved] private OsuColour colours { get; set; } + [Cached] + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); + private bool hasBegunMutating; private Container content; @@ -314,7 +318,8 @@ namespace osu.Game.Skinning.Editor private class SceneLibrary : CompositeDrawable { - public const float HEIGHT = 30; + public const float BUTTON_HEIGHT = 40; + private const float padding = 10; [Resolved(canBeNull: true)] @@ -325,18 +330,18 @@ namespace osu.Game.Skinning.Editor public SceneLibrary() { - Height = HEIGHT + padding * 2; + Height = BUTTON_HEIGHT + padding * 2; } [BackgroundDependencyLoader] - private void load() + private void load(OverlayColourProvider overlayColourProvider) { InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, - Colour = Color4Extensions.FromHex("222") + Colour = overlayColourProvider.Background5, }, new OsuScrollContainer(Direction.Horizontal) { @@ -353,11 +358,18 @@ namespace osu.Game.Skinning.Editor Direction = FillDirection.Horizontal, Children = new Drawable[] { - new PurpleTriangleButton + new OsuSpriteText + { + Text = "Scene library", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Margin = new MarginPadding(10), + }, + new SceneButton { Text = "Song Select", - Width = 100, - Height = HEIGHT, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, Action = () => game?.PerformFromScreen(screen => { if (screen is SongSelect) @@ -366,11 +378,11 @@ namespace osu.Game.Skinning.Editor screen.Push(new PlaySongSelect()); }, new[] { typeof(SongSelect) }) }, - new PurpleTriangleButton + new SceneButton { Text = "Gameplay", - Width = 100, - Height = HEIGHT, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, Action = () => game?.PerformFromScreen(screen => { if (screen is Player) @@ -387,6 +399,22 @@ namespace osu.Game.Skinning.Editor } }; } + + private class SceneButton : OsuButton + { + public SceneButton() + { + Width = 100; + Height = BUTTON_HEIGHT; + } + + [BackgroundDependencyLoader(true)] + private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) + { + BackgroundColour = overlayColourProvider?.Background3 ?? colours.Blue3; + Content.CornerRadius = 5; + } + } } } } From b08d4bb8eb12c6d8f7337aa1445b821203cd1c95 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 15 Mar 2022 15:34:04 +0900 Subject: [PATCH 11/13] Move `SceneLibrary` implementation to its own file --- osu.Game/Skinning/Editor/SkinEditor.cs | 111 +--------------- .../Skinning/Editor/SkinEditorSceneLibrary.cs | 123 ++++++++++++++++++ 2 files changed, 124 insertions(+), 110 deletions(-) create mode 100644 osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index b891d63da3..acae09ee71 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -4,29 +4,21 @@ using System; using System.Collections.Generic; using System.Linq; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; -using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; -using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; -using osu.Game.Rulesets; using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit.Components.Menus; -using osu.Game.Screens.Play; -using osu.Game.Screens.Select; -using osuTK; namespace osu.Game.Skinning.Editor { @@ -119,7 +111,7 @@ namespace osu.Game.Skinning.Editor }, }, }, - new SceneLibrary + new SkinEditorSceneLibrary { RelativeSizeAxes = Axes.X, Y = menu_height, @@ -315,106 +307,5 @@ namespace osu.Game.Skinning.Editor foreach (var item in items) availableTargets.FirstOrDefault(t => t.Components.Contains(item))?.Remove(item); } - - private class SceneLibrary : CompositeDrawable - { - public const float BUTTON_HEIGHT = 40; - - private const float padding = 10; - - [Resolved(canBeNull: true)] - private OsuGame game { get; set; } - - [Resolved] - private IBindable ruleset { get; set; } - - public SceneLibrary() - { - Height = BUTTON_HEIGHT + padding * 2; - } - - [BackgroundDependencyLoader] - private void load(OverlayColourProvider overlayColourProvider) - { - InternalChildren = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = overlayColourProvider.Background5, - }, - new OsuScrollContainer(Direction.Horizontal) - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - new FillFlowContainer - { - Name = "Scene library", - AutoSizeAxes = Axes.X, - RelativeSizeAxes = Axes.Y, - Spacing = new Vector2(padding), - Padding = new MarginPadding(padding), - Direction = FillDirection.Horizontal, - Children = new Drawable[] - { - new OsuSpriteText - { - Text = "Scene library", - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Margin = new MarginPadding(10), - }, - new SceneButton - { - Text = "Song Select", - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Action = () => game?.PerformFromScreen(screen => - { - if (screen is SongSelect) - return; - - screen.Push(new PlaySongSelect()); - }, new[] { typeof(SongSelect) }) - }, - new SceneButton - { - Text = "Gameplay", - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Action = () => game?.PerformFromScreen(screen => - { - if (screen is Player) - return; - - var replayGeneratingMod = ruleset.Value.CreateInstance().GetAutoplayMod(); - if (replayGeneratingMod != null) - screen.Push(new ReplayPlayer((beatmap, mods) => replayGeneratingMod.CreateReplayScore(beatmap, mods))); - }, new[] { typeof(Player), typeof(SongSelect) }) - }, - } - }, - } - } - }; - } - - private class SceneButton : OsuButton - { - public SceneButton() - { - Width = 100; - Height = BUTTON_HEIGHT; - } - - [BackgroundDependencyLoader(true)] - private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) - { - BackgroundColour = overlayColourProvider?.Background3 ?? colours.Blue3; - Content.CornerRadius = 5; - } - } - } } } diff --git a/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs b/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs new file mode 100644 index 0000000000..5da6147e4c --- /dev/null +++ b/osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs @@ -0,0 +1,123 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using JetBrains.Annotations; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Screens; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; +using osu.Game.Rulesets; +using osu.Game.Screens.Play; +using osu.Game.Screens.Select; +using osuTK; + +namespace osu.Game.Skinning.Editor +{ + public class SkinEditorSceneLibrary : CompositeDrawable + { + public const float BUTTON_HEIGHT = 40; + + private const float padding = 10; + + [Resolved(canBeNull: true)] + private OsuGame game { get; set; } + + [Resolved] + private IBindable ruleset { get; set; } + + public SkinEditorSceneLibrary() + { + Height = BUTTON_HEIGHT + padding * 2; + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider overlayColourProvider) + { + InternalChildren = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = overlayColourProvider.Background6, + }, + new OsuScrollContainer(Direction.Horizontal) + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new FillFlowContainer + { + Name = "Scene library", + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + Spacing = new Vector2(padding), + Padding = new MarginPadding(padding), + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = "Scene library", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Margin = new MarginPadding(10), + }, + new SceneButton + { + Text = "Song Select", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Action = () => game?.PerformFromScreen(screen => + { + if (screen is SongSelect) + return; + + screen.Push(new PlaySongSelect()); + }, new[] { typeof(SongSelect) }) + }, + new SceneButton + { + Text = "Gameplay", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Action = () => game?.PerformFromScreen(screen => + { + if (screen is Player) + return; + + var replayGeneratingMod = ruleset.Value.CreateInstance().GetAutoplayMod(); + if (replayGeneratingMod != null) + screen.Push(new ReplayPlayer((beatmap, mods) => replayGeneratingMod.CreateReplayScore(beatmap, mods))); + }, new[] { typeof(Player), typeof(SongSelect) }) + }, + } + }, + } + } + }; + } + + private class SceneButton : OsuButton + { + public SceneButton() + { + Width = 100; + Height = BUTTON_HEIGHT; + } + + [BackgroundDependencyLoader(true)] + private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) + { + BackgroundColour = overlayColourProvider?.Background3 ?? colours.Blue3; + Content.CornerRadius = 5; + } + } + } +} From 4525ed645c4c844c21774eeb6b2ced2e0028c3e9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 15 Mar 2022 16:36:04 +0900 Subject: [PATCH 12/13] Update skin editor to use `EditorSidebar` --- .../TestSceneSkinEditorComponentsList.cs | 12 ++++++--- .../Skinning/Editor/SkinComponentToolbox.cs | 12 +++------ osu.Game/Skinning/Editor/SkinEditor.cs | 27 +++++++++++++------ .../Skinning/Editor/SkinSettingsToolbox.cs | 20 ++++++++------ 4 files changed, 44 insertions(+), 27 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorComponentsList.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorComponentsList.cs index 58c89411c0..5385a9983b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorComponentsList.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditorComponentsList.cs @@ -2,7 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Game.Overlays; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; using osu.Game.Skinning.Editor; @@ -11,13 +13,17 @@ namespace osu.Game.Tests.Visual.Gameplay { public class TestSceneSkinEditorComponentsList : SkinnableTestScene { + [Cached] + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); + [Test] public void TestToggleEditor() { - AddStep("show available components", () => SetContents(_ => new SkinComponentToolbox(300) + AddStep("show available components", () => SetContents(_ => new SkinComponentToolbox { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Width = 0.6f, })); } diff --git a/osu.Game/Skinning/Editor/SkinComponentToolbox.cs b/osu.Game/Skinning/Editor/SkinComponentToolbox.cs index 2781f1958f..05da229c3e 100644 --- a/osu.Game/Skinning/Editor/SkinComponentToolbox.cs +++ b/osu.Game/Skinning/Editor/SkinComponentToolbox.cs @@ -18,19 +18,17 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets; using osu.Game.Rulesets.Difficulty; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; +using osu.Game.Screens.Edit.Components; using osuTK; using osuTK.Graphics; namespace osu.Game.Skinning.Editor { - public class SkinComponentToolbox : ScrollingToolboxGroup + public class SkinComponentToolbox : EditorSidebarSection { - public const float WIDTH = 200; - public Action RequestPlacement; private const float component_display_scale = 0.8f; @@ -45,11 +43,9 @@ namespace osu.Game.Skinning.Editor [Cached(typeof(HealthProcessor))] private HealthProcessor healthProcessor = new DrainingHealthProcessor(0); - public SkinComponentToolbox(float height) - : base("Components", height) + public SkinComponentToolbox() + : base("Components") { - RelativeSizeAxes = Axes.None; - Width = WIDTH; } [BackgroundDependencyLoader] diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index acae09ee71..381f7a1cc3 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -18,6 +18,7 @@ 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; namespace osu.Game.Skinning.Editor @@ -130,21 +131,31 @@ namespace osu.Game.Skinning.Editor { new Drawable[] { - new SkinComponentToolbox(600) + new EditorSidebar { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - RequestPlacement = placeComponent + Children = new[] + { + new SkinComponentToolbox + { + RequestPlacement = placeComponent + }, + } }, content = new Container { RelativeSizeAxes = Axes.Both, }, - settingsToolbox = new SkinSettingsToolbox + new EditorSidebar { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - } + Children = new[] + { + settingsToolbox = new SkinSettingsToolbox + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + } + } + }, } } } diff --git a/osu.Game/Skinning/Editor/SkinSettingsToolbox.cs b/osu.Game/Skinning/Editor/SkinSettingsToolbox.cs index c0ef8e7316..fc06d3647a 100644 --- a/osu.Game/Skinning/Editor/SkinSettingsToolbox.cs +++ b/osu.Game/Skinning/Editor/SkinSettingsToolbox.cs @@ -2,22 +2,26 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; -using osu.Game.Rulesets.Edit; +using osu.Framework.Graphics.Containers; +using osu.Game.Screens.Edit.Components; using osuTK; namespace osu.Game.Skinning.Editor { - internal class SkinSettingsToolbox : ScrollingToolboxGroup + internal class SkinSettingsToolbox : EditorSidebarSection { - public const float WIDTH = 200; + protected override Container Content { get; } public SkinSettingsToolbox() - : base("Settings", 600) + : base("Settings") { - RelativeSizeAxes = Axes.None; - Width = WIDTH; - - FillFlow.Spacing = new Vector2(10); + base.Content.Add(Content = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(10), + }); } } } From 54e351efe9e6dfe53fe13034108a454ff480ab03 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 15 Mar 2022 16:57:39 +0900 Subject: [PATCH 13/13] Convert top level skin editor layout to use grid container Fix `SkinEditor`'s initial target not being a `Screen` --- osu.Game/Skinning/Editor/SkinEditor.cs | 180 +++++++++++++------------ 1 file changed, 95 insertions(+), 85 deletions(-) diff --git a/osu.Game/Skinning/Editor/SkinEditor.cs b/osu.Game/Skinning/Editor/SkinEditor.cs index 381f7a1cc3..f7e5aeecdf 100644 --- a/osu.Game/Skinning/Editor/SkinEditor.cs +++ b/osu.Game/Skinning/Editor/SkinEditor.cs @@ -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()