Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit c591106

Browse files
Merged in fix/NewInputSystemHandler (pull request #99)
New InputSystem Handler
2 parents 7342ed2 + f349471 commit c591106

18 files changed

+393
-514
lines changed

Runtime/Scripts/Controls/InputFocus.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void Start()
2626
void Update()
2727
{
2828
// Check if the "Enter" key was just released with the chat input not focused
29-
if (Input.GetKeyUp(KeyCode.Return) && !_inputField.isFocused)
29+
if (UIExtensionsInputManager.GetKeyUp(KeyCode.Return) && !_inputField.isFocused)
3030
{
3131
// If we need to ignore the keypress, do nothing - otherwise activate the input field
3232
if (_ignoreNextActivation)
@@ -60,7 +60,7 @@ public void buttonPressed()
6060
public void OnEndEdit(string textString)
6161
{
6262
// If the edit ended because we clicked away, don't do anything extra
63-
if (!Input.GetKeyDown(KeyCode.Return))
63+
if (!UIExtensionsInputManager.GetKeyDown(KeyCode.Return))
6464
{
6565
return;
6666
}

Runtime/Scripts/Controls/SelectionBox/SelectionBox.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ void ResetBoxRect(){
147147

148148
void BeginSelection(){
149149
// Click somewhere in the Game View.
150-
if (!Input.GetMouseButtonDown(0))
150+
if (!UIExtensionsInputManager.GetMouseButtonDown(0))
151151
return;
152152

153153
//The boxRect will be inactive up until the point we start selecting
154154
boxRect.gameObject.SetActive(true);
155155

156156
// Get the initial click position of the mouse.
157-
origin = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
157+
origin = new Vector2(UIExtensionsInputManager.MousePosition.x, UIExtensionsInputManager.MousePosition.y);
158158

159159
//If the initial click point is not inside the selection mask, we abort the selection
160160
if (!PointIsValidAgainstSelectionMask(origin)) {
@@ -185,7 +185,7 @@ void BeginSelection(){
185185
selectableList.Add (selectable);
186186

187187
//We're using left shift to act as the "Add To Selection" command. So if left shift isn't pressed, we want everything to begin deselected
188-
if (!Input.GetKey (KeyCode.LeftShift)) {
188+
if (!UIExtensionsInputManager.GetKey (KeyCode.LeftShift)) {
189189
selectable.selected = false;
190190
}
191191
}
@@ -211,7 +211,7 @@ bool PointIsValidAgainstSelectionMask(Vector2 screenPoint){
211211

212212
IBoxSelectable GetSelectableAtMousePosition() {
213213
//Firstly, we cannot click on something that is not inside the selection mask (if we have one)
214-
if (!PointIsValidAgainstSelectionMask(Input.mousePosition)) {
214+
if (!PointIsValidAgainstSelectionMask(UIExtensionsInputManager.MousePosition)) {
215215
return null;
216216
}
217217

@@ -227,7 +227,7 @@ IBoxSelectable GetSelectableAtMousePosition() {
227227

228228
//Once we've found the rendering camera, we check if the selectables rectTransform contains the click. That way we
229229
//Can click anywhere on a rectTransform to select it.
230-
if (RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition, screenCamera)) {
230+
if (RectTransformUtility.RectangleContainsScreenPoint(rectTransform, UIExtensionsInputManager.MousePosition, screenCamera)) {
231231

232232
//And if it does, we select it and send it back
233233
return selectable;
@@ -240,7 +240,7 @@ IBoxSelectable GetSelectableAtMousePosition() {
240240
var selectableScreenPoint = GetScreenPointOfSelectable(selectable);
241241

242242
//Check that the click fits within the screen-radius of the selectable
243-
if (Vector2.Distance(selectableScreenPoint, Input.mousePosition) <= radius) {
243+
if (Vector2.Distance(selectableScreenPoint, UIExtensionsInputManager.MousePosition) <= radius) {
244244

245245
//And if it does, we select it and send it back
246246
return selectable;
@@ -255,11 +255,11 @@ IBoxSelectable GetSelectableAtMousePosition() {
255255

256256
void DragSelection(){
257257
//Return if we're not dragging or if the selection has been aborted (BoxRect disabled)
258-
if (!Input.GetMouseButton(0) || !boxRect.gameObject.activeSelf)
258+
if (!UIExtensionsInputManager.GetMouseButton(0) || !boxRect.gameObject.activeSelf)
259259
return;
260260

261261
// Store the current mouse position in screen space.
262-
Vector2 currentMousePosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
262+
Vector2 currentMousePosition = new Vector2(UIExtensionsInputManager.MousePosition.x, UIExtensionsInputManager.MousePosition.y);
263263

264264
// How far have we moved the mouse?
265265
Vector2 difference = currentMousePosition - origin;
@@ -414,7 +414,7 @@ public IBoxSelectable[] GetAllSelected(){
414414

415415
void EndSelection(){
416416
//Get out if we haven't finished selecting, or if the selection has been aborted (boxRect disabled)
417-
if (!Input.GetMouseButtonUp(0) || !boxRect.gameObject.activeSelf)
417+
if (!UIExtensionsInputManager.GetMouseButtonUp(0) || !boxRect.gameObject.activeSelf)
418418
return;
419419

420420
clickedAfterDrag = GetSelectableAtMousePosition();

Runtime/Scripts/InputModules.meta

Lines changed: 0 additions & 5 deletions
This file was deleted.

Runtime/Scripts/InputModules/AimerInputModule.cs

Lines changed: 0 additions & 163 deletions
This file was deleted.

Runtime/Scripts/InputModules/AimerInputModule.cs.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)