1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 10:22:56 +08:00

Change skin.ini boolean parsing to match osu!stable

Closes https://github.com/ppy/osu/issues/18579.
This commit is contained in:
Dean Herbert 2022-06-06 19:43:08 +09:00
parent 8189820bf9
commit 3862681d94

View File

@ -303,8 +303,13 @@ namespace osu.Game.Skinning
if (Configuration.ConfigDictionary.TryGetValue(lookup.ToString(), out string val))
{
// special case for handling skins which use 1 or 0 to signify a boolean state.
// ..or in some cases 2 (https://github.com/ppy/osu/issues/18579).
if (typeof(TValue) == typeof(bool))
val = val == "1" ? "true" : "false";
{
val = bool.TryParse(val, out bool boolVal)
? Convert.ChangeType(boolVal, typeof(bool)).ToString()
: Convert.ChangeType(Convert.ToInt32(val), typeof(bool)).ToString();
}
var bindable = new Bindable<TValue>();
if (val != null)