mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Update design of EditorMenuBar to match flyte's design more closely
This commit is contained in:
Submodule osu-framework updated: cdb031c3a8...a24fd77ad5
@ -32,16 +32,11 @@ namespace osu.Game.Screens.Edit
|
|||||||
Height = 40,
|
Height = 40,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = OsuColour.FromHex("111")
|
|
||||||
},
|
|
||||||
new EditorMenuBar
|
new EditorMenuBar
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
X = 100,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Items = new[]
|
Items = new[]
|
||||||
{
|
{
|
||||||
new EditorMenuBarItem("File")
|
new EditorMenuBarItem("File")
|
||||||
|
@ -19,8 +19,20 @@ namespace osu.Game.Screens.Edit.Menus
|
|||||||
public EditorMenuBar()
|
public EditorMenuBar()
|
||||||
: base(Direction.Horizontal, true)
|
: base(Direction.Horizontal, true)
|
||||||
{
|
{
|
||||||
ItemsContainer.Padding = new MarginPadding(0);
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
|
ItemsContainer.Padding = new MarginPadding { Left = 100 };
|
||||||
BackgroundColour = Color4.Transparent;
|
BackgroundColour = Color4.Transparent;
|
||||||
|
|
||||||
|
AddRangeInternal(new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = OsuColour.FromHex("111"),
|
||||||
|
Depth = float.MaxValue
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu();
|
protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu();
|
||||||
@ -32,9 +44,32 @@ namespace osu.Game.Screens.Edit.Menus
|
|||||||
private Color4 openedForegroundColour;
|
private Color4 openedForegroundColour;
|
||||||
private Color4 openedBackgroundColour;
|
private Color4 openedBackgroundColour;
|
||||||
|
|
||||||
|
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => parentSizedBox.ReceiveMouseInputAt(screenSpacePos);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A box with width equal to this <see cref="DrawableEditorBarMenuItem"/>'s width, and height equal to the parent height.
|
||||||
|
/// </summary>
|
||||||
|
private readonly Box parentSizedBox;
|
||||||
|
|
||||||
public DrawableEditorBarMenuItem(MenuItem item)
|
public DrawableEditorBarMenuItem(MenuItem item)
|
||||||
: base(item)
|
: base(item)
|
||||||
{
|
{
|
||||||
|
Anchor = Anchor.CentreLeft;
|
||||||
|
Origin = Anchor.CentreLeft;
|
||||||
|
|
||||||
|
AddInternal(parentSizedBox = new Box
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
BypassAutoSizeAxes = Axes.Both,
|
||||||
|
Alpha = 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetFlowDirection(Direction direction)
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -62,6 +97,13 @@ namespace osu.Game.Screens.Edit.Menus
|
|||||||
base.UpdateForegroundColour();
|
base.UpdateForegroundColour();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
parentSizedBox.Height = Parent.DrawHeight;
|
||||||
|
}
|
||||||
|
|
||||||
protected override Drawable CreateBackground() => new Container
|
protected override Drawable CreateBackground() => new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -75,6 +117,17 @@ namespace osu.Game.Screens.Edit.Menus
|
|||||||
Child = new Box { RelativeSizeAxes = Axes.Both }
|
Child = new Box { RelativeSizeAxes = Axes.Both }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected override DrawableOsuMenuItem.TextContainer CreateTextContainer() => new TextContainer();
|
||||||
|
|
||||||
|
private new class TextContainer : DrawableOsuMenuItem.TextContainer
|
||||||
|
{
|
||||||
|
public TextContainer()
|
||||||
|
{
|
||||||
|
NormalText.TextSize = BoldText.TextSize = 14;
|
||||||
|
NormalText.Margin = BoldText.Margin = new MarginPadding { Horizontal = 10, Vertical = MARGIN_VERTICAL };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SubMenu : OsuMenu
|
private class SubMenu : OsuMenu
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Screens.Edit.Menus;
|
using osu.Game.Screens.Edit.Menus;
|
||||||
|
|
||||||
@ -9,74 +12,82 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
public class TestCaseEditorMenuBar : OsuTestCase
|
public class TestCaseEditorMenuBar : OsuTestCase
|
||||||
{
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(EditorMenuBar), typeof(ScreenSelectionTabControl) };
|
||||||
|
|
||||||
public TestCaseEditorMenuBar()
|
public TestCaseEditorMenuBar()
|
||||||
{
|
{
|
||||||
Add(new EditorMenuBar
|
Add(new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 50,
|
||||||
Y = 50,
|
Y = 50,
|
||||||
Items = new[]
|
Child = new EditorMenuBar
|
||||||
{
|
{
|
||||||
new EditorMenuBarItem("File")
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Items = new[]
|
||||||
{
|
{
|
||||||
Items = new[]
|
new EditorMenuBarItem("File")
|
||||||
{
|
{
|
||||||
new EditorMenuItem("Clear All Notes"),
|
Items = new[]
|
||||||
new EditorMenuItem("Open Difficulty..."),
|
{
|
||||||
new EditorMenuItem("Save"),
|
new EditorMenuItem("Clear All Notes"),
|
||||||
new EditorMenuItem("Create a new Difficulty..."),
|
new EditorMenuItem("Open Difficulty..."),
|
||||||
new EditorMenuItemSpacer(),
|
new EditorMenuItem("Save"),
|
||||||
new EditorMenuItem("Revert to Saved"),
|
new EditorMenuItem("Create a new Difficulty..."),
|
||||||
new EditorMenuItem("Revert to Saved (Full)"),
|
new EditorMenuItemSpacer(),
|
||||||
new EditorMenuItemSpacer(),
|
new EditorMenuItem("Revert to Saved"),
|
||||||
new EditorMenuItem("Test Beatmap"),
|
new EditorMenuItem("Revert to Saved (Full)"),
|
||||||
new EditorMenuItem("Open AiMod"),
|
new EditorMenuItemSpacer(),
|
||||||
new EditorMenuItemSpacer(),
|
new EditorMenuItem("Test Beatmap"),
|
||||||
new EditorMenuItem("Upload Beatmap..."),
|
new EditorMenuItem("Open AiMod"),
|
||||||
new EditorMenuItem("Export Package"),
|
new EditorMenuItemSpacer(),
|
||||||
new EditorMenuItem("Export Map Package"),
|
new EditorMenuItem("Upload Beatmap..."),
|
||||||
new EditorMenuItem("Import from..."),
|
new EditorMenuItem("Export Package"),
|
||||||
new EditorMenuItemSpacer(),
|
new EditorMenuItem("Export Map Package"),
|
||||||
new EditorMenuItem("Open Song Folder"),
|
new EditorMenuItem("Import from..."),
|
||||||
new EditorMenuItem("Open .osu in Notepad"),
|
new EditorMenuItemSpacer(),
|
||||||
new EditorMenuItem("Open .osb in Notepad"),
|
new EditorMenuItem("Open Song Folder"),
|
||||||
new EditorMenuItemSpacer(),
|
new EditorMenuItem("Open .osu in Notepad"),
|
||||||
new EditorMenuItem("Exit"),
|
new EditorMenuItem("Open .osb in Notepad"),
|
||||||
}
|
new EditorMenuItemSpacer(),
|
||||||
},
|
new EditorMenuItem("Exit"),
|
||||||
new EditorMenuBarItem("Timing")
|
}
|
||||||
{
|
},
|
||||||
Items = new[]
|
new EditorMenuBarItem("Timing")
|
||||||
{
|
{
|
||||||
new EditorMenuItem("Time Signature"),
|
Items = new[]
|
||||||
new EditorMenuItem("Metronome Clicks"),
|
{
|
||||||
new EditorMenuItemSpacer(),
|
new EditorMenuItem("Time Signature"),
|
||||||
new EditorMenuItem("Add Timing Section"),
|
new EditorMenuItem("Metronome Clicks"),
|
||||||
new EditorMenuItem("Add Inheriting Section"),
|
new EditorMenuItemSpacer(),
|
||||||
new EditorMenuItem("Reset Current Section"),
|
new EditorMenuItem("Add Timing Section"),
|
||||||
new EditorMenuItem("Delete Timing Section"),
|
new EditorMenuItem("Add Inheriting Section"),
|
||||||
new EditorMenuItem("Resnap Current Section"),
|
new EditorMenuItem("Reset Current Section"),
|
||||||
new EditorMenuItemSpacer(),
|
new EditorMenuItem("Delete Timing Section"),
|
||||||
new EditorMenuItem("Timing Setup"),
|
new EditorMenuItem("Resnap Current Section"),
|
||||||
new EditorMenuItemSpacer(),
|
new EditorMenuItemSpacer(),
|
||||||
new EditorMenuItem("Resnap All Notes", MenuItemType.Destructive),
|
new EditorMenuItem("Timing Setup"),
|
||||||
new EditorMenuItem("Move all notes in time...", MenuItemType.Destructive),
|
new EditorMenuItemSpacer(),
|
||||||
new EditorMenuItem("Recalculate Slider Lengths", MenuItemType.Destructive),
|
new EditorMenuItem("Resnap All Notes", MenuItemType.Destructive),
|
||||||
new EditorMenuItem("Delete All Timing Sections", MenuItemType.Destructive),
|
new EditorMenuItem("Move all notes in time...", MenuItemType.Destructive),
|
||||||
new EditorMenuItemSpacer(),
|
new EditorMenuItem("Recalculate Slider Lengths", MenuItemType.Destructive),
|
||||||
new EditorMenuItem("Set Current Position as Preview Point"),
|
new EditorMenuItem("Delete All Timing Sections", MenuItemType.Destructive),
|
||||||
}
|
new EditorMenuItemSpacer(),
|
||||||
},
|
new EditorMenuItem("Set Current Position as Preview Point"),
|
||||||
new EditorMenuBarItem("Testing")
|
}
|
||||||
{
|
},
|
||||||
Items = new[]
|
new EditorMenuBarItem("Testing")
|
||||||
{
|
{
|
||||||
new EditorMenuItem("Item 1"),
|
Items = new[]
|
||||||
new EditorMenuItem("Item 2"),
|
{
|
||||||
new EditorMenuItem("Item 3"),
|
new EditorMenuItem("Item 1"),
|
||||||
}
|
new EditorMenuItem("Item 2"),
|
||||||
},
|
new EditorMenuItem("Item 3"),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user