Use ExpandingButtonContainer in editor composer

This commit is contained in:
Dean Herbert 2022-01-06 21:10:45 +09:00
parent 5baaf356aa
commit cea9cab4dc
4 changed files with 23 additions and 15 deletions

View File

@ -94,9 +94,11 @@ namespace osu.Game.Overlays
{ {
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
Truncate = true,
Text = title.ToUpperInvariant(), Text = title.ToUpperInvariant(),
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17), Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17),
Margin = new MarginPadding { Left = 10 }, Padding = new MarginPadding { Left = 10, Right = 30 },
}, },
button = new IconButton button = new IconButton
{ {

View File

@ -2,13 +2,13 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Screens.Play.PlayerSettings; using osu.Game.Overlays;
namespace osu.Game.Rulesets.Edit namespace osu.Game.Rulesets.Edit
{ {
public class ToolboxGroup : PlayerSettingsGroup public class EditorToolboxGroup : SettingsToolboxGroup
{ {
public ToolboxGroup(string title) public EditorToolboxGroup(string title)
: base(title) : base(title)
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;

View File

@ -13,6 +13,7 @@ using osu.Framework.Input;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Configuration;
using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -98,8 +99,6 @@ namespace osu.Game.Rulesets.Edit
dependencies.CacheAs(Playfield); dependencies.CacheAs(Playfield);
const float toolbar_width = 200;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new Container new Container
@ -116,20 +115,15 @@ namespace osu.Game.Rulesets.Edit
.WithChild(BlueprintContainer = CreateBlueprintContainer()) .WithChild(BlueprintContainer = CreateBlueprintContainer())
} }
}, },
new FillFlowContainer new LeftToolboxFlow
{ {
Name = "Sidebar",
RelativeSizeAxes = Axes.Y,
Width = toolbar_width,
Padding = new MarginPadding { Right = 10 },
Spacing = new Vector2(10),
Children = new Drawable[] Children = new Drawable[]
{ {
new ToolboxGroup("toolbox (1-9)") new EditorToolboxGroup("toolbox (1-9)")
{ {
Child = toolboxCollection = new EditorRadioButtonCollection { RelativeSizeAxes = Axes.X } Child = toolboxCollection = new EditorRadioButtonCollection { RelativeSizeAxes = Axes.X }
}, },
new ToolboxGroup("toggles (Q~P)") new EditorToolboxGroup("toggles (Q~P)")
{ {
Child = togglesCollection = new FillFlowContainer Child = togglesCollection = new FillFlowContainer
{ {
@ -426,6 +420,18 @@ namespace osu.Game.Rulesets.Edit
} }
#endregion #endregion
private class LeftToolboxFlow : ExpandingButtonContainer
{
public LeftToolboxFlow()
: base(80, 200)
{
RelativeSizeAxes = Axes.Y;
Padding = new MarginPadding { Right = 10 };
FillFlow.Spacing = new Vector2(10);
}
}
} }
/// <summary> /// <summary>

View File

@ -7,7 +7,7 @@ using osu.Game.Graphics.Containers;
namespace osu.Game.Rulesets.Edit namespace osu.Game.Rulesets.Edit
{ {
public class ScrollingToolboxGroup : ToolboxGroup public class ScrollingToolboxGroup : EditorToolboxGroup
{ {
protected readonly OsuScrollContainer Scroll; protected readonly OsuScrollContainer Scroll;