mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:28:00 +08:00
Make UserPanel show current user activity when
user status is online.
This commit is contained in:
parent
fa986bb5e9
commit
88b8afbb6a
@ -152,6 +152,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
};
|
||||
|
||||
panel.Status.BindTo(api.LocalUser.Value.Status);
|
||||
panel.Activity.BindTo(api.LocalUser.Value.Activity);
|
||||
|
||||
dropdown.Current.ValueChanged += action =>
|
||||
{
|
||||
|
@ -126,6 +126,7 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
panel.Status.BindTo(u.Status);
|
||||
panel.Activity.BindTo(u.Activity);
|
||||
return panel;
|
||||
})
|
||||
};
|
||||
|
@ -150,7 +150,7 @@ namespace osu.Game.Screens
|
||||
sampleExit?.Play();
|
||||
applyArrivingDefaults(true);
|
||||
|
||||
ScreenStatus = ScreenStatus;
|
||||
ScreenActivity = ScreenActivity;
|
||||
|
||||
base.OnResuming(last);
|
||||
}
|
||||
@ -168,7 +168,7 @@ namespace osu.Game.Screens
|
||||
|
||||
backgroundStack?.Push(localBackground = CreateBackground());
|
||||
|
||||
ScreenStatus = InitialScreenActivity;
|
||||
ScreenActivity = InitialScreenActivity;
|
||||
|
||||
base.OnEntering(last);
|
||||
}
|
||||
|
@ -30,6 +30,9 @@ namespace osu.Game.Users
|
||||
private const float content_padding = 10;
|
||||
private const float status_height = 30;
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
private Container statusBar;
|
||||
private Box statusBg;
|
||||
private OsuSpriteText statusMessage;
|
||||
@ -39,6 +42,8 @@ namespace osu.Game.Users
|
||||
|
||||
public readonly Bindable<UserStatus> Status = new Bindable<UserStatus>();
|
||||
|
||||
public readonly Bindable<UserActivity> Activity = new Bindable<UserActivity>();
|
||||
|
||||
public new Action Action;
|
||||
|
||||
protected Action ViewProfile;
|
||||
@ -54,7 +59,7 @@ namespace osu.Game.Users
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuColour colours, UserProfileOverlay profile)
|
||||
private void load(UserProfileOverlay profile)
|
||||
{
|
||||
if (colours == null)
|
||||
throw new ArgumentNullException(nameof(colours));
|
||||
@ -195,8 +200,8 @@ namespace osu.Game.Users
|
||||
});
|
||||
}
|
||||
|
||||
Status.ValueChanged += status => displayStatus(status.NewValue);
|
||||
Status.ValueChanged += status => statusBg.FadeColour(status.NewValue?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint);
|
||||
Status.ValueChanged += status => displayStatus(status.NewValue, Activity.Value);
|
||||
Activity.ValueChanged += activity => displayStatus(Status.Value, activity.NewValue);
|
||||
|
||||
base.Action = ViewProfile = () =>
|
||||
{
|
||||
@ -211,7 +216,7 @@ namespace osu.Game.Users
|
||||
Status.TriggerChange();
|
||||
}
|
||||
|
||||
private void displayStatus(UserStatus status)
|
||||
private void displayStatus(UserStatus status, UserActivity activity = null)
|
||||
{
|
||||
const float transition_duration = 500;
|
||||
|
||||
@ -227,7 +232,15 @@ namespace osu.Game.Users
|
||||
statusBar.FadeIn(transition_duration, Easing.OutQuint);
|
||||
this.ResizeHeightTo(height, transition_duration, Easing.OutQuint);
|
||||
|
||||
if (status is UserStatusOnline && activity != null)
|
||||
{
|
||||
statusMessage.Text = activity.Status;
|
||||
statusBg.FadeColour(status.GetAppropriateColour(colours), 500, Easing.OutQuint);
|
||||
return;
|
||||
}
|
||||
|
||||
statusMessage.Text = status.Message;
|
||||
statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user