Пример #1
0
        // ------------------------
        static public void CreateContextMenuForMousePositionBinding(Object panelOrRig, System.Action onRefreshCallback = null)
        {
            InputRig          rig   = (panelOrRig as InputRig);
            TouchControlPanel panel = (panelOrRig as TouchControlPanel);

            //bool displayPanelName = false;

            if (panel != null)
            {
                rig = panel.rig;
            }

            else if (rig != null)
            {
                // Auto Select panel...

                panel = TouchControlWizardUtils.GetRigPanel(rig);
                //displayPanelName = true;
            }
            else
            {
                return;
            }


            List <TouchControl> controlList = rig.GetTouchControls();


            GenericMenu menu = new GenericMenu();


            string commandName = ("Mouse Position ");

            menu.AddDisabledItem(new GUIContent("Actions for : " + commandName));
            menu.AddSeparator("");

            UniversalBindingAssignment.AddBindingContainerToMenu(menu, rig, onRefreshCallback, BindingDescription.BindingType.MousePos, commandName,
                                                                 "Bind to Input Rig/", rig);

            menu.AddSeparator("");

            if (panel == null)
            {
                menu.AddDisabledItem(new GUIContent("Add a Touch Control Panel to this rig to create and bind commands to Touch Controls!"));
            }
            else
            {
                UniversalBindingAssignment.AddControlListBindingsToMenu(menu, controlList, onRefreshCallback,
                                                                        BindingDescription.BindingType.MousePos, commandName, "Bind to Touch Controls/");

                menu.AddSeparator("");



                int mouseTargetMaxId = CFUtils.GetEnumMaxValue(typeof(SuperTouchZoneCreationWizard.BindingSetup.MouseBindingTarget));

                for (int i = 1; i <= 2; ++i)
                {
                    for (int j = 1; j <= mouseTargetMaxId; ++j)
                    {
                        SuperTouchZoneCreationWizard.BindingSetup.MouseBindingTarget
                            mouseTarget = (SuperTouchZoneCreationWizard.BindingSetup.MouseBindingTarget)j;

                        WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [" +
                                                 ((i == 1) ? "Single-finger" : "Two-finger") + mouseTarget.ToString() + "]...", panel, typeof(SuperTouchZoneCreationWizard),
                                                 SuperTouchZoneCreationWizard.BindingSetup.MousePos(i, mouseTarget), onRefreshCallback);
                    }
                }

                menu.AddSeparator("Create a Super Touch Zone/");

                WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone...", panel,
                                         typeof(SuperTouchZoneCreationWizard), null, onRefreshCallback);
            }

            menu.ShowAsContext();
        }
Пример #2
0
        // ------------------------
        static public void CreateContextMenuForEmuTouchBinding(Object panelOrRig, System.Action onRefreshCallback = null)
        {
            InputRig          rig   = (panelOrRig as InputRig);
            TouchControlPanel panel = (panelOrRig as TouchControlPanel);

            //bool displayPanelName = false;

            if (panel != null)
            {
                rig = panel.rig;
            }

            else if (rig != null)
            {
                // Auto Select panel...

                panel = TouchControlWizardUtils.GetRigPanel(rig);
                //displayPanelName = true;
            }
            else
            {
                return;
            }


            List <TouchControl> controlList = rig.GetTouchControls();


            GenericMenu menu = new GenericMenu();


            string commandName = ("Emuulated Touch ");

            menu.AddDisabledItem(new GUIContent("Actions for : " + commandName));
            menu.AddSeparator("");

            UniversalBindingAssignment.AddBindingContainerToMenu(menu, rig, onRefreshCallback, BindingDescription.BindingType.EmuTouch, commandName,
                                                                 "Bind to Input Rig/", rig);

            menu.AddSeparator("");

            if (panel == null)
            {
                menu.AddDisabledItem(new GUIContent("Add a Touch Control Panel to this rig to create and bind commands to Touch Controls!"));
            }
            else
            {
                UniversalBindingAssignment.AddControlListBindingsToMenu(menu, controlList, onRefreshCallback,
                                                                        BindingDescription.BindingType.EmuTouch, commandName, "Bind to Touch Controls/");

                menu.AddSeparator("");



                WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Single-finger Touch]...", panel,
                                         typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.EmuTouch(1), onRefreshCallback);
                WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Two-finger Touch]...", panel,
                                         typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.EmuTouch(2), onRefreshCallback);


                menu.AddSeparator("Create a Super Touch Zone/");

                WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone...", panel,
                                         typeof(SuperTouchZoneCreationWizard), null, onRefreshCallback);
            }

            menu.ShowAsContext();
        }
Пример #3
0
        // -----------------
        static private void AddTouchControlCreationItemsToMenuForAxisOrKey(GenericMenu menu, TouchControlPanel panel, string axisName, KeyCode key,
                                                                           System.Action onRefreshCallback)
        {
            string commandName = (string.IsNullOrEmpty(axisName) ? ("\"" + key.ToString() + "\" keycode ") : ("\"" + axisName + "\" axis "));


            menu.AddSeparator("Create a Button/");

            WizardMenuItem.AddToMenu(menu, "Create a Button/Button with " + commandName + "bound to [Press] ...", panel,
                                     typeof(TouchButtonCreationWizard), TouchButtonCreationWizard.BindingSetup.PressKeyOrAxis(key, axisName), onRefreshCallback);
            WizardMenuItem.AddToMenu(menu, "Create a Button/Button with " + commandName + "bound to [Toggle]...", panel,
                                     typeof(TouchButtonCreationWizard), TouchButtonCreationWizard.BindingSetup.ToggleKeyOrAxis(key, axisName), onRefreshCallback);

            WizardMenuItem.AddToMenu(menu, "Create a Button/Button...", panel,
                                     typeof(TouchButtonCreationWizard), null, onRefreshCallback);


            //	menu.AddSeparator("");


            WizardMenuItem.AddToMenu(menu, "Create a Joystick/Joystick with " + commandName + "bound to [Press]...", panel,
                                     typeof(TouchJoystickCreationWizard), TouchJoystickCreationWizard.BindingSetup.PressKeyOrAxis(key, axisName), onRefreshCallback);

            if (!string.IsNullOrEmpty(axisName))
            {
                WizardMenuItem.AddToMenu(menu, "Create a Joystick/Joystick with " + commandName + "bound to [Horizontal Axis]...", panel,
                                         typeof(TouchJoystickCreationWizard), TouchJoystickCreationWizard.BindingSetup.HorzAxis(axisName), onRefreshCallback);
                WizardMenuItem.AddToMenu(menu, "Create a Joystick/Joystick with " + commandName + "bound to [Vertical Axis]...", panel,
                                         typeof(TouchJoystickCreationWizard), TouchJoystickCreationWizard.BindingSetup.VertAxis(axisName), onRefreshCallback);
            }

            menu.AddSeparator("Create a Joystick/");

            WizardMenuItem.AddToMenu(menu, "Create a Joystick/Joystick...", panel,
                                     typeof(TouchJoystickCreationWizard), null, onRefreshCallback);



            WizardMenuItem.AddToMenu(menu, "Create a Wheel/Wheel with " + commandName + "bound to [Press]...", panel,
                                     typeof(TouchWheelCreationWizard), TouchWheelCreationWizard.BindingSetup.PressKeyOrAxis(key, axisName), onRefreshCallback);

            if (!string.IsNullOrEmpty(axisName))
            {
                WizardMenuItem.AddToMenu(menu, "Create a Wheel/Wheel with " + commandName + "bound to [Analog Turn]...", panel,
                                         typeof(TouchWheelCreationWizard), TouchWheelCreationWizard.BindingSetup.TurnAxis(axisName), onRefreshCallback);
            }

            menu.AddSeparator("Create a Wheel/");

            WizardMenuItem.AddToMenu(menu, "Create a Wheel/Wheel...", panel,
                                     typeof(TouchWheelCreationWizard), null, onRefreshCallback);


            WizardMenuItem.AddToMenu(menu, "Create a TrackPad/TrackPad with " + commandName + "bound to [Press] bound to " + commandName + "...", panel,
                                     typeof(TouchTrackPadCreationWizard), TouchTrackPadCreationWizard.BindingSetup.PressKeyOrAxis(key, axisName), onRefreshCallback);

            if (!string.IsNullOrEmpty(axisName))
            {
                WizardMenuItem.AddToMenu(menu, "Create a TrackPad/TrackPad with " + commandName + "bound to [Horz. Swipe Delta]...", panel,
                                         typeof(TouchTrackPadCreationWizard), TouchTrackPadCreationWizard.BindingSetup.HorzAxis(axisName), onRefreshCallback);

                WizardMenuItem.AddToMenu(menu, "Create a TrackPad/TrackPad with " + commandName + "bound to [Vert. Swipe Delta]...", panel,
                                         typeof(TouchTrackPadCreationWizard), TouchTrackPadCreationWizard.BindingSetup.VertAxis(axisName), onRefreshCallback);
            }

            menu.AddSeparator("Create a TrackPad/");

            WizardMenuItem.AddToMenu(menu, "Create a TrackPad/TrackPad...", panel,
                                     typeof(TouchTrackPadCreationWizard), null, onRefreshCallback);


            WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Single-finger Press]...", panel,
                                     typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.PressKeyOrAxis(1, key, axisName), onRefreshCallback);
            WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Single-finger Tap]...", panel,
                                     typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.TapKeyOrAxis(1, key, axisName), onRefreshCallback);
            WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Two-finger Press]...", panel,
                                     typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.PressKeyOrAxis(2, key, axisName), onRefreshCallback);
            WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Two-finger Tap]...", panel,
                                     typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.TapKeyOrAxis(2, key, axisName), onRefreshCallback);

            if (!string.IsNullOrEmpty(axisName))
            {
                WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Single-finger Horz. Swipe Delta]...", panel,
                                         typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.HorzSwipeAxis(1, axisName), onRefreshCallback);
                WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Single-finger Vert. Swipe Delta]...", panel,
                                         typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.VertSwipeAxis(1, axisName), onRefreshCallback);
                WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Two-finger Horz. Swipe Delta]...", panel,
                                         typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.HorzSwipeAxis(2, axisName), onRefreshCallback);
                WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Two-finger Vert. Swipe Delta]...", panel,
                                         typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.VertSwipeAxis(2, axisName), onRefreshCallback);

                WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Single-finger Horz. Scroll]...", panel,
                                         typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.HorzScrollAxis(1, axisName), onRefreshCallback);
                WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Single-finger Vert. Scroll]...", panel,
                                         typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.VertScrollAxis(1, axisName), onRefreshCallback);
                WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Two-finger Horz. Scroll]...", panel,
                                         typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.HorzScrollAxis(2, axisName), onRefreshCallback);
                WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone with " + commandName + "bound to [Two-finger Vert. Scroll]...", panel,
                                         typeof(SuperTouchZoneCreationWizard), SuperTouchZoneCreationWizard.BindingSetup.VertScrollAxis(2, axisName), onRefreshCallback);
            }

            menu.AddSeparator("Create a Super Touch Zone/");

            WizardMenuItem.AddToMenu(menu, "Create a Super Touch Zone/Super Touch Zone...", panel,
                                     typeof(SuperTouchZoneCreationWizard), null, onRefreshCallback);
        }