public static void OpenPage(string page, bool setCurrentTab = true) { GameObject pageGameObject = GameObject.Find(page); if (pageGameObject == null) { MelonLoader.MelonLogger.Error($"Page with path {page} could not be found"); return; } CurrentMenu.SetActive(false); if (page.Split('/').Last() == "ShortcutMenu") { SetMenuIndex(0); } else { QuickMenu.prop_QuickMenu_0.field_Private_Int32_0 = -1; CurrentMenu = pageGameObject; } CurrentTabMenu.SetActive(false); if (setCurrentTab) { CurrentTabMenu = pageGameObject; } QuickMenuContextualDisplay quickMenuContextualDisplay = QuickMenu.prop_QuickMenu_0.field_Private_QuickMenuContextualDisplay_0; QuickMenuContexualDisplayMethod.Invoke(quickMenuContextualDisplay, new object[] { QuickMenuContextualDisplayEnum.GetEnumValues().GetValue(Array.IndexOf(QuickMenuContextualDisplayEnum.GetEnumNames(), "NoSelection")) }); pageGameObject.SetActive(true); }
public static void ShowQuickmenuPage(string pagename) { QuickMenu quickmenu = GetQuickMenuInstance(); Transform pageTransform = quickmenu?.transform.Find(pagename); if (currentPageGetter == null) { GameObject shortcutMenu = quickmenu.transform.Find("ShortcutMenu").gameObject; if (!shortcutMenu.activeInHierarchy) { shortcutMenu = quickmenu.transform.Find("UserInteractMenu").gameObject; } FieldInfo[] fis = Il2CppType.Of <QuickMenu>().GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where((fi) => fi.FieldType == Il2CppType.Of <GameObject>()).ToArray(); int count = 0; foreach (FieldInfo fi in fis) { GameObject value = fi.GetValue(quickmenu)?.TryCast <GameObject>(); if (value == shortcutMenu && ++count == 2) { currentPageGetter = fi; break; } } if (currentPageGetter == null) { Console.WriteLine("[QMStuff] Unable to find field currentPage in QuickMenu"); return; } } currentPageGetter.GetValue(quickmenu)?.Cast <GameObject>().SetActive(false); GameObject infoBar = GetQuickMenuInstance().transform.Find("QuickMenu_NewElements/_InfoBar").gameObject; infoBar.SetActive(pagename == "ShortcutMenu"); QuickMenuContextualDisplay quickmenuContextualDisplay = GetQuickMenuInstance().field_Private_QuickMenuContextualDisplay_0; quickmenuContextualDisplay.Method_Public_Void_EnumNPublicSealedvaUnNoToUs7vUsNoUnique_0(QuickMenuContextualDisplay.EnumNPublicSealedvaUnNoToUs7vUsNoUnique.NoSelection); //quickmenuContextualDisplay.Method_Public_Nested0_0(QuickMenuContextualDisplay.Nested0.NoSelection); pageTransform.gameObject.SetActive(true); currentPageGetter.SetValue(quickmenu, pageTransform.gameObject); if (pagename == "ShortcutMenu") { SetIndex(0); } else if (pagename == "UserInteractMenu") { SetIndex(3); } else { SetIndex(-1); } }
// VRCTools ShowQuickMenuPage function internal static void ShowQuickmenuPage(string pagename) { QuickMenu quickmenu = QMStuff.GetQuickMenuInstance(); Transform pageTransform = quickmenu?.transform.Find(pagename); if (pageTransform == null) { VRCModLogger.LogError("[QMStuff] pageTransform is null !"); } if (currentPageGetter == null) { GameObject shortcutMenu = quickmenu.transform.Find("ShortcutMenu").gameObject; FieldInfo[] fis = typeof(QuickMenu).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where((fi) => fi.FieldType == typeof(GameObject)).ToArray(); VRCModLogger.Log("[QMStuff] GameObject Fields in QuickMenu:"); int count = 0; foreach (FieldInfo fi in fis) { GameObject value = fi.GetValue(quickmenu) as GameObject; if (value == shortcutMenu && ++count == 2) { VRCModLogger.Log("[QMStuff] currentPage field: " + fi.Name); currentPageGetter = fi; break; } } if (currentPageGetter == null) { VRCModLogger.LogError("[QMStuff] Unable to find field currentPage in QuickMenu"); return; } } ((GameObject)currentPageGetter.GetValue(quickmenu))?.SetActive(false); QMStuff.GetQuickMenuInstance().transform.Find("QuickMenu_NewElements/_InfoBar").gameObject.SetActive(false); if (quickmenuContextualDisplayGetter != null) { quickmenuContextualDisplayGetter = typeof(QuickMenu).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault((fi) => fi.FieldType == typeof(QuickMenuContextualDisplay)); } QuickMenuContextualDisplay quickmenuContextualDisplay = quickmenuContextualDisplayGetter?.GetValue(quickmenu) as QuickMenuContextualDisplay; if (quickmenuContextualDisplay != null) { currentPageGetter.SetValue(quickmenu, pageTransform.gameObject); typeof(QuickMenuContextualDisplay).GetMethod("SetDefaultContext", BindingFlags.Public | BindingFlags.Instance).Invoke(quickmenuContextualDisplay, new object[] { 0, null, null }); // This is the only way to pass the unknown enum type value } currentPageGetter.SetValue(quickmenu, pageTransform.gameObject); typeof(QuickMenu).GetMethod("SetContext", BindingFlags.Public | BindingFlags.Instance).Invoke(quickmenu, new object[] { 1, null, null }); // This is the only way to pass the unknown enum type value pageTransform.gameObject.SetActive(true); }
//Partial reproduction of SetMenuIndex from QuickMenu public static void ShowQuickmenuPage(string pagename) { QuickMenu quickmenu = GetQuickMenuInstance(); Transform pageTransform = quickmenu?.transform.Find(pagename); if (pageTransform == null) { Console.WriteLine("[QuickMenuUtils] pageTransform is null !"); } if (currentPageGetter == null) { GameObject shortcutMenu = quickmenu.transform.Find("ShortcutMenu").gameObject; if (!shortcutMenu.activeInHierarchy) { shortcutMenu = quickmenu.transform.Find("UserInteractMenu").gameObject; } FieldInfo[] fis = typeof(QuickMenu).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where((fi) => fi.FieldType == typeof(GameObject)).ToArray(); //emmVRCLoader.Logger.Log("[QuickMenuUtils] GameObject Fields in QuickMenu:"); int count = 0; foreach (FieldInfo fi in fis) { GameObject value = fi.GetValue(quickmenu) as GameObject; if (value == shortcutMenu && ++count == 2) { //emmVRCLoader.Logger.Log("[QuickMenuUtils] currentPage field: " + fi.Name); currentPageGetter = fi; break; } } if (currentPageGetter == null) { Console.WriteLine("[QuickMenuUtils] Unable to find field currentPage in QuickMenu"); return; } } ((GameObject)currentPageGetter.GetValue(quickmenu))?.SetActive(false); GameObject infoBar = GetQuickMenuInstance().transform.Find("QuickMenu_NewElements/_InfoBar").gameObject; infoBar.SetActive(pagename == "ShortcutMenu"); if (quickmenuContextualDisplayGetter != null) { quickmenuContextualDisplayGetter = typeof(QuickMenu).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault((fi) => fi.FieldType == typeof(QuickMenuContextualDisplay)); } QuickMenuContextualDisplay quickmenuContextualDisplay = quickmenuContextualDisplayGetter?.GetValue(quickmenu) as QuickMenuContextualDisplay; if (quickmenuContextualDisplay != null) { currentPageGetter.SetValue(quickmenu, pageTransform.gameObject); typeof(QuickMenuContextualDisplay).GetMethod("SetDefaultContext", BindingFlags.Public | BindingFlags.Instance).Invoke(quickmenuContextualDisplay, new object[] { 0, null, null }); // This is the only way to pass the unknown enum type value } currentPageGetter.SetValue(quickmenu, pageTransform.gameObject); typeof(QuickMenu).GetMethod("SetContext", BindingFlags.Public | BindingFlags.Instance).Invoke(quickmenu, new object[] { 1, null, null }); // This is the only way to pass the unknown enum type value pageTransform.gameObject.SetActive(true); if (pagename == "ShortcutMenu") { SetIndex(0); } else if (pagename == "UserInteractMenu") { SetIndex(3); } else { SetIndex(-1); } }
public static void ShowQuickmenuPage(string pagename) { QuickMenu quickMenuInstance = GetQuickMenuInstance(); Transform transform = (quickMenuInstance != null) ? quickMenuInstance.transform.Find(pagename) : null; if (transform == null) { Console.WriteLine("[QuickMenuUtils] pageTransform is null !"); } if (currentPageGetter == null) { if (currentPageGetter == null) { GameObject gameObject = quickMenuInstance.transform.Find("ShortcutMenu").gameObject; FieldInfo[] array = (from fi in typeof(QuickMenu).GetFields(BindingFlags.Instance | BindingFlags.NonPublic) where fi.FieldType == typeof(GameObject) select fi).ToArray <FieldInfo>(); int num = 0; foreach (FieldInfo fieldInfo in array) { if (fieldInfo.GetValue(quickMenuInstance) as GameObject == gameObject && ++num == 2) { currentPageGetter = fieldInfo; break; } } } if (currentPageGetter == null) { GameObject gameObject = quickMenuInstance.transform.Find("UserInteractMenu").gameObject; FieldInfo[] array = (from fi in typeof(QuickMenu).GetFields(BindingFlags.Instance | BindingFlags.NonPublic) where fi.FieldType == typeof(GameObject) select fi).ToArray <FieldInfo>(); int num = 0; foreach (FieldInfo fieldInfo in array) { if (fieldInfo.GetValue(quickMenuInstance) as GameObject == gameObject && ++num == 2) { currentPageGetter = fieldInfo; break; } } } if (currentPageGetter == null) { Console.WriteLine("[QuickMenuUtils] Unable to find field currentPage in QuickMenu"); return; } } GameObject gameObject2 = (GameObject)currentPageGetter.GetValue(quickMenuInstance); if (gameObject2 != null) { gameObject2.SetActive(false); } GetQuickMenuInstance().transform.Find("QuickMenu_NewElements/_InfoBar").gameObject.SetActive(false); if (quickmenuContextualDisplayGetter != null) { quickmenuContextualDisplayGetter = typeof(QuickMenu).GetFields(BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault((FieldInfo fi) => fi.FieldType == typeof(QuickMenuContextualDisplay)); } FieldInfo fieldInfo2 = quickmenuContextualDisplayGetter; QuickMenuContextualDisplay quickMenuContextualDisplay = ((fieldInfo2 != null) ? fieldInfo2.GetValue(quickMenuInstance) : null) as QuickMenuContextualDisplay; if (quickMenuContextualDisplay != null) { currentPageGetter.SetValue(quickMenuInstance, transform.gameObject); quickMenuContextualDisplay.Method_Public_Nested0_0(QuickMenuContextualDisplay.Nested0.NoSelection); } currentPageGetter.SetValue(quickMenuInstance, transform.gameObject); quickMenuContextualDisplay.Method_Public_Nested0_0(QuickMenuContextualDisplay.Nested0.NoSelection); transform.gameObject.SetActive(true); }
// Show a Quick Menu page via the Page Name. Hope to god this works! public static void ShowQuickmenuPage(string pagename) { var quickmenu = GetQuickMenuInstance(); var pageTransform = quickmenu.transform.Find(pagename); if (pageTransform == null) { Console.WriteLine("[QMStuff] pageTransform is null !"); } if (currentPageGetter == null) { var shortcutMenu = quickmenu.transform.Find("ShortcutMenu").gameObject; if (shortcutMenu != null && !shortcutMenu.activeInHierarchy) { shortcutMenu = quickmenu.transform.Find("UserInteractMenu").gameObject; } var fis = Il2CppType.Of <QuickMenu>().GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where((fi) => fi.FieldType == Il2CppType.Of <GameObject>()).ToArray(); //MelonLoader.MelonLogger.Log("[QMStuff] GameObject Fields in QuickMenu:"); int count = 0; foreach (var fi in fis) { var value = fi.GetValue(quickmenu)?.TryCast <GameObject>(); if (value != shortcutMenu || ++count != 2) { continue; } //MelonLoader.MelonLogger.Log("[QMStuff] currentPage field: " + fi.Name); currentPageGetter = fi; break; } if (currentPageGetter == null) { Console.WriteLine("[QMStuff] Unable to find field currentPage in QuickMenu"); return; } } currentPageGetter.GetValue(quickmenu)?.Cast <GameObject>().SetActive(false); var infoBar = GetQuickMenuInstance().transform.Find("QuickMenu_NewElements/_InfoBar").gameObject; infoBar.SetActive(pagename == "ShortcutMenu"); QuickMenuContextualDisplay quickmenuContextualDisplay = GetQuickMenuInstance().field_Private_QuickMenuContextualDisplay_0; quickmenuContextualDisplay.Method_Public_Void_EnumNPublicSealedvaUnNoToUs7vUsNoUnique_0(QuickMenuContextualDisplay.EnumNPublicSealedvaUnNoToUs7vUsNoUnique.NoSelection); //quickmenuContextualDisplay.Method_Public_Nested0_0(QuickMenuContextualDisplay.Nested0.NoSelection); pageTransform.gameObject.SetActive(true); currentPageGetter.SetValue(quickmenu, pageTransform.gameObject); switch (pagename) { case "ShortcutMenu": SetIndex(0); break; case "UserInteractMenu": SetIndex(3); break; default: SetIndex(-1); break; } }
public static void ShowCustomMenu(string index) { var quickMenu = Wrappers.GetQuickMenu(); var Menu = quickMenu.transform.Find(index); if (Menu == null) { GameObject gameObject2 = (GameObject)currentPageGetter.GetValue(quickMenu); gameObject2.SetActive(true); quickMenu.transform.Find("QuickMenu_NewElements/_InfoBar").gameObject.SetActive(true); } else { GameObject gameObject = quickMenu.transform.Find("ShortcutMenu").gameObject; FieldInfo[] array = (from fi in typeof(QuickMenu).GetFields(BindingFlags.Instance | BindingFlags.Public) where fi.FieldType == typeof(GameObject) select fi).ToArray <FieldInfo>(); int num = 0; foreach (FieldInfo fieldInfo in array) { if (fieldInfo.GetValue(quickMenu) as GameObject == gameObject && ++num == 2) { currentPageGetter = fieldInfo; break; } } if (currentPageGetter != null) { GameObject Active = (GameObject)currentPageGetter.GetValue(quickMenu); Active.SetActive(false); quickMenu.transform.Find("QuickMenu_NewElements/_InfoBar").gameObject.SetActive(false); quickmenuContextualDisplayGetter = typeof(QuickMenu).GetFields(BindingFlags.Instance | BindingFlags.Public).FirstOrDefault((FieldInfo fi) => fi.FieldType == typeof(QuickMenuContextualDisplay)); FieldInfo fieldInfo2 = quickmenuContextualDisplayGetter; if (fieldInfo2 == null) { return; } QuickMenuContextualDisplay quickMenuContextualDisplay = ((fieldInfo2 != null) ? fieldInfo2.GetValue(quickMenu) : null) as QuickMenuContextualDisplay; if (quickMenuContextualDisplay == null) { return; } currentPageGetter.SetValue(quickMenu, Menu.gameObject); MethodBase method = typeof(QuickMenuContextualDisplay).GetMethod("SetDefaultContext", BindingFlags.Instance | BindingFlags.Public); object obj = quickMenuContextualDisplay; object[] array3 = new object[3]; array3[0] = 0; method.Invoke(obj, array3); currentPageGetter.SetValue(quickMenu, Menu.gameObject); MethodBase method2 = typeof(QuickMenu).GetMethod("SetContext", BindingFlags.Instance | BindingFlags.Public); object obj2 = quickMenu; object[] array4 = new object[3]; array4[0] = 1; method2.Invoke(obj2, array4); Menu.gameObject.SetActive(true); } } // THIS IS CREDITS TO DUBYADUDE HERE }
public static void OpenPlayerInQuickMenu(Player player) { InputManager.SelectPlayer(player.field_Internal_VRCPlayer_0); QuickMenuContextualDisplay.Method_Public_Static_Void_VRCPlayer_0(player.field_Internal_VRCPlayer_0); }
public static void ShowQuickmenuPage(string pagename) { QuickMenu quickMenuInstance = GetQuickMenuInstance(); Transform transform = (quickMenuInstance != null) ? quickMenuInstance.transform.Find(pagename) : null; if (transform == null) { Console.WriteLine("[QuickMenuUtils] pageTransform is null !"); } if (currentPageGetter == null) { if (currentPageGetter == null) { GameObject gameObject = quickMenuInstance.transform.Find("ShortcutMenu").gameObject; FieldInfo[] array = (from fi in typeof(QuickMenu).GetFields(BindingFlags.Instance | BindingFlags.NonPublic) where fi.FieldType == typeof(GameObject) select fi).ToArray <FieldInfo>(); //Console.WriteLine("[QuickMenuUtils] GameObject Fields in QuickMenu:"); int num = 0; foreach (FieldInfo fieldInfo in array) { if (fieldInfo.GetValue(quickMenuInstance) as GameObject == gameObject && ++num == 2) { //Console.WriteLine("[QuickMenuUtils] currentPage field: " + fieldInfo.Name); currentPageGetter = fieldInfo; break; } } } if (currentPageGetter == null) { GameObject gameObject = quickMenuInstance.transform.Find("UserInteractMenu").gameObject; FieldInfo[] array = (from fi in typeof(QuickMenu).GetFields(BindingFlags.Instance | BindingFlags.NonPublic) where fi.FieldType == typeof(GameObject) select fi).ToArray <FieldInfo>(); //Console.WriteLine("[QuickMenuUtils] GameObject Fields in QuickMenu:"); int num = 0; foreach (FieldInfo fieldInfo in array) { if (fieldInfo.GetValue(quickMenuInstance) as GameObject == gameObject && ++num == 2) { //Console.WriteLine("[QuickMenuUtils] currentPage field: " + fieldInfo.Name); currentPageGetter = fieldInfo; break; } } } if (currentPageGetter == null) { Console.WriteLine("[QuickMenuUtils] Unable to find field currentPage in QuickMenu"); return; } } GameObject gameObject2 = (GameObject)currentPageGetter.GetValue(quickMenuInstance); if (gameObject2 != null) { gameObject2.SetActive(false); } GetQuickMenuInstance().transform.Find("QuickMenu_NewElements/_InfoBar").gameObject.SetActive(false); if (quickmenuContextualDisplayGetter != null) { quickmenuContextualDisplayGetter = typeof(QuickMenu).GetFields(BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault((FieldInfo fi) => fi.FieldType == typeof(QuickMenuContextualDisplay)); } FieldInfo fieldInfo2 = quickmenuContextualDisplayGetter; QuickMenuContextualDisplay quickMenuContextualDisplay = ((fieldInfo2 != null) ? fieldInfo2.GetValue(quickMenuInstance) : null) as QuickMenuContextualDisplay; if (quickMenuContextualDisplay != null) { currentPageGetter.SetValue(quickMenuInstance, transform.gameObject); MethodBase method = typeof(QuickMenuContextualDisplay).GetMethod("SetDefaultContext", BindingFlags.Instance | BindingFlags.Public); object obj = quickMenuContextualDisplay; object[] array3 = new object[3]; array3[0] = 0; method.Invoke(obj, array3); } currentPageGetter.SetValue(quickMenuInstance, transform.gameObject); MethodBase method2 = typeof(QuickMenu).GetMethod("SetContext", BindingFlags.Instance | BindingFlags.Public); object obj2 = quickMenuInstance; object[] array4 = new object[3]; array4[0] = 1; method2.Invoke(obj2, array4); transform.gameObject.SetActive(true); }