Decompiled source of SilkGoddess v1.0.4
SilkGoddess/SilkGoddess.dll
Decompiled 2 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.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using HutongGames.PlayMaker; using HutongGames.PlayMaker.Actions; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using SilkGoddess.Behaviours; using SilkGoddess.Patches; using Silksong.FsmUtil.Actions; using TeamCherry.Localization; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.ResourceManagement.ResourceProviders; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SilkGoddess")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+e320c7be0dd0b7fc0d5645173c0259d2636c198f")] [assembly: AssemblyProduct("SilkGoddess")] [assembly: AssemblyTitle("SilkGoddess")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Silksong.FsmUtil.Actions { public class DelegateAction<TArg> : FsmStateAction { public Action<TArg>? Method; public TArg? Arg; public override void Reset() { Method = null; ((FsmStateAction)this).Reset(); } public override void OnEnter() { if (Method != null && Arg != null) { Method(Arg); } if (!((object)Arg is Action action) || action != new Action(base.Finish)) { ((FsmStateAction)this).Finish(); } } } } namespace SilkGoddess { internal static class AssetManager { [CompilerGenerated] private sealed class <>c__DisplayClass6_0 { public string prefabName; internal bool <LoadScenePrefabs>b__0(Transform obj) { return ((Object)obj).name == prefabName; } } [CompilerGenerated] private sealed class <Init>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Init>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = LoadScenePrefabs(); <>1__state = 1; return true; case 1: <>1__state = -1; 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(); } } [CompilerGenerated] private sealed class <LoadBundleAssets>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private string <platformFolder>5__1; private string <bundlesPath>5__2; private RuntimePlatform <>s__3; private Dictionary<string, string[]>.Enumerator <>s__4; private string <bundleName>5__5; private string[] <assetNames>5__6; private bool <bundleAlreadyLoaded>5__7; private string <bundlePath>5__8; private AssetBundleCreateRequest <bundleLoadRequest>5__9; private AssetBundle <bundle>5__10; private IEnumerator<AssetBundle> <>s__11; private AssetBundle <loadedBundle>5__12; private string[] <>s__13; private int <>s__14; private string <assetPath>5__15; private string[] <>s__16; private int <>s__17; private string <assetName>5__18; private AssetBundleRequest <loadAssetRequest>5__19; private Object <loadedAsset>5__20; private string[] <>s__21; private int <>s__22; private string <assetPath>5__23; private string[] <>s__24; private int <>s__25; private string <assetName>5__26; private AssetBundleRequest <assetLoadRequest>5__27; private Object <loadedAsset>5__28; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadBundleAssets>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if ((uint)(num - -4) <= 1u || (uint)(num - 1) <= 2u) { try { if (num == -4 || num == 1) { try { } finally { <>m__Finally2(); } } } finally { <>m__Finally1(); } } <platformFolder>5__1 = null; <bundlesPath>5__2 = null; <>s__4 = default(Dictionary<string, string[]>.Enumerator); <bundleName>5__5 = null; <assetNames>5__6 = null; <bundlePath>5__8 = null; <bundleLoadRequest>5__9 = null; <bundle>5__10 = null; <>s__11 = null; <loadedBundle>5__12 = null; <>s__13 = null; <assetPath>5__15 = null; <>s__16 = null; <assetName>5__18 = null; <loadAssetRequest>5__19 = null; <loadedAsset>5__20 = null; <>s__21 = null; <assetPath>5__23 = null; <>s__24 = null; <assetName>5__26 = null; <assetLoadRequest>5__27 = null; <loadedAsset>5__28 = null; <>1__state = -2; } private bool MoveNext() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0054: 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_0057: Invalid comparison between Unknown and I4 //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Invalid comparison between Unknown and I4 try { string key; switch (<>1__state) { default: return false; case 0: { <>1__state = -1; <>s__3 = Application.platform; if (1 == 0) { } RuntimePlatform val = <>s__3; key = (((int)val == 1) ? "StandaloneOSX" : (((int)val == 2) ? "StandaloneWindows64" : (((int)val != 13) ? "" : "StandaloneLinux64"))); if (1 == 0) { } <platformFolder>5__1 = key; <bundlesPath>5__2 = Path.Combine(Addressables.RuntimePath, <platformFolder>5__1); <>s__4 = BundleAssets.GetEnumerator(); <>1__state = -3; goto IL_04bf; } case 1: <>1__state = -4; <loadedAsset>5__20 = <loadAssetRequest>5__19.asset; AssetManager.TryAdd<Object>(<loadedAsset>5__20); Debug.Log((object)<loadedAsset>5__20.name); goto IL_023c; case 2: <>1__state = -3; <bundle>5__10 = <bundleLoadRequest>5__9.assetBundle; _manuallyLoadedBundles.Add(<bundle>5__10); <>s__21 = <bundle>5__10.GetAllAssetNames(); <>s__22 = 0; goto IL_0481; case 3: { <>1__state = -3; <loadedAsset>5__28 = <assetLoadRequest>5__27.asset; AssetManager.TryAdd<Object>(<loadedAsset>5__28); <assetLoadRequest>5__27 = null; <loadedAsset>5__28 = null; goto IL_043b; } IL_0481: if (<>s__22 < <>s__21.Length) { <assetPath>5__23 = <>s__21[<>s__22]; <>s__24 = <assetNames>5__6; <>s__25 = 0; goto IL_0451; } <>s__21 = null; <bundlePath>5__8 = null; <bundleLoadRequest>5__9 = null; <bundle>5__10 = null; <bundleName>5__5 = null; <assetNames>5__6 = null; goto IL_04bf; IL_023c: <>s__16 = null; if (<bundleAlreadyLoaded>5__7) { goto IL_027b; } <assetPath>5__15 = null; <>s__14++; goto IL_0268; IL_027b: <>s__13 = null; if (<bundleAlreadyLoaded>5__7) { goto IL_02a9; } <loadedBundle>5__12 = null; goto IL_0299; IL_0451: if (<>s__25 < <>s__24.Length) { <assetName>5__26 = <>s__24[<>s__25]; if (<assetPath>5__23.GetAssetRoot() == <assetName>5__26) { <assetLoadRequest>5__27 = <bundle>5__10.LoadAssetAsync(<assetPath>5__23); <>2__current = <assetLoadRequest>5__27; <>1__state = 3; return true; } goto IL_043b; } <>s__24 = null; <assetPath>5__23 = null; <>s__22++; goto IL_0481; IL_0268: if (<>s__14 < <>s__13.Length) { <assetPath>5__15 = <>s__13[<>s__14]; <>s__16 = <assetNames>5__6; for (<>s__17 = 0; <>s__17 < <>s__16.Length; <>s__17++) { <assetName>5__18 = <>s__16[<>s__17]; if (<assetPath>5__15.GetAssetRoot() == <assetName>5__18) { <bundleAlreadyLoaded>5__7 = true; <loadAssetRequest>5__19 = <loadedBundle>5__12.LoadAssetAsync(<assetPath>5__15); <>2__current = <loadAssetRequest>5__19; <>1__state = 1; return true; } <assetName>5__18 = null; } goto IL_023c; } goto IL_027b; IL_0299: if (<>s__11.MoveNext()) { <loadedBundle>5__12 = <>s__11.Current; <>s__13 = <loadedBundle>5__12.GetAllAssetNames(); <>s__14 = 0; goto IL_0268; } goto IL_02a9; IL_043b: <assetName>5__26 = null; <>s__25++; goto IL_0451; IL_02a9: <>m__Finally2(); <>s__11 = null; if (<bundleAlreadyLoaded>5__7) { Debug.Log((object)("Bundle " + <bundleName>5__5 + " already loaded!")); goto IL_04bf; } <bundlePath>5__8 = Path.Combine(<bundlesPath>5__2, <bundleName>5__5 + ".bundle"); <bundleLoadRequest>5__9 = AssetBundle.LoadFromFileAsync(<bundlePath>5__8); <>2__current = <bundleLoadRequest>5__9; <>1__state = 2; return true; IL_04bf: if (<>s__4.MoveNext()) { <>s__4.Current.Deconstruct(out key, out string[] value); <bundleName>5__5 = key; <assetNames>5__6 = value; <bundleAlreadyLoaded>5__7 = false; <>s__11 = AssetBundle.GetAllLoadedAssetBundles().GetEnumerator(); <>1__state = -4; goto IL_0299; } <>m__Finally1(); <>s__4 = default(Dictionary<string, string[]>.Enumerator); return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__4).Dispose(); } private void <>m__Finally2() { <>1__state = -3; if (<>s__11 != null) { <>s__11.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadScenePrefabs>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private Dictionary<string, string[]>.Enumerator <>s__1; private string <sceneName>5__2; private string[] <prefabNames>5__3; private string <loadScenePath>5__4; private AsyncOperationHandle<SceneInstance> <loadSceneHandle>5__5; private AsyncOperationHandle<SceneInstance> <unloadSceneHandle>5__6; private SceneInstance <sceneInstance>5__7; private Scene <scene>5__8; private GameObject[] <>s__9; private int <>s__10; private GameObject <rootObj>5__11; private string[] <>s__12; private int <>s__13; private <>c__DisplayClass6_0 <>8__14; private GameObject <prefab>5__15; private GameObject <prefabCopy>5__16; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadScenePrefabs>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { //IL_0049: 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_0061: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 1u) { try { } finally { <>m__Finally1(); } } <>s__1 = default(Dictionary<string, string[]>.Enumerator); <sceneName>5__2 = null; <prefabNames>5__3 = null; <loadScenePath>5__4 = null; <loadSceneHandle>5__5 = default(AsyncOperationHandle<SceneInstance>); <unloadSceneHandle>5__6 = default(AsyncOperationHandle<SceneInstance>); <sceneInstance>5__7 = default(SceneInstance); <>s__9 = null; <rootObj>5__11 = null; <>s__12 = null; <>8__14 = null; <prefab>5__15 = null; <prefabCopy>5__16 = null; <>1__state = -2; } private bool MoveNext() { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Invalid comparison between Unknown and I4 //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: 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_00fa: 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_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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; AudioManager.BlockAudioChange = true; <>s__1 = ScenePrefabs.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; if ((int)<loadSceneHandle>5__5.Status == 1) { <sceneInstance>5__7 = <loadSceneHandle>5__5.Result; <scene>5__8 = ((SceneInstance)(ref <sceneInstance>5__7)).Scene; <>s__9 = ((Scene)(ref <scene>5__8)).GetRootGameObjects(); for (<>s__10 = 0; <>s__10 < <>s__9.Length; <>s__10++) { <rootObj>5__11 = <>s__9[<>s__10]; <>s__12 = <prefabNames>5__3; for (<>s__13 = 0; <>s__13 < <>s__12.Length; <>s__13++) { <>8__14 = new <>c__DisplayClass6_0(); <>8__14.prefabName = <>s__12[<>s__13]; Transform? obj2 = ((IEnumerable<Transform>)<rootObj>5__11.GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform obj) => ((Object)obj).name == <>8__14.prefabName)); <prefab>5__15 = ((obj2 != null) ? ((Component)obj2).gameObject : null); if (Object.op_Implicit((Object)(object)<prefab>5__15)) { <prefab>5__15.SetActive(false); <prefabCopy>5__16 = Object.Instantiate<GameObject>(<prefab>5__15); ((Object)<prefabCopy>5__16).name = <>8__14.prefabName; Object.DontDestroyOnLoad((Object)(object)<prefabCopy>5__16); AssetManager.TryAdd<GameObject>(<prefabCopy>5__16); <prefabCopy>5__16 = null; } <prefab>5__15 = null; <>8__14 = null; } <>s__12 = null; <rootObj>5__11 = null; } <>s__9 = null; <sceneInstance>5__7 = default(SceneInstance); } else { Debug.Log((object)<loadSceneHandle>5__5.OperationException); } <unloadSceneHandle>5__6 = Addressables.UnloadSceneAsync(<loadSceneHandle>5__5, true); <>2__current = <unloadSceneHandle>5__6; <>1__state = 2; return true; case 2: <>1__state = -3; <loadScenePath>5__4 = null; <loadSceneHandle>5__5 = default(AsyncOperationHandle<SceneInstance>); <unloadSceneHandle>5__6 = default(AsyncOperationHandle<SceneInstance>); <sceneName>5__2 = null; <prefabNames>5__3 = null; break; } if (<>s__1.MoveNext()) { <>s__1.Current.Deconstruct(out string key, out string[] value); <sceneName>5__2 = key; <prefabNames>5__3 = value; <loadScenePath>5__4 = "Scenes/" + <sceneName>5__2; <loadSceneHandle>5__5 = Addressables.LoadSceneAsync((object)<loadScenePath>5__4, (LoadSceneMode)1, true, 100, (SceneReleaseMode)0); <>2__current = <loadSceneHandle>5__5; <>1__state = 1; return true; } <>m__Finally1(); <>s__1 = default(Dictionary<string, string[]>.Enumerator); AudioManager.BlockAudioChange = false; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__1).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly Dictionary<string, string[]> ScenePrefabs = new Dictionary<string, string[]> { ["Song_25"] = new string[1] { "Song Reed Grand SK" }, ["Dust_Maze_01"] = new string[1] { "Wraith" }, ["Song_Tower_01"] = new string[1] { "Cross Slash" } }; private static readonly Dictionary<string, string[]> BundleAssets = new Dictionary<string, string[]> { ["tk2danimations_assets_areadustmaze"] = new string[1] { "Wraith Anim" }, ["tk2dcollections_assets_areadustmaze"] = new string[1] { "Wraith Cln" }, ["animations_assets_areahangareasong"] = new string[2] { "spell_sphere", "focus_blast_grand_reed" } }; private static List<AssetBundle> _manuallyLoadedBundles = new List<AssetBundle>(); private static readonly Dictionary<Type, Dictionary<string, Object>> Assets = new Dictionary<Type, Dictionary<string, Object>>(); internal static string GetAssetRoot(this string assetPath) { return assetPath.Split("/").Last().Replace(".asset", "") .Replace(".prefab", "") .Replace(".wav", "") .Replace(".controller", ""); } [IteratorStateMachine(typeof(<Init>d__5))] internal static IEnumerator Init() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Init>d__5(0); } [IteratorStateMachine(typeof(<LoadScenePrefabs>d__6))] private static IEnumerator LoadScenePrefabs() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadScenePrefabs>d__6(0); } [IteratorStateMachine(typeof(<LoadBundleAssets>d__7))] internal static IEnumerator LoadBundleAssets() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadBundleAssets>d__7(0); } private static bool Has(string assetName) { foreach (var (_, dictionary2) in Assets) { foreach (var (text2, val2) in dictionary2) { if (assetName == text2 && Object.op_Implicit(val2)) { return true; } } } return false; } private static void TryAdd<T>(T asset) where T : Object { string name = ((Object)asset).name; if (Has(name)) { Debug.Log((object)("Asset \"" + name + "\" has already been loaded!")); return; } Type type = ((object)asset).GetType(); if (Assets.ContainsKey(type)) { Dictionary<string, Object> dictionary = Assets[type]; if (dictionary != null) { if (dictionary.ContainsKey(name)) { Object val = dictionary[name]; if (val != (Object)null) { Debug.Log((object)$"There is already an asset \"{name}\" of type \"{type}\"!"); return; } Debug.Log((object)$"Key \"{name}\" for sub-dictionary of type \"{type}\" exists, but its value is null; Replacing with new asset..."); Assets[type][name] = (Object)(object)asset; } else { Debug.Log((object)$"Adding asset \"{name}\" of type \"{type}\"."); Assets[type].Add(name, (Object)(object)asset); } } else { Debug.Log((object)$"Failed to get sub-dictionary of type \"{type}\"!"); Assets.Add(type, new Dictionary<string, Object>()); } } else { Assets.Add(type, new Dictionary<string, Object> { [name] = (Object)(object)asset }); Debug.Log((object)$"Added new sub-dictionary of type \"{type}\" with initial asset \"{name}\"."); } } internal static void UnloadAll() { foreach (Dictionary<string, Object> value in Assets.Values) { foreach (Object value2 in value.Values) { Object.DestroyImmediate(value2); } } Assets.Clear(); GC.Collect(); } internal static void UnloadManualBundles() { foreach (AssetBundle manuallyLoadedBundle in _manuallyLoadedBundles) { string bundleName = ((Object)manuallyLoadedBundle).name; AssetBundleUnloadOperation val = manuallyLoadedBundle.UnloadAsync(true); ((AsyncOperation)val).completed += delegate { Debug.Log((object)("Successfully unloaded bundle \"" + bundleName + "\"")); }; } _manuallyLoadedBundles.Clear(); foreach (KeyValuePair<string, Object> item in Assets[typeof(GameObject)]) { item.Deconstruct(out var _, out var value); Object val2 = value; GameObject val3 = (GameObject)(object)((val2 is GameObject) ? val2 : null); if (val3 != null && val3.activeSelf) { Debug.Log((object)("Recycling all instances of prefab \"" + ((Object)val3).name + "\"")); ObjectPoolExtensions.RecycleAll(val3); } } } internal static T? Get<T>(string assetName) where T : Object { Type typeFromHandle = typeof(T); if (Assets.ContainsKey(typeFromHandle)) { Dictionary<string, Object> dictionary = Assets[typeFromHandle]; if (dictionary != null) { if (dictionary.ContainsKey(assetName)) { Object val = dictionary[assetName]; if (val != (Object)null) { return (T)(object)((val is T) ? val : null); } Debug.Log((object)("Failed to get asset \"" + assetName + "\"; asset is null!")); return default(T); } Debug.Log((object)$"Sub-dictionary for type \"{typeFromHandle}\" does not contain key \"{assetName}\"!"); return default(T); } Debug.Log((object)$"Failed to get asset \"{assetName}\"; sub-dictionary of key \"{typeFromHandle}\" is null!"); return default(T); } Debug.Log((object)$"Could not find a sub-dictionary of type \"{typeFromHandle}\"!"); return default(T); } } internal static class ActionUtils { public static void ClearActionsAfter(this FsmState source, int index) { FsmStateAction[] array = source.Actions; if (index < 0 || index >= array.Length) { throw new ArgumentOutOfRangeException("index", "Index is out of range of the actions array."); } Array.Resize(ref array, index + 1); source.Actions = array; } public static void CloneActionsAndTransitions(FsmState source, FsmState target) { FsmStateAction[] actions = source.Actions; FsmTransition[] transitions = source.Transitions; target.Actions = (FsmStateAction[])(object)new FsmStateAction[actions.Length]; target.Transitions = (FsmTransition[])(object)new FsmTransition[transitions.Length]; for (int i = 0; i < actions.Length; i++) { FsmStateAction originalActions = actions[i]; target.Actions[i] = CloneAction(originalActions); } for (int j = 0; j < transitions.Length; j++) { FsmTransition originaltransitions = transitions[j]; target.Transitions[j] = CloneTransition(originaltransitions); } } internal static FsmStateAction CloneAction(FsmStateAction originalActions) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown Type type = ((object)originalActions).GetType(); FsmStateAction val = (FsmStateAction)Activator.CreateInstance(type); FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(val, fieldInfo.GetValue(originalActions)); } return val; } private static FsmTransition CloneTransition(FsmTransition originaltransitions) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown Type type = ((object)originaltransitions).GetType(); FsmTransition val = (FsmTransition)Activator.CreateInstance(type); FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(val, fieldInfo.GetValue(originaltransitions)); } return val; } internal static FsmStateAction RandomFloatAdder(FsmFloat target, float min, float max) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown return (FsmStateAction)new FloatAddRandom { floatVariable = target, addMin = FsmFloat.op_Implicit(min), addMax = FsmFloat.op_Implicit(max) }; } internal static FsmStateAction RandomFloatSetter(FsmFloat target, float min, float max) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown return (FsmStateAction)new RandomFloat { min = FsmFloat.op_Implicit(min), max = FsmFloat.op_Implicit(max), storeResult = target }; } internal static FsmStateAction FloatAdder(FsmFloat target, float value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_001a: Expected O, but got Unknown return (FsmStateAction)new FloatAdd { floatVariable = target, add = FsmFloat.op_Implicit(value) }; } internal static FsmStateAction FloatSetter(FsmFloat target, FsmFloat value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown return (FsmStateAction)new SetFloatValue { floatVariable = target, floatValue = value, everyFrame = false }; } internal static FsmStateAction BoolSetter(FsmBool target, bool value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown return (FsmStateAction)new SetBoolValue { boolVariable = target, boolValue = FsmBool.op_Implicit(value), everyFrame = false }; } internal static FsmStateAction BoolSender(GameObject target, string name, FsmBool value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000c: 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_0026: Expected O, but got Unknown //IL_0026: 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_0042: 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_0051: Expected O, but got Unknown return (FsmStateAction)new SetFsmBool { gameObject = new FsmOwnerDefault { OwnerOption = (OwnerDefaultOption)1, GameObject = FsmGameObject.op_Implicit(target) }, fsmName = FsmString.op_Implicit("Control"), variableName = FsmString.op_Implicit(name), setValue = value, everyFrame = false }; } internal static FsmStateAction FloatSender(GameObject target, string name, FsmFloat num) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000c: 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_0026: Expected O, but got Unknown //IL_0026: 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_0042: 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_0051: Expected O, but got Unknown return (FsmStateAction)new SetFsmFloat { gameObject = new FsmOwnerDefault { OwnerOption = (OwnerDefaultOption)1, GameObject = FsmGameObject.op_Implicit(target) }, fsmName = FsmString.op_Implicit("Control"), variableName = FsmString.op_Implicit(name), setValue = num, everyFrame = false }; } internal static FsmStateAction EventSender(FsmGameObject pintarget, FsmString pinevent) { return EventSenderWithDelay(pintarget, pinevent, 0f); } internal static FsmStateAction EventSenderWithDelay(FsmGameObject pintarget, FsmString pinevent, float delay) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0033: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_004e: Expected O, but got Unknown return (FsmStateAction)new SendEventByName { eventTarget = new FsmEventTarget { target = (EventTarget)1, gameObject = new FsmOwnerDefault { OwnerOption = (OwnerDefaultOption)1, GameObject = pintarget } }, sendEvent = pinevent, delay = FsmFloat.op_Implicit(delay), everyFrame = false }; } internal static FsmStateAction SelfEventSender(FsmString pinevent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0018: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown return (FsmStateAction)new SendEventByName { eventTarget = new FsmEventTarget { target = (EventTarget)0 }, sendEvent = pinevent, delay = FsmFloat.op_Implicit(0f), everyFrame = false }; } internal static FsmStateAction SelfAnimatorPosition(FsmFloat x, FsmFloat y, FsmFloat z) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0019: 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_001f: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_004a: 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_0058: 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_0074: Expected O, but got Unknown return (FsmStateAction)new AnimatePositionTo { gameObject = new FsmOwnerDefault { OwnerOption = (OwnerDefaultOption)0 }, toValue = new FsmVector3 { UseVariable = true, Value = new Vector3(x.value, y.value, z.value) }, objectTransform = null, localSpace = false, time = FsmFloat.op_Implicit(2f), finishEvent = FsmEvent.Finished }; } internal static FsmStateAction Waiter(float seconds) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_001e: Expected O, but got Unknown return (FsmStateAction)new Wait { time = FsmFloat.op_Implicit(seconds), finishEvent = FsmEvent.Finished }; } internal static FsmStateAction WaiterWithEvent(float seconds, FsmEvent waitevent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_001a: Expected O, but got Unknown return (FsmStateAction)new Wait { time = FsmFloat.op_Implicit(seconds), finishEvent = waitevent }; } internal static FsmStateAction Passer(FsmEvent eventname) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown return (FsmStateAction)new NextFrameEvent { sendEvent = eventname }; } internal static FsmStateAction PositionGetter(FsmGameObject target, FsmFloat x, FsmFloat y) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000c: 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_0021: Expected O, but got Unknown //IL_0021: 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_0040: 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_005e: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown return (FsmStateAction)new GetPosition { gameObject = new FsmOwnerDefault { OwnerOption = (OwnerDefaultOption)1, GameObject = target }, vector = FsmVector3.op_Implicit(new Vector3(0f, 0f, 0f)), x = x, y = y, z = FsmFloat.op_Implicit(0f), everyFrame = false, space = (Space)0 }; } internal static FsmStateAction SimpleRandomEvent(FsmEvent[] events) { //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_0060: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown int num = events.Length; FsmFloat[] array = (FsmFloat[])(object)new FsmFloat[num]; FsmInt[] array2 = (FsmInt[])(object)new FsmInt[num]; FsmInt[] array3 = (FsmInt[])(object)new FsmInt[num]; for (int i = 0; i < num; i++) { array[i] = FsmFloat.op_Implicit(1f); array2[i] = FsmInt.op_Implicit(3); array3[i] = FsmInt.op_Implicit(5); } return (FsmStateAction)new SendRandomEventV4 { events = events, weights = array, eventMax = array2, missedMax = array3, activeBool = FsmBool.op_Implicit(false) }; } } public static class FsmUtil { [PublicAPI] public static PlayMakerFSM? GetFsmPreprocessed(this GameObject go, string fsmName) { PlayMakerFSM[] components = go.GetComponents<PlayMakerFSM>(); foreach (PlayMakerFSM val in components) { if (val.FsmName == fsmName) { val.Preprocess(); return val; } } return null; } private static TVal? GetItemFromArray<TVal>(TVal[] origArray, Func<TVal, bool> isItemCheck) where TVal : class { foreach (TVal val in origArray) { if (isItemCheck(val)) { return val; } } return null; } private static TVal[] GetItemsFromArray<TVal>(TVal[] origArray, Func<TVal, bool> isItemCheck) where TVal : class { int num = 0; foreach (TVal arg in origArray) { if (isItemCheck(arg)) { num++; } } if (num == origArray.Length) { return origArray; } if (num == 0) { return Array.Empty<TVal>(); } TVal[] array = new TVal[num]; int num2 = 0; foreach (TVal val in origArray) { if (isItemCheck(val)) { array[num2] = val; num2++; } } return array; } [PublicAPI] public static FsmState? GetState(this PlayMakerFSM fsm, string stateName) { string stateName2 = stateName; return GetItemFromArray(fsm.FsmStates, (FsmState x) => x.Name == stateName2); } [PublicAPI] public static FsmState? GetState(this Fsm fsm, string stateName) { string stateName2 = stateName; return GetItemFromArray(fsm.States, (FsmState x) => x.Name == stateName2); } [PublicAPI] public static FsmTransition? GetTransition(this PlayMakerFSM fsm, string stateName, string eventName) { return fsm.GetState(stateName).GetTransition(eventName); } [PublicAPI] public static FsmTransition? GetTransition(this Fsm fsm, string stateName, string eventName) { return fsm.GetState(stateName).GetTransition(eventName); } [PublicAPI] public static FsmTransition? GetTransition(this FsmState state, string eventName) { string eventName2 = eventName; return GetItemFromArray(state.Transitions, (FsmTransition x) => x.EventName == eventName2); } [PublicAPI] public static FsmTransition? GetGlobalTransition(this PlayMakerFSM fsm, string globalEventName) { return fsm.Fsm.GetGlobalTransition(globalEventName); } [PublicAPI] public static FsmTransition? GetGlobalTransition(this Fsm fsm, string globalEventName) { string globalEventName2 = globalEventName; return GetItemFromArray(fsm.GlobalTransitions, (FsmTransition x) => x.EventName == globalEventName2); } [PublicAPI] public static TAction? GetAction<TAction>(this PlayMakerFSM fsm, string stateName, int index) where TAction : FsmStateAction { return fsm.GetState(stateName).GetAction<TAction>(index); } [PublicAPI] public static TAction? GetAction<TAction>(this Fsm fsm, string stateName, int index) where TAction : FsmStateAction { return fsm.GetState(stateName).GetAction<TAction>(index); } [PublicAPI] public static TAction? GetAction<TAction>(this FsmState state, int index) where TAction : FsmStateAction { FsmStateAction obj = state.Actions[index]; return (TAction)(object)((obj is TAction) ? obj : null); } [PublicAPI] public static FsmStateAction? GetStateAction(this PlayMakerFSM fsm, string stateName, int index) { return fsm.GetState(stateName).GetStateAction(index); } [PublicAPI] public static FsmStateAction? GetStateAction(this Fsm fsm, string stateName, int index) { return fsm.GetState(stateName).GetStateAction(index); } [PublicAPI] public static FsmStateAction? GetStateAction(this FsmState state, int index) { return state.Actions[index]; } [PublicAPI] public static TAction[] GetActionsOfType<TAction>(this PlayMakerFSM fsm, string stateName) where TAction : FsmStateAction { return fsm.GetState(stateName).GetActionsOfType<TAction>(); } [PublicAPI] public static TAction[] GetActionsOfType<TAction>(this Fsm fsm, string stateName) where TAction : FsmStateAction { return fsm.GetState(stateName).GetActionsOfType<TAction>(); } [PublicAPI] public static TAction[] GetActionsOfType<TAction>(this FsmState state) where TAction : FsmStateAction { return Array.ConvertAll(GetItemsFromArray(state.Actions, (FsmStateAction x) => x is TAction), (FsmStateAction x) => (TAction)(object)x); } [PublicAPI] public static TAction? GetFirstActionOfType<TAction>(this PlayMakerFSM fsm, string stateName) where TAction : FsmStateAction { return fsm.GetState(stateName).GetFirstActionOfType<TAction>(); } [PublicAPI] public static TAction? GetFirstActionOfType<TAction>(this Fsm fsm, string stateName) where TAction : FsmStateAction { return fsm.GetState(stateName).GetFirstActionOfType<TAction>(); } [PublicAPI] public static TAction? GetFirstActionOfType<TAction>(this FsmState state) where TAction : FsmStateAction { int num = -1; for (int i = 0; i < state.Actions.Length; i++) { if (state.Actions[i] is TAction) { num = i; break; } } if (num == -1) { return default(TAction); } return state.GetAction<TAction>(num); } [PublicAPI] public static TAction? GetLastActionOfType<TAction>(this PlayMakerFSM fsm, string stateName) where TAction : FsmStateAction { return fsm.GetState(stateName).GetLastActionOfType<TAction>(); } [PublicAPI] public static TAction? GetLastActionOfType<TAction>(this Fsm fsm, string stateName) where TAction : FsmStateAction { return fsm.GetState(stateName).GetLastActionOfType<TAction>(); } [PublicAPI] public static TAction? GetLastActionOfType<TAction>(this FsmState state) where TAction : FsmStateAction { int num = -1; for (int num2 = state.Actions.Length - 1; num2 >= 0; num2--) { if (state.Actions[num2] is TAction) { num = num2; break; } } if (num == -1) { return default(TAction); } return state.GetAction<TAction>(num); } private static TVal[] AddItemToArray<TVal>(TVal[] origArray, TVal value) { TVal[] array = new TVal[origArray.Length + 1]; origArray.CopyTo(array, 0); array[origArray.Length] = value; return array; } [PublicAPI] public static FsmState AddState(this PlayMakerFSM fsm, string stateName) { //IL_000c: 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_001e: Expected O, but got Unknown return fsm.Fsm.AddState(new FsmState(fsm.Fsm) { Name = stateName }); } [PublicAPI] public static FsmState AddState(this Fsm fsm, string stateName) { //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_0014: Expected O, but got Unknown return fsm.AddState(new FsmState(fsm) { Name = stateName }); } [PublicAPI] public static FsmState AddState(this PlayMakerFSM fsm, FsmState state) { return fsm.Fsm.AddState(state); } [PublicAPI] public static FsmState AddState(this Fsm fsm, FsmState state) { FsmState[] states = fsm.States; FsmState[] array2 = (fsm.States = AddItemToArray(states, state)); fsm.SaveActions(); return array2[states.Length]; } [PublicAPI] public static FsmState CopyState(this PlayMakerFSM fsm, string fromState, string toState) { return fsm.Fsm.CopyState(fromState, toState); } [PublicAPI] public static FsmState CopyState(this Fsm fsm, string fromState, string toState) { //IL_0016: 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) //IL_0024: Expected O, but got Unknown FsmState state = fsm.GetState(fromState); if (state != null) { state.SaveActions(); } FsmState val = new FsmState(state) { Name = toState }; FsmTransition[] transitions = val.Transitions; foreach (FsmTransition val2 in transitions) { val2.ToFsmState = fsm.GetState(val2.ToState); } fsm.AddState(val); return val; } [PublicAPI] public static FsmEvent AddTransition(this PlayMakerFSM fsm, string stateName, string eventName, string toState) { return fsm.GetState(stateName).AddTransition(eventName, toState); } [PublicAPI] public static FsmEvent AddTransition(this Fsm fsm, string stateName, string eventName, string toState) { return fsm.GetState(stateName).AddTransition(eventName, toState); } [PublicAPI] public static FsmEvent AddTransition(this FsmState state, string eventName, string toState) { //IL_000e: 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_001b: 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_003b: Expected O, but got Unknown FsmEvent fsmEvent = FsmEvent.GetFsmEvent(eventName); FsmTransition[] transitions = AddItemToArray(state.Transitions, new FsmTransition { ToState = toState, ToFsmState = state.Fsm.GetState(toState), FsmEvent = fsmEvent }); state.Transitions = transitions; return fsmEvent; } [PublicAPI] public static FsmEvent AddGlobalTransition(this PlayMakerFSM fsm, string globalEventName, string toState) { return fsm.Fsm.AddGlobalTransition(globalEventName, toState); } [PublicAPI] public static FsmEvent AddGlobalTransition(this Fsm fsm, string globalEventName, string toState) { //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_0010: Expected O, but got Unknown //IL_0016: 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) //IL_0023: 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_003e: Expected O, but got Unknown FsmEvent val = new FsmEvent(globalEventName) { IsGlobal = true }; FsmTransition[] globalTransitions = AddItemToArray(fsm.GlobalTransitions, new FsmTransition { ToState = toState, ToFsmState = fsm.GetState(toState), FsmEvent = val }); fsm.GlobalTransitions = globalTransitions; return val; } [PublicAPI] public static void AddAction(this PlayMakerFSM fsm, string stateName, FsmStateAction action) { fsm.GetState(stateName).AddAction(action); } [PublicAPI] public static void AddAction(this Fsm fsm, string stateName, FsmStateAction action) { fsm.GetState(stateName).AddAction(action); } [PublicAPI] public static void AddAction(this FsmState state, FsmStateAction action) { FsmStateAction[] actions = AddItemToArray(state.Actions, action); state.Actions = actions; action.Init(state); } [PublicAPI] public static void AddActions(this PlayMakerFSM fsm, string stateName, params FsmStateAction[] actions) { fsm.GetState(stateName).AddActions(actions); } [PublicAPI] public static void AddActions(this Fsm fsm, string stateName, params FsmStateAction[] actions) { fsm.GetState(stateName).AddActions(actions); } [PublicAPI] public static void AddActions(this FsmState state, params FsmStateAction[] actions) { foreach (FsmStateAction action in actions) { state.AddAction(action); } } [PublicAPI] public static void AddMethod(this PlayMakerFSM fsm, string stateName, Action<FsmStateAction> method) { fsm.GetState(stateName).AddMethod(method); } [PublicAPI] public static void AddMethod(this Fsm fsm, string stateName, Action<FsmStateAction> method) { fsm.GetState(stateName).AddMethod(method); } [PublicAPI] public static void AddMethod(this FsmState state, Action<FsmStateAction> method) { DelegateAction<FsmStateAction> delegateAction = new DelegateAction<FsmStateAction> { Method = method }; delegateAction.Arg = (FsmStateAction?)(object)delegateAction; state.AddAction((FsmStateAction)(object)delegateAction); } [PublicAPI] public static void AddLambdaMethod(this PlayMakerFSM fsm, string stateName, Action<Action> method) { fsm.GetState(stateName).AddLambdaMethod(method); } [PublicAPI] public static void AddLambdaMethod(this Fsm fsm, string stateName, Action<Action> method) { fsm.GetState(stateName).AddLambdaMethod(method); } [PublicAPI] public static void AddLambdaMethod(this FsmState state, Action<Action> method) { DelegateAction<Action> delegateAction = new DelegateAction<Action> { Method = method }; delegateAction.Arg = ((FsmStateAction)delegateAction).Finish; state.AddAction((FsmStateAction)(object)delegateAction); } private static TVal[] InsertItemIntoArray<TVal>(TVal[] origArray, TVal value, int index) { int num = origArray.Length; if (index < 0 || index > num + 1) { throw new ArgumentOutOfRangeException($"Index {index} was out of range for array with length {num}!"); } TVal[] array = new TVal[num + 1]; for (int i = 0; i < index; i++) { array[i] = origArray[i]; } array[index] = value; for (int i = index; i < num; i++) { array[i + 1] = origArray[i]; } return array; } [PublicAPI] public static void InsertAction(this PlayMakerFSM fsm, string stateName, FsmStateAction action, int index) { fsm.GetState(stateName).InsertAction(index, action); } [PublicAPI] public static void InsertAction(this PlayMakerFSM fsm, string stateName, int index, FsmStateAction action) { fsm.GetState(stateName).InsertAction(index, action); } [PublicAPI] public static void InsertAction(this Fsm fsm, string stateName, FsmStateAction action, int index) { fsm.GetState(stateName).InsertAction(index, action); } [PublicAPI] public static void InsertAction(this Fsm fsm, string stateName, int index, FsmStateAction action) { fsm.GetState(stateName).InsertAction(index, action); } [PublicAPI] public static void InsertAction(this FsmState state, FsmStateAction action, int index) { state.InsertAction(index, action); } [PublicAPI] public static void InsertAction(this FsmState state, int index, FsmStateAction action) { FsmStateAction[] actions = InsertItemIntoArray(state.Actions, action, index); state.Actions = actions; action.Init(state); } [PublicAPI] public static void InsertActions(this PlayMakerFSM fsm, string stateName, int index, params FsmStateAction[] actions) { fsm.GetState(stateName).InsertActions(index, actions); } [PublicAPI] public static void InsertActions(this Fsm fsm, string stateName, int index, params FsmStateAction[] actions) { fsm.GetState(stateName).InsertActions(index, actions); } [PublicAPI] public static void InsertActions(this FsmState state, int index, params FsmStateAction[] actions) { foreach (FsmStateAction action in actions) { state.InsertAction(action, index); index++; } } [PublicAPI] public static void InsertMethod(this PlayMakerFSM fsm, string stateName, Action<FsmStateAction> method, int index) { fsm.GetState(stateName).InsertMethod(index, method); } [PublicAPI] public static void InsertMethod(this PlayMakerFSM fsm, string stateName, int index, Action<FsmStateAction> method) { fsm.GetState(stateName).InsertMethod(index, method); } [PublicAPI] public static void InsertMethod(this Fsm fsm, string stateName, Action<FsmStateAction> method, int index) { fsm.GetState(stateName).InsertMethod(index, method); } [PublicAPI] public static void InsertMethod(this Fsm fsm, string stateName, int index, Action<FsmStateAction> method) { fsm.GetState(stateName).InsertMethod(index, method); } [PublicAPI] public static void InsertMethod(this FsmState state, Action<FsmStateAction> method, int index) { state.InsertMethod(index, method); } [PublicAPI] public static void InsertMethod(this FsmState state, int index, Action<FsmStateAction> method) { DelegateAction<FsmStateAction> delegateAction = new DelegateAction<FsmStateAction> { Method = method }; delegateAction.Arg = (FsmStateAction?)(object)delegateAction; state.InsertAction((FsmStateAction)(object)delegateAction, index); } [PublicAPI] public static void InsertLambdaMethod(this PlayMakerFSM fsm, string stateName, Action<Action> method, int index) { fsm.GetState(stateName).InsertLambdaMethod(index, method); } [PublicAPI] public static void InsertLambdaMethod(this PlayMakerFSM fsm, string stateName, int index, Action<Action> method) { fsm.GetState(stateName).InsertLambdaMethod(index, method); } [PublicAPI] public static void InsertLambdaMethod(this Fsm fsm, string stateName, Action<Action> method, int index) { fsm.GetState(stateName).InsertLambdaMethod(index, method); } [PublicAPI] public static void InsertLambdaMethod(this Fsm fsm, string stateName, int index, Action<Action> method) { fsm.GetState(stateName).InsertLambdaMethod(index, method); } [PublicAPI] public static void InsertLambdaMethod(this FsmState state, Action<Action> method, int index) { state.InsertLambdaMethod(index, method); } [PublicAPI] public static void InsertLambdaMethod(this FsmState state, int index, Action<Action> method) { DelegateAction<Action> delegateAction = new DelegateAction<Action> { Method = method }; delegateAction.Arg = ((FsmStateAction)delegateAction).Finish; state.InsertAction((FsmStateAction)(object)delegateAction, index); } [PublicAPI] public static void ReplaceAction(this PlayMakerFSM fsm, string stateName, FsmStateAction action, int index) { fsm.GetState(stateName).ReplaceAction(index, action); } [PublicAPI] public static void ReplaceAction(this PlayMakerFSM fsm, string stateName, int index, FsmStateAction action) { fsm.GetState(stateName).ReplaceAction(index, action); } [PublicAPI] public static void ReplaceAction(this Fsm fsm, string stateName, FsmStateAction action, int index) { fsm.GetState(stateName).ReplaceAction(index, action); } [PublicAPI] public static void ReplaceAction(this Fsm fsm, string stateName, int index, FsmStateAction action) { fsm.GetState(stateName).ReplaceAction(index, action); } [PublicAPI] public static void ReplaceAction(this FsmState state, FsmStateAction action, int index) { state.ReplaceAction(index, action); } [PublicAPI] public static void ReplaceAction(this FsmState state, int index, FsmStateAction action) { state.Actions[index] = action; action.Init(state); } [PublicAPI] public static void ReplaceAllActions(this PlayMakerFSM fsm, string stateName, params FsmStateAction[] actions) { fsm.GetState(stateName).ReplaceAllActions(actions); } [PublicAPI] public static void ReplaceAllActions(this Fsm fsm, string stateName, params FsmStateAction[] actions) { fsm.GetState(stateName).ReplaceAllActions(actions); } [PublicAPI] public static void ReplaceAllActions(this FsmState state, params FsmStateAction[] actions) { state.Actions = actions; foreach (FsmStateAction val in actions) { val.Init(state); } } [PublicAPI] public static bool ChangeTransition(this PlayMakerFSM fsm, string stateName, string eventName, string toState) { return fsm.GetState(stateName).ChangeTransition(eventName, toState); } [PublicAPI] public static bool ChangeTransition(this Fsm fsm, string stateName, string eventName, string toState) { return fsm.GetState(stateName).ChangeTransition(eventName, toState); } [PublicAPI] public static bool ChangeTransition(this FsmState state, string eventName, string toState) { FsmTransition transition = state.GetTransition(eventName); if (transition == null) { return false; } transition.ToState = toState; transition.ToFsmState = state.Fsm.GetState(toState); return true; } [PublicAPI] public static bool ChangeGlobalTransition(this PlayMakerFSM fsm, string globalEventName, string toState) { return fsm.Fsm.ChangeGlobalTransition(globalEventName, toState); } [PublicAPI] public static bool ChangeGlobalTransition(this Fsm fsm, string globalEventName, string toState) { FsmTransition globalTransition = fsm.GetGlobalTransition(globalEventName); if (globalTransition == null) { return false; } globalTransition.ToState = toState; globalTransition.ToFsmState = fsm.GetState(toState); return true; } private static TVal[] RemoveItemsFromArray<TVal>(TVal[] origArray, Func<TVal, bool> shouldBeRemovedCallback) { int num = 0; foreach (TVal arg in origArray) { if (shouldBeRemovedCallback(arg)) { num++; } } if (num == 0) { return origArray; } TVal[] array = new TVal[origArray.Length - num]; for (int num2 = origArray.Length - 1; num2 >= 0; num2--) { TVal val = origArray[num2]; if (shouldBeRemovedCallback(val)) { num--; } else { array[num2 - num] = val; } } return array; } [PublicAPI] public static void RemoveState(this PlayMakerFSM fsm, string stateName) { fsm.Fsm.RemoveState(stateName); } [PublicAPI] public static void RemoveState(this Fsm fsm, string stateName) { string stateName2 = stateName; fsm.States = RemoveItemsFromArray(fsm.States, (FsmState x) => x.Name == stateName2); } [PublicAPI] public static void RemoveTransition(this PlayMakerFSM fsm, string stateName, string eventName) { fsm.GetState(stateName).RemoveTransition(eventName); } [PublicAPI] public static void RemoveTransition(this Fsm fsm, string stateName, string eventName) { fsm.GetState(stateName).RemoveTransition(eventName); } [PublicAPI] public static void RemoveTransition(this FsmState state, string eventName) { string eventName2 = eventName; state.Transitions = RemoveItemsFromArray(state.Transitions, (FsmTransition x) => x.EventName == eventName2); } [PublicAPI] public static void RemoveGlobalTransition(this PlayMakerFSM fsm, string globalEventName) { fsm.Fsm.RemoveGlobalTransition(globalEventName); } [PublicAPI] public static void RemoveGlobalTransition(this Fsm fsm, string globalEventName) { string globalEventName2 = globalEventName; fsm.GlobalTransitions = RemoveItemsFromArray(fsm.GlobalTransitions, (FsmTransition x) => x.EventName == globalEventName2); } [PublicAPI] public static void RemoveTransitionsTo(this PlayMakerFSM fsm, string toState) { fsm.Fsm.RemoveTransitionsTo(toState); } [PublicAPI] public static void RemoveTransitionsTo(this Fsm fsm, string toState) { FsmState[] states = fsm.States; foreach (FsmState state in states) { state.RemoveTransitionsTo(toState); } } [PublicAPI] public static void RemoveTransitionsTo(this PlayMakerFSM fsm, string stateName, string toState) { fsm.GetState(stateName).RemoveTransitionsTo(toState); } [PublicAPI] public static void RemoveTransitionsTo(this Fsm fsm, string stateName, string toState) { fsm.GetState(stateName).RemoveTransitionsTo(toState); } [PublicAPI] public static void RemoveTransitionsTo(this FsmState state, string toState) { string toState2 = toState; state.Transitions = RemoveItemsFromArray(state.Transitions, (FsmTransition x) => x.ToState == toState2); } [PublicAPI] public static void RemoveTransitions(this PlayMakerFSM fsm, string stateName) { fsm.GetState(stateName).RemoveTransitions(); } [PublicAPI] public static void RemoveTransitions(this Fsm fsm, string stateName) { fsm.GetState(stateName).RemoveTransitions(); } [PublicAPI] public static void RemoveTransitions(this FsmState state) { state.Transitions = Array.Empty<FsmTransition>(); } [PublicAPI] public static bool RemoveAction(this PlayMakerFSM fsm, string stateName, int index) { return fsm.GetState(stateName).RemoveAction(index); } [PublicAPI] public static bool RemoveAction(this Fsm fsm, string stateName, int index) { return fsm.GetState(stateName).RemoveAction(index); } [PublicAPI] public static bool RemoveAction(this FsmState state, int index) { FsmStateAction[] actions = state.Actions; if (index < 0 || index >= actions.Length) { return false; } FsmStateAction[] array = (FsmStateAction[])(object)new FsmStateAction[actions.Length - 1]; int num = array.Length; for (int i = 0; i < index; i++) { array[i] = actions[i]; } for (int i = index; i < num; i++) { array[i] = actions[i + 1]; } state.Actions = array; return true; } [PublicAPI] public static void RemoveActionsOfType<TAction>(this PlayMakerFSM fsm) { fsm.Fsm.RemoveActionsOfType<TAction>(); } [PublicAPI] public static void RemoveActionsOfType<TAction>(this Fsm fsm) { FsmState[] states = fsm.States; foreach (FsmState state in states) { state.RemoveActionsOfType<TAction>(); } } [PublicAPI] public static void RemoveActionsOfType<TAction>(this PlayMakerFSM fsm, string stateName) { fsm.GetState(stateName).RemoveActionsOfType<TAction>(); } [PublicAPI] public static void RemoveActionsOfType<TAction>(this Fsm fsm, string stateName) { fsm.GetState(stateName).RemoveActionsOfType<TAction>(); } [PublicAPI] public static void RemoveActionsOfType<TAction>(this FsmState state) { state.Actions = RemoveItemsFromArray(state.Actions, (FsmStateAction x) => x is TAction); } [PublicAPI] public static void RemoveFirstActionOfType<TAction>(this PlayMakerFSM fsm, string stateName) { fsm.GetState(stateName).RemoveFirstActionOfType<TAction>(); } [PublicAPI] public static void RemoveFirstActionOfType<TAction>(this Fsm fsm, string stateName) { fsm.GetState(stateName).RemoveFirstActionOfType<TAction>(); } [PublicAPI] public static void RemoveFirstActionOfType<TAction>(this FsmState state) { int num = -1; for (int i = 0; i < state.Actions.Length; i++) { if (state.Actions[i] is TAction) { num = i; break; } } if (num != -1) { state.RemoveAction(num); } } [PublicAPI] public static void RemoveLastActionOfType<TAction>(this PlayMakerFSM fsm, string stateName) { fsm.GetState(stateName).RemoveLastActionOfType<TAction>(); } [PublicAPI] public static void RemoveLastActionOfType<TAction>(this Fsm fsm, string stateName) { fsm.GetState(stateName).RemoveLastActionOfType<TAction>(); } [PublicAPI] public static void RemoveLastActionOfType<TAction>(this FsmState state) { int num = -1; for (int num2 = state.Actions.Length - 1; num2 >= 0; num2--) { if (state.Actions[num2] is TAction) { num = num2; break; } } if (num != -1) { state.RemoveAction(num); } } [PublicAPI] public static bool DisableAction(this PlayMakerFSM fsm, string stateName, int index) { return fsm.GetState(stateName).DisableAction(index); } [PublicAPI] public static bool DisableAction(this Fsm fsm, string stateName, int index) { return fsm.GetState(stateName).DisableAction(index); } [PublicAPI] public static bool DisableAction(this FsmState state, int index) { if (index < 0 || index >= state.Actions.Length) { return false; } state.Actions[index].Enabled = false; return true; } [PublicAPI] public static bool DisableActions(this PlayMakerFSM fsm, string stateName, params int[] indices) { return fsm.GetState(stateName).DisableActions(indices); } [PublicAPI] public static bool DisableActions(this Fsm fsm, string stateName, params int[] indices) { return fsm.GetState(stateName).DisableActions(indices); } [PublicAPI] public static bool DisableActions(this FsmState state, params int[] indices) { bool flag = true; foreach (int index in indices) { flag = flag && state.DisableAction(index); } return flag; } [PublicAPI] public static void DisableActionsOfType<TAction>(this PlayMakerFSM fsm) { fsm.Fsm.DisableActionsOfType<TAction>(); } [PublicAPI] public static void DisableActionsOfType<TAction>(this Fsm fsm) { FsmState[] states = fsm.States; foreach (FsmState state in states) { state.DisableActionsOfType<TAction>(); } } [PublicAPI] public static void DisableActionsOfType<TAction>(this PlayMakerFSM fsm, string stateName) { fsm.GetState(stateName).DisableActionsOfType<TAction>(); } [PublicAPI] public static void DisableActionsOfType<TAction>(this Fsm fsm, string stateName) { fsm.GetState(stateName).DisableActionsOfType<TAction>(); } [PublicAPI] public static void DisableActionsOfType<TAction>(this FsmState state) { FsmStateAction[] actions = state.Actions; foreach (FsmStateAction val in actions) { if (val is TAction) { val.Enabled = false; } } } private static TVar[] MakeNewVariableArray<TVar>(TVar[] orig, string name) where TVar : NamedVariable, new() { TVar[] array = new TVar[orig.Length + 1]; orig.CopyTo(array, 0); int num = orig.Length; TVar val = new TVar(); ((NamedVariable)val).name = name; array[num] = val; return array; } [PublicAPI] public static FsmFloat AddFloatVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.AddFloatVariable(name); } [PublicAPI] public static FsmFloat AddFloatVariable(this Fsm fsm, string name) { FsmFloat[] array = MakeNewVariableArray<FsmFloat>(fsm.Variables.FloatVariables, name); fsm.Variables.FloatVariables = array; return array[^1]; } [PublicAPI] public static FsmInt AddIntVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.AddIntVariable(name); } [PublicAPI] public static FsmInt AddIntVariable(this Fsm fsm, string name) { FsmInt[] array = MakeNewVariableArray<FsmInt>(fsm.Variables.IntVariables, name); fsm.Variables.IntVariables = array; return array[^1]; } [PublicAPI] public static FsmBool AddBoolVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.AddBoolVariable(name); } [PublicAPI] public static FsmBool AddBoolVariable(this Fsm fsm, string name) { FsmBool[] array = MakeNewVariableArray<FsmBool>(fsm.Variables.BoolVariables, name); fsm.Variables.BoolVariables = array; return array[^1]; } [PublicAPI] public static FsmString AddStringVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.AddStringVariable(name); } [PublicAPI] public static FsmString AddStringVariable(this Fsm fsm, string name) { FsmString[] array = MakeNewVariableArray<FsmString>(fsm.Variables.StringVariables, name); fsm.Variables.StringVariables = array; return array[^1]; } [PublicAPI] public static FsmVector2 AddVector2Variable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.AddVector2Variable(name); } [PublicAPI] public static FsmVector2 AddVector2Variable(this Fsm fsm, string name) { FsmVector2[] array = MakeNewVariableArray<FsmVector2>(fsm.Variables.Vector2Variables, name); fsm.Variables.Vector2Variables = array; return array[^1]; } [PublicAPI] public static FsmVector3 AddVector3Variable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.AddVector3Variable(name); } [PublicAPI] public static FsmVector3 AddVector3Variable(this Fsm fsm, string name) { FsmVector3[] array = MakeNewVariableArray<FsmVector3>(fsm.Variables.Vector3Variables, name); fsm.Variables.Vector3Variables = array; return array[^1]; } [PublicAPI] public static FsmColor AddColorVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.AddColorVariable(name); } [PublicAPI] public static FsmColor AddColorVariable(this Fsm fsm, string name) { FsmColor[] array = MakeNewVariableArray<FsmColor>(fsm.Variables.ColorVariables, name); fsm.Variables.ColorVariables = array; return array[^1]; } [PublicAPI] public static FsmRect AddRectVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.AddRectVariable(name); } [PublicAPI] public static FsmRect AddRectVariable(this Fsm fsm, string name) { FsmRect[] array = MakeNewVariableArray<FsmRect>(fsm.Variables.RectVariables, name); fsm.Variables.RectVariables = array; return array[^1]; } [PublicAPI] public static FsmQuaternion AddQuaternionVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.AddQuaternionVariable(name); } [PublicAPI] public static FsmQuaternion AddQuaternionVariable(this Fsm fsm, string name) { FsmQuaternion[] array = MakeNewVariableArray<FsmQuaternion>(fsm.Variables.QuaternionVariables, name); fsm.Variables.QuaternionVariables = array; return array[^1]; } [PublicAPI] public static FsmGameObject AddGameObjectVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.AddGameObjectVariable(name); } [PublicAPI] public static FsmGameObject AddGameObjectVariable(this Fsm fsm, string name) { FsmGameObject[] array = MakeNewVariableArray<FsmGameObject>(fsm.Variables.GameObjectVariables, name); fsm.Variables.GameObjectVariables = array; return array[^1]; } private static TVar? FindInVariableArray<TVar>(TVar[] orig, string name) where TVar : NamedVariable, new() { foreach (TVar val in orig) { if (((NamedVariable)val).Name == name) { return val; } } return default(TVar); } [PublicAPI] public static FsmFloat? FindFloatVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.FindFloatVariable(name); } [PublicAPI] public static FsmFloat? FindFloatVariable(this Fsm fsm, string name) { return FindInVariableArray<FsmFloat>(fsm.Variables.FloatVariables, name); } [PublicAPI] public static FsmInt? FindIntVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.FindIntVariable(name); } [PublicAPI] public static FsmInt? FindIntVariable(this Fsm fsm, string name) { return FindInVariableArray<FsmInt>(fsm.Variables.IntVariables, name); } [PublicAPI] public static FsmBool? FindBoolVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.FindBoolVariable(name); } [PublicAPI] public static FsmBool? FindBoolVariable(this Fsm fsm, string name) { return FindInVariableArray<FsmBool>(fsm.Variables.BoolVariables, name); } [PublicAPI] public static FsmString? FindStringVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.FindStringVariable(name); } [PublicAPI] public static FsmString? FindStringVariable(this Fsm fsm, string name) { return FindInVariableArray<FsmString>(fsm.Variables.StringVariables, name); } [PublicAPI] public static FsmVector2? FindVector2Variable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.FindVector2Variable(name); } [PublicAPI] public static FsmVector2? FindVector2Variable(this Fsm fsm, string name) { return FindInVariableArray<FsmVector2>(fsm.Variables.Vector2Variables, name); } [PublicAPI] public static FsmVector3? FindVector3Variable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.FindVector3Variable(name); } [PublicAPI] public static FsmVector3? FindVector3Variable(this Fsm fsm, string name) { return FindInVariableArray<FsmVector3>(fsm.Variables.Vector3Variables, name); } [PublicAPI] public static FsmColor? FindColorVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.FindColorVariable(name); } [PublicAPI] public static FsmColor? FindColorVariable(this Fsm fsm, string name) { return FindInVariableArray<FsmColor>(fsm.Variables.ColorVariables, name); } [PublicAPI] public static FsmRect? FindRectVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.FindRectVariable(name); } [PublicAPI] public static FsmRect? FindRectVariable(this Fsm fsm, string name) { return FindInVariableArray<FsmRect>(fsm.Variables.RectVariables, name); } [PublicAPI] public static FsmQuaternion? FindQuaternionVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.FindQuaternionVariable(name); } [PublicAPI] public static FsmQuaternion? FindQuaternionVariable(this Fsm fsm, string name) { return FindInVariableArray<FsmQuaternion>(fsm.Variables.QuaternionVariables, name); } [PublicAPI] public static FsmGameObject? FindGameObjectVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.FindGameObjectVariable(name); } [PublicAPI] public static FsmGameObject? FindGameObjectVariable(this Fsm fsm, string name) { return FindInVariableArray<FsmGameObject>(fsm.Variables.GameObjectVariables, name); } [PublicAPI] public static FsmFloat GetFloatVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.GetFloatVariable(name); } [PublicAPI] public static FsmFloat GetFloatVariable(this Fsm fsm, string name) { FsmFloat val = fsm.FindFloatVariable(name); if (val != null) { return val; } return fsm.AddFloatVariable(name); } [PublicAPI] public static FsmInt GetIntVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.GetIntVariable(name); } [PublicAPI] public static FsmInt GetIntVariable(this Fsm fsm, string name) { FsmInt val = fsm.FindIntVariable(name); if (val != null) { return val; } return fsm.AddIntVariable(name); } [PublicAPI] public static FsmBool GetBoolVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.GetBoolVariable(name); } [PublicAPI] public static FsmBool GetBoolVariable(this Fsm fsm, string name) { FsmBool val = fsm.FindBoolVariable(name); if (val != null) { return val; } return fsm.AddBoolVariable(name); } [PublicAPI] public static FsmString GetStringVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.GetStringVariable(name); } [PublicAPI] public static FsmString GetStringVariable(this Fsm fsm, string name) { FsmString val = fsm.FindStringVariable(name); if (val != null) { return val; } return fsm.AddStringVariable(name); } [PublicAPI] public static FsmVector2 GetVector2Variable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.GetVector2Variable(name); } [PublicAPI] public static FsmVector2 GetVector2Variable(this Fsm fsm, string name) { FsmVector2 val = fsm.FindVector2Variable(name); if (val != null) { return val; } return fsm.AddVector2Variable(name); } [PublicAPI] public static FsmVector3 GetVector3Variable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.GetVector3Variable(name); } [PublicAPI] public static FsmVector3 GetVector3Variable(this Fsm fsm, string name) { FsmVector3 val = fsm.FindVector3Variable(name); if (val != null) { return val; } return fsm.AddVector3Variable(name); } [PublicAPI] public static FsmColor GetColorVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.GetColorVariable(name); } [PublicAPI] public static FsmColor GetColorVariable(this Fsm fsm, string name) { FsmColor val = fsm.FindColorVariable(name); if (val != null) { return val; } return fsm.AddColorVariable(name); } [PublicAPI] public static FsmRect GetRectVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.GetRectVariable(name); } [PublicAPI] public static FsmRect GetRectVariable(this Fsm fsm, string name) { FsmRect val = fsm.FindRectVariable(name); if (val != null) { return val; } return fsm.AddRectVariable(name); } [PublicAPI] public static FsmQuaternion GetQuaternionVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.GetQuaternionVariable(name); } [PublicAPI] public static FsmQuaternion GetQuaternionVariable(this Fsm fsm, string name) { FsmQuaternion val = fsm.FindQuaternionVariable(name); if (val != null) { return val; } return fsm.AddQuaternionVariable(name); } [PublicAPI] public static FsmGameObject GetGameObjectVariable(this PlayMakerFSM fsm, string name) { return fsm.Fsm.GetGameObjectVariable(name); } [PublicAPI] public static FsmGameObject GetGameObjectVariable(this Fsm fsm, string name) { FsmGameObject val = fsm.FindGameObjectVariable(name); if (val != null) { return val; } return fsm.AddGameObjectVariable(name); } } internal static class InternalLogger { internal static ManualLogSource? Logger; internal static void LogFine(string message) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogDebug((object)message); } } internal static void LogDebug(string message) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)message); } Debug.Log((object)message); } internal static void Log(string message) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogMessage((object)message); } Debug.Log((object)message); } internal static void LogWarn(string message) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)message); } Debug.LogWarning((object)message); } internal static void LogError(string message) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)message); } Debug.LogError((object)message); } internal static void LogFatal(string message) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogFatal((object)message); } Debug.LogError((object)message); } } public class InvokeCoroutine : FsmStateAction { [CompilerGenerated] private sealed class <Coroutine>d__3 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public InvokeCoroutine <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Coroutine>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = <>4__this._coroutine(); <>1__state = 1; return true; case 1: <>1__state = -1; ((FsmStateAction)<>4__this).Finish(); 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 readonly Func<IEnumerator> _coroutine; private readonly bool _wait; public InvokeCoroutine(Func<IEnumerator> coroutine, bool wait) { _coroutine = coroutine; _wait = wait; } [IteratorStateMachine(typeof(<Coroutine>d__3))] private IEnumerator Coroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Coroutine>d__3(0) { <>4__this = this }; } public override void OnEnter() { ((FsmStateAction)this).Fsm.Owner.StartCoroutine(_wait ? Coroutine() : _coroutine()); if (!_wait) { ((FsmStateAction)this).Finish(); } } } public class InvokeMethod : FsmStateAction { private readonly Action _action; public InvokeMethod(Action action) { _action = action; } public override void OnEnter() { _action(); ((FsmStateAction)this).Finish(); } } [BepInPlugin("SilkGoddess", "SilkGoddess", "1.0.0")] public class Plugin : BaseUnityPlugin { private static Harmony _harmony; private static bool QueenScene; private static HeroController? hornet; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Debug.Log((object)"Plugin SilkGoddess (1.0.0) has loaded!"); _harmony = new Harmony("1.0.0"); MainPatches.Initialize(); _harmony.PatchAll(typeof(MainPatches)); } private void OnDestroy() { _harmony.UnpatchSelf(); AssetManager.UnloadAll(); } } } namespace SilkGoddess.Patches { internal static class BossPatches { [HarmonyPatch(typeof(PlayMakerFSM), "Start")] [HarmonyPrefix] private static void ModifySilk(PlayMakerFSM __instance) { if (((Object)__instance).name == "Silk Boss" && __instance.FsmName == "Control" && (Object)(object)((Component)__instance).gameObject.GetComponent<SilkGod>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<SilkGod>(); } if (((Object)__instance).name.StartsWith("Hand") && __instance.FsmName == "Hand Control" && (Object)(object)((Component)__instance).gameObject.GetComponent<SilkHand>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<SilkHand>(); } } [HarmonyPatch(typeof(AreaTitleController), "Start")] [HarmonyPrefix] private static void RemoveAreaTitle(AreaTitleController __instance) { Object.Destroy((Object)(object)((Component)__instance).gameObject); } [HarmonyPostfix] [HarmonyPatch(typeof(Language), "Get", new Type[] { typeof(string), typeof(string) })] private static void ChangeSilkTitle(string key, string sheetTitle, ref string __result) { //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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Invalid comparison between Unknown and I4 if (1 == 0) { } string text2; if (!(key == "SILK_SUPER")) { if (key == "SILK_MAIN") { LanguageCode val = Language.CurrentLanguage(); if (1 == 0) { } string text = (((int)val == 44) ? "SILK" : (((int)val != 117) ? __result : "실크")); if (1 == 0) { } text2 = text; } else { text2 = __result; } } else { LanguageCode val2 = Language.CurrentLanguage(); if (1 == 0) { } string text = (((int)val2 == 44) ? "Absolute Weaver" : (((int)val2 != 117) ? __result : "절대적 방직자")); if (1 == 0) { } text2 = text; } if (1 == 0) { } __result = text2; } } internal static class MainPatches { [CompilerGenerated] private sealed class <Unpatch>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IEnumerator result; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Unpatch>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (result.MoveNext()) { <>2__current = result.Current; <>1__state = 1; return true; } _harmony.UnpatchSelf(); 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 static Harmony _harmony; internal static void Initialize() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown _harmony = new Harmony("MainPatches"); } [HarmonyPrefix] [HarmonyPatch(typeof(GameManager), "Awake")] private static void InitAssetManager(GameManager __instance) { ((MonoBehaviour)__instance).StartCoroutine(AssetManager.Init()); } [HarmonyPostfix] [HarmonyPatch(typeof(GameManager), "SetLoadedGameData", new Type[] { typeof(SaveGameData), typeof(int) })] private static void PatchSilk(GameManager __instance) { GameManager __instance2 = __instance; __instance2.GetSaveStatsForSlot(PlayerData.instance.profileID, (Action<SaveStats, string>)delegate { _harmony.PatchAll(typeof(BossPatches)); ((Component)__instance2).gameObject.AddComponent<ImportLoader>(); }); } [IteratorStateMachine(typeof(<Unpatch>d__4))] [HarmonyPostfix] [HarmonyPatch(typeof(GameManager), "ReturnToMainMenu")] private static IEnumerator Unpatch(IEnumerator result) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Unpatch>d__4(0) { result = result }; } } } namespace SilkGoddess.Behaviours { internal class ImportLoader : MonoBehaviour { [CompilerGenerated] private sealed class <Start>d__9 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ImportLoader <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Start>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = AssetManager.LoadBundleAssets(); <>1__state = 1; return true; case 1: <>1__state = -1; threadstorm = ((Component)AssetManager.Get<GameObject>("Song Reed Grand SK").transform.Find("grand_reed_spell_sphere")).gameObject; burst = ((Component)AssetManager.Get<GameObject>("Song Reed Grand SK").transform.Find("Focus Blast")).gameObject; stormsound = (AudioClip)FSMUtility.LocateMyFSM(AssetManager.Get<GameObject>("Song Reed Grand SK"), "Control").GetState("Cast").GetAction<AudioPlayerOneShotSingle>(3) .audioClip.Value; circlef = AssetManager.Get<GameObject>("Cross Slash"); wraith = AssetManager.Get<GameObject>("Wraith"); wraithanim = AssetManager.Get<GameObject>("Wraith Anim"); wraithsprite = AssetManager.Get<GameObject>("Wraith Cln").GetComponent<tk2dSpriteCollectionData>(); stormanim = AssetManager.Get<RuntimeAnimatorController>("spell_sphere"); burstanim = AssetManager.Get<RuntimeAnimatorController>("focus_blast_grand_reed"); threadstorm.GetComponent<Animator>().runtimeAnimatorController = stormanim; burst.GetComponent<Animator>().runtimeAnimatorController = burstanim; wraith.GetComponent<tk2dSpriteAnimator>().Library = wraithanim.GetComponent<tk2dSpriteAnimation>(); ((tk2dBaseSprite)wraith.GetComponent<tk2dSprite>()).collection = wraithsprite; ((Behaviour)((Component)threadstorm.transform.Find("damager")).GetComponent<CircleCollider2D>()).enabled = true; Object.Destroy((Object)(object)((Component)circlef.transform.Find("lace")).gameObject); Object.Destroy((Object)(object)((Component)circlef.transform.Find("hero damager")).gameObject); Object.Destroy((Object)(object)((Component)threadstorm.transform.Find("sphere_ground_blast")).gameObject); Object.Destroy((Object)(object)((Component)threadstorm.transform.Find("Particle_rocks_small")).gameObject); Object.Destroy((Object)(object)threadstorm.GetComponent<CameraControlAnimationEvents>()); Object.Destroy((Object)(object)threadstorm.GetComponent<DeactivateAfterDelay>()); Object.Destroy((Object)(object)((Component)burst.transform.Find("damager")).gameObject); Debug.Log((object)"EVERYTHING loaded in!"); wraith.SetActive(false); threadstorm.SetActive(false); burst.SetActive(false); 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(); } } internal static GameObject threadstorm; internal static GameObject burst; internal static GameObject circlef; internal static GameObject wraith; internal static GameObject wraithanim; internal static RuntimeAnimatorController stormanim; internal static RuntimeAnimatorController burstanim; internal static tk2dSpriteCollectionData wraithsprite; internal static AudioClip stormsound; [IteratorStateMachine(typeof(<Start>d__9))] private IEnumerator Start() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Start>d__9(0) { <>4__this = this }; } internal static GameObject GetThreadStorm() { return threadstorm; } internal static GameObject GetWraith() { return wraith; } internal static GameObject GetCircle() { return circlef; } internal static GameObject GetBurst() { return burst; } internal static AudioClip GetAudioStorm() { return stormsound; } private void OnDestroy() { AssetManager.UnloadManualBundles(); } } internal class Circleslash : MonoBehaviour { [CompilerGenerated] private sealed class <Delaydeactivate>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Circleslash <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Delaydeactivate>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; ((Component)<>4__this).gameObject.SetActive(false); 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 PlayMakerFSM _control = null; private void Awake() { ((MonoBehaviour)this).StartCoroutine(Delaydeactivate()); Debug.Log((object)"krilled lace"); } [IteratorStateMachine(typeof(<Delaydeactivate>d__2))] private IEnumerator Delaydeactivate() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Delaydeactivate>d__2(0) { <>4__this = this }; } } [RequireComponent(typeof(tk2dSpriteAnimator))] [RequireComponent(typeof(Rigidbody2D))] [RequireComponent(typeof(PlayMakerFSM))] internal class SilkGod : MonoBehaviour { [CompilerGenerated] private sealed class <FirstRadialDelay>d__18 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SilkGod <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FirstRadialDelay>d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.6f); <>1__state = 1; return true; case 1: <>1__state = -1; FSMUtility.LocateMyFSM(<>4__this.first.value, "Hand Control").SetState("Radial Swipe"); 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(); } } [CompilerGenerated] private sealed class <FirstStormDelay>d__21 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SilkGod <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FirstStormDelay>d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be