feat(Dialogue): 实现基本的对话系统

This commit is contained in:
2025-10-23 15:46:17 +08:00
parent 869d5794f3
commit efcbc8eea5
29 changed files with 1398 additions and 86 deletions

8
Assets/Art/Picture.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2c7d306a193a0af44972d310797d659a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

View File

@@ -0,0 +1,140 @@
fileFormatVersion: 2
guid: f5964a6faf742d1489e69770e9befe4b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 24, y: 24, z: 24, w: 24}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 1537655665
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,137 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5026564290621909743
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7109199603733405013}
- component: {fileID: 6045953545529474038}
- component: {fileID: 2655736863155566944}
- component: {fileID: 5391301326884702461}
- component: {fileID: 5310363734895796047}
- component: {fileID: 1414476190416482629}
m_Layer: 0
m_Name: BaseWall
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7109199603733405013
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5026564290621909743}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -10, y: 1, z: 0}
m_LocalScale: {x: 5, y: 5, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &6045953545529474038
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5026564290621909743}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &2655736863155566944
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5026564290621909743}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!65 &5391301326884702461
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5026564290621909743}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &5310363734895796047
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5026564290621909743}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2791e039b8344f45ad6dc86f5188d82d, type: 3}
m_Name:
m_EditorClassIdentifier:
isEnableEdit: 1
isOpenInEditor: 1
--- !u!114 &1414476190416482629
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5026564290621909743}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ce12e438b058416294facd94fdcec417, type: 3}
m_Name:
m_EditorClassIdentifier:
isEnableEdit: 1
isOpenInEditor: 1

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1b9d4654dd2760b41a57e40cd13d935a
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 180962201054a1044b5900effffb6e61
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,151 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2957889408346666551
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5753354802695894622}
- component: {fileID: 3241988889103041809}
- component: {fileID: 5420721594423021998}
- component: {fileID: 2827643473192136634}
- component: {fileID: 8799585641887548552}
- component: {fileID: 3087030512776463226}
- component: {fileID: 7443008762644925283}
m_Layer: 0
m_Name: BaseDialogueItem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5753354802695894622
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2957889408346666551}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -15, y: 2.5, z: 0}
m_LocalScale: {x: 2.5, y: 2.5, z: 0.5}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3241988889103041809
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2957889408346666551}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &5420721594423021998
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2957889408346666551}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!65 &2827643473192136634
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2957889408346666551}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &8799585641887548552
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2957889408346666551}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2791e039b8344f45ad6dc86f5188d82d, type: 3}
m_Name:
m_EditorClassIdentifier:
isEnableEdit: 1
isOpenInEditor: 1
--- !u!114 &3087030512776463226
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2957889408346666551}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ce12e438b058416294facd94fdcec417, type: 3}
m_Name:
m_EditorClassIdentifier:
isEnableEdit: 1
isOpenInEditor: 1
--- !u!114 &7443008762644925283
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2957889408346666551}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 11e2853ce9054f6b90407f3c56563502, type: 3}
m_Name:
m_EditorClassIdentifier:
dialogueContent:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 60bb36db0366d0247a1d264fc148699c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -155,7 +155,8 @@ GameObject:
- component: {fileID: 1774433545530707224}
- component: {fileID: 5633281206562703781}
- component: {fileID: 4616892119606260346}
m_Layer: 0
- component: {fileID: 3493211357972151578}
m_Layer: 8
m_Name: Player
m_TagString: Player
m_Icon: {fileID: 0}
@@ -331,6 +332,20 @@ MonoBehaviour:
m_EditorClassIdentifier:
raycaster: {fileID: 8217262775185484522}
maxConnectDistance: 10.5
--- !u!114 &3493211357972151578
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3550102669167288263}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 504b772e6a254764388ec3b68f4c9ad0, type: 3}
m_Name:
m_EditorClassIdentifier:
isEnablePlayerDialogue: 1
firstPersonRaycaster: {fileID: 8217262775185484522}
--- !u!1 &3610935294554348573
GameObject:
m_ObjectHideFlags: 0

View File

@@ -0,0 +1,264 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1980382229787217836
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 770150940736596707}
- component: {fileID: 8677764218385065946}
- component: {fileID: 8851227466014393207}
m_Layer: 5
m_Name: Content
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &770150940736596707
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1980382229787217836}
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: 137519622818440187}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 800, y: 160}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8677764218385065946
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1980382229787217836}
m_CullTransparentMesh: 1
--- !u!114 &8851227466014393207
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1980382229787217836}
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: ...
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, 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: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
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 &4131091626654046850
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2911880712525793305}
- component: {fileID: 1661731106221209034}
- component: {fileID: 7647474162869005798}
m_Layer: 5
m_Name: Panel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2911880712525793305
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4131091626654046850}
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: 137519622818440187}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.0023193, y: 0.00027466}
m_SizeDelta: {x: 985.4, y: 257.82}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1661731106221209034
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4131091626654046850}
m_CullTransparentMesh: 1
--- !u!114 &7647474162869005798
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4131091626654046850}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 21300000, guid: f5964a6faf742d1489e69770e9befe4b, type: 3}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &4411825979609720476
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 137519622818440187}
- component: {fileID: 7150196100635104784}
m_Layer: 5
m_Name: PlayerDialogueViwer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &137519622818440187
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4411825979609720476}
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:
- {fileID: 2911880712525793305}
- {fileID: 770150940736596707}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: -8.703308, y: 185.26105}
m_SizeDelta: {x: 985.4095, y: 257.8189}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &7150196100635104784
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4411825979609720476}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c0395910b982454e9d80e05e192178e8, type: 3}
m_Name:
m_EditorClassIdentifier:
IsOpenOnFirstLoad: 0
dialogueText: {fileID: 8851227466014393207}
panel: {fileID: 4131091626654046850}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 62d39262178af1941b7488794adfa8e7
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -2075,11 +2075,6 @@ PrefabInstance:
propertyPath: m_Name
value: Player
objectReference: {fileID: 0}
- target: {fileID: 3550102669167288263, guid: 667aedb0d3f8c9d469819c9ff2b4472b,
type: 3}
propertyPath: m_Layer
value: 8
objectReference: {fileID: 0}
- target: {fileID: 7437893023972897012, guid: 667aedb0d3f8c9d469819c9ff2b4472b,
type: 3}
propertyPath: m_LocalPosition.x
@@ -2218,6 +2213,154 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e6007da0e1121fd4ab3b932c054f6256, type: 3}
--- !u!1001 &7779342506646282638
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 5026564290621909743, guid: 1b9d4654dd2760b41a57e40cd13d935a,
type: 3}
propertyPath: m_Name
value: BaseWall
objectReference: {fileID: 0}
- target: {fileID: 7109199603733405013, guid: 1b9d4654dd2760b41a57e40cd13d935a,
type: 3}
propertyPath: m_LocalPosition.x
value: -10
objectReference: {fileID: 0}
- target: {fileID: 7109199603733405013, guid: 1b9d4654dd2760b41a57e40cd13d935a,
type: 3}
propertyPath: m_LocalPosition.y
value: 2.5
objectReference: {fileID: 0}
- target: {fileID: 7109199603733405013, guid: 1b9d4654dd2760b41a57e40cd13d935a,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7109199603733405013, guid: 1b9d4654dd2760b41a57e40cd13d935a,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7109199603733405013, guid: 1b9d4654dd2760b41a57e40cd13d935a,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7109199603733405013, guid: 1b9d4654dd2760b41a57e40cd13d935a,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7109199603733405013, guid: 1b9d4654dd2760b41a57e40cd13d935a,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7109199603733405013, guid: 1b9d4654dd2760b41a57e40cd13d935a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7109199603733405013, guid: 1b9d4654dd2760b41a57e40cd13d935a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7109199603733405013, guid: 1b9d4654dd2760b41a57e40cd13d935a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1b9d4654dd2760b41a57e40cd13d935a, type: 3}
--- !u!1001 &8980111935536418165
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2957889408346666551, guid: 60bb36db0366d0247a1d264fc148699c,
type: 3}
propertyPath: m_Name
value: BaseDialogueItem
objectReference: {fileID: 0}
- target: {fileID: 5753354802695894622, guid: 60bb36db0366d0247a1d264fc148699c,
type: 3}
propertyPath: m_LocalPosition.x
value: -15
objectReference: {fileID: 0}
- target: {fileID: 5753354802695894622, guid: 60bb36db0366d0247a1d264fc148699c,
type: 3}
propertyPath: m_LocalPosition.y
value: 2.5
objectReference: {fileID: 0}
- target: {fileID: 5753354802695894622, guid: 60bb36db0366d0247a1d264fc148699c,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5753354802695894622, guid: 60bb36db0366d0247a1d264fc148699c,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5753354802695894622, guid: 60bb36db0366d0247a1d264fc148699c,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5753354802695894622, guid: 60bb36db0366d0247a1d264fc148699c,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5753354802695894622, guid: 60bb36db0366d0247a1d264fc148699c,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5753354802695894622, guid: 60bb36db0366d0247a1d264fc148699c,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5753354802695894622, guid: 60bb36db0366d0247a1d264fc148699c,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5753354802695894622, guid: 60bb36db0366d0247a1d264fc148699c,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7443008762644925283, guid: 60bb36db0366d0247a1d264fc148699c,
type: 3}
propertyPath: dialogueContent
value: 'This is a Dialogue test
next test1
next test2
next
test3'
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 60bb36db0366d0247a1d264fc148699c, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
@@ -2240,6 +2383,8 @@ SceneRoots:
- {fileID: 6865129841946316189}
- {fileID: 2578337202726380610}
- {fileID: 1781028406820323425}
- {fileID: 7779342506646282638}
- {fileID: 8980111935536418165}
- {fileID: 1035971231385273297}
- {fileID: 366996911271636373}
- {fileID: 6191742170513974480}

View File

@@ -602,6 +602,7 @@ RectTransform:
- {fileID: 1082771939}
- {fileID: 165485610}
- {fileID: 120768280}
- {fileID: 1822383180}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@@ -1015,10 +1016,10 @@ RectTransform:
m_Children: []
m_Father: {fileID: 1852693707}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.0015259, y: 49.67}
m_SizeDelta: {x: 489.28, y: 63.34}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0.0015258789, y: 49.67}
m_SizeDelta: {x: -2.7200012, y: 63.34}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1439567735
MonoBehaviour:
@@ -1237,6 +1238,12 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
layer: 1
--- !u!224 &1822383180 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
m_PrefabInstance: {fileID: 5086905788647474485}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1852693706
GameObject:
m_ObjectHideFlags: 0
@@ -1272,8 +1279,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -260.4452, y: 104.34}
m_SizeDelta: {x: 489.2865, y: 162.68}
m_AnchoredPosition: {x: -166, y: 101}
m_SizeDelta: {x: 296.6285, y: 162.68}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1852693708
MonoBehaviour:
@@ -1322,10 +1329,10 @@ RectTransform:
m_Children: []
m_Father: {fileID: 1852693707}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.00067139, y: -40.67}
m_SizeDelta: {x: 489.28, y: 81.34}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0.0006713867, y: -40.67}
m_SizeDelta: {x: -2.7200012, y: 81.34}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1852915598
MonoBehaviour:
@@ -1543,6 +1550,124 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: faba7bc710ad07f4491499290cd8b296, type: 3}
--- !u!1001 &5086905788647474485
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1067459529}
m_Modifications:
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_AnchorMax.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_AnchorMin.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_SizeDelta.x
value: 985.4095
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_SizeDelta.y
value: 257.8189
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_AnchoredPosition.x
value: -8.703308
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 185.26105
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 137519622818440187, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4411825979609720476, guid: 62d39262178af1941b7488794adfa8e7,
type: 3}
propertyPath: m_Name
value: PlayerDialogueViwer
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 62d39262178af1941b7488794adfa8e7, type: 3}
--- !u!1001 &6300650283385539470
PrefabInstance:
m_ObjectHideFlags: 0

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 290c1bc2a04e492c9676d8230845ff58
timeCreated: 1761189130

View File

@@ -0,0 +1,22 @@
using System;
using UnityEngine;
using Script.Gameplay.Interface;
using UnityEngine.Events;
namespace Script.Gameplay.Dialogue
{
public class BaseDialogueItem : MonoBehaviour, IDialogue
{
[TextArea] [SerializeField] private string dialogueContent; // 对话内容
public UnityEvent<bool> OnBeginDialogue { get; set; }
public UnityEvent<bool> OnEndDialogue { get; set; }
public bool IsRoad { get; set; }
public int GetDialogueCount { get; set; }
public string DialogueContent
{
get => dialogueContent;
set => dialogueContent = value;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 11e2853ce9054f6b90407f3c56563502
timeCreated: 1761189140

View File

@@ -127,6 +127,15 @@ namespace Script.Gameplay.Input
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""ShowNextDialogue"",
""type"": ""Button"",
""id"": ""a8bce90a-e5e4-45fe-8189-cfb48debddf5"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
@@ -294,6 +303,17 @@ namespace Script.Gameplay.Input
""action"": ""CutLine"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""86dadc63-5591-4a7b-8fec-e5cfdb31b787"",
""path"": ""<Mouse>/leftButton"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""ShowNextDialogue"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
@@ -313,6 +333,7 @@ namespace Script.Gameplay.Input
m_Player_SetOutput = m_Player.FindAction("SetOutput", throwIfNotFound: true);
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);
}
~@PlayerInputActions()
@@ -390,6 +411,7 @@ namespace Script.Gameplay.Input
private readonly InputAction m_Player_SetOutput;
private readonly InputAction m_Player_SetInput;
private readonly InputAction m_Player_CutLine;
private readonly InputAction m_Player_ShowNextDialogue;
public struct PlayerActions
{
private @PlayerInputActions m_Wrapper;
@@ -405,6 +427,7 @@ namespace Script.Gameplay.Input
public InputAction @SetOutput => m_Wrapper.m_Player_SetOutput;
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 InputActionMap Get() { return m_Wrapper.m_Player; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
@@ -447,6 +470,9 @@ namespace Script.Gameplay.Input
@CutLine.started += instance.OnCutLine;
@CutLine.performed += instance.OnCutLine;
@CutLine.canceled += instance.OnCutLine;
@ShowNextDialogue.started += instance.OnShowNextDialogue;
@ShowNextDialogue.performed += instance.OnShowNextDialogue;
@ShowNextDialogue.canceled += instance.OnShowNextDialogue;
}
private void UnregisterCallbacks(IPlayerActions instance)
@@ -484,6 +510,9 @@ namespace Script.Gameplay.Input
@CutLine.started -= instance.OnCutLine;
@CutLine.performed -= instance.OnCutLine;
@CutLine.canceled -= instance.OnCutLine;
@ShowNextDialogue.started -= instance.OnShowNextDialogue;
@ShowNextDialogue.performed -= instance.OnShowNextDialogue;
@ShowNextDialogue.canceled -= instance.OnShowNextDialogue;
}
public void RemoveCallbacks(IPlayerActions instance)
@@ -514,6 +543,7 @@ namespace Script.Gameplay.Input
void OnSetOutput(InputAction.CallbackContext context);
void OnSetInput(InputAction.CallbackContext context);
void OnCutLine(InputAction.CallbackContext context);
void OnShowNextDialogue(InputAction.CallbackContext context);
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
using UnityEngine;
using UnityEngine.Events;
namespace Script.Gameplay.Interface
{
public interface IDialogue
{
public UnityEvent<bool> OnBeginDialogue { get; set; }
public UnityEvent<bool> OnEndDialogue { get; set; }
public bool IsRoad { get; set; }
public int GetDialogueCount { get; set; }
public string DialogueContent { get; set; }
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6aa3fac9c1bc4bfaa9c14c987146f934
timeCreated: 1761189058

View File

@@ -30,20 +30,25 @@ namespace Script.Gameplay.Player
[SerializeField] private FirstPersonRaycaster raycaster; // 第一人称射线检测器
[SerializeField] private float maxConnectDistance = 10f; // 最大连接距离
private IConnectable previousTarget;
private IConnectable currentTarget;
public IConnectable CurrentTarget
{
get => currentTarget;
set
{
if (value != null)
previousTarget = currentTarget;
currentTarget = value;
if (previousTarget != currentTarget)
{
currentTarget = value;
OnGazeEnter?.Invoke(currentTarget.GetGameObject());
}
else
{
OnGazeExit?.Invoke(null);
if (currentTarget != null)
{
OnGazeEnter?.Invoke((currentTarget as MonoBehaviour)?.gameObject);
}
if (previousTarget != null)
{
OnGazeExit?.Invoke((previousTarget as MonoBehaviour)?.gameObject);
}
}
}
} // 当前注视的可连接对象
@@ -89,12 +94,6 @@ namespace Script.Gameplay.Player
GameObject lookAtObj = raycaster.CurrentLookAtObject;
IConnectable hitConnectable = lookAtObj != null ? lookAtObj.GetComponent<IConnectable>() : null;
// 注视对象变化时触发进入/离开(使用接口方法)
// if (hitConnectable != previousGazedTarget)
// {
// previousGazedTarget = hitConnectable;
// }
CurrentTarget = hitConnectable;
}

View File

@@ -0,0 +1,155 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Core;
using UnityEngine;
using UnityEngine.Events;
using Script.Gameplay.Interface;
using Script.Gameplay.Input;
using UI;
namespace Script.Gameplay.Player
{
public class PlayerDialogueController : MonoBehaviour
{
[SerializeField] private bool isEnablePlayerDialogue = true; // 是否启用玩家对话功能
[SerializeField] private FirstPersonRaycaster firstPersonRaycaster; // 第一人称射线检测器
private bool isReadingDialogue = false;
public event Action OnPlayerBeginDialogue;
public event Action OnPlayerEndDialogue;
public event Action<GameObject> OnGazeEnterDialogue;
public event Action<GameObject> OnGazeExitDialogue;
private Queue<string> dialogueQueue = new Queue<string>();
private PlayerDialogueViewer playerDialogueViewer;
private IDialogue previousDialogue;
private IDialogue currentDialogueTarget;
public IDialogue CurrentDialogueTarget
{
get => currentDialogueTarget;
set
{
previousDialogue = currentDialogueTarget;
currentDialogueTarget = value;
if (previousDialogue != currentDialogueTarget)
{
if (currentDialogueTarget != null)
{
OnGazeEnterDialogue?.Invoke((currentDialogueTarget as MonoBehaviour)?.gameObject);
}
if (previousDialogue != null)
{
OnGazeExitDialogue?.Invoke((previousDialogue as MonoBehaviour)?.gameObject);
}
}
}
}
void Start()
{
if (firstPersonRaycaster == null)
firstPersonRaycaster = GetComponent<FirstPersonRaycaster>() ??
GetComponentInChildren<FirstPersonRaycaster>();
if (firstPersonRaycaster == null)
firstPersonRaycaster = FindObjectOfType<FirstPersonRaycaster>();
if (firstPersonRaycaster == null)
Debug.LogWarning("FirstPersonRaycaster not found! Please assign or add it to the player.");
var input = InputManager.Instance.Input;
input.Player.Interact.performed += ctx =>
{
if (!isEnablePlayerDialogue) return;
if (CurrentDialogueTarget == null) return;
if (isReadingDialogue) return;
BeginDialogue();
};
input.Player.ShowNextDialogue.performed += ctx =>
{
if (!isEnablePlayerDialogue) return;
if (CurrentDialogueTarget == null) return;
if (!isReadingDialogue) return;
PassNextDialogue();
};
ControllerLocator.Instance.Register(this);
}
void Update()
{
DetectDialogue();
}
private void DetectDialogue()
{
if (!isEnablePlayerDialogue || firstPersonRaycaster == null) return;
GameObject lookAtObj = firstPersonRaycaster.CurrentLookAtObject;
IDialogue hitDialogue = lookAtObj != null ? lookAtObj.GetComponent<IDialogue>() : null;
CurrentDialogueTarget = hitDialogue;
}
private void BeginDialogue()
{
if (CurrentDialogueTarget != null)
{
isReadingDialogue = true;
OnPlayerBeginDialogue?.Invoke();
CurrentDialogueTarget.OnBeginDialogue?.Invoke(true);
dialogueQueue = SplitDialogue(CurrentDialogueTarget.DialogueContent);
PassNextDialogue();
}
}
private void PassNextDialogue()
{
if (CurrentDialogueTarget != null)
{
if (dialogueQueue.Count == 0)
{
EndDialogue();
return;
}
string nextDialogue = dialogueQueue.Dequeue();
if (playerDialogueViewer != null)
{
playerDialogueViewer.ReceiveDialogue(nextDialogue);
}
}
}
private void EndDialogue()
{
if (CurrentDialogueTarget != null)
{
isReadingDialogue = false;
OnPlayerEndDialogue?.Invoke();
CurrentDialogueTarget.OnEndDialogue?.Invoke(true);
if (playerDialogueViewer != null)
{
playerDialogueViewer.ClosePanel();
}
// 可扩展隐藏UI、恢复输入等
}
}
private Queue<string> SplitDialogue(string content)
{
// 按换行分段
return new(content.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries));
}
public void RegisterDialogueViewer(PlayerDialogueViewer viewer)
{
playerDialogueViewer = viewer;
}
public void SetPlayerDialogueEnabled(bool isEnabled)
{
isEnablePlayerDialogue = isEnabled;
if (!isEnabled)
{
CurrentDialogueTarget = null;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 504b772e6a254764388ec3b68f4c9ad0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -11,27 +11,28 @@ namespace Script.Gameplay.Player
[SerializeField] private FirstPersonRaycaster raycaster; // 新增:第一人称射线检测器
[SerializeField] private bool isEnablePlayerInteraction = true; // 是否启用玩家交互功能
private IInteractable previousTarget;
private IInteractable currentTarget;
private IInteractable CurrentTarget
{
get => currentTarget;
set
{
previousTarget = currentTarget;
currentTarget = value;
if (currentTarget != null)
if (previousTarget != currentTarget)
{
// 可以在这里添加一些逻辑比如显示交互提示UI
OnGazeEnter?.Invoke(this.gameObject);
}
else
{
// 可以在这里隐藏交互提示UI
OnGazeExit?.Invoke(this.gameObject);
if (currentTarget != null)
{
OnGazeEnter?.Invoke((currentTarget as MonoBehaviour)?.gameObject);
}
if (previousTarget != null)
{
OnGazeExit?.Invoke((previousTarget as MonoBehaviour)?.gameObject);
}
}
}
} // 被射线命中的当前可交互对象(用于按键交互)
private IInteractable previousGazedTarget; // 上一次注视的对象(用于注视进入/离开事件)
public event Action<GameObject> OnGazeEnter;
public event Action<GameObject> OnGazeExit;
@@ -68,34 +69,14 @@ namespace Script.Gameplay.Player
GameObject lookAtObj = raycaster.CurrentLookAtObject;
IInteractable hitInteractable = lookAtObj != null ? lookAtObj.GetComponent<IInteractable>() : null;
// 如果命中对象与之前注视的不一样,触发进入/离开事件
if (hitInteractable != previousGazedTarget)
{
// if (previousGazedTarget != null)
// {
// previousGazedTarget.OnGazeExit(this.gameObject);
// }
//
// if (hitInteractable != null)
// {
// hitInteractable.OnGazeEnter(this.gameObject);
// // 这里可以显示交互提示UI例如 “E - 开门”
// //Debug.Log(hitInteractable.GetInteractPrompt());
// }
previousGazedTarget = hitInteractable;
}
CurrentTarget = hitInteractable;
}
public void SetPlayerInteractionEnabled(bool isEnabled)
{
isEnablePlayerInteraction = isEnabled;
if (!isEnabled && previousGazedTarget != null)
if (!isEnabled)
{
// previousGazedTarget.OnGazeExit(this.gameObject);
previousGazedTarget = null;
CurrentTarget = null;
}
}

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using Core;
using Script.Gameplay.Input;
using Script.Gameplay.Player;
using TMPro;
using UnityEngine;
namespace UI
{
// 负责显示玩家对话内容的UI组件
public class PlayerDialogueViewer : UIBase
{
[SerializeField] private TMP_Text dialogueText;
[SerializeField] private GameObject panel;
private bool isShowingPanel = false;
private PlayerDialogueController playerDialogueController;
private InputManager inputManager;
protected override void Awake()
{
base.Awake();
inputManager = InputManager.Instance;
ControllerLocator.Instance.TryGetWait<PlayerDialogueController>(OnGetPlayerDialogueController);
}
private void OnGetPlayerDialogueController(PlayerDialogueController controller)
{
playerDialogueController = controller;
playerDialogueController.RegisterDialogueViewer(this);
}
public void ReceiveDialogue(string content)
{
if(!isShowingPanel) OpenPanel();
dialogueText.text = content;
}
private void OpenPanel()
{
isShowingPanel = true;
Show();
}
public void ClosePanel()
{
isShowingPanel = false;
Hide();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c0395910b982454e9d80e05e192178e8
timeCreated: 1761184075

View File

@@ -14,50 +14,45 @@ namespace UI
[SerializeField] private GameObject reminderDeleteLinePrefab;
private PlayerInteractorController playerInteractorController;
private PlayerConnectController playerConnectController;
private PlayerDialogueController playerDialogueController;
protected override void Awake()
{
base.Awake();
ControllerLocator.Instance.TryGetWait<PlayerInteractorController>(OnGetInteractorController);
ControllerLocator.Instance.TryGetWait<PlayerConnectController>(OnGetConnectController);
ControllerLocator.Instance.TryGetWait<PlayerDialogueController>(OnGetDialogueController);
}
private void OnGetInteractorController(PlayerInteractorController controller)
{
playerInteractorController = controller;
playerInteractorController.OnGazeEnter += HandleInteractGazeEnter;
playerInteractorController.OnGazeExit += HandleInteractGazeExit;
}
private void HandleInteractGazeEnter(GameObject obj)
{
reminderInteractPrefab.SetActive(true);
}
private void HandleInteractGazeExit(GameObject obj)
{
reminderInteractPrefab.SetActive(false);
playerInteractorController.OnGazeEnter += (obj) => reminderInteractPrefab.SetActive(true);
playerInteractorController.OnGazeExit += (obj) => reminderInteractPrefab.SetActive(false);
}
private void OnGetConnectController(PlayerConnectController controller)
{
playerConnectController = controller;
playerConnectController.OnGazeEnter += HandleConnectGazeEnter;
playerConnectController.OnGazeExit += HandleConnectGazeExit;
playerConnectController.OnGazeEnter += (obj) =>
{
reminderConnectPrefab.SetActive(true);
reminderSetPointPrefab.SetActive(true);
reminderDeleteLinePrefab.SetActive(true);
};
playerConnectController.OnGazeExit += (obj) =>
{
reminderConnectPrefab.SetActive(false);
reminderSetPointPrefab.SetActive(false);
reminderDeleteLinePrefab.SetActive(false);
};
}
private void HandleConnectGazeEnter(GameObject obj)
private void OnGetDialogueController(PlayerDialogueController controller)
{
reminderConnectPrefab.SetActive(true);
reminderSetPointPrefab.SetActive(true);
reminderDeleteLinePrefab.SetActive(true);
}
private void HandleConnectGazeExit(GameObject obj)
{
reminderConnectPrefab.SetActive(false);
reminderSetPointPrefab.SetActive(false);
reminderDeleteLinePrefab.SetActive(false);
playerDialogueController = controller;
playerDialogueController.OnGazeEnterDialogue += (obj) => reminderInteractPrefab.SetActive(true);
playerDialogueController.OnGazeExitDialogue += (obj) => reminderInteractPrefab.SetActive(false);
}
}
}

View File

@@ -103,6 +103,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "ShowNextDialogue",
"type": "Button",
"id": "a8bce90a-e5e4-45fe-8189-cfb48debddf5",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
@@ -270,6 +279,17 @@
"action": "CutLine",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "86dadc63-5591-4a7b-8fec-e5cfdb31b787",
"path": "<Mouse>/leftButton",
"interactions": "",
"processors": "",
"groups": "",
"action": "ShowNextDialogue",
"isComposite": false,
"isPartOfComposite": false
}
]
}

View File

@@ -1,6 +1,7 @@
{
"dependencies": {
"com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask",
"com.unity.2d.sprite": "1.0.0",
"com.unity.collab-proxy": "2.10.0",
"com.unity.ide.rider": "3.0.34",
"com.unity.ide.visualstudio": "2.0.22",

View File

@@ -7,6 +7,12 @@
"dependencies": {},
"hash": "73a63b7f672b88f7e9992f6917eb458a8cbb6fa9"
},
"com.unity.2d.sprite": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {}
},
"com.unity.burst": {
"version": "1.8.18",
"depth": 1,