mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:02:53 +08:00
Merge branch 'master' into FlagHUD
This commit is contained in:
commit
33de27499a
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -108,6 +108,12 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: microsoft
|
||||
java-version: 11
|
||||
|
||||
- name: Install .NET 6.0.x
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
|
@ -10,7 +10,7 @@
|
||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.1121.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.1121.1" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<!-- Fody does not handle Android build well, and warns when unchanged.
|
||||
|
@ -78,6 +78,31 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddStep("complete request", () => pendingRequest.TriggerSuccess(TEST_USER));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLogin()
|
||||
{
|
||||
GetUserRequest pendingRequest = null!;
|
||||
|
||||
AddStep("set up request handling", () =>
|
||||
{
|
||||
dummyAPI.HandleRequest = req =>
|
||||
{
|
||||
if (dummyAPI.State.Value == APIState.Online && req is GetUserRequest getUserRequest)
|
||||
{
|
||||
pendingRequest = getUserRequest;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
});
|
||||
AddStep("logout", () => dummyAPI.Logout());
|
||||
AddStep("show user", () => profile.ShowUser(new APIUser { Id = 1 }));
|
||||
AddStep("login", () => dummyAPI.Login("username", "password"));
|
||||
AddWaitStep("wait some", 3);
|
||||
AddStep("complete request", () => pendingRequest.TriggerSuccess(TEST_USER));
|
||||
}
|
||||
|
||||
public static readonly APIUser TEST_USER = new APIUser
|
||||
{
|
||||
Username = @"Somebody",
|
||||
|
@ -188,7 +188,10 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
}
|
||||
|
||||
if (skinEditor.State.Value == Visibility.Visible)
|
||||
{
|
||||
skinEditor.Save(false);
|
||||
skinEditor.UpdateTargetScreen(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
skinEditor.Hide();
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -18,6 +19,7 @@ using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays.Profile;
|
||||
@ -42,6 +44,11 @@ namespace osu.Game.Overlays
|
||||
private ProfileSectionsContainer? sectionsContainer;
|
||||
private ProfileSectionTabControl? tabs;
|
||||
|
||||
private IUser? user;
|
||||
private IRulesetInfo? ruleset;
|
||||
|
||||
private readonly IBindable<APIState> apiState = new Bindable<APIState>();
|
||||
|
||||
[Resolved]
|
||||
private RulesetStore rulesets { get; set; } = null!;
|
||||
|
||||
@ -58,16 +65,36 @@ namespace osu.Game.Overlays
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
apiState.BindTo(API.State);
|
||||
apiState.BindValueChanged(state => Schedule(() =>
|
||||
{
|
||||
if (state.NewValue == APIState.Online && user != null)
|
||||
Scheduler.AddOnce(fetchAndSetContent);
|
||||
}));
|
||||
}
|
||||
|
||||
protected override ProfileHeader CreateHeader() => new ProfileHeader();
|
||||
|
||||
protected override Color4 BackgroundColour => ColourProvider.Background5;
|
||||
|
||||
public void ShowUser(IUser user, IRulesetInfo? ruleset = null)
|
||||
public void ShowUser(IUser userToShow, IRulesetInfo? userRuleset = null)
|
||||
{
|
||||
if (user.OnlineID == APIUser.SYSTEM_USER_ID)
|
||||
if (userToShow.OnlineID == APIUser.SYSTEM_USER_ID)
|
||||
return;
|
||||
|
||||
user = userToShow;
|
||||
ruleset = userRuleset;
|
||||
|
||||
Show();
|
||||
Scheduler.AddOnce(fetchAndSetContent);
|
||||
}
|
||||
|
||||
private void fetchAndSetContent()
|
||||
{
|
||||
Debug.Assert(user != null);
|
||||
|
||||
if (user.OnlineID == Header.User.Value?.User.Id && ruleset?.MatchesOnlineID(Header.User.Value?.Ruleset) == true)
|
||||
return;
|
||||
@ -143,24 +170,28 @@ namespace osu.Game.Overlays
|
||||
|
||||
sectionsContainer.ScrollToTop();
|
||||
|
||||
userReq = user.OnlineID > 1 ? new GetUserRequest(user.OnlineID, ruleset) : new GetUserRequest(user.Username, ruleset);
|
||||
userReq.Success += u => userLoadComplete(u, ruleset);
|
||||
API.Queue(userReq);
|
||||
loadingLayer.Show();
|
||||
if (API.State.Value != APIState.Offline)
|
||||
{
|
||||
userReq = user.OnlineID > 1 ? new GetUserRequest(user.OnlineID, ruleset) : new GetUserRequest(user.Username, ruleset);
|
||||
userReq.Success += u => userLoadComplete(u, ruleset);
|
||||
|
||||
API.Queue(userReq);
|
||||
loadingLayer.Show();
|
||||
}
|
||||
}
|
||||
|
||||
private void userLoadComplete(APIUser user, IRulesetInfo? ruleset)
|
||||
private void userLoadComplete(APIUser loadedUser, IRulesetInfo? userRuleset)
|
||||
{
|
||||
Debug.Assert(sections != null && sectionsContainer != null && tabs != null);
|
||||
|
||||
var actualRuleset = rulesets.GetRuleset(ruleset?.ShortName ?? user.PlayMode).AsNonNull();
|
||||
var actualRuleset = rulesets.GetRuleset(userRuleset?.ShortName ?? loadedUser.PlayMode).AsNonNull();
|
||||
|
||||
var userProfile = new UserProfileData(user, actualRuleset);
|
||||
var userProfile = new UserProfileData(loadedUser, actualRuleset);
|
||||
Header.User.Value = userProfile;
|
||||
|
||||
if (user.ProfileOrder != null)
|
||||
if (loadedUser.ProfileOrder != null)
|
||||
{
|
||||
foreach (string id in user.ProfileOrder)
|
||||
foreach (string id in loadedUser.ProfileOrder)
|
||||
{
|
||||
var sec = sections.FirstOrDefault(s => s.Identifier == id);
|
||||
|
||||
|
@ -16,6 +16,12 @@ namespace osu.Game.Rulesets.Objects.Types
|
||||
/// <summary>
|
||||
/// When starting a new combo, the offset of the new combo relative to the current one.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is generally a setting provided by a beatmap creator to choreograph interesting colour patterns
|
||||
/// which can only be achieved by skipping combo colours with per-hitobject level.
|
||||
///
|
||||
/// It is exposed via <see cref="IHasComboInformation.ComboIndexWithOffsets"/>.
|
||||
/// </remarks>
|
||||
int ComboOffset { get; }
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,9 @@ namespace osu.Game.Rulesets.Objects.Types
|
||||
/// </summary>
|
||||
public interface IHasComboInformation : IHasCombo
|
||||
{
|
||||
/// <summary>
|
||||
/// Bindable exposure of <see cref="IndexInCurrentCombo"/>.
|
||||
/// </summary>
|
||||
Bindable<int> IndexInCurrentComboBindable { get; }
|
||||
|
||||
/// <summary>
|
||||
@ -19,13 +22,21 @@ namespace osu.Game.Rulesets.Objects.Types
|
||||
/// </summary>
|
||||
int IndexInCurrentCombo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bindable exposure of <see cref="ComboIndex"/>.
|
||||
/// </summary>
|
||||
Bindable<int> ComboIndexBindable { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The index of this combo in relation to the beatmap.
|
||||
///
|
||||
/// In other words, this is incremented by 1 each time a <see cref="NewCombo"/> is reached.
|
||||
/// </summary>
|
||||
int ComboIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bindable exposure of <see cref="ComboIndexWithOffsets"/>.
|
||||
/// </summary>
|
||||
Bindable<int> ComboIndexWithOffsetsBindable { get; }
|
||||
|
||||
/// <summary>
|
||||
@ -39,6 +50,9 @@ namespace osu.Game.Rulesets.Objects.Types
|
||||
/// </summary>
|
||||
new bool NewCombo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bindable exposure of <see cref="LastInCombo"/>.
|
||||
/// </summary>
|
||||
Bindable<bool> LastInComboBindable { get; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -36,7 +36,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="11.5.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2023.1121.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2023.1121.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.1114.0" />
|
||||
<PackageReference Include="Sentry" Version="3.40.0" />
|
||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||
|
@ -23,6 +23,6 @@
|
||||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.1121.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.1121.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user