diff --git a/.idea/.idea.HALLUCINATE/.idea/workspace.xml b/.idea/.idea.HALLUCINATE/.idea/workspace.xml
index 09c57bba..36e32af1 100644
--- a/.idea/.idea.HALLUCINATE/.idea/workspace.xml
+++ b/.idea/.idea.HALLUCINATE/.idea/workspace.xml
@@ -6,7 +6,14 @@
+
+
+
+
+
+
+
@@ -143,7 +150,7 @@
-
+
diff --git a/Assets/InputSystem_Actions.inputactions b/Assets/InputSystem_Actions.inputactions
index a34d7931..0cc46afa 100644
--- a/Assets/InputSystem_Actions.inputactions
+++ b/Assets/InputSystem_Actions.inputactions
@@ -642,6 +642,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
+ },
+ {
+ "name": "ToggleSetting",
+ "type": "Button",
+ "id": "ae29d662-c797-4411-8ff3-8b5ad78427d8",
+ "expectedControlType": "",
+ "processors": "",
+ "interactions": "",
+ "initialStateCheck": false
}
],
"bindings": [
@@ -1062,6 +1071,39 @@
"action": "TrackedDeviceOrientation",
"isComposite": false,
"isPartOfComposite": false
+ },
+ {
+ "name": "One Modifier",
+ "id": "112443de-ae57-4a55-a65c-98090d95ee75",
+ "path": "OneModifier",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "ToggleSetting",
+ "isComposite": true,
+ "isPartOfComposite": false
+ },
+ {
+ "name": "modifier",
+ "id": "4fae2510-0264-46ca-9c9d-9d2cb0ad32d1",
+ "path": "/leftCtrl",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "ToggleSetting",
+ "isComposite": false,
+ "isPartOfComposite": true
+ },
+ {
+ "name": "binding",
+ "id": "822afb75-3d28-4c6d-8a32-3c7c65f81ddb",
+ "path": "/o",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "ToggleSetting",
+ "isComposite": false,
+ "isPartOfComposite": true
}
]
}
diff --git a/Assets/Scove/UIScaleTest.unity b/Assets/Scove/UIScaleTest.unity
index 1a8a17dc..aea8b375 100644
--- a/Assets/Scove/UIScaleTest.unity
+++ b/Assets/Scove/UIScaleTest.unity
@@ -149,10 +149,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: bcb7b8ed439bb4546b0648c627c2ce5d, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Hallucinate.UI.UIManager
+ inputReader: {fileID: 2128442884}
gameIcon: {fileID: 0}
+ cursorSprite: {fileID: 21300000, guid: bf03bd4e32f382f45bd848d91517f188, type: 3}
cursorTrailSprite: {fileID: 21300000, guid: b9c4a623634019648b505c6122243b00, type: 3}
- cursorSize: 30
+ cursorSize: 57
trailLength: 15
+ trailSpacing: 2
enableRipples: 1
rippleColor: {r: 1, g: 1, b: 1, a: 0.5}
mainMenuTemplate: {fileID: 9197481963319205126, guid: 8dcbe9fd5e8c43c43921af21a6347624, type: 3}
@@ -462,10 +465,174 @@ MonoBehaviour:
m_VarianceClampScale: 0.9
m_ContrastAdaptiveSharpening: 0
m_Version: 2
+--- !u!1 &2128442883
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 2128442885}
+ - component: {fileID: 2128442884}
+ - component: {fileID: 2128442886}
+ m_Layer: 0
+ m_Name: InputReader
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &2128442884
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2128442883}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 5962d8f2c8e40e240a4a4907c7b539fa, type: 3}
+ m_Name:
+ m_EditorClassIdentifier: Assembly-CSharp::OnlyScove.Scripts.InputReader
+--- !u!4 &2128442885
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2128442883}
+ serializedVersion: 2
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: -16124.571, y: -11651.664, z: 100.93924}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &2128442886
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2128442883}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3}
+ m_Name:
+ m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.PlayerInput
+ m_Actions: {fileID: -944628639613478452, guid: ac73bbdc8e64ac34c9525df400c1534f, type: 3}
+ m_NotificationBehavior: 2
+ m_UIInputModule: {fileID: 0}
+ m_DeviceLostEvent:
+ m_PersistentCalls:
+ m_Calls: []
+ m_DeviceRegainedEvent:
+ m_PersistentCalls:
+ m_Calls: []
+ m_ControlsChangedEvent:
+ m_PersistentCalls:
+ m_Calls: []
+ m_ActionEvents:
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 351f2ccd-1f9f-44bf-9bec-d62ac5c5f408
+ m_ActionName: 'Player/Move[/Keyboard/w,/Keyboard/upArrow,/Keyboard/s,/Keyboard/downArrow,/Keyboard/a,/Keyboard/leftArrow,/Keyboard/d,/Keyboard/rightArrow]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 6b444451-8a00-4d00-a97e-f47457f736a8
+ m_ActionName: 'Player/Look[/Mouse/delta]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 6c2ab1b8-8984-453a-af3d-a3c78ae1679a
+ m_ActionName: 'Player/Attack[/Mouse/leftButton,/Keyboard/enter]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 852140f2-7766-474d-8707-702459ba45f3
+ m_ActionName: 'Player/Interact[/Keyboard/e]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 27c5f898-bc57-4ee1-8800-db469aca5fe3
+ m_ActionName: 'Player/Crouch[/Keyboard/c]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: f1ba0d36-48eb-4cd5-b651-1c94a6531f70
+ m_ActionName: 'Player/Jump[/Keyboard/space]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 2776c80d-3c14-4091-8c56-d04ced07a2b0
+ m_ActionName: 'Player/Previous[/Keyboard/q,/Keyboard/1]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: b7230bb6-fc9b-4f52-8b25-f5e19cb2c2ba
+ m_ActionName: 'Player/Next[/Keyboard/e,/Keyboard/2]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 641cd816-40e6-41b4-8c3d-04687c349290
+ m_ActionName: 'Player/Sprint[/Keyboard/leftShift]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 1702ffae-5ad3-4532-9855-bf7e2a8ae749
+ m_ActionName: 'Player/Scroll[/Mouse/scroll]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 7e8b9416-0a2d-4652-98d8-e7368560ede9
+ m_ActionName: 'Player/ToggleView[/Keyboard/f2]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: c95b2375-e6d9-4b88-9c4c-c5e76515df4b
+ m_ActionName: 'UI/Navigate[/Keyboard/w,/Keyboard/upArrow,/Keyboard/s,/Keyboard/downArrow,/Keyboard/a,/Keyboard/leftArrow,/Keyboard/d,/Keyboard/rightArrow]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 7607c7b6-cd76-4816-beef-bd0341cfe950
+ m_ActionName: 'UI/Submit[/Keyboard/enter]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 15cef263-9014-4fd5-94d9-4e4a6234a6ef
+ m_ActionName: 'UI/Cancel[/Keyboard/escape]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 32b35790-4ed0-4e9a-aa41-69ac6d629449
+ m_ActionName: 'UI/Point[/Mouse/position]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 3c7022bf-7922-4f7c-a998-c437916075ad
+ m_ActionName: 'UI/Click[/Mouse/leftButton]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 44b200b1-1557-4083-816c-b22cbdf77ddf
+ m_ActionName: 'UI/RightClick[/Mouse/rightButton]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: dad70c86-b58c-4b17-88ad-f5e53adf419e
+ m_ActionName: 'UI/MiddleClick[/Mouse/middleButton]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 0489e84a-4833-4c40-bfae-cea84b696689
+ m_ActionName: 'UI/ScrollWheel[/Mouse/scroll]'
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 24908448-c609-4bc3-a128-ea258674378a
+ m_ActionName: UI/TrackedDevicePosition
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: 9caa3d8a-6b2f-4e8e-8bad-6ede561bd9be
+ m_ActionName: UI/TrackedDeviceOrientation
+ - m_PersistentCalls:
+ m_Calls: []
+ m_ActionId: ae29d662-c797-4411-8ff3-8b5ad78427d8
+ m_ActionName: 'UI/ToggleSetting[/Keyboard/leftCtrl,/Keyboard/o]'
+ m_NeverAutoSwitchControlSchemes: 0
+ m_DefaultControlScheme:
+ m_DefaultActionMap: UI
+ m_SplitScreenIndex: -1
+ m_Camera: {fileID: 1848374380}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1848374381}
- {fileID: 626355270}
+ - {fileID: 2128442885}
- {fileID: 458228301}
diff --git a/Assets/Scripts/Player Controller/InputReader.cs b/Assets/Scripts/Player Controller/InputReader.cs
index e9bee96d..ea8b99f7 100644
--- a/Assets/Scripts/Player Controller/InputReader.cs
+++ b/Assets/Scripts/Player Controller/InputReader.cs
@@ -10,10 +10,9 @@ namespace OnlyScove.Scripts
public virtual Vector2 MoveInput { get; protected set; }
public virtual Vector2 LookInput { get; protected set; }
public virtual Vector2 ScrollInput { get; protected set; }
- public virtual bool IsSprintHeld { get; protected set; } // Left Shift
- public virtual bool IsAttackHeld { get; protected set; } // Left Mouse Button
+ public virtual bool IsSprintHeld { get; protected set; }
+ public virtual bool IsAttackHeld { get; protected set; }
- // THÊM HÀM NÀY ĐỂ ĐỒNG BỘ MẠNG
public void ApplyNetworkInput(Vector2 move, bool isSprint)
{
MoveInput = move;
@@ -21,15 +20,19 @@ namespace OnlyScove.Scripts
}
// One-shot Events
- public event Action OnJumpEvent; // Space
- public event Action OnDodgeEvent; // Right Mouse Button (RMB)
- public event Action OnSprintEvent; // Left Shift
- public event Action OnAttackEvent; // Left Mouse Button (LMB)
- public event Action OnCrouchEvent; // C Key
- public event Action OnInteractEvent; // E Key
- public event Action OnNextInteractEvent; // R Key
- public event Action OnPreviousInteractEvent; // Q Key
- public event Action OnToggleViewEvent; // F2 - New event for toggling camera view
+ public event Action OnJumpEvent;
+ public event Action OnDodgeEvent;
+ public event Action OnSprintEvent;
+ public event Action OnAttackEvent;
+ public event Action OnCrouchEvent;
+ public event Action OnInteractEvent;
+ public event Action OnNextInteractEvent;
+ public event Action OnPreviousInteractEvent;
+ public event Action OnToggleViewEvent;
+
+ // UI Events
+ public event Action OnToggleSettingsEvent; // Cho Ctrl+O
+ public event Action OnCancelEvent; // Cho phím ESC hoặc phím đóng UI
public void OnAttack(InputAction.CallbackContext context)
{
@@ -69,13 +72,9 @@ namespace OnlyScove.Scripts
if (context.canceled) IsSprintHeld = false;
}
- // New method for ToggleView input
public void OnToggleView(InputAction.CallbackContext context)
{
- if (context.performed)
- {
- OnToggleViewEvent?.Invoke();
- }
+ if (context.performed) OnToggleViewEvent?.Invoke();
}
public void OnJump(InputAction.CallbackContext context)
@@ -95,13 +94,7 @@ namespace OnlyScove.Scripts
public void OnInteract(InputAction.CallbackContext context)
{
- Debug.Log($"[InputReader] Interaction State: {context.phase} | Started: {context.started} | Performed: {context.performed} | Canceled: {context.canceled}");
-
- if (context.performed)
- {
- Debug.Log("[InputReader] Event OnInteractEvent triggered!");
- OnInteractEvent?.Invoke();
- }
+ if (context.performed) OnInteractEvent?.Invoke();
}
public void OnNext(InputAction.CallbackContext context)
@@ -113,5 +106,20 @@ namespace OnlyScove.Scripts
{
if (context.performed) OnPreviousInteractEvent?.Invoke();
}
+
+ // UI Callbacks
+ public void OnToggleSettings(InputAction.CallbackContext context)
+ {
+ if (context.performed)
+ {
+ Debug.Log("[InputReader] Toggle Settings Action Performed!");
+ OnToggleSettingsEvent?.Invoke();
+ }
+ }
+
+ public void OnCancel(InputAction.CallbackContext context)
+ {
+ if (context.performed) OnCancelEvent?.Invoke();
+ }
}
-}
\ No newline at end of file
+}
diff --git a/Assets/Scripts/UI/MainMenuController.cs b/Assets/Scripts/UI/MainMenuController.cs
index 02df4980..f412003e 100644
--- a/Assets/Scripts/UI/MainMenuController.cs
+++ b/Assets/Scripts/UI/MainMenuController.cs
@@ -103,7 +103,6 @@ namespace Hallucinate.UI
// Khởi động lại rotation nếu có icon
StartRotation();
- UnityEngine.Cursor.visible = true;
await base.PlayTransitionIn();
// Nếu không phải lần đầu load (tức là quay lại bằng nút Back), tự động bung Ribbon
diff --git a/Assets/Scripts/UI/SettingsController.cs b/Assets/Scripts/UI/SettingsController.cs
index d5491838..1368e661 100644
--- a/Assets/Scripts/UI/SettingsController.cs
+++ b/Assets/Scripts/UI/SettingsController.cs
@@ -19,25 +19,38 @@ namespace Hallucinate.UI
_tabTitle = root.Q