Skip to content

Commit 4477b51

Browse files
committed
Move SwitchProController class out of Gamepad.cs
1 parent a281958 commit 4477b51

File tree

5 files changed

+44
-36
lines changed

5 files changed

+44
-36
lines changed

Assets/Tests/InputSystem/Plugins/iOSTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using UnityEngine.InputSystem.iOS.LowLevel;
1010
using UnityEngine.InputSystem.LowLevel;
1111
using UnityEngine.InputSystem.Processors;
12+
using UnityEngine.InputSystem.Switch;
1213
using UnityEngine.InputSystem.XInput;
1314
using UnityEngine.TestTools;
1415
using UnityEngine.TestTools.Utils;

Packages/com.unity.inputsystem/InputSystem/Devices/Gamepad.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -806,39 +806,4 @@ public virtual void SetMotorSpeeds(float lowFrequency, float highFrequency)
806806
private static int s_GamepadCount;
807807
private static Gamepad[] s_Gamepads;
808808
}
809-
810-
/// <summary>
811-
/// Base class for Nintendo Switch Pro Controllers that provides the correct button mappings for Nintendo's face button layout where A is east, B is south, X is north, and Y is west.
812-
/// If you use InputSystem.GetDevice and the ABXY properties to represent the labels on the device, you must query for this class
813-
/// </summary>
814-
public abstract class SwitchProController : Gamepad
815-
{
816-
/// <summary>
817-
/// A Button for a Nintendo Switch Pro Controller.
818-
/// If querying via script, ensure you cast the device to a Switch Pro Controller class, rather than using the Gamepad class.
819-
/// The gamepad class will return the state of buttonSouth, whereas this class returns the state of buttonEast
820-
/// </summary>
821-
public new ButtonControl aButton => buttonEast;
822-
823-
/// <summary>
824-
/// B Button for a Nintendo Switch Pro Controller.
825-
/// If querying via script, ensure you cast the device to a Switch Pro Controller class, rather than using the Gamepad class.
826-
/// The gamepad class will return the state of buttonEast, whereas this class returns the state of buttonSouth
827-
/// </summary>
828-
public new ButtonControl bButton => buttonSouth;
829-
830-
/// <summary>
831-
/// Y Button for a Nintendo Switch Pro Controller.
832-
/// If querying via script, ensure you cast the device to a Switch Pro Controller class, rather than using the Gamepad class.
833-
/// The gamepad class will return the state of buttonNorth, whereas this class returns the state of buttonWest
834-
/// </summary>
835-
public new ButtonControl yButton => buttonWest;
836-
837-
/// <summary>
838-
/// X Button for a Nintendo Switch Pro Controller.
839-
/// If querying via script, ensure you cast the device to a Switch Pro Controller class, rather than using the Gamepad class.
840-
/// The gamepad class will return the state of buttonWest, whereas this class returns the state of buttonNorth
841-
/// </summary>
842-
public new ButtonControl xButton => buttonNorth;
843-
}
844809
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using UnityEngine.InputSystem.Controls;
2+
3+
namespace UnityEngine.InputSystem.Switch
4+
{
5+
/// <summary>
6+
/// Base class for Nintendo Switch Pro Controllers that provides the correct button mappings for Nintendo's face button layout where A is east, B is south, X is north, and Y is west.
7+
/// If you use InputSystem.GetDevice and the ABXY properties to represent the labels on the device, you must query for this class
8+
/// </summary>
9+
public abstract class SwitchProController : Gamepad
10+
{
11+
/// <summary>
12+
/// A Button for a Nintendo Switch Pro Controller.
13+
/// If querying via script, ensure you cast the device to a Switch Pro Controller class, rather than using the Gamepad class.
14+
/// The gamepad class will return the state of buttonSouth, whereas this class returns the state of buttonEast
15+
/// </summary>
16+
public new ButtonControl aButton => buttonEast;
17+
18+
/// <summary>
19+
/// B Button for a Nintendo Switch Pro Controller.
20+
/// If querying via script, ensure you cast the device to a Switch Pro Controller class, rather than using the Gamepad class.
21+
/// The gamepad class will return the state of buttonEast, whereas this class returns the state of buttonSouth
22+
/// </summary>
23+
public new ButtonControl bButton => buttonSouth;
24+
25+
/// <summary>
26+
/// Y Button for a Nintendo Switch Pro Controller.
27+
/// If querying via script, ensure you cast the device to a Switch Pro Controller class, rather than using the Gamepad class.
28+
/// The gamepad class will return the state of buttonNorth, whereas this class returns the state of buttonWest
29+
/// </summary>
30+
public new ButtonControl yButton => buttonWest;
31+
32+
/// <summary>
33+
/// X Button for a Nintendo Switch Pro Controller.
34+
/// If querying via script, ensure you cast the device to a Switch Pro Controller class, rather than using the Gamepad class.
35+
/// The gamepad class will return the state of buttonWest, whereas this class returns the state of buttonNorth
36+
/// </summary>
37+
public new ButtonControl xButton => buttonNorth;
38+
}
39+
}

Packages/com.unity.inputsystem/InputSystem/Plugins/Switch/SwitchProController.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Packages/com.unity.inputsystem/InputSystem/Plugins/iOS/IOSGameController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#if UNITY_EDITOR || UNITY_IOS || UNITY_TVOS || UNITY_VISIONOS || PACKAGE_DOCS_GENERATION
22
using System.Runtime.InteropServices;
3-
using UnityEngine.InputSystem.Controls;
43
using UnityEngine.InputSystem.DualShock;
54
using UnityEngine.InputSystem.Layouts;
65
using UnityEngine.InputSystem.LowLevel;
76
using UnityEngine.InputSystem.iOS.LowLevel;
7+
using UnityEngine.InputSystem.Switch;
88
using UnityEngine.InputSystem.Utilities;
99

1010
namespace UnityEngine.InputSystem.iOS.LowLevel

0 commit comments

Comments
 (0)