コード例 #1
0
        private void Update()
        {
            for (int i = 0; i < m_gamepadStateText.Length; i++)
            {
                m_gamepadStateText[i].text = i.ToString() + ": " + GamepadHandler.GamepadName(i);                                               // InputManager.Gamepad.GamepadAvailable(i, out _) ? "Connected" : "Not Connected";
            }
            for (int i = 0; i < m_gamepadButtonText.Length; i++)
            {
                m_gamepadButtonText[i].text = GamepadHandler.GetButton((GamepadButton)i, playerID).ToString();
            }
            for (int i = 0; i < m_gamepadAxisText.Length; i++)
            {
                m_gamepadAxisText[i].text = GamepadHandler.GetAxis((GamepadAxis)i, playerID).ToString();
            }

            // if(InputManager.Gamepad.GamepadProfile.DPadType == GamepadDPadType.Axis) {
            //     if(InputManager.Gamepad.GetButtonDown(GamepadButton.DPadUp, playerID)) Debug.Log("DPadUp was pressed!");
            //     if(InputManager.Gamepad.GetButtonDown(GamepadButton.DPadDown, playerID)) Debug.Log("DPadDown was pressed!");
            //     if(InputManager.Gamepad.GetButtonDown(GamepadButton.DPadLeft, playerID)) Debug.Log("DPadLeft was pressed!");
            //     if(InputManager.Gamepad.GetButtonDown(GamepadButton.DPadRight, playerID)) Debug.Log("DPadRight was pressed!");

            //     if(InputManager.Gamepad.GetButtonUp(GamepadButton.DPadUp, playerID)) Debug.Log("DPadUp was released!");
            //     if(InputManager.Gamepad.GetButtonUp(GamepadButton.DPadDown, playerID)) Debug.Log("DPadDown was released!");
            //     if(InputManager.Gamepad.GetButtonUp(GamepadButton.DPadLeft, playerID)) Debug.Log("DPadLeft was released!");
            //     if(InputManager.Gamepad.GetButtonUp(GamepadButton.DPadRight, playerID)) Debug.Log("DPadRight was released!");
            // }
        }
コード例 #2
0
        public void OnGUI()
        {
            if (gamepadProfiles == null)
            {
                gamepadProfiles = GamepadHandler.LoadAllGamepadProfiles();
            }

            if (gamepadProfiles.Length <= 0 || (hasSelection && selectedProfileIndex >= gamepadProfiles.Length))
            {
                InputManagerWindow.ResetSelections();
            }

            float testButtonHeight = 30;

            if (Application.isPlaying)
            {
                testButtonHeight += 45;
                if (testSceneEditor.lastScene != null)
                {
                    testButtonHeight += 44;
                }
            }

            if (HierarchyGUI.Draw(InputManagerWindow.tabsOffYOffset + testButtonHeight, false, BuildHierarchyElementsList(), DrawSelected, CreateEditMenu))
            {
                OnNewProfileSelection(gamepadProfiles[selectedProfileIndex]);
            }

            Rect testRect = new Rect(0.0f, 0.0f, InputManagerWindow.width, testButtonHeight);

            testRect.y += InputManagerWindow.tabsOffYOffset;

            GUILayout.BeginArea(testRect);

            for (int i = 0; i < 1; i++)
            {
                EditorGUILayout.Space();
            }

            if (Application.isPlaying)
            {
                if (testSceneEditor.lastScene != null)
                {
                    EditorGUILayout.HelpBox("Do not close the Input Manager window while in the gamepad testing scene.\n\nOr you will not be taken back to the original scene you were working on...", MessageType.Warning);
                }
                EditorGUILayout.HelpBox("[Play Mode]: Any new Profiles will be active the next time you enter play mode.", MessageType.Info);
            }
            else
            {
                if (GUILayout.Button("Start Gamepad Inputs Testing Scene"))
                {
                    testSceneEditor.StartTestScene();
                }
            }

            GUILayout.EndArea();
        }
コード例 #3
0
        private void Update()
        {
            for (int i = 0; i < m_gamepadStateText.Length; i++)
            {
                m_gamepadStateText[i].text = InputManager.Gamepad.GamepadIsConnected(i) ? "Connected" : "Not Connected";
            }

            for (int i = 0; i < m_gamepadButtonText.Length; i++)
            {
                m_gamepadButtonText[i].text = InputManager.Gamepad.GetButton((GamepadButton)i, playerID).ToString();
            }

            for (int i = 0; i < m_gamepadAxisText.Length; i++)
            {
                m_gamepadAxisText[i].text = InputManager.Gamepad.GetAxis((GamepadAxis)i, playerID).ToString();
            }

            GamepadHandler adapter = InputManager.Gamepad;//.Adapter as GenericGamepadStateAdapter;

            if (adapter.GamepadProfile.DPadType == GamepadDPadType.Axis)
            {
                if (InputManager.Gamepad.GetButtonDown(GamepadButton.DPadUp, playerID))
                {
                    Debug.Log("DPadUp was pressed!");
                }
                if (InputManager.Gamepad.GetButtonDown(GamepadButton.DPadDown, playerID))
                {
                    Debug.Log("DPadDown was pressed!");
                }
                if (InputManager.Gamepad.GetButtonDown(GamepadButton.DPadLeft, playerID))
                {
                    Debug.Log("DPadLeft was pressed!");
                }
                if (InputManager.Gamepad.GetButtonDown(GamepadButton.DPadRight, playerID))
                {
                    Debug.Log("DPadRight was pressed!");
                }

                if (InputManager.Gamepad.GetButtonUp(GamepadButton.DPadUp, playerID))
                {
                    Debug.Log("DPadUp was released!");
                }
                if (InputManager.Gamepad.GetButtonUp(GamepadButton.DPadDown, playerID))
                {
                    Debug.Log("DPadDown was released!");
                }
                if (InputManager.Gamepad.GetButtonUp(GamepadButton.DPadLeft, playerID))
                {
                    Debug.Log("DPadLeft was released!");
                }
                if (InputManager.Gamepad.GetButtonUp(GamepadButton.DPadRight, playerID))
                {
                    Debug.Log("DPadRight was released!");
                }
            }
        }
コード例 #4
0
 public PositionSelector(Vector3 position, Vector3 rotation)
 {
     this.GamepadHandler = new GamepadHandler();
     this.GamepadHandler.LeftStickChanged  += LeftStickChanged;
     this.GamepadHandler.RightStickChanged += RightStickChanged;
     this.GamepadHandler.LeftStickPressed  += LeftStickPressed;
     this._instructionalButtons             = new Scaleform(Function.Call <int>(Hash.REQUEST_SCALEFORM_MOVIE, "instructional_buttons"));
     this._mainCamera          = World.CreateCamera(position, rotation, 50f);
     this._mainCamera.IsActive = false;
     this._renderSceneTimer    = new Timer(5000);
     this._renderSceneTimer.Start();
 }
コード例 #5
0
ファイル: MainWindow.xaml.cs プロジェクト: jcfain/TCodeRemote
        public MainWindow()
        {
            Dispatcher.UnhandledException += Dispatcher_UnhandledException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;;

            GamepadHandler = new GamepadHandler();
            GamepadHandler.ConnectionChange            += GamepadConnected_Changed;
            InputSerialDeviceHandler                    = new SerialDeviceHandler(OSRRemoteDeviceMode.In);
            InputSerialDeviceHandler.ConnectionChange  += SerialConnected_Changed;
            OutputSerialDeviceHandler                   = new SerialDeviceHandler(OSRRemoteDeviceMode.Out);
            OutputSerialDeviceHandler.ConnectionChange += SerialConnected_Changed;
            SerialPorts            = OutputSerialDeviceHandler.GetPorts();
            BLEDevices             = new ObservableCollection <DeviceModel>();
            InputTcpAddresshandler = new TcpHandler(OSRRemoteDeviceMode.In);
            InputTcpAddresshandler.ConnectionChange += NetworkConnected_Changed;
            OutputTcpAddresshandler = new TcpHandler(OSRRemoteDeviceMode.Out);
            OutputTcpAddresshandler.ConnectionChange += NetworkConnected_Changed;
            InputUdpAddresshandler = new UdpHandler(OSRRemoteDeviceMode.In);
            InputUdpAddresshandler.ConnectionChange += NetworkConnected_Changed;
            OutputUdpAddresshandler = new UdpHandler(OSRRemoteDeviceMode.Out);
            OutputUdpAddresshandler.ConnectionChange += NetworkConnected_Changed;
            //BLEDeviceHandler = new BLEDeviceHandler(OSRRemoteDeviceMode.Out);
            //BLEDeviceHandler.ConnectionChange += BLEDeviceHandler_ConnectionChanged;
            //BLEDeviceHandler.DeviceAdded += BLEDeviceAdded;
            //BLEDeviceHandler.DeviceRemoved += BLEDeviceRemoved;



            InitializeComponent();

            this.DataContext       = this;
            IPAddressLabel.Content = GetLocalIPV4Address();

            RestoreSavedSettings();

            _outputNetworkAddressTxtDebouncer        = new Debouncer();
            _outputNetworkAddressTxtDebouncer.Idled += OutputNetworkAddressTxtDebouncer_Idled;
            _inputNetworkPortTxtDebouncer            = new Debouncer();
            _inputNetworkPortTxtDebouncer.Idled     += InputNetworkPortTxtDebouncer_Idled;

            //BLERdo.Checked += OutRadio_Checked;
        }
コード例 #6
0
        static bool ScanJoystickAxis(int numJoysticks)
        {
            int axes = 8;

            for (int i = 0; i < axes; i++)
            {
                GamepadAxis axis = (GamepadAxis)i;
                for (int x = 0; x < numJoysticks; x++)
                {
                    float axisRaw = GamepadHandler.GetAxisRaw(axis, x, .2f);
                    if (Mathf.Abs(axisRaw) >= 1.0f)
                    {
                        if (scanHandler(ScanResult.GamepadAxisResult(axis, axisRaw)))
                        {
                            return(EndScan());
                        }
                    }
                }
            }
            return(false);
        }
コード例 #7
0
        static bool ScanJoystickButton(int numJoysticks)
        {
            int gamepadButtons = 14;

            for (int i = 0; i < gamepadButtons; i++)
            {
                GamepadButton button = (GamepadButton)i;
                // for (int x = 0; x < InputBinding.MAX_JOYSTICKS; x++) {
                for (int x = 0; x < numJoysticks; x++)
                {
                    if (GamepadHandler.GetButtonDown(button, x))
                    {
                        if (scanHandler(ScanResult.GamepadButtonResult(button)))
                        {
                            return(EndScan());
                        }
                    }
                }
            }
            return(false);
        }
コード例 #8
0
 void ReloadProfilesAndRepaint()
 {
     gamepadProfiles = GamepadHandler.LoadAllGamepadProfiles();
     InputManagerWindow.ResetSelections();
     InputManagerWindow.instance.Repaint();
 }