mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Tidy up variables and spacing
This commit is contained in:
parent
7c9f345cd2
commit
a8530fde9d
@ -31,7 +31,8 @@ namespace osu.Desktop
|
||||
|
||||
private readonly IBindable<UserStatus> status = new Bindable<UserStatus>();
|
||||
private readonly IBindable<UserActivity> activity = new Bindable<UserActivity>();
|
||||
private readonly Bindable<DiscordRichPresenceMode> mode = new Bindable<DiscordRichPresenceMode>();
|
||||
|
||||
private readonly Bindable<DiscordRichPresenceMode> privacyMode = new Bindable<DiscordRichPresenceMode>();
|
||||
|
||||
private readonly RichPresence presence = new RichPresence
|
||||
{
|
||||
@ -53,7 +54,8 @@ namespace osu.Desktop
|
||||
|
||||
client.OnError += (_, e) => Logger.Log($"An error occurred with Discord RPC Client: {e.Code} {e.Message}", LoggingTarget.Network);
|
||||
|
||||
config.BindWith(OsuSetting.DiscordRichPresence, mode);
|
||||
config.BindWith(OsuSetting.DiscordRichPresence, privacyMode);
|
||||
|
||||
(user = provider.LocalUser.GetBoundCopy()).BindValueChanged(u =>
|
||||
{
|
||||
status.UnbindBindings();
|
||||
@ -66,7 +68,7 @@ namespace osu.Desktop
|
||||
ruleset.BindValueChanged(_ => updateStatus());
|
||||
status.BindValueChanged(_ => updateStatus());
|
||||
activity.BindValueChanged(_ => updateStatus());
|
||||
mode.BindValueChanged(_ => updateStatus());
|
||||
privacyMode.BindValueChanged(_ => updateStatus());
|
||||
|
||||
client.Initialize();
|
||||
}
|
||||
@ -82,7 +84,7 @@ namespace osu.Desktop
|
||||
if (!client.IsInitialized)
|
||||
return;
|
||||
|
||||
if (status.Value is UserStatusOffline || mode.Value == DiscordRichPresenceMode.Off)
|
||||
if (status.Value is UserStatusOffline || privacyMode.Value == DiscordRichPresenceMode.Off)
|
||||
{
|
||||
client.ClearPresence();
|
||||
return;
|
||||
@ -100,7 +102,7 @@ namespace osu.Desktop
|
||||
}
|
||||
|
||||
// update user information
|
||||
if (mode.Value == DiscordRichPresenceMode.Limited)
|
||||
if (privacyMode.Value == DiscordRichPresenceMode.Limited)
|
||||
presence.Assets.LargeImageText = string.Empty;
|
||||
else
|
||||
presence.Assets.LargeImageText = $"{user.Value.Username}" + (user.Value.Statistics?.Ranks.Global > 0 ? $" (rank #{user.Value.Statistics.Ranks.Global:N0})" : string.Empty);
|
||||
@ -144,7 +146,7 @@ namespace osu.Desktop
|
||||
return edit.Beatmap.ToString();
|
||||
|
||||
case UserActivity.InLobby lobby:
|
||||
return mode.Value == DiscordRichPresenceMode.Limited ? string.Empty : lobby.Room.Name.Value;
|
||||
return privacyMode.Value == DiscordRichPresenceMode.Limited ? string.Empty : lobby.Room.Name.Value;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
|
Loading…
Reference in New Issue
Block a user