mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Merge pull request #19662 from peppy/startup-correct-username
Use a placeholder user with the correct username during login process
This commit is contained in:
commit
888c4c8e08
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user