mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 06:12:56 +08:00
Merge pull request #13516 from smoogipoo/beatmap-listing-enum-localisation
This commit is contained in:
commit
044ff9d1d2
@ -52,6 +52,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.614.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.614.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.614.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.616.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -160,7 +160,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Text = (value as IHasDescription)?.Description ?? (value as Enum)?.GetDescription() ?? value.ToString(),
|
Text = (value as IHasDescription)?.Description ?? (value as Enum)?.GetLocalisableDescription() ?? value.ToString(),
|
||||||
Font = OsuFont.GetFont(size: 14)
|
Font = OsuFont.GetFont(size: 14)
|
||||||
},
|
},
|
||||||
Bar = new Box
|
Bar = new Box
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
@ -81,7 +82,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Torus, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
|
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Torus, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual string CreateText() => (Value as Enum)?.GetDescription() ?? Value.ToString();
|
protected virtual LocalisableString CreateText() => (Value as Enum)?.GetLocalisableDescription() ?? Value.ToString();
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// 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 System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
@ -33,38 +33,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override LocalisableString LabelFor(ScoreRank value)
|
protected override LocalisableString LabelFor(ScoreRank value) => value.GetLocalisableDescription();
|
||||||
{
|
|
||||||
switch (value)
|
|
||||||
{
|
|
||||||
case ScoreRank.XH:
|
|
||||||
return BeatmapsStrings.RankXH;
|
|
||||||
|
|
||||||
case ScoreRank.X:
|
|
||||||
return BeatmapsStrings.RankX;
|
|
||||||
|
|
||||||
case ScoreRank.SH:
|
|
||||||
return BeatmapsStrings.RankSH;
|
|
||||||
|
|
||||||
case ScoreRank.S:
|
|
||||||
return BeatmapsStrings.RankS;
|
|
||||||
|
|
||||||
case ScoreRank.A:
|
|
||||||
return BeatmapsStrings.RankA;
|
|
||||||
|
|
||||||
case ScoreRank.B:
|
|
||||||
return BeatmapsStrings.RankB;
|
|
||||||
|
|
||||||
case ScoreRank.C:
|
|
||||||
return BeatmapsStrings.RankC;
|
|
||||||
|
|
||||||
case ScoreRank.D:
|
|
||||||
return BeatmapsStrings.RankD;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new ArgumentException("Unsupported value.", nameof(value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the label text to be used for the supplied <paramref name="value"/>.
|
/// Returns the label text to be used for the supplied <paramref name="value"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual LocalisableString LabelFor(T value) => (value as Enum)?.GetDescription() ?? value.ToString();
|
protected virtual LocalisableString LabelFor(T value) => (value as Enum)?.GetLocalisableDescription() ?? value.ToString();
|
||||||
|
|
||||||
private void updateState()
|
private void updateState()
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
// 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 System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapListing
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
{
|
{
|
||||||
|
[LocalisableEnum(typeof(SearchCategoryEnumLocalisationMapper))]
|
||||||
public enum SearchCategory
|
public enum SearchCategory
|
||||||
{
|
{
|
||||||
Any,
|
Any,
|
||||||
@ -23,4 +27,43 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
[Description("My Maps")]
|
[Description("My Maps")]
|
||||||
Mine,
|
Mine,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SearchCategoryEnumLocalisationMapper : EnumLocalisationMapper<SearchCategory>
|
||||||
|
{
|
||||||
|
public override LocalisableString Map(SearchCategory value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case SearchCategory.Any:
|
||||||
|
return BeatmapsStrings.StatusAny;
|
||||||
|
|
||||||
|
case SearchCategory.Leaderboard:
|
||||||
|
return BeatmapsStrings.StatusLeaderboard;
|
||||||
|
|
||||||
|
case SearchCategory.Ranked:
|
||||||
|
return BeatmapsStrings.StatusRanked;
|
||||||
|
|
||||||
|
case SearchCategory.Qualified:
|
||||||
|
return BeatmapsStrings.StatusQualified;
|
||||||
|
|
||||||
|
case SearchCategory.Loved:
|
||||||
|
return BeatmapsStrings.StatusLoved;
|
||||||
|
|
||||||
|
case SearchCategory.Favourites:
|
||||||
|
return BeatmapsStrings.StatusFavourites;
|
||||||
|
|
||||||
|
case SearchCategory.Pending:
|
||||||
|
return BeatmapsStrings.StatusPending;
|
||||||
|
|
||||||
|
case SearchCategory.Graveyard:
|
||||||
|
return BeatmapsStrings.StatusGraveyard;
|
||||||
|
|
||||||
|
case SearchCategory.Mine:
|
||||||
|
return BeatmapsStrings.StatusMine;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(value), value, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,34 @@
|
|||||||
// 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.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapListing
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
{
|
{
|
||||||
|
[LocalisableEnum(typeof(SearchExplicitEnumLocalisationMapper))]
|
||||||
public enum SearchExplicit
|
public enum SearchExplicit
|
||||||
{
|
{
|
||||||
Hide,
|
Hide,
|
||||||
Show
|
Show
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SearchExplicitEnumLocalisationMapper : EnumLocalisationMapper<SearchExplicit>
|
||||||
|
{
|
||||||
|
public override LocalisableString Map(SearchExplicit value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case SearchExplicit.Hide:
|
||||||
|
return BeatmapsStrings.NsfwExclude;
|
||||||
|
|
||||||
|
case SearchExplicit.Show:
|
||||||
|
return BeatmapsStrings.NsfwInclude;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(value), value, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
// 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 System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapListing
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
{
|
{
|
||||||
|
[LocalisableEnum(typeof(SearchExtraEnumLocalisationMapper))]
|
||||||
public enum SearchExtra
|
public enum SearchExtra
|
||||||
{
|
{
|
||||||
[Description("Has Video")]
|
[Description("Has Video")]
|
||||||
@ -13,4 +17,22 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
[Description("Has Storyboard")]
|
[Description("Has Storyboard")]
|
||||||
Storyboard
|
Storyboard
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SearchExtraEnumLocalisationMapper : EnumLocalisationMapper<SearchExtra>
|
||||||
|
{
|
||||||
|
public override LocalisableString Map(SearchExtra value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case SearchExtra.Video:
|
||||||
|
return BeatmapsStrings.ExtraVideo;
|
||||||
|
|
||||||
|
case SearchExtra.Storyboard:
|
||||||
|
return BeatmapsStrings.ExtraStoryboard;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(value), value, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
// 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 System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapListing
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
{
|
{
|
||||||
|
[LocalisableEnum(typeof(SearchGeneralEnumLocalisationMapper))]
|
||||||
public enum SearchGeneral
|
public enum SearchGeneral
|
||||||
{
|
{
|
||||||
[Description("Recommended difficulty")]
|
[Description("Recommended difficulty")]
|
||||||
@ -16,4 +20,25 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
[Description("Subscribed mappers")]
|
[Description("Subscribed mappers")]
|
||||||
Follows
|
Follows
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SearchGeneralEnumLocalisationMapper : EnumLocalisationMapper<SearchGeneral>
|
||||||
|
{
|
||||||
|
public override LocalisableString Map(SearchGeneral value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case SearchGeneral.Recommended:
|
||||||
|
return BeatmapsStrings.GeneralRecommended;
|
||||||
|
|
||||||
|
case SearchGeneral.Converts:
|
||||||
|
return BeatmapsStrings.GeneralConverts;
|
||||||
|
|
||||||
|
case SearchGeneral.Follows:
|
||||||
|
return BeatmapsStrings.GeneralFollows;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(value), value, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
// 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 System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapListing
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
{
|
{
|
||||||
|
[LocalisableEnum(typeof(SearchGenreEnumLocalisationMapper))]
|
||||||
public enum SearchGenre
|
public enum SearchGenre
|
||||||
{
|
{
|
||||||
Any = 0,
|
Any = 0,
|
||||||
@ -26,4 +30,58 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
Folk = 13,
|
Folk = 13,
|
||||||
Jazz = 14
|
Jazz = 14
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SearchGenreEnumLocalisationMapper : EnumLocalisationMapper<SearchGenre>
|
||||||
|
{
|
||||||
|
public override LocalisableString Map(SearchGenre value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case SearchGenre.Any:
|
||||||
|
return BeatmapsStrings.GenreAny;
|
||||||
|
|
||||||
|
case SearchGenre.Unspecified:
|
||||||
|
return BeatmapsStrings.GenreUnspecified;
|
||||||
|
|
||||||
|
case SearchGenre.VideoGame:
|
||||||
|
return BeatmapsStrings.GenreVideoGame;
|
||||||
|
|
||||||
|
case SearchGenre.Anime:
|
||||||
|
return BeatmapsStrings.GenreAnime;
|
||||||
|
|
||||||
|
case SearchGenre.Rock:
|
||||||
|
return BeatmapsStrings.GenreRock;
|
||||||
|
|
||||||
|
case SearchGenre.Pop:
|
||||||
|
return BeatmapsStrings.GenrePop;
|
||||||
|
|
||||||
|
case SearchGenre.Other:
|
||||||
|
return BeatmapsStrings.GenreOther;
|
||||||
|
|
||||||
|
case SearchGenre.Novelty:
|
||||||
|
return BeatmapsStrings.GenreNovelty;
|
||||||
|
|
||||||
|
case SearchGenre.HipHop:
|
||||||
|
return BeatmapsStrings.GenreHipHop;
|
||||||
|
|
||||||
|
case SearchGenre.Electronic:
|
||||||
|
return BeatmapsStrings.GenreElectronic;
|
||||||
|
|
||||||
|
case SearchGenre.Metal:
|
||||||
|
return BeatmapsStrings.GenreMetal;
|
||||||
|
|
||||||
|
case SearchGenre.Classical:
|
||||||
|
return BeatmapsStrings.GenreClassical;
|
||||||
|
|
||||||
|
case SearchGenre.Folk:
|
||||||
|
return BeatmapsStrings.GenreFolk;
|
||||||
|
|
||||||
|
case SearchGenre.Jazz:
|
||||||
|
return BeatmapsStrings.GenreJazz;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(value), value, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
// 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.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapListing
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
{
|
{
|
||||||
|
[LocalisableEnum(typeof(SearchLanguageEnumLocalisationMapper))]
|
||||||
[HasOrderedElements]
|
[HasOrderedElements]
|
||||||
public enum SearchLanguage
|
public enum SearchLanguage
|
||||||
{
|
{
|
||||||
@ -53,4 +57,61 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
[Order(13)]
|
[Order(13)]
|
||||||
Other
|
Other
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SearchLanguageEnumLocalisationMapper : EnumLocalisationMapper<SearchLanguage>
|
||||||
|
{
|
||||||
|
public override LocalisableString Map(SearchLanguage value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case SearchLanguage.Any:
|
||||||
|
return BeatmapsStrings.LanguageAny;
|
||||||
|
|
||||||
|
case SearchLanguage.Unspecified:
|
||||||
|
return BeatmapsStrings.LanguageUnspecified;
|
||||||
|
|
||||||
|
case SearchLanguage.English:
|
||||||
|
return BeatmapsStrings.LanguageEnglish;
|
||||||
|
|
||||||
|
case SearchLanguage.Japanese:
|
||||||
|
return BeatmapsStrings.LanguageJapanese;
|
||||||
|
|
||||||
|
case SearchLanguage.Chinese:
|
||||||
|
return BeatmapsStrings.LanguageChinese;
|
||||||
|
|
||||||
|
case SearchLanguage.Instrumental:
|
||||||
|
return BeatmapsStrings.LanguageInstrumental;
|
||||||
|
|
||||||
|
case SearchLanguage.Korean:
|
||||||
|
return BeatmapsStrings.LanguageKorean;
|
||||||
|
|
||||||
|
case SearchLanguage.French:
|
||||||
|
return BeatmapsStrings.LanguageFrench;
|
||||||
|
|
||||||
|
case SearchLanguage.German:
|
||||||
|
return BeatmapsStrings.LanguageGerman;
|
||||||
|
|
||||||
|
case SearchLanguage.Swedish:
|
||||||
|
return BeatmapsStrings.LanguageSwedish;
|
||||||
|
|
||||||
|
case SearchLanguage.Spanish:
|
||||||
|
return BeatmapsStrings.LanguageSpanish;
|
||||||
|
|
||||||
|
case SearchLanguage.Italian:
|
||||||
|
return BeatmapsStrings.LanguageItalian;
|
||||||
|
|
||||||
|
case SearchLanguage.Russian:
|
||||||
|
return BeatmapsStrings.LanguageRussian;
|
||||||
|
|
||||||
|
case SearchLanguage.Polish:
|
||||||
|
return BeatmapsStrings.LanguagePolish;
|
||||||
|
|
||||||
|
case SearchLanguage.Other:
|
||||||
|
return BeatmapsStrings.LanguageOther;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(value), value, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,38 @@
|
|||||||
// 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.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapListing
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
{
|
{
|
||||||
|
[LocalisableEnum(typeof(SearchPlayedEnumLocalisationMapper))]
|
||||||
public enum SearchPlayed
|
public enum SearchPlayed
|
||||||
{
|
{
|
||||||
Any,
|
Any,
|
||||||
Played,
|
Played,
|
||||||
Unplayed
|
Unplayed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SearchPlayedEnumLocalisationMapper : EnumLocalisationMapper<SearchPlayed>
|
||||||
|
{
|
||||||
|
public override LocalisableString Map(SearchPlayed value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case SearchPlayed.Any:
|
||||||
|
return BeatmapsStrings.PlayedAny;
|
||||||
|
|
||||||
|
case SearchPlayed.Played:
|
||||||
|
return BeatmapsStrings.PlayedPlayed;
|
||||||
|
|
||||||
|
case SearchPlayed.Unplayed:
|
||||||
|
return BeatmapsStrings.PlayedUnplayed;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(value), value, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
// 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.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapListing
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
{
|
{
|
||||||
|
[LocalisableEnum(typeof(SortCriteriaLocalisationMapper))]
|
||||||
public enum SortCriteria
|
public enum SortCriteria
|
||||||
{
|
{
|
||||||
Title,
|
Title,
|
||||||
@ -14,4 +19,40 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
Favourites,
|
Favourites,
|
||||||
Relevance
|
Relevance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SortCriteriaLocalisationMapper : EnumLocalisationMapper<SortCriteria>
|
||||||
|
{
|
||||||
|
public override LocalisableString Map(SortCriteria value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case SortCriteria.Title:
|
||||||
|
return BeatmapsStrings.ListingSearchSortingTitle;
|
||||||
|
|
||||||
|
case SortCriteria.Artist:
|
||||||
|
return BeatmapsStrings.ListingSearchSortingArtist;
|
||||||
|
|
||||||
|
case SortCriteria.Difficulty:
|
||||||
|
return BeatmapsStrings.ListingSearchSortingDifficulty;
|
||||||
|
|
||||||
|
case SortCriteria.Ranked:
|
||||||
|
return BeatmapsStrings.ListingSearchSortingRanked;
|
||||||
|
|
||||||
|
case SortCriteria.Rating:
|
||||||
|
return BeatmapsStrings.ListingSearchSortingRating;
|
||||||
|
|
||||||
|
case SortCriteria.Plays:
|
||||||
|
return BeatmapsStrings.ListingSearchSortingPlays;
|
||||||
|
|
||||||
|
case SortCriteria.Favourites:
|
||||||
|
return BeatmapsStrings.ListingSearchSortingFavourites;
|
||||||
|
|
||||||
|
case SortCriteria.Relevance:
|
||||||
|
return BeatmapsStrings.ListingSearchSortingRelevance;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(value), value, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ namespace osu.Game.Overlays
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
|
||||||
Text = (value as Enum)?.GetDescription() ?? value.ToString()
|
Text = (value as Enum)?.GetLocalisableDescription() ?? value.ToString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -106,7 +106,19 @@ namespace osu.Game.Overlays
|
|||||||
public OverlayHeaderTabItem(T value)
|
public OverlayHeaderTabItem(T value)
|
||||||
: base(value)
|
: base(value)
|
||||||
{
|
{
|
||||||
Text.Text = ((Value as Enum)?.GetDescription() ?? Value.ToString()).ToLower();
|
if (!(Value is Enum enumValue))
|
||||||
|
Text.Text = Value.ToString().ToLower();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var localisableDescription = enumValue.GetLocalisableDescription();
|
||||||
|
var nonLocalisableDescription = enumValue.GetDescription();
|
||||||
|
|
||||||
|
// If localisable == non-localisable, then we must have a basic string, so .ToLower() is used.
|
||||||
|
Text.Text = localisableDescription.Equals(nonLocalisableDescription)
|
||||||
|
? nonLocalisableDescription.ToLower()
|
||||||
|
: localisableDescription;
|
||||||
|
}
|
||||||
|
|
||||||
Text.Font = OsuFont.GetFont(size: 14);
|
Text.Font = OsuFont.GetFont(size: 14);
|
||||||
Text.Margin = new MarginPadding { Vertical = 16.5f }; // 15px padding + 1.5px line-height difference compensation
|
Text.Margin = new MarginPadding { Vertical = 16.5f }; // 15px padding + 1.5px line-height difference compensation
|
||||||
Bar.Margin = new MarginPadding { Bottom = bar_height };
|
Bar.Margin = new MarginPadding { Bottom = bar_height };
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
// 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 System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Scoring
|
namespace osu.Game.Scoring
|
||||||
{
|
{
|
||||||
|
[LocalisableEnum(typeof(ScoreRankEnumLocalisationMapper))]
|
||||||
public enum ScoreRank
|
public enum ScoreRank
|
||||||
{
|
{
|
||||||
[Description(@"D")]
|
[Description(@"D")]
|
||||||
@ -31,4 +35,40 @@ namespace osu.Game.Scoring
|
|||||||
[Description(@"SS+")]
|
[Description(@"SS+")]
|
||||||
XH,
|
XH,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ScoreRankEnumLocalisationMapper : EnumLocalisationMapper<ScoreRank>
|
||||||
|
{
|
||||||
|
public override LocalisableString Map(ScoreRank value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case ScoreRank.XH:
|
||||||
|
return BeatmapsStrings.RankXH;
|
||||||
|
|
||||||
|
case ScoreRank.X:
|
||||||
|
return BeatmapsStrings.RankX;
|
||||||
|
|
||||||
|
case ScoreRank.SH:
|
||||||
|
return BeatmapsStrings.RankSH;
|
||||||
|
|
||||||
|
case ScoreRank.S:
|
||||||
|
return BeatmapsStrings.RankS;
|
||||||
|
|
||||||
|
case ScoreRank.A:
|
||||||
|
return BeatmapsStrings.RankA;
|
||||||
|
|
||||||
|
case ScoreRank.B:
|
||||||
|
return BeatmapsStrings.RankB;
|
||||||
|
|
||||||
|
case ScoreRank.C:
|
||||||
|
return BeatmapsStrings.RankC;
|
||||||
|
|
||||||
|
case ScoreRank.D:
|
||||||
|
return BeatmapsStrings.RankD;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(value), value, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2021.614.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2021.616.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.614.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.614.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.4.0" />
|
<PackageReference Include="Sentry" Version="3.4.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.28.2" />
|
<PackageReference Include="SharpCompress" Version="0.28.2" />
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.614.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.616.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.614.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.614.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
||||||
@ -93,7 +93,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2021.614.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2021.616.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.28.2" />
|
<PackageReference Include="SharpCompress" Version="0.28.2" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user