mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:13:21 +08:00
Add ScreenSelectionTabControl to EditorMenuBar
This commit is contained in:
parent
545c375199
commit
ba8bf6cbd5
@ -59,7 +59,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
public class OsuTabItem : TabItem<T>, IHasAccentColour
|
||||
{
|
||||
protected readonly SpriteText Text;
|
||||
private readonly Box box;
|
||||
protected readonly Box Bar;
|
||||
|
||||
private Color4 accentColour;
|
||||
public Color4 AccentColour
|
||||
@ -77,13 +77,13 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
private void fadeActive()
|
||||
{
|
||||
box.FadeIn(transition_length, Easing.OutQuint);
|
||||
Bar.FadeIn(transition_length, Easing.OutQuint);
|
||||
Text.FadeColour(Color4.White, transition_length, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private void fadeInactive()
|
||||
{
|
||||
box.FadeOut(transition_length, Easing.OutQuint);
|
||||
Bar.FadeOut(transition_length, Easing.OutQuint);
|
||||
Text.FadeColour(AccentColour, transition_length, Easing.OutQuint);
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-Bold", // Font should only turn bold when active?
|
||||
},
|
||||
box = new Box
|
||||
Bar = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 1,
|
||||
|
@ -32,6 +32,12 @@ namespace osu.Game.Screens.Edit.Menus
|
||||
Colour = OsuColour.FromHex("111"),
|
||||
Depth = float.MaxValue
|
||||
},
|
||||
new ScreenSelectionTabControl
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
X = -15
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
84
osu.Game/Screens/Edit/Menus/ScreenSelectionTabControl.cs
Normal file
84
osu.Game/Screens/Edit/Menus/ScreenSelectionTabControl.cs
Normal file
@ -0,0 +1,84 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Menus
|
||||
{
|
||||
public class ScreenSelectionTabControl : OsuTabControl<EditorScreenMode>
|
||||
{
|
||||
public ScreenSelectionTabControl()
|
||||
{
|
||||
AutoSizeAxes = Axes.X;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
||||
TabContainer.RelativeSizeAxes &= ~Axes.X;
|
||||
TabContainer.AutoSizeAxes = Axes.X;
|
||||
TabContainer.Padding = new MarginPadding();
|
||||
|
||||
Add(new Box
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 1,
|
||||
Colour = Color4.White.Opacity(0.2f),
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AccentColour = colours.Yellow;
|
||||
}
|
||||
|
||||
protected override Dropdown<EditorScreenMode> CreateDropdown() => null;
|
||||
|
||||
protected override TabItem<EditorScreenMode> CreateTabItem(EditorScreenMode value) => new TabItem(value);
|
||||
|
||||
private new class TabItem : OsuTabItem
|
||||
{
|
||||
private const float transition_length = 250;
|
||||
|
||||
public TabItem(EditorScreenMode value)
|
||||
: base(value)
|
||||
{
|
||||
Text.Margin = new MarginPadding();
|
||||
Text.Anchor = Anchor.CentreLeft;
|
||||
Text.Origin = Anchor.CentreLeft;
|
||||
}
|
||||
|
||||
protected override void OnActivated()
|
||||
{
|
||||
base.OnActivated();
|
||||
Bar.ScaleTo(new Vector2(1, 5), transition_length, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void OnDeactivated()
|
||||
{
|
||||
base.OnDeactivated();
|
||||
Bar.ScaleTo(Vector2.One, transition_length, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum EditorScreenMode
|
||||
{
|
||||
[System.ComponentModel.Description("compose")]
|
||||
Compose,
|
||||
[System.ComponentModel.Description("design")]
|
||||
Design,
|
||||
[System.ComponentModel.Description("timing")]
|
||||
Timing,
|
||||
[System.ComponentModel.Description("song")]
|
||||
SongSetup
|
||||
}
|
||||
}
|
@ -618,6 +618,7 @@
|
||||
<Compile Include="Screens\Edit\Menus\EditorMenuBarItem.cs" />
|
||||
<Compile Include="Screens\Edit\Menus\EditorMenuItem.cs" />
|
||||
<Compile Include="Screens\Edit\Menus\EditorMenuItemSpacer.cs" />
|
||||
<Compile Include="Screens\Edit\Menus\ScreenSelectionTabControl.cs" />
|
||||
<Compile Include="Screens\Loader.cs" />
|
||||
<Compile Include="Screens\Menu\Button.cs" />
|
||||
<Compile Include="Screens\Menu\ButtonSystem.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user