mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 13:23:05 +08:00
Merge branch 'master' into fix-social-overlay-performance
This commit is contained in:
commit
169c18d238
@ -2,6 +2,7 @@
|
|||||||
// 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 NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
@ -12,10 +13,12 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneUserPanel : OsuTestScene
|
public class TestSceneUserPanel : OsuTestScene
|
||||||
{
|
{
|
||||||
|
private readonly UserPanel peppy;
|
||||||
|
|
||||||
public TestSceneUserPanel()
|
public TestSceneUserPanel()
|
||||||
{
|
{
|
||||||
UserPanel flyte;
|
UserPanel flyte;
|
||||||
UserPanel peppy;
|
|
||||||
Add(new FillFlowContainer
|
Add(new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -44,13 +47,31 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
});
|
});
|
||||||
|
|
||||||
flyte.Status.Value = new UserStatusOnline();
|
flyte.Status.Value = new UserStatusOnline();
|
||||||
peppy.Status.Value = new UserStatusSoloGame();
|
peppy.Status.Value = null;
|
||||||
|
}
|
||||||
|
|
||||||
AddStep(@"spectating", () => { flyte.Status.Value = new UserStatusSpectating(); });
|
[Test]
|
||||||
AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); });
|
public void UserStatusesTests()
|
||||||
AddStep(@"modding", () => { flyte.Status.Value = new UserStatusModding(); });
|
{
|
||||||
AddStep(@"offline", () => { flyte.Status.Value = new UserStatusOffline(); });
|
AddStep("online", () => { peppy.Status.Value = new UserStatusOnline(); });
|
||||||
AddStep(@"null status", () => { flyte.Status.Value = null; });
|
AddStep(@"do not disturb", () => { peppy.Status.Value = new UserStatusDoNotDisturb(); });
|
||||||
|
AddStep(@"offline", () => { peppy.Status.Value = new UserStatusOffline(); });
|
||||||
|
AddStep(@"null status", () => { peppy.Status.Value = null; });
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void UserActivitiesTests()
|
||||||
|
{
|
||||||
|
Bindable<UserActivity> activity = new Bindable<UserActivity>();
|
||||||
|
|
||||||
|
peppy.Activity.BindTo(activity);
|
||||||
|
|
||||||
|
AddStep("idle", () => { activity.Value = null; });
|
||||||
|
AddStep("spectating", () => { activity.Value = new UserActivity.Spectating(); });
|
||||||
|
AddStep("solo", () => { activity.Value = new UserActivity.SoloGame(null, null); });
|
||||||
|
AddStep("choosing", () => { activity.Value = new UserActivity.ChoosingBeatmap(); });
|
||||||
|
AddStep("editing", () => { activity.Value = new UserActivity.Editing(null); });
|
||||||
|
AddStep("modding", () => { activity.Value = new UserActivity.Modding(); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,8 @@ namespace osu.Game.Online.API
|
|||||||
|
|
||||||
public Bindable<User> LocalUser { get; } = new Bindable<User>(createGuestUser());
|
public Bindable<User> LocalUser { get; } = new Bindable<User>(createGuestUser());
|
||||||
|
|
||||||
|
public Bindable<UserActivity> Activity { get; } = new Bindable<UserActivity>();
|
||||||
|
|
||||||
protected bool HasLogin => authentication.Token.Value != null || (!string.IsNullOrEmpty(ProvidedUsername) && !string.IsNullOrEmpty(password));
|
protected bool HasLogin => authentication.Token.Value != null || (!string.IsNullOrEmpty(ProvidedUsername) && !string.IsNullOrEmpty(password));
|
||||||
|
|
||||||
private readonly CancellationTokenSource cancellationToken = new CancellationTokenSource();
|
private readonly CancellationTokenSource cancellationToken = new CancellationTokenSource();
|
||||||
@ -55,6 +57,12 @@ namespace osu.Game.Online.API
|
|||||||
authentication.TokenString = config.Get<string>(OsuSetting.Token);
|
authentication.TokenString = config.Get<string>(OsuSetting.Token);
|
||||||
authentication.Token.ValueChanged += onTokenChanged;
|
authentication.Token.ValueChanged += onTokenChanged;
|
||||||
|
|
||||||
|
LocalUser.BindValueChanged(u =>
|
||||||
|
{
|
||||||
|
u.OldValue?.Activity.UnbindFrom(Activity);
|
||||||
|
u.NewValue.Activity.BindTo(Activity);
|
||||||
|
}, true);
|
||||||
|
|
||||||
var thread = new Thread(run)
|
var thread = new Thread(run)
|
||||||
{
|
{
|
||||||
Name = "APIAccess",
|
Name = "APIAccess",
|
||||||
|
@ -17,6 +17,8 @@ namespace osu.Game.Online.API
|
|||||||
Id = 1001,
|
Id = 1001,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
public Bindable<UserActivity> Activity { get; } = new Bindable<UserActivity>();
|
||||||
|
|
||||||
public bool IsLoggedIn => true;
|
public bool IsLoggedIn => true;
|
||||||
|
|
||||||
public string ProvidedUsername => LocalUser.Value.Username;
|
public string ProvidedUsername => LocalUser.Value.Username;
|
||||||
@ -41,6 +43,15 @@ namespace osu.Game.Online.API
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DummyAPIAccess()
|
||||||
|
{
|
||||||
|
LocalUser.BindValueChanged(u =>
|
||||||
|
{
|
||||||
|
u.OldValue?.Activity.UnbindFrom(Activity);
|
||||||
|
u.NewValue.Activity.BindTo(Activity);
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Queue(APIRequest request)
|
public virtual void Queue(APIRequest request)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,11 @@ namespace osu.Game.Online.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Bindable<User> LocalUser { get; }
|
Bindable<User> LocalUser { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current user's activity.
|
||||||
|
/// </summary>
|
||||||
|
Bindable<UserActivity> Activity { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns whether the local user is logged in.
|
/// Returns whether the local user is logged in.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -154,8 +154,9 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
};
|
};
|
||||||
|
|
||||||
panel.Status.BindTo(api.LocalUser.Value.Status);
|
panel.Status.BindTo(api.LocalUser.Value.Status);
|
||||||
|
panel.Activity.BindTo(api.LocalUser.Value.Activity);
|
||||||
|
|
||||||
dropdown.Current.ValueChanged += action =>
|
dropdown.Current.BindValueChanged(action =>
|
||||||
{
|
{
|
||||||
switch (action.NewValue)
|
switch (action.NewValue)
|
||||||
{
|
{
|
||||||
@ -178,9 +179,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
api.Logout();
|
api.Logout();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
}, true);
|
||||||
dropdown.Current.TriggerChange();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,6 +119,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
panel.Status.BindTo(u.Status);
|
panel.Status.BindTo(u.Status);
|
||||||
|
panel.Activity.BindTo(u.Activity);
|
||||||
return panel;
|
return panel;
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
@ -24,6 +24,7 @@ using osu.Game.Screens.Edit.Design;
|
|||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit
|
namespace osu.Game.Screens.Edit
|
||||||
{
|
{
|
||||||
@ -47,6 +48,8 @@ namespace osu.Game.Screens.Edit
|
|||||||
private DependencyContainer dependencies;
|
private DependencyContainer dependencies;
|
||||||
private GameHost host;
|
private GameHost host;
|
||||||
|
|
||||||
|
protected override UserActivity InitialActivity => new UserActivity.Editing(Beatmap.Value.BeatmapInfo);
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ using osu.Game.Input.Bindings;
|
|||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Users;
|
||||||
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
namespace osu.Game.Screens
|
namespace osu.Game.Screens
|
||||||
@ -52,6 +54,30 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
protected new OsuGameBase Game => base.Game as OsuGameBase;
|
protected new OsuGameBase Game => base.Game as OsuGameBase;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="UserActivity"/> to set the user's activity automatically to when this screen is entered
|
||||||
|
/// <para>This <see cref="Activity"/> will be automatically set to <see cref="InitialActivity"/> for this screen on entering unless
|
||||||
|
/// <see cref="Activity"/> is manually set before.</para>
|
||||||
|
/// </summary>
|
||||||
|
protected virtual UserActivity InitialActivity => null;
|
||||||
|
|
||||||
|
private UserActivity activity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current <see cref="UserActivity"/> for this screen.
|
||||||
|
/// </summary>
|
||||||
|
protected UserActivity Activity
|
||||||
|
{
|
||||||
|
get => activity;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == activity) return;
|
||||||
|
|
||||||
|
activity = value;
|
||||||
|
updateActivity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to disallow changes to game-wise Beatmap/Ruleset bindables for this screen (and all children).
|
/// Whether to disallow changes to game-wise Beatmap/Ruleset bindables for this screen (and all children).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -90,6 +116,9 @@ namespace osu.Game.Screens
|
|||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private OsuLogo logo { get; set; }
|
private OsuLogo logo { get; set; }
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
protected OsuScreen()
|
protected OsuScreen()
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
@ -123,12 +152,15 @@ namespace osu.Game.Screens
|
|||||||
sampleExit?.Play();
|
sampleExit?.Play();
|
||||||
applyArrivingDefaults(true);
|
applyArrivingDefaults(true);
|
||||||
|
|
||||||
|
updateActivity();
|
||||||
|
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSuspending(IScreen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
|
|
||||||
onSuspendingLogo();
|
onSuspendingLogo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +170,9 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
backgroundStack?.Push(localBackground = CreateBackground());
|
backgroundStack?.Push(localBackground = CreateBackground());
|
||||||
|
|
||||||
|
if (activity == null)
|
||||||
|
Activity = InitialActivity;
|
||||||
|
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,6 +190,12 @@ namespace osu.Game.Screens
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateActivity()
|
||||||
|
{
|
||||||
|
if (api != null)
|
||||||
|
api.Activity.Value = activity;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when this screen was entered or resumed and the logo state is required to be adjusted.
|
/// Fired when this screen was entered or resumed and the logo state is required to be adjusted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -27,6 +27,7 @@ using osu.Game.Scoring;
|
|||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Storyboards.Drawables;
|
using osu.Game.Storyboards.Drawables;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
@ -34,6 +35,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
protected override bool AllowBackButton => false; // handled by HoldForMenuButton
|
protected override bool AllowBackButton => false; // handled by HoldForMenuButton
|
||||||
|
|
||||||
|
protected override UserActivity InitialActivity => new UserActivity.SoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value);
|
||||||
|
|
||||||
public override float BackgroundParallaxAmount => 0.1f;
|
public override float BackgroundParallaxAmount => 0.1f;
|
||||||
|
|
||||||
public override bool HideOverlaysOnEnter => true;
|
public override bool HideOverlaysOnEnter => true;
|
||||||
|
@ -22,6 +22,7 @@ using osu.Game.Rulesets.Mods;
|
|||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
using osu.Game.Screens.Play.PlayerSettings;
|
using osu.Game.Screens.Play.PlayerSettings;
|
||||||
|
using osu.Game.Users;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -42,6 +43,8 @@ namespace osu.Game.Screens.Play
|
|||||||
private bool hideOverlays;
|
private bool hideOverlays;
|
||||||
public override bool HideOverlaysOnEnter => hideOverlays;
|
public override bool HideOverlaysOnEnter => hideOverlays;
|
||||||
|
|
||||||
|
protected override UserActivity InitialActivity => null; //shows the previous screen status
|
||||||
|
|
||||||
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||||
|
|
||||||
protected override bool PlayResumeSound => false;
|
protected override bool PlayResumeSound => false;
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
|
using osu.Game.Users;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
@ -18,6 +19,8 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public override bool AllowExternalScreenChange => true;
|
public override bool AllowExternalScreenChange => true;
|
||||||
|
|
||||||
|
protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,8 @@ namespace osu.Game.Users
|
|||||||
|
|
||||||
public Bindable<UserStatus> Status = new Bindable<UserStatus>();
|
public Bindable<UserStatus> Status = new Bindable<UserStatus>();
|
||||||
|
|
||||||
|
public IBindable<UserActivity> Activity = new Bindable<UserActivity>();
|
||||||
|
|
||||||
//public Team Team;
|
//public Team Team;
|
||||||
|
|
||||||
[JsonProperty(@"profile_colour")]
|
[JsonProperty(@"profile_colour")]
|
||||||
|
68
osu.Game/Users/UserActivity.cs
Normal file
68
osu.Game/Users/UserActivity.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
// 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 osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Users
|
||||||
|
{
|
||||||
|
public abstract class UserActivity
|
||||||
|
{
|
||||||
|
public abstract string Status { get; }
|
||||||
|
public virtual Color4 GetAppropriateColour(OsuColour colours) => colours.GreenDarker;
|
||||||
|
|
||||||
|
public class Modding : UserActivity
|
||||||
|
{
|
||||||
|
public override string Status => "Modding a map";
|
||||||
|
public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ChoosingBeatmap : UserActivity
|
||||||
|
{
|
||||||
|
public override string Status => "Choosing a beatmap";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MultiplayerGame : UserActivity
|
||||||
|
{
|
||||||
|
public override string Status => "Playing with others";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Editing : UserActivity
|
||||||
|
{
|
||||||
|
public BeatmapInfo Beatmap { get; }
|
||||||
|
|
||||||
|
public Editing(BeatmapInfo info)
|
||||||
|
{
|
||||||
|
Beatmap = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Status => @"Editing a beatmap";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SoloGame : UserActivity
|
||||||
|
{
|
||||||
|
public BeatmapInfo Beatmap { get; }
|
||||||
|
|
||||||
|
public Rulesets.RulesetInfo Ruleset { get; }
|
||||||
|
|
||||||
|
public SoloGame(BeatmapInfo info, Rulesets.RulesetInfo ruleset)
|
||||||
|
{
|
||||||
|
Beatmap = info;
|
||||||
|
Ruleset = ruleset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Status => @"Playing alone";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Spectating : UserActivity
|
||||||
|
{
|
||||||
|
public override string Status => @"Spectating a game";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InLobby : UserActivity
|
||||||
|
{
|
||||||
|
public override string Status => @"In a Multiplayer Lobby";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -30,6 +30,9 @@ namespace osu.Game.Users
|
|||||||
private const float content_padding = 10;
|
private const float content_padding = 10;
|
||||||
private const float status_height = 30;
|
private const float status_height = 30;
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
private Container statusBar;
|
private Container statusBar;
|
||||||
private Box statusBg;
|
private Box statusBg;
|
||||||
private OsuSpriteText statusMessage;
|
private OsuSpriteText statusMessage;
|
||||||
@ -39,6 +42,8 @@ namespace osu.Game.Users
|
|||||||
|
|
||||||
public readonly Bindable<UserStatus> Status = new Bindable<UserStatus>();
|
public readonly Bindable<UserStatus> Status = new Bindable<UserStatus>();
|
||||||
|
|
||||||
|
public readonly IBindable<UserActivity> Activity = new Bindable<UserActivity>();
|
||||||
|
|
||||||
public new Action Action;
|
public new Action Action;
|
||||||
|
|
||||||
protected Action ViewProfile;
|
protected Action ViewProfile;
|
||||||
@ -54,7 +59,7 @@ namespace osu.Game.Users
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(OsuColour colours, UserProfileOverlay profile)
|
private void load(UserProfileOverlay profile)
|
||||||
{
|
{
|
||||||
if (colours == null)
|
if (colours == null)
|
||||||
throw new ArgumentNullException(nameof(colours));
|
throw new ArgumentNullException(nameof(colours));
|
||||||
@ -194,8 +199,8 @@ namespace osu.Game.Users
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Status.ValueChanged += status => displayStatus(status.NewValue);
|
Status.ValueChanged += status => displayStatus(status.NewValue, Activity.Value);
|
||||||
Status.ValueChanged += status => statusBg.FadeColour(status.NewValue?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint);
|
Activity.ValueChanged += activity => displayStatus(Status.Value, activity.NewValue);
|
||||||
|
|
||||||
base.Action = ViewProfile = () =>
|
base.Action = ViewProfile = () =>
|
||||||
{
|
{
|
||||||
@ -210,7 +215,7 @@ namespace osu.Game.Users
|
|||||||
Status.TriggerChange();
|
Status.TriggerChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayStatus(UserStatus status)
|
private void displayStatus(UserStatus status, UserActivity activity = null)
|
||||||
{
|
{
|
||||||
const float transition_duration = 500;
|
const float transition_duration = 500;
|
||||||
|
|
||||||
@ -225,8 +230,17 @@ namespace osu.Game.Users
|
|||||||
statusBar.ResizeHeightTo(status_height, transition_duration, Easing.OutQuint);
|
statusBar.ResizeHeightTo(status_height, transition_duration, Easing.OutQuint);
|
||||||
statusBar.FadeIn(transition_duration, Easing.OutQuint);
|
statusBar.FadeIn(transition_duration, Easing.OutQuint);
|
||||||
this.ResizeHeightTo(height, transition_duration, Easing.OutQuint);
|
this.ResizeHeightTo(height, transition_duration, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
statusMessage.Text = status.Message;
|
if (status is UserStatusOnline && activity != null)
|
||||||
|
{
|
||||||
|
statusMessage.Text = activity.Status;
|
||||||
|
statusBg.FadeColour(activity.GetAppropriateColour(colours), 500, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
statusMessage.Text = status?.Message;
|
||||||
|
statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,33 +29,7 @@ namespace osu.Game.Users
|
|||||||
public override Color4 GetAppropriateColour(OsuColour colours) => colours.Gray7;
|
public override Color4 GetAppropriateColour(OsuColour colours) => colours.Gray7;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UserStatusSpectating : UserStatusOnline
|
public class UserStatusDoNotDisturb : UserStatus
|
||||||
{
|
|
||||||
public override string Message => @"Spectating a game";
|
|
||||||
}
|
|
||||||
|
|
||||||
public class UserStatusInLobby : UserStatusOnline
|
|
||||||
{
|
|
||||||
public override string Message => @"in Multiplayer Lobby";
|
|
||||||
}
|
|
||||||
|
|
||||||
public class UserStatusSoloGame : UserStatusBusy
|
|
||||||
{
|
|
||||||
public override string Message => @"Solo Game";
|
|
||||||
}
|
|
||||||
|
|
||||||
public class UserStatusMultiplayerGame : UserStatusBusy
|
|
||||||
{
|
|
||||||
public override string Message => @"Multiplaying";
|
|
||||||
}
|
|
||||||
|
|
||||||
public class UserStatusModding : UserStatusOnline
|
|
||||||
{
|
|
||||||
public override string Message => @"Modding a map";
|
|
||||||
public override Color4 GetAppropriateColour(OsuColour colours) => colours.PurpleDark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class UserStatusDoNotDisturb : UserStatusBusy
|
|
||||||
{
|
{
|
||||||
public override string Message => @"Do not disturb";
|
public override string Message => @"Do not disturb";
|
||||||
public override Color4 GetAppropriateColour(OsuColour colours) => colours.RedDark;
|
public override Color4 GetAppropriateColour(OsuColour colours) => colours.RedDark;
|
||||||
|
Loading…
Reference in New Issue
Block a user