using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.Scripting;
////TODO: speaker, touchpad
////TODO: move gyro here
namespace UnityEngine.InputSystem.DualShock
{
///
/// A Sony DualShock/DualSense controller.
///
[InputControlLayout(displayName = "PlayStation Controller")]
public class DualShockGamepad : Gamepad, IDualShockHaptics
{
///
/// Button that is triggered when the touchbar on the controller is pressed down.
///
/// Control representing the touchbar button.
[InputControl(name = "buttonWest", displayName = "Square", shortDisplayName = "Square")]
[InputControl(name = "buttonNorth", displayName = "Triangle", shortDisplayName = "Triangle")]
[InputControl(name = "buttonEast", displayName = "Circle", shortDisplayName = "Circle")]
[InputControl(name = "buttonSouth", displayName = "Cross", shortDisplayName = "Cross")]
[InputControl]
public ButtonControl touchpadButton { get; protected set; }
///
/// The right side button in the middle section of the controller. Equivalent to
/// .
///
/// Same as .
[InputControl(name = "start", displayName = "Options")]
public ButtonControl optionsButton { get; protected set; }
///
/// The left side button in the middle section of the controller. Equivalent to
///
///
/// Same as .
[InputControl(name = "select", displayName = "Share")]
public ButtonControl shareButton { get; protected set; }
///
/// The left shoulder button.
///
/// Equivalent to .
[InputControl(name = "leftShoulder", displayName = "L1", shortDisplayName = "L1")]
public ButtonControl L1 { get; protected set; }
///
/// The right shoulder button.
///
/// Equivalent to .
[InputControl(name = "rightShoulder", displayName = "R1", shortDisplayName = "R1")]
public ButtonControl R1 { get; protected set; }
///
/// The left trigger button.
///
/// Equivalent to .
[InputControl(name = "leftTrigger", displayName = "L2", shortDisplayName = "L2")]
public ButtonControl L2 { get; protected set; }
///
/// The right trigger button.
///
/// Equivalent to .
[InputControl(name = "rightTrigger", displayName = "R2", shortDisplayName = "R2")]
public ButtonControl R2 { get; protected set; }
///
/// The left stick press button.
///
/// Equivalent to .
[InputControl(name = "leftStickPress", displayName = "L3", shortDisplayName = "L3")]
public ButtonControl L3 { get; protected set; }
///
/// The right stick press button.
///
/// Equivalent to .
[InputControl(name = "rightStickPress", displayName = "R3", shortDisplayName = "R3")]
public ButtonControl R3 { get; protected set; }
///
/// The last used/added DualShock controller.
///
/// Equivalent to .
public new static DualShockGamepad current { get; private set; }
///
/// If the controller is connected over HID, returns data parsed from .
///
internal HID.HID.HIDDeviceDescriptor hidDescriptor { get; private set; }
///
public override void MakeCurrent()
{
base.MakeCurrent();
current = this;
}
///
protected override void OnRemoved()
{
base.OnRemoved();
if (current == this)
current = null;
}
///
protected override void FinishSetup()
{
base.FinishSetup();
touchpadButton = GetChildControl("touchpadButton");
optionsButton = startButton;
shareButton = selectButton;
L1 = leftShoulder;
R1 = rightShoulder;
L2 = leftTrigger;
R2 = rightTrigger;
L3 = leftStickButton;
R3 = rightStickButton;
if (m_Description.capabilities != null && m_Description.interfaceName == "HID")
hidDescriptor = HID.HID.HIDDeviceDescriptor.FromJson(m_Description.capabilities);
}
///
public virtual void SetLightBarColor(Color color)
{
}
}
}