Beispiel #1
0
        /// <summary>
        /// Fixer les valeurs du GamePad Sugoi a partir du Gamepad Windows
        /// </summary>
        /// <param name="gamepadWindows"></param>
        /// <param name="gamepadSugoi"></param>

        private void SetSugoiGamepadValue(GamepadWindows.Gamepad gamepadWindows, Gamepad gamepadSugoi)
        {
            if (gamepadWindows == null)
            {
                return;
            }

            if (gamepadSugoi == null)
            {
                return;
            }

            var gamepadValues = gamepadWindows.GetCurrentReading();

            this.SetSugoiGamepadButton(gamepadSugoi, gamepadValues, GamepadWindows.GamepadButtons.A, GamepadKeys.ButtonA);
            this.SetSugoiGamepadButton(gamepadSugoi, gamepadValues, GamepadWindows.GamepadButtons.B, GamepadKeys.ButtonB);
            this.SetSugoiGamepadButton(gamepadSugoi, gamepadValues, GamepadWindows.GamepadButtons.X, GamepadKeys.ButtonC);
            this.SetSugoiGamepadButton(gamepadSugoi, gamepadValues, GamepadWindows.GamepadButtons.Y, GamepadKeys.ButtonD);

            this.SetSugoiGamepadThumb(gamepadSugoi, gamepadValues.LeftThumbstickX, GamepadKeys.Left, GamepadKeys.Right);
            this.SetSugoiGamepadThumb(gamepadSugoi, gamepadValues.LeftThumbstickY, GamepadKeys.Down, GamepadKeys.Up);

            if (gamepadSugoi.HorizontalController == GamepadKeys.None && gamepadSugoi.VerticalController == GamepadKeys.None)
            {
                this.SetSugoiGamepadButton(gamepadSugoi, gamepadValues, GamepadWindows.GamepadButtons.DPadRight, GamepadKeys.Right);
                this.SetSugoiGamepadButton(gamepadSugoi, gamepadValues, GamepadWindows.GamepadButtons.DPadUp, GamepadKeys.Up);
                this.SetSugoiGamepadButton(gamepadSugoi, gamepadValues, GamepadWindows.GamepadButtons.DPadLeft, GamepadKeys.Left);
                this.SetSugoiGamepadButton(gamepadSugoi, gamepadValues, GamepadWindows.GamepadButtons.DPadDown, GamepadKeys.Down);
            }
        }
 public GamepadWithButtonState(
     Windows.Gaming.Input.Gamepad gamepad,
     bool buttonAWasPressedLastFrame)
 {
     this.gamepad = gamepad;
     this.buttonAWasPressedLastFrame = buttonAWasPressedLastFrame;
 }
Beispiel #3
0
        private void Gamepad_GamepadAdded(object sender, Windows.Gaming.Input.Gamepad e)
        {
            var body   = Guid.NewGuid();
            var inputs = CreateController(e, body);

            inputs.Init().ContinueWith(_ => CreatePlayer(body, inputs));
        }
    void OnGamepadRemoved(object sender, Windows.Gaming.Input.Gamepad gamepad)
    {
        var eh = _onGamepadRemoved;

        if (eh != null)
        {
            UnityEngine.WSA.Application.InvokeOnAppThread(() =>
            {
                Debug.Log("Gamepad removed. IsPresent is :" + IsPresent);
                eh(this, null);
            }, true);
        }
    }
Beispiel #5
0
    void OnGamepadRemoved(object sender, Windows.Gaming.Input.Gamepad gamepad)
    {
        var eh = _onGamepadRemoved;

        if (eh != null)
        {
            UnityEngine.WSA.Application.InvokeOnAppThread(() =>
            {
                eh(this, null);
            }, true);
        }
        TraceHelper.LogOnUnityThread("gamepad removed. IsConnected is :" + IsPresent);
    }
Beispiel #6
0
    void OnGamepadAdded(object sender, Windows.Gaming.Input.Gamepad gamepad)
    {
        TraceHelper.LogOnUnityThread("gamepad added. IsConnected is " + ControllersPresent);
        var eh = _onGamepadAdded;

        if (eh != null)
        {
            UnityEngine.WSA.Application.InvokeOnAppThread(() =>
            {
                eh(this, null);
            }, true);
        }
    }
    void OnGamepadAdded(object sender, Windows.Gaming.Input.Gamepad gamepad)
    {
        var eh = _onGamepadAdded;

        if (eh != null)
        {
            UnityEngine.WSA.Application.InvokeOnAppThread(() =>
            {
#if TRACING_VERBOSE
                Debug.Log(string.Format("Gamepad added. {0} controllers present", ControllersPresent));
#endif
                eh(this, null);
            }, true);
        }
    }
Beispiel #8
0
 private void Gamepad_GamepadAdded(object sender, Windows.Gaming.Input.Gamepad e)
 {
     this._xboxController = e;
 }
Beispiel #9
0
        //private async IAsyncEnumerable<PlayerInputs> InterseptInputs(IAsyncEnumerable<PlayerInputs> x)
        //{
        //    await foreach(var item in x)
        //    {
        //        yield return item;
        //    }
        //}

        private void Gamepad_GamepadRemoved(object sender, Windows.Gaming.Input.Gamepad e)
        {
            RemovePlayer(e);
        }