1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 21:43:22 +08:00

Address review

This commit is contained in:
Shivam 2020-12-07 21:38:15 +01:00
parent 191f863a49
commit f980f41324
2 changed files with 7 additions and 11 deletions

View File

@ -34,18 +34,16 @@ namespace osu.Game.Tournament.IO
else else
Migrate(UnderlyingStorage.GetStorageForDirectory(default_tournament)); Migrate(UnderlyingStorage.GetStorageForDirectory(default_tournament));
CurrentTournament = new Bindable<string>(storageConfig.Get<string>(StorageConfig.CurrentTournament)); CurrentTournament = storageConfig.GetBindable<string>(StorageConfig.CurrentTournament);
Logger.Log("Using tournament storage: " + GetFullPath(string.Empty)); Logger.Log("Using tournament storage: " + GetFullPath(string.Empty));
CurrentTournament.BindValueChanged(updateTournament, false); CurrentTournament.BindValueChanged(updateTournament);
} }
private void updateTournament(ValueChangedEvent<string> newTournament) private void updateTournament(ValueChangedEvent<string> newTournament)
{ {
ChangeTargetStorage(allTournaments.GetStorageForDirectory(newTournament.NewValue)); ChangeTargetStorage(allTournaments.GetStorageForDirectory(newTournament.NewValue));
Logger.Log("Changing tournament storage: " + GetFullPath(string.Empty)); Logger.Log("Changing tournament storage: " + GetFullPath(string.Empty));
storageConfig.Set(StorageConfig.CurrentTournament, newTournament.NewValue);
storageConfig.Save();
} }
public IEnumerable<string> ListTournaments() => allTournaments.GetDirectories(string.Empty); public IEnumerable<string> ListTournaments() => allTournaments.GetDirectories(string.Empty);

View File

@ -42,16 +42,14 @@ namespace osu.Game.Tournament.Screens
[Resolved] [Resolved]
private RulesetStore rulesets { get; set; } private RulesetStore rulesets { get; set; }
[Resolved]
private Storage storage { get; set; }
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private TournamentSceneManager sceneManager { get; set; } private TournamentSceneManager sceneManager { get; set; }
private Bindable<Size> windowSize; private Bindable<Size> windowSize;
private TournamentStorage storage;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(FrameworkConfigManager frameworkConfig) private void load(FrameworkConfigManager frameworkConfig, Storage storage)
{ {
windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize); windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize);
@ -66,6 +64,7 @@ namespace osu.Game.Tournament.Screens
api.LocalUser.BindValueChanged(_ => Schedule(reload)); api.LocalUser.BindValueChanged(_ => Schedule(reload));
stableInfo.OnStableInfoSaved += () => Schedule(reload); stableInfo.OnStableInfoSaved += () => Schedule(reload);
this.storage = (TournamentStorage)storage;
reload(); reload();
} }
@ -75,7 +74,6 @@ namespace osu.Game.Tournament.Screens
private void reload() private void reload()
{ {
var fileBasedIpc = ipc as FileBasedIPC; var fileBasedIpc = ipc as FileBasedIPC;
var tourneyStorage = storage as TournamentStorage;
fillFlow.Children = new Drawable[] fillFlow.Children = new Drawable[]
{ {
new ActionableInfo new ActionableInfo
@ -121,8 +119,8 @@ namespace osu.Game.Tournament.Screens
{ {
Label = "Current tournament", Label = "Current tournament",
Description = "Changes the background videos and bracket to match the selected tournament. This requires a restart to apply changes.", Description = "Changes the background videos and bracket to match the selected tournament. This requires a restart to apply changes.",
Items = tourneyStorage?.ListTournaments(), Items = storage.ListTournaments(),
Current = tourneyStorage?.CurrentTournament, Current = storage.CurrentTournament,
}, },
resolution = new ResolutionSelector resolution = new ResolutionSelector
{ {