1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +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
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));
CurrentTournament.BindValueChanged(updateTournament, false);
CurrentTournament.BindValueChanged(updateTournament);
}
private void updateTournament(ValueChangedEvent<string> newTournament)
{
ChangeTargetStorage(allTournaments.GetStorageForDirectory(newTournament.NewValue));
Logger.Log("Changing tournament storage: " + GetFullPath(string.Empty));
storageConfig.Set(StorageConfig.CurrentTournament, newTournament.NewValue);
storageConfig.Save();
}
public IEnumerable<string> ListTournaments() => allTournaments.GetDirectories(string.Empty);

View File

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