Naming adjustments

This commit is contained in:
EVAST9919 2019-06-07 01:43:26 +03:00
parent 2a303748e3
commit 923f9fb6cd
5 changed files with 54 additions and 54 deletions

View File

@ -1,40 +0,0 @@
// 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.
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Overlays.Profile.Header.Components;
using osuTK.Graphics;
using System;
using System.Collections.Generic;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneGamemodeControl : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(GamemodeControl),
typeof(GamemodeTabItem),
};
public TestSceneGamemodeControl()
{
GamemodeControl control;
Child = control = new GamemodeControl
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
AddStep("set osu! as default", () => control.SetDefaultGamemode("osu"));
AddStep("set mania as default", () => control.SetDefaultGamemode("mania"));
AddStep("set taiko as default", () => control.SetDefaultGamemode("taiko"));
AddStep("set catch as default", () => control.SetDefaultGamemode("fruits"));
AddStep("select default gamemode", control.SelectDefaultGamemode);
AddStep("set random colour", () => control.AccentColour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1));
}
}
}

View File

@ -0,0 +1,40 @@
// 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.
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Overlays.Profile.Header.Components;
using osuTK.Graphics;
using System;
using System.Collections.Generic;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneProfileRulesetSelector : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(ProfileRulesetSelector),
typeof(RulesetTabItem),
};
public TestSceneProfileRulesetSelector()
{
ProfileRulesetSelector selector;
Child = selector = new ProfileRulesetSelector
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
AddStep("set osu! as default", () => selector.SetDefaultGamemode("osu"));
AddStep("set mania as default", () => selector.SetDefaultGamemode("mania"));
AddStep("set taiko as default", () => selector.SetDefaultGamemode("taiko"));
AddStep("set catch as default", () => selector.SetDefaultGamemode("fruits"));
AddStep("select default gamemode", selector.SelectDefaultGamemode);
AddStep("set random colour", () => selector.AccentColour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1));
}
}
}

View File

@ -12,11 +12,11 @@ using osuTK.Graphics;
namespace osu.Game.Overlays.Profile.Header.Components namespace osu.Game.Overlays.Profile.Header.Components
{ {
public class GamemodeControl : TabControl<RulesetInfo> public class ProfileRulesetSelector : TabControl<RulesetInfo>
{ {
protected override Dropdown<RulesetInfo> CreateDropdown() => null; protected override Dropdown<RulesetInfo> CreateDropdown() => null;
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new GamemodeTabItem(value) protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new RulesetTabItem(value)
{ {
AccentColour = AccentColour AccentColour = AccentColour
}; };
@ -35,12 +35,12 @@ namespace osu.Game.Overlays.Profile.Header.Components
foreach (TabItem<RulesetInfo> tabItem in TabContainer) foreach (TabItem<RulesetInfo> tabItem in TabContainer)
{ {
((GamemodeTabItem)tabItem).AccentColour = value; ((RulesetTabItem)tabItem).AccentColour = value;
} }
} }
} }
public GamemodeControl() public ProfileRulesetSelector()
{ {
TabContainer.Masking = false; TabContainer.Masking = false;
TabContainer.Spacing = new Vector2(10, 0); TabContainer.Spacing = new Vector2(10, 0);
@ -62,7 +62,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{ {
foreach (TabItem<RulesetInfo> tabItem in TabContainer) foreach (TabItem<RulesetInfo> tabItem in TabContainer)
{ {
((GamemodeTabItem)tabItem).IsDefault = ((GamemodeTabItem)tabItem).Value.ShortName == gamemode; ((RulesetTabItem)tabItem).IsDefault = ((RulesetTabItem)tabItem).Value.ShortName == gamemode;
} }
} }
@ -70,9 +70,9 @@ namespace osu.Game.Overlays.Profile.Header.Components
{ {
foreach (TabItem<RulesetInfo> tabItem in TabContainer) foreach (TabItem<RulesetInfo> tabItem in TabContainer)
{ {
if (((GamemodeTabItem)tabItem).IsDefault) if (((RulesetTabItem)tabItem).IsDefault)
{ {
Current.Value = ((GamemodeTabItem)tabItem).Value; Current.Value = ((RulesetTabItem)tabItem).Value;
return; return;
} }
} }

View File

@ -15,7 +15,7 @@ using osuTK.Graphics;
namespace osu.Game.Overlays.Profile.Header.Components namespace osu.Game.Overlays.Profile.Header.Components
{ {
public class GamemodeTabItem : TabItem<RulesetInfo> public class RulesetTabItem : TabItem<RulesetInfo>
{ {
private readonly OsuSpriteText text; private readonly OsuSpriteText text;
private readonly SpriteIcon icon; private readonly SpriteIcon icon;
@ -52,7 +52,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
} }
} }
public GamemodeTabItem(RulesetInfo value) public RulesetTabItem(RulesetInfo value)
: base(value) : base(value)
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;

View File

@ -26,7 +26,7 @@ namespace osu.Game.Overlays
protected ProfileHeader Header; protected ProfileHeader Header;
private SectionsContainer<ProfileSection> sectionsContainer; private SectionsContainer<ProfileSection> sectionsContainer;
private ProfileTabControl tabs; private ProfileTabControl tabs;
private GamemodeControl gamemodeControl; private ProfileRulesetSelector rulesetSelector;
public const float CONTENT_X_MARGIN = 70; public const float CONTENT_X_MARGIN = 70;
@ -122,7 +122,7 @@ namespace osu.Game.Overlays
sectionsContainer.ScrollToTop(); sectionsContainer.ScrollToTop();
Header.Add(gamemodeControl = new GamemodeControl Header.Add(rulesetSelector = new ProfileRulesetSelector
{ {
Alpha = 0, Alpha = 0,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
@ -152,10 +152,10 @@ namespace osu.Game.Overlays
} }
} }
gamemodeControl.SetDefaultGamemode(user.PlayMode ?? "osu"); rulesetSelector.SetDefaultGamemode(user.PlayMode ?? "osu");
gamemodeControl.SelectDefaultGamemode(); rulesetSelector.SelectDefaultGamemode();
gamemodeControl.FadeInFromZero(100, Easing.OutQuint); rulesetSelector.FadeInFromZero(100, Easing.OutQuint);
} }
private class ProfileTabControl : PageTabControl<ProfileSection> private class ProfileTabControl : PageTabControl<ProfileSection>