mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 20:12:57 +08:00
Substitute APIUser
for UserProfile
in overlay
This commit is contained in:
parent
608d8ee7d4
commit
d7294ac3e6
@ -9,6 +9,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Profile;
|
||||||
using osu.Game.Overlays.Profile.Sections;
|
using osu.Game.Overlays.Profile.Sections;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Online
|
namespace osu.Game.Tests.Visual.Online
|
||||||
@ -37,8 +38,8 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Child = section = new HistoricalSection(),
|
Child = section = new HistoricalSection(),
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("Show peppy", () => section.User.Value = new APIUser { Id = 2 });
|
AddStep("Show peppy", () => section.UserProfile.Value = new UserProfile(new APIUser { Id = 2 }));
|
||||||
AddStep("Show WubWoofWolf", () => section.User.Value = new APIUser { Id = 39828 });
|
AddStep("Show WubWoofWolf", () => section.UserProfile.Value = new UserProfile(new APIUser { Id = 39828 }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Game.Overlays.Profile.Sections.Historical;
|
using osu.Game.Overlays.Profile.Sections.Historical;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -14,6 +12,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
using osu.Game.Overlays.Profile;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Online
|
namespace osu.Game.Tests.Visual.Online
|
||||||
{
|
{
|
||||||
@ -22,7 +21,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Cached]
|
[Cached]
|
||||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Red);
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Red);
|
||||||
|
|
||||||
private readonly Bindable<APIUser> user = new Bindable<APIUser>();
|
private readonly Bindable<UserProfile?> user = new Bindable<UserProfile?>();
|
||||||
private readonly PlayHistorySubsection section;
|
private readonly PlayHistorySubsection section;
|
||||||
|
|
||||||
public TestScenePlayHistorySubsection()
|
public TestScenePlayHistorySubsection()
|
||||||
@ -45,49 +44,49 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestNullValues()
|
public void TestNullValues()
|
||||||
{
|
{
|
||||||
AddStep("Load user", () => user.Value = user_with_null_values);
|
AddStep("Load user", () => user.Value = new UserProfile(user_with_null_values));
|
||||||
AddAssert("Section is hidden", () => section.Alpha == 0);
|
AddAssert("Section is hidden", () => section.Alpha == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestEmptyValues()
|
public void TestEmptyValues()
|
||||||
{
|
{
|
||||||
AddStep("Load user", () => user.Value = user_with_empty_values);
|
AddStep("Load user", () => user.Value = new UserProfile(user_with_empty_values));
|
||||||
AddAssert("Section is hidden", () => section.Alpha == 0);
|
AddAssert("Section is hidden", () => section.Alpha == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestOneValue()
|
public void TestOneValue()
|
||||||
{
|
{
|
||||||
AddStep("Load user", () => user.Value = user_with_one_value);
|
AddStep("Load user", () => user.Value = new UserProfile(user_with_one_value));
|
||||||
AddAssert("Section is hidden", () => section.Alpha == 0);
|
AddAssert("Section is hidden", () => section.Alpha == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestTwoValues()
|
public void TestTwoValues()
|
||||||
{
|
{
|
||||||
AddStep("Load user", () => user.Value = user_with_two_values);
|
AddStep("Load user", () => user.Value = new UserProfile(user_with_two_values));
|
||||||
AddAssert("Section is visible", () => section.Alpha == 1);
|
AddAssert("Section is visible", () => section.Alpha == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestConstantValues()
|
public void TestConstantValues()
|
||||||
{
|
{
|
||||||
AddStep("Load user", () => user.Value = user_with_constant_values);
|
AddStep("Load user", () => user.Value = new UserProfile(user_with_constant_values));
|
||||||
AddAssert("Section is visible", () => section.Alpha == 1);
|
AddAssert("Section is visible", () => section.Alpha == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestConstantZeroValues()
|
public void TestConstantZeroValues()
|
||||||
{
|
{
|
||||||
AddStep("Load user", () => user.Value = user_with_zero_values);
|
AddStep("Load user", () => user.Value = new UserProfile(user_with_zero_values));
|
||||||
AddAssert("Section is visible", () => section.Alpha == 1);
|
AddAssert("Section is visible", () => section.Alpha == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestFilledValues()
|
public void TestFilledValues()
|
||||||
{
|
{
|
||||||
AddStep("Load user", () => user.Value = user_with_filled_values);
|
AddStep("Load user", () => user.Value = new UserProfile(user_with_filled_values));
|
||||||
AddAssert("Section is visible", () => section.Alpha == 1);
|
AddAssert("Section is visible", () => section.Alpha == 1);
|
||||||
AddAssert("Array length is the same", () => user_with_filled_values.MonthlyPlayCounts.Length == getChartValuesLength());
|
AddAssert("Array length is the same", () => user_with_filled_values.MonthlyPlayCounts.Length == getChartValuesLength());
|
||||||
}
|
}
|
||||||
@ -95,7 +94,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestMissingValues()
|
public void TestMissingValues()
|
||||||
{
|
{
|
||||||
AddStep("Load user", () => user.Value = user_with_missing_values);
|
AddStep("Load user", () => user.Value = new UserProfile(user_with_missing_values));
|
||||||
AddAssert("Section is visible", () => section.Alpha == 1);
|
AddAssert("Section is visible", () => section.Alpha == 1);
|
||||||
AddAssert("Array length is 7", () => getChartValuesLength() == 7);
|
AddAssert("Array length is 7", () => getChartValuesLength() == 7);
|
||||||
}
|
}
|
||||||
|
@ -29,33 +29,33 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestBasic()
|
public void TestBasic()
|
||||||
{
|
{
|
||||||
AddStep("Show example user", () => header.User.Value = TestSceneUserProfileOverlay.TEST_USER);
|
AddStep("Show example user", () => header.UserProfile.Value = new UserProfile(TestSceneUserProfileOverlay.TEST_USER));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestOnlineState()
|
public void TestOnlineState()
|
||||||
{
|
{
|
||||||
AddStep("Show online user", () => header.User.Value = new APIUser
|
AddStep("Show online user", () => header.UserProfile.Value = new UserProfile(new APIUser
|
||||||
{
|
{
|
||||||
Id = 1001,
|
Id = 1001,
|
||||||
Username = "IAmOnline",
|
Username = "IAmOnline",
|
||||||
LastVisit = DateTimeOffset.Now,
|
LastVisit = DateTimeOffset.Now,
|
||||||
IsOnline = true,
|
IsOnline = true,
|
||||||
});
|
}));
|
||||||
|
|
||||||
AddStep("Show offline user", () => header.User.Value = new APIUser
|
AddStep("Show offline user", () => header.UserProfile.Value = new UserProfile(new APIUser
|
||||||
{
|
{
|
||||||
Id = 1002,
|
Id = 1002,
|
||||||
Username = "IAmOffline",
|
Username = "IAmOffline",
|
||||||
LastVisit = DateTimeOffset.Now.AddDays(-10),
|
LastVisit = DateTimeOffset.Now.AddDays(-10),
|
||||||
IsOnline = false,
|
IsOnline = false,
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestRankedState()
|
public void TestRankedState()
|
||||||
{
|
{
|
||||||
AddStep("Show ranked user", () => header.User.Value = new APIUser
|
AddStep("Show ranked user", () => header.UserProfile.Value = new UserProfile(new APIUser
|
||||||
{
|
{
|
||||||
Id = 2001,
|
Id = 2001,
|
||||||
Username = "RankedUser",
|
Username = "RankedUser",
|
||||||
@ -70,9 +70,9 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray()
|
Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
|
|
||||||
AddStep("Show unranked user", () => header.User.Value = new APIUser
|
AddStep("Show unranked user", () => header.UserProfile.Value = new UserProfile(new APIUser
|
||||||
{
|
{
|
||||||
Id = 2002,
|
Id = 2002,
|
||||||
Username = "UnrankedUser",
|
Username = "UnrankedUser",
|
||||||
@ -86,7 +86,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Data = Enumerable.Range(2345, 85).ToArray()
|
Data = Enumerable.Range(2345, 85).ToArray()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Profile;
|
||||||
using osu.Game.Overlays.Profile.Sections;
|
using osu.Game.Overlays.Profile.Sections;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Online
|
namespace osu.Game.Tests.Visual.Online
|
||||||
@ -44,7 +45,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("Show cookiezi", () => ranks.User.Value = new APIUser { Id = 124493 });
|
AddStep("Show cookiezi", () => ranks.UserProfile.Value = new UserProfile(new APIUser { Id = 124493 }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
{
|
{
|
||||||
public partial class BottomHeaderContainer : CompositeDrawable
|
public partial class BottomHeaderContainer : CompositeDrawable
|
||||||
{
|
{
|
||||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
private LinkFlowContainer topLinkContainer = null!;
|
private LinkFlowContainer topLinkContainer = null!;
|
||||||
private LinkFlowContainer bottomLinkContainer = null!;
|
private LinkFlowContainer bottomLinkContainer = null!;
|
||||||
@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
User.BindValueChanged(user => updateDisplay(user.NewValue));
|
UserProfile.BindValueChanged(user => updateDisplay(user.NewValue?.User));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDisplay(APIUser? user)
|
private void updateDisplay(APIUser? user)
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
public partial class CentreHeaderContainer : CompositeDrawable
|
public partial class CentreHeaderContainer : CompositeDrawable
|
||||||
{
|
{
|
||||||
public readonly BindableBool DetailsVisible = new BindableBool(true);
|
public readonly BindableBool DetailsVisible = new BindableBool(true);
|
||||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
private OverlinedInfoContainer hiddenDetailGlobal = null!;
|
private OverlinedInfoContainer hiddenDetailGlobal = null!;
|
||||||
private OverlinedInfoContainer hiddenDetailCountry = null!;
|
private OverlinedInfoContainer hiddenDetailCountry = null!;
|
||||||
@ -53,15 +53,15 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
{
|
{
|
||||||
new FollowersButton
|
new FollowersButton
|
||||||
{
|
{
|
||||||
User = { BindTarget = User }
|
UserProfile = { BindTarget = UserProfile }
|
||||||
},
|
},
|
||||||
new MappingSubscribersButton
|
new MappingSubscribersButton
|
||||||
{
|
{
|
||||||
User = { BindTarget = User }
|
UserProfile = { BindTarget = UserProfile }
|
||||||
},
|
},
|
||||||
new MessageUserButton
|
new MessageUserButton
|
||||||
{
|
{
|
||||||
User = { BindTarget = User }
|
UserProfile = { BindTarget = UserProfile }
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -92,7 +92,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
Size = new Vector2(40),
|
Size = new Vector2(40),
|
||||||
User = { BindTarget = User }
|
UserProfile = { BindTarget = UserProfile }
|
||||||
},
|
},
|
||||||
expandedDetailContainer = new Container
|
expandedDetailContainer = new Container
|
||||||
{
|
{
|
||||||
@ -104,7 +104,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
Child = new LevelProgressBar
|
Child = new LevelProgressBar
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
User = { BindTarget = User }
|
UserProfile = { BindTarget = UserProfile }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hiddenDetailContainer = new FillFlowContainer
|
hiddenDetailContainer = new FillFlowContainer
|
||||||
@ -141,7 +141,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
expandedDetailContainer.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
expandedDetailContainer.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
||||||
});
|
});
|
||||||
|
|
||||||
User.BindValueChanged(user => updateDisplay(user.NewValue));
|
UserProfile.BindValueChanged(userProfile => updateDisplay(userProfile.NewValue?.User));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDisplay(APIUser? user)
|
private void updateDisplay(APIUser? user)
|
||||||
|
@ -5,14 +5,13 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Header.Components
|
namespace osu.Game.Overlays.Profile.Header.Components
|
||||||
{
|
{
|
||||||
public partial class FollowersButton : ProfileHeaderStatisticsButton
|
public partial class FollowersButton : ProfileHeaderStatisticsButton
|
||||||
{
|
{
|
||||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
public override LocalisableString TooltipText => FriendsStrings.ButtonsDisabled;
|
public override LocalisableString TooltipText => FriendsStrings.ButtonsDisabled;
|
||||||
|
|
||||||
@ -22,7 +21,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
// todo: when friending/unfriending is implemented, the APIAccess.Friends list should be updated accordingly.
|
// todo: when friending/unfriending is implemented, the APIAccess.Friends list should be updated accordingly.
|
||||||
User.BindValueChanged(user => SetValue(user.NewValue?.FollowerCount ?? 0), true);
|
UserProfile.BindValueChanged(user => SetValue(user.NewValue?.User.FollowerCount ?? 0), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
{
|
{
|
||||||
public partial class LevelBadge : CompositeDrawable, IHasTooltip
|
public partial class LevelBadge : CompositeDrawable, IHasTooltip
|
||||||
{
|
{
|
||||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
public LocalisableString TooltipText { get; private set; }
|
public LocalisableString TooltipText { get; private set; }
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
User.BindValueChanged(user => updateLevel(user.NewValue));
|
UserProfile.BindValueChanged(user => updateLevel(user.NewValue?.User));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLevel(APIUser? user)
|
private void updateLevel(APIUser? user)
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
{
|
{
|
||||||
public partial class LevelProgressBar : CompositeDrawable, IHasTooltip
|
public partial class LevelProgressBar : CompositeDrawable, IHasTooltip
|
||||||
{
|
{
|
||||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
public LocalisableString TooltipText { get; }
|
public LocalisableString TooltipText { get; }
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
User.BindValueChanged(user => updateProgress(user.NewValue));
|
UserProfile.BindValueChanged(user => updateProgress(user.NewValue?.User));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateProgress(APIUser? user)
|
private void updateProgress(APIUser? user)
|
||||||
|
@ -5,14 +5,13 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Header.Components
|
namespace osu.Game.Overlays.Profile.Header.Components
|
||||||
{
|
{
|
||||||
public partial class MappingSubscribersButton : ProfileHeaderStatisticsButton
|
public partial class MappingSubscribersButton : ProfileHeaderStatisticsButton
|
||||||
{
|
{
|
||||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
public override LocalisableString TooltipText => FollowsStrings.MappingFollowers;
|
public override LocalisableString TooltipText => FollowsStrings.MappingFollowers;
|
||||||
|
|
||||||
@ -21,7 +20,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
User.BindValueChanged(user => SetValue(user.NewValue?.MappingFollowerCount ?? 0), true);
|
UserProfile.BindValueChanged(user => SetValue(user.NewValue?.User.MappingFollowerCount ?? 0), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Online.Chat;
|
using osu.Game.Online.Chat;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -16,7 +15,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
{
|
{
|
||||||
public partial class MessageUserButton : ProfileHeaderButton
|
public partial class MessageUserButton : ProfileHeaderButton
|
||||||
{
|
{
|
||||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
public override LocalisableString TooltipText => UsersStrings.CardSendMessage;
|
public override LocalisableString TooltipText => UsersStrings.CardSendMessage;
|
||||||
|
|
||||||
@ -49,12 +48,16 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
{
|
{
|
||||||
if (!Content.IsPresent) return;
|
if (!Content.IsPresent) return;
|
||||||
|
|
||||||
channelManager?.OpenPrivateChannel(User.Value);
|
channelManager?.OpenPrivateChannel(UserProfile.Value?.User);
|
||||||
userOverlay?.Hide();
|
userOverlay?.Hide();
|
||||||
chatOverlay?.Show();
|
chatOverlay?.Show();
|
||||||
};
|
};
|
||||||
|
|
||||||
User.ValueChanged += e => Content.Alpha = e.NewValue != null && !e.NewValue.PMFriendsOnly && apiProvider.LocalUser.Value.Id != e.NewValue.Id ? 1 : 0;
|
UserProfile.ValueChanged += e =>
|
||||||
|
{
|
||||||
|
var user = e.NewValue?.User;
|
||||||
|
Content.Alpha = user != null && !user.PMFriendsOnly && apiProvider.LocalUser.Value.Id != user.Id ? 1 : 0;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,13 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Header.Components
|
namespace osu.Game.Overlays.Profile.Header.Components
|
||||||
{
|
{
|
||||||
public partial class OverlinedTotalPlayTime : CompositeDrawable, IHasTooltip
|
public partial class OverlinedTotalPlayTime : CompositeDrawable, IHasTooltip
|
||||||
{
|
{
|
||||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
public LocalisableString TooltipText { get; set; }
|
public LocalisableString TooltipText { get; set; }
|
||||||
|
|
||||||
@ -36,13 +35,14 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
LineColour = colourProvider.Highlight1,
|
LineColour = colourProvider.Highlight1,
|
||||||
};
|
};
|
||||||
|
|
||||||
User.BindValueChanged(updateTime, true);
|
UserProfile.BindValueChanged(updateTime, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTime(ValueChangedEvent<APIUser?> user)
|
private void updateTime(ValueChangedEvent<UserProfile?> userProfile)
|
||||||
{
|
{
|
||||||
TooltipText = (user.NewValue?.Statistics?.PlayTime ?? 0) / 3600 + " hours";
|
int? playTime = userProfile.NewValue?.User.Statistics?.PlayTime;
|
||||||
info.Content = formatTime(user.NewValue?.Statistics?.PlayTime);
|
TooltipText = (playTime ?? 0) / 3600 + " hours";
|
||||||
|
info.Content = formatTime(playTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string formatTime(int? secondsNull)
|
private string formatTime(int? secondsNull)
|
||||||
|
@ -11,7 +11,6 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Online.Leaderboards;
|
using osu.Game.Online.Leaderboards;
|
||||||
using osu.Game.Overlays.Profile.Header.Components;
|
using osu.Game.Overlays.Profile.Header.Components;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
@ -30,7 +29,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
private FillFlowContainer? fillFlow;
|
private FillFlowContainer? fillFlow;
|
||||||
private RankGraph rankGraph = null!;
|
private RankGraph rankGraph = null!;
|
||||||
|
|
||||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
private bool expanded = true;
|
private bool expanded = true;
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
User.ValueChanged += e => updateDisplay(e.NewValue);
|
UserProfile.ValueChanged += e => updateDisplay(e.NewValue);
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -99,7 +98,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
{
|
{
|
||||||
new OverlinedTotalPlayTime
|
new OverlinedTotalPlayTime
|
||||||
{
|
{
|
||||||
User = { BindTarget = User }
|
UserProfile = { BindTarget = UserProfile }
|
||||||
},
|
},
|
||||||
medalInfo = new OverlinedInfoContainer
|
medalInfo = new OverlinedInfoContainer
|
||||||
{
|
{
|
||||||
@ -171,8 +170,10 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDisplay(APIUser? user)
|
private void updateDisplay(UserProfile? userProfile)
|
||||||
{
|
{
|
||||||
|
var user = userProfile?.User;
|
||||||
|
|
||||||
medalInfo.Content = user?.Achievements?.Length.ToString() ?? "0";
|
medalInfo.Content = user?.Achievements?.Length.ToString() ?? "0";
|
||||||
ppInfo.Content = user?.Statistics?.PP?.ToLocalisableString("#,##0") ?? (LocalisableString)"0";
|
ppInfo.Content = user?.Statistics?.PP?.ToLocalisableString("#,##0") ?? (LocalisableString)"0";
|
||||||
|
|
||||||
|
@ -20,14 +20,14 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
{
|
{
|
||||||
private FillFlowContainer badgeFlowContainer = null!;
|
private FillFlowContainer badgeFlowContainer = null!;
|
||||||
|
|
||||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
Alpha = 0;
|
Alpha = 0;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
User.ValueChanged += e => updateDisplay(e.NewValue);
|
UserProfile.ValueChanged += e => updateDisplay(e.NewValue?.User);
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,6 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Overlays.Profile.Header.Components;
|
using osu.Game.Overlays.Profile.Header.Components;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Users.Drawables;
|
using osu.Game.Users.Drawables;
|
||||||
@ -27,7 +26,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
{
|
{
|
||||||
private const float avatar_size = 110;
|
private const float avatar_size = 110;
|
||||||
|
|
||||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; } = null!;
|
private IAPIProvider api { get; set; } = null!;
|
||||||
@ -171,11 +170,13 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
User.BindValueChanged(user => updateUser(user.NewValue));
|
UserProfile.BindValueChanged(user => updateUser(user.NewValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUser(APIUser? user)
|
private void updateUser(UserProfile? userProfile)
|
||||||
{
|
{
|
||||||
|
var user = userProfile?.User;
|
||||||
|
|
||||||
avatar.User = user;
|
avatar.User = user;
|
||||||
usernameText.Text = user?.Username ?? string.Empty;
|
usernameText.Text = user?.Username ?? string.Empty;
|
||||||
openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}";
|
openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}";
|
||||||
|
@ -9,7 +9,6 @@ using osu.Framework.Graphics.Colour;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Overlays.Profile.Header;
|
using osu.Game.Overlays.Profile.Header;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
@ -20,7 +19,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
{
|
{
|
||||||
private UserCoverBackground coverContainer = null!;
|
private UserCoverBackground coverContainer = null!;
|
||||||
|
|
||||||
public Bindable<APIUser?> User = new Bindable<APIUser?>();
|
public Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
private CentreHeaderContainer centreHeaderContainer;
|
private CentreHeaderContainer centreHeaderContainer;
|
||||||
private DetailHeaderContainer detailHeaderContainer;
|
private DetailHeaderContainer detailHeaderContainer;
|
||||||
@ -29,7 +28,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
{
|
{
|
||||||
ContentSidePadding = UserProfileOverlay.CONTENT_X_MARGIN;
|
ContentSidePadding = UserProfileOverlay.CONTENT_X_MARGIN;
|
||||||
|
|
||||||
User.ValueChanged += e => updateDisplay(e.NewValue);
|
UserProfile.ValueChanged += e => updateDisplay(e.NewValue);
|
||||||
|
|
||||||
TabControl.AddItem(LayoutStrings.HeaderUsersShow);
|
TabControl.AddItem(LayoutStrings.HeaderUsersShow);
|
||||||
|
|
||||||
@ -73,34 +72,34 @@ namespace osu.Game.Overlays.Profile
|
|||||||
new TopHeaderContainer
|
new TopHeaderContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
User = { BindTarget = User },
|
UserProfile = { BindTarget = UserProfile },
|
||||||
},
|
},
|
||||||
centreHeaderContainer = new CentreHeaderContainer
|
centreHeaderContainer = new CentreHeaderContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
User = { BindTarget = User },
|
UserProfile = { BindTarget = UserProfile },
|
||||||
},
|
},
|
||||||
detailHeaderContainer = new DetailHeaderContainer
|
detailHeaderContainer = new DetailHeaderContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
User = { BindTarget = User },
|
UserProfile = { BindTarget = UserProfile },
|
||||||
},
|
},
|
||||||
new MedalHeaderContainer
|
new MedalHeaderContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
User = { BindTarget = User },
|
UserProfile = { BindTarget = UserProfile },
|
||||||
},
|
},
|
||||||
new BottomHeaderContainer
|
new BottomHeaderContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
User = { BindTarget = User },
|
UserProfile = { BindTarget = UserProfile },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override OverlayTitle CreateTitle() => new ProfileHeaderTitle();
|
protected override OverlayTitle CreateTitle() => new ProfileHeaderTitle();
|
||||||
|
|
||||||
private void updateDisplay(APIUser? user) => coverContainer.User = user;
|
private void updateDisplay(UserProfile? userProfile) => coverContainer.User = userProfile?.User;
|
||||||
|
|
||||||
private partial class ProfileHeaderTitle : OverlayTitle
|
private partial class ProfileHeaderTitle : OverlayTitle
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,6 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile
|
namespace osu.Game.Overlays.Profile
|
||||||
{
|
{
|
||||||
@ -29,7 +28,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
protected ProfileSection()
|
protected ProfileSection()
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
|||||||
|
|
||||||
protected override int InitialItemsCount => type == BeatmapSetType.Graveyard ? 2 : 6;
|
protected override int InitialItemsCount => type == BeatmapSetType.Graveyard ? 2 : 6;
|
||||||
|
|
||||||
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<APIUser?> user, LocalisableString headerText)
|
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<UserProfile?> user, LocalisableString headerText)
|
||||||
: base(user, headerText)
|
: base(user, headerText)
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
@ -18,13 +18,13 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
{
|
{
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, UsersStrings.ShowExtraBeatmapsFavouriteTitle),
|
new PaginatedBeatmapContainer(BeatmapSetType.Favourite, UserProfile, UsersStrings.ShowExtraBeatmapsFavouriteTitle),
|
||||||
new PaginatedBeatmapContainer(BeatmapSetType.Ranked, User, UsersStrings.ShowExtraBeatmapsRankedTitle),
|
new PaginatedBeatmapContainer(BeatmapSetType.Ranked, UserProfile, UsersStrings.ShowExtraBeatmapsRankedTitle),
|
||||||
new PaginatedBeatmapContainer(BeatmapSetType.Loved, User, UsersStrings.ShowExtraBeatmapsLovedTitle),
|
new PaginatedBeatmapContainer(BeatmapSetType.Loved, UserProfile, UsersStrings.ShowExtraBeatmapsLovedTitle),
|
||||||
new PaginatedBeatmapContainer(BeatmapSetType.Guest, User, UsersStrings.ShowExtraBeatmapsGuestTitle),
|
new PaginatedBeatmapContainer(BeatmapSetType.Guest, UserProfile, UsersStrings.ShowExtraBeatmapsGuestTitle),
|
||||||
new PaginatedBeatmapContainer(BeatmapSetType.Pending, User, UsersStrings.ShowExtraBeatmapsPendingTitle),
|
new PaginatedBeatmapContainer(BeatmapSetType.Pending, UserProfile, UsersStrings.ShowExtraBeatmapsPendingTitle),
|
||||||
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, UsersStrings.ShowExtraBeatmapsGraveyardTitle),
|
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, UserProfile, UsersStrings.ShowExtraBeatmapsGraveyardTitle),
|
||||||
new PaginatedBeatmapContainer(BeatmapSetType.Nominated, User, UsersStrings.ShowExtraBeatmapsNominatedTitle),
|
new PaginatedBeatmapContainer(BeatmapSetType.Nominated, UserProfile, UsersStrings.ShowExtraBeatmapsNominatedTitle),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected abstract LocalisableString GraphCounterName { get; }
|
protected abstract LocalisableString GraphCounterName { get; }
|
||||||
|
|
||||||
protected ChartProfileSubsection(Bindable<APIUser?> user, LocalisableString headerText)
|
protected ChartProfileSubsection(Bindable<UserProfile?> userProfile, LocalisableString headerText)
|
||||||
: base(user, headerText)
|
: base(userProfile, headerText)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,12 +41,12 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
User.BindValueChanged(onUserChanged, true);
|
UserProfile.BindValueChanged(onUserChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onUserChanged(ValueChangedEvent<APIUser?> e)
|
private void onUserChanged(ValueChangedEvent<UserProfile?> e)
|
||||||
{
|
{
|
||||||
var values = GetValues(e.NewValue);
|
var values = GetValues(e.NewValue?.User);
|
||||||
|
|
||||||
if (values == null || values.Length <= 1)
|
if (values == null || values.Length <= 1)
|
||||||
{
|
{
|
||||||
|
@ -16,8 +16,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
{
|
{
|
||||||
public partial class PaginatedMostPlayedBeatmapContainer : PaginatedProfileSubsection<APIUserMostPlayedBeatmap>
|
public partial class PaginatedMostPlayedBeatmapContainer : PaginatedProfileSubsection<APIUserMostPlayedBeatmap>
|
||||||
{
|
{
|
||||||
public PaginatedMostPlayedBeatmapContainer(Bindable<APIUser?> user)
|
public PaginatedMostPlayedBeatmapContainer(Bindable<UserProfile?> userProfile)
|
||||||
: base(user, UsersStrings.ShowExtraHistoricalMostPlayedTitle)
|
: base(userProfile, UsersStrings.ShowExtraHistoricalMostPlayedTitle)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
{
|
{
|
||||||
protected override LocalisableString GraphCounterName => UsersStrings.ShowExtraHistoricalMonthlyPlaycountsCountLabel;
|
protected override LocalisableString GraphCounterName => UsersStrings.ShowExtraHistoricalMonthlyPlaycountsCountLabel;
|
||||||
|
|
||||||
public PlayHistorySubsection(Bindable<APIUser?> user)
|
public PlayHistorySubsection(Bindable<UserProfile?> userProfile)
|
||||||
: base(user, UsersStrings.ShowExtraHistoricalMonthlyPlaycountsTitle)
|
: base(userProfile, UsersStrings.ShowExtraHistoricalMonthlyPlaycountsTitle)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
{
|
{
|
||||||
protected override LocalisableString GraphCounterName => UsersStrings.ShowExtraHistoricalReplaysWatchedCountsCountLabel;
|
protected override LocalisableString GraphCounterName => UsersStrings.ShowExtraHistoricalReplaysWatchedCountsCountLabel;
|
||||||
|
|
||||||
public ReplaysSubsection(Bindable<APIUser?> user)
|
public ReplaysSubsection(Bindable<UserProfile?> userProfile)
|
||||||
: base(user, UsersStrings.ShowExtraHistoricalReplaysWatchedCountsTitle)
|
: base(userProfile, UsersStrings.ShowExtraHistoricalReplaysWatchedCountsTitle)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,10 +20,10 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new PlayHistorySubsection(User),
|
new PlayHistorySubsection(UserProfile),
|
||||||
new PaginatedMostPlayedBeatmapContainer(User),
|
new PaginatedMostPlayedBeatmapContainer(UserProfile),
|
||||||
new PaginatedScoreContainer(ScoreType.Recent, User, UsersStrings.ShowExtraHistoricalRecentPlaysTitle),
|
new PaginatedScoreContainer(ScoreType.Recent, UserProfile, UsersStrings.ShowExtraHistoricalRecentPlaysTitle),
|
||||||
new ReplaysSubsection(User)
|
new ReplaysSubsection(UserProfile)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,17 +14,16 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Extensions.LocalisationExtensions;
|
using osu.Framework.Extensions.LocalisationExtensions;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
||||||
{
|
{
|
||||||
public partial class KudosuInfo : Container
|
public partial class KudosuInfo : Container
|
||||||
{
|
{
|
||||||
private readonly Bindable<APIUser?> user = new Bindable<APIUser?>();
|
private readonly Bindable<UserProfile?> userProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
public KudosuInfo(Bindable<APIUser?> user)
|
public KudosuInfo(Bindable<UserProfile?> userProfile)
|
||||||
{
|
{
|
||||||
this.user.BindTo(user);
|
this.userProfile.BindTo(userProfile);
|
||||||
CountSection total;
|
CountSection total;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
@ -32,7 +31,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
|||||||
CornerRadius = 3;
|
CornerRadius = 3;
|
||||||
Child = total = new CountTotal();
|
Child = total = new CountTotal();
|
||||||
|
|
||||||
this.user.ValueChanged += u => total.Count = u.NewValue?.Kudosu.Total ?? 0;
|
this.userProfile.ValueChanged += u => total.Count = u.NewValue?.User.Kudosu.Total ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e) => true;
|
protected override bool OnClick(ClickEvent e) => true;
|
||||||
|
@ -14,8 +14,8 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
|||||||
{
|
{
|
||||||
public partial class PaginatedKudosuHistoryContainer : PaginatedProfileSubsection<APIKudosuHistory>
|
public partial class PaginatedKudosuHistoryContainer : PaginatedProfileSubsection<APIKudosuHistory>
|
||||||
{
|
{
|
||||||
public PaginatedKudosuHistoryContainer(Bindable<APIUser?> user)
|
public PaginatedKudosuHistoryContainer(Bindable<UserProfile?> userProfile)
|
||||||
: base(user, missingText: UsersStrings.ShowExtraKudosuEntryEmpty)
|
: base(userProfile, missingText: UsersStrings.ShowExtraKudosuEntryEmpty)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new KudosuInfo(User),
|
new KudosuInfo(UserProfile),
|
||||||
new PaginatedKudosuHistoryContainer(User),
|
new PaginatedKudosuHistoryContainer(UserProfile),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,8 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
private OsuSpriteText missing = null!;
|
private OsuSpriteText missing = null!;
|
||||||
private readonly LocalisableString? missingText;
|
private readonly LocalisableString? missingText;
|
||||||
|
|
||||||
protected PaginatedProfileSubsection(Bindable<APIUser?> user, LocalisableString? headerText = null, LocalisableString? missingText = null)
|
protected PaginatedProfileSubsection(Bindable<UserProfile?> userProfile, LocalisableString? headerText = null, LocalisableString? missingText = null)
|
||||||
: base(user, headerText, CounterVisibilityState.AlwaysVisible)
|
: base(userProfile, headerText, CounterVisibilityState.AlwaysVisible)
|
||||||
{
|
{
|
||||||
this.missingText = missingText;
|
this.missingText = missingText;
|
||||||
}
|
}
|
||||||
@ -89,10 +89,10 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
User.BindValueChanged(onUserChanged, true);
|
UserProfile.BindValueChanged(onUserChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onUserChanged(ValueChangedEvent<APIUser?> e)
|
private void onUserChanged(ValueChangedEvent<UserProfile?> e)
|
||||||
{
|
{
|
||||||
loadCancellation?.Cancel();
|
loadCancellation?.Cancel();
|
||||||
retrievalRequest?.Cancel();
|
retrievalRequest?.Cancel();
|
||||||
@ -100,23 +100,23 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
CurrentPage = null;
|
CurrentPage = null;
|
||||||
ItemsContainer.Clear();
|
ItemsContainer.Clear();
|
||||||
|
|
||||||
if (e.NewValue != null)
|
if (e.NewValue?.User != null)
|
||||||
{
|
{
|
||||||
showMore();
|
showMore();
|
||||||
SetCount(GetCount(e.NewValue));
|
SetCount(GetCount(e.NewValue.User));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showMore()
|
private void showMore()
|
||||||
{
|
{
|
||||||
if (User.Value == null)
|
if (UserProfile.Value?.User == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
loadCancellation = new CancellationTokenSource();
|
loadCancellation = new CancellationTokenSource();
|
||||||
|
|
||||||
CurrentPage = CurrentPage?.TakeNext(ItemsPerPage) ?? new PaginationParameters(InitialItemsCount);
|
CurrentPage = CurrentPage?.TakeNext(ItemsPerPage) ?? new PaginationParameters(InitialItemsCount);
|
||||||
|
|
||||||
retrievalRequest = CreateRequest(User.Value, CurrentPage.Value);
|
retrievalRequest = CreateRequest(UserProfile.Value.User, CurrentPage.Value);
|
||||||
retrievalRequest.Success += items => UpdateItems(items, loadCancellation);
|
retrievalRequest.Success += items => UpdateItems(items, loadCancellation);
|
||||||
|
|
||||||
api.Queue(retrievalRequest);
|
api.Queue(retrievalRequest);
|
||||||
|
@ -6,24 +6,23 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections
|
namespace osu.Game.Overlays.Profile.Sections
|
||||||
{
|
{
|
||||||
public abstract partial class ProfileSubsection : FillFlowContainer
|
public abstract partial class ProfileSubsection : FillFlowContainer
|
||||||
{
|
{
|
||||||
protected readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
protected readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||||
|
|
||||||
private readonly LocalisableString headerText;
|
private readonly LocalisableString headerText;
|
||||||
private readonly CounterVisibilityState counterVisibilityState;
|
private readonly CounterVisibilityState counterVisibilityState;
|
||||||
|
|
||||||
private ProfileSubsectionHeader header = null!;
|
private ProfileSubsectionHeader header = null!;
|
||||||
|
|
||||||
protected ProfileSubsection(Bindable<APIUser?> user, LocalisableString? headerText = null, CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden)
|
protected ProfileSubsection(Bindable<UserProfile?> userProfile, LocalisableString? headerText = null, CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden)
|
||||||
{
|
{
|
||||||
this.headerText = headerText ?? string.Empty;
|
this.headerText = headerText ?? string.Empty;
|
||||||
this.counterVisibilityState = counterVisibilityState;
|
this.counterVisibilityState = counterVisibilityState;
|
||||||
User.BindTo(user);
|
UserProfile.BindTo(userProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -19,8 +19,8 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
{
|
{
|
||||||
private readonly ScoreType type;
|
private readonly ScoreType type;
|
||||||
|
|
||||||
public PaginatedScoreContainer(ScoreType type, Bindable<APIUser?> user, LocalisableString headerText)
|
public PaginatedScoreContainer(ScoreType type, Bindable<UserProfile?> userProfile, LocalisableString headerText)
|
||||||
: base(user, headerText)
|
: base(userProfile, headerText)
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,9 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
{
|
{
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new PaginatedScoreContainer(ScoreType.Pinned, User, UsersStrings.ShowExtraTopRanksPinnedTitle),
|
new PaginatedScoreContainer(ScoreType.Pinned, UserProfile, UsersStrings.ShowExtraTopRanksPinnedTitle),
|
||||||
new PaginatedScoreContainer(ScoreType.Best, User, UsersStrings.ShowExtraTopRanksBestTitle),
|
new PaginatedScoreContainer(ScoreType.Best, UserProfile, UsersStrings.ShowExtraTopRanksBestTitle),
|
||||||
new PaginatedScoreContainer(ScoreType.Firsts, User, UsersStrings.ShowExtraTopRanksFirstTitle)
|
new PaginatedScoreContainer(ScoreType.Firsts, UserProfile, UsersStrings.ShowExtraTopRanksFirstTitle)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
|
|||||||
{
|
{
|
||||||
public partial class PaginatedRecentActivityContainer : PaginatedProfileSubsection<APIRecentActivity>
|
public partial class PaginatedRecentActivityContainer : PaginatedProfileSubsection<APIRecentActivity>
|
||||||
{
|
{
|
||||||
public PaginatedRecentActivityContainer(Bindable<APIUser?> user)
|
public PaginatedRecentActivityContainer(Bindable<UserProfile?> userProfile)
|
||||||
: base(user, missingText: EventsStrings.Empty)
|
: base(userProfile, missingText: EventsStrings.Empty)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
{
|
{
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new PaginatedRecentActivityContainer(User),
|
new PaginatedRecentActivityContainer(UserProfile),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
Show();
|
Show();
|
||||||
|
|
||||||
if (user.OnlineID == Header?.User.Value?.Id)
|
if (user.OnlineID == Header?.UserProfile.Value?.User.Id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sectionsContainer != null)
|
if (sectionsContainer != null)
|
||||||
@ -134,7 +134,8 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Debug.Assert(sections != null && sectionsContainer != null && tabs != null);
|
Debug.Assert(sections != null && sectionsContainer != null && tabs != null);
|
||||||
|
|
||||||
Header.User.Value = user;
|
var userProfile = new UserProfile(user);
|
||||||
|
Header.UserProfile.Value = userProfile;
|
||||||
|
|
||||||
if (user.ProfileOrder != null)
|
if (user.ProfileOrder != null)
|
||||||
{
|
{
|
||||||
@ -144,7 +145,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
if (sec != null)
|
if (sec != null)
|
||||||
{
|
{
|
||||||
sec.User.Value = user;
|
sec.UserProfile.Value = userProfile;
|
||||||
|
|
||||||
sectionsContainer.Add(sec);
|
sectionsContainer.Add(sec);
|
||||||
tabs.AddItem(sec);
|
tabs.AddItem(sec);
|
||||||
|
Loading…
Reference in New Issue
Block a user