示例#1
0
 // Fetch the Quick Menu instance
 public static MonoBehaviourPublicObAuSpObBoSpGaBoInSpUnique GetQuickMenuInstance()
 {
     if (quickmenuInstance == null)
     {
         quickmenuInstance = MonoBehaviourPublicObAuSpObBoSpGaBoInSpUnique.prop_MonoBehaviourPublicObAuSpObBoSpGaBoInSpUnique_0;
     }
     return(quickmenuInstance);
 }
示例#2
0
        // Show a Quick Menu page via the Page Name. Hope to god this works!
        public static void ShowQuickmenuPage(string pagename)
        {
            MonoBehaviourPublicObAuSpObBoSpGaBoInSpUnique quickmenu = GetQuickMenuInstance();
            Transform pageTransform = quickmenu?.transform.Find(pagename);

            if (pageTransform == null)
            {
                Console.WriteLine("[QMStuff] pageTransform is null !");
            }

            if (currentPageGetter == null)
            {
                GameObject shortcutMenu = quickmenu.transform.Find("ShortcutMenu").gameObject;
                if (!shortcutMenu.activeInHierarchy)
                {
                    shortcutMenu = quickmenu.transform.Find("UserInteractMenu").gameObject;
                }


                FieldInfo[] fis = Il2CppType.Of <MonoBehaviourPublicObAuSpObBoSpGaBoInSpUnique>().GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where((fi) => fi.FieldType == Il2CppType.Of <GameObject>()).ToArray();
                //MelonLoader.MelonModLogger.Log("[QMStuff] GameObject Fields in QuickMenu:");
                int count = 0;
                foreach (FieldInfo fi in fis)
                {
                    GameObject value = fi.GetValue(quickmenu)?.TryCast <GameObject>();
                    if (value == shortcutMenu && ++count == 2)
                    {
                        //MelonLoader.MelonModLogger.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);

            GameObject infoBar = GetQuickMenuInstance().transform.Find("QuickMenu_NewElements/_InfoBar").gameObject;

            infoBar.SetActive(pagename == "ShortcutMenu");

            MonoBehaviourPublicGaBuGaBoBuObGaAPObInUnique quickmenuContextualDisplay = GetQuickMenuInstance().field_Private_MonoBehaviourPublicGaBuGaBoBuObGaAPObInUnique_0;

            quickmenuContextualDisplay.Method_Public_Void_EnumNPublicSealedvaUnNoToUs7vUsNoUnique_0(MonoBehaviourPublicGaBuGaBoBuObGaAPObInUnique.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);
            }
        }