Ejemplo n.º 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(QuickMenuStuff.GetQuickMenuInstance().transform.Find("CameraMenu"), QuickMenuStuff.GetQuickMenuInstance().transform);

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

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

            IEnumerator enumerator = menu.transform.GetEnumerator();

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

            if (backbtnTextColor == null)
            {
                backbtnTextColor = Color.yellow;
            }
            backButton = new QMSingleButton(this, 4, 2, "Back", new Action(() => { QuickMenuStuff.ShowQuickmenuPage(btnQMLoc); }), "Go Back", backbtnBackgroundColor, backbtnTextColor);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }