1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 21:42:55 +08:00
osu-lazer/osu.Game/Screens/Edit/Components/Menus/EditorScreenSwitcherControl.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
2.2 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
2018-11-20 15:51:59 +08:00
using osuTK;
2018-04-13 17:19:50 +08:00
2018-11-06 17:28:22 +08:00
namespace osu.Game.Screens.Edit.Components.Menus
{
public partial class EditorScreenSwitcherControl : OsuTabControl<EditorScreenMode>
{
public EditorScreenSwitcherControl()
{
AutoSizeAxes = Axes.X;
RelativeSizeAxes = Axes.Y;
2018-04-13 17:19:50 +08:00
TabContainer.RelativeSizeAxes &= ~Axes.X;
TabContainer.AutoSizeAxes = Axes.X;
TabContainer.Padding = new MarginPadding(10);
}
2018-04-13 17:19:50 +08:00
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
AccentColour = colourProvider.Light3;
AddInternal(new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background2,
});
}
2018-04-13 17:19:50 +08:00
protected override Dropdown<EditorScreenMode> CreateDropdown() => null!;
2018-04-13 17:19:50 +08:00
protected override TabItem<EditorScreenMode> CreateTabItem(EditorScreenMode value) => new TabItem(value);
2018-04-13 17:19:50 +08:00
2017-09-29 19:02:55 +08:00
private partial class TabItem : OsuTabItem
{
private const float transition_length = 250;
2018-04-13 17:19:50 +08:00
public TabItem(EditorScreenMode value)
: base(value)
{
Text.Margin = new MarginPadding();
Text.Anchor = Anchor.CentreLeft;
Text.Origin = Anchor.CentreLeft;
Text.Font = OsuFont.TorusAlternate;
Bar.Expire();
}
protected override void OnActivated()
{
base.OnActivated();
Bar.ScaleTo(new Vector2(1, 5), transition_length, Easing.OutQuint);
}
2018-04-13 17:19:50 +08:00
protected override void OnDeactivated()
{
base.OnDeactivated();
Bar.ScaleTo(Vector2.One, transition_length, Easing.OutQuint);
}
}
}
}