Пример #1
0
        // Use this for initialization
        public static Dictionary <HandControllers.DIRECTION, MenuItem> InitMenu(MenuUIHandler ui)
        {
            MenuItem dectrans = new MenuItem("- Transp", "", "dectrans", true,
                                             (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                Color color = obj.GetComponent <Renderer>().material.color;
                color.a    -= 0.1f;
                obj.GetComponent <Renderer>().material.color = color;
            }, null, ui, null);

            MenuItem addtrans = new MenuItem("+ Transp", "", "dectrans", true,
                                             (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                Color color = obj.GetComponent <Renderer>().material.color;
                color.a    += 0.1f;
                obj.GetComponent <Renderer>().material.color = color;
            }, null, ui, null);

            MenuItem scaleup = new MenuItem("Scale Up", "", "scaleup", true,
                                            (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                obj.transform.localScale += new Vector3(0.01f, 0.01f, 0.01f);
            }, null, ui, null);

            MenuItem scaledown = new MenuItem("Scale Down", "", "scaledown", true,
                                              (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                Debug.Log("DOWN BITCH");
                obj.transform.localScale -= new Vector3(0.01f, 0.01f, 0.01f);
            }, null, ui, null);



            //build all in a dictionary
            return(new Dictionary <HandControllers.DIRECTION, MenuItem>()
            {
                { HandControllers.DIRECTION.NORTH, scaleup },
                { HandControllers.DIRECTION.SOUTH, scaledown },
                { HandControllers.DIRECTION.WEST, dectrans },
                { HandControllers.DIRECTION.EAST, addtrans }
            });
        }
Пример #2
0
        public MenuItem(string _labelActive, string _labelDisabled, string _gameobjectname, bool _isActivated, Action <GameObject, ViveControllerModule.EventData> on, Action <GameObject, ViveControllerModule.EventData> off, MenuUIHandler _ui = null, GameObject _obj = null)
        {
            labelActive    = _labelActive;
            labelInActive  = _labelDisabled;
            gameobjectName = _gameobjectname;
            isActivated    = _isActivated;
            pressPairings.Add(false, off);
            pressPairings.Add(true, on);



            if (_ui)
            {
                ui = _ui;
            }
            if (_obj)
            {
                obj = _obj;
            }
        }
Пример #3
0
        // Use this for initialization
        public static Dictionary <HandControllers.DIRECTION, MenuItem> InitMenu(MenuUIHandler ui)
        {
            MenuItem nextmenu = new MenuItem("Next Menu", "", "nextmenu", true,
                                             (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                obj.SendMessage("showNextMenu", edata.viveControllerModule.gameObject.transform);
            }, null, ui, null);

            MenuItem prevmenu = new MenuItem("Prev Menu", "", "prevmenu", true,
                                             (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                obj.SendMessage("showPrevMenu", edata.viveControllerModule.gameObject.transform);
            }, null, ui, null);

            MenuItem scrollUp = new MenuItem("Scroll Up", "", "scrollup", true,
                                             (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                obj.SendMessage("scrollUp", edata.viveControllerModule.gameObject.transform);
            }, null, ui, null);


            MenuItem scrolldown = new MenuItem("Scroll Down", "", "scrolldown", true,
                                               (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                obj.SendMessage("scrollDown", edata.viveControllerModule.gameObject.transform);
            }, null, ui, null);

            // submenuitems = new List<MenuItem> { movex, scaleup, movey, movex };

            //build all in a dictionary
            return(new Dictionary <HandControllers.DIRECTION, MenuItem>()
            {
                { HandControllers.DIRECTION.WEST, prevmenu },
                { HandControllers.DIRECTION.EAST, nextmenu },
                { HandControllers.DIRECTION.NORTH, scrollUp },
                { HandControllers.DIRECTION.SOUTH, scrolldown }
            });
        }
Пример #4
0
        // Use this for initialization
        public static Dictionary <HandControllers.DIRECTION, MenuItem> InitMenu(MenuUIHandler ui)
        {
            MenuItem scaleup = new MenuItem("Scale Up", "", "scaleup", true,
                                            (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                obj.transform.localScale += new Vector3(0.1f, 0.1f, 0.1f);
            }, null, ui, null);

            MenuItem scaledown = new MenuItem("Scale Down", "", "scaledown", true,
                                              (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                obj.transform.localScale -= new Vector3(0.1f, 0.1f, 0.1f);
            }, null, ui, null);


            //movementState
            MenuItem rotate = new MenuItem("Rotate Y", "", "Rotatey", true,
                                           (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                LeanTween.rotateAround(obj, Vector3.up, 5, 0.1f);
                //movementState = ACTIONTYPE.MOVEX;
                // obj.GetComponentInChildren<AxisLineRenderer>().LockMode(AxisLineRenderer.AXIS.ROTATE);
                // obj.GetComponentInChildren<AssetWrapper>().isLocked = true;
                //update menu
            }, null, ui, null);

            rotate.menuEditState = HandControllers.EDITSTATE.ROTATE;

            //movementState
            MenuItem lockX = new MenuItem("LockX", "", "LockX", true,
                                          (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                //movementState = ACTIONTYPE.MOVEX;
                obj.GetComponentInChildren <AxisLineRenderer>().LockMode(AxisLineRenderer.AXIS.X);
                obj.GetComponentInChildren <AssetWrapper>().isLocked = true;
                //update menu
            }, null, ui, null);

            //movementState
            MenuItem lockY = new MenuItem("LockY", "", "LockY", true,
                                          (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                obj.GetComponentInChildren <AxisLineRenderer>().LockMode(AxisLineRenderer.AXIS.Y);
                obj.GetComponentInChildren <AssetWrapper>().isLocked = true;
                //update menu
            }, null, ui, null);

            //movementState
            MenuItem lockZ = new MenuItem("LockZ", "", "LockZ", true,
                                          (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                obj.GetComponentInChildren <AxisLineRenderer>().LockMode(AxisLineRenderer.AXIS.Z);
                obj.GetComponentInChildren <AssetWrapper>().isLocked = true;
                //update menu
            }, null, ui, null);

            MenuItem doneedit = new MenuItem("Done", "", "Done", true,
                                             (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                obj.GetComponentInChildren <AssetWrapper>().isLocked = false;
                obj.GetComponentInChildren <AxisLineRenderer>().LockMode(AxisLineRenderer.AXIS.ALL);
            }, null, ui, null);

            MenuItem destroy = new MenuItem("Destroy", "", "Destroy", true,
                                            (GameObject obj, ViveControllerModule.EventData edata) =>
            {
                WorldContentManager.Instance.DeleteObject(obj.GetComponentInChildren <ReverieTimelineRecorder>().objectid);
                GameObject.Destroy(obj);
            }, null, ui, null);

            // submenuitems = new List<MenuItem> { movex, scaleup, movey, movex };

            //build all in a dictionary
            return(new Dictionary <HandControllers.DIRECTION, MenuItem>()
            {
                { HandControllers.DIRECTION.NORTH, doneedit },
                { HandControllers.DIRECTION.NORTHEAST, rotate },
                { HandControllers.DIRECTION.EAST, destroy },
                { HandControllers.DIRECTION.NORTHWEST, scaleup },
                //  {HandControllers.DIRECTION.WEST, lockY },
                { HandControllers.DIRECTION.SOUTHWEST, scaledown }
            });
        }