Decompiled source of HeMoDingDing Mod v1.0.0
HeMoDingDingMod.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using DM; using EzECS.Barriers; using HarmonyLib; using HeMoDingDingMod.ECS; using HeMoDingDingMod.unity脚本; using HeMoDingDingMod.unity脚本.蠕虫类; using HeMoDingDingMod.unity脚本.补丁空间; using HeMoDingDingMod.unity脚本.补丁空间.补丁添加进; using HeMoDingDingMod.我的反射; using Landfall.TABS; using Landfall.TABS.AI.Components; using Landfall.TABS.AI.Components.Modifiers; using Landfall.TABS.AI.Components.Tags; using Landfall.TABS.AI.Systems; using Landfall.TABS.GameState; using Landfall.TABS.UnitEditor; using TFBGames; using Unity.Collections; using Unity.Entities; using Unity.Jobs; using Unity.Mathematics; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Mod name")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("made in SFT by FhpSlime")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3a45c3cf-230c-4310-952f-0887d4266a22")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace HeMoDingDingMod { [BepInPlugin("HeMoDingDingMod", "HeMoDingDingMod", "1.0.0")] internal class Loader : BaseUnityPlugin { [CompilerGenerated] private sealed class <call>d__1 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Loader <>4__this; private GameObject <HeMoDingdingDanli>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <call>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <HeMoDingdingDanli>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; UManager.Init(); new Harmony(UManager.modname).PatchAll(); <HeMoDingdingDanli>5__1 = new GameObject("HeMoDingdingDanli"); Object.DontDestroyOnLoad((Object)(object)<HeMoDingdingDanli>5__1); <HeMoDingdingDanli>5__1.AddComponent<添加自定义内容>(); Debug.Log((object)"黑莫丁丁mod已加载完毕"); <>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)Object.FindObjectOfType<ServiceLocator>() != (Object)null)); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitUntil((Func<bool>)(() => ServiceLocator.GetService<ISaveLoaderService>() != null)); <>1__state = 2; return true; case 2: <>1__state = -1; 多国语言部分333.添加语言(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"黑莫丁丁补丁注入中..."); Harmony.CreateAndPatchAll(typeof(buding.HeMoDingDingHMBD), (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"黑莫丁丁补丁注入完成!"); ((MonoBehaviour)this).StartCoroutine(call()); } [IteratorStateMachine(typeof(<call>d__1))] private IEnumerator call() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <call>d__1(0) { <>4__this = this }; } } public static class UManager { public enum 对象类 { 单位模型, 武器, 技能, 服饰, 抛射物 } public static string modname = "HeMoDingDingMod"; public static List<UnitBlueprint> 编辑器单位基础 = new List<UnitBlueprint>(); public static int MYmodid = 228472303; public static int MYmodunitid = 62847203; public static void Init() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_07e0: Unknown result type (might be due to invalid IL or missing references) //IL_090d: Unknown result type (might be due to invalid IL or missing references) //IL_09dd: Unknown result type (might be due to invalid IL or missing references) //IL_0a5b: Unknown result type (might be due to invalid IL or missing references) Assembly executingAssembly = Assembly.GetExecutingAssembly(); Stream manifestResourceStream = executingAssembly.GetManifestResourceStream("HeMoDingDingMod.hemodingdongsass"); AssetBundle val = AssetBundle.LoadFromStream(manifestResourceStream); Faction val2 = 游戏内容工具.创建派系("UNIT_KONGBUSHENGWU", null, val.LoadAsset<Sprite>("恐怖生物派系dsadsicon"), -4, 49582393); GameObject val3 = 游戏内容工具.注册单位Base(val.LoadAsset<GameObject>("世界吞噬者模型")); val3.GetComponentInChildren<平滑蠕虫跟随>().节间距 = 2f; val3.GetComponentInChildren<平滑蠕虫跟随>().最大允许距离倍数 = 0.9f; val3.GetComponentInChildren<吞噬者移动类>().巡游时间 = 7f; val3.GetComponentInChildren<吞噬者移动类>().转向速度 = 80f; UnitBlueprint val4 = 游戏内容工具.复制单位("UNIT_SHIJIETUNSHIZHE", 游戏内容工具.获取原版单位蓝图(new DatabaseID(-1, 1166250463)), val2, val.LoadAsset<Sprite>("世界吞噬者dsfk"), (DatabaseID?)new DatabaseID(-3, 350452348)); val4.UnitBase = val3; val4.sizeMultiplier = 0.8f; val4.health = 599f; val4.forceCost = 4800u; val4.SetUnitSoundsWithDebug("Secret Attack Vocals/Raptor", "Secret Death Vocals/Raptor", 0.6f); UnitBlueprint val5 = 游戏内容工具.复制单位("世界吞噬者基础蓝图", 游戏内容工具.获取原版单位蓝图(new DatabaseID(-1, 1166250463)), (Faction)null, val.LoadAsset<Sprite>("世界吞噬者dsfk"), (DatabaseID?)new DatabaseID(-3, 345363465)); val5.UnitBase = val3; 编辑器单位基础.Add(val5); 游戏内容工具.注册道具(游戏物品加入.Instance.创建物品("调整身体体节连接", val.LoadAsset<GameObject>("空服饰3453"), new DatabaseID(-3, 176742343))).AddComponent<蠕虫服饰调整>(); 游戏内容工具.注册道具(游戏物品加入.Instance.创建物品("调整蠕虫移动属性", val.LoadAsset<GameObject>("空服饰3453"), new DatabaseID(-3, 176742344))).AddComponent<蠕虫服饰调整2>(); 游戏内容工具.注册道具(游戏物品加入.Instance.创建物品("调整蠕虫移动属性2", val.LoadAsset<GameObject>("空服饰3453"), new DatabaseID(-3, 176742345))).AddComponent<蠕虫服饰调整3>(); UnitBlueprint val6 = 游戏内容工具.复制单位("UNIT_HEIJIABUBUSIZHAN", (UnitBlueprint)null, val2, val.LoadAsset<Sprite>("玛丽卡死icon"), (DatabaseID?)new DatabaseID(-3, 312534211)); val6.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[0]; val6.health = 9000f; val6.massMultiplier = 20f; GameObject rightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("黑剑23243"), 对象类.武器); val6.RightWeapon = rightWeapon; val6.m_props = (GameObject[])(object)new GameObject[11] { 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("玛利喀斯后披风"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("玛利喀斯大腿护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("玛利喀斯大臂护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("玛利喀斯头盔"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("玛利喀斯小腿护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("玛利喀斯小臂护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("玛利喀斯护膝"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("玛利喀斯肩膀护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("玛利喀斯胸甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("玛利喀斯腰部护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("玛利喀斯鞋子"), 对象类.服饰) }; GameObject val7 = 游戏内容工具.注册单位Base(游戏物品加入.Instance.创建物品("灰色人物模型", 获取工具.获取原版内容游戏物品("m_unitBases", new DatabaseID(-1, 1760500345)), new DatabaseID(-3, 13972330))); TeamColor[] componentsInChildren = val7.GetComponentsInChildren<TeamColor>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].blueMaterial = val.LoadAsset<Material>("低反射灰色12"); componentsInChildren[i].redMaterial = val.LoadAsset<Material>("低反射灰色12"); } val6.UnitBase = val7; val6.forceCost = 10000u; val6.SetUnitSoundsWithDebug("Reinassance Attack Vocals/Jouster", "Reinassance Attack Vocals/Jouster", 0.4f); UnitBlueprint val8 = 游戏内容工具.复制单位("UNIT_YILIUTI", (UnitBlueprint)null, val2, val.LoadAsset<Sprite>("遗留着uu"), (DatabaseID?)new DatabaseID(-3, 312534212)); val8.forceCost = 120u; val8.m_props = (GameObject[])(object)new GameObject[7] { 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("死亡剑士上衣"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("死亡剑士大臂套"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("死亡剑士头部插件"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("死亡剑士小臂刺"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("死亡剑士躯干装饰剑"), 对象类.服饰), 获取工具.获取原版内容游戏物品("m_characterProps", new DatabaseID(-1, 1944888562)), 获取工具.获取原版内容游戏物品("m_characterProps", new DatabaseID(-1, 273394296)) }; val8.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("死亡剑士刀剑"), 对象类.武器); val8.health = 20f; val8.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("cd瞬移技能")) }; val8.UnitBase = 获取工具.获取原版内容游戏物品("m_unitBases", new DatabaseID(-1, 1288909650)); val8.SetUnitSoundsWithDebug("Reinassance Attack Vocals/Halberd", "Reinassance Death Vocals/Halberd", 0.5f); UnitBlueprint val9 = 游戏内容工具.复制单位("UNIT_KUANGBAOZHADANREN", (UnitBlueprint)null, val2, val.LoadAsset<Sprite>("精神病人32213"), (DatabaseID?)new DatabaseID(-3, 312534213)); val9.sizeMultiplier = 1f; val9.health = 70f; val9.forceCost = 350u; val9.m_props = (GameObject[])(object)new GameObject[6] { 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("爆破鬼才左腿装饰"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("爆破鬼才的夹克"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("爆破鬼才的脑袋"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("爆破鬼才的连体服饰"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("爆破鬼才背包342"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("爆破鬼才的轮子腰带"), 对象类.服饰) }; val9.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("扔炸弹34"), 对象类.武器); val9.LeftWeapon = val9.RightWeapon; 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("大小炸弹34"), 对象类.抛射物); val9.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("桶装爆破进243")) }; val9.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(NeverStopRunning) }; val9.SetUnitSoundsWithDebug("Western Attack Vocals/Quickdraw", "Western Death Vocals/Quickdraw", 1.5f); UnitBlueprint val10 = 游戏内容工具.复制单位("UNIT_JUEXINGSHUBING", (UnitBlueprint)null, val2, val.LoadAsset<Sprite>("觉醒骷髅兵3we"), (DatabaseID?)new DatabaseID(-3, 312534214)); val10.sizeMultiplier = 0.7f; val10.health = 200f; val10.forceCost = 500u; val10.m_props = (GameObject[])(object)new GameObject[4] { 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("觉醒骷髅大褂"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("觉醒骷髅帽子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("觉醒骷髅裤子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("觉醒骷髅鞋子"), 对象类.服饰) }; val10.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("觉醒骷髅复制剑"), 对象类.武器); val10.UnitBase = 获取工具.获取原版内容游戏物品("m_unitBases", new DatabaseID(-1, 1288909650)); val10.SetUnitSoundsWithDebug("Halloween Attack Vocals/SkeletonWarrior", "Halloween Death Vocals/SkeletonWarrior", 0.95f); UnitBlueprint val11 = 游戏内容工具.复制单位("UNIT_YONGYEQIANXINGZHE", (UnitBlueprint)null, val2, val.LoadAsset<Sprite>("幻影刺客sdkfhj"), (DatabaseID?)new DatabaseID(-3, 332534267)); val11.health = 900f; val11.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[2] { 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("体积雾技能")), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("暗影刺客瞬移技能")) }; val11.m_props = (GameObject[])(object)new GameObject[5] { 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("暗影刺客上衣"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("暗影刺客头发"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("暗影刺客意义不明的手臂套子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("暗影刺客裤子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("暗影刺客鞋子"), 对象类.服饰) }; val11.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("暗影刺客武器"), 对象类.武器); val11.LeftWeapon = val11.RightWeapon; val11.forceCost = 1500u; val11.SetUnitSoundsWithDebug("Fantasy Dark Attack Vocals/FantasyAssassin", "Fantasy Dark Death Vocals/FantasyAssassin", 0.95f); UnitBlueprint val12 = 游戏内容工具.复制单位("UNIT_SHIluoTANXIANJIA", (UnitBlueprint)null, val2, val.LoadAsset<Sprite>("失落冒险家43rdsf"), (DatabaseID?)new DatabaseID(-3, 332534268)); val12.sizeMultiplier = 1.5f; val12.health = 1400f; val12.massMultiplier = 20f; val12.m_props = (GameObject[])(object)new GameObject[6] { 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("迷雾行者上衣"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("迷雾行者外套"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("迷雾行者头盔和头发"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("迷雾行者披风"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("迷雾行者裤子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("迷雾行者鞋子"), 对象类.服饰) }; val12.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { 获取工具.获取原版内容游戏物品("m_combatMoves", new DatabaseID(-1, 920020464)) }; val12.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("十字巨剑3434"), 对象类.武器); val12.holdinigWithTwoHands = true; val12.movementSpeedMuiltiplier = 1.8f; val12.forceCost = 3700u; val12.SetUnitSoundsWithDebug("Fantasy Dark Attack Vocals/StormPriest", "Fantasy Dark Death Vocals/StormPriest", 0.85f); UnitBlueprint val13 = 游戏内容工具.复制单位("UNIT_ZHONGXINGJUNCHUANQIANGQBING", (UnitBlueprint)null, val2, val.LoadAsset<Sprite>("重装步兵daskfn"), (DatabaseID?)new DatabaseID(-3, 332534269)); val13.health = 3000f; val13.sizeMultiplier = 1.7f; val13.massMultiplier = 30f; val13.m_props = (GameObject[])(object)new GameObject[12] { 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("重装亡灵上板甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("重装亡灵下体板甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("重装亡灵前挡"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("重装亡灵大腿护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("重装亡灵大臂护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("重装亡灵头盔"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("重装亡灵护手"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("重装亡灵护膝刺甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("重装亡灵护颈"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("重装亡灵板甲裤子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("重装亡灵羊角护臂"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("重装亡灵鞋子"), 对象类.服饰) }; GameObject val14 = 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("空技能3434")); val14.AddComponent<重装亡灵抛射物免疫添加工具>(); val13.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { val14 }; val13.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("戳矛23"), 对象类.武器); val13.LeftWeapon = 注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("石头盾牌345"), 对象类.武器); val13.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(重装亡灵后撤步) }; val13.forceCost = 8000u; val13.SetUnitSoundsWithDebug("Pirate Attack Vocals/Cannon", "Pirate Attack Vocals/Cannon", 0.85f); List<UnitBlueprint> list = new List<UnitBlueprint>(); UnitBlueprint[] units = val2.Units; foreach (UnitBlueprint item in units) { list.Add(item); } list.Sort((UnitBlueprint unit1, UnitBlueprint unit2) => unit1.GetUnitCost(true).CompareTo(unit2.GetUnitCost(true))); val2.Units = list.ToArray(); } public static GameObject 注册创建游戏对象自动id分配(GameObject 对象, 对象类 类型 = 对象类.技能) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) switch (类型) { case 对象类.技能: { GameObject result5 = 游戏内容工具.注册能力(游戏物品加入.Instance.创建物品(((Object)对象).name, 对象, new DatabaseID(-3, MYmodid))); MYmodid++; return result5; } case 对象类.服饰: { GameObject result4 = 游戏内容工具.注册道具(游戏物品加入.Instance.创建物品(((Object)对象).name, 对象, new DatabaseID(-3, MYmodid))); MYmodid++; return result4; } case 对象类.抛射物: { GameObject result3 = 游戏内容工具.注册投射物(游戏物品加入.Instance.创建物品(((Object)对象).name, 对象, new DatabaseID(-3, MYmodid))); MYmodid++; return result3; } case 对象类.单位模型: { GameObject result2 = 游戏内容工具.注册单位Base(游戏物品加入.Instance.创建物品(((Object)对象).name, 对象, new DatabaseID(-3, MYmodid))); MYmodid++; return result2; } case 对象类.武器: { GameObject result = 游戏内容工具.注册武器(游戏物品加入.Instance.创建物品(((Object)对象).name, 对象, new DatabaseID(-3, MYmodid))); MYmodid++; return result; } default: return null; } } } public class 游戏物品加入 { private GameObject 物品对象池; private static 游戏物品加入 _instance; public static 游戏物品加入 Instance { get { if (_instance == null) { _instance = new 游戏物品加入(); } return _instance; } } private 游戏物品加入() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown Debug.Log((object)"开始创建对象池"); 物品对象池 = new GameObject { hideFlags = (HideFlags)61 }; ((Object)物品对象池).name = "HeMoDingDingObject"; 物品对象池.SetActive(false); Debug.Log((object)"对象池创建完毕"); } public GameObject 创建物品(string 名字, GameObject 要复制的物体, DatabaseID 物体标识, Sprite icon = null) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"开始创建物品"); GameObject val = Object.Instantiate<GameObject>(要复制的物体, 物品对象池.transform); ((Object)val).hideFlags = (HideFlags)52; SetHideFlagsRecursive(val, (HideFlags)52); ((Object)val).name = 名字 + Assembly.GetCallingAssembly().GetName().Name; IDatabaseEntity componentInChildren = val.GetComponentInChildren<IDatabaseEntity>(); if (componentInChildren != null) { CharacterItem val2 = (CharacterItem)(object)((componentInChildren is CharacterItem) ? componentInChildren : null); componentInChildren.Entity.GUID = 物体标识; componentInChildren.Entity.Name = 名字; if ((Object)(object)icon != (Object)null) { componentInChildren.Entity.SpriteIcon = icon; } } Debug.Log((object)("物品创建完毕" + ((Object)val).name)); return val; } private void SetHideFlagsRecursive(GameObject obj, HideFlags flags) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)obj == (Object)null) { return; } ((Object)obj).hideFlags = flags; foreach (Transform item in obj.transform) { Transform val = item; if ((Object)(object)val != (Object)null) { SetHideFlagsRecursive(((Component)val).gameObject, flags); } } } } public static class 游戏内容工具 { private static LandfallContentDatabase 内容数据库 => ContentDatabase.Instance().LandfallContentDatabase; private static AssetLoader 资源加载器 => ContentDatabase.Instance().AssetLoader; private static Dictionary<DatabaseID, Object> 非流式资源字典 => (Dictionary<DatabaseID, Object>)(typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(资源加载器)); public static GameObject 注册单位Base(GameObject 单位基础) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return 注册游戏对象到数据库(单位基础, 单位基础.GetComponent<Unit>().Entity.GUID, "m_unitBases", (GameObject db) => db.GetComponent<Unit>().Entity.GUID); } public static GameObject 注册武器(GameObject 武器对象) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return 注册游戏对象到数据库(武器对象, ((CharacterItem)武器对象.GetComponent<WeaponItem>()).Entity.GUID, "m_weapons", (GameObject obj) => ((CharacterItem)obj.GetComponent<WeaponItem>()).Entity.GUID); } public static GameObject 注册能力(GameObject 能力对象) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return 注册游戏对象到数据库(能力对象, ((CharacterItem)能力对象.GetComponent<SpecialAbility>()).Entity.GUID, "m_combatMoves", (GameObject obj) => ((CharacterItem)obj.GetComponent<SpecialAbility>()).Entity.GUID); } public static GameObject 注册投射物(GameObject 投射物对象) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return 注册游戏对象到数据库(投射物对象, 投射物对象.GetComponent<ProjectileEntity>().Entity.GUID, "m_projectiles", (GameObject obj) => obj.GetComponent<ProjectileEntity>().Entity.GUID); } public static GameObject 注册道具(GameObject 道具对象) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return 注册游戏对象到数据库(道具对象, ((CharacterItem)道具对象.GetComponent<PropItem>()).Entity.GUID, "m_characterProps", (GameObject obj) => ((CharacterItem)obj.GetComponent<PropItem>()).Entity.GUID); } private static GameObject 注册游戏对象到数据库(GameObject 游戏对象, DatabaseID 对象ID, string 数据库字段名, Func<GameObject, DatabaseID> 获取ID函数) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Dictionary<DatabaseID, GameObject> dictionary = 获取字典<GameObject>(数据库字段名); if (!dictionary.ContainsKey(对象ID)) { dictionary.Add(对象ID, 游戏对象); 非流式资源字典.Add(对象ID, (Object)(object)游戏对象); 设置字典值<GameObject>(数据库字段名, dictionary); } return 游戏对象; } public static UnitBlueprint 获取原版单位蓝图(DatabaseID id) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) Dictionary<DatabaseID, UnitBlueprint> dictionary = 获取字典<UnitBlueprint>("m_unitBlueprints"); UnitBlueprint value; return dictionary.TryGetValue(id, out value) ? value : null; } public static UnitBlueprint 复制单位(string 名称, UnitBlueprint 源单位蓝图 = null, Faction 所属派系 = null, Sprite 图标 = null, DatabaseID? 自定义ID = null) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)源单位蓝图 == (Object)null) { 源单位蓝图 = 获取原版单位蓝图(new DatabaseID(-1, 1166250463)); } if ((Object)(object)源单位蓝图 == (Object)null) { Debug.LogError((object)"无法获取源单位蓝图"); return null; } Debug.LogWarning((object)"开始创建蓝图"); UnitBlueprint val = Object.Instantiate<UnitBlueprint>(源单位蓝图); val.Entity.GUID = (DatabaseID)(((??)自定义ID) ?? DatabaseID.NewID()); val.Entity.Name = 名称; ((Object)val).name = 名称; if ((Object)(object)图标 != (Object)null) { val.Entity.SpriteIcon = 图标; } Debug.LogWarning((object)"完成蓝图创建并指定ID"); Dictionary<DatabaseID, UnitBlueprint> dictionary = 获取字典<UnitBlueprint>("m_unitBlueprints"); if (!dictionary.ContainsKey(val.Entity.GUID)) { 非流式资源字典.Add(val.Entity.GUID, (Object)(object)val); dictionary.Add(val.Entity.GUID, val); 设置字典值<UnitBlueprint>("m_unitBlueprints", dictionary); Debug.LogWarning((object)"成功添加到数据库"); } if ((Object)(object)所属派系 != (Object)null && (Object)(object)val != (Object)null) { List<UnitBlueprint> list = 所属派系.Units?.ToList() ?? new List<UnitBlueprint>(); if (!list.Contains(val)) { list.Add(val); 所属派系.Units = list.ToArray(); } } return val; } public static Faction 创建派系(string 名称, UnitBlueprint[] 单位列表 = null, Sprite 图标 = null, int 模组ID = 0, int 派系ID = 0) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) Faction val = ScriptableObject.CreateInstance<Faction>(); val.Init(); val.Entity.GUID = (DatabaseID)((模组ID != 0 && 派系ID != 0) ? new DatabaseID(模组ID, 派系ID) : DatabaseID.NewID()); val.Entity.Name = 名称; ((Object)val).name = 名称; val.Units = (UnitBlueprint[])(((object)单位列表) ?? ((object)new UnitBlueprint[0])); if ((Object)(object)图标 != (Object)null) { val.Entity.SpriteIcon = 图标; } Dictionary<DatabaseID, Faction> dictionary = 获取字典<Faction>("m_factions"); if (!dictionary.ContainsKey(val.Entity.GUID)) { 非流式资源字典.Add(val.Entity.GUID, (Object)(object)val); dictionary.Add(val.Entity.GUID, val); List<DatabaseID> list = 获取默认快捷栏派系ID列表(); if (!list.Contains(val.Entity.GUID)) { list.Add(val.Entity.GUID); 排序并设置默认快捷栏列表(list, dictionary); } 设置字典值<Faction>("m_factions", dictionary); } return val; } private static Dictionary<DatabaseID, T> 获取字典<T>(string 字段名) where T : Object { return (Dictionary<DatabaseID, T>)(typeof(LandfallContentDatabase).GetField(字段名, BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(内容数据库)); } private static void 设置字典值<T>(string 字段名, Dictionary<DatabaseID, T> 字典) where T : Object { typeof(LandfallContentDatabase).GetField(字段名, BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(内容数据库, 字典); } private static List<DatabaseID> 获取默认快捷栏派系ID列表() { return (List<DatabaseID>)(typeof(LandfallContentDatabase).GetField("m_defaultHotbarFactionIds", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(内容数据库)); } private static void 排序并设置默认快捷栏列表(List<DatabaseID> 列表, Dictionary<DatabaseID, Faction> 派系字典) { Faction value2; List<DatabaseID> value = 列表.OrderBy((DatabaseID id) => 派系字典.TryGetValue(id, out value2) ? value2.index : int.MaxValue).ToList(); typeof(LandfallContentDatabase).GetField("m_defaultHotbarFactionIds", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(内容数据库, value); } } public static class 获取工具 { private static LandfallContentDatabase 内容数据库 => ContentDatabase.Instance().LandfallContentDatabase; private static AssetLoader 资源加载器 => ContentDatabase.Instance().AssetLoader; private static Dictionary<DatabaseID, Object> 非流式资源字典 => (Dictionary<DatabaseID, Object>)(typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(资源加载器)); private static Dictionary<DatabaseID, T> 获取字典<T>(string 字段名) where T : Object { return (Dictionary<DatabaseID, T>)(typeof(LandfallContentDatabase).GetField(字段名, BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(内容数据库)); } public static GameObject 获取原版内容游戏物品(string 字典名, DatabaseID id) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return 获取字典<GameObject>(字典名)[id]; } } } namespace HeMoDingDingMod.我的反射 { public static class UnitBlueprintExtensions { public static bool SetFieldWithDebug(this UnitBlueprint blueprint, string fieldName, object value, string callerInfo = "") { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)("[SetField失败] 兵种蓝图为空!调用者: " + callerInfo)); return false; } Debug.Log((object)$"[SetField调试] 开始设置字段 '{fieldName}',值: '{value}',类型: {value?.GetType()}, 调用者: {callerInfo}"); FieldInfo field = typeof(UnitBlueprint).GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { PropertyInfo property = typeof(UnitBlueprint).GetProperty(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite) { Debug.Log((object)$"[SetField调试] 找到属性 '{fieldName}',类型: {property.PropertyType}"); try { if (value != null && !property.PropertyType.IsAssignableFrom(value.GetType())) { Debug.Log((object)$"[SetField调试] 尝试类型转换: {value.GetType()} -> {property.PropertyType}"); value = Convert.ChangeType(value, property.PropertyType); } property.SetValue(blueprint, value); Debug.Log((object)$"[SetField调试] ✅ 属性 '{fieldName}' 设置成功!新值: {property.GetValue(blueprint)}"); return true; } catch (Exception ex) { Debug.LogError((object)("[SetField失败] 设置属性 '" + fieldName + "' 异常: " + ex.Message + "\n堆栈: " + ex.StackTrace)); return false; } } Debug.LogError((object)("[SetField失败] 字段/属性 '" + fieldName + "' 在 UnitBlueprint 中不存在!")); blueprint.PrintAllFields(); return false; } Debug.Log((object)$"[SetField调试] 找到字段 '{fieldName}',字段类型: {field.FieldType},是否为私有: {field.IsPrivate}"); try { object value2 = field.GetValue(blueprint); Debug.Log((object)string.Format("[SetField调试] 原值: {0}", value2 ?? "null")); if (value != null && !field.FieldType.IsAssignableFrom(value.GetType())) { Debug.Log((object)$"[SetField调试] 需要类型转换: {value.GetType()} -> {field.FieldType}"); try { value = Convert.ChangeType(value, field.FieldType); Debug.Log((object)$"[SetField调试] 类型转换成功: {value.GetType()}"); } catch (Exception ex2) { Debug.LogError((object)("[SetField调试] 类型转换失败: " + ex2.Message)); return false; } } field.SetValue(blueprint, value); object value3 = field.GetValue(blueprint); Debug.Log((object)string.Format("[SetField调试] ✅ 字段 '{0}' 设置成功!新值: {1}", fieldName, value3 ?? "null")); return true; } catch (Exception ex3) { Debug.LogError((object)("[SetField失败] 设置字段 '" + fieldName + "' 异常: " + ex3.Message + "\n堆栈: " + ex3.StackTrace)); return false; } } public static void PrintAllFields(this UnitBlueprint blueprint) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"兵种蓝图为空,无法打印字段信息"); return; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("========== UnitBlueprint 字段信息 =========="); stringBuilder.AppendLine("兵种名称: " + blueprint.Name); stringBuilder.AppendLine($"兵种GUID: {blueprint.Entity.GUID}"); FieldInfo[] fields = typeof(UnitBlueprint).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); stringBuilder.AppendLine($"\n所有字段 (共{fields.Length}个):"); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { try { object value = fieldInfo.GetValue(blueprint); string text = (fieldInfo.IsPublic ? "public" : "private"); stringBuilder.AppendLine(string.Format(" [{0}] {1} ({2}) = {3}", text, fieldInfo.Name, fieldInfo.FieldType, value ?? "null")); } catch (Exception ex) { stringBuilder.AppendLine(" [" + fieldInfo.Name + "] 获取失败: " + ex.Message); } } PropertyInfo[] properties = typeof(UnitBlueprint).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); stringBuilder.AppendLine($"\n所有属性 (共{properties.Length}个):"); PropertyInfo[] array2 = properties; foreach (PropertyInfo propertyInfo in array2) { try { object value2 = propertyInfo.GetValue(blueprint); string text2 = (propertyInfo.CanRead ? "可读" : "不可读"); string text3 = (propertyInfo.CanWrite ? "可写" : "不可写"); stringBuilder.AppendLine(string.Format(" [{0}|{1}] {2} ({3}) = {4}", text2, text3, propertyInfo.Name, propertyInfo.PropertyType, value2 ?? "null")); } catch (Exception ex2) { stringBuilder.AppendLine(" [" + propertyInfo.Name + "] 获取失败: " + ex2.Message); } } stringBuilder.AppendLine("==========================================="); Debug.Log((object)stringBuilder.ToString()); } public static bool SetUnitSoundsWithDebug(this UnitBlueprint blueprint, string vocalSound, string deathSound, float pitch = 1f, string footstepSound = "Footsteps/Minotaur") { //IL_004b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"❌ 设置声音失败:兵种蓝图为空!"); return false; } Debug.Log((object)"\n========== 开始设置兵种声音 =========="); Debug.Log((object)("兵种名称: " + blueprint.Name)); Debug.Log((object)$"兵种GUID: {blueprint.Entity.GUID}"); Debug.Log((object)"设置参数:"); Debug.Log((object)(" - vocalSound: " + vocalSound)); Debug.Log((object)(" - deathSound: " + deathSound)); Debug.Log((object)$" - pitch: {pitch}"); Debug.Log((object)(" - footstepSound: " + footstepSound)); bool flag = true; Debug.Log((object)"\n--- 设置前的状态 ---"); blueprint.PrintCurrentSoundState(); if (!blueprint.SetFieldWithDebug("vocalRef", vocalSound, "SetUnitSounds")) { flag = false; } if (!blueprint.SetFieldWithDebug("deathRef", deathSound, "SetUnitSounds")) { flag = false; } if (!blueprint.SetFieldWithDebug("footRef", footstepSound, "SetUnitSounds")) { flag = false; } if (!blueprint.SetFieldWithDebug("voicePitch", pitch, "SetUnitSounds")) { flag = false; } Debug.Log((object)"\n--- 检查VoiceBundle ---"); Object fieldWithDebug = blueprint.GetFieldWithDebug<Object>("voiceBundle", "SetUnitSounds"); if (fieldWithDebug != (Object)null) { Debug.LogWarning((object)$"⚠\ufe0f 检测到VoiceBundle不为null: {fieldWithDebug},这可能会覆盖单独的vocalRef和deathRef设置"); blueprint.SetFieldWithDebug("voiceBundle", null, "SetUnitSounds"); } Debug.Log((object)"\n--- 触发Validate验证 ---"); try { MethodInfo method = typeof(UnitBlueprint).GetMethod("Validate", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(blueprint, null); Debug.Log((object)"✅ Validate方法调用成功"); } else { Debug.LogWarning((object)"⚠\ufe0f 未找到Validate方法"); } } catch (Exception ex) { Debug.LogError((object)("❌ Validate调用失败: " + ex.Message)); } Debug.Log((object)"\n--- 设置后的状态 ---"); blueprint.PrintCurrentSoundState(); Debug.Log((object)(flag ? "✅ 声音设置成功!" : "❌ 声音设置失败!")); Debug.Log((object)"==========================================\n"); return flag; } public static void PrintCurrentSoundState(this UnitBlueprint blueprint) { if (!((Object)(object)blueprint == (Object)null)) { string fieldWithDebug = blueprint.GetFieldWithDebug<string>("vocalRef", "PrintState"); string fieldWithDebug2 = blueprint.GetFieldWithDebug<string>("deathRef", "PrintState"); string fieldWithDebug3 = blueprint.GetFieldWithDebug<string>("footRef", "PrintState"); float fieldWithDebug4 = blueprint.GetFieldWithDebug<float>("voicePitch", "PrintState"); Object fieldWithDebug5 = blueprint.GetFieldWithDebug<Object>("voiceBundle", "PrintState"); object fieldWithDebug6 = blueprint.GetFieldWithDebug<object>("vocalPathData", "PrintState"); object fieldWithDebug7 = blueprint.GetFieldWithDebug<object>("deathPathData", "PrintState"); object fieldWithDebug8 = blueprint.GetFieldWithDebug<object>("footPathData", "PrintState"); Debug.Log((object)"当前声音状态:"); Debug.Log((object)(" - vocalRef: " + (fieldWithDebug ?? "null"))); Debug.Log((object)(" - deathRef: " + (fieldWithDebug2 ?? "null"))); Debug.Log((object)(" - footRef: " + (fieldWithDebug3 ?? "null"))); Debug.Log((object)$" - voicePitch: {fieldWithDebug4}"); Debug.Log((object)(" - voiceBundle: " + (((object)fieldWithDebug5)?.GetType().Name ?? "null"))); Debug.Log((object)(" - vocalPathData: " + ((fieldWithDebug6 != null) ? "已设置" : "null"))); Debug.Log((object)(" - deathPathData: " + ((fieldWithDebug7 != null) ? "已设置" : "null"))); Debug.Log((object)(" - footPathData: " + ((fieldWithDebug8 != null) ? "已设置" : "null"))); } } public static T GetFieldWithDebug<T>(this UnitBlueprint blueprint, string fieldName, string callerInfo = "") { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)("[GetField失败] 兵种蓝图为空!调用者: " + callerInfo)); return default(T); } FieldInfo field = typeof(UnitBlueprint).GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { PropertyInfo property = typeof(UnitBlueprint).GetProperty(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { try { object value = property.GetValue(blueprint); return (value != null) ? ((T)value) : default(T); } catch (Exception ex) { Debug.LogError((object)("[GetField失败] 获取属性 '" + fieldName + "' 异常: " + ex.Message)); return default(T); } } Debug.LogWarning((object)("[GetField] 字段/属性 '" + fieldName + "' 不存在")); return default(T); } try { object value2 = field.GetValue(blueprint); return (value2 != null) ? ((T)value2) : default(T); } catch (Exception ex2) { Debug.LogError((object)("[GetField失败] 获取字段 '" + fieldName + "' 异常: " + ex2.Message)); return default(T); } } } internal static class 多国语言部分333 { public static void 添加语言() { 语言添加("UNIT_KONGBUSHENGWU", "恐怖生物#Horror Beast#恐怖生物#Schreckenskreatur#Créature d'horreur#Ужасающий зверь#Bestia Horrorífica#Bestia Orripilante"); 语言添加("UNIT_SHIJIETUNSHIZHE", "世界吞噬者#World Devourer#世界吞噬者#Weltenverschlinger#Dévoreur du Monde#Пожиратель миров#Devoramundos#Divoramondi"); 语言添加("UNIT_YILIUTI", "遗留体#Remnant#遺留體#Überbleibsel#Relicat#Реликт#Reliquia#Relitto"); 语言添加("UNIT_JUEXINGSHUBING", "觉醒骷髅兵#Awakened Skeleton#覚醒したスケルトン兵#Erwachter Skelettkrieger#Squelette éveillé#Пробужденный скелет#Esqueleto Despertado#Scheletro Risvegliato"); 语言添加("UNIT_HEIJIABUBUSIZHAN", "黑剑加不死斩#Black Sword & Immortal Slash#黒剣・不死斬り#Schwarzes Schwert & Unsterblichkeitsschnitt#Épée Noire & Tranchant Immortel#Черный меч и Бессмертный удар#Espada Negra y Corte Inmortal#Spada Nera e Taglio Immortale"); 语言添加("UNIT_KUANGBAOZHADANREN", "狂暴炸弹人#Raging Bomber#狂暴爆弾兵#Tobsüchtiger Bomber#Bombardier Enragé#Неистовый подрывник#Bombardero Furioso#Bombardiere Furioso"); 语言添加("UNIT_YONGYEQIANXINGZHE", "永夜潜行者#Evernight Stalker#永夜の潜行者#Nachtwanderer#Rôdeur de la Nuit éternelle#Ночной сталкер#Acechador de la Noche Eterna#Inseguitore dell'Eterna Notte"); 语言添加("UNIT_SHIluoTANXIANJIA", "失落探险家#Lost Explorer#失われた探検家#Verlorener Entdecker#Explorateur Perdu#Потерянный исследователь#Explorador Perdido#Esploratore Perduto"); 语言添加("UNIT_ZHONGXINGJUNCHUANQIANGQBING", "重型军团长枪兵#Heavy Legionary Lancer#重装軍団長槍兵#Schwerer Legionärslanzenträger#Lancier Lourd de Légion#Тяжелый копейщик легиона#Lancero Pesado de Legión#Lanciere Pesante della Legione"); } public static void 语言添加(string key, string trans) { //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(key)) { Debug.LogError((object)"翻译键不能为空!"); return; } if (string.IsNullOrEmpty(trans)) { Debug.LogError((object)"翻译内容不能为空!"); return; } string[] array = trans.Split(new string[1] { "#" }, StringSplitOptions.RemoveEmptyEntries); if (array.Length != 8) { Debug.LogError((object)$"翻译格式错误:需要8种语言,但只提供了{array.Length}种。格式应为:中文#英文#日文#德文#法文#俄文#西班牙文#意大利文"); return; } for (int i = 0; i < array.Length; i++) { if (string.IsNullOrWhiteSpace(array[i])) { string[] array2 = new string[8] { "中文", "英文", "日文", "德文", "法文", "俄文", "西班牙文", "意大利文" }; Debug.LogError((object)$"第{i}个位置({array2[i]})的翻译内容为空!"); return; } } try { Dictionary<int, Language> dictionary = new Dictionary<int, Language>(); dictionary.Add(0, (Language)7); dictionary.Add(1, (Language)0); dictionary.Add(2, (Language)8); dictionary.Add(3, (Language)3); dictionary.Add(4, (Language)1); dictionary.Add(5, (Language)6); dictionary.Add(6, (Language)4); dictionary.Add(7, (Language)2); FieldInfo field = typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic); if (field == null) { Debug.LogError((object)"无法访问Localizer的m_localization字段!"); return; } if (!(field.GetValue(null) is Dictionary<Language, Dictionary<string, string>> dictionary2)) { Debug.LogError((object)"本地化字典为空或类型不匹配!"); return; } foreach (Language value in dictionary.Values) { if (!dictionary2.ContainsKey(value)) { Debug.LogError((object)$"本地化字典中缺少语言:{value}"); return; } } int num = 0; for (int j = 0; j < dictionary.Count; j++) { Language val = dictionary[j]; if (!dictionary2[val].ContainsKey(key)) { dictionary2[val].Add(key, array[j]); num++; } else { Debug.LogWarning((object)$"语言{val}中已存在键'{key}',跳过添加"); } } field.SetValue(null, dictionary2); if (num > 0) { Debug.Log((object)$"成功为{num}种语言添加了翻译键:{key}"); } else { Debug.Log((object)("所有语言中都已存在键'" + key + "',未添加任何新翻译")); } } catch (Exception ex) { Debug.LogError((object)("添加翻译时发生错误:" + ex.Message + "\n" + ex.StackTrace)); } } } } namespace HeMoDingDingMod.unity脚本 { public class 添加自定义内容 : MonoBehaviour { public 添加自定义内容() { SceneManager.sceneLoaded += SceneLoaded; } public void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown if (!(((Scene)(ref scene)).name == "UnitCreator_GamepadUI")) { return; } UnitEditorManager component = ((Scene)(ref scene)).GetRootGameObjects().ToList().Find((GameObject x) => Object.op_Implicit((Object)(object)x.GetComponent<UnitEditorManager>())) .GetComponent<UnitEditorManager>(); List<UnitBaseWrapper> list = new List<UnitBaseWrapper>(component.UnitBases); UnitBlueprint[] array = UManager.编辑器单位基础.ToArray(); foreach (UnitBlueprint val in array) { UnitBaseWrapper wrapper = new UnitBaseWrapper { BaseDisplayName = val.Entity.Name, UnitBaseBlueprint = val, UnitBaseRestriction = (UnitBaseRestrictions)0 }; val.Entity.GetSpriteIconAsync((Action<Sprite>)delegate(Sprite sprite) { wrapper.BaseIcon = sprite; }); list.Add(wrapper); } component.UnitBases = list.ToArray(); } } } namespace HeMoDingDingMod.unity脚本.补丁空间 { internal class buding { internal class HeMoDingDingHMBD { [HarmonyPatch(typeof(ProjectileHit))] [HarmonyPatch("DoGameplayEffects")] public class ProjectileHit_DoGameplayEffects1_HEMODINHGDING { [CompilerGenerated] private sealed class <RestoreValuesAfterDelay>d__1 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ProjectileHit instance; public float originalDamage; public float originalForce; private Traverse <traverse>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RestoreValuesAfterDelay>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <traverse>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; <traverse>5__1 = Traverse.Create((object)instance); <traverse>5__1.Field("damage").SetValue((object)originalDamage); <traverse>5__1.Field("force").SetValue((object)originalForce); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPrefix] public static bool DoGameplayEffects_Prefix(ProjectileHit __instance, HitData hit, float m = 1f, Unit unit = null) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hit.transform == (Object)null || (Object)(object)hit.rigidbody == (Object)null) { return true; } Transform root = hit.transform.root; if ((Object)(object)root == (Object)null) { return true; } 抛射物免疫组件ghao component = ((Component)root).GetComponent<抛射物免疫组件ghao>(); if ((Object)(object)component == (Object)null || !component.是否启用) { return true; } if (component.完全免疫) { component.触发免疫(); if ((Object)(object)component.免疫特效 != (Object)null) { GameObject val = Object.Instantiate<GameObject>(component.免疫特效, hit.point, Quaternion.identity); val.transform.forward = hit.normal; } return false; } if (component.免疫次数 > 0) { component.触发免疫(); component.免疫次数--; if ((Object)(object)component.免疫特效 != (Object)null) { GameObject val2 = Object.Instantiate<GameObject>(component.免疫特效, hit.point, Quaternion.identity); val2.transform.forward = hit.normal; } return false; } float 抛射物抗性 = component.抛射物抗性; if (抛射物抗性 > 0f) { Traverse val3 = Traverse.Create((object)__instance); float value = val3.Field("damage").GetValue<float>(); float num = value * (1f - 抛射物抗性); val3.Field("damage").SetValue((object)num); float value2 = val3.Field("force").GetValue<float>(); float num2 = value2 * (1f - 抛射物抗性); val3.Field("force").SetValue((object)num2); if (抛射物抗性 >= 1f) { val3.Field("damage").SetValue((object)value); val3.Field("force").SetValue((object)value2); if ((Object)(object)component.免疫特效 != (Object)null) { Object.Instantiate<GameObject>(component.免疫特效, hit.point, Quaternion.identity); } return false; } ((MonoBehaviour)__instance).StartCoroutine(RestoreValuesAfterDelay(__instance, value, value2)); } return true; } [IteratorStateMachine(typeof(<RestoreValuesAfterDelay>d__1))] private static IEnumerator RestoreValuesAfterDelay(ProjectileHit instance, float originalDamage, float originalForce) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RestoreValuesAfterDelay>d__1(0) { instance = instance, originalDamage = originalDamage, originalForce = originalForce }; } } } } public class 抛射物免疫组件ghao : MonoBehaviour { [Header("基础设置")] public bool 是否启用 = true; [Header("免疫类型")] public bool 完全免疫 = false; [Header("免疫次数")] [Tooltip("0表示无限次数")] public int 免疫次数 = 3; [Header("抛射物抗性")] [Range(0f, 1f)] [Tooltip("0无抗性,1完全免疫抛射物伤害")] public float 抛射物抗性 = 0.5f; [Header("免疫特效")] public GameObject 免疫特效; [Header("状态记录")] public int 已触发次数 = 0; public DateTime 最后触发时间; [Header("特殊效果")] [Tooltip("反弹抛射物")] public bool 反弹抛射物 = false; [Tooltip("偏转抛射物方向")] public bool 偏转抛射物 = false; [Tooltip("吸收抛射物并恢复生命")] public bool 吸收抛射物 = false; public float 吸收恢复量 = 0f; public void 触发免疫() { 已触发次数++; 最后触发时间 = DateTime.Now; Debug.Log((object)$"{((Object)((Component)this).gameObject).name} 触发抛射物免疫,已触发次数: {已触发次数}"); } public bool 是否可以免疫() { if (!是否启用) { return false; } if (免疫次数 == 0) { return true; } return 已触发次数 < 免疫次数; } } } namespace HeMoDingDingMod.unity脚本.补丁空间.补丁添加进 { public class 重装亡灵抛射物免疫添加工具 : MonoBehaviour { private void Start() { Transform root = ((Component)this).transform.root; 抛射物免疫组件ghao 抛射物免疫组件ghao = ((Component)root).gameObject.AddComponent<抛射物免疫组件ghao>(); 抛射物免疫组件ghao.抛射物抗性 = 0.9f; } } } namespace HeMoDingDingMod.unity脚本.蠕虫类 { public class 吞噬者移动类 : MonoBehaviour { public enum 行动模式 { 空中巡游, 追击目标, 直线冲刺 } public Transform 目标; public float 巡游速度; public float 追击速度; public float 冲刺速度; public float 转向速度; public float 冲刺时间; public float 巡游时间; public float 冲刺触发距离; public float 巡游状态目标切换时间; public float 巡游半径 = 20f; public float 巡游高度范围 = 10f; public Rigidbody 物体刚体; public 行动模式 行动行为 = 行动模式.追击目标; public float 减速时间 = 1f; private float 减速计时器 = 0f; private bool 正在减速 = false; private float 目标速度; private Vector3 随机位置; private float 与目标距离; private float 冲刺计时器 = 0f; private float 巡游计时器 = 0f; private float 巡游目标切换计时器 = 0f; public bool 启用 = true; private Unit 此单位; private void Start() { if (!Object.op_Implicit((Object)(object)物体刚体)) { 物体刚体 = ((Component)this).GetComponent<Rigidbody>(); } 此单位 = ((Component)this).GetComponentInParent<Unit>(); if (Object.op_Implicit((Object)(object)物体刚体)) { 物体刚体.useGravity = false; 物体刚体.drag = 5f; 物体刚体.angularDrag = 5f; 物体刚体.collisionDetectionMode = (CollisionDetectionMode)2; } 生成随机巡游位置(); } private void Update() { //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) if (!启用 || !Object.op_Implicit((Object)(object)此单位)) { return; } if (此单位.data.Dead) { 物体刚体.useGravity = true; Transform val = ((Component)this).transform.Find("碰撞伤害体"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } 启用 = false; } 目标 = ((Component)此单位.data.targetData.mainRig).transform; if (!Object.op_Implicit((Object)(object)物体刚体) || (Object)(object)目标 == (Object)null) { return; } switch (行动行为) { case 行动模式.空中巡游: 巡游计时器 += Time.deltaTime; 巡游目标切换计时器 += Time.deltaTime; break; case 行动模式.直线冲刺: 冲刺计时器 += Time.deltaTime; break; } if (正在减速) { 减速计时器 += Time.deltaTime; float num = 减速计时器 / 减速时间; num = Mathf.SmoothStep(0f, 1f, num); float num2 = Mathf.Lerp(冲刺速度, 目标速度, num); 物体刚体.velocity = ((Component)this).transform.forward * num2; if (减速计时器 >= 减速时间) { 正在减速 = false; 减速计时器 = 0f; } } } private void FixedUpdate() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (!启用 || !Object.op_Implicit((Object)(object)物体刚体) || (Object)(object)目标 == (Object)null) { return; } 与目标距离 = Vector3.Distance(((Component)this).transform.position, 目标.position); if (行动行为 == 行动模式.追击目标 && 与目标距离 <= 冲刺触发距离) { 行动行为 = 行动模式.直线冲刺; 冲刺计时器 = 0f; 正在减速 = false; } else if (行动行为 == 行动模式.直线冲刺 && 冲刺计时器 >= 冲刺时间) { 开始减速过渡(行动模式.空中巡游, 巡游速度); } else if (行动行为 == 行动模式.空中巡游 && 巡游计时器 >= 巡游时间) { 行动行为 = 行动模式.追击目标; } if (!正在减速) { switch (行动行为) { case 行动模式.空中巡游: 处理巡游模式移动(); break; case 行动模式.追击目标: 处理追击模式移动(); break; case 行动模式.直线冲刺: 处理冲刺模式移动(); break; } } } public void 设置启用(bool d = true) { 启用 = d; } private void 开始减速过渡(行动模式 下一状态, float 目标速度值) { 行动行为 = 下一状态; 目标速度 = 目标速度值; 正在减速 = true; 减速计时器 = 0f; 巡游计时器 = 0f; 生成随机巡游位置(); } private void 处理巡游模式移动() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (巡游目标切换计时器 >= 巡游状态目标切换时间) { 生成随机巡游位置(); 巡游目标切换计时器 = 0f; } 物体刚体.velocity = ((Component)this).transform.forward * 巡游速度; Vector3 val = 随机位置 - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; 平滑面向方向(转向速度, normalized); } private void 处理追击模式移动() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) Vector3 forward = ((Component)this).transform.forward; 物体刚体.velocity = forward * 追击速度; if (forward != Vector3.zero) { 平滑面向目标(转向速度, 目标.position); } } private void 处理冲刺模式移动() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) Vector3 forward = ((Component)this).transform.forward; 物体刚体.velocity = forward * 冲刺速度; Vector3 val = 目标.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; if (normalized != Vector3.zero) { 平滑面向目标(转向速度 * 0.3f, 目标.position); } } private void 生成随机巡游位置() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)目标 == (Object)null)) { Vector2 val = Random.insideUnitCircle * 巡游半径; float num = Random.Range(0f, 巡游高度范围); 随机位置 = 目标.position + new Vector3(val.x, num, val.y); } } private void 平滑面向目标(float 速度, Vector3 目标点) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) Vector3 val = 目标点 - ((Component)this).transform.position; if (val != Vector3.zero) { Quaternion val2 = Quaternion.LookRotation(val); ((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val2, 速度 * Time.deltaTime); } } private void 平滑面向方向(float 速度, Vector3 方向) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (方向 != Vector3.zero) { Quaternion val = Quaternion.LookRotation(方向); ((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val, 速度 * Time.deltaTime); } } private void 重置状态() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) 冲刺计时器 = 0f; 巡游计时器 = 0f; 巡游目标切换计时器 = 0f; 行动行为 = 行动模式.追击目标; if (Object.op_Implicit((Object)(object)物体刚体)) { 物体刚体.velocity = Vector3.zero; } } private void OnDisable() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)物体刚体)) { 物体刚体.velocity = Vector3.zero; } } } public class 平滑蠕虫跟随 : MonoBehaviour { [Header("引用设置")] public Transform 头部; public List<Transform> 身体节列表 = new List<Transform>(); [Header("跟随参数")] public float 节间距 = 1f; public float 跟随刚度 = 15f; public float 旋转刚度 = 10f; [Header("平滑设置")] [Range(0.1f, 1f)] public float 位置插值速度 = 0.5f; [Range(0.1f, 1f)] public float 旋转插值速度 = 0.3f; [Header("方向设置")] public bool 反转方向 = true; [Header("断裂防止")] public float 最大允许距离倍数 = 2f; public bool 防止断裂 = true; [Header("暂停处理")] public bool 暂停时保持位置 = true; private List<Vector3> 目标位置列表 = new List<Vector3>(); private List<Quaternion> 目标旋转列表 = new List<Quaternion>(); private float 路径更新间隔 = 0.002f; private float 上次路径更新时间; private Vector3 上次头部位置; private float 头部速度; private void Start() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) 初始化身体节(); 上次路径更新时间 = Time.time; 上次头部位置 = 头部.position; } private void LateUpdate() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) if ((Mathf.Approximately(Time.timeScale, 0f) && 暂停时保持位置) || (Object)(object)头部 == (Object)null || 身体节列表.Count == 0) { return; } float deltaTime = GetDeltaTime(); 头部速度 = Vector3.Distance(头部.position, 上次头部位置) / deltaTime; 上次头部位置 = 头部.position; float num = Mathf.Clamp(路径更新间隔 / (1f + 头部速度 * 0.1f), 0.001f, 0.01f); if (GetTime() - 上次路径更新时间 > num) { 更新路径点(); 上次路径更新时间 = GetTime(); } for (int i = 0; i < 身体节列表.Count; i++) { if ((Object)(object)身体节列表[i] == (Object)null) { continue; } int num2 = Mathf.Min(i + 1, 目标位置列表.Count - 1); Vector3 val = 目标位置列表[num2]; Vector3 val2; if (防止断裂 && i == 0) { float num3 = Vector3.Distance(身体节列表[i].position, 头部.position); float num4 = 节间距 * 最大允许距离倍数; if (num3 > num4) { val2 = 身体节列表[i].position - 头部.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; val = 头部.position + normalized * 节间距; } } float num5 = Mathf.Max(跟随刚度, 头部速度 * 2f); float num6 = 位置插值速度 * num5 * deltaTime; num6 = Mathf.Clamp01(num6); if (num6 > 0f) { 身体节列表[i].position = Vector3.Lerp(身体节列表[i].position, val, num6); } if (num2 <= 0 || num2 >= 目标位置列表.Count) { continue; } Vector3 normalized2; if (i < 身体节列表.Count - 1) { val2 = 目标位置列表[num2 + 1] - 身体节列表[i].position; normalized2 = ((Vector3)(ref val2)).normalized; } else { val2 = 目标位置列表[num2] - 身体节列表[i].position; normalized2 = ((Vector3)(ref val2)).normalized; } if (normalized2 != Vector3.zero && ((Vector3)(ref normalized2)).sqrMagnitude > 0.001f) { Quaternion val3 = ((!反转方向) ? Quaternion.LookRotation(normalized2) : Quaternion.LookRotation(-normalized2)); float num7 = Mathf.Max(旋转刚度, 头部速度 * 1.5f); float num8 = 旋转插值速度 * num7 * deltaTime; num8 = Mathf.Clamp01(num8); if (num8 > 0f) { 身体节列表[i].rotation = Quaternion.Slerp(身体节列表[i].rotation, val3, num8); } } } } private void 初始化身体节() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) 目标位置列表.Clear(); 目标旋转列表.Clear(); 目标位置列表.Add(头部.position); 目标旋转列表.Add(头部.rotation); for (int i = 0; i < 身体节列表.Count; i++) { if ((Object)(object)身体节列表[i] != (Object)null) { Vector3 val = 头部.position - 头部.forward * (节间距 * (float)(i + 1)); 身体节列表[i].position = val; Vector3 val2 = 头部.position - val; Vector3 normalized = ((Vector3)(ref val2)).normalized; 身体节列表[i].rotation = Quaternion.LookRotation(-normalized); 目标位置列表.Add(val); 目标旋转列表.Add(身体节列表[i].rotation); } } } private void 更新路径点() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) if (目标位置列表.Count > 0) { 目标位置列表[0] = 头部.position; 目标旋转列表[0] = 头部.rotation; } for (int i = 1; i < 目标位置列表.Count; i++) { Vector3 val = 目标位置列表[i - 1]; Vector3 val2 = val - 目标位置列表[i]; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude > 0.001f) { Vector3 val3 = val2 / magnitude; if (magnitude > 节间距 * 1.2f || magnitude < 节间距 * 0.8f) { 目标位置列表[i] = val - val3 * 节间距; } } if (i <= 0) { continue; } Vector3 val4; Vector3 normalized; if (i < 目标位置列表.Count - 1) { val4 = 目标位置列表[i + 1] - 目标位置列表[i]; normalized = ((Vector3)(ref val4)).normalized; } else { val4 = 目标位置列表[i] - 目标位置列表[i - 1]; normalized = ((Vector3)(ref val4)).normalized; } if (normalized != Vector3.zero && ((Vector3)(ref normalized)).sqrMagnitude > 0.001f) { if (反转方向) { 目标旋转列表[i] = Quaternion.LookRotation(-normalized); } else { 目标旋转列表[i] = Quaternion.LookRotation(normalized); } } } } private float GetDeltaTime() { if (Mathf.Approximately(Time.timeScale, 0f)) { return Time.unscaledDeltaTime; } return Time.deltaTime; } private float GetTime() { if (Mathf.Approximately(Time.timeScale, 0f)) { return Time.unscaledTime; } return Time.time; } public void 游戏结束() { ((Behaviour)this).enabled = false; } private void OnDisable() { } private void OnDrawGizmosSelected() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) if (!Application.isPlaying || 目标位置列表 == null) { return; } for (int i = 0; i < 目标位置列表.Count; i++) { Gizmos.color = ((i == 0) ? Color.blue : Color.yellow); Gizmos.DrawSphere(目标位置列表[i], 0.2f); if (i < 目标旋转列表.Count) { Gizmos.color = Color.red; Vector3 val = 目标旋转列表[i] * Vector3.forward; Gizmos.DrawRay(目标位置列表[i], val * 0.5f); if (反转方向) { Gizmos.color = Color.green; if (i < 目标位置列表.Count - 1) { Vector3 val2 = 目标位置列表[i + 1] - 目标位置列表[i]; Vector3 normalized = ((Vector3)(ref val2)).normalized; Gizmos.DrawRay(目标位置列表[i], normalized * 0.5f); } } } if (i > 0) { float num = Vector3.Distance(目标位置列表[i - 1], 目标位置列表[i]); Gizmos.color = ((Mathf.Abs(num - 节间距) < 0.1f) ? Color.green : Color.red); Gizmos.DrawLine(目标位置列表[i - 1], 目标位置列表[i]); } } } } public class 游戏开始事件启动器 : MonoBehaviour { private GameStateManager man; private bool 已开始 = false; public UnityEvent 开始战斗事件; private void Start() { man = ServiceLocator.GetService<GameStateManager>(); if (man == null) { Debug.LogError((object)"GameStateManager not found in ServiceLocator"); } } private void Update() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 if (!已开始 && (int)man.GameState == 1) { UnityEvent obj = 开始战斗事件; if (obj != null) { obj.Invoke(); } 已开始 = true; ((Behaviour)this).enabled = false; } } } public class 兵种ai地面检测121 : MonoBehaviour { private Unit unit; private DataHandler dataq; private bool 判断1 = true; private float 计时器 = 0f; private LayerMask 地面层掩码 = LayerMask.op_Implicit(512); private Vector3 当前地面位置; private Vector3 当前地面法线; private bool 是否在地面 = false; private float 距离地面距离 = 0f; public Vector3 当前地面位置信息 => 当前地面位置; public Vector3 当前地面法线信息 => 当前地面法线; public float 距离地面距离信息 => 距离地面距离; public bool 角色在地面 => 是否在地面; public void Start() { unit = ((Component)((Component)this).gameObject.transform.root).gameObject.GetComponentInChildren<Unit>(); dataq = unit.data; } public bool 获取地面数据(out Vector3 地面位置, out Vector3 地面法线, out float 距离) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) 地面位置 = Vector3.zero; 地面法线 = Vector3.up; 距离 = 0f; Vector3 val = unit.data.mainRig.position + Vector3.up * 2f; float num = 5f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, num, LayerMask.op_Implicit(地面层掩码))) { 地面位置 = ((RaycastHit)(ref val2)).point; 地面法线 = ((RaycastHit)(ref val2)).normal; 距离 = Vector3.Distance(unit.data.mainRig.position, ((RaycastHit)(ref val2)).point); return true; } return false; } public Vector3 获取地面位置(float 检测高度 = 10f) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) Vector3 position = unit.data.mainRig.position; Vector3 val = position + Vector3.up * 检测高度; float num = 检测高度 * 3f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, num, LayerMask.op_Implicit(地面层掩码))) { 当前地面位置 = ((RaycastHit)(ref val2)).point; 当前地面法线 = ((RaycastHit)(ref val2)).normal; 是否在地面 = true; 距离地面距离 = Vector3.Distance(position, ((RaycastHit)(ref val2)).point); return ((RaycastHit)(ref val2)).point; } 是否在地面 = false; return ((Component)this).transform.position; } public Vector3 获取地面法线(float 检测高度 = 10f) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) Vector3 position = unit.data.mainRig.position; Vector3 val = position + Vector3.up * 检测高度; float num = 检测高度 * 3f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, num, LayerMask.op_Implicit(地面层掩码))) { return ((RaycastHit)(ref val2)).normal; } return Vector3.up; } public float 获取距离地面距离(float 检测高度 = 10f) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) Vector3 position = unit.data.mainRig.position; Vector3 val = position + Vector3.up * 检测高度; float num = 检测高度 * 3f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, num, LayerMask.op_Implicit(地面层掩码))) { return Vector3.Distance(position, ((RaycastHit)(ref val2)).point); } return float.MaxValue; } public bool 是否接触地面(float 最大距离 = 1.5f) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) 获取地面位置(2f); return 是否在地面 && 距离地面距离 <= 最大距离; } public void 更新地面数据() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unkno