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

This commit is contained in:
2025-10-24 16:45:02 +08:00
parent 72921fe173
commit b873bd251f
6 changed files with 5404 additions and 5054 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,140 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &485939746293016442
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7029993173035865934}
- component: {fileID: 3012417534690017725}
- component: {fileID: 1415649979958087733}
m_Layer: 5
m_Name: Read
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &7029993173035865934
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 485939746293016442}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1135667794185554838}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 150, y: -35}
m_SizeDelta: {x: 300, y: 70}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3012417534690017725
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 485939746293016442}
m_CullTransparentMesh: 1
--- !u!114 &1415649979958087733
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 485939746293016442}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "R - \u9605\u8BFB"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 538fd603dd2dddd4daf31aa55f44c7e5, type: 2}
m_sharedMaterial: {fileID: -3917370665499528571, guid: 538fd603dd2dddd4daf31aa55f44c7e5,
type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 25
m_fontSizeBase: 25
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &1372230259415100561
GameObject:
m_ObjectHideFlags: 0
@@ -436,6 +571,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 930174563945914406}
- {fileID: 7029993173035865934}
- {fileID: 1105326741592270637}
- {fileID: 7955482942286597510}
- {fileID: 8695974536346969846}
@@ -460,6 +596,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
IsOpenOnFirstLoad: 1
reminderInteractPrefab: {fileID: 1372230259415100561}
reminderReadPrefab: {fileID: 485939746293016442}
reminderConnectPrefab: {fileID: 1566038821549990303}
reminderSetPointPrefab: {fileID: 8649771482720941180}
reminderDeleteLinePrefab: {fileID: 2108696256597691169}

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);
}
}
}

View File

@@ -112,6 +112,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Read",
"type": "Button",
"id": "fa5376df-3b5c-46fe-a07b-6078433ec971",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
@@ -290,6 +299,17 @@
"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
}
]
}