Пример #1
0
        /** 更新。インプットシステム。ゲームパッド。パッドトリガー。
         */
        private bool Main_InputSystem_GamePad_PadTrigger(ref Pad_Status a_pad_status)
        {
                        #if (USE_DEF_FEE_INPUTSYSTEM)
            {
                UnityEngine_InputSystem.Gamepad t_gamepad = this.GetPadDevice(a_pad_status.pad_index);
                if (t_gamepad != null)
                {
                    //デバイス。
                    bool  t_l_1 = t_gamepad.leftShoulder.isPressed;
                    bool  t_r_1 = t_gamepad.rightShoulder.isPressed;
                    float t_l_2 = t_gamepad.leftTrigger.ReadValue();
                    float t_r_2 = t_gamepad.rightTrigger.ReadValue();

                    //設定。
                    a_pad_status.l_trigger_1.Set(t_l_1 & this.is_focus);
                    a_pad_status.r_trigger_1.Set(t_r_1 & this.is_focus);
                    if (this.is_focus == true)
                    {
                        a_pad_status.l_trigger_2.Set(t_l_2);
                        a_pad_status.r_trigger_2.Set(t_r_2);
                    }
                    else
                    {
                        a_pad_status.l_trigger_2.Set(0.0f);
                        a_pad_status.r_trigger_2.Set(0.0f);
                    }

                    return(true);
                }
            }
                        #endif

            return(false);
        }
Пример #2
0
        /** 更新。インプットシステム。ゲームパッド。パッドモーター。
         */
        private bool Main_InputSystem_GamePad_PadMotor(ref Pad_Status a_pad_status)
        {
                        #if (USE_DEF_FEE_INPUTSYSTEM)
            {
                UnityEngine_InputSystem.Gamepad t_gamepad = this.GetPadDevice(a_pad_status.pad_index);
                if (t_gamepad != null)
                {
                    float t_value_low      = a_pad_status.moter_low.GetValue();
                    float t_value_high     = a_pad_status.moter_high.GetValue();
                    float t_raw_value_low  = a_pad_status.moter_low.GetRawValue();
                    float t_raw_value_high = a_pad_status.moter_high.GetRawValue();

                    {
                        a_pad_status.moter_low.SetRawValue(t_value_low);
                        a_pad_status.moter_high.SetRawValue(t_value_high);
                        t_gamepad.SetMotorSpeeds(t_value_low, t_value_high);
                    }

                    return(true);
                }
            }
                        #endif

            return(false);
        }
Пример #3
0
        /** 更新。インプットシステム。デバイスリスト。
         */
        private void Main_InputSystem_UpdateDeviceList()
        {
                        #if (USE_DEF_FEE_INPUTSYSTEM)
            {
                this.paddevice_list.Clear();

                foreach (UnityEngine_InputSystem.InputDevice t_device in UnityEngine_InputSystem.InputSystem.devices)
                {
                    UnityEngine_InputSystem.Gamepad t_gamepad = t_device as UnityEngine_InputSystem.Gamepad;
                    if (t_gamepad != null)
                    {
                        this.paddevice_list.Add(t_gamepad);
                    }
                }

                this.paddevice_list.Sort((UnityEngine_InputSystem.Gamepad a_test, UnityEngine_InputSystem.Gamepad a_target) => {
                    int t_ret = a_test.deviceId - a_target.deviceId;
                    if (t_ret == 0)
                    {
                        t_ret = a_test.GetHashCode() - a_target.GetHashCode();
                    }
                    return(t_ret);
                });
            }
                        #endif
        }
Пример #4
0
 /** [シングルトン]削除。
  */
 private void Delete()
 {
                 #if (USE_DEF_FEE_INPUTSYSTEM)
     {
         foreach (UnityEngine_InputSystem.InputDevice t_device in UnityEngine_InputSystem.InputSystem.devices)
         {
             UnityEngine_InputSystem.Gamepad t_gamepad = t_device as UnityEngine_InputSystem.Gamepad;
             if (t_gamepad != null)
             {
                 t_gamepad.SetMotorSpeeds(0.0f, 0.0f);
             }
         }
     }
                 #endif
 }
Пример #5
0
        /** 更新。インプットシステム。ゲームパッド。パッドスティック。
         */
        private bool Main_InputSystem_GamePad_PadStick(ref Pad_Status a_pad_status)
        {
                        #if (USE_DEF_FEE_INPUTSYSTEM)
            {
                UnityEngine_InputSystem.Gamepad t_gamepad = this.GetPadDevice(a_pad_status.pad_index);
                if (t_gamepad != null)
                {
                    //デバイス。
                    float t_l_x  = t_gamepad.leftStick.x.ReadValue();
                    float t_l_y  = t_gamepad.leftStick.y.ReadValue();
                    float t_r_x  = t_gamepad.rightStick.x.ReadValue();
                    float t_r_y  = t_gamepad.rightStick.y.ReadValue();
                    bool  t_l_on = t_gamepad.leftStickButton.isPressed;
                    bool  t_r_on = t_gamepad.rightStickButton.isPressed;

                    //設定。
                    if (this.is_focus == true)
                    {
                        a_pad_status.l_stick.Set(t_l_x, t_l_y);
                        a_pad_status.r_stick.Set(t_r_x, t_r_y);
                    }
                    else
                    {
                        a_pad_status.l_stick.Set(0.0f, 0.0f);
                        a_pad_status.r_stick.Set(0.0f, 0.0f);
                    }
                    a_pad_status.l_stick_button.Set(t_l_on & this.is_focus);
                    a_pad_status.r_stick_button.Set(t_r_on & this.is_focus);

                    //devicename
                    a_pad_status.devicename = t_gamepad.displayName;

                    return(true);
                }
            }
                        #endif

            return(false);
        }
Пример #6
0
        /** 更新。インプットシステム。ゲームパッド。パッドデジタルボタン。
         */
        private bool Main_InputSystem_GamePad_PadDigitalButton(ref Pad_Status a_pad_status)
        {
                        #if (USE_DEF_FEE_INPUTSYSTEM)
            {
                UnityEngine_InputSystem.Gamepad t_gamepad = this.GetPadDevice(a_pad_status.pad_index);
                if (t_gamepad != null)
                {
                    //デバイス。
                    bool t_left_on       = t_gamepad.dpad.left.isPressed;
                    bool t_right_on      = t_gamepad.dpad.right.isPressed;
                    bool t_up_on         = t_gamepad.dpad.up.isPressed;
                    bool t_down_on       = t_gamepad.dpad.down.isPressed;
                    bool t_enter_on      = t_gamepad.buttonEast.isPressed;
                    bool t_escape_on     = t_gamepad.buttonSouth.isPressed;
                    bool t_sub1_on       = t_gamepad.buttonNorth.isPressed;
                    bool t_sub2_on       = t_gamepad.buttonWest.isPressed;
                    bool t_left_menu_on  = t_gamepad.selectButton.isPressed;
                    bool t_right_menu_on = t_gamepad.startButton.isPressed;

                    //設定。
                    a_pad_status.left.Set(t_left_on & this.is_focus);
                    a_pad_status.right.Set(t_right_on & this.is_focus);
                    a_pad_status.up.Set(t_up_on & this.is_focus);
                    a_pad_status.down.Set(t_down_on & this.is_focus);
                    a_pad_status.enter.Set(t_enter_on & this.is_focus);
                    a_pad_status.escape.Set(t_escape_on & this.is_focus);
                    a_pad_status.sub1.Set(t_sub1_on & this.is_focus);
                    a_pad_status.sub2.Set(t_sub2_on & this.is_focus);
                    a_pad_status.left_menu.Set(t_left_menu_on & this.is_focus);
                    a_pad_status.right_menu.Set(t_right_menu_on & this.is_focus);

                    return(true);
                }
            }
                        #endif

            return(false);
        }
Пример #7
0
 public override void MakeCurrent()
 {
     base.MakeCurrent();
     current = this;
 }