Пример #1
0
        public void initButton(int btnXLocation, int btnYLocation, String btnText, String btnToolTip, Nullable <Color> btnBackgroundColor = null, Nullable <Color> btnTextColor = null, Nullable <Color> backbtnBackgroundColor = null, Nullable <Color> backbtnTextColor = null)
        {
            Transform menu = UnityEngine.Object.Instantiate <Transform>(QuickMenuStuff.GetQuickMenuInstance().transform.Find("CameraMenu"), QuickMenuStuff.GetQuickMenuInstance().transform);

            menuName  = "CustomMenu" + btnQMLoc + "_" + btnXLocation + "_" + btnYLocation;
            menu.name = menuName;

            mainButton = new QMSingleButton(btnQMLoc, btnXLocation, btnYLocation, btnText, delegate() { QuickMenuStuff.ShowQuickmenuPage(menuName); }, btnToolTip, btnBackgroundColor, btnTextColor);

            IEnumerator enumerator = menu.transform.GetEnumerator();

            while (enumerator.MoveNext())
            {
                object    obj     = enumerator.Current;
                Transform btnEnum = (Transform)obj;
                if (btnEnum != null)
                {
                    UnityEngine.Object.Destroy(btnEnum.gameObject);
                }
            }

            if (backbtnTextColor == null)
            {
                backbtnTextColor = Color.yellow;
            }
            backButton = new QMSingleButton(this, 4, 2, "Back", delegate() { QuickMenuStuff.ShowQuickmenuPage(btnQMLoc); }, "Go Back", backbtnBackgroundColor, backbtnTextColor);
        }
Пример #2
0
        private void initButton(int btnXLocation, int btnYLocation, String btnText, UnityAction btnAction, String btnToolTip, Nullable <Color> btnBackgroundColor = null, Nullable <Color> btnTextColor = null)
        {
            Transform btnTemplate = null;

            btnTemplate = QuickMenuStuff.GetQuickMenuInstance().transform.Find("ShortcutMenu/WorldsButton");

            button = UnityEngine.Object.Instantiate <GameObject>(btnTemplate.gameObject, QuickMenuStuff.GetQuickMenuInstance().transform.Find(btnQMLoc), true);

            initShift[0] = -1;
            initShift[1] = 0;
            setLocation(btnXLocation, btnYLocation);
            setButtonText(btnText);
            setToolTip(btnToolTip);
            setAction(btnAction);

            if (btnBackgroundColor != null)
            {
                setBackgroundColor((Color)btnBackgroundColor);
            }
            if (btnTextColor != null)
            {
                setTextColor((Color)btnTextColor);
            }

            setActive(true);
        }
Пример #3
0
        private void initButton(int btnXLocation, int btnYLocation, String btnTextOn, UnityAction btnActionOn, String btnTextOff, UnityAction btnActionOff, String btnToolTip, Nullable <Color> btnBackgroundColor = null, Nullable <Color> btnTextColor = null)
        {
            Transform btnTemplate = null;

            btnTemplate = QuickMenuStuff.GetQuickMenuInstance().transform.Find("UserInteractMenu/BlockButton");

            button = UnityEngine.Object.Instantiate <GameObject>(btnTemplate.gameObject, QuickMenuStuff.GetQuickMenuInstance().transform.Find(btnQMLoc), true);

            btnOn  = button.transform.Find("Toggle_States_Visible/ON").gameObject;
            btnOff = button.transform.Find("Toggle_States_Visible/OFF").gameObject;

            initShift[0] = -4;
            initShift[1] = 0;
            setLocation(btnXLocation, btnYLocation);

            setOnText(btnTextOn);
            setOffText(btnTextOff);
            Text[] btnTextsOn = btnOn.GetComponentsInChildren <Text>();
            btnTextsOn[0].name = "Text_ON";
            btnTextsOn[1].name = "Text_OFF";
            Text[] btnTextsOff = btnOff.GetComponentsInChildren <Text>();
            btnTextsOff[0].name = "Text_ON";
            btnTextsOff[1].name = "Text_OFF";

            setToolTip(btnToolTip);
            button.transform.GetComponentInChildren <UiTooltip>().SetToolTipBasedOnToggle();

            setAction(btnActionOn, btnActionOff);
            btnOn.SetActive(false);
            btnOff.SetActive(true);

            if (btnBackgroundColor != null)
            {
                setBackgroundColor((Color)btnBackgroundColor);
            }

            if (btnTextColor != null)
            {
                setTextColor((Color)btnTextColor);
            }

            setActive(true);
        }
Пример #4
0
        public IEnumerator Start()
        {
            //Q_RUBYLogo is initially set as a QMSingleButton, so we want to instantiate
            //a new one with all of the properties that we want
            Q_RUBYLogo = new QMSingleButton(
                //BtnMenu -> this has 3 possible types, "ShortcutMenu", "UserInteractMenu" or a QMNestedButton (button that opens up to other buttons)
                //ShortcutMenu -> main quick menu with worlds/avatars
                //UserInteractMenu -> quick menu when selecting a player
                "ShortcutMenu",
                //The x and y coordinates of the button. 0,0 is considered one to the left of worlds button.
                //x -> positive moves you to the right
                //y -> positive moves you down
                5, -1,
                //The main text of the button
                "RUBY",
                //The action you want the button to do when it is pressed, delegate() { } is a must have
                delegate()
            {
                System.Diagnostics.Process.Start("https://www.vrchaven.com/");
                QuickMenuStuff.GetQuickMenuInstance().CloseMenu();
            },
                //The tooltip of the button (the text on top when hovering over the button)
                "Client by DubyaDude <3\nClicking here will open a browser to the website.",
                //First color is background color, second color is text color. If not filled in or set to null, default colors will stay
                Color.cyan, Color.white
                );
            //Now you have a new button!



            //This creates a custom sprite for the Q_RUBYLogo button
            Sprite logoSprite = new Sprite();

            using (WWW www = new WWW("https://www.vrchaven.com/img/logo.png"))
            {
                yield return(www);

                logoSprite = Sprite.Create(www.texture, new Rect(0, 0, www.texture.width, www.texture.height),
                                           new Vector2(0, 0));
            }

            Q_RUBYLogo.getGameObject().GetComponentInChildren <UnityEngine.UI.Image>().sprite = logoSprite;
            Material logoMaterial = new Material(Q_RUBYLogo.getGameObject().GetComponentInChildren <UnityEngine.UI.Image>().material);

            logoMaterial.shader = Shader.Find("Unlit/Transparent");
            Q_RUBYLogo.getGameObject().GetComponentInChildren <UnityEngine.UI.Image>().material = logoMaterial;


            //Q_Functions is initially set as a QMNestedButton, so we want to instantiate
            //a new one with all of the properties that we want
            Q_Functions = new QMNestedButton(
                //BtnMenu -> this has 3 possible types, "ShortcutMenu", "UserInteractMenu" or a QMNestedButton (button that opens up to other buttons)
                //ShortcutMenu -> main quick menu with worlds/avatars
                //UserInteractMenu -> quick menu when selecting a player
                "ShortcutMenu",
                //The x and y coordinates of the button. 0,0 is considered one to the left of worlds button.
                //x -> positive moves you to the right
                //y -> positive moves you down
                5, 2,
                //The main text of the nested button
                "Functions",
                //The tooltip of the button (the text on top when hovering over the button)
                "A little bit of extra stuff",
                //(Nested button) First color is background color, second color is text color. If not filled in or set to null, default colors will stay
                Color.cyan, Color.white,
                //(Back button in nested page) First color is background color, second color is text color. If not filled in or set to null, default colors will stay
                Color.cyan, Color.yellow
                );

            //Moves the back button one to the right for more room
            Q_Functions.getBackButton().setLocation(2, 0);


            //Q_F_Gain is initially set as a QMToggleButton, so we want to instantiate
            //a new one with all of the properties that we want
            Q_F_Gain = new QMToggleButton(
                //BtnMenu -> this has 3 possible types, "ShortcutMenu", "UserInteractMenu" or a QMNestedButton (button that opens up to other buttons)
                //ShortcutMenu -> main quick menu with worlds/avatars
                //UserInteractMenu -> quick menu when selecting a player
                Q_Functions,
                //The x and y coordinates of the button. 0,0 is considered one to the left of worlds button.
                //x -> positive moves you to the right
                //y -> positive moves you down
                1, 0,
                //The text for the 'on' position of the button
                "Max Gain",
                //The 'on' action of the button
                delegate()
            {
                Console.WriteLine("Max Gain");
            },
                //The text for the 'off' position of the button
                "Normal Gain",
                //The 'off' action of the button
                delegate()
            {
                Console.WriteLine("Normal Gain");
            },
                //The tooltip of the button (the text on top when hovering over the button)
                "Volume to the MAXIMUM!",
                //First color is background color, second color is text color. If not filled in or set to null, default colors will stay
                Color.cyan, Color.white
                );
        }