private void CreateButton(string text, int xoffset, Action onClick) { Transform baseButtonTransform = QuickMenuUtils.GetQuickMenuInstance().transform.Find("ShortcutMenu/CloseButton") ?? QuickMenuUtils.GetQuickMenuInstance().transform.Find("ShortcutMenu/SettingsButton"); if (baseButtonTransform != null) { Transform modconf = UnityUiUtils.DuplicateButton(baseButtonTransform, text, new Vector2(0, 0)); modconf.name = "ModConfigsButton (" + text + ")"; modconf.GetComponentInChildren <RectTransform>().sizeDelta = new Vector2(300, 100); modconf.GetComponentInChildren <Text>().color = Color.white; //modconf.GetComponent<Button>().interactable = false; modconf.GetComponent <Button>().onClick.RemoveAllListeners(); modconf.GetComponent <Button>().onClick.AddListener(() => onClick()); modconf.GetComponent <RectTransform>().SetParent(transform, true); modconf.GetComponent <RectTransform>().localPosition = new Vector3(0, 0, 0); modconf.GetComponent <RectTransform>().anchoredPosition = new Vector2(xoffset, -440); modconf.GetComponent <RectTransform>().localRotation = Quaternion.identity; modconf.GetComponent <RectTransform>().localScale = Vector3.one; modconf.GetComponentInChildren <Text>().fontSize = 30; } else { VRCModLogger.Log("[ModConfigPage] QuickMenu/ShortcutMenu/SettingsButton and QuickMenu/ShortcutMenu/SettingsButton are null"); } }
public static void Setup() { //Create mods config page GameObject screens = GameObject.Find("UserInterface/MenuContent/Screens"); GameObject avatarscreen = GameObject.Find("UserInterface/MenuContent/Screens/Avatar"); if (avatarscreen != null) { GameObject go = new GameObject("ModConfig", typeof(RectTransform), typeof(VRCUiPage)); go.transform.SetParent(screens.transform, false); go.GetComponent <VRCUiPage>().screenType = avatarscreen.GetComponent <VRCUiPage>().screenType; go.GetComponent <VRCUiPage>().displayName = "Mod Conf"; go.GetComponent <VRCUiPage>().AudioShow = avatarscreen.GetComponent <VRCUiPage>().AudioShow; go.GetComponent <VRCUiPage>().AudioLoop = avatarscreen.GetComponent <VRCUiPage>().AudioLoop; go.GetComponent <VRCUiPage>().AudioHide = avatarscreen.GetComponent <VRCUiPage>().AudioHide; go.AddComponent <ModConfigPage>(); //SCREEN CONTENT SIZE: 1500x1000 //Create mods config quickmenu button Transform baseButtonTransform = QuickMenuUtils.GetQuickMenuInstance().transform.Find("ShortcutMenu/CloseButton"); if (baseButtonTransform != null) { Transform modconf = UnityUiUtils.DuplicateButton(baseButtonTransform, "Mod\nConfigs", new Vector2(-420, 0)); modconf.name = "ModConfigsButton"; modconf.GetComponentInChildren <Text>().color = new Color(1, 0.5f, 0.1f); //modconf.GetComponent<Button>().interactable = false; modconf.GetComponent <Button>().onClick.RemoveAllListeners(); modconf.GetComponent <Button>().onClick.AddListener(() => { VRCUiManagerUtils.GetVRCUiManager().ShowUi(false, true); ModManager.StartCoroutine(QuickMenuUtils.PlaceUiAfterPause()); VRCUiManagerUtils.GetVRCUiManager().ShowScreen("UserInterface/MenuContent/Screens/ModConfig"); }); } else { VRCModLogger.Log("[ModConfigPage] QuickMenu/ShortcutMenu/CloseButton is null"); } } else { VRCModLogger.Log("[ModConfigPage] UserInterface/MenuContent/Screens/Avatar is null"); } }
public static void Setup() { try { Transform baseTextTransform = QuickMenuUtils.GetQuickMenuInstance().transform.Find("ShortcutMenu/BuildNumText"); if (baseTextTransform != null) { Transform vrcmodNetworkTransform = new GameObject("VRCModNetworkStatusText", typeof(RectTransform), typeof(Text)).transform; vrcmodNetworkTransform.SetParent(baseTextTransform.parent, false); vrcmodNetworkTransform.SetSiblingIndex(baseTextTransform.GetSiblingIndex() + 1); networkstatusText = vrcmodNetworkTransform.GetComponent <Text>(); RectTransform networkstatusRT = vrcmodNetworkTransform.GetComponent <RectTransform>(); networkstatusRT.localScale = baseTextTransform.localScale; networkstatusRT.anchorMin = baseTextTransform.GetComponent <RectTransform>().anchorMin; networkstatusRT.anchorMax = baseTextTransform.GetComponent <RectTransform>().anchorMax; networkstatusRT.anchoredPosition = baseTextTransform.GetComponent <RectTransform>().anchoredPosition; networkstatusRT.sizeDelta = new Vector2(2000, baseTextTransform.GetComponent <RectTransform>().sizeDelta.y); networkstatusRT.pivot = baseTextTransform.GetComponent <RectTransform>().pivot; Vector3 newPos = baseTextTransform.localPosition; newPos.x -= baseTextTransform.GetComponent <RectTransform>().sizeDelta.x * 0.5f; newPos.x += 2000 * 0.5f; newPos.y += -85; networkstatusRT.localPosition = newPos; networkstatusText.text = "VRCModNetworkStatus: <color=orange>Unknown</color>"; networkstatusText.color = baseTextTransform.GetComponent <Text>().color; networkstatusText.font = baseTextTransform.GetComponent <Text>().font; networkstatusText.fontSize = baseTextTransform.GetComponent <Text>().fontSize; networkstatusText.fontStyle = baseTextTransform.GetComponent <Text>().fontStyle; networkstatusText.horizontalOverflow = HorizontalWrapMode.Overflow; Update(); } else { VRCModLogger.Log("[VRCMNWStatus] QuickMenu/ShortcutMenu/BuildNumText is null"); } }catch (Exception ex) { VRCModLoader.VRCModLogger.Log("[VRCMNWStatus] " + ex.ToString()); } }
private void CreatePref(ModPrefs.PrefDesc pref, ref float totalHeight) { GameObject textName = new GameObject("PrefName (" + pref.DisplayText + ")", typeof(RectTransform), typeof(Text)); textName.transform.SetParent(scrollContent, false); textName.GetComponent <RectTransform>().sizeDelta = new Vector2(675f, 70f); textName.GetComponent <RectTransform>().anchorMin = new Vector2(0.5f, 1.0f); textName.GetComponent <RectTransform>().anchorMax = new Vector2(0.5f, 1.0f); textName.GetComponent <RectTransform>().pivot = new Vector2(1f, 1.0f); textName.GetComponent <RectTransform>().anchoredPosition = new Vector2(-75, -totalHeight); textName.GetComponent <Text>().font = QuickMenuUtils.GetQuickMenuInstance().transform.Find("ShortcutMenu/BuildNumText").GetComponent <Text>().font; textName.GetComponent <Text>().fontSize = 50; textName.GetComponent <Text>().alignment = TextAnchor.MiddleRight; textName.GetComponent <Text>().alignByGeometry = true; textName.GetComponent <Text>().text = pref.DisplayText; if (pref.Type == ModPrefs.PrefType.BOOL) { UIToggleSwitch toggle = UnityUiUtils.CreateUIToggleSwitch(scrollContent.GetComponent <RectTransform>()); toggle.GetComponent <RectTransform>().anchorMin = new Vector2(0.5f, 1.0f); toggle.GetComponent <RectTransform>().anchorMax = new Vector2(0.5f, 1.0f); toggle.GetComponent <RectTransform>().pivot = new Vector2(0.0f, 1.0f); toggle.GetComponent <RectTransform>().anchoredPosition = new Vector2(75f, -totalHeight); toggle.GetComponent <Toggle>().isOn = pref.Value == "1"; toggle.OnChange = (isOn) => pref.ValueEdited = isOn ? "1" : "0"; } else { GameObject textValue = new GameObject("PrefValue (" + pref.DisplayText + ")", typeof(RectTransform), typeof(Text)); textValue.transform.SetParent(scrollContent, false); textValue.GetComponent <RectTransform>().sizeDelta = new Vector2(675f, 70f); textValue.GetComponent <RectTransform>().anchorMin = new Vector2(0.5f, 1.0f); textValue.GetComponent <RectTransform>().anchorMax = new Vector2(0.5f, 1.0f); textValue.GetComponent <RectTransform>().pivot = new Vector2(0f, 1.0f); textValue.GetComponent <RectTransform>().anchoredPosition = new Vector2(75f, -totalHeight); textValue.GetComponent <Text>().font = QuickMenuUtils.GetQuickMenuInstance().transform.Find("ShortcutMenu/BuildNumText").GetComponent <Text>().font; textValue.GetComponent <Text>().fontSize = 50; textValue.GetComponent <Text>().alignment = TextAnchor.MiddleLeft; textValue.GetComponent <Text>().alignByGeometry = true; textValue.GetComponent <Text>().text = pref.Value; } totalHeight += 70; }
private void CreateCategoryTitle(string title, ref float totalHeight) { GameObject text = new GameObject("CategoryTitle (" + title + ")", typeof(RectTransform), typeof(Text)); text.transform.SetParent(scrollContent, false); text.GetComponent <RectTransform>().sizeDelta = new Vector2(1500, 90); text.GetComponent <RectTransform>().anchorMin = new Vector2(0.5f, 1.0f); text.GetComponent <RectTransform>().anchorMax = new Vector2(0.5f, 1.0f); text.GetComponent <RectTransform>().pivot = new Vector2(0.5f, 1.0f); text.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -totalHeight); text.GetComponent <Text>().font = QuickMenuUtils.GetQuickMenuInstance().transform.Find("ShortcutMenu/BuildNumText").GetComponent <Text>().font; text.GetComponent <Text>().fontSize = 70; text.GetComponent <Text>().alignment = TextAnchor.MiddleCenter; text.GetComponent <Text>().alignByGeometry = true; text.GetComponent <Text>().text = title; text.GetComponent <Text>().color = Color.yellow; totalHeight += 90; }
public static void Setup() { try { Transform baseTextTransform = QuickMenuUtils.GetQuickMenuInstance().transform.Find("ShortcutMenu/BuildNumText"); if (baseTextTransform != null) { Transform vrcmodNetworkTransform = new GameObject("VRCModNetworkStatusText", typeof(RectTransform), typeof(Text)).transform; vrcmodNetworkTransform.SetParent(baseTextTransform.parent, false); vrcmodNetworkTransform.SetSiblingIndex(baseTextTransform.GetSiblingIndex() + 1); networkstatusText = vrcmodNetworkTransform.GetComponent <Text>(); RectTransform networkstatusRT = vrcmodNetworkTransform.GetComponent <RectTransform>(); networkstatusRT.localScale = baseTextTransform.localScale; networkstatusRT.anchorMin = baseTextTransform.GetComponent <RectTransform>().anchorMin; networkstatusRT.anchorMax = baseTextTransform.GetComponent <RectTransform>().anchorMax; networkstatusRT.anchoredPosition = baseTextTransform.GetComponent <RectTransform>().anchoredPosition; networkstatusRT.sizeDelta = new Vector2(2000, baseTextTransform.GetComponent <RectTransform>().sizeDelta.y); networkstatusRT.pivot = baseTextTransform.GetComponent <RectTransform>().pivot; Vector3 newPos = baseTextTransform.localPosition; newPos.x -= baseTextTransform.GetComponent <RectTransform>().sizeDelta.x * 0.5f; newPos.x += 2000 * 0.5f; newPos.y += -85; networkstatusRT.localPosition = newPos; networkstatusText.text = "VRCModNetworkStatus: <color=orange>Unknown</color>"; networkstatusText.color = baseTextTransform.GetComponent <Text>().color; networkstatusText.font = baseTextTransform.GetComponent <Text>().font; networkstatusText.fontSize = baseTextTransform.GetComponent <Text>().fontSize; networkstatusText.fontStyle = baseTextTransform.GetComponent <Text>().fontStyle; networkstatusText.horizontalOverflow = HorizontalWrapMode.Overflow; Transform settingsButtonTransform = QuickMenuUtils.GetQuickMenuInstance().transform.Find("ShortcutMenu/SettingsButton"); vrcmnwButton = UnityUiUtils.DuplicateButton(settingsButtonTransform, "", new Vector2(-230, -930)).GetComponent <RectTransform>(); VRCModLogger.Log("vrcmnwButton pos: " + vrcmnwButton.position.x + ", " + vrcmnwButton.position.y + ", " + vrcmnwButton.position.z); VRCModLogger.Log("networkstatusRT pos: " + networkstatusRT.position.x + ", " + networkstatusRT.position.y + ", " + networkstatusRT.position.z); //vrcmnwButton.gameObject.SetActive(true); //vrcmnwButton.GetComponentInChildren<Text>().text = "Mod/Game\nSettings"; //vrcmnwButton.GetComponent<UiTooltip>().text = "Link current VRChat account to your VRCTools account"; //vrcmnwButton.position = networkstatusRT.position; Button vrcmnwButtonButton = vrcmnwButton.GetComponent <Button>(); vrcmnwButtonButton.onClick = new Button.ButtonClickedEvent(); vrcmnwButtonButton.onClick.AddListener(VRCModNetworkManager.LinkVRCAccount); vrcmnwButton.sizeDelta = new Vector2(850, 140); ExpendCollider(QuickMenuUtils.GetQuickMenuInstance().GetComponent <BoxCollider>(), new Vector2(0, -400)); Update(); } else { VRCModLogger.Log("[VRCMNWStatus] QuickMenu/ShortcutMenu/BuildNumText is null"); } } catch (Exception ex) { VRCModLoader.VRCModLogger.Log("[VRCMNWStatus] " + ex); } }
public static void Setup() { try { //Create mods config page VRCModLogger.Log("[ModConfigPage] Setup"); GameObject avatarscreen = GameObject.Find("UserInterface/MenuContent/Screens/Avatar"); GameObject cameramenu = GameObject.Find("UserInterface/MenuContent/Screens/CameraMenu"); VRCModLogger.Log("[ModConfigPage] avatarscreen: " + avatarscreen); if (avatarscreen != null) { VRCModLogger.Log("[ModConfigPage] Setting up ModConfigPage"); GameObject go = new GameObject("ModConfig", typeof(RectTransform), typeof(VRCUiPage)); go.transform.SetParent(avatarscreen.transform.parent, false); go.GetComponent <VRCUiPage>().screenType = avatarscreen.GetComponent <VRCUiPage>().screenType; go.GetComponent <VRCUiPage>().displayName = "Mod Conf"; go.GetComponent <VRCUiPage>().AudioShow = avatarscreen.GetComponent <VRCUiPage>().AudioShow; go.GetComponent <VRCUiPage>().AudioHide = avatarscreen.GetComponent <VRCUiPage>().AudioHide; VRCModLogger.Log("[ModConfigPage] Adding ModConfigPage component"); go.AddComponent <ModConfigPage>(); //SCREEN CONTENT SIZE: 1500x1000 VRCModLogger.Log("[ModConfigPage] Editing QuickMenu's Settings button"); Transform settingsButtonTransform = QuickMenuUtils.GetQuickMenuInstance().transform.Find("ShortcutMenu/SettingsButton"); settingsButtonTransform.GetComponentInChildren <Text>().text = "Mod/Game\nSettings"; settingsButtonTransform.GetComponent <UiTooltip>().text = "Tune Control, Audio, Video and Mod Settings. Log Out or Quit."; VRCModLogger.Log("[ModConfigPage] Editing QuickMenu's InfoBar"); Transform infobarpanelTransform = QuickMenuUtils.GetQuickMenuInstance().transform.Find("QuickMenu_NewElements/_InfoBar/Panel"); RectTransform infobarpanelRectTransform = infobarpanelTransform.GetComponent <RectTransform>(); infobarpanelRectTransform.sizeDelta = new Vector2(infobarpanelRectTransform.sizeDelta.x, infobarpanelRectTransform.sizeDelta.y + 80); infobarpanelRectTransform.anchoredPosition = new Vector2(infobarpanelRectTransform.anchoredPosition.x, infobarpanelRectTransform.anchoredPosition.y - 40); VRCModLogger.Log("[ModConfigPage] Setting up SettingsMenu"); Transform cameraMenuTransform = QuickMenuUtils.GetQuickMenuInstance().transform.Find("CameraMenu"); Transform settingsMenuTransform = Instantiate(cameraMenuTransform, QuickMenuUtils.GetQuickMenuInstance().transform); settingsMenuTransform.name = "SettingsMenu"; Button.ButtonClickedEvent showGameConfigMenu = settingsButtonTransform.GetComponent <Button>().onClick; settingsButtonTransform.GetComponent <Button>().onClick = new Button.ButtonClickedEvent(); settingsButtonTransform.GetComponent <Button>().onClick.AddListener(() => { QuickMenuUtils.ShowQuickmenuPage("SettingsMenu"); }); VRCModLogger.Log("[ModConfigPage] Editing QuickMenu's SettingsMenu buttons"); int i = 0; foreach (Transform child in settingsMenuTransform) { if (child != null) { if (i == 0) { child.name = "Game Settings"; child.GetComponentInChildren <Text>().text = "Game\nSettings"; child.GetComponent <UiTooltip>().text = "Tune Control, Audio and Video Settings. Log Out or Quit."; child.GetComponent <Button>().onClick = showGameConfigMenu; } else if (i == 1) { child.name = "Mod Settings"; child.GetComponentInChildren <Text>().text = "Mod\nSettings"; child.GetComponent <UiTooltip>().text = "Enable Features or Configure Installed Mods"; child.GetComponent <Button>().onClick = new Button.ButtonClickedEvent(); child.GetComponent <Button>().onClick.AddListener(() => { VRCUiManagerUtils.GetVRCUiManager().ShowUi(false, true); ModManager.StartCoroutine(QuickMenuUtils.PlaceUiAfterPause()); VRCUiManagerUtils.GetVRCUiManager().ShowScreen("UserInterface/MenuContent/Screens/ModConfig"); }); } else if (child.name != "BackButton") { Destroy(child.gameObject); } } i++; } } else { VRCModLogger.Log("[ModConfigPage] UserInterface/MenuContent/Screens/Avatar is null"); } } catch (Exception ex) { VRCModLoader.VRCModLogger.Log("[ModConfigPage] " + ex.ToString()); } }