Decompiled source of StarFan Birthday v0.0.1
StarFan Birthday.dll
Decompiled 3 weeks 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 BepInEx; using DM; using HarmonyLib; using Landfall.TABS; using Landfall.TABS.AI; using Landfall.TABS.UnitEditor; using LaoXingChenShengRiMod; using LaoXingChenShengRiMod.物品添加类; using LaoXingChenShengRiMod.角色类.青铜石像23; using LaoXingChenShengRiMod.角色类.青铜石像sdajf; using TFBGames; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using youMod_Name.物品添加类; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LaoXingChenShengRiMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [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 youMod_Name.物品添加类 { public static class 便携添加工具 { public enum 对象类 { 单位模型, 武器, 技能, 服饰, 抛射物 } public static int MYmodid = 7589069; public static int MYmodunitid = 2688786; 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 static void 添加单位到指定派系(UnitBlueprint[] 指定的所有单位, Faction 指定派系, bool 自动排序 = false, bool 去重 = false) { if (指定的所有单位 == null || 指定的所有单位.Length == 0) { return; } List<UnitBlueprint> list = new List<UnitBlueprint>(); if (指定派系.Units != null) { list.AddRange(指定派系.Units); } list.AddRange(指定的所有单位); if (去重) { list = (from unit in list where ((unit != null) ? unit.Entity : null) != null group unit by unit.Entity.GUID into @group select @group.First()).ToList(); } if (自动排序) { list.Sort((UnitBlueprint unit1, UnitBlueprint unit2) => unit1.GetUnitCost(true).CompareTo(unit2.GetUnitCost(true))); } 指定派系.Units = list.ToArray(); } public static void 添加单位到指定派系(UnitBlueprint 指定单位, Faction 指定派系, bool 自动排序 = false, bool 去重 = false) { if (!((Object)(object)指定单位 == (Object)null)) { 添加单位到指定派系((UnitBlueprint[])(object)new UnitBlueprint[1] { 指定单位 }, 指定派系, 自动排序, 去重); } } public static void 设置单位蓝图声音(UnitBlueprint 此单位, string 单位声音, string 单位阵亡声音, float 音调, string 单位脚步声音) { 此单位.SetUnitSounds(单位声音, 单位阵亡声音, 音调, 单位脚步声音); } public static void 设置单位蓝图骑手(UnitBlueprint 此单位, UnitBlueprint[] 骑手组) { 此单位.SetRiders(骑手组); } } public static class UnitBlueprintExtensions { public static bool SetField(this UnitBlueprint blueprint, string fieldName, object value) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[SetField] 兵种蓝图为空"); return false; } 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) { try { if (value != null && !property.PropertyType.IsAssignableFrom(value.GetType())) { value = Convert.ChangeType(value, property.PropertyType); } property.SetValue(blueprint, value); return true; } catch (Exception ex) { Debug.LogError((object)("[SetField] 设置属性 '" + fieldName + "' 失败: " + ex.Message)); return false; } } Debug.LogError((object)("[SetField] 字段/属性 '" + fieldName + "' 不存在")); return false; } try { if (value != null && !field.FieldType.IsAssignableFrom(value.GetType())) { value = Convert.ChangeType(value, field.FieldType); } field.SetValue(blueprint, value); return true; } catch (Exception ex2) { Debug.LogError((object)("[SetField] 设置字段 '" + fieldName + "' 失败: " + ex2.Message)); return false; } } public static T GetField<T>(this UnitBlueprint blueprint, string fieldName) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[GetField] 兵种蓝图为空"); 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); } } 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); } } public static bool SetUnitSounds(this UnitBlueprint blueprint, string vocalSound, string deathSound, float pitch = 1f, string footstepSound = "Footsteps/Minotaur") { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[SetUnitSounds] 兵种蓝图为空"); return false; } bool result = true; if (!blueprint.SetField("vocalRef", vocalSound)) { result = false; } if (!blueprint.SetField("deathRef", deathSound)) { result = false; } if (!blueprint.SetField("footRef", footstepSound)) { result = false; } if (!blueprint.SetField("voicePitch", pitch)) { result = false; } VoiceBundle field = blueprint.GetField<VoiceBundle>("voiceBundle"); if ((Object)(object)field != (Object)null) { blueprint.SetField("voiceBundle", null); } typeof(UnitBlueprint).GetMethod("Validate", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(blueprint, null); return result; } public static bool SetRider(this UnitBlueprint blueprint, UnitBlueprint riderBlueprint) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[SetRider] 兵种蓝图为空"); return false; } if ((Object)(object)riderBlueprint == (Object)null) { Debug.LogError((object)"[SetRider] 骑手蓝图为空"); return false; } blueprint.SetCustomRider(riderBlueprint.Entity.GUID); return true; } public static bool SetRiders(this UnitBlueprint blueprint, UnitBlueprint[] riderBlueprints) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[SetRiders] 兵种蓝图为空"); return false; } if (riderBlueprints == null || riderBlueprints.Length == 0) { blueprint.SetNoCustomRider(); return blueprint.SetField("Riders", null); } return blueprint.SetField("Riders", riderBlueprints); } public static bool AddRider(this UnitBlueprint blueprint, UnitBlueprint riderBlueprint) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[AddRider] 兵种蓝图为空"); return false; } if ((Object)(object)riderBlueprint == (Object)null) { Debug.LogError((object)"[AddRider] 骑手蓝图为空"); return false; } UnitBlueprint[] field = blueprint.GetField<UnitBlueprint[]>("Riders"); UnitBlueprint[] value; if (field == null || field.Length == 0) { value = (UnitBlueprint[])(object)new UnitBlueprint[1] { riderBlueprint }; } else { if (field.Any((UnitBlueprint r) => r.Entity.GUID == riderBlueprint.Entity.GUID)) { Debug.LogWarning((object)("[AddRider] 骑手 '" + riderBlueprint.Name + "' 已存在")); return false; } value = field.Concat((IEnumerable<UnitBlueprint>)(object)new UnitBlueprint[1] { riderBlueprint }).ToArray(); } return blueprint.SetField("Riders", value); } public static bool RemoveRider(this UnitBlueprint blueprint, UnitBlueprint riderBlueprint) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[RemoveRider] 兵种蓝图为空"); return false; } if ((Object)(object)riderBlueprint == (Object)null) { Debug.LogError((object)"[RemoveRider] 骑手蓝图为空"); return false; } UnitBlueprint[] field = blueprint.GetField<UnitBlueprint[]>("Riders"); if (field == null || field.Length == 0) { return true; } UnitBlueprint[] array = field.Where((UnitBlueprint r) => r.Entity.GUID != riderBlueprint.Entity.GUID).ToArray(); if (array.Length == field.Length) { Debug.LogWarning((object)("[RemoveRider] 未找到骑手 '" + riderBlueprint.Name + "'")); return false; } if (array.Length == 0) { blueprint.SetNoCustomRider(); return blueprint.SetField("Riders", null); } return blueprint.SetField("Riders", array); } public static bool ClearRiders(this UnitBlueprint blueprint) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[ClearRiders] 兵种蓝图为空"); return false; } blueprint.SetNoCustomRider(); return blueprint.SetField("Riders", null); } public static UnitBlueprint[] GetRiders(this UnitBlueprint blueprint) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[GetRiders] 兵种蓝图为空"); return Array.Empty<UnitBlueprint>(); } return blueprint.UnitRiders ?? Array.Empty<UnitBlueprint>(); } } public class 懒得发字典添加物品类 { private static 懒得发字典添加物品类 _instance; private GameObject 物品对象池; 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 = UManager.mod名字; 物品对象池.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 Faction 获取原版派系(DatabaseID id) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) Dictionary<DatabaseID, Faction> dictionary = 获取字典<Faction>("m_factions"); Faction 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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])); 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 LaoXingChenShengRiMod { [BepInPlugin("LaoXingChenShengRiMod", "LaoXingChenShengRiMod", "1.0.0")] internal class Loader : BaseUnityPlugin { private void Awake() { Debug.Log((object)"已加载LaoXingChenShengRiMod"); Harmony.CreateAndPatchAll(typeof(Loader).Assembly, "com.LaoXingChenShengRiMod.HarmonyLib"); ((BaseUnityPlugin)this).Logger.LogInfo((object)("模组 " + typeof(Loader).Assembly.GetName().Name + " 已加载!")); ((MonoBehaviour)this).StartCoroutine(call()); } private IEnumerator call() { UManager.Init(); yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)Object.FindObjectOfType<ServiceLocator>() != (Object)null)); yield return (object)new WaitUntil((Func<bool>)(() => ServiceLocator.GetService<ISaveLoaderService>() != null)); yield return (object)new WaitForSecondsRealtime(0.3f); UManager.vsb(); GameObject 老星辰生日_SENSHONT = new GameObject("老星辰生日_SENSHONT"); Object.DontDestroyOnLoad((Object)(object)老星辰生日_SENSHONT); 老星辰生日_SENSHONT.AddComponent<场景管理器添加隐藏物体>(); 多国语言部分333.添加语言(); } } public static class UManager { public static string mod名字 = "LaoXingChenShengRiMod"; public static AssetBundle modsb; public static void vsb() { SoundPlayer service = ServiceLocator.GetService<SoundPlayer>(); if ((Object)(object)service == (Object)null) { Debug.LogError((object)"无法获取SoundPlayer服务"); return; } SoundBank soundBank = service.soundBank; if ((Object)(object)soundBank == (Object)null) { Debug.LogError((object)"SoundPlayer中的soundBank为空"); return; } SoundBank[] array = modsb.LoadAllAssets<SoundBank>(); if (array != null && array.Length != 0) { List<SoundBankCategory> list = soundBank.Categories?.ToList() ?? new List<SoundBankCategory>(); SoundBank[] array2 = array; foreach (SoundBank val in array2) { if ((Object)(object)val != (Object)null && val.Categories != null) { list.AddRange(val.Categories); Debug.Log((object)$"已合并SoundBank: {((Object)val).name}, 类别数: {val.Categories.Length}"); } else if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"遇到空的SoundBank引用,已跳过"); } else { Debug.LogWarning((object)("SoundBank " + ((Object)val).name + " 的Categories为空")); } } soundBank.Categories = list.ToArray(); Debug.Log((object)$"SoundBank合并完成,总类别数: {list.Count}"); } else { Debug.LogWarning((object)"主AssetBundle中没有找到任何SoundBank"); } } public static void Init() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) Assembly executingAssembly = Assembly.GetExecutingAssembly(); Stream manifestResourceStream = executingAssembly.GetManifestResourceStream("LaoXingChenShengRiMod.sdfsasefds"); AssetBundle val = (modsb = AssetBundle.LoadFromStream(manifestResourceStream)); Material[] array = val.LoadAllAssets<Material>(); if (array.Length != 0) { for (int i = 0; i < array.Length; i++) { if (Object.op_Implicit((Object)(object)array[i])) { array[i].shader = Shader.Find(((Object)array[i].shader).name); } } } UnitBlueprint val2 = 游戏内容工具.复制单位("UNIT_GUTONGLONGKUILUI", (UnitBlueprint)null, (Faction)null, val.LoadAsset<Sprite>("古铜龙傀儡icon"), (DatabaseID?)new DatabaseID(-5, 6586743)); GameObject val3 = 游戏内容工具.注册单位Base(val.LoadAsset<GameObject>("石龙模型qedfds")); UnitBlueprint val4 = 游戏内容工具.复制单位("火焰士兵", (UnitBlueprint)null, (Faction)null, (Sprite)null, (DatabaseID?)new DatabaseID(-5, 6452382)); val3.GetComponentInChildren<周围随机位置生成单位>().单位蓝图 = val4; val4.UnitBase = 游戏内容工具.注册单位Base(val.LoadAsset<GameObject>("火焰小兵模型kdfj")); val2.UnitBase = val3; val2.stepMultiplier = 4f; val2.movementSpeedMuiltiplier = 0.8f; val2.sizeMultiplier = 4f; val2.animationMultiplier = 1f; val2.health = 9500f; GameObject val5 = 游戏内容工具.注册武器(val.LoadAsset<GameObject>("古铜大刀sdfasd")); val5.AddComponent<迅速绑定武器>(); GameObject val6 = 游戏内容工具.注册武器(val.LoadAsset<GameObject>("古铜盾牌fsdsdf")); val6.AddComponent<迅速绑定武器>(); val2.RightWeapon = val5; val2.LeftWeapon = val6; val2.massMultiplier = 10f; val2.forceCost = 13000u; val2.Entity.SetUnlockKey("QINGLONG_SHIXIANG"); val2.SetUnitSounds("Misc Attack Vocals/Crow", "Misc Attack Vocals/Crow", 1f, "Footsteps/IceGiant"); val4.SetUnitSounds("Misc Attack Vocals/Crow", "Misc Attack Vocals/Crow"); 便携添加工具.注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("青铜龙象服饰_ring圆环"), 便携添加工具.对象类.服饰); 便携添加工具.注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("青铜龙象服饰_小腿护甲"), 便携添加工具.对象类.服饰); 便携添加工具.注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("青铜龙象服饰_护腿"), 便携添加工具.对象类.服饰); 便携添加工具.注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("青铜龙象服饰_肩甲"), 便携添加工具.对象类.服饰); 便携添加工具.注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("青铜龙象服饰_胸甲"), 便携添加工具.对象类.服饰); 便携添加工具.注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("青铜龙象服饰_裙甲"), 便携添加工具.对象类.服饰); 便携添加工具.注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("火焰箭矢sdcg"), 便携添加工具.对象类.抛射物); GameObject[] array2 = val.LoadAllAssets<GameObject>(); 游戏内容工具.注册能力(懒得发字典添加物品类.Instance.创建物品("大型剑雨", val.LoadAsset<GameObject>("大型剑雨sdf"), new DatabaseID(-3, 52033422))); 游戏内容工具.注册能力(懒得发字典添加物品类.Instance.创建物品("激光吐息", val.LoadAsset<GameObject>("激光吐息sdasd"), new DatabaseID(-3, 52033423))); 便携添加工具.注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("火焰吐息_青铜石像")); 游戏内容工具.注册能力(懒得发字典添加物品类.Instance.创建物品("熔渣凝聚", val.LoadAsset<GameObject>("熔渣凝聚akfd"), new DatabaseID(-3, 52033424))); 游戏内容工具.注册能力(懒得发字典添加物品类.Instance.创建物品("白色冲击波", val.LoadAsset<GameObject>("白色冲击波45f"), new DatabaseID(-3, 52033425))); GameObject val7 = 游戏内容工具.注册能力(懒得发字典添加物品类.Instance.创建物品("红色冲击波", val.LoadAsset<GameObject>("红色冲击波45fdsd"), new DatabaseID(-3, 52033426))); val7.GetComponentInChildren<周围随机位置生成单位>().单位蓝图 = val4; 便携添加工具.注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("纯粹火焰吐息")); val4.RightWeapon = 便携添加工具.注册创建游戏对象自动id分配(val.LoadAsset<GameObject>("火焰大刀2343"), 便携添加工具.对象类.武器); Faction 指定派系 = 游戏内容工具.获取原版派系(new DatabaseID(-1, 874593522)); 添加单位到指定派系(val2, 指定派系); } public static void 添加单位到指定派系(UnitBlueprint[] 指定的所有单位, Faction 指定派系, bool 自动排序 = false, bool 去重 = false) { if (指定的所有单位 == null || 指定的所有单位.Length == 0) { return; } List<UnitBlueprint> list = new List<UnitBlueprint>(); if (指定派系.Units != null) { list.AddRange(指定派系.Units); } list.AddRange(指定的所有单位); if (去重) { list = (from unit in list where ((unit != null) ? unit.Entity : null) != null group unit by unit.Entity.GUID into @group select @group.First()).ToList(); } if (自动排序) { list.Sort((UnitBlueprint unit1, UnitBlueprint unit2) => unit1.GetUnitCost(true).CompareTo(unit2.GetUnitCost(true))); } 指定派系.Units = list.ToArray(); } public static void 添加单位到指定派系(UnitBlueprint 指定单位, Faction 指定派系, bool 自动排序 = false, bool 去重 = false) { if (!((Object)(object)指定单位 == (Object)null)) { 添加单位到指定派系((UnitBlueprint[])(object)new UnitBlueprint[1] { 指定单位 }, 指定派系, 自动排序, 去重); } } } } namespace LaoXingChenShengRiMod.角色类 { public class 碰撞检测获取单位基类 : MonoBehaviour { public enum 施加方式 { 对敌方, 全部, 对自己和对于, 仅自己 } public enum 检测方式 { 物体, 单位 } public UnitEffectBase 效果设置; public float 检测半径 = 6f; public LayerMask 检测层; private Unit 存储单位; public 施加方式 效果施加对应 = 施加方式.对敌方; private Team 队伍信息; public 检测方式 sss = 检测方式.单位; protected virtual void Start() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_004c: Unknown result type (might be due to invalid IL or missing references) if (sss == 检测方式.单位) { 存储单位 = ((Component)this).GetComponentInParent<Unit>(); 队伍信息 = 存储单位.data.team; } if (sss == 检测方式.物体) { 队伍信息 = ((Component)this).GetComponentInParent<TeamHolder>().team; } } public void 开始检测() { //IL_0007: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 检测半径, LayerMask.op_Implicit(检测层)); if (array.Length == 0) { 完成所有检测(存储单位, null); return; } List<Unit> list = new List<Unit>(); for (int i = 0; i < array.Length; i++) { Unit componentInParent = ((Component)array[i]).GetComponentInParent<Unit>(); if ((Object)(object)componentInParent == (Object)null || componentInParent.data.Dead) { continue; } bool flag = false; switch (效果施加对应) { case 施加方式.对敌方: flag = componentInParent.data.team != 队伍信息; break; case 施加方式.全部: flag = true; break; case 施加方式.对自己和对于: flag = componentInParent.data.team == 队伍信息; break; case 施加方式.仅自己: { Unit componentInParent2 = ((Component)this).GetComponentInParent<Unit>(); flag = (Object)(object)componentInParent == (Object)(object)componentInParent2; break; } } if (!flag) { continue; } list.Add(componentInParent); if (Object.op_Implicit((Object)(object)效果设置)) { UnitEffectBase val = UnitEffectBase.AddEffectToTarget(((Component)((Component)array[i]).transform).gameObject, 效果设置); if ((Object)(object)val == (Object)null) { val = Object.Instantiate<UnitEffectBase>(效果设置, ((Component)array[i]).transform); ((Component)val).transform.SetPositionAndRotation(((Component)array[i]).transform.position, Quaternion.identity); TeamHolder.AddTeamHolder(((Component)val).gameObject, ((Component)this).gameObject); val.DoEffect(); } else { val.Ping(); } 完成单次检测(val, 存储单位, componentInParent, ((Component)((Component)this).transform).gameObject); } else { 完成单次检测(null, 存储单位, componentInParent, ((Component)((Component)this).transform).gameObject); } } 完成所有检测(存储单位, list.ToArray()); } public virtual void 完成单次检测(UnitEffectBase 效果实例, Unit 召唤者, Unit 受影响者, GameObject 召唤物体) { } public virtual void 完成所有检测(Unit 召唤者, Unit[] 受影响者) { } public void 测试检测范围() { //IL_0007: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 检测半径, LayerMask.op_Implicit(检测层)); Debug.Log((object)$"检测到 {array.Length} 个碰撞体,半径 = {检测半径}"); Collider[] array2 = array; foreach (Collider val in array2) { Debug.DrawLine(((Component)this).transform.position, ((Component)val).transform.position, Color.yellow, 5f); } } private void OnDrawGizmos() { //IL_0015: 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_0037: 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) Gizmos.color = new Color(0f, 1f, 0f, 0.3f); Gizmos.DrawSphere(((Component)this).transform.position, 检测半径); Gizmos.color = Color.green; Gizmos.DrawWireSphere(((Component)this).transform.position, 检测半径); } } public class 效果事件Hesed_Mod : UnitEffectBase { public UnityEvent 执行效果事件; public UnityEvent 叠加效果事件; public override void DoEffect() { UnityEvent obj = 执行效果事件; if (obj != null) { obj.Invoke(); } } public override void Ping() { UnityEvent obj = 叠加效果事件; if (obj != null) { obj.Invoke(); } } } public static class 材质修复工具 { public static void 材质修复(GameObject 物体, float 明度 = 1.5f) { if ((Object)(object)物体 == (Object)null) { Debug.LogWarning((object)"材质修复:目标物体为 null。"); return; } Renderer[] componentsInChildren = 物体.GetComponentsInChildren<Renderer>(true); List<Material> list = new List<Material>(); foreach (Renderer val in componentsInChildren) { if (val is ParticleSystemRenderer) { continue; } Material[] sharedMaterials = val.sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { continue; } foreach (Material val2 in sharedMaterials) { if (!((Object)(object)val2 == (Object)null) && !list.Contains(val2)) { list.Add(val2); } } } for (int k = 0; k < list.Count; k++) { Material val3 = list[k]; if (IsStandardShader(val3.shader)) { Material 新材质 = CreateStandardCopy(val3, 明度); ApplyToRenderers(物体, val3, 新材质); } else { 修复普通材质(val3, 明度); } } } private static bool IsStandardShader(Shader shader) { if ((Object)(object)shader == (Object)null) { return false; } if (((Object)shader).name == "Standard") { return true; } Shader val = Shader.Find("Standard"); return (Object)(object)val != (Object)null && (Object)(object)shader == (Object)(object)val; } private static Material CreateStandardCopy(Material 旧材质, float 明度) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown Shader val = Shader.Find("Standard"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"材质修复:找不到 Standard Shader,回退到原材质。"); 修复普通材质(旧材质, 明度); return 旧材质; } Material val2 = new Material(val); ((Object)val2).name = ((Object)旧材质).name + " (Standard修复)"; val2.CopyPropertiesFromMaterial(旧材质); val2.renderQueue = 旧材质.renderQueue; val2.doubleSidedGI = 旧材质.doubleSidedGI; val2.enableInstancing = 旧材质.enableInstancing; CopyShaderKeywords(旧材质, val2); CopyTextures(旧材质, val2); 调整颜色亮度(val2, 明度); return val2; } private static void CopyShaderKeywords(Material 源, Material 目标) { string[] shaderKeywords = 源.shaderKeywords; if (shaderKeywords != null && shaderKeywords.Length != 0) { 目标.shaderKeywords = shaderKeywords; } } private static void CopyTextures(Material 源, Material 目标) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0092: Unknown result type (might be due to invalid IL or missing references) Shader shader = 源.shader; int propertyCount = shader.GetPropertyCount(); for (int i = 0; i < propertyCount; i++) { if ((int)shader.GetPropertyType(i) != 4) { continue; } string propertyName = shader.GetPropertyName(i); if (源.HasProperty(propertyName) && 目标.HasProperty(propertyName)) { Texture texture = 源.GetTexture(propertyName); if ((Object)(object)texture != (Object)null) { 目标.SetTexture(propertyName, texture); } Vector2 textureScale = 源.GetTextureScale(propertyName); Vector2 textureOffset = 源.GetTextureOffset(propertyName); 目标.SetTextureScale(propertyName, textureScale); 目标.SetTextureOffset(propertyName, textureOffset); } } } private static void 修复普通材质(Material 材质, float 明度) { if ((Object)(object)材质.shader != (Object)null) { 材质.shader = Shader.Find(((Object)材质.shader).name); } 调整颜色亮度(材质, 明度); } public static void 调整颜色亮度(Material 材质, float 明度) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) //IL_002c: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) if (材质.HasProperty("_Color")) { Color color = 材质.GetColor("_Color"); Color val = default(Color); ((Color)(ref val))..ctor(Mathf.Clamp01(color.r * 明度), Mathf.Clamp01(color.g * 明度), Mathf.Clamp01(color.b * 明度), color.a); 材质.SetColor("_Color", val); } else if (材质.HasProperty("_MainColor")) { Color color2 = 材质.GetColor("_MainColor"); Color val2 = default(Color); ((Color)(ref val2))..ctor(Mathf.Clamp01(color2.r * 明度), Mathf.Clamp01(color2.g * 明度), Mathf.Clamp01(color2.b * 明度), color2.a); 材质.SetColor("_MainColor", val2); } } private static void ApplyToRenderers(GameObject 物体, Material 旧材质, Material 新材质) { if ((Object)(object)旧材质 == (Object)(object)新材质) { return; } Renderer[] componentsInChildren = 物体.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (val is ParticleSystemRenderer) { continue; } Material[] sharedMaterials = val.sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { continue; } bool flag = false; for (int j = 0; j < sharedMaterials.Length; j++) { if ((Object)(object)sharedMaterials[j] == (Object)(object)旧材质) { sharedMaterials[j] = 新材质; flag = true; } } if (flag) { val.sharedMaterials = sharedMaterials; } } } } } namespace LaoXingChenShengRiMod.角色类.青铜石像sdajf { public class 单位击倒效果 : MonoBehaviour { [Header("组件引用")] public DataHandler 单位数据; public Balance 单位平衡系统; public Rigidbody 主刚体; [Header("击倒参数")] public float 击倒时间 = 2f; public float 击飞力度 = 5f; public float 击退力度 = 10f; private float 计时器 = 0f; private bool 已击倒 = false; private Vector3 击退方向 = Vector3.zero; private bool 是否正在等待击倒 = false; private Coroutine 延迟击倒协程 = null; private void Start() { 初始化组件(); } private void 初始化组件() { Unit component = ((Component)((Component)this).transform.root).GetComponent<Unit>(); if ((Object)(object)component != (Object)null) { 单位数据 = component.data; } if ((Object)(object)单位数据 == (Object)null) { 单位数据 = ((Component)this).GetComponent<DataHandler>(); } 单位平衡系统 = ((Component)this).GetComponent<Balance>(); if ((Object)(object)单位数据 != (Object)null) { 主刚体 = 单位数据.mainRig; } } private void Update() { if (!是否正在等待击倒 && Object.op_Implicit((Object)(object)单位数据) && !单位数据.Dead && 已击倒) { 计时器 += Time.deltaTime; if (计时器 >= 击倒时间) { 恢复站立(); } } } public void 执行击倒() { 执行击倒1(); } public void 执行击倒1(Vector3? 攻击方向 = null, float? 自定义力度 = null) { //IL_005a: 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_005f: Unknown result type (might be due to invalid IL or missing references) if (!是否正在等待击倒 && !已击倒) { if ((Object)(object)单位数据 == (Object)null || (Object)(object)主刚体 == (Object)null) { 初始化组件(); } 击退方向 = (Vector3)(((??)攻击方向) ?? Vector3.forward); float 力度 = 自定义力度 ?? 击退力度; if (延迟击倒协程 != null) { ((MonoBehaviour)this).StopCoroutine(延迟击倒协程); 延迟击倒协程 = null; } 延迟击倒协程 = ((MonoBehaviour)this).StartCoroutine(延迟执行击倒(力度)); } } private IEnumerator 延迟执行击倒(float 力度) { 是否正在等待击倒 = true; yield return null; if ((Object)(object)单位数据 == (Object)null || (Object)(object)主刚体 == (Object)null) { 初始化组件(); if ((Object)(object)单位数据 == (Object)null || (Object)(object)主刚体 == (Object)null) { Debug.LogWarning((object)"单位数据或主刚体为空,无法执行击倒"); 是否正在等待击倒 = false; 延迟击倒协程 = null; yield break; } } 执行击倒内部(力度); 是否正在等待击倒 = false; 延迟击倒协程 = null; } private void 执行击倒内部(float 力度) { //IL_0090: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)单位数据 == (Object)null) && !单位数据.Dead && !已击倒) { 单位数据.fallTime = 击倒时间; 单位数据.ragdollControl = 0f; 单位数据.muscleControl = 0f; 单位数据.cantFallForSeconds = 0.3f; 单位数据.immunityForSeconds = -1f; if ((Object)(object)主刚体 != (Object)null) { Vector3 val = Vector3.up * 击飞力度 + 击退方向 * 力度; 主刚体.AddForce(val, (ForceMode)1); } 单位数据.isGrounded = false; 单位数据.sinceGrounded = 0f; if ((Object)(object)单位平衡系统 != (Object)null) { 单位平衡系统.Fall(); } 已击倒 = true; 计时器 = 0f; Debug.Log((object)$"单位已击倒,持续 {击倒时间} 秒"); } } private void 恢复站立() { if (!((Object)(object)单位数据 == (Object)null) && !单位数据.Dead) { 单位数据.fallTime = -0.1f; 单位数据.ragdollControl = 1f; 单位数据.muscleControl = 1f; 单位数据.cantFallForSeconds = 0f; 单位数据.immunityForSeconds = 0.5f; 已击倒 = false; 计时器 = 0f; Debug.Log((object)"单位已恢复站立"); } } public void 中断击倒() { if (延迟击倒协程 != null) { ((MonoBehaviour)this).StopCoroutine(延迟击倒协程); 延迟击倒协程 = null; 是否正在等待击倒 = false; } if (已击倒) { 恢复站立(); } } public void 设置击倒时间(float f) { 击倒时间 = f; 计时器 = 0f; } public bool 是否已击倒() { return 已击倒; } public bool 是否正在等待执行() { return 是否正在等待击倒; } } public class 圆形baozha版本 : 碰撞检测获取单位基类 { public float 力度大小 = 9000f; public float 伤害 = 900f; public override void 完成单次检测(UnitEffectBase 效果实例, Unit 召唤者, Unit 受影响者, GameObject 召唤物体) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00be: Unknown result type (might be due to invalid IL or missing references) base.完成单次检测(效果实例, 召唤者, 受影响者, 召唤物体); if (!Object.op_Implicit((Object)(object)受影响者)) { return; } if ((Object)(object)召唤者 == (Object)null) { TeamHolder component = ((Component)((Component)this).transform.root).GetComponent<TeamHolder>(); if ((Object)(object)component != (Object)null) { 召唤者 = ((Component)component).GetComponent<Unit>(); } } ((Damagable)受影响者.data.healthHandler).TakeDamage(伤害, ((Component)this).transform.position, 召唤者, (DamageType)0); Rigidbody[] allRigs = 受影响者.data.allRigs.AllRigs; foreach (Rigidbody obj in allRigs) { Vector3 val = 受影响者.data.mainRig.position - ((Component)this).transform.position; obj.AddForce(((Vector3)(ref val)).normalized * 力度大小, (ForceMode)5); } } } public class 平滑跟随目标121 : MonoBehaviour { public Transform 跟随目标; public Transform 需要跟随对象; public float 跟随速度 = 5f; public float 旋转速度 = 5f; private Vector3 相对位置; private Quaternion 相对旋转; private void Start() { //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_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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) if ((Object)(object)跟随目标 == (Object)null || (Object)(object)需要跟随对象 == (Object)null) { Debug.LogError((object)"平滑跟随目标:跟随目标或需要跟随对象未赋值!"); return; } 相对位置 = 跟随目标.InverseTransformPoint(需要跟随对象.position); 相对旋转 = Quaternion.Inverse(跟随目标.rotation) * 需要跟随对象.rotation; 需要跟随对象.SetParent(((Component)this).transform.root); } private void Update() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_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_004c: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0094: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)跟随目标 == (Object)null) && !((Object)(object)需要跟随对象 == (Object)null)) { Vector3 val = 跟随目标.TransformPoint(相对位置); Quaternion val2 = 跟随目标.rotation * 相对旋转; 需要跟随对象.position = Vector3.Lerp(需要跟随对象.position, val, 跟随速度 * Time.deltaTime); 需要跟随对象.rotation = Quaternion.Slerp(需要跟随对象.rotation, val2, 旋转速度 * Time.deltaTime); } } } public class 披风脚本asd : MonoBehaviour { [Serializable] public class 记录相对位置类 { public Vector3 相对于上一个骨骼的局部位置; public Quaternion 相对于上一个骨骼的局部旋转; public float 与上一个骨骼的距离; public 记录相对位置类(Vector3 局部偏移, Quaternion 局部旋转, float 距离) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) 相对于上一个骨骼的局部位置 = 局部偏移; 相对于上一个骨骼的局部旋转 = 局部旋转; 与上一个骨骼的距离 = 距离; } } public Transform 根部披风; public List<Transform> 披风骨骼组; [Header("间隔距离设置")] public float 移动速度 = 9f; public float 旋转速度 = 9f; [Header("拉伸限制")] public float 最大拉伸距离 = 0.5f; public bool 启用拉伸限制 = true; [Header("轴向映射")] public Vector3 物体指向目标的轴 = Vector3.up; public Vector3 物体的上方向轴 = Vector3.forward; [Header("世界参考")] public Vector3 世界向上方向 = Vector3.up; public bool 物体局部指定为准 = true; public Transform 指定为替换世界空间物体; public Vector3 局部世界物体指向 = Vector3.up; public bool 以上一个物体的局部轴为例 = false; public Vector3 上一个物体局部世界物体指向 = Vector3.up; private float 第一根骨骼与根骨骼的距离; private Vector3 第一根骨骼相对于根的局部位置; private Quaternion 第一根骨骼相对于根的局部旋转; public List<记录相对位置类> 骨骼组 = new List<记录相对位置类>(); private void Start() { 初始化骨骼关系(); } private void 初始化骨骼关系() { //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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_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_0084: Unknown result type (might be due to invalid IL or missing references) 骨骼组.Clear(); for (int i = 0; i < 披风骨骼组.Count; i++) { if (i == 0) { 第一根骨骼相对于根的局部位置 = 根部披风.InverseTransformPoint(披风骨骼组[i].position); 第一根骨骼相对于根的局部旋转 = Quaternion.Inverse(根部披风.rotation) * 披风骨骼组[i].rotation; 第一根骨骼与根骨骼的距离 = Vector3.Distance(披风骨骼组[i].position, 根部披风.position); } else { Vector3 局部偏移 = 披风骨骼组[i - 1].InverseTransformPoint(披风骨骼组[i].position); Quaternion 局部旋转 = Quaternion.Inverse(披风骨骼组[i - 1].rotation) * 披风骨骼组[i].rotation; 骨骼组.Add(new 记录相对位置类(局部偏移, 局部旋转, Vector3.Distance(披风骨骼组[i].position, 披风骨骼组[i - 1].position))); } } } private void Update() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_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_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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) 处理骨骼(); if (物体局部指定为准 && !以上一个物体的局部轴为例 && (Object)(object)指定为替换世界空间物体 != (Object)null) { Vector3 val = 指定为替换世界空间物体.TransformPoint(局部世界物体指向) - 指定为替换世界空间物体.position; Vector3 normalized = ((Vector3)(ref val)).normalized; 世界向上方向 = normalized; } } private void 处理骨骼() { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_0099: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 披风骨骼组.Count; i++) { Vector3 val; if (i == 0) { 披风骨骼组[i].position = 计算最大拉伸距离(根部披风.TransformPoint(第一根骨骼相对于根的局部位置), 披风骨骼组[i].position); val = 根部披风.position - 披风骨骼组[i].position; Vector3 normalized = ((Vector3)(ref val)).normalized; 披风骨骼组[i].rotation = Quaternion.Lerp(披风骨骼组[i].rotation, 计算旋转(normalized, 世界向上方向, 物体指向目标的轴, 物体的上方向轴, 根部披风), Time.deltaTime * 旋转速度); } else { 披风骨骼组[i].position = 计算最大拉伸距离(披风骨骼组[i - 1].TransformPoint(骨骼组[i - 1].相对于上一个骨骼的局部位置), 披风骨骼组[i].position); val = 披风骨骼组[i - 1].position - 披风骨骼组[i].position; Vector3 normalized2 = ((Vector3)(ref val)).normalized; 披风骨骼组[i].rotation = Quaternion.Lerp(披风骨骼组[i].rotation, 计算旋转(normalized2, 世界向上方向, 物体指向目标的轴, 物体的上方向轴, 披风骨骼组[i - 1]), Time.deltaTime * 旋转速度); } } } private Vector3 计算最大拉伸距离(Vector3 目标位置, 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_000f: 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_0015: 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_001c: 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_0050: 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_0034: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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 val = Vector3.Lerp(当前位置, 目标位置, Time.deltaTime * 移动速度); Vector3 val2 = val - 目标位置; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude > 最大拉伸距离) { return 目标位置 + val2 / magnitude * 最大拉伸距离; } return val; } private Quaternion 计算旋转(Vector3 目标方向, Vector3 世界向上, Vector3 物体指向轴, Vector3 物体向上轴, Transform 指定世界之上) { //IL_0071: 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_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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_003e: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_0110: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_013f: 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_0141: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f3: 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_0162: Unknown result type (might be due to invalid IL or missing references) Vector3 val; Vector3 val2; if (以上一个物体的局部轴为例 && (Object)(object)指定世界之上 != (Object)null) { val = 指定世界之上.TransformPoint(上一个物体局部世界物体指向) - 指定世界之上.position; val2 = ((Vector3)(ref val)).normalized; float num = Mathf.Abs(Vector3.Dot(val2, ((Vector3)(ref 目标方向)).normalized)); if (num > 0.9999f) { val2 = 指定世界之上.right; } } else { val2 = ((Vector3)(ref 世界向上)).normalized; } 目标方向 = ((Vector3)(ref 目标方向)).normalized; 物体指向轴 = ((Vector3)(ref 物体指向轴)).normalized; 物体向上轴 = ((Vector3)(ref 物体向上轴)).normalized; float num2 = Mathf.Abs(Vector3.Dot(目标方向, val2)); Vector3 val4; if (num2 > 0.9999f) { Vector3 val3 = ((Mathf.Abs(Vector3.Dot(目标方向, Vector3.right)) < 0.9999f) ? Vector3.right : Vector3.forward); val = Vector3.Cross(val3, 目标方向); Vector3 normalized = ((Vector3)(ref val)).normalized; val = Vector3.Cross(目标方向, normalized); val4 = ((Vector3)(ref val)).normalized; } else { val = Vector3.Cross(val2, 目标方向); Vector3 normalized2 = ((Vector3)(ref val)).normalized; val = Vector3.Cross(目标方向, normalized2); val4 = ((Vector3)(ref val)).normalized; if (Vector3.Dot(val4, val2) < 0f) { val4 = -val4; } } Quaternion val5 = Quaternion.LookRotation(目标方向, val4); Quaternion val6 = Quaternion.LookRotation(物体指向轴, 物体向上轴); return val5 * Quaternion.Inverse(val6); } } public class aaa延迟间隔事件管理器 : MonoBehaviour { [Header("延迟执行设置")] public UnityEvent 延迟执行的事件; public float 延迟时间 = 2f; public bool 在启动时执行延迟事件 = false; [Header("间隔执行设置")] public UnityEvent 间隔执行的事件; public float 间隔时间 = 1f; public int 执行次数 = 5; public bool 在启动时开始间隔执行 = false; private Coroutine 当前延迟协程; private Coroutine 当前间隔协程; private void Start() { if (在启动时执行延迟事件) { 开始延迟执行(); } if (在启动时开始间隔执行) { 开始间隔执行(); } } public void 开始延迟执行() { 停止延迟执行(); 当前延迟协程 = ((MonoBehaviour)this).StartCoroutine(延迟执行协程()); } public void 开始延迟执行(float 自定义延迟时间) { 停止延迟执行(); 当前延迟协程 = ((MonoBehaviour)this).StartCoroutine(延迟执行协程(自定义延迟时间)); } private IEnumerator 延迟执行协程() { yield return (object)new WaitForSeconds(延迟时间); UnityEvent obj = 延迟执行的事件; if (obj != null) { obj.Invoke(); } 当前延迟协程 = null; } private IEnumerator 延迟执行协程(float 自定义延迟时间) { yield return (object)new WaitForSeconds(自定义延迟时间); UnityEvent obj = 延迟执行的事件; if (obj != null) { obj.Invoke(); } 当前延迟协程 = null; } public void 开始间隔执行() { 停止间隔执行(); 当前间隔协程 = ((MonoBehaviour)this).StartCoroutine(间隔执行协程()); } public void 开始间隔执行(float 自定义间隔时间, int 自定义执行次数) { 停止间隔执行(); 当前间隔协程 = ((MonoBehaviour)this).StartCoroutine(间隔执行协程(自定义间隔时间, 自定义执行次数)); } private IEnumerator 间隔执行协程() { for (int 当前次数 = 0; 当前次数 < 执行次数; 当前次数++) { yield return (object)new WaitForSeconds(间隔时间); UnityEvent obj = 间隔执行的事件; if (obj != null) { obj.Invoke(); } } 当前间隔协程 = null; } private IEnumerator 间隔执行协程(float 自定义间隔时间, int 自定义执行次数) { for (int 当前次数 = 0; 当前次数 < 自定义执行次数; 当前次数++) { yield return (object)new WaitForSeconds(自定义间隔时间); UnityEvent obj = 间隔执行的事件; if (obj != null) { obj.Invoke(); } } 当前间隔协程 = null; } public void 停止延迟执行() { if (当前延迟协程 != null) { ((MonoBehaviour)this).StopCoroutine(当前延迟协程); 当前延迟协程 = null; } } public void 停止间隔执行() { if (当前间隔协程 != null) { ((MonoBehaviour)this).StopCoroutine(当前间隔协程); 当前间隔协程 = null; } } public void 停止所有执行() { ((MonoBehaviour)this).StopAllCoroutines(); 当前延迟协程 = null; 当前间隔协程 = null; } public void 开始所有执行() { 开始延迟执行(); 开始间隔执行(); } } public class 辅助事件触发器 : MonoBehaviour { public bool 是否启用 = true; public UnityEvent 启用事件; public void 启动事件() { if (是否启用) { UnityEvent obj = 启用事件; if (obj != null) { obj.Invoke(); } } } public void 设置启用(bool d = false) { 是否启用 = d; } } public class 旋转动画器dsfgf : MonoBehaviour { [Header("旋转参数")] public Vector3 旋转轴 = new Vector3(0f, 1f, 0f); public float 旋转速度 = 90f; [Header("旋转模式")] public bool 本地坐标轴 = true; public bool 自动旋转 = true; public bool 反转方向 = false; [Header("随机起始位置")] public bool 随机起始角度 = false; private float 当前速度; private void Start() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_006e: Unknown result type (might be due to invalid IL or missing references) 当前速度 = (反转方向 ? (0f - 旋转速度) : 旋转速度); if (随机起始角度) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Random.Range(0f, 360f), Random.Range(0f, 360f), Random.Range(0f, 360f)); if (本地坐标轴) { ((Component)this).transform.localRotation = Quaternion.Euler(val); } else { ((Component)this).transform.rotation = Quaternion.Euler(val); } } } private void Update() { if (自动旋转) { 执行旋转(); } } public void 执行旋转() { //IL_0047: 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_0025: 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) float num = 当前速度 * Time.deltaTime; if (本地坐标轴) { ((Component)this).transform.Rotate(((Vector3)(ref 旋转轴)).normalized * num, (Space)1); } else { ((Component)this).transform.Rotate(((Vector3)(ref 旋转轴)).normalized * num, (Space)0); } } public void 开始旋转() { 自动旋转 = true; } public void 停止旋转() { 自动旋转 = false; } public void 设置旋转速度(float 速度) { 旋转速度 = Mathf.Abs(速度); 当前速度 = (反转方向 ? (0f - 旋转速度) : 旋转速度); } public void 设置旋转方向(bool 反转) { 反转方向 = 反转; 当前速度 = (反转方向 ? (0f - 旋转速度) : 旋转速度); } public void 设置旋转轴(Vector3 新旋转轴) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) 旋转轴 = ((Vector3)(ref 新旋转轴)).normalized; } public void 添加临时旋转(float 角度) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) float num = 角度 * Time.deltaTime; ((Component)this).transform.Rotate(((Vector3)(ref 旋转轴)).normalized * num, (Space)(本地坐标轴 ? 1 : 0)); } public void 重置旋转() { //IL_0024: 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) if (本地坐标轴) { ((Component)this).transform.localRotation = Quaternion.identity; } else { ((Component)this).transform.rotation = Quaternion.identity; } } public void 设置目标旋转角度(Vector3 角度) { //IL_0020: 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) if (本地坐标轴) { ((Component)this).transform.localEulerAngles = 角度; } else { ((Component)this).transform.eulerAngles = 角度; } } } public class 激光攻击脚本 : MonoBehaviour { [Header("激光组件")] public LineRenderer 激光线渲染器; public Transform 激光起点; public Transform 激光终点; [Header("射线参数")] public LayerMask 射线检测层 = LayerMask.op_Implicit(-1); public float 最大延伸距离 = 100f; public int 最大穿透个数 = 5; [Header("特效参数")] public float 实例化爆炸特效间隔 = 0.2f; public GameObject 特效预制体; private Coroutine 激光协程; private List<Vector3> 命中点列表 = new List<Vector3>(); private bool 是否正在攻击 = false; private Team 队伍标识 = (Team)0; public bool 无友伤 = true; private void Start() { //IL_0019: 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) 关闭激光(); 队伍标识 = ((Component)((Component)this).transform.root).GetComponent<Unit>().Team; } public void 启动激光() { if (!是否正在攻击) { 是否正在攻击 = true; ((Renderer)激光线渲染器).enabled = true; if (激光协程 != null) { ((MonoBehaviour)this).StopCoroutine(激光协程); } 激光协程 = ((MonoBehaviour)this).StartCoroutine(持续发射激光()); } } public void 关闭激光() { 是否正在攻击 = false; if (激光协程 != null) { ((MonoBehaviour)this).StopCoroutine(激光协程); 激光协程 = null; } ((Renderer)激光线渲染器).enabled = false; 命中点列表.Clear(); } private IEnumerator 持续发射激光() { float 上次生成特效时间 = 0f; while (是否正在攻击) { List<Vector3> 当前命中点 = 执行穿透射线检测(); if (当前命中点.Count > 0) { Vector3 终点位置 = 当前命中点[当前命中点.Count - 1]; 激光终点.position = 终点位置; } else { Vector3 终点位置2 = 激光起点.position + 激光起点.forward * 最大延伸距离; 激光终点.position = 终点位置2; } 激光线渲染器.SetPosition(0, 激光起点.position); 激光线渲染器.SetPosition(1, 激光终点.position); if (当前命中点.Count > 0 && Time.time - 上次生成特效时间 >= 实例化爆炸特效间隔) { foreach (Vector3 命中点 in 当前命中点) { if ((Object)(object)特效预制体 != (Object)null) { TeamHolder.AddTeamHolder(Object.Instantiate<GameObject>(特效预制体, 命中点, Quaternion.identity), ((Component)this).gameObject); } } 上次生成特效时间 = Time.time; } 命中点列表 = 当前命中点; yield return null; } } private List<Vector3> 执行穿透射线检测() { //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_0019: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); Vector3 position = 激光起点.position; Vector3 forward = 激光起点.forward; RaycastHit[] array = Physics.RaycastAll(position, forward, 最大延伸距离, LayerMask.op_Implicit(射线检测层)); Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); List<RaycastHit> list2 = new List<RaycastHit>(); if (无友伤) { for (int num = 0; num < array.Length; num++) { RaycastHit item = array[num]; Unit component = ((Component)((Component)((RaycastHit)(ref item)).collider).transform.root).GetComponent<Unit>(); if ((Object)(object)component != (Object)null) { if (component.Team != 队伍标识) { list2.Add(item); } } else { list2.Add(item); } } } else { list2.AddRange(array); } int num2 = Mathf.Min(list2.Count, 最大穿透个数); for (int num3 = 0; num3 < num2; num3++) { RaycastHit val = list2[num3]; list.Add(((RaycastHit)(ref val)).point); } return list; } public List<GameObject> 获取当前命中物体() { //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_0019: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) List<GameObject> list = new List<GameObject>(); Vector3 position = 激光起点.position; Vector3 forward = 激光起点.forward; RaycastHit[] array = Physics.RaycastAll(position, forward, 最大延伸距离, LayerMask.op_Implicit(射线检测层)); Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); List<RaycastHit> list2 = new List<RaycastHit>(); if (无友伤) { for (int num = 0; num < array.Length; num++) { RaycastHit item = array[num]; Unit component = ((Component)((Component)((RaycastHit)(ref item)).collider).transform.root).GetComponent<Unit>(); if ((Object)(object)component != (Object)null) { if (component.Team != 队伍标识) { list2.Add(item); } } else { list2.Add(item); } } } else { list2.AddRange(array); } int num2 = Mathf.Min(list2.Count, 最大穿透个数); for (int num3 = 0; num3 < num2; num3++) { RaycastHit val = list2[num3]; list.Add(((Component)((RaycastHit)(ref val)).collider).gameObject); } return list; } private void OnDrawGizmosSelected() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)激光起点 == (Object)null) { return; } Gizmos.color = Color.yellow; Vector3 val = 激光起点.position + 激光起点.forward * 最大延伸距离; Gizmos.DrawLine(激光起点.position, val); Gizmos.color = Color.red; foreach (Vector3 item in 命中点列表) { Gizmos.DrawSphere(item, 0.1f); } } } public class 天地环砸击 : MonoBehaviour { private class 环状态缓存 { public Transform 父级; public Vector3 局部位置; public Quaternion 局部旋转; public Vector3 局部缩放; } public Transform 天环; public Transform 地环; public Transform 人环; public Transform 天环旋转参考; public Transform 地环旋转参考; public Transform 人环旋转参考; public float 缩放倍率 = 3f; public float 坠落速度 = 20f; public float 移动速度 = 5f; public float 上升高度 = 15f; public float 恢复速度 = 1f; public GameObject 特效预制体; public bool 恢复位置 = false; public float 缩放回去速度 = 3f; private DataHandler 此单位数据; private Dictionary<Transform, Coroutine> 运行中的协程 = new Dictionary<Transform, Coroutine>(); private Dictionary<Transform, 环状态缓存> 环状态字典 = new Dictionary<Transform, 环状态缓存>(); private void Start() { 此单位数据 = ((Component)((Component)this).transform.root).GetComponent<Unit>().data; 缓存环状态(天环); 缓存环状态(地环); 缓存环状态(人环); } private void 缓存环状态(Transform 环) { //IL_0021: 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_002d: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)环 == (Object)null)) { 环状态缓存 value = new 环状态缓存 { 父级 = 环.parent, 局部位置 = 环.localPosition, 局部旋转 = 环.localRotation, 局部缩放 = 环.localScale }; 环状态字典[环] = value; } } public void 释放天环() { if ((Object)(object)天环 != (Object)null && (Object)(object)天环旋转参考 != (Object)null) { 启动环技能(天环, 天环旋转参考); } } public void 释放地环() { if ((Object)(object)地环 != (Object)null && (Object)(object)地环旋转参考 != (Object)null) { 启动环技能(地环, 地环旋转参考); } } public void 释放人环() { if ((Object)(object)人环 != (Object)null && (Object)(object)人环旋转参考 != (Object)null) { 启动环技能(人环, 人环旋转参考); } } public void 修改特效(GameObject fd) { 特效预制体 = fd; } private void 启动环技能(Transform 环, Transform 旋转参考) { if (运行中的协程.ContainsKey(环) && 运行中的协程[环] != null) { ((MonoBehaviour)this).StopCoroutine(运行中的协程[环]); 恢复环状态立即(环); } Coroutine value = ((MonoBehaviour)this).StartCoroutine(环技能携程(环, 旋转参考)); 运行中的协程[环] = value; } private void 恢复环状态立即(Transform 环) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (环状态字典.ContainsKey(环)) { 环状态缓存 环状态缓存 = 环状态字典[环]; 环.SetParent(环状态缓存.父级); 环.localPosition = 环状态缓存.局部位置; 环.localRotation = 环状态缓存.局部旋转; 环.localScale = 环状态缓存.局部缩放; } } private IEnumerator 恢复环状态平滑(Transform 环) { if (环状态字典.ContainsKey(环)) { 环状态缓存 状态 = 环状态字典[环]; Transform 目标父级 = 状态.父级; 环.SetParent(目标父级); Vector3 起始位置 = 环.localPosition; Quaternion 起始旋转 = 环.localRotation; Vector3 起始缩放 = 环.localScale; Vector3 目标位置 = 状态.局部位置; Quaternion 目标旋转 = 状态.局部旋转; Vector3 目标缩放 = 状态.局部缩放; float 当前时间 = 0f; float 总时间 = 1f / 恢复速度; while (当前时间 < 总时间) { 当前时间 += Time.deltaTime; float 进度 = 当前时间 / 总时间; 进度 = Mathf.SmoothStep(0f, 1f, 进度); 环.localPosition = Vector3.Lerp(起始位置, 目标位置, 进度); 环.localRotation = Quaternion.Slerp(起始旋转, 目标旋转, 进度); 环.localScale = Vector3.Lerp(起始缩放, 目标缩放, 进度); yield return null; } 环.localPosition = 状态.局部位置; 环.localRotation = 状态.局部旋转; 环.localScale = 状态.局部缩放; } } private IEnumerator 零缩放携程(Transform 环) { Vector3 起始缩放 = 环.localScale; Vector3 目标缩放 = Vector3.zero; float 当前时间 = 0f; float 总时间 = 1f / 缩放回去速度; while (当前时间 < 总时间) { 当前时间 += Time.deltaTime; float 进度 = 当前时间 / 总时间; 进度 = Mathf.SmoothStep(0f, 1f, 进度); 环.localScale = Vector3.Lerp(起始缩放, 目标缩放, 进度); yield return null; } 环.localScale = 目标缩放; } private unsafe IEnumerator 环技能携程(Transform 环, Transform 旋转参考) { _ = 环状态字典[环]; 环.SetParent(环.root); _ = 环.position; _ = 环.rotation; _ = 环.localScale; Vector3 目标位置 = 此单位数据.targetData.mainRig.position; Vector3 世界起始位置 = 环.position; Quaternion 世界起始旋转 = 环.rotation; Vector3 世界起始缩放 = 环.localScale; Vector3 上升目标位置 = 目标位置 + Vector3.up * 上升高度; yield return ((MonoBehaviour)this).StartCoroutine(移动旋转缩放协程(环, 上升目标位置, 旋转参考.rotation, 世界起始位置, 世界起始旋转, 世界起始缩放)); Ray 射线 = new Ray(目标位置 + Vector3.up * 50f, Vector3.down); RaycastHit 击中信息 = default(RaycastHit); Vector3 坠落目标点; if (Physics.Raycast(射线, ref 击中信息, 100f, 512)) { 坠落目标点 = ((RaycastHit)(ref 击中信息)).point; Vector3 val = 坠落目标点; Debug.Log((object)("检测到地面,击中点: " + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString())); } else { 坠落目标点 = 目标位置; Vector3 val = 坠落目标点; Debug.Log((object)("未检测到地面,使用目标位置: " + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString())); } yield return ((MonoBehaviour)this).StartCoroutine(坠落协程(环, 坠落目标点)); if ((Object)(object)特效预制体 != (Object)null) { GameObject 特效 = Object.Instantiate<GameObject>(特效预制体, 坠落目标点, Quaternion.identity); TeamHolder.AddTeamHolder(特效, ((Component)this).gameObject); } if (恢复位置) { yield return ((MonoBehaviour)this).StartCoroutine(恢复环状态平滑(环)); } else { yield return ((MonoBehaviour)this).StartCoroutine(零缩放携程(环)); } if (运行中的协程.ContainsKey(环)) { 运行中的协程.Remove(环); } } private IEnumerator 移动旋转缩放协程(Transform 环, Vector3 目标位置, Quaternion 目标旋转, Vector3 起始位置, Quaternion 起始旋转, Vector3 起始缩放) { //IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown r