From 2ca6b7da37254eceeae1fb31d03b793cffb81d35 Mon Sep 17 00:00:00 2001 From: Ali Sharoz Date: Tue, 4 Mar 2025 10:08:20 +0500 Subject: [PATCH] Touch Controls --- Assets/Scenes/BossRoom.unity | 30 ++++- .../Gameplay/UserInput/ClientInputSender.cs | 22 ++-- ProjectSettings/EditorBuildSettings.asset | 4 + ProjectSettings/InputManager.asset | 113 ++++++++++++++++++ 4 files changed, 156 insertions(+), 13 deletions(-) diff --git a/Assets/Scenes/BossRoom.unity b/Assets/Scenes/BossRoom.unity index 7770830f..8b997ebc 100644 --- a/Assets/Scenes/BossRoom.unity +++ b/Assets/Scenes/BossRoom.unity @@ -4894,7 +4894,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Material: {fileID: 1102464587} m_Color: {r: 1, g: 1, b: 1, a: 0} - m_RaycastTarget: 1 + m_RaycastTarget: 0 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: @@ -14390,6 +14390,10 @@ PrefabInstance: propertyPath: GlobalObjectIdHash value: 1893031554 objectReference: {fileID: 0} + - target: {fileID: 3029178677072641126, guid: cc55d0a8a5047dc48905945e6431a5ec, type: 3} + propertyPath: InScenePlacedSourceGlobalObjectIdHash + value: 2382957028 + objectReference: {fileID: 0} - target: {fileID: 3765979716845461200, guid: cc55d0a8a5047dc48905945e6431a5ec, type: 3} propertyPath: m_RootOrder value: 12 @@ -17922,6 +17926,10 @@ PrefabInstance: propertyPath: GlobalObjectIdHash value: 3725617381 objectReference: {fileID: 0} + - target: {fileID: 8707830667181757321, guid: 0cf63be61cf984413ad0574abf99a025, type: 3} + propertyPath: InScenePlacedSourceGlobalObjectIdHash + value: 415900578 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -18675,6 +18683,10 @@ PrefabInstance: propertyPath: GlobalObjectIdHash value: 1108263711 objectReference: {fileID: 0} + - target: {fileID: 3029178677072641126, guid: cc55d0a8a5047dc48905945e6431a5ec, type: 3} + propertyPath: InScenePlacedSourceGlobalObjectIdHash + value: 2382957028 + objectReference: {fileID: 0} - target: {fileID: 3765979716845461200, guid: cc55d0a8a5047dc48905945e6431a5ec, type: 3} propertyPath: m_RootOrder value: 11 @@ -22083,6 +22095,10 @@ PrefabInstance: propertyPath: GlobalObjectIdHash value: 2180899269 objectReference: {fileID: 0} + - target: {fileID: 6695920927348029111, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} + propertyPath: InScenePlacedSourceGlobalObjectIdHash + value: 3439787871 + objectReference: {fileID: 0} - target: {fileID: 7241368247586282332, guid: d026428052f506a4a99ce1b7c94c4d45, type: 3} propertyPath: m_DebugCheatsPanel value: @@ -215202,6 +215218,10 @@ PrefabInstance: propertyPath: GlobalObjectIdHash value: 334833956 objectReference: {fileID: 0} + - target: {fileID: 3029178677072641126, guid: cc55d0a8a5047dc48905945e6431a5ec, type: 3} + propertyPath: InScenePlacedSourceGlobalObjectIdHash + value: 2382957028 + objectReference: {fileID: 0} - target: {fileID: 3765979716845461200, guid: cc55d0a8a5047dc48905945e6431a5ec, type: 3} propertyPath: m_RootOrder value: 10 @@ -216143,11 +216163,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 9059929381734582209, guid: 334e483163a0ba54bb764e318223c9ba, type: 3} propertyPath: m_LocalPosition.x - value: 86.45001 + value: 0 objectReference: {fileID: 0} - target: {fileID: 9059929381734582209, guid: 334e483163a0ba54bb764e318223c9ba, type: 3} propertyPath: m_LocalPosition.y - value: 64 + value: 0 objectReference: {fileID: 0} - target: {fileID: 9059929381734582209, guid: 334e483163a0ba54bb764e318223c9ba, type: 3} propertyPath: m_AnchoredPosition.x @@ -248996,6 +249016,10 @@ PrefabInstance: propertyPath: m_enableAutoSizing value: 1 objectReference: {fileID: 0} + - target: {fileID: 3248795005399589873, guid: 1ea5a06766f2d924aba28a422e7d0d77, type: 3} + propertyPath: 'm_ActiveFontFeatures.Array.data[0]' + value: 1801810542 + objectReference: {fileID: 0} - target: {fileID: 3306163344670940352, guid: 1ea5a06766f2d924aba28a422e7d0d77, type: 3} propertyPath: m_IsActive value: 0 diff --git a/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs b/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs index dc33ee0c..45679589 100644 --- a/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs +++ b/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs @@ -13,10 +13,10 @@ using UnityEngine.AI; using UnityEngine.Assertions; using UnityEngine.EventSystems; using UnityEngine.Serialization; - -#if UNITY_ANDROID || UNITY_IOS using CnControls; -#endif + +//#if UNITY_ANDROID || UNITY_IOS +//#endif namespace Unity.BossRoom.Gameplay.UserInput { @@ -548,7 +548,7 @@ namespace Unity.BossRoom.Gameplay.UserInput bool SwapKeyPressed = false; private void HandleSwapInput() { - if (Input.GetKeyDown(KeyCode.Q)) + if (Input.GetKeyDown(KeyCode.Q)|| CnInputManager.GetButtonDown("Swap")) { if (CanActivateSwapMode()) { @@ -569,8 +569,10 @@ namespace Unity.BossRoom.Gameplay.UserInput private void HandleAbilityInput() { - if (Input.GetKeyDown(KeyCode.E)) // Dash'N'Crash + //if (Input.GetKeyDown(KeyCode.E)) // Dash'N'Crash + if (CnInputManager.GetButtonDown("DashNCrash")|| Input.GetKeyDown(KeyCode.E)) // Dash'N'Crash { + Debug.Log("Ali Dash"); if (!m_ServerCharacter.IsCrow) { m_UIMessageFeed.DisplayMessage("You must be the Crow to activate this ability"); @@ -578,15 +580,15 @@ namespace Unity.BossRoom.Gameplay.UserInput } ActivateAbilityIfAllowed(GameDataSource.Instance.DashNCrashAbilityKey, "Abilities are only for crow"); } - if (Input.GetKeyDown(KeyCode.R)) // Freeze Throw + if (CnInputManager.GetButtonDown("FreezeThrow") || Input.GetKeyDown(KeyCode.R)) // Freeze Throw { ActivateAbilityIfAllowed(GameDataSource.Instance.FreezeThrowAbilityKey); } - if (Input.GetKeyDown(KeyCode.F)) // Vector Wall + if (CnInputManager.GetButtonDown("VectorWall") || Input.GetKeyDown(KeyCode.F)) // Vector Wall { ActivateAbilityIfAllowed(GameDataSource.Instance.VectorWallAbilityKey); } - if (Input.GetKeyDown(KeyCode.C)) // The Executioner + if (CnInputManager.GetButtonDown("TheExecutioner") || Input.GetKeyDown(KeyCode.C)) // The Executioner { if (m_ServerCharacter.IsCrow) { @@ -595,7 +597,7 @@ namespace Unity.BossRoom.Gameplay.UserInput } ActivateAbilityIfAllowed(GameDataSource.Instance.TheExecutionerKey); } - if (Input.GetKeyDown(KeyCode.V)) // Crow's Foresight + if (CnInputManager.GetButtonDown("CrowsForesight") || Input.GetKeyDown(KeyCode.V)) // Crow's Foresight { if (!m_ServerCharacter.IsCrow) { @@ -608,7 +610,7 @@ namespace Unity.BossRoom.Gameplay.UserInput private void HandleSprint() { if(m_ServerCharacter.IsCrow) return; - if (Input.GetKey(KeyCode.LeftShift)) + if (CnInputManager.GetButtonDown("Sprint") || Input.GetKey(KeyCode.LeftShift)) { float staminaCost = 50f * Time.deltaTime; diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index c1379314..248c9d61 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -8,6 +8,9 @@ EditorBuildSettings: - enabled: 1 path: Assets/Scenes/Startup.unity guid: 86b1b2a26bfd34afa97a088e851b2fb3 + - enabled: 0 + path: Assets/Standard Assets/CNControls/Examples/Scenes/2D.unity + guid: e6fabbdad66303343829c93cd507d54a - enabled: 1 path: Assets/Scenes/MainMenu.unity guid: e676e10fba50b4172a2b5146af0b3c12 @@ -36,3 +39,4 @@ EditorBuildSettings: path: Assets/Scenes/BossRoom.unity guid: 8368882deebe81b4bb278e5aba53948a m_configObjects: {} + m_UseUCBPForAssetBundles: 0 diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset index b16147e9..cd6a0a80 100644 --- a/ProjectSettings/InputManager.asset +++ b/ProjectSettings/InputManager.asset @@ -245,6 +245,118 @@ InputManager: type: 0 axis: 0 joyNum: 0 + - serializedVersion: 3 + m_Name: DashNCrash + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 3 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: VectorWall + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 3 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Swap + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 3 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: FreezeThrow + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 3 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: TheExecutioner + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 3 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: CrowsForesight + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 3 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Sprint + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 3 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 - serializedVersion: 3 m_Name: Submit descriptiveName: @@ -485,3 +597,4 @@ InputManager: type: 2 axis: 5 joyNum: 0 + m_UsePhysicalKeys: 1