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

Revert the use of an enum in ProfileHeader.

This commit is contained in:
Lucas A 2021-07-18 19:18:06 +02:00
parent 77807f9e32
commit 9257cd7fad

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -15,7 +14,7 @@ using osu.Game.Users;
namespace osu.Game.Overlays.Profile namespace osu.Game.Overlays.Profile
{ {
public class ProfileHeader : TabControlOverlayHeader<ProfileHeaderTab> public class ProfileHeader : TabControlOverlayHeader<LocalisableString>
{ {
private UserCoverBackground coverContainer; private UserCoverBackground coverContainer;
@ -30,6 +29,9 @@ namespace osu.Game.Overlays.Profile
User.ValueChanged += e => updateDisplay(e.NewValue); User.ValueChanged += e => updateDisplay(e.NewValue);
TabControl.AddItem(LayoutStrings.HeaderUsersShow);
TabControl.AddItem(LayoutStrings.HeaderUsersModding);
centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true); centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true);
} }
@ -107,29 +109,4 @@ namespace osu.Game.Overlays.Profile
protected override double LoadDelay => 0; protected override double LoadDelay => 0;
} }
} }
[LocalisableEnum(typeof(ProfileHeaderTabEnumLocalisationMapper))]
public enum ProfileHeaderTab
{
Info,
Modding,
}
public class ProfileHeaderTabEnumLocalisationMapper : EnumLocalisationMapper<ProfileHeaderTab>
{
public override LocalisableString Map(ProfileHeaderTab value)
{
switch (value)
{
case ProfileHeaderTab.Info:
return LayoutStrings.HeaderUsersShow;
case ProfileHeaderTab.Modding:
return LayoutStrings.HeaderUsersModding;
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}
}
} }