Skip to content

Commit 3191c2e

Browse files
committed
Reformatted files
1 parent eaa9295 commit 3191c2e

File tree

7 files changed

+34
-43
lines changed

7 files changed

+34
-43
lines changed

Assets/Samples/RebindingUI/ActionIndicator.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,30 @@ public class ActionUIIndicator : MonoBehaviour
1212
{
1313
[Tooltip("Reference to the associated action to be visualized.")]
1414
public InputActionReference action;
15-
15+
1616
[Tooltip("The color to show when the associated action is performed.")]
17-
public Color activeColor = Color.green;
18-
17+
public Color activeColor = Color.green;
18+
1919
[Tooltip("The color to show when the associated action has not been performed for the specified duration.")]
2020
public Color inactiveColor = Color.black;
21-
21+
2222
[Tooltip("The duration for which the indicator should be lit before becoming completely inactive.")]
2323
public float duration = 1.0f;
24-
24+
2525
private double m_RealTimeLastPerformed;
2626
private Image m_Image;
27-
27+
2828
void Start()
2929
{
3030
m_Image = GetComponent<Image>();
3131
}
32-
32+
3333
private void OnEnable()
3434
{
3535
action.action.performed += OnPerformed;
3636
action.action.Enable();
3737
}
38-
38+
3939
private void OnDisable()
4040
{
4141
action.action.Disable();
@@ -50,7 +50,7 @@ private void OnPerformed(InputAction.CallbackContext obj)
5050
private void Update()
5151
{
5252
var elapsedSincePerformed = Time.realtimeSinceStartupAsDouble - m_RealTimeLastPerformed;
53-
m_Image.color = duration <= 0.0f ? inactiveColor : Color.Lerp(inactiveColor, activeColor,
53+
m_Image.color = duration <= 0.0f ? inactiveColor : Color.Lerp(inactiveColor, activeColor,
5454
(float)Math.Max(0.0, 1.0 - elapsedSincePerformed / duration));
5555
}
5656
}

Assets/Samples/RebindingUI/GameManager.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ public class GameManager : MonoBehaviour
99
{
1010
// TODO Its still an issue if we assign UI cancel button in rebinding,
1111
// same goes for keyboard ESC
12-
12+
1313
public GameObject menu;
1414
public InputActionAsset gameplayActions;
1515
public InputActionReference menuAction;
1616
public InputActionReference exitMenuAction;
1717
public GameObject initiallySelectedGameObject;
18-
18+
1919
void Start()
2020
{
2121
// Let menu initially be disabled
2222
menu.SetActive(false);
23-
23+
2424
// Let gameplay actions be initially enabled
2525
gameplayActions.Enable();
2626
}
@@ -41,10 +41,10 @@ private void OnMenu(InputAction.CallbackContext obj)
4141
{
4242
// Disable gameplay actions while in menu
4343
gameplayActions.Disable();
44-
44+
4545
// Enable menu if currently not active
4646
menu.SetActive(true);
47-
47+
4848
// Make sure EventSystem has a selection to allow gamepad navigation
4949
if (EventSystem.current.currentSelectedGameObject == null)
5050
EventSystem.current.SetSelectedGameObject(EventSystem.current.firstSelectedGameObject);
@@ -54,10 +54,10 @@ private void OnExitMenu(InputAction.CallbackContext obj)
5454
{
5555
if (!menu.activeInHierarchy)
5656
return;
57-
57+
5858
// Hide menu
5959
menu.SetActive(false);
60-
60+
6161
// Reenable gameplay actions
6262
gameplayActions.Enable();
6363
}

Assets/Samples/RebindingUI/RebindActionUI.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ private void PerformInteractiveRebind(InputAction action, int bindingIndex, bool
257257
m_RebindOperation?.Cancel(); // Will null out m_RebindOperation.
258258

259259
var actionWasEnabledPriorToRebind = action.enabled; // Allow restoring enabled state
260-
260+
261261
void CleanUp()
262262
{
263263
m_RebindOperation?.Dispose();
@@ -266,7 +266,7 @@ void CleanUp()
266266
// Restore action enabled state based on state prior to rebind
267267
if (actionWasEnabledPriorToRebind)
268268
action.actionMap.Enable();
269-
269+
270270
m_UIInputActionMap?.Enable();
271271
}
272272

Assets/Samples/RebindingUI/RebindingUISampleController.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public class RebindingUISampleController : MonoBehaviour
1616
public InputActionReference interact;
1717
public InputActionReference use;
1818
public InputActionReference menu;
19-
19+
2020
public float movementSpeed = 10.0f;
21-
21+
2222
private Material m_Material;
2323
private Vector3 m_TargetPosition;
2424
private Vector3 m_TargetEulerAngles;
@@ -40,7 +40,7 @@ private void OnEnable()
4040
{
4141
if (target != null)
4242
m_TargetPosition = target.transform.position;
43-
43+
4444
move?.action?.Enable();
4545
look?.action?.Enable();
4646
interact?.action?.Enable();
@@ -60,7 +60,7 @@ private void Update()
6060
// When we "Move" we add to the target position
6161
if (move != null && move.action != null)
6262
m_TargetPosition += (Vector3)(move.action.ReadValue<Vector2>() * Time.deltaTime * movementSpeed);
63-
63+
6464
// When we "Look" we rotate the target object relative to its current orientation.
6565
if (look != null && look.action != null && target != null)
6666
{
@@ -69,15 +69,15 @@ private void Update()
6969
// to convert absolute movement to movement per time unit.
7070
var timeInvariant = (look.action.activeControl is DeltaControl);
7171
var scale = timeInvariant ? 1.0f : Time.deltaTime * 300.0f;
72-
72+
7373
target.transform.Rotate(Vector3.up, look.action.ReadValue<Vector2>().x * -1.0f * scale, Space.World);
7474
target.transform.Rotate(Vector3.right, look.action.ReadValue<Vector2>().y * 1.0f * scale, Space.World);
7575
}
76-
76+
7777
// When we "Interact", we move to the next target color
7878
if (interact.action.WasPressedThisFrame())
7979
m_TargetColor = Colors[(++m_ColorIndex % Colors.Length)];
80-
80+
8181
// When we "Use", we toggle scale of secondary object
8282
if (use.action.WasPerformedThisFrame())
8383
m_TargetScale = (Mathf.Approximately(m_TargetScale, 0.0f) ? 1.0f : 0.0f);

Assets/Samples/RebindingUI/RebindingUISampleScene.unity

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4259,22 +4259,13 @@ GameObject:
42594259
m_Component:
42604260
- component: {fileID: 1183078599}
42614261
- component: {fileID: 1183078598}
4262-
- component: {fileID: 1183078597}
42634262
m_Layer: 0
42644263
m_Name: Main Camera
42654264
m_TagString: MainCamera
42664265
m_Icon: {fileID: 0}
42674266
m_NavMeshLayer: 0
42684267
m_StaticEditorFlags: 0
42694268
m_IsActive: 1
4270-
--- !u!81 &1183078597
4271-
AudioListener:
4272-
m_ObjectHideFlags: 0
4273-
m_CorrespondingSourceObject: {fileID: 0}
4274-
m_PrefabInstance: {fileID: 0}
4275-
m_PrefabAsset: {fileID: 0}
4276-
m_GameObject: {fileID: 1183078596}
4277-
m_Enabled: 1
42784269
--- !u!20 &1183078598
42794270
Camera:
42804271
m_ObjectHideFlags: 0

Assets/Tests/InputSystem/CoreTests_Events.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,20 +1229,20 @@ class SuppressedActionEventData
12291229
public void EventHandledPolicy_ShouldReflectUserSetting()
12301230
{
12311231
// Assert default setting
1232-
Assert.That(InputSystem.inputEventHandledPolicy, Is.EqualTo(InputEventHandledPolicy.SuppressStateUpdates));
1232+
Assert.That(InputSystem.s_Manager.inputEventHandledPolicy, Is.EqualTo(InputEventHandledPolicy.SuppressStateUpdates));
12331233

12341234
// Assert policy can be changed
1235-
InputSystem.inputEventHandledPolicy = InputEventHandledPolicy.SuppressActionUpdates;
1236-
Assert.That(InputSystem.inputEventHandledPolicy, Is.EqualTo(InputEventHandledPolicy.SuppressActionUpdates));
1235+
InputSystem.s_Manager.inputEventHandledPolicy = InputEventHandledPolicy.SuppressActionUpdates;
1236+
Assert.That(InputSystem.s_Manager.inputEventHandledPolicy, Is.EqualTo(InputEventHandledPolicy.SuppressActionUpdates));
12371237

12381238
// Assert policy can be changed back
1239-
InputSystem.inputEventHandledPolicy = InputEventHandledPolicy.SuppressStateUpdates;
1240-
Assert.That(InputSystem.inputEventHandledPolicy, Is.EqualTo(InputEventHandledPolicy.SuppressStateUpdates));
1239+
InputSystem.s_Manager.inputEventHandledPolicy = InputEventHandledPolicy.SuppressStateUpdates;
1240+
Assert.That(InputSystem.s_Manager.inputEventHandledPolicy, Is.EqualTo(InputEventHandledPolicy.SuppressStateUpdates));
12411241

12421242
// Assert setting property to an invalid value throws exception and do not have side-effects
12431243
Assert.Throws<ArgumentOutOfRangeException>(() =>
1244-
InputSystem.inputEventHandledPolicy = (InputEventHandledPolicy)123456);
1245-
Assert.That(InputSystem.inputEventHandledPolicy, Is.EqualTo(InputEventHandledPolicy.SuppressStateUpdates));
1244+
InputSystem.s_Manager.inputEventHandledPolicy = (InputEventHandledPolicy)123456);
1245+
Assert.That(InputSystem.s_Manager.inputEventHandledPolicy, Is.EqualTo(InputEventHandledPolicy.SuppressStateUpdates));
12461246
}
12471247

12481248
[TestCase(InputEventHandledPolicy.SuppressStateUpdates,
@@ -1255,7 +1255,7 @@ public void Events_ShouldRespectHandledPolicyUponUpdate(InputEventHandledPolicy
12551255
int[] expectedProcessed, int[] expectedCancelled) // EDIT
12561256
{
12571257
// Update setting to match desired scenario
1258-
InputSystem.inputEventHandledPolicy = policy;
1258+
InputSystem.s_Manager.inputEventHandledPolicy = policy;
12591259

12601260
// Use a boxed boolean to allow lambda to capture reference.
12611261
var data = new SuppressedActionEventData();

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ however, it has to be formatted properly to pass verification tests.
1111
## [Unreleased] - yyyy-mm-dd
1212

1313
### Changed
14-
- Expanded `RebindingUISample` to include a "game mode" state and a "menu state" to be more similar to a real game. Also added action-performed indicators illustrating when actions get triggered.
14+
- Expanded `RebindingUISample` to include a "game mode" state and a "menu state" to be more similar to a real game. Also added action-performed indicators illustrating when actions get triggered.
1515

1616
### Added
1717
- Support for Xbox controllers over USB on macOS, using macOS's default driver. [ISXB-1548]

0 commit comments

Comments
 (0)