diff --git a/Assets/Resources/Yarn/OptionTest.meta b/Assets/Resources/Yarn/OptionTest.meta new file mode 100644 index 000000000..2b5ea3deb --- /dev/null +++ b/Assets/Resources/Yarn/OptionTest.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 201339454033674448f997737049ce0e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Yarn/OptionTest/OptionTest.yarnproject b/Assets/Resources/Yarn/OptionTest/OptionTest.yarnproject new file mode 100644 index 000000000..016b7ab29 --- /dev/null +++ b/Assets/Resources/Yarn/OptionTest/OptionTest.yarnproject @@ -0,0 +1,12 @@ +{ + "projectFileVersion": 2, + "sourceFiles": [ + "*.yarn" + ], + "excludeFiles": [ + "**/*~/*" + ], + "localisation": {}, + "baseLanguage": "zh-CHS", + "compilerOptions": {} +} \ No newline at end of file diff --git a/Assets/Resources/Yarn/OptionTest/OptionTest.yarnproject.meta b/Assets/Resources/Yarn/OptionTest/OptionTest.yarnproject.meta new file mode 100644 index 000000000..62afb237c --- /dev/null +++ b/Assets/Resources/Yarn/OptionTest/OptionTest.yarnproject.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 8fe94dc39a250ca4f9cd937647ab4893 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 053561912b1654d80a424bb0696a74ae, type: 3} + useAddressableAssets: 0 + UseUnityLocalisationSystem: 0 + unityLocalisationStringTableCollection: {instanceID: 0} diff --git a/Assets/Resources/Yarn/OptionTest/OptionTest1.yarn b/Assets/Resources/Yarn/OptionTest/OptionTest1.yarn new file mode 100644 index 000000000..6d69025f1 --- /dev/null +++ b/Assets/Resources/Yarn/OptionTest/OptionTest1.yarn @@ -0,0 +1,15 @@ +title: Start +--- +我: 这是选项测试文件 #line:069537f +我: 点击不同按钮可以执行不同命令 #line:00147c3 +<> +我: 加载测试场景 #line:0a67910 +我: 提供两个按钮进行点击 #line:0cb2011 +[command name=show_buttons /] #line:006eeaa + -> 按钮1 #line:0db0f08 + 我: 按下了按钮1 #line:0d84460 + -> 按钮2 #line:0556913 + 我: 按下了按钮2 #line:0b552f4 + +我: 测试完成 #line:011c95f +=== diff --git a/Assets/Resources/Yarn/OptionTest/OptionTest1.yarn.meta b/Assets/Resources/Yarn/OptionTest/OptionTest1.yarn.meta new file mode 100644 index 000000000..198eb93be --- /dev/null +++ b/Assets/Resources/Yarn/OptionTest/OptionTest1.yarn.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 4643db09184d54d4f9c0c69236d3c501 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 94073015eacc34c1d8fc6786e43d60ca, type: 3} diff --git a/Assets/Scenes/OptionTestScene.unity b/Assets/Scenes/OptionTestScene.unity new file mode 100644 index 000000000..7f04ccda8 --- /dev/null +++ b/Assets/Scenes/OptionTestScene.unity @@ -0,0 +1,347 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &506231561 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 506231565} + - component: {fileID: 506231564} + - component: {fileID: 506231563} + - component: {fileID: 506231562} + - component: {fileID: 506231566} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &506231562 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 506231561} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &506231563 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 506231561} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &506231564 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 506231561} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 25 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: -1 + m_TargetDisplay: 0 +--- !u!224 &506231565 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 506231561} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 693116407} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &506231566 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 506231561} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5897053db6d09014c809a2f20396e2ab, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &693116406 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 693116407} + - component: {fileID: 693116410} + - component: {fileID: 693116409} + - component: {fileID: 693116408} + m_Layer: 5 + m_Name: Panel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &693116407 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 693116406} + 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: 506231565} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 1920, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &693116408 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 693116406} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 4 + m_Spacing: 1 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!114 &693116409 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 693116406} + 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: 0.392} + 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: 10907, guid: 0000000000000000f000000000000000, type: 0} + 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!222 &693116410 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 693116406} + m_CullTransparentMesh: 1 +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 506231565} diff --git a/Assets/Scenes/OptionTestScene.unity.meta b/Assets/Scenes/OptionTestScene.unity.meta new file mode 100644 index 000000000..1a8a9ee9f --- /dev/null +++ b/Assets/Scenes/OptionTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f9668465fd9c51748b8c47d8adb80210 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 792c391b8..e91bdc5cf 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -155,8 +155,8 @@ Transform: m_Children: - {fileID: 1584263514} - {fileID: 973075153} - - {fileID: 525522645} - {fileID: 1936621685} + - {fileID: 494300779} m_Father: {fileID: 1009826577} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &72512887 @@ -204,9 +204,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 1696845842} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 200, y: -54.599014} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 240, y: 80} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &237392156 @@ -462,6 +462,50 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6c926f9749bfa894eaaff47ec3a43a64, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &494300778 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 494300779} + - component: {fileID: 494300780} + m_Layer: 0 + m_Name: Command Option View + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &494300779 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 494300778} + serializedVersion: 2 + 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: 72512886} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &494300780 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 494300778} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e61040b961ba1446ad453ee17f4a737, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &519420028 GameObject: m_ObjectHideFlags: 0 @@ -599,55 +643,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &525522644 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 525522645} - - component: {fileID: 525522646} - m_Layer: 0 - m_Name: Advance Input - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &525522645 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 525522644} - serializedVersion: 2 - 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: 72512886} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &525522646 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 525522644} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 097b95c9f69f04f2d8c08a817e7786af, type: 3} - m_Name: - m_EditorClassIdentifier: - dialogueView: {fileID: 1584263515} - continueActionType: 1 - continueActionKeyCode: 32 - continueActionButtonName: Jump - continueActionOnButtonRelease: 0 --- !u!1 &619394800 GameObject: m_ObjectHideFlags: 0 @@ -1162,10 +1157,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 18a3ec3914131d44199ae33902edf159, type: 3} m_Name: m_EditorClassIdentifier: + runMode: 1 firstTalkSO: {fileID: 11400000, guid: 2cc7ecb3ca3ad4f418430e814a7d1dc5, type: 2} clinicScene: ClinicScene - runMode: 1 - testScene: + testYarnProject: OptionTest --- !u!4 &719228339 Transform: m_ObjectHideFlags: 0 @@ -1930,9 +1925,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 1696845842} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 200, y: -163.79704} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 240, y: 80} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1596715192 @@ -2224,9 +2219,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 1696845842} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 200, y: -272.99506} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 240, y: 80} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1611684201 @@ -2632,6 +2627,8 @@ MonoBehaviour: _variableStorage: {fileID: 667130563} dialogueViews: - {fileID: 1584263515} + - {fileID: 973075154} + - {fileID: 494300780} startNode: Start startAutomatically: 0 runSelectedOptionAsLine: 0 diff --git a/Assets/Scripts/Dialog System/CommandOptionView.cs b/Assets/Scripts/Dialog System/CommandOptionView.cs new file mode 100644 index 000000000..beeb4ed1a --- /dev/null +++ b/Assets/Scripts/Dialog System/CommandOptionView.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Yarn.Markup; +using Yarn.Unity; + +namespace AibisDream +{ + public class CommandOptionView : DialogueViewBase + { + // ָѡģʽ + private bool isInCommand; + private string commandName; + + public override void RunLine(LocalizedLine dialogueLine, Action onDialogueLineFinished) + { + // жǷCommand״̬ + isInCommand = dialogueLine.Text.TryGetCommandAttr(out var name); + if (isInCommand) + { + // ָ + commandName = name; + // һ + onDialogueLineFinished.Invoke(); + } + else + { + base.RunLine(dialogueLine, onDialogueLineFinished); + } + } + + public override void RunOptions(DialogueOption[] dialogueOptions, Action onOptionSelected) + { + // ֱָ + if (!isInCommand) + { + base.RunOptions(dialogueOptions, onOptionSelected); + return; + } + + // ѡ + YarnOption[] options = YarnOption.GeneOptions(dialogueOptions, onOptionSelected); + DialogController.Instance.InvokeOptionCommand(commandName, options); + commandName = null; + } + + public override void InterruptLine(LocalizedLine dialogueLine, Action onDialogueLineFinished) + { + base.InterruptLine(dialogueLine, onDialogueLineFinished); + } + + public override void DismissLine(Action onDismissalComplete) + { + base.DismissLine(onDismissalComplete); + } + + public override void UserRequestedViewAdvancement() + { + base.UserRequestedViewAdvancement(); + } + } +} + diff --git a/Assets/Scripts/Dialog System/CommandOptionView.cs.meta b/Assets/Scripts/Dialog System/CommandOptionView.cs.meta new file mode 100644 index 000000000..1532c96a6 --- /dev/null +++ b/Assets/Scripts/Dialog System/CommandOptionView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4e61040b961ba1446ad453ee17f4a737 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Dialog System/DialogController.cs b/Assets/Scripts/Dialog System/DialogController.cs index a3a4affca..dd6388389 100644 --- a/Assets/Scripts/Dialog System/DialogController.cs +++ b/Assets/Scripts/Dialog System/DialogController.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -11,6 +12,8 @@ namespace AibisDream { private DialogueRunner dialogueRunner; + private Dictionary> commandMap = new Dictionary>(); + private void Start() { dialogueRunner = GetComponentInChildren(); @@ -26,6 +29,55 @@ namespace AibisDream dialogueRunner.StartDialogue("Start"); } + /// + /// ִָ + /// + /// ָ + public void InvokeOptionCommand(string commandName, YarnOption[] options) + { + if (commandName == null) { } + + if (commandMap.TryGetValue(commandName, out var action)) + { + action(options); + } + else + { + Debug.LogWarning($"ûҵ {commandName} "); + } + } + + /// + /// עѡָ + /// + /// ָ + /// ָ + public void RegisterOptionCommand(string commandName, Action commandAction) + { + if (commandMap.ContainsKey(commandName)) + { + Debug.Log($" {commandName} δעᣬע滻ָ"); + } + + commandMap[commandName] = commandAction; + } + + /// + /// жָ + /// + /// ָ + public void RemoveOptionCommand(string commandName) + { + if (commandMap.ContainsKey(commandName)) + { + commandMap.Remove(commandName); + } + else + { + Debug.Log($" {commandName} δעᣬע滻ָ"); + } + } + #region [YarnCommand("switch_tv")] public static void SwitchTV(string picName) diff --git a/Assets/Scripts/Dialog System/LineView.cs b/Assets/Scripts/Dialog System/LineView.cs index c62b2412f..dceb13a71 100644 --- a/Assets/Scripts/Dialog System/LineView.cs +++ b/Assets/Scripts/Dialog System/LineView.cs @@ -8,13 +8,33 @@ namespace AibisDream { public class LineView : DialogueViewBase { + // ָѡģʽ + private bool isInCommand; + public override void RunLine(LocalizedLine dialogueLine, Action onDialogueLineFinished) { - DialogUiViewer.Instance.ShowLine(dialogueLine.TextWithoutCharacterName.Text, dialogueLine.CharacterName, onDialogueLineFinished); + isInCommand = dialogueLine.Text.HasCommandAttr(); + + if (isInCommand) + { + DialogUiViewer.Instance.HideDialog(); + base.RunLine(dialogueLine, onDialogueLineFinished); + return; + } + + DialogUiViewer.Instance.ShowLine(dialogueLine.TextWithoutCharacterName.Text, + dialogueLine.CharacterName, onDialogueLineFinished); } public override void RunOptions(DialogueOption[] dialogueOptions, Action onOptionSelected) { + if (isInCommand) + { + DialogUiViewer.Instance.HideDialog(); + base.RunOptions(dialogueOptions, onOptionSelected); + return; + } + DialogUiViewer.Instance.ShowOptions(dialogueOptions, onOptionSelected); } diff --git a/Assets/Scripts/Dialog System/YarnOption.cs b/Assets/Scripts/Dialog System/YarnOption.cs new file mode 100644 index 000000000..37485fd89 --- /dev/null +++ b/Assets/Scripts/Dialog System/YarnOption.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Yarn.Unity; + +namespace AibisDream +{ + public class YarnOption + { + private DialogueOption dialogueOption; + + private Action onOptionSelected; + + public YarnOption(DialogueOption dialogueOption, Action onOptionSelected) + { + this.dialogueOption = dialogueOption; + this.onOptionSelected = onOptionSelected; + } + + public string Text + { + get + { + return dialogueOption.Line.TextWithoutCharacterName.Text; + } + } + + /// + /// ѡѡ + /// + public void SelectOption() + { + if (onOptionSelected == null) + { + Debug.LogWarning($"ѡ {Text} Ѿִй"); + } + else + { + onOptionSelected.Invoke(dialogueOption.DialogueOptionID); + onOptionSelected = null; + } + } + + /// + /// ѡ + /// + /// ԭʼѡ + /// ѡ + /// װѡ + public static YarnOption[] GeneOptions(DialogueOption[] options, Action onOptionSelected) + { + YarnOption[] yarnOptions = new YarnOption[options.Length]; + for (int i = 0; i < options.Length; i++) + { + yarnOptions[i] = new YarnOption(options[i], onOptionSelected); + } + + return yarnOptions; + } + } +} + diff --git a/Assets/Scripts/Dialog System/YarnOption.cs.meta b/Assets/Scripts/Dialog System/YarnOption.cs.meta new file mode 100644 index 000000000..711e3485a --- /dev/null +++ b/Assets/Scripts/Dialog System/YarnOption.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 19f7a96d35f4ad54ea493eb8c65ab6f0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Game Loop/GameLoopManager.cs b/Assets/Scripts/Game Loop/GameLoopManager.cs index 352e49566..18518a3b2 100644 --- a/Assets/Scripts/Game Loop/GameLoopManager.cs +++ b/Assets/Scripts/Game Loop/GameLoopManager.cs @@ -4,12 +4,17 @@ using Unity.VisualScripting; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Rendering; +using Yarn.Unity; namespace AibisDream { public class GameLoopManager : Singleton { - [Header("��һ���Ի�")] + [Header("ģʽ")] + [SerializeField] + private RunMode runMode; + + [Header("ʽ")] [SerializeField] private TalkSceneSO firstTalkSO; private TalkSceneSO currentTalkSceneSO; @@ -17,29 +22,16 @@ namespace AibisDream [SerializeField] private string clinicScene; - [SerializeField] - private RunMode runMode; + [Header("Ի")] + [SerializeField] private string testYarnProject; - [SerializeField] - private string testScene; - - private void Start() + public void Start() { - if (runMode == RunMode.Pro) + if (runMode == RunMode.Test) { - // ���� - GameObject UI = GameObject.Find("UI"); - UI.SetActive(true); - } - else if (runMode == RunMode.Test) - { - if (testScene == null) - { - Debug.Log("��������Գ�������"); - } - - // ���������� - SceneLoader.Instance.LoadScene(testScene); + GameObject gameObject = GameObject.Find("UI"); + gameObject.transform.Find("Main Canvas").gameObject.SetActive(false); + StartTestGame(); } } @@ -56,11 +48,19 @@ namespace AibisDream StartMenuViewer.Instance.HideStartMenu(); DialogController.Instance.StartDialog(currentTalkSceneSO.yarnProject); } + + public void StartTestGame() + { + SceneLoader.Instance.LoadScene(clinicScene); + var proj = Resources.Load($"Yarn/{testYarnProject}/{testYarnProject}"); + Debug.Log(proj == null); + DialogController.Instance.StartDialog(proj); + } } public enum RunMode { - Test, Pro + Test, Pro, FixTest } } diff --git a/Assets/Scripts/MiniGame/Gear.cs b/Assets/Scripts/MiniGame/Gear.cs index 2415052b9..7cde0c841 100644 --- a/Assets/Scripts/MiniGame/Gear.cs +++ b/Assets/Scripts/MiniGame/Gear.cs @@ -10,12 +10,14 @@ namespace AibisDream [SerializeField] public GearModel data; - public GearModel Data { + public GearModel Data + { get { return data; } - set { + set + { data = value; InitGearModel(data); - } + } } private GearController gearController; diff --git a/Assets/Scripts/Test.meta b/Assets/Scripts/Test.meta new file mode 100644 index 000000000..b1d67f64f --- /dev/null +++ b/Assets/Scripts/Test.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 999ff60e53f68cc42b783630507e7781 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Test/OptionTest.cs b/Assets/Scripts/Test/OptionTest.cs new file mode 100644 index 000000000..f9eb82554 --- /dev/null +++ b/Assets/Scripts/Test/OptionTest.cs @@ -0,0 +1,41 @@ +using System.Collections; +using System.Collections.Generic; +using TMPro; +using UnityEngine; +using UnityEngine.UI; + +namespace AibisDream.Test +{ + public class OptionTest : MonoBehaviour + { + private GameObject panel; + private GameObject prefab; + + void Start() + { + DialogController.Instance.RegisterOptionCommand("show_buttons", ShowButtons); + panel = transform.GetChild(0).gameObject; + prefab = Resources.Load("Perfabs/UI/Choice Button"); + } + + public void ShowButtons(YarnOption[] options) + { + foreach (YarnOption option in options) + { + var instance = Instantiate(prefab); + instance.transform.SetParent(panel.transform); + instance.GetComponentInChildren().text = option.Text; + instance.GetComponent