Exemplo n.º 1
0
        public void initButton(int btnXLocation, int btnYLocation, String btnText, String btnToolTip, Color btnBackgroundColor, Color btnTextColor, Color backbtnBackgroundColor, Color backbtnTextColor)
        {
            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);
        }
Exemplo n.º 2
0
        public 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);
            button.name = btnTextOn.ToLower().ToString();
            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);
        }
Exemplo n.º 3
0
        public void initButton(int btnXLocation, int btnYLocation, String btnText, UnityAction btnAction, String btnToolTip, Color btnBackgroundColor, Color btnTextColor)
        {
            Transform btnTemplate = null;

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

            button       = UnityEngine.Object.Instantiate <GameObject>(btnTemplate.gameObject, QuickMenuStuff.GetQuickMenuInstance().transform.Find(btnQMLoc), true);
            button.name  = btnText.ToLower().ToString();
            initShift[0] = -1;
            initShift[1] = 0;
            setLocation(btnXLocation, btnYLocation);
            setButtonText(btnText);
            setToolTip(btnToolTip);
            setAction(btnAction);
            setBackgroundColor(btnBackgroundColor);
            setTextColor(btnTextColor);

            setActive(true);
        }