mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 15:57:24 +08:00
Merge pull request #8441 from EVAST9919/fix-panel-message
Fix last seen date being visible in user panel when it shouldn't
This commit is contained in:
commit
a141e2e8b7
@ -28,7 +28,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
private readonly Bindable<UserStatus> status = new Bindable<UserStatus>();
|
private readonly Bindable<UserStatus> status = new Bindable<UserStatus>();
|
||||||
|
|
||||||
private UserGridPanel peppy;
|
private UserGridPanel peppy;
|
||||||
private UserListPanel evast;
|
private TestUserListPanel evast;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private RulesetStore rulesetStore { get; set; }
|
private RulesetStore rulesetStore { get; set; }
|
||||||
@ -38,6 +38,9 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
UserGridPanel flyte;
|
UserGridPanel flyte;
|
||||||
|
|
||||||
|
activity.Value = null;
|
||||||
|
status.Value = null;
|
||||||
|
|
||||||
Child = new FillFlowContainer
|
Child = new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -63,7 +66,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
IsSupporter = true,
|
IsSupporter = true,
|
||||||
SupportLevel = 3,
|
SupportLevel = 3,
|
||||||
}) { Width = 300 },
|
}) { Width = 300 },
|
||||||
evast = new UserListPanel(new User
|
evast = new TestUserListPanel(new User
|
||||||
{
|
{
|
||||||
Username = @"Evast",
|
Username = @"Evast",
|
||||||
Id = 8195163,
|
Id = 8195163,
|
||||||
@ -96,7 +99,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestUserActivity()
|
public void TestUserActivity()
|
||||||
{
|
{
|
||||||
AddStep("set online status", () => peppy.Status.Value = evast.Status.Value = new UserStatusOnline());
|
AddStep("set online status", () => status.Value = new UserStatusOnline());
|
||||||
|
|
||||||
AddStep("idle", () => activity.Value = null);
|
AddStep("idle", () => activity.Value = null);
|
||||||
AddStep("spectating", () => activity.Value = new UserActivity.Spectating());
|
AddStep("spectating", () => activity.Value = new UserActivity.Spectating());
|
||||||
@ -109,6 +112,29 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("modding", () => activity.Value = new UserActivity.Modding());
|
AddStep("modding", () => activity.Value = new UserActivity.Modding());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestUserActivityChange()
|
||||||
|
{
|
||||||
|
AddAssert("visit message is visible", () => evast.LastVisitMessage.IsPresent);
|
||||||
|
AddStep("set online status", () => status.Value = new UserStatusOnline());
|
||||||
|
AddAssert("visit message is not visible", () => !evast.LastVisitMessage.IsPresent);
|
||||||
|
AddStep("set choosing activity", () => activity.Value = new UserActivity.ChoosingBeatmap());
|
||||||
|
AddStep("set offline status", () => status.Value = new UserStatusOffline());
|
||||||
|
AddAssert("visit message is visible", () => evast.LastVisitMessage.IsPresent);
|
||||||
|
AddStep("set online status", () => status.Value = new UserStatusOnline());
|
||||||
|
AddAssert("visit message is not visible", () => !evast.LastVisitMessage.IsPresent);
|
||||||
|
}
|
||||||
|
|
||||||
private UserActivity soloGameStatusForRuleset(int rulesetId) => new UserActivity.SoloGame(null, rulesetStore.GetRuleset(rulesetId));
|
private UserActivity soloGameStatusForRuleset(int rulesetId) => new UserActivity.SoloGame(null, rulesetStore.GetRuleset(rulesetId));
|
||||||
|
|
||||||
|
private class TestUserListPanel : UserListPanel
|
||||||
|
{
|
||||||
|
public TestUserListPanel(User user)
|
||||||
|
: base(user)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public new TextFlowContainer LastVisitMessage => base.LastVisitMessage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,10 @@ namespace osu.Game.Users
|
|||||||
|
|
||||||
protected DelayedLoadUnloadWrapper Background { get; private set; }
|
protected DelayedLoadUnloadWrapper Background { get; private set; }
|
||||||
|
|
||||||
|
protected TextFlowContainer LastVisitMessage { get; private set; }
|
||||||
|
|
||||||
private SpriteIcon statusIcon;
|
private SpriteIcon statusIcon;
|
||||||
private OsuSpriteText statusMessage;
|
private OsuSpriteText statusMessage;
|
||||||
private TextFlowContainer lastVisitMessage;
|
|
||||||
|
|
||||||
protected UserPanel(User user)
|
protected UserPanel(User user)
|
||||||
{
|
{
|
||||||
@ -153,7 +154,7 @@ namespace osu.Game.Users
|
|||||||
|
|
||||||
var alignment = rightAlignedChildren ? Anchor.CentreRight : Anchor.CentreLeft;
|
var alignment = rightAlignedChildren ? Anchor.CentreRight : Anchor.CentreLeft;
|
||||||
|
|
||||||
statusContainer.Add(lastVisitMessage = new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold)).With(text =>
|
statusContainer.Add(LastVisitMessage = new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold)).With(text =>
|
||||||
{
|
{
|
||||||
text.Anchor = alignment;
|
text.Anchor = alignment;
|
||||||
text.Origin = alignment;
|
text.Origin = alignment;
|
||||||
@ -184,6 +185,8 @@ namespace osu.Game.Users
|
|||||||
{
|
{
|
||||||
if (status != null)
|
if (status != null)
|
||||||
{
|
{
|
||||||
|
LastVisitMessage.FadeTo(status is UserStatusOffline && User.LastVisit.HasValue ? 1 : 0);
|
||||||
|
|
||||||
// Set status message based on activity (if we have one) and status is not offline
|
// Set status message based on activity (if we have one) and status is not offline
|
||||||
if (activity != null && !(status is UserStatusOffline))
|
if (activity != null && !(status is UserStatusOffline))
|
||||||
{
|
{
|
||||||
@ -193,7 +196,6 @@ namespace osu.Game.Users
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise use only status
|
// Otherwise use only status
|
||||||
lastVisitMessage.FadeTo(status is UserStatusOffline && User.LastVisit.HasValue ? 1 : 0);
|
|
||||||
statusMessage.Text = status.Message;
|
statusMessage.Text = status.Message;
|
||||||
statusIcon.FadeColour(status.GetAppropriateColour(colours), 500, Easing.OutQuint);
|
statusIcon.FadeColour(status.GetAppropriateColour(colours), 500, Easing.OutQuint);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user