Beispiel #1
0
        public void initButton(int btnXLocation, int btnYLocation, bool btnHalf, string btnText, string btnToolTip, System.Action action = null, Color?btnBackgroundColor = null, Color?btnTextColor = null, Color?backbtnBackgroundColor = null, Color?backbtnTextColor = null)
        {
            btnType = "NestedButton";

            Transform menu = Object.Instantiate <Transform>(QMStuff.NestedMenuTemplate(), QMStuff.GetQuickMenuInstance().transform);

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

            mainButton = new ButtonAPI.SingleButton(btnQMLoc, btnXLocation, btnYLocation, btnHalf, btnText, btnToolTip, delegate()
            {
                if (action != null)
                {
                    action.Invoke();
                }
                QMStuff.ShowQuickmenuPage(menuName);
            }, btnBackgroundColor, btnTextColor);

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

            if (backbtnTextColor == null)
            {
                backbtnTextColor = Color.yellow;
            }
            backButton = new ButtonAPI.SingleButton(menuName, 5, 5, true, "Back", "Go Back", delegate()
            {
                QMStuff.ShowQuickmenuPage(btnQMLoc);
            }, backbtnTextColor, backbtnBackgroundColor);
        }
Beispiel #2
0
        public override void OnStart()
        {
            flyMenu = new ButtonAPI.NestedButton(QMmenu.mainMenuP1.GetMenuName(), 1, 0, true, "Fly", "Fly menu");

            flyButton = new ButtonAPI.ToggleButton(flyMenu.GetMenuName(), 1, 0, true, "Fly", "Toggle fly", delegate(bool state)
            {
                isFly = !isFly;
                Utils.GetLocalPlayer().gameObject.GetComponent <CharacterController>().enabled = !isFly;
                Utils.CoreLogger.Trace(isFly ? "Fly enabled" : "Fly Disabled");

                player       = Utils.GetLocalPlayer().gameObject;
                playerCamera = Utils.GetLocalPlayerCamera();
            }, Color.magenta, Color.white);

            new ButtonAPI.SingleButton(flyMenu.GetMenuName(), 2, 0, true, "▲", "Speed Up", delegate()
            {
                flySpeed++;

                speedResetButton.SetButtonText($"Speed [{flySpeed}]");
            });

            new ButtonAPI.SingleButton(flyMenu.GetMenuName(), 2, 1, true, "▼", "Speed Down", delegate()
            {
                flySpeed--;

                if (flySpeed <= 0)
                {
                    flySpeed = 1;
                }
                speedResetButton.SetButtonText($"Speed [{flySpeed}]");
            });

            speedResetButton = new ButtonAPI.SingleButton(flyMenu.GetMenuName(), 1, 1, true, $"Speed [{flySpeed}]", "Reset fly Speed", delegate()
            {
                flySpeed = 2;
                speedResetButton.SetButtonText($"Speed [{flySpeed}]");
            });
        }