feat(Read): 将阅读修改为R键,并添加阅读提示

This commit is contained in:
2025-10-24 16:45:02 +08:00
parent 9d7106bb5e
commit 22a2ab724a
6 changed files with 5404 additions and 5054 deletions

View File

@@ -136,6 +136,15 @@ namespace Script.Gameplay.Input
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Read"",
""type"": ""Button"",
""id"": ""fa5376df-3b5c-46fe-a07b-6078433ec971"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
@@ -314,6 +323,17 @@ namespace Script.Gameplay.Input
""action"": ""ShowNextDialogue"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""15819353-a9d0-43b3-92b2-c89ec003b41c"",
""path"": ""<Keyboard>/r"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Read"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
@@ -334,6 +354,7 @@ namespace Script.Gameplay.Input
m_Player_SetInput = m_Player.FindAction("SetInput", throwIfNotFound: true);
m_Player_CutLine = m_Player.FindAction("CutLine", throwIfNotFound: true);
m_Player_ShowNextDialogue = m_Player.FindAction("ShowNextDialogue", throwIfNotFound: true);
m_Player_Read = m_Player.FindAction("Read", throwIfNotFound: true);
}
~@PlayerInputActions()
@@ -412,6 +433,7 @@ namespace Script.Gameplay.Input
private readonly InputAction m_Player_SetInput;
private readonly InputAction m_Player_CutLine;
private readonly InputAction m_Player_ShowNextDialogue;
private readonly InputAction m_Player_Read;
public struct PlayerActions
{
private @PlayerInputActions m_Wrapper;
@@ -428,6 +450,7 @@ namespace Script.Gameplay.Input
public InputAction @SetInput => m_Wrapper.m_Player_SetInput;
public InputAction @CutLine => m_Wrapper.m_Player_CutLine;
public InputAction @ShowNextDialogue => m_Wrapper.m_Player_ShowNextDialogue;
public InputAction @Read => m_Wrapper.m_Player_Read;
public InputActionMap Get() { return m_Wrapper.m_Player; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
@@ -473,6 +496,9 @@ namespace Script.Gameplay.Input
@ShowNextDialogue.started += instance.OnShowNextDialogue;
@ShowNextDialogue.performed += instance.OnShowNextDialogue;
@ShowNextDialogue.canceled += instance.OnShowNextDialogue;
@Read.started += instance.OnRead;
@Read.performed += instance.OnRead;
@Read.canceled += instance.OnRead;
}
private void UnregisterCallbacks(IPlayerActions instance)
@@ -513,6 +539,9 @@ namespace Script.Gameplay.Input
@ShowNextDialogue.started -= instance.OnShowNextDialogue;
@ShowNextDialogue.performed -= instance.OnShowNextDialogue;
@ShowNextDialogue.canceled -= instance.OnShowNextDialogue;
@Read.started -= instance.OnRead;
@Read.performed -= instance.OnRead;
@Read.canceled -= instance.OnRead;
}
public void RemoveCallbacks(IPlayerActions instance)
@@ -544,6 +573,7 @@ namespace Script.Gameplay.Input
void OnSetInput(InputAction.CallbackContext context);
void OnCutLine(InputAction.CallbackContext context);
void OnShowNextDialogue(InputAction.CallbackContext context);
void OnRead(InputAction.CallbackContext context);
}
}
}

View File

@@ -56,7 +56,7 @@ namespace Script.Gameplay.Player
Debug.LogWarning("FirstPersonRaycaster not found! Please assign or add it to the player.");
var input = InputManager.Instance.Input;
input.Player.Interact.performed += ctx =>
input.Player.Read.performed += ctx =>
{
if (!isEnablePlayerDialogue) return;
if (CurrentDialogueTarget == null) return;

View File

@@ -9,6 +9,7 @@ namespace UI
public class PlayerGazeReminder : UIBase
{
[SerializeField] private GameObject reminderInteractPrefab;
[SerializeField] private GameObject reminderReadPrefab;
[SerializeField] private GameObject reminderConnectPrefab;
[SerializeField] private GameObject reminderSetPointPrefab;
[SerializeField] private GameObject reminderDeleteLinePrefab;
@@ -51,8 +52,8 @@ namespace UI
private void OnGetDialogueController(PlayerDialogueController controller)
{
playerDialogueController = controller;
playerDialogueController.OnGazeEnterDialogue += (obj) => reminderInteractPrefab.SetActive(true);
playerDialogueController.OnGazeExitDialogue += (obj) => reminderInteractPrefab.SetActive(false);
playerDialogueController.OnGazeEnterDialogue += (obj) => reminderReadPrefab.SetActive(true);
playerDialogueController.OnGazeExitDialogue += (obj) => reminderReadPrefab.SetActive(false);
}
}
}