public static void StopAnimation(ItemEquippable item = null) { if (ActiveItem?.Owner?.IsLocallyOwned != true) { return; } Instance.LogDebug("Aborting animation coroutine"); if (item != null && item.Owner != ActiveItem.Owner) { Instance.LogError("The item is not owned by the local player."); return; } ActiveItem.StopCoroutine(AnimationSequence); if (item != null) { var gearPartHolder = item.GearPartHolder; gearPartHolder.FrontPartAnimator?.Rebind(); gearPartHolder.ReceiverPartAnimator?.Rebind(); gearPartHolder.StockPartAnimator?.Rebind(); ActiveItem.Owner.AnimatorArms.Rebind(); // This resets the animation weights, which fixes the // funky fingers created by rebinding AnimatorArms. ActiveItem.Owner.Inventory.PlayAnimationsForWieldedItem(); } ActiveItem = null; AnimationSequence = null; }
public void initButton(int btnXLocation, int btnYLocation, String btnText, String btnToolTip, Color?btnBackgroundColor = null, Color?btnTextColor = null, Color?backbtnBackgroundColor = null, Color?backbtnTextColor = null) { btnType = "NestedButton"; Transform menu = UnityEngine.Object.Instantiate <Transform>(QMStuff.NestedMenuTemplate(), QMStuff.GetQuickMenuInstance().transform); menuName = QMButtonAPI.identifier + btnQMLoc + "_" + btnXLocation + "_" + btnYLocation; menu.name = menuName; mainButton = new QMSingleButton(btnQMLoc, btnXLocation, btnYLocation, btnText, () => { QMStuff.ShowQuickmenuPage(menuName); }, btnToolTip, btnBackgroundColor, btnTextColor); Il2CppSystem.Collections.IEnumerator enumerator = menu.transform.GetEnumerator(); while (enumerator.MoveNext()) { Il2CppSystem.Object obj = enumerator.Current; Transform btnEnum = obj.Cast <Transform>(); if (btnEnum != null) { UnityEngine.Object.Destroy(btnEnum.gameObject); } } if (backbtnTextColor == null) { backbtnTextColor = Color.yellow; } QMButtonAPI.allNestedButtons.Add(this); backButton = new QMSingleButton(this, 5, 2, "Back", () => { QMStuff.ShowQuickmenuPage(btnQMLoc); }, "Go Back", backbtnBackgroundColor, backbtnTextColor); }
private void initButton(int btnXLocation, int btnYLocation, bool btnHalf, string btnText, string btnToolTip, System.Action action = null, Color?btnBackgroundColor = null, Color?btnTextColor = null, Color?backbtnBackgroundColor = null, Color?backbtnTextColor = null) { btnType = "NestedButton"; Transform menu = Object.Instantiate(QMStuff.NestedMenuTemplate(), QMStuff.GetQuickMenuInstance().transform); menuName = "PureMOD" + btnQMLoc + "_" + btnXLocation + "_" + btnYLocation; menu.name = menuName; mainButton = new SingleButton(btnQMLoc, btnXLocation, btnYLocation, btnHalf, btnText, btnToolTip, delegate() { if (action != null) { action.Invoke(); } QMStuff.ShowQuickmenuPage(menuName); }, btnBackgroundColor, btnTextColor); Il2CppSystem.Collections.IEnumerator enumerator = menu.transform.GetEnumerator(); while (enumerator.MoveNext()) { GameObject.Destroy(enumerator.Current.Cast <Transform>()?.gameObject); } if (backbtnTextColor == null) { backbtnTextColor = Color.yellow; } backButton = new SingleButton(menuName, 5, 5, true, "Back", "Go Back", delegate() { QMStuff.ShowQuickmenuPage(btnQMLoc); }, backbtnTextColor, backbtnBackgroundColor); }
/// <summary> /// WARNING: Pubternal API (internal). Do not use. May change during any update. /// </summary> /// <param name="coroutine"></param> /// <returns></returns> public static Coroutine Start(IEnumerator coroutine) { #if IL2CPP var wrapper = new Il2CppSystem.Collections.IEnumerator(new Il2CppManagedEnumerator(coroutine).Pointer); return(PluginLoader.MonoBehaviour.StartCoroutine(wrapper)); #else return(PluginLoader.MonoBehaviour.StartCoroutine(coroutine)); #endif }
public static bool Prefix(IntroCutscene __instance, ref Il2CppSystem.Collections.IEnumerator __result) { if (!CustomOptionHolder.activateRoles.getBool()) { return(true); // Don't override the intro of the vanilla roles } __result = setupRole(__instance).WrapToIl2Cpp(); return(false); }
public void ClearButtons() { Il2CppSystem.Collections.IEnumerator enumerator = CachedMenu.transform.GetEnumerator(); while (enumerator.MoveNext()) { Il2CppSystem.Object obj = enumerator.Current; Transform btnEnum = obj.Cast <Transform>(); if (btnEnum != null) { UnityEngine.Object.Destroy(btnEnum.gameObject); } } }
public static void ClearPage(string pagename) { QuickMenu quickmenu = GetQuickMenuInstance(); Transform pageTransform = quickmenu?.transform.Find(pagename); Il2CppSystem.Collections.IEnumerator enumerator = pageTransform.transform.GetEnumerator(); while (enumerator.MoveNext()) { Il2CppSystem.Object obj = enumerator.Current; Transform btnEnum = obj.Cast <Transform>(); if (btnEnum != null) { UnityEngine.Object.Destroy(btnEnum.gameObject); } } }
private static void ItemEquippable__DoTriggerWeaponAnimSequence__Postfix( ItemEquippable __instance, ref Il2CppSystem.Collections.IEnumerator __result) { // Even though this shouldn't happen, check just in case. if (!__instance.Owner.IsLocallyOwned) { return; } if (__instance != __instance.Owner.Inventory.WieldedItem) { Instance.LogWarning($"{nameof(ItemEquippable.DoTriggerWeaponAnimSequence)} was called on an item that isn't being wielded?"); return; } Instance.LogDebug("Starting animation coroutine"); ActiveItem = __instance; AnimationSequence = __result; }
public Il2CppEnumeratorWrapper(Il2CppSystem.Collections.IEnumerator il2CppEnumerator) => _il2CPPEnumerator = il2CppEnumerator;
public Coroutine StartCoroutine(Il2CppSystem.Collections.IEnumerator routine) => throw new NotImplementedException();
private IEnumerator InitButtonNew(string Name, string base64image, string ImageURL, byte[] imagebytes) { menuName = QMButtonAPI.identifier + "_Custom_Menu_" + Name; while (MonoBehaviourPublicObCoGaCoObCoObCoUnique.prop_MonoBehaviourPublicObCoGaCoObCoObCoUnique_0 == null || MonoBehaviourPublicObCoGaCoObCoObCoUnique.prop_MonoBehaviourPublicObCoGaCoObCoObCoUnique_0.field_Public_ArrayOf_GameObject_0 == null) { yield return(null); } byte[] imagedata = null; if (base64image != null && ImageURL == null && imagebytes == null) { imagedata = Convert.FromBase64String(base64image); } else if (ImageURL != null && base64image == null && imagebytes == null) { WebClient wc = new WebClient(); imagedata = wc.DownloadData(ImageURL); } else if (imagebytes != null && ImageURL == null && base64image == null) { imagedata = imagebytes; } else { MelonLoader.MelonLogger.Error("Well Shit someone is dumb"); yield break; } Texture2D icontexture = new Texture2D(2, 2, TextureFormat.ARGB32, false); ImageConversion.LoadImage(icontexture, imagedata); Transform menu = UnityEngine.Object.Instantiate <Transform>(QMStuff.NestedMenuTemplate(), QMStuff.GetQuickMenuInstance().transform); menu.name = menuName; var TabButton = GameObject.Instantiate(GameObject.Find("UserInterface/QuickMenu/QuickModeTabs/NotificationsTab"), GameObject.Find("UserInterface/QuickMenu/QuickModeTabs").transform); TabButton.name = QMButtonAPI.identifier + "_" + Name; GameObject.Destroy(TabButton.transform.Find("Badge")); TabButton.GetComponent <Button>().onClick = new Button.ButtonClickedEvent(); TabButton.GetComponent <Button>().onClick.AddListener((Action) delegate() { QMStuff.ShowQuickmenuPage(menuName); }); TabButton.transform.Find("Icon").GetComponent <Image>().sprite = new Sprite(); TabButton.transform.Find("Icon").GetComponent <Image>().material = new Material(TabButton.transform.Find("Icon").GetComponent <Image>().material) { mainTexture = icontexture }; Il2CppSystem.Collections.IEnumerator enumerator = menu.transform.GetEnumerator(); while (enumerator.MoveNext()) { Il2CppSystem.Object obj = enumerator.Current; Transform btnEnum = obj.Cast <Transform>(); if (btnEnum != null) { UnityEngine.Object.Destroy(btnEnum.gameObject); } } QMButtonAPI.allNestedButtons.Add(this); backButton = new QMSingleButton(this, 5, 2, "Back", () => { QMStuff.ShowQuickmenuPage("ShortcutMenu"); }, "Go Back", Color.cyan, Color.yellow); yield break; }
public ManagedEnumerator(Il2CppSystem.Collections.IEnumerator enumerator) { _enumerator = enumerator; }
public ManagedIl2CppEnumerator(Il2CppSystem.Collections.IEnumerator enumerator) { this.enumerator = enumerator ?? throw new ArgumentNullException(nameof(enumerator)); }