mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 20:05:29 +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.Status.BindTo(api.LocalUser.Value.Status);
|
||||||
|
panel.Activity.BindTo(api.LocalUser.Value.Activity);
|
||||||
|
|
||||||
dropdown.Current.ValueChanged += action =>
|
dropdown.Current.ValueChanged += action =>
|
||||||
{
|
{
|
||||||
|
@ -126,6 +126,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
panel.Status.BindTo(u.Status);
|
panel.Status.BindTo(u.Status);
|
||||||
|
panel.Activity.BindTo(u.Activity);
|
||||||
return panel;
|
return panel;
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
@ -150,7 +150,7 @@ namespace osu.Game.Screens
|
|||||||
sampleExit?.Play();
|
sampleExit?.Play();
|
||||||
applyArrivingDefaults(true);
|
applyArrivingDefaults(true);
|
||||||
|
|
||||||
ScreenStatus = ScreenStatus;
|
ScreenActivity = ScreenActivity;
|
||||||
|
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
backgroundStack?.Push(localBackground = CreateBackground());
|
backgroundStack?.Push(localBackground = CreateBackground());
|
||||||
|
|
||||||
ScreenStatus = InitialScreenActivity;
|
ScreenActivity = InitialScreenActivity;
|
||||||
|
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
}
|
}
|
||||||
|
@ -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 Bindable<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));
|
||||||
@ -195,8 +200,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 = () =>
|
||||||
{
|
{
|
||||||
@ -211,7 +216,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;
|
||||||
|
|
||||||
@ -227,7 +232,15 @@ namespace osu.Game.Users
|
|||||||
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);
|
||||||
|
|
||||||
|
if (status is UserStatusOnline && activity != null)
|
||||||
|
{
|
||||||
|
statusMessage.Text = activity.Status;
|
||||||
|
statusBg.FadeColour(status.GetAppropriateColour(colours), 500, Easing.OutQuint);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
statusMessage.Text = status.Message;
|
statusMessage.Text = status.Message;
|
||||||
|
statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user