mirror of
https://github.com/osukey/osukey.git
synced 2025-05-31 02:17:34 +09:00
further simplification
This commit is contained in:
parent
27f81288ef
commit
332c199dc2
@ -5,7 +5,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using AutoMapper.Internal;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.TypeExtensions;
|
using osu.Framework.Extensions.TypeExtensions;
|
||||||
@ -182,7 +181,10 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
if (sourceSetting.IsDefault)
|
if (sourceSetting.IsDefault)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (getBindableGenericType(targetSetting) != getBindableGenericType(sourceSetting))
|
var targetType = targetSetting.GetType();
|
||||||
|
var sourceType = sourceSetting.GetType();
|
||||||
|
|
||||||
|
if (!targetType.IsAssignableFrom(sourceType) && !sourceType.IsAssignableFrom(targetType))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// TODO: special case for handling number types
|
// TODO: special case for handling number types
|
||||||
@ -190,11 +192,6 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
PropertyInfo property = targetSetting.GetType().GetProperty(nameof(Bindable<bool>.Value))!;
|
PropertyInfo property = targetSetting.GetType().GetProperty(nameof(Bindable<bool>.Value))!;
|
||||||
property.SetValue(targetSetting, property.GetValue(sourceSetting));
|
property.SetValue(targetSetting, property.GetValue(sourceSetting));
|
||||||
}
|
}
|
||||||
|
|
||||||
Type getBindableGenericType(IBindable setting) =>
|
|
||||||
setting.GetType().GetTypeInheritance()
|
|
||||||
.First(t => t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Bindable<>))
|
|
||||||
.GenericTypeArguments.Single();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user