Exemple #1
0
        // ------------------------
        static public void CreateContextMenuForKeyBinding(Object panelOrRig, KeyCode key, System.Action onRefreshCallback = null)
        {
            InputRig          rig   = (panelOrRig as InputRig);
            TouchControlPanel panel = (panelOrRig as TouchControlPanel);

            string axisName = null;

            //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 = (string.IsNullOrEmpty(axisName) ? ("\"" + key.ToString() + "\" keycode ") : ("\"" + axisName + "\" axis "));

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



            {
                UniversalBindingAssignment.AddBindingContainerToMenu(menu, rig, onRefreshCallback, BindingDescription.BindingType.Digital, commandName,
                                                                     "Bind to Input Rig/", rig, key, null); //, null);


                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.Digital, commandName, "Bind to Touch Controls/", key, null); // true); //, null);


                    menu.AddSeparator("");


                    AddTouchControlCreationItemsToMenuForAxisOrKey(menu, panel, null, key, onRefreshCallback);
                }
            }

            menu.ShowAsContext();
        }
Exemple #2
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();
        }
Exemple #3
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();
        }
Exemple #4
0
        // ------------------------
        static public void CreateContextMenuForAxisBinding(Object panelOrRig, string axisName, /*InputRig.InputSource sourceType, */ 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 = ("\"" + axisName + "\" axis ");

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


            InputRig.AxisConfig axisConfig = rig.GetAxisConfig(axisName);
            if (axisConfig == null)
            {
                AxisCreationMenuItem.AddAllMenuItems(menu, axisName, "", rig, onRefreshCallback);
            }

            else
            {
                int
                    axisSourceTypeMask = axisConfig.GetSupportedInputSourceMask();
                BindingDescription.BindingType
                    bindingTypeMask = BindingDescription.BindingType.Axis | BindingDescription.BindingType.Digital;


                UniversalBindingAssignment.AddBindingContainerToMenu(menu, rig, onRefreshCallback, bindingTypeMask, commandName,
                                                                     "Bind to Input Rig/", rig, KeyCode.None, axisName, axisSourceTypeMask); //, true); //, null);

                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,
                                                                            bindingTypeMask, commandName, "Bind to Touch Controls/", KeyCode.None, axisName); //, true); //, null);

                    menu.AddSeparator("");

                    AddTouchControlCreationItemsToMenuForAxisOrKey(menu, panel, axisName, KeyCode.None, onRefreshCallback);
                }
            }

            menu.ShowAsContext();
        }