From fc1ea41818db62bd80db1bda41064aed9fd0c6b7 Mon Sep 17 00:00:00 2001 From: Vova <3emaster@gmail.com> Date: Thu, 23 May 2024 12:27:21 +0300 Subject: [PATCH] fix mouse actions --- Assets/Scenes/City.unity | 2 +- Assets/Scripts/Managers/GameManager.cs | 1 - Assets/Scripts/Managers/InGameMouseHandler.cs | 15 ++---- .../Managers/InputSystem/InputActions.cs | 2 +- Assets/Scripts/UIElements/RadialMenuItem.cs | 2 +- Packages/packages-lock.json | 51 ++++++------------- ProjectSettings/ProjectVersion.txt | 4 +- ProjectSettings/ShaderGraphSettings.asset | 2 - 8 files changed, 23 insertions(+), 56 deletions(-) diff --git a/Assets/Scenes/City.unity b/Assets/Scenes/City.unity index ce2d058d..0466c1e4 100644 --- a/Assets/Scenes/City.unity +++ b/Assets/Scenes/City.unity @@ -2451,7 +2451,7 @@ MonoBehaviour: m_OverrideVoxelSize: 1 m_VoxelSize: 0.3 m_MinRegionArea: 1 - m_NavMeshData: {fileID: 23800000, guid: a0cdc9a92c4bac44cbd576f9c5bfb78a, type: 2} + m_NavMeshData: {fileID: 23800000, guid: 3ce2e5aab30f1724e85beabcb1680e85, type: 2} m_BuildHeightMesh: 1 --- !u!4 &464115413 Transform: diff --git a/Assets/Scripts/Managers/GameManager.cs b/Assets/Scripts/Managers/GameManager.cs index 9161498f..c8920f70 100644 --- a/Assets/Scripts/Managers/GameManager.cs +++ b/Assets/Scripts/Managers/GameManager.cs @@ -44,7 +44,6 @@ public class GameManager : MonoBehaviour } private void OnDisable() { - _gameMouseHandler.Dispose(); _inputSystem.Disable(); } diff --git a/Assets/Scripts/Managers/InGameMouseHandler.cs b/Assets/Scripts/Managers/InGameMouseHandler.cs index 876d4607..76df35ee 100644 --- a/Assets/Scripts/Managers/InGameMouseHandler.cs +++ b/Assets/Scripts/Managers/InGameMouseHandler.cs @@ -14,8 +14,6 @@ public class InGameMouseHandler : UnityEngine.Object private Camera _camera; private BaseInteractableObject _selectedObject; - private bool _pressControl = false; - private bool _mousePress = false; public InGameMouseHandler(Camera camera) { @@ -26,17 +24,11 @@ public class InGameMouseHandler : UnityEngine.Object var waypointPrefab = Resources.Load("WayPointSign", typeof(WaypointVisual)) as WaypointVisual; _waypointVisual = Instantiate(waypointPrefab, GameManager.Instance.transform); - GameManager.Instance.Input.PlayerAction.PointClick.performed += ClickToMove; } - public void Dispose() + private void ClickToMove(bool isClickOnGui) { - GameManager.Instance.Input.PlayerAction.PointClick.performed += ClickToMove; - } - - private void ClickToMove(InputAction.CallbackContext context) - { - if (!_pressControl) + if (isClickOnGui) { GameManager.Instance.UI.ClosePopupMenu(); @@ -55,14 +47,13 @@ public class InGameMouseHandler : UnityEngine.Object } } } - _pressControl = false; } public void Update() { if (Mouse.current.leftButton.wasPressedThisFrame) { - _pressControl = !EventSystem.current.IsPointerOverGameObject(); + ClickToMove(!EventSystem.current.IsPointerOverGameObject()); } _ray = _camera.ScreenPointToRay(Mouse.current.position.ReadValue()); if (Physics.Raycast(_ray, out var mouseRaycastHit, 100f, _selectableLayerMask)) diff --git a/Assets/Scripts/Managers/InputSystem/InputActions.cs b/Assets/Scripts/Managers/InputSystem/InputActions.cs index b48a28ca..d3eebe69 100644 --- a/Assets/Scripts/Managers/InputSystem/InputActions.cs +++ b/Assets/Scripts/Managers/InputSystem/InputActions.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator -// version 1.8.1 +// version 1.8.2 // from Assets/Scripts/Managers/InputSystem/InputActions.inputactions // // Changes to this file may cause incorrect behavior and will be lost if diff --git a/Assets/Scripts/UIElements/RadialMenuItem.cs b/Assets/Scripts/UIElements/RadialMenuItem.cs index 8ef56afb..02d1d7eb 100644 --- a/Assets/Scripts/UIElements/RadialMenuItem.cs +++ b/Assets/Scripts/UIElements/RadialMenuItem.cs @@ -54,7 +54,7 @@ public class RadialMenuItem : MonoBehaviour public void CancelAndClose() { - tcs.TrySetCanceled(); + tcs.TrySetResult(RadialMenuActions.Cancel); Close(); } diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 5331db4b..1168d289 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -60,14 +60,13 @@ "url": "https://packages.unity.com" }, "com.unity.collections": { - "version": "2.4.0", - "depth": 2, + "version": "1.4.0", + "depth": 3, "source": "registry", "dependencies": { - "com.unity.burst": "1.8.12", + "com.unity.burst": "1.6.6", "com.unity.nuget.mono-cecil": "1.11.4", - "com.unity.test-framework": "1.4.3", - "com.unity.test-framework.performance": "3.0.3" + "com.unity.test-framework": "1.1.31" }, "url": "https://packages.unity.com" }, @@ -107,7 +106,7 @@ "url": "https://packages.unity.com" }, "com.unity.mathematics": { - "version": "1.3.1", + "version": "1.2.6", "depth": 1, "source": "registry", "dependencies": {}, @@ -115,19 +114,18 @@ }, "com.unity.nuget.mono-cecil": { "version": "1.11.4", - "depth": 3, + "depth": 4, "source": "registry", "dependencies": {}, "url": "https://packages.unity.com" }, "com.unity.render-pipelines.core": { - "version": "17.0.3", + "version": "16.0.6", "depth": 1, "source": "builtin", "dependencies": { - "com.unity.mathematics": "1.2.6", + "com.unity.mathematics": "1.2.4", "com.unity.ugui": "2.0.0", - "com.unity.collections": "2.2.0", "com.unity.modules.physics": "1.0.0", "com.unity.modules.terrain": "1.0.0", "com.unity.modules.jsonserialize": "1.0.0", @@ -141,27 +139,18 @@ "dependencies": { "com.unity.mathematics": "1.2.1", "com.unity.burst": "1.8.9", - "com.unity.render-pipelines.core": "17.0.3", - "com.unity.shadergraph": "17.0.3", - "com.unity.render-pipelines.universal-config": "17.0.3" - } - }, - "com.unity.render-pipelines.universal-config": { - "version": "17.0.3", - "depth": 1, - "source": "builtin", - "dependencies": { - "com.unity.render-pipelines.core": "17.0.3" + "com.unity.render-pipelines.core": "16.0.6", + "com.unity.shadergraph": "16.0.6" } }, "com.unity.rendering.light-transport": { - "version": "1.0.1", + "version": "1.0.2", "depth": 2, "source": "builtin", "dependencies": { - "com.unity.collections": "2.2.0", + "com.unity.collections": "1.4.0", "com.unity.mathematics": "1.2.4", - "com.unity.modules.terrain": "1.0.0" + "com.unity.render-pipelines.core": "16.0.1" } }, "com.unity.searcher": { @@ -172,11 +161,11 @@ "url": "https://packages.unity.com" }, "com.unity.shadergraph": { - "version": "17.0.3", + "version": "16.0.6", "depth": 1, "source": "builtin", "dependencies": { - "com.unity.render-pipelines.core": "17.0.3", + "com.unity.render-pipelines.core": "16.0.6", "com.unity.searcher": "4.9.2" } }, @@ -191,16 +180,6 @@ }, "url": "https://packages.unity.com" }, - "com.unity.test-framework.performance": { - "version": "3.0.3", - "depth": 3, - "source": "registry", - "dependencies": { - "com.unity.test-framework": "1.1.31", - "com.unity.modules.jsonserialize": "1.0.0" - }, - "url": "https://packages.unity.com" - }, "com.unity.timeline": { "version": "1.8.6", "depth": 0, diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 1069f07f..2ffa4518 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 6000.0.0f1 -m_EditorVersionWithRevision: 6000.0.0f1 (4ff56b3ea44c) +m_EditorVersion: 2023.2.20f1 +m_EditorVersionWithRevision: 2023.2.20f1 (0e25a174756c) diff --git a/ProjectSettings/ShaderGraphSettings.asset b/ProjectSettings/ShaderGraphSettings.asset index e66042a7..9b28428b 100644 --- a/ProjectSettings/ShaderGraphSettings.asset +++ b/ProjectSettings/ShaderGraphSettings.asset @@ -12,7 +12,5 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: de02f9e1d18f588468e474319d09a723, type: 3} m_Name: m_EditorClassIdentifier: - shaderVariantLimit: 128 customInterpolatorErrorThreshold: 32 customInterpolatorWarningThreshold: 16 - customHeatmapValues: {fileID: 0}