mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Move window/volume configuration to framework level.
This commit is contained in:
@ -22,7 +22,7 @@ namespace osu.Game
|
||||
{
|
||||
public class OsuGameBase : BaseGame, IOnlineComponent
|
||||
{
|
||||
internal OsuConfigManager Config;
|
||||
protected OsuConfigManager LocalConfig;
|
||||
|
||||
protected override string MainResourceFile => @"osu.Game.Resources.dll";
|
||||
|
||||
@ -40,7 +40,7 @@ namespace osu.Game
|
||||
private void load()
|
||||
{
|
||||
Dependencies.Cache(this);
|
||||
Dependencies.Cache(Config);
|
||||
Dependencies.Cache(LocalConfig);
|
||||
Dependencies.Cache(new BeatmapDatabase(Host.Storage, Host));
|
||||
Dependencies.Cache(new OsuColour());
|
||||
|
||||
@ -69,9 +69,9 @@ namespace osu.Game
|
||||
|
||||
Dependencies.Cache(API = new APIAccess
|
||||
{
|
||||
Username = Config.Get<string>(OsuConfig.Username),
|
||||
Password = Config.Get<string>(OsuConfig.Password),
|
||||
Token = Config.Get<string>(OsuConfig.Token)
|
||||
Username = LocalConfig.Get<string>(OsuConfig.Username),
|
||||
Password = LocalConfig.Get<string>(OsuConfig.Password),
|
||||
Token = LocalConfig.Get<string>(OsuConfig.Token)
|
||||
});
|
||||
|
||||
API.Register(this);
|
||||
@ -82,8 +82,8 @@ namespace osu.Game
|
||||
switch (state)
|
||||
{
|
||||
case APIState.Online:
|
||||
Config.Set(OsuConfig.Username, Config.Get<bool>(OsuConfig.SaveUsername) ? API.Username : string.Empty);
|
||||
Config.Set(OsuConfig.Password, Config.Get<bool>(OsuConfig.SavePassword) ? API.Password : string.Empty);
|
||||
LocalConfig.Set(OsuConfig.Username, LocalConfig.Get<bool>(OsuConfig.SaveUsername) ? API.Username : string.Empty);
|
||||
LocalConfig.Set(OsuConfig.Password, LocalConfig.Get<bool>(OsuConfig.SavePassword) ? API.Password : string.Empty);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -103,8 +103,8 @@ namespace osu.Game
|
||||
|
||||
public override void SetHost(BasicGameHost host)
|
||||
{
|
||||
if (Config == null)
|
||||
Config = new OsuConfigManager(host.Storage);
|
||||
if (LocalConfig == null)
|
||||
LocalConfig = new OsuConfigManager(host.Storage);
|
||||
base.SetHost(host);
|
||||
}
|
||||
|
||||
@ -117,10 +117,10 @@ namespace osu.Game
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
//refresh token may have changed.
|
||||
if (Config != null && API != null)
|
||||
if (LocalConfig != null && API != null)
|
||||
{
|
||||
Config.Set(OsuConfig.Token, API.Token);
|
||||
Config.Save();
|
||||
LocalConfig.Set(OsuConfig.Token, API.Token);
|
||||
LocalConfig.Save();
|
||||
}
|
||||
|
||||
base.Dispose(isDisposing);
|
||||
|
Reference in New Issue
Block a user