示例#1
0
    public void JoyStickMove(JOYSTICK_STATE _joyStickState)
    {
        if (!bScriptEnable)
        {
            return;
        }

        joystickState = _joyStickState;

        if (!m_playerState.IsPlayerMove())
        {
            return;
        }

        m_bUiMove = true;

        if (_joyStickState == JOYSTICK_STATE.JOYSTICK_LEFT)
        {
            m_animFuntion.SetBool(m_animFuntion.hashBMove, true);
            m_characterMove.MoveLeft(m_playerInfo.fMoveSpeed);
            m_underUI.transform.localScale = new Vector3(-1, 1, 1);
        }
        else if (_joyStickState == JOYSTICK_STATE.JOYSTICK_RIGHT)
        {
            m_animFuntion.SetBool(m_animFuntion.hashBMove, true);
            m_characterMove.MoveRight(m_playerInfo.fMoveSpeed);
            m_underUI.transform.localScale = new Vector3(1, 1, 1);
        }
        else if (m_animFuntion.GetBool(m_animFuntion.hashBMove))
        {
            m_bUiMove = false;
            m_animFuntion.SetBool(m_animFuntion.hashBMove, false);
            m_characterMove.MoveStop();
        }
    }
示例#2
0
        public VirtualJoystick(string device)
        {
            // Initalize the controller)
            Dev = CreateFile(DeviceName, EFileAccess.GenericWrite, EFileShare.Write, IntPtr.Zero, ECreationDisposition.OpenExisting, EFileAttributes.None, IntPtr.Zero);

            if (Dev.ToInt32() == -1)
            {
                Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
            }

            joyState = new JOYSTICK_STATE();

            joyState.Signature = JOYSTICK_STATE_V1;

            joyState.NumAnalog  = 4;
            joyState.NumDigital = 32;

            joyState.Analog1   = 1;
            joyState.Analog2   = 1;
            joyState.Analog3   = 1;
            joyState.Analog4   = 1;
            joyState.Digital1  = 0;
            joyState.Digital2  = 0;
            joyState.Digital3  = 0;
            joyState.Digital4  = 0;
            joyState.Digital5  = 0;
            joyState.Digital6  = 0;
            joyState.Digital7  = 0;
            joyState.Digital8  = 0;
            joyState.Digital9  = 0;
            joyState.Digital10 = 0;
            joyState.Digital11 = 0;
            joyState.Digital12 = 0;
            joyState.Digital13 = 0;
            joyState.Digital14 = 0;
            joyState.Digital15 = 0;
            joyState.Digital16 = 0;
            joyState.Digital17 = 0;
            joyState.Digital18 = 0;
            joyState.Digital19 = 0;
            joyState.Digital20 = 0;
            joyState.Digital21 = 0;
            joyState.Digital22 = 0;
            joyState.Digital23 = 0;
            joyState.Digital24 = 0;
            joyState.Digital25 = 0;
            joyState.Digital26 = 0;
            joyState.Digital27 = 0;
            joyState.Digital28 = 0;
            joyState.Digital29 = 0;
            joyState.Digital30 = 0;
            joyState.Digital31 = 0;
            joyState.Digital32 = 0;

            _th = new Thread(_DeviceWriter);
            _th.Start();

            TritonBase.AfterExit += new AnonymousSignal(TritonBase_AfterExit);
        }
示例#3
0
        public VirtualJoystick(string device)
        {
            // Initalize the controller)
            Dev = CreateFile(DeviceName, EFileAccess.GenericWrite, EFileShare.Write, IntPtr.Zero, ECreationDisposition.OpenExisting, EFileAttributes.None, IntPtr.Zero);

            if (Dev.ToInt32() == -1)
                Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());

            joyState = new JOYSTICK_STATE();

            joyState.Signature = JOYSTICK_STATE_V1;

            joyState.NumAnalog = 4;
            joyState.NumDigital = 32;

            joyState.Analog1 = 1;
            joyState.Analog2 = 1;
            joyState.Analog3 = 1;
            joyState.Analog4 = 1;
            joyState.Digital1 = 0;
            joyState.Digital2 = 0;
            joyState.Digital3 = 0;
            joyState.Digital4 = 0;
            joyState.Digital5 = 0;
            joyState.Digital6 = 0;
            joyState.Digital7 = 0;
            joyState.Digital8 = 0;
            joyState.Digital9 = 0;
            joyState.Digital10 = 0;
            joyState.Digital11 = 0;
            joyState.Digital12 = 0;
            joyState.Digital13 = 0;
            joyState.Digital14 = 0;
            joyState.Digital15 = 0;
            joyState.Digital16 = 0;
            joyState.Digital17 = 0;
            joyState.Digital18 = 0;
            joyState.Digital19 = 0;
            joyState.Digital20 = 0;
            joyState.Digital21 = 0;
            joyState.Digital22 = 0;
            joyState.Digital23 = 0;
            joyState.Digital24 = 0;
            joyState.Digital25 = 0;
            joyState.Digital26 = 0;
            joyState.Digital27 = 0;
            joyState.Digital28 = 0;
            joyState.Digital29 = 0;
            joyState.Digital30 = 0;
            joyState.Digital31 = 0;
            joyState.Digital32 = 0;

            _th = new Thread(_DeviceWriter);
            _th.Start();

            TritonBase.AfterExit += new AnonymousSignal(TritonBase_AfterExit);
        }
示例#4
0
 private static extern bool DeviceIoControl(IntPtr hDevice, uint dwIoControlCode, ref JOYSTICK_STATE lpInBuffer, Int32 nInBufferSize, IntPtr lpOutBuffer, uint nOutBufferSize, out uint lpBytesReturned, IntPtr lpOverlapped);
示例#5
0
 private static extern bool DeviceIoControl(IntPtr hDevice, uint dwIoControlCode, ref JOYSTICK_STATE lpInBuffer, Int32 nInBufferSize, IntPtr lpOutBuffer, uint nOutBufferSize, out  uint lpBytesReturned, IntPtr lpOverlapped);