/// <summary> /// Turns a QMSingleButton into an arrow button. /// </summary> /// <param name="qmSingleButton">QMSingleButton you want to turn into an arrow.</param> /// <param name="arrowDirection">Direction you want the arrow to point.</param> public static void MakeArrowButton(QMSingleButton qmSingleButton, ArrowDirection arrowDirection) { var arrowSprite = QuickMenu.prop_QuickMenu_0.transform.Find("QuickMenu_NewElements/_CONTEXT/QM_Context_User_Selected/NextArrow_Button").GetComponentInChildren <Image>().sprite; if (arrowDirection == ArrowDirection.Up) { qmSingleButton.getGameObject().GetComponentInChildren <Image>().sprite = arrowSprite; qmSingleButton.getGameObject().GetComponent <RectTransform>().localRotation = Quaternion.Euler(new Vector3(0, 0, 90)); qmSingleButton.getGameObject().GetComponentInChildren <Text>().GetComponent <RectTransform>().localRotation = Quaternion.Euler(new Vector3(0, 0, -90)); } else if (arrowDirection == ArrowDirection.Down) { qmSingleButton.getGameObject().GetComponentInChildren <Image>().sprite = arrowSprite; qmSingleButton.getGameObject().GetComponent <RectTransform>().localRotation = Quaternion.Euler(new Vector3(0, 0, -90)); qmSingleButton.getGameObject().GetComponentInChildren <Text>().GetComponent <RectTransform>().localRotation = Quaternion.Euler(new Vector3(0, 0, 90)); } else if (arrowDirection == ArrowDirection.Left) { qmSingleButton.getGameObject().GetComponentInChildren <Image>().sprite = arrowSprite; qmSingleButton.getGameObject().GetComponent <RectTransform>().localRotation = Quaternion.Euler(new Vector3(0, 0, 180)); qmSingleButton.getGameObject().GetComponentInChildren <Text>().GetComponent <RectTransform>().localRotation = Quaternion.Euler(new Vector3(0, 0, -180)); } else if (arrowDirection == ArrowDirection.Right) { qmSingleButton.getGameObject().GetComponentInChildren <Image>().sprite = arrowSprite; } }
private void OnUIInit() { QMSingleButton CopyIDButton = new QMSingleButton( "ShortcutMenu", ButtonsX.Value, ButtonsY.Value, "Copy\nInstance ID", delegate() { Clipboard.SetText($"{RoomManager.field_Internal_Static_ApiWorld_0.id}:{RoomManager.field_Internal_Static_ApiWorldInstance_0.instanceId}"); }, "Copy the ID of the current instance." ); QMSingleButton JoinInstanceButton = new QMSingleButton( "ShortcutMenu", ButtonsX.Value, ButtonsY.Value, "Join\nInstance", delegate() { new PortalInternal().Method_Private_Void_String_String_PDM_0(Clipboard.GetText().Split(':')[0], Clipboard.GetText().Split(':')[1]); }, "Join an instance via your clipboard." ); Misc.ChangeButtonSize(CopyIDButton.getGameObject(), 420, 210); Misc.ChangeButtonSize(JoinInstanceButton.getGameObject(), 420, 210); Misc.MoveButton(CopyIDButton.getGameObject(), CopyIDButton.getGameObject().GetComponent <RectTransform>().localPosition.x, CopyIDButton.getGameObject().GetComponent <RectTransform>().localPosition.y + 105); Misc.MoveButton(JoinInstanceButton.getGameObject(), JoinInstanceButton.getGameObject().GetComponent <RectTransform>().localPosition.x, JoinInstanceButton.getGameObject().GetComponent <RectTransform>().localPosition.y - 105); }
public static void Init() { menu = new QMNestedButton("UIElementsMenu", 0, 0, "Component\nToggle", "Opens a menu for toggling various components in VRChat."); menu.getBackButton().setLocation(0, 0); TogglePickup = new QMToggleButton(menu, 1, 0, "VRC_Pickup", () => { Main.VRC_Pickup.Value = true; VRCPickup.Toggle(); }, "Disabled", () => { Main.VRC_Pickup.Value = false; VRCPickup.Toggle(); }, "TOGGLE: Keep Objects visible, but disable you being able to pick them up."); TogglePickupObject = new QMToggleButton(menu, 2, 0, "Pickup Objects", () => { Main.VRC_Pickup_Objects.Value = true; VRCPickup.Toggle(); }, "Disabled", () => { Main.VRC_Pickup_Objects.Value = false; VRCPickup.Toggle(); }, "TOGGLE: Change the visibility of pickup-able objects"); ToggleVideoPlayers = new QMToggleButton(menu, 3, 0, "Video Players", () => { Main.VRC_SyncVideoPlayer.Value = true; _VRCSyncVideoPlayer.Toggle(); }, "Disabled", () => { _VRCSyncVideoPlayer.OnLevelLoad(); Main.VRC_SyncVideoPlayer.Value = false; _VRCSyncVideoPlayer.Toggle(); }, "TOGGLE: Video Players"); TogglePens = new QMToggleButton(menu, 4, 0, "Pens", () => { Main.Pens.Value = true; Pens.Toggle(); }, "Disabled", () => { Main.Pens.Value = false; Pens.Toggle(); }, "TOGGLE: Pens & Erasers"); ToggleStation = new QMToggleButton(menu, 1, 1, "Chairs", () => { Main.VRC_Station.Value = true; }, "Disabled", () => { Main.VRC_Station.Value = false; }, "TOGGLE: Ability to sit in chairs"); ToggleMirror = new QMToggleButton(menu, 2, 1, "Mirrors", () => { Main.VRC_MirrorReflect.Value = true; VRCMirrorReflect.Toggle(); }, "Disabled", () => { Main.VRC_MirrorReflect.Value = false; VRCMirrorReflect.Toggle(); }, "TOGGLE: All Mirrors"); TogglePostProcessing = new QMToggleButton(menu, 3, 1, "PostProcessing", () => { Main.PostProcessing.Value = true; PostProcessing.Toggle(); }, "Disabled", () => { Main.PostProcessing.Value = false; PostProcessing.Toggle(); }, "TOGGLE: Post Processing"); TogglePedestal = new QMToggleButton(menu, 4, 1, "Avatar\nPedestals", () => { Main.VRC_AvatarPedestal.Value = true; VRCAvatarPedestal.Revert(); }, "Disabled", () => { Main.VRC_AvatarPedestal.Value = false; VRCAvatarPedestal.Disable(); }, "TOGGLE: Avatar Pedestals throughout the world"); RefreshButton = new QMSingleButton(menu, 4, -2, "Refresh", () => { VRCPickup.OnLevelLoad(); _VRCSyncVideoPlayer.OnLevelLoad(); Pens.OnLevelLoad(); Patches.PatchVRC_Station(); PostProcessing.OnLevelLoad(); _VRCSyncVideoPlayer.OnLevelLoad(); VRCAvatarPedestal.OnLevelLoad(); VRCMirrorReflect.OnLevelLoad(); }, "Pressing this will attempt to recache all objects in the world.\nThis is the same thing as if you rejoin the world."); RefreshButton.getGameObject().GetComponent <RectTransform>().sizeDelta /= new Vector2(1.0f, 2.0f); RefreshButton.getGameObject().GetComponent <RectTransform>().anchoredPosition += new Vector2(0f, -105f); menu.getMainButton().getGameObject().name = "CTMenu"; // Sets Toggle States on UI Init setAllButtonToggleStates(false); }
public override void VRChat_OnUiManagerInit() { videoLibrary = new QMNestedButton("ShortcutMenu", -10, 0, "", "", null, null, null, null); videoLibrary.getMainButton().getGameObject().GetComponentInChildren <Image>().enabled = false; videoLibrary.getMainButton().getGameObject().GetComponentInChildren <Text>().enabled = false; ExpansionKitApi.RegisterSimpleMenuButton(ExpandedMenu.QuickMenu, "Video\nLibrary", delegate { videoLibrary.getMainButton().getGameObject().GetComponent <Button>().Press(); }); var indexButton = new QMSingleButton(videoLibrary, 4, 1, "Page:\n" + (currentMenuIndex + 1).ToString() + " of " + (indexNumber + 1).ToString(), delegate { }, "", Color.clear, Color.yellow); indexButton.getGameObject().GetComponentInChildren <Button>().enabled = false; indexButton.getGameObject().GetComponentInChildren <Image>().enabled = false; previousButton = new QMSingleButton(videoLibrary, 4, 0, "Previous\nPage", delegate { if (currentMenuIndex != 0) { currentMenuIndex--; } foreach (ModVideo videoButton in videoList) { if (videoButton.IndexNumber != currentMenuIndex) { videoButton.VideoButton.setActive(false); } else { videoButton.VideoButton.setActive(true); } } indexButton.setButtonText("Page:\n" + (currentMenuIndex + 1).ToString() + " of " + (indexNumber + 1).ToString()); }, "Previous video page", null, null); nextButton = new QMSingleButton(videoLibrary, 4, 2, "Next\nPage", delegate { if (currentMenuIndex != indexNumber) { currentMenuIndex++; } foreach (ModVideo videoButton in videoList) { if (videoButton.IndexNumber != currentMenuIndex) { videoButton.VideoButton.setActive(false); } else { videoButton.VideoButton.setActive(true); } } indexButton.setButtonText("Page:\n" + (currentMenuIndex + 1).ToString() + " of " + (indexNumber + 1).ToString()); }, "Previous video page", null, null); var openReadMe = new QMSingleButton(videoLibrary, 5, 0, "Read\nMe", delegate { Process.Start("https://github.com/UshioHiko/VRCVideoLibrary/blob/master/README.md"); }, "Opens a link to the mod's \"Read Me\""); var openListButton = new QMSingleButton(videoLibrary, 5, -1, "Open\nLibrary\nDocument", delegate { OpenVideoLibrary(); }, "Opens the Video Library text document\nLibrary Format: \"Button Name|Video Url\"", null, null); var getLinkToggle = new QMToggleButton(videoLibrary, 5, 1, "Buttons Copy\nVideo Link", delegate { getLink = true; }, "Disabled", delegate { getLink = false; }, "Makes video library buttons copy video url to your system clipboard", null, null, false, false); foreach (ModVideo video in videoList) { if (video.VideoNumber == 0) { var vidButton = new QMSingleButton(videoLibrary, 1, 0, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { MelonCoroutines.Start(video.AddVideo(onCooldown)); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; } else if (video.VideoNumber == 1) { var vidButton = new QMSingleButton(videoLibrary, 2, 0, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { MelonCoroutines.Start(video.AddVideo(onCooldown)); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; } else if (video.VideoNumber == 2) { var vidButton = new QMSingleButton(videoLibrary, 3, 0, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { MelonCoroutines.Start(video.AddVideo(onCooldown)); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; } else if (video.VideoNumber == 3) { var vidButton = new QMSingleButton(videoLibrary, 1, 1, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { MelonCoroutines.Start(video.AddVideo(onCooldown)); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; } else if (video.VideoNumber == 4) { var vidButton = new QMSingleButton(videoLibrary, 2, 1, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { MelonCoroutines.Start(video.AddVideo(onCooldown)); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; } else if (video.VideoNumber == 5) { var vidButton = new QMSingleButton(videoLibrary, 3, 1, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { MelonCoroutines.Start(video.AddVideo(onCooldown)); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; } else if (video.VideoNumber == 6) { var vidButton = new QMSingleButton(videoLibrary, 1, 2, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { MelonCoroutines.Start(video.AddVideo(onCooldown)); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; } else if (video.VideoNumber == 7) { var vidButton = new QMSingleButton(videoLibrary, 2, 2, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { MelonCoroutines.Start(video.AddVideo(onCooldown)); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; } else if (video.VideoNumber == 8) { var vidButton = new QMSingleButton(videoLibrary, 3, 2, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { MelonCoroutines.Start(video.AddVideo(onCooldown)); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; } if (video.IndexNumber != currentMenuIndex) { video.VideoButton.setActive(false); } } if (videoList.Count <= 9) { previousButton.setIntractable(false); nextButton.setIntractable(false); } }
public void BuildList() { for (int i = 0; i < videoList.Count; i++) { ModVideo video = videoList[i]; switch (video.VideoNumber) { case 0: { var vidButton = new QMSingleButton(videoLibrary, 1, 0, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { video.AddVideo(onCooldown); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; vidButton.getGameObject().GetComponentInChildren <Text>().resizeTextForBestFit = true; break; } case 1: { var vidButton = new QMSingleButton(videoLibrary, 2, 0, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { video.AddVideo(onCooldown); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; vidButton.getGameObject().GetComponentInChildren <Text>().resizeTextForBestFit = true; break; } case 2: { var vidButton = new QMSingleButton(videoLibrary, 3, 0, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { video.AddVideo(onCooldown); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; vidButton.getGameObject().GetComponentInChildren <Text>().resizeTextForBestFit = true; break; } case 3: { var vidButton = new QMSingleButton(videoLibrary, 1, 1, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { video.AddVideo(onCooldown); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; vidButton.getGameObject().GetComponentInChildren <Text>().resizeTextForBestFit = true; break; } case 4: { var vidButton = new QMSingleButton(videoLibrary, 2, 1, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { video.AddVideo(onCooldown); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; vidButton.getGameObject().GetComponentInChildren <Text>().resizeTextForBestFit = true; break; } case 5: { var vidButton = new QMSingleButton(videoLibrary, 3, 1, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { video.AddVideo(onCooldown); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; vidButton.getGameObject().GetComponentInChildren <Text>().resizeTextForBestFit = true; break; } case 6: { var vidButton = new QMSingleButton(videoLibrary, 1, 2, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { video.AddVideo(onCooldown); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; vidButton.getGameObject().GetComponentInChildren <Text>().resizeTextForBestFit = true; break; } case 7: { var vidButton = new QMSingleButton(videoLibrary, 2, 2, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { video.AddVideo(onCooldown); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; vidButton.getGameObject().GetComponentInChildren <Text>().resizeTextForBestFit = true; break; } case 8: { var vidButton = new QMSingleButton(videoLibrary, 3, 2, video.VideoName, delegate { if (getLink) { video.GetLink(); } else { video.AddVideo(onCooldown); if (!onCooldown) { MelonCoroutines.Start(CoolDown()); } } }, $"Puts {video.VideoName} on the video player", null, null); video.VideoButton = vidButton; vidButton.getGameObject().GetComponentInChildren <Text>().resizeTextForBestFit = true; break; } } if (video.IndexNumber != currentMenuIndex) { video.VideoButton.setActive(false); } } indexButton.setButtonText("Page:\n" + (currentMenuIndex + 1).ToString() + " of " + (indexNumber + 1).ToString()); }
private IEnumerator LoadMenu() { while (!libraryInitialized) { yield return(null); } indexButton = new QMSingleButton(videoLibrary, 4, 1, "Page:\n" + (currentMenuIndex + 1).ToString() + " of " + (indexNumber + 1).ToString(), delegate { }, "", Color.clear, Color.yellow); indexButton.getGameObject().GetComponentInChildren <Button>().enabled = false; indexButton.getGameObject().GetComponentInChildren <Image>().enabled = false; previousButton = new QMSingleButton(videoLibrary, 4, 0, "Previous\nPage", delegate { if (currentMenuIndex != 0) { currentMenuIndex--; } foreach (ModVideo videoButton in videoList) { if (videoButton.IndexNumber != currentMenuIndex) { videoButton.VideoButton.setActive(false); } else { videoButton.VideoButton.setActive(true); } } indexButton.setButtonText("Page:\n" + (currentMenuIndex + 1).ToString() + " of " + (indexNumber + 1).ToString()); }, "Previous video page", null, null); nextButton = new QMSingleButton(videoLibrary, 4, 2, "Next\nPage", delegate { if (currentMenuIndex != indexNumber) { currentMenuIndex++; } foreach (ModVideo videoButton in videoList) { if (videoButton.IndexNumber != currentMenuIndex) { videoButton.VideoButton.setActive(false); } else { videoButton.VideoButton.setActive(true); } } indexButton.setButtonText("Page:\n" + (currentMenuIndex + 1).ToString() + " of " + (indexNumber + 1).ToString()); }, "Previous video page", null, null); var videoFromClipboard = new QMSingleButton(videoLibrary, 1, -2, "Video From\nClipboard", delegate { MelonCoroutines.Start(ModVideo.VideoFromClipboard(onCooldown)); }, "Puts the link in your system clipboard into the world's video player"); var openListButton = new QMSingleButton(videoLibrary, 2, -2, "Open\nLibrary\nDocument", delegate { OpenVideoLibrary(); }, "Opens the Video Library text document\nLibrary Format: \"Button Name|Video Url\"", null, null); var openReadMe = new QMSingleButton(videoLibrary, 3, -2, "Read\nMe", delegate { Process.Start("https://github.com/UshioHiko/VRCVideoLibrary/blob/master/README.md"); }, "Opens a link to the mod's \"Read Me\""); var getLinkToggle = new QMToggleButton(videoLibrary, 4, -2, "Buttons Copy\nVideo Link", delegate { getLink = true; }, "Disabled", delegate { getLink = false; }, "Makes video library buttons copy video url to your system clipboard", null, null, false, false); var refreshList = new QMSingleButton(videoLibrary, 5, -2, "Refresh\nList", delegate { DeleteButtons(); ClearButtons(); GetVideoLibrary(); BuildList(); }, "Refreshes the list"); BuildList(); if (videoList.Count <= 9) { previousButton.setIntractable(false); nextButton.setIntractable(false); } }