mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:23:00 +08:00
Localise friends online status stream control.
This commit is contained in:
parent
285c49be7e
commit
f2287ba022
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using Humanizer;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osuTK.Graphics;
|
||||
@ -17,11 +18,11 @@ namespace osu.Game.Overlays.Changelog
|
||||
Width *= 2;
|
||||
}
|
||||
|
||||
protected override string MainText => Value.DisplayName;
|
||||
protected override LocalisableString MainText => Value.DisplayName;
|
||||
|
||||
protected override string AdditionalText => Value.LatestBuild.DisplayVersion;
|
||||
protected override LocalisableString AdditionalText => Value.LatestBuild.DisplayVersion;
|
||||
|
||||
protected override string InfoText => Value.LatestBuild.Users > 0 ? $"{"user".ToQuantity(Value.LatestBuild.Users, "N0")} online" : null;
|
||||
protected override LocalisableString InfoText => Value.LatestBuild.Users > 0 ? $"{"user".ToQuantity(Value.LatestBuild.Users, "N0")} online" : null;
|
||||
|
||||
protected override Color4 GetBarColour(OsuColour colours) => Value.Colour;
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -14,9 +16,9 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
||||
{
|
||||
}
|
||||
|
||||
protected override string MainText => Value.Status.ToString();
|
||||
protected override LocalisableString MainText => Value.Status.GetLocalisableDescription();
|
||||
|
||||
protected override string AdditionalText => Value.Count.ToString();
|
||||
protected override LocalisableString AdditionalText => Value.Count.ToString();
|
||||
|
||||
protected override Color4 GetBarColour(OsuColour colours)
|
||||
{
|
||||
|
@ -1,12 +1,38 @@
|
||||
// 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.Dashboard.Friends
|
||||
{
|
||||
[LocalisableEnum(typeof(OnlineStatusEnumLocalisationMapper))]
|
||||
public enum OnlineStatus
|
||||
{
|
||||
All,
|
||||
Online,
|
||||
Offline
|
||||
}
|
||||
|
||||
public class OnlineStatusEnumLocalisationMapper : EnumLocalisationMapper<OnlineStatus>
|
||||
{
|
||||
public override LocalisableString Map(OnlineStatus value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case OnlineStatus.All:
|
||||
return SortStrings.All;
|
||||
|
||||
case OnlineStatus.Online:
|
||||
return UsersStrings.StatusOnline;
|
||||
|
||||
case OnlineStatus.Offline:
|
||||
return UsersStrings.StatusOffline;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(value), value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
@ -88,11 +89,11 @@ namespace osu.Game.Overlays
|
||||
SelectedItem.BindValueChanged(_ => updateState(), true);
|
||||
}
|
||||
|
||||
protected abstract string MainText { get; }
|
||||
protected abstract LocalisableString MainText { get; }
|
||||
|
||||
protected abstract string AdditionalText { get; }
|
||||
protected abstract LocalisableString AdditionalText { get; }
|
||||
|
||||
protected virtual string InfoText => string.Empty;
|
||||
protected virtual LocalisableString InfoText => string.Empty;
|
||||
|
||||
protected abstract Color4 GetBarColour(OsuColour colours);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user