mirror of https://github.com/ppy/osu
quality: convert getter property to method so that sensible information can be hidden via an argument
This commit is contained in:
parent
1baaae35a9
commit
da10166628
|
@ -98,7 +98,7 @@ private void updateStatus()
|
|||
|
||||
if (status.Value is UserStatusOnline && activity.Value != null)
|
||||
{
|
||||
presence.State = truncate(privacyMode.Value == DiscordRichPresenceMode.Limited ? activity.Value.LimitedStatus : activity.Value.Status);
|
||||
presence.State = truncate(activity.Value.GetStatus(privacyMode.Value == DiscordRichPresenceMode.Limited));
|
||||
presence.Details = truncate(getDetails(activity.Value));
|
||||
|
||||
if (getBeatmap(activity.Value) is IBeatmapInfo beatmap && beatmap.OnlineID > 0)
|
||||
|
|
|
@ -106,7 +106,7 @@ private void displayStatus(UserStatus status, UserActivity activity = null)
|
|||
// Set status message based on activity (if we have one) and status is not offline
|
||||
if (activity != null && !(status is UserStatusOffline))
|
||||
{
|
||||
statusMessage.Text = activity.Status;
|
||||
statusMessage.Text = activity.GetStatus();
|
||||
statusIcon.FadeColour(activity.GetAppropriateColour(Colours), 500, Easing.OutQuint);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#nullable disable
|
||||
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Rulesets;
|
||||
|
@ -15,24 +14,19 @@ namespace osu.Game.Users
|
|||
{
|
||||
public abstract class UserActivity
|
||||
{
|
||||
public abstract string Status { get; }
|
||||
|
||||
/// <summary>
|
||||
/// This property is used when the <see cref="DiscordRichPresenceMode"/> is <see cref="DiscordRichPresenceMode.Limited"/>
|
||||
/// </summary>
|
||||
public virtual string LimitedStatus => Status;
|
||||
public abstract string GetStatus(bool hideIdentifiableInformation = false);
|
||||
|
||||
public virtual Color4 GetAppropriateColour(OsuColour colours) => colours.GreenDarker;
|
||||
|
||||
public class Modding : UserActivity
|
||||
{
|
||||
public override string Status => "Modding a map";
|
||||
public override string GetStatus(bool hideIdentifiableInformation = false) => "Modding a map";
|
||||
public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark;
|
||||
}
|
||||
|
||||
public class ChoosingBeatmap : UserActivity
|
||||
{
|
||||
public override string Status => "Choosing a beatmap";
|
||||
public override string GetStatus(bool hideIdentifiableInformation = false) => "Choosing a beatmap";
|
||||
}
|
||||
|
||||
public abstract class InGame : UserActivity
|
||||
|
@ -47,7 +41,7 @@ protected InGame(IBeatmapInfo beatmapInfo, IRulesetInfo ruleset)
|
|||
Ruleset = ruleset;
|
||||
}
|
||||
|
||||
public override string Status => Ruleset.CreateInstance().PlayingVerb;
|
||||
public override string GetStatus(bool hideIdentifiableInformation = false) => Ruleset.CreateInstance().PlayingVerb;
|
||||
}
|
||||
|
||||
public class InMultiplayerGame : InGame
|
||||
|
@ -57,7 +51,7 @@ public InMultiplayerGame(IBeatmapInfo beatmapInfo, IRulesetInfo ruleset)
|
|||
{
|
||||
}
|
||||
|
||||
public override string Status => $@"{base.Status} with others";
|
||||
public override string GetStatus(bool hideIdentifiableInformation = false) => $@"{base.GetStatus(hideIdentifiableInformation)} with others";
|
||||
}
|
||||
|
||||
public class SpectatingMultiplayerGame : InGame
|
||||
|
@ -67,7 +61,7 @@ public SpectatingMultiplayerGame(IBeatmapInfo beatmapInfo, IRulesetInfo ruleset)
|
|||
{
|
||||
}
|
||||
|
||||
public override string Status => $"Watching others {base.Status.ToLowerInvariant()}";
|
||||
public override string GetStatus(bool hideIdentifiableInformation = false) => $"Watching others {base.GetStatus(hideIdentifiableInformation).ToLowerInvariant()}";
|
||||
}
|
||||
|
||||
public class InPlaylistGame : InGame
|
||||
|
@ -95,7 +89,7 @@ public Editing(IBeatmapInfo info)
|
|||
BeatmapInfo = info;
|
||||
}
|
||||
|
||||
public override string Status => @"Editing a beatmap";
|
||||
public override string GetStatus(bool hideIdentifiableInformation = false) => @"Editing a beatmap";
|
||||
}
|
||||
|
||||
public class Watching : UserActivity
|
||||
|
@ -111,12 +105,12 @@ public Watching(ScoreInfo score)
|
|||
this.score = score;
|
||||
}
|
||||
|
||||
public override string Status => $@"Watching {Username}";
|
||||
public override string GetStatus(bool hideIdentifiableInformation = false) => hideIdentifiableInformation ? @"Watching a game" : $@"Watching {Username}";
|
||||
}
|
||||
|
||||
public class Spectating : Watching
|
||||
{
|
||||
public override string Status => $@"Spectating {Username}";
|
||||
public override string GetStatus(bool hideIdentifiableInformation = false) => hideIdentifiableInformation ? @"Spectating a game" : $@"Spectating {Username}";
|
||||
|
||||
public Spectating(ScoreInfo score)
|
||||
: base(score)
|
||||
|
@ -126,12 +120,12 @@ public Spectating(ScoreInfo score)
|
|||
|
||||
public class SearchingForLobby : UserActivity
|
||||
{
|
||||
public override string Status => @"Looking for a lobby";
|
||||
public override string GetStatus(bool hideIdentifiableInformation = false) => @"Looking for a lobby";
|
||||
}
|
||||
|
||||
public class InLobby : UserActivity
|
||||
{
|
||||
public override string Status => @"In a lobby";
|
||||
public override string GetStatus(bool hideIdentifiableInformation = false) => @"In a lobby";
|
||||
|
||||
public readonly Room Room;
|
||||
|
||||
|
|
Loading…
Reference in New Issue