mirror of
https://github.com/ppy/osu
synced 2025-03-06 03:19:47 +00: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.
|
// 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 osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
|
||||||
|
@ -1,42 +1,23 @@
|
|||||||
// 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.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Rankings
|
namespace osu.Game.Overlays.Rankings
|
||||||
{
|
{
|
||||||
[LocalisableEnum(typeof(RankingsScopeEnumLocalisationMapper))]
|
|
||||||
public enum RankingsScope
|
public enum RankingsScope
|
||||||
{
|
{
|
||||||
|
[LocalisableDescription(typeof(RankingsStrings), nameof(RankingsStrings.TypePerformance))]
|
||||||
Performance,
|
Performance,
|
||||||
|
|
||||||
|
[LocalisableDescription(typeof(RankingsStrings), nameof(RankingsStrings.TypeCharts))]
|
||||||
Spotlights,
|
Spotlights,
|
||||||
|
|
||||||
|
[LocalisableDescription(typeof(RankingsStrings), nameof(RankingsStrings.TypeScore))]
|
||||||
Score,
|
Score,
|
||||||
|
|
||||||
|
[LocalisableDescription(typeof(RankingsStrings), nameof(RankingsStrings.TypeCountry))]
|
||||||
Country
|
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.
|
// 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.Extensions.LocalisationExtensions;
|
using osu.Framework.Extensions.LocalisationExtensions;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
@ -16,28 +15,12 @@ namespace osu.Game.Overlays.Rankings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[LocalisableEnum(typeof(RankingsSortCriteriaEnumLocalisationMapper))]
|
|
||||||
public enum RankingsSortCriteria
|
public enum RankingsSortCriteria
|
||||||
{
|
{
|
||||||
|
[LocalisableDescription(typeof(SortStrings), nameof(SortStrings.All))]
|
||||||
All,
|
All,
|
||||||
|
|
||||||
|
[LocalisableDescription(typeof(SortStrings), nameof(SortStrings.Friends))]
|
||||||
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