1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 13:23:05 +08:00

Re-implement config value.

This commit is contained in:
smoogipooo 2017-04-15 05:52:46 +09:00
parent 0a1376c2db
commit 6dbc75283c
3 changed files with 10 additions and 3 deletions

View File

@ -17,6 +17,8 @@ namespace osu.Game.Configuration
Set(OsuConfig.Username, string.Empty); Set(OsuConfig.Username, string.Empty);
Set(OsuConfig.Token, string.Empty); Set(OsuConfig.Token, string.Empty);
Set(OsuConfig.Ruleset, 0, 0, int.MaxValue);
Set(OsuConfig.AudioDevice, string.Empty); Set(OsuConfig.AudioDevice, string.Empty);
Set(OsuConfig.SavePassword, false); Set(OsuConfig.SavePassword, false);
Set(OsuConfig.SaveUsername, true); Set(OsuConfig.SaveUsername, true);

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Modes namespace osu.Game.Modes
{ {
@ -31,6 +32,8 @@ namespace osu.Game.Modes
return ruleset; return ruleset;
} }
public static int GetId(Ruleset ruleset) => available_rulesets.First(kvp => kvp.Value == ruleset).Key;
public static IEnumerable<Ruleset> AllRulesets => available_rulesets.Values; public static IEnumerable<Ruleset> AllRulesets => available_rulesets.Values;
} }
} }

View File

@ -58,7 +58,8 @@ namespace osu.Game
private VolumeControl volume; private VolumeControl volume;
public Bindable<Ruleset> Ruleset; private Bindable<int> configRuleset;
public Bindable<Ruleset> Ruleset = new Bindable<Ruleset>();
private readonly string[] args; private readonly string[] args;
@ -88,8 +89,9 @@ namespace osu.Game
Dependencies.Cache(this); Dependencies.Cache(this);
// Todo: I don't think this'll work, need BindableRuleset configRuleset = LocalConfig.GetBindable<int>(OsuConfig.Ruleset);
Ruleset = new Bindable<Ruleset>(); Ruleset.Value = RulesetCollection.GetRuleset(configRuleset.Value);
Ruleset.ValueChanged += r => configRuleset.Value = RulesetCollection.GetId(r);
} }
private ScheduledDelegate scoreLoad; private ScheduledDelegate scoreLoad;