mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 10:22:56 +08:00
Update new usages of LocalisableEnum
This commit is contained in:
parent
6b2ea1b08f
commit
1152e15282
@ -1,10 +1,10 @@
|
||||
// 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.Bindables;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Users;
|
||||
|
||||
|
@ -1,42 +1,23 @@
|
||||
// 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 System;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings
|
||||
{
|
||||
[LocalisableEnum(typeof(RankingsScopeEnumLocalisationMapper))]
|
||||
public enum RankingsScope
|
||||
{
|
||||
[LocalisableDescription(typeof(RankingsStrings), nameof(RankingsStrings.TypePerformance))]
|
||||
Performance,
|
||||
|
||||
[LocalisableDescription(typeof(RankingsStrings), nameof(RankingsStrings.TypeCharts))]
|
||||
Spotlights,
|
||||
|
||||
[LocalisableDescription(typeof(RankingsStrings), nameof(RankingsStrings.TypeScore))]
|
||||
Score,
|
||||
|
||||
[LocalisableDescription(typeof(RankingsStrings), nameof(RankingsStrings.TypeCountry))]
|
||||
Country
|
||||
}
|
||||
|
||||
public class RankingsScopeEnumLocalisationMapper : EnumLocalisationMapper<RankingsScope>
|
||||
{
|
||||
public override LocalisableString Map(RankingsScope value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case RankingsScope.Performance:
|
||||
return RankingsStrings.TypePerformance;
|
||||
|
||||
case RankingsScope.Spotlights:
|
||||
return RankingsStrings.TypeCharts;
|
||||
|
||||
case RankingsScope.Score:
|
||||
return RankingsStrings.TypeScore;
|
||||
|
||||
case RankingsScope.Country:
|
||||
return RankingsStrings.TypeCountry;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(value), value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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 System;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
@ -16,28 +15,12 @@ namespace osu.Game.Overlays.Rankings
|
||||
}
|
||||
}
|
||||
|
||||
[LocalisableEnum(typeof(RankingsSortCriteriaEnumLocalisationMapper))]
|
||||
public enum RankingsSortCriteria
|
||||
{
|
||||
[LocalisableDescription(typeof(SortStrings), nameof(SortStrings.All))]
|
||||
All,
|
||||
|
||||
[LocalisableDescription(typeof(SortStrings), nameof(SortStrings.Friends))]
|
||||
Friends
|
||||
}
|
||||
|
||||
public class RankingsSortCriteriaEnumLocalisationMapper : EnumLocalisationMapper<RankingsSortCriteria>
|
||||
{
|
||||
public override LocalisableString Map(RankingsSortCriteria value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case RankingsSortCriteria.All:
|
||||
return SortStrings.All;
|
||||
|
||||
case RankingsSortCriteria.Friends:
|
||||
return SortStrings.Friends;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(value), value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user