mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 00:23:01 +08:00
Use PageTabControl.
This commit is contained in:
parent
51107acdff
commit
140c74cd2a
@ -23,12 +23,14 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Height = 30;
|
Height = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PageTabItem : TabItem<T>
|
public class PageTabItem : TabItem<T>
|
||||||
{
|
{
|
||||||
private const float transition_duration = 100;
|
private const float transition_duration = 100;
|
||||||
|
|
||||||
private readonly Box box;
|
private readonly Box box;
|
||||||
|
|
||||||
|
protected readonly SpriteText Text;
|
||||||
|
|
||||||
public override bool Active
|
public override bool Active
|
||||||
{
|
{
|
||||||
get { return base.Active; }
|
get { return base.Active; }
|
||||||
@ -51,12 +53,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
Text = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = 8, Bottom = 8 },
|
Margin = new MarginPadding { Top = 8, Bottom = 8 },
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Text = (value as Enum).GetDescription() ?? value.ToString(),
|
Text = (value as Enum)?.GetDescription() ?? value.ToString(),
|
||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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 OpenTK;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -83,31 +84,41 @@ namespace osu.Game.Users
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
private class ProfileTabControl : PageTabControl<ProfileSection>
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
{
|
||||||
tabs.AccentColour = colours.Yellow;
|
private readonly Box bottom;
|
||||||
}
|
|
||||||
|
|
||||||
private class ProfileTabControl : OsuTabControl<ProfileSection>
|
|
||||||
{
|
|
||||||
public ProfileTabControl()
|
public ProfileTabControl()
|
||||||
{
|
{
|
||||||
TabContainer.RelativeSizeAxes &= ~Axes.X;
|
TabContainer.RelativeSizeAxes &= ~Axes.X;
|
||||||
TabContainer.AutoSizeAxes |= Axes.X;
|
TabContainer.AutoSizeAxes |= Axes.X;
|
||||||
TabContainer.Anchor |= Anchor.x1;
|
TabContainer.Anchor |= Anchor.x1;
|
||||||
TabContainer.Origin |= Anchor.x1;
|
TabContainer.Origin |= Anchor.x1;
|
||||||
|
Add(bottom = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 1,
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
EdgeSmoothness = new Vector2(1)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override TabItem<ProfileSection> CreateTabItem(ProfileSection value) => new ProfileTabItem(value);
|
protected override TabItem<ProfileSection> CreateTabItem(ProfileSection value) => new ProfileTabItem(value);
|
||||||
|
|
||||||
private class ProfileTabItem : OsuTabItem
|
private class ProfileTabItem : PageTabItem
|
||||||
{
|
{
|
||||||
public ProfileTabItem(ProfileSection value) : base(value)
|
public ProfileTabItem(ProfileSection value) : base(value)
|
||||||
{
|
{
|
||||||
Text.Text = value.Title;
|
Text.Text = value.Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
bottom.Colour = colours.Yellow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user