public static QuickMenu ReadQuickMenuData() { QuickMenu menu = new QuickMenu(); menu.ReadXml(AppContext.Instance.Settings.QuickMenuFileName); return menu; }
// Show a Quick Menu page via the Page Name. Hope to god this works! public static void ShowQuickmenuPage(string pagename) { QuickMenu 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 <QuickMenu>().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"); 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 (shortcutMenu == null) { shortcutMenu = QuickMenu.prop_QuickMenu_0.transform.Find("ShortcutMenu")?.gameObject; } if (userInteractMenu == null) { userInteractMenu = QuickMenu.prop_QuickMenu_0.transform.Find("UserInteractMenu")?.gameObject; } if (pagename == "ShortcutMenu") { SetIndex(0); } else if (pagename == "UserInteractMenu") { SetIndex(3); } else { SetIndex(-1); shortcutMenu?.SetActive(false); userInteractMenu?.SetActive(false); } }
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); }
//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 Player GetSelectedPlayer(this QuickMenu instance) { APIUser apiUser = instance.field_Private_APIUser_0; return(PlayerWrapper.GetPlayer(apiUser.id)); }
public async Task <bool> InteractWithDisplay() { Point lookingAt = PlayerLookingAt; Exhibit ex = ExhibitAt(lookingAt.X, lookingAt.Y); if (ex == null) { return(false); } RenderState.DrawCloseup = true; RenderState.Closeup = ex; RenderState.DrawStatic = ex.StaticBeforeCoin; await TextArea.PrintLine(ex.IntroductionText); await TextArea.PrintLine(); await TextArea.PrintLineCentered(ex.LongName + " ", ex.TitleColor); if (ex.IsClosed) { await TextArea.PrintLineCentered(" - Exhibit closed - ", ex.TitleColor); await TextArea.PrintLine(); await GameControl.WaitForKey(); return(true); } await TextArea.PrintLineCentered(ex.InsertCoinText + " ", ex.TitleColor); await TextArea.PrintLine(); await GameControl.WaitForKey(); if (ex.RequiresCoin == false) { RenderState.DrawStatic = false; await RunExhibit(ex); } else { if (ex.HasBeenVisited == false) { await TextArea.PrintLine("You haven't used this exhibit."); } else { await TextArea.PrintLine(); } if (Options.DisableExhibitsRequireCoins == false && ex.PlayerHasCoin == false) { await NeedsCoinMessage(ex); await GameControl.WaitAsync(500); return(true); } else { await TextArea.PrintLine(ex.UseCoinMessage); await TextArea.PrintLine(); int choice = await QuickMenu.QuickMenu(new MenuItemList("Yes", "no"), 3); if (choice == 1) { return(true); } if (Options.DisableExhibitsRequireCoins == false) { ex.UseCoin(); } RenderState.DrawStatic = false; await RunExhibit(ex); } } return(true); }
public static bool get_IsOnRightHand(this QuickMenu quickMenu) { return((bool)QuickMenuUtils.get_IsOnRightHand_Method.Invoke(quickMenu, null)); }
static APIUser smethod_1(QuickMenu quickMenu_0) { return(quickMenu_0.SelectedUser); }
public static bool get_canRecvReqInvite(this QuickMenu quickMenu) { return((bool)QuickMenuUtils.get_canRecvReqInvite_Method.Invoke(quickMenu, null)); }
public static bool get_IsActive(this QuickMenu quickMenu) { return((bool)QuickMenuUtils.get_IsActive_Method.Invoke(quickMenu, null)); }
public Slider(string label, float x, float y, float min, float max, float initial, Transform parent, Action <float> OnChange) { QuickMenu qm = QuickMenu.prop_QuickMenu_0; this.OnChange = OnChange; GameObject slider = UnityEngine.Object.Instantiate(BaseSlider, parent).gameObject; slider.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f); slider.transform.localPosition = new Vector3(ButtonSize * (x - 0.25f), ButtonSize * (y + 2.5f), 0.01f); slider.transform.localRotation = Quaternion.Euler(0, 0, 0); Action <float> OnValueChanged = new Action <float>(value => { _SetValue(value); }); uiSlider = slider.GetComponentInChildren <UnityEngine.UI.Slider>(); uiSlider.minValue = min; uiSlider.maxValue = max; uiSlider.onValueChanged = new UnityEngine.UI.Slider.SliderEvent(); uiSlider.onValueChanged.AddListener(OnValueChanged); slider.GetComponent <Image>().color = Colors.SliderInactive; slider.transform.Find("Fill Area/Fill").GetComponent <Image>().color = Colors.SliderActive; GameObject textGO = new GameObject("Text"); textGO.transform.SetParent(parent.transform, false); Font font = Resources.GetBuiltinResource <Font>("Arial.ttf"); Text textText = textGO.AddComponent <Text>(); textText.supportRichText = true; textText.text = label; textText.font = font; textText.fontSize = 64; textText.color = Colors.SliderText; textText.alignment = TextAnchor.MiddleCenter; textText.transform.localPosition = slider.transform.localPosition; textText.transform.localPosition += new Vector3(0, 80, 0); textText.GetComponent <RectTransform>().sizeDelta = new Vector2(textText.fontSize * label.Length, 100f); textText.fontStyle = FontStyle.Bold; UnityEngine.UI.Button textButton = textGO.AddComponent <UnityEngine.UI.Button>(); textButton.onClick.AddListener(new Action(() => { HUDKeypad($"Set {label}", "Set", "Enter value...", new Action <string>(raw => { if (float.TryParse(raw, out float val)) { // this is not the best solution by far but given the amount of times // on value changed is called its probably better than an if statement uiSlider.onValueChanged.RemoveAllListeners(); SetValue(val); uiSlider.onValueChanged.AddListener(OnValueChanged); } })); })); textGO.GetComponent <RectTransform>(); valueText = slider.transform.Find("Fill Area/Label").GetComponent <Text>(); valueText.color = Colors.SliderValueText; valueText.fontStyle = FontStyle.Bold; uiSlider.Set(initial, true); self = slider.gameObject; }
public static void SelectPlayer(this QuickMenu instance, VRCPlayer player) => instance.Method_Public_Void_VRCPlayer_0(player);
public async Task <bool> TalkToKing() { if (Player.DungeonLevel != 7) { return(false); } if (King == null) { return(false); } if (King.HP <= 0) { return(false); } if (Story.MarthbaneOfferedHelpToKing == false) { SoundMan.PlaySound(LotaSound.VeryGood); TextArea.Clear(true); await TextArea.PrintLineSlow("I am king durek!!", XleColor.White); await TextArea.PrintLineSlow("Do you come to help me?", XleColor.White); await TextArea.PrintLineSlow(); if (await QuickMenu.QuickMenuYesNo() == 1) { await DoomedMessage(); return(true); } Story.MarthbaneOfferedHelpToKing = true; TextArea.Clear(true); await TextArea.PrintLineSlow("I fear you have been caught in the", XleColor.White); await TextArea.PrintLineSlow("same trap that imprisons me...", XleColor.White); await TextArea.PrintLineSlow(); await TextArea.PrintLineSlow("unless...", XleColor.White); await GameControl.WaitAsync(2000); } TextArea.Clear(true); await TextArea.PrintLineSlow("Do you carry my signet ring?", XleColor.White); await TextArea.PrintLineSlow(); if (await QuickMenu.QuickMenuYesNo() == 1) { await DoomedMessage(); return(true); } GameState.Player.Items[LobItem.SignetRing] = 0; TextArea.Clear(true); await TextArea.PrintLineSlow("In times of distress, the ring will\nreturn me to the castle!! I fear it\ncan do nothing more than give you a\nroute of escape.", XleColor.White); await GameControl.WaitAsync(3000); TextArea.Clear(true); await TextArea.PrintLineSlow("\n\n\nNoble adventurer, i am in your debt.\nMay we meet in better times.", XleColor.White); await GameControl.WaitAsync(3000); SoundMan.PlaySound(LotaSound.EnemyMiss); Story.RescuedKing = true; Combat.Monsters.Remove(King); OpenEscapeRoute(); return(true); }
protected override async Task <bool> SpeakImplAsync() { int choice = 0; int raftCost = (int)(400 * TheEvent.CostFactor); int gearCost = (int)(50 * TheEvent.CostFactor); MenuItemList theList = new MenuItemList("Yes", "No"); bool skipRaft = false; bool offerCoin = false; if (IsLoanOverdue()) { await StoreDeclinePlayer(); return(true); } // check to see if there are any rafts near the raft drop point skipRaft = CheckForNearbyRaft(skipRaft); await TextArea.PrintLine(); await TextArea.PrintLine("** " + TheEvent.ShopName + " **", XleColor.Yellow); await TextArea.PrintLine(); if (skipRaft == false) { await TextArea.PrintLine("Want to buy a raft for " + raftCost.ToString() + " gold?"); choice = await QuickMenu.QuickMenu(theList, 3, 1); if (choice == 0) { // Purchase raft if (Player.Spend(raftCost)) { Player.Rafts.Add(new RaftData(TheEvent.BuyRaftPt.X, TheEvent.BuyRaftPt.Y, TheEvent.BuyRaftMap)); await TextArea.PrintLine("Raft purchased."); SoundMan.PlaySound(LotaSound.Sale); await GameControl.WaitAsync(1000); await TextArea.PrintLine("Board raft outside."); offerCoin = true; } else { await TextArea.PrintLine("Not enough gold."); SoundMan.PlaySound(LotaSound.Medium); await GameControl.WaitAsync(750); } } } if (skipRaft == true || choice == 1) { await TextArea.PrintLine("How about some climbing gear"); await TextArea.PrintLine("for " + gearCost.ToString() + " gold?"); await TextArea.PrintLine(); choice = await QuickMenu.QuickMenu(theList, 3, 1); if (choice == 0) { if (Player.Spend(gearCost)) { await TextArea.PrintLine("Climbing gear purchased."); Player.Items[ClimbingGearItemId] += 1; offerCoin = true; SoundMan.PlaySound(LotaSound.Sale); } else { await TextArea.PrintLine("Not enough gold."); SoundMan.PlaySound(LotaSound.Medium); } } else if (choice == 1) { await TextArea.PrintLine(); await TextArea.PrintLine("Nothing Purchased."); SoundMan.PlaySound(LotaSound.Medium); } await GameControl.WaitAsync(750); } if (offerCoin) { await CheckOfferMuseumCoin(Player); } return(true); }
public static APIUser get_SelectedUser(this QuickMenu quickMenu) { return((APIUser)QuickMenuUtils.get_SelectedUser_Method.Invoke(quickMenu, null)); }
private void Awake() { myQuickMenu = QuickMenu.prop_QuickMenu_0; }
public static void set_SelectedUser(this QuickMenu quickMenu, APIUser value) { QuickMenuUtils.set_SelectedUser_Method.Invoke(quickMenu, new object[] { (APIUser)value }); }
private Task <int> MakeOffer(Equipment item, int offer, bool finalOffer) { BuybackFormatter.Offer(item, offer, finalOffer); return(QuickMenu.QuickMenuYesNo(true)); }
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); }