mirror of
https://github.com/osukey/osukey.git
synced 2025-05-20 21:17:32 +09: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<UserStatus> status = new Bindable<UserStatus>();
|
||||||
private readonly IBindable<UserActivity> activity = new Bindable<UserActivity>();
|
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
|
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);
|
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 =>
|
(user = provider.LocalUser.GetBoundCopy()).BindValueChanged(u =>
|
||||||
{
|
{
|
||||||
status.UnbindBindings();
|
status.UnbindBindings();
|
||||||
@ -66,7 +68,7 @@ namespace osu.Desktop
|
|||||||
ruleset.BindValueChanged(_ => updateStatus());
|
ruleset.BindValueChanged(_ => updateStatus());
|
||||||
status.BindValueChanged(_ => updateStatus());
|
status.BindValueChanged(_ => updateStatus());
|
||||||
activity.BindValueChanged(_ => updateStatus());
|
activity.BindValueChanged(_ => updateStatus());
|
||||||
mode.BindValueChanged(_ => updateStatus());
|
privacyMode.BindValueChanged(_ => updateStatus());
|
||||||
|
|
||||||
client.Initialize();
|
client.Initialize();
|
||||||
}
|
}
|
||||||
@ -82,7 +84,7 @@ namespace osu.Desktop
|
|||||||
if (!client.IsInitialized)
|
if (!client.IsInitialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (status.Value is UserStatusOffline || mode.Value == DiscordRichPresenceMode.Off)
|
if (status.Value is UserStatusOffline || privacyMode.Value == DiscordRichPresenceMode.Off)
|
||||||
{
|
{
|
||||||
client.ClearPresence();
|
client.ClearPresence();
|
||||||
return;
|
return;
|
||||||
@ -100,7 +102,7 @@ namespace osu.Desktop
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update user information
|
// update user information
|
||||||
if (mode.Value == DiscordRichPresenceMode.Limited)
|
if (privacyMode.Value == DiscordRichPresenceMode.Limited)
|
||||||
presence.Assets.LargeImageText = string.Empty;
|
presence.Assets.LargeImageText = string.Empty;
|
||||||
else
|
else
|
||||||
presence.Assets.LargeImageText = $"{user.Value.Username}" + (user.Value.Statistics?.Ranks.Global > 0 ? $" (rank #{user.Value.Statistics.Ranks.Global:N0})" : string.Empty);
|
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();
|
return edit.Beatmap.ToString();
|
||||||
|
|
||||||
case UserActivity.InLobby lobby:
|
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;
|
return string.Empty;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user