diff --git a/UIExtenderLibModule/Prefab/Patches/WidgetPrefabLoadPatch.cs b/UIExtenderLibModule/Prefab/Patches/WidgetPrefabLoadPatch.cs index 9f32705..a39d081 100644 --- a/UIExtenderLibModule/Prefab/Patches/WidgetPrefabLoadPatch.cs +++ b/UIExtenderLibModule/Prefab/Patches/WidgetPrefabLoadPatch.cs @@ -4,6 +4,8 @@ using System.Linq; using System.Reflection; using System.Reflection.Emit; +using System.Xml; +using System.Xml.XmlConfiguration; using HarmonyLib; using TaleWorlds.GauntletUI.PrefabSystem; @@ -27,11 +29,8 @@ internal static IEnumerable Transpiler(IEnumerable !(i.opcode == OpCodes.Newobj && (i.operand as ConstructorInfo).FullDescription() == xmlSettingsCtor)).Count() + 2; - var to = from + input.Skip(from).TakeWhile(i => !(i.opcode == OpCodes.Newobj && (i.operand as ConstructorInfo).FullDescription() == widgetPrefabCtor)).Count(); + var from = input.TakeWhile(i => !(i.opcode == OpCodes.Newobj && (i.operand as ConstructorInfo).DeclaringType == typeof(XmlReaderSettings))).Count() + 2; + var to = from + input.Skip(from).TakeWhile(i => !(i.opcode == OpCodes.Newobj && (i.operand as ConstructorInfo).DeclaringType == typeof(WidgetPrefab))).Count(); var count = to - from; instructions.RemoveRange(from, count);