Exemplo n.º 1
0
        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.GetExpandedMenu(ExpandedMenu.QuickMenu).AddSimpleButton("Video\nLibrary", delegate
            {
                videoLibrary.getMainButton().getGameObject().GetComponent <Button>().onClick.Invoke();
            });

            MelonCoroutines.Start(LoadMenu());
        }
Exemplo n.º 2
0
 private void OnUiManagerInit()
 {
     ExpansionKitApi.GetExpandedMenu(ExpandedMenu.QuickMenu).AddSimpleButton("Video\nLibrary", () =>
     {
         videoLibrary.getMainButton().getGameObject().GetComponent <Button>().onClick?.Invoke();
     });
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        private IEnumerator LoadMenu()
        {
            while (!libraryInitialized)
            {
                yield return(null);
            }
            while (APIUser.CurrentUser == null)
            {
                yield return(null);
            }

            videoLibrary = new QMNestedButton("ShortcutMenu", 5, -1, "", "", null, null, null, null);
            videoLibrary.getMainButton().getGameObject().GetComponentInChildren <Image>().enabled = false;
            videoLibrary.getMainButton().getGameObject().GetComponentInChildren <Text>().enabled  = false;

            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, "", () =>
            {
                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);
            MakeArrowButton(previousButton, ArrowDirection.Up);

            nextButton = new QMSingleButton(videoLibrary, 4, 2, "", () =>
            {
                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);
            MakeArrowButton(nextButton, ArrowDirection.Down);
            var videoFromClipboard = new QMSingleButton(videoLibrary, 1, -2, "Video From\nClipboard", () =>
            {
                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", () =>
            {
                OpenVideoLibrary();
            }, "Opens the Video Library text document\nLibrary Format: \"Button Name|Video Url\"", null, null);

            var openReadMe = new QMSingleButton(videoLibrary, 3, -2, "Read\nMe", () =>
            {
                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", () =>
            {
                getLink = true;
            }, "Disabled", () =>
            {
                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", () =>
            {
                DeleteButtons();
                ClearButtons();
                GetVideoLibrary();
                BuildList();
            }, "Refreshes the list");

            if (videoList.Count <= 9)
            {
                previousButton.setIntractable(false);
                nextButton.setIntractable(false);
            }

            BuildList();
        }