1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:07:25 +08:00

Split SetDefaultGamemode into two functions

This commit is contained in:
EVAST9919 2019-06-04 18:37:31 +03:00
parent d0d846469a
commit 0c48aec265
3 changed files with 37 additions and 29 deletions

View File

@ -59,9 +59,16 @@ namespace osu.Game.Overlays.Profile.Header.Components
{ {
foreach (GamemodeTabItem i in TabContainer) foreach (GamemodeTabItem i in TabContainer)
{ {
if (i.Value.ShortName == gamemode) i.IsDefault = i.Value.ShortName == gamemode;
}
}
public void SelectDefaultGamemode()
{
foreach (GamemodeTabItem i in TabContainer)
{
if (i.IsDefault)
{ {
i.IsDefault = true;
Current.Value = i.Value; Current.Value = i.Value;
return; return;
} }

View File

@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
isDefault = value; isDefault = value;
icon.FadeTo(isDefault ? 1 : 0, 100, Easing.OutQuint); icon.FadeTo(isDefault ? 1 : 0, 200, Easing.OutQuint);
} }
} }
@ -59,34 +59,34 @@ namespace osu.Game.Overlays.Profile.Header.Components
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(3, 0),
Children = new Drawable[]
{ {
AutoSizeAxes = Axes.Both, text = new OsuSpriteText
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(3, 0),
Children = new Drawable[]
{ {
text = new OsuSpriteText Origin = Anchor.Centre,
{ Anchor = Anchor.Centre,
Origin = Anchor.Centre, Text = value.Name,
Anchor = Anchor.Centre, Font = OsuFont.GetFont()
Text = value.Name, },
Font = OsuFont.GetFont() icon = new SpriteIcon
}, {
icon = new SpriteIcon Origin = Anchor.Centre,
{ Anchor = Anchor.Centre,
Origin = Anchor.Centre, Alpha = 0,
Anchor = Anchor.Centre, AlwaysPresent = true,
Alpha = 0, Icon = FontAwesome.Solid.Star,
AlwaysPresent = true, Size = new Vector2(12),
Icon = FontAwesome.Solid.Star, },
Size = new Vector2(12), }
}, },
} new HoverClickSounds()
},
new HoverClickSounds()
}; };
} }

View File

@ -113,6 +113,7 @@ namespace osu.Game.Overlays.Profile
string playMode = user.PlayMode; string playMode = user.PlayMode;
gamemodeControl.SetDefaultGamemode(playMode); gamemodeControl.SetDefaultGamemode(playMode);
gamemodeControl.SelectDefaultGamemode();
gamemodeControl.FadeInFromZero(100, Easing.OutQuint); gamemodeControl.FadeInFromZero(100, Easing.OutQuint);
} }