1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 02:32:55 +08:00

Merge branch 'master' into open-profile-hotkey

This commit is contained in:
Andrew Hong 2022-08-10 01:31:37 -04:00 committed by GitHub
commit 6f1fdd4c34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 3 deletions

View File

@ -137,6 +137,17 @@ namespace osu.Game.Online.API
state.Value = APIState.Connecting; state.Value = APIState.Connecting;
if (localUser.IsDefault)
{
// Show a placeholder user if saved credentials are available.
// This is useful for storing local scores and showing a placeholder username after starting the game,
// until a valid connection has been established.
localUser.Value = new APIUser
{
Username = ProvidedUsername,
};
}
// save the username at this point, if the user requested for it to be. // save the username at this point, if the user requested for it to be.
config.SetValue(OsuSetting.Username, config.Get<bool>(OsuSetting.SaveUsername) ? ProvidedUsername : string.Empty); config.SetValue(OsuSetting.Username, config.Get<bool>(OsuSetting.SaveUsername) ? ProvidedUsername : string.Empty);
@ -402,7 +413,7 @@ namespace osu.Game.Online.API
} }
} }
public bool IsLoggedIn => localUser.Value.Id > 1; // TODO: should this also be true if attempting to connect? public bool IsLoggedIn => State.Value > APIState.Offline;
public void Queue(APIRequest request) public void Queue(APIRequest request)
{ {

View File

@ -104,11 +104,11 @@ namespace osu.Game.Overlays
filterControl.CardSize.BindValueChanged(_ => onCardSizeChanged()); filterControl.CardSize.BindValueChanged(_ => onCardSizeChanged());
apiUser = api.LocalUser.GetBoundCopy(); apiUser = api.LocalUser.GetBoundCopy();
apiUser.BindValueChanged(_ => apiUser.BindValueChanged(_ => Schedule(() =>
{ {
if (api.IsLoggedIn) if (api.IsLoggedIn)
addContentToResultsArea(Drawable.Empty()); addContentToResultsArea(Drawable.Empty());
}); }));
} }
public void ShowWithSearch(string query) public void ShowWithSearch(string query)

View File

@ -249,6 +249,9 @@ namespace osu.Game.Screens.Play
// this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources. // this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
GameplayClockContainer.Add(rulesetSkinProvider); GameplayClockContainer.Add(rulesetSkinProvider);
if (cancellationToken.IsCancellationRequested)
return;
rulesetSkinProvider.AddRange(new Drawable[] rulesetSkinProvider.AddRange(new Drawable[]
{ {
failAnimationLayer = new FailAnimation(DrawableRuleset) failAnimationLayer = new FailAnimation(DrawableRuleset)
@ -279,6 +282,9 @@ namespace osu.Game.Screens.Play
}, },
}); });
if (cancellationToken.IsCancellationRequested)
return;
if (Configuration.AllowRestart) if (Configuration.AllowRestart)
{ {
rulesetSkinProvider.Add(new HotkeyRetryOverlay rulesetSkinProvider.Add(new HotkeyRetryOverlay