chore: 删除废弃的 Screen System、FixLightSystem 和相关代码
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6a22dc1e52d77c642996ae783383afeb
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 11400000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 7c9077b0433a4cf45812d3d82e129d9d
|
|
||||||
PrefabImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,251 +0,0 @@
|
|||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!1 &3675732557702321100
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 5343213196093212347}
|
|
||||||
- component: {fileID: 427227765761721121}
|
|
||||||
- component: {fileID: 5616660998303846768}
|
|
||||||
- component: {fileID: 17086051977173185}
|
|
||||||
- component: {fileID: 2630460379558902454}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Screen Text
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!224 &5343213196093212347
|
|
||||||
RectTransform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 3675732557702321100}
|
|
||||||
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: 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.5, y: 0.5}
|
|
||||||
--- !u!23 &427227765761721121
|
|
||||||
MeshRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 3675732557702321100}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_CastShadows: 0
|
|
||||||
m_ReceiveShadows: 0
|
|
||||||
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: -6659093157667844055, guid: f242fb3dde1933640859f1c54591c9c8, 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: 1016946085
|
|
||||||
m_SortingLayer: 11
|
|
||||||
m_SortingOrder: 45
|
|
||||||
m_AdditionalVertexStreams: {fileID: 0}
|
|
||||||
--- !u!114 &5616660998303846768
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 3675732557702321100}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, 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: "9.\u5730\u94C1\u5BF9\u8BDD\uFF08\u9700\u8981\u706B\u5C71\u548C\u533B\u751F\u90FD\u5728\u5730\u94C1\u4E0A\u53D1\u751F\u5BF9\u8BDD10.\u5916\u51FA\u90E8\u5206\u4ECE\u5916\u51FA\u573A\u666F\u5730\u94C1\u7AD9\u51FA\u53E3\u5904\u51FA\u73B0\u533B\u751F\uFF0C\u7136\u540Efadeout\uFF0C\u7136\u540Efadein\u5230\u8BCA\u5BA4\u95E8\u53E3\uFF0C\u548C\u82F1\u91CC\u5BF9\u8BDD11.\u8FDB\u5165\u8BCA\u5BA4"
|
|
||||||
m_isRightToLeft: 0
|
|
||||||
m_fontAsset: {fileID: 11400000, guid: f242fb3dde1933640859f1c54591c9c8, type: 2}
|
|
||||||
m_sharedMaterial: {fileID: -6659093157667844055, guid: f242fb3dde1933640859f1c54591c9c8, 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: 2.5
|
|
||||||
m_fontSizeBase: 2.5
|
|
||||||
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: 20
|
|
||||||
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: 0
|
|
||||||
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
|
|
||||||
_SortingLayer: 0
|
|
||||||
_SortingLayerID: 0
|
|
||||||
_SortingOrder: 0
|
|
||||||
m_hasFontAssetChanged: 0
|
|
||||||
m_renderer: {fileID: 427227765761721121}
|
|
||||||
m_maskType: 0
|
|
||||||
--- !u!114 &17086051977173185
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 3675732557702321100}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: e8ace8ced0e81c847968cdca0aeda757, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
typewriterStartsAutomatically: 0
|
|
||||||
animationLoop: 0
|
|
||||||
timeScale: 0
|
|
||||||
_text: "9.\u5730\u94C1\u5BF9\u8BDD\uFF08\u9700\u8981\u706B\u5C71\u548C\u533B\u751F\u90FD\u5728\u5730\u94C1\u4E0A\u53D1\u751F\u5BF9\u8BDD10.\u5916\u51FA\u90E8\u5206\u4ECE\u5916\u51FA\u573A\u666F\u5730\u94C1\u7AD9\u51FA\u53E3\u5904\u51FA\u73B0\u533B\u751F\uFF0C\u7136\u540Efadeout\uFF0C\u7136\u540Efadein\u5230\u8BCA\u5BA4\u95E8\u53E3\uFF0C\u548C\u82F1\u91CC\u5BF9\u8BDD11.\u8FDB\u5165\u8BCA\u5BA4"
|
|
||||||
useDynamicScaling: 1
|
|
||||||
referenceFontSize: 10
|
|
||||||
isResettingTimeOnNewText: 1
|
|
||||||
useDefaultDatabases: 1
|
|
||||||
databaseBehaviors: {fileID: 11400000, guid: ab7e07cba198f4345b19d351e6a3034f, type: 2}
|
|
||||||
databaseAppearances: {fileID: 11400000, guid: 71ecf6147756deb4ca20570628f94f96, type: 2}
|
|
||||||
useDefaultStyleSheet: 1
|
|
||||||
styleSheet: {fileID: 0}
|
|
||||||
databaseActions: {fileID: 11400000, guid: de78232a60d74f6459e57e5606304209, type: 2}
|
|
||||||
defaultAppearancesTags:
|
|
||||||
- step
|
|
||||||
defaultDisappearancesTags:
|
|
||||||
- fade
|
|
||||||
defaultBehaviorsTags: []
|
|
||||||
defaultTagsMode: 0
|
|
||||||
--- !u!114 &2630460379558902454
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 3675732557702321100}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 57a6945b90dcd0c4b81619c0d8b5c283, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
useTypeWriter: 1
|
|
||||||
startTypewriterMode: 2
|
|
||||||
hideAppearancesOnSkip: 1
|
|
||||||
hideDisappearancesOnSkip: 0
|
|
||||||
triggerEventsOnSkip: 0
|
|
||||||
resetTypingSpeedAtStartup: 1
|
|
||||||
disappearanceOrientation: 0
|
|
||||||
triggerShowedAfterEffectsEnd: 0
|
|
||||||
triggerDisappearedAfterEffectsEnd: 0
|
|
||||||
onTextShowed:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls: []
|
|
||||||
onTypewriterStart:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls: []
|
|
||||||
onTextDisappeared:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls: []
|
|
||||||
onCharacterVisible:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls: []
|
|
||||||
onMessage:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls: []
|
|
||||||
waitForNormalChars: 0.03
|
|
||||||
waitLong: 0.6
|
|
||||||
waitMiddle: 0.2
|
|
||||||
avoidMultiplePunctuationWait: 0
|
|
||||||
waitForNewLines: 1
|
|
||||||
waitForLastCharacter: 1
|
|
||||||
useTypewriterWaitForDisappearances: 1
|
|
||||||
disappearanceWaitTime: 0.015
|
|
||||||
disappearanceSpeedMultiplier: 1
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 685577c7a817bba4ca5a68ec82e49bc1
|
|
||||||
PrefabImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,173 +0,0 @@
|
|||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!1 &5370176113195622641
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 4156240678385147197}
|
|
||||||
- component: {fileID: 3152720343440710739}
|
|
||||||
- component: {fileID: 351969066121265812}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Task Item Temp
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!224 &4156240678385147197
|
|
||||||
RectTransform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 5370176113195622641}
|
|
||||||
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: 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: 1.39, y: 0}
|
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
|
||||||
--- !u!23 &3152720343440710739
|
|
||||||
MeshRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 5370176113195622641}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_CastShadows: 0
|
|
||||||
m_ReceiveShadows: 0
|
|
||||||
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: -6659093157667844055, guid: f242fb3dde1933640859f1c54591c9c8, 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: 1016946085
|
|
||||||
m_SortingLayer: 11
|
|
||||||
m_SortingOrder: 3
|
|
||||||
m_AdditionalVertexStreams: {fileID: 0}
|
|
||||||
--- !u!114 &351969066121265812
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 5370176113195622641}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, 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: "\u25CF \u5BFB\u627EUF\u6A21\u5757"
|
|
||||||
m_isRightToLeft: 0
|
|
||||||
m_fontAsset: {fileID: 11400000, guid: f242fb3dde1933640859f1c54591c9c8, type: 2}
|
|
||||||
m_sharedMaterial: {fileID: -6659093157667844055, guid: f242fb3dde1933640859f1c54591c9c8, type: 2}
|
|
||||||
m_fontSharedMaterials: []
|
|
||||||
m_fontMaterial: {fileID: 0}
|
|
||||||
m_fontMaterials: []
|
|
||||||
m_fontColor32:
|
|
||||||
serializedVersion: 2
|
|
||||||
rgba: 4278255300
|
|
||||||
m_fontColor: {r: 0.7686275, g: 0.9960785, b: 0, 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: 2.5
|
|
||||||
m_fontSizeBase: 2.5
|
|
||||||
m_fontWeight: 400
|
|
||||||
m_enableAutoSizing: 0
|
|
||||||
m_fontSizeMin: 18
|
|
||||||
m_fontSizeMax: 72
|
|
||||||
m_fontStyle: 0
|
|
||||||
m_HorizontalAlignment: 1
|
|
||||||
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: 0
|
|
||||||
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
|
|
||||||
_SortingLayer: 0
|
|
||||||
_SortingLayerID: 0
|
|
||||||
_SortingOrder: 0
|
|
||||||
m_hasFontAssetChanged: 0
|
|
||||||
m_renderer: {fileID: 3152720343440710739}
|
|
||||||
m_maskType: 0
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 63913c6ee20b38644bf16a505dd300f2
|
|
||||||
PrefabImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,217 +0,0 @@
|
|||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!1 &5370176113195622641
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 4156240678385147197}
|
|
||||||
- component: {fileID: 3152720343440710739}
|
|
||||||
- component: {fileID: 351969066121265812}
|
|
||||||
- component: {fileID: 1785907059718621836}
|
|
||||||
- component: {fileID: 3387003730839350180}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Task Item
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!224 &4156240678385147197
|
|
||||||
RectTransform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 5370176113195622641}
|
|
||||||
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: 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: 1.39, y: 0}
|
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
|
||||||
--- !u!23 &3152720343440710739
|
|
||||||
MeshRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 5370176113195622641}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_CastShadows: 0
|
|
||||||
m_ReceiveShadows: 0
|
|
||||||
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: -6659093157667844055, guid: f242fb3dde1933640859f1c54591c9c8, 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: 1016946085
|
|
||||||
m_SortingLayer: 11
|
|
||||||
m_SortingOrder: 39
|
|
||||||
m_AdditionalVertexStreams: {fileID: 0}
|
|
||||||
--- !u!114 &351969066121265812
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 5370176113195622641}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, 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: "\u25CF \u5BFB\u627EUF\u6A21\u5757"
|
|
||||||
m_isRightToLeft: 0
|
|
||||||
m_fontAsset: {fileID: 11400000, guid: f242fb3dde1933640859f1c54591c9c8, type: 2}
|
|
||||||
m_sharedMaterial: {fileID: -6659093157667844055, guid: f242fb3dde1933640859f1c54591c9c8, type: 2}
|
|
||||||
m_fontSharedMaterials: []
|
|
||||||
m_fontMaterial: {fileID: 0}
|
|
||||||
m_fontMaterials: []
|
|
||||||
m_fontColor32:
|
|
||||||
serializedVersion: 2
|
|
||||||
rgba: 4278255300
|
|
||||||
m_fontColor: {r: 0.7686275, g: 0.9960785, b: 0, 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: 2.5
|
|
||||||
m_fontSizeBase: 2.5
|
|
||||||
m_fontWeight: 400
|
|
||||||
m_enableAutoSizing: 0
|
|
||||||
m_fontSizeMin: 18
|
|
||||||
m_fontSizeMax: 72
|
|
||||||
m_fontStyle: 0
|
|
||||||
m_HorizontalAlignment: 1
|
|
||||||
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: 0
|
|
||||||
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
|
|
||||||
_SortingLayer: 0
|
|
||||||
_SortingLayerID: 0
|
|
||||||
_SortingOrder: 0
|
|
||||||
m_hasFontAssetChanged: 0
|
|
||||||
m_renderer: {fileID: 3152720343440710739}
|
|
||||||
m_maskType: 0
|
|
||||||
--- !u!114 &1785907059718621836
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 5370176113195622641}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 56eb0353ae6e5124bb35b17aff880f16, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
m_StringReference:
|
|
||||||
m_TableReference:
|
|
||||||
m_TableCollectionName:
|
|
||||||
m_TableEntryReference:
|
|
||||||
m_KeyId: 0
|
|
||||||
m_Key:
|
|
||||||
m_FallbackState: 0
|
|
||||||
m_WaitForCompletion: 0
|
|
||||||
m_LocalVariables: []
|
|
||||||
m_FormatArguments: []
|
|
||||||
m_UpdateString:
|
|
||||||
m_PersistentCalls:
|
|
||||||
m_Calls: []
|
|
||||||
references:
|
|
||||||
version: 2
|
|
||||||
RefIds: []
|
|
||||||
--- !u!114 &3387003730839350180
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 5370176113195622641}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 4c9c71a7e9c9455d955ff20b5db823a1, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
isLineText: 1
|
|
||||||
template: "\u25CF {0}"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: db95b777ec4d99341aebf0d10c8e8bb1
|
|
||||||
PrefabImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,214 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using AibisDream.Utility;
|
|
||||||
using DG.Tweening;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace AibisDream.FixSystem
|
|
||||||
{
|
|
||||||
public class CharacterViewer : MonoBehaviour
|
|
||||||
{
|
|
||||||
private string _curCharacterName;
|
|
||||||
private GameObject _curCharacter;
|
|
||||||
private float _characterAlpha;
|
|
||||||
private Coroutine _autoBlinkCoroutine;
|
|
||||||
|
|
||||||
private Transform FaceGroup => _curCharacter.transform.Find("表情");
|
|
||||||
private Transform PoseGroup => _curCharacter.transform.Find("动作");
|
|
||||||
private Transform LinkDevice => _curCharacter.transform.Find("换液设备");
|
|
||||||
private SpriteRenderer _blinkLayer;
|
|
||||||
|
|
||||||
public CharacterData characterData;
|
|
||||||
public event Action<CharacterData> CharacterChangeEvent;
|
|
||||||
|
|
||||||
public IEnumerator CharacterInit(string characterName)
|
|
||||||
{
|
|
||||||
// 异步加载角色预制体(psb)
|
|
||||||
ResourceRequest request = Resources.LoadAsync<GameObject>($"Characters/{characterName}");
|
|
||||||
yield return request;
|
|
||||||
#if DEBUG
|
|
||||||
if (request.asset == null)
|
|
||||||
{
|
|
||||||
Debug.Log($"{characterName}没有找到");
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// 先卸载旧的
|
|
||||||
if (_curCharacter != null)
|
|
||||||
{
|
|
||||||
Destroy(_curCharacter);
|
|
||||||
_curCharacter = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
characterData = new CharacterData();
|
|
||||||
characterData.characterName = characterName;
|
|
||||||
// 加载新的
|
|
||||||
GameObject characterPrefab = request.asset as GameObject;
|
|
||||||
_curCharacter = Instantiate(characterPrefab, transform);
|
|
||||||
// 初始化处理
|
|
||||||
_curCharacter.SetActive(false);
|
|
||||||
_blinkLayer = _curCharacter.transform.Find("闭眼").GetComponent<SpriteRenderer>();
|
|
||||||
_blinkLayer.enabled = false;
|
|
||||||
// 表情和动作只留一种
|
|
||||||
characterData.faceName = ActiveLayer(FaceGroup);
|
|
||||||
characterData.poseName = ActiveLayer(PoseGroup);
|
|
||||||
// 换液设备先隐藏
|
|
||||||
RemoveLinkDevice();
|
|
||||||
|
|
||||||
// 初始化角色透明度
|
|
||||||
SetCharacterAlpha(0);
|
|
||||||
|
|
||||||
// 等待一帧,确保初始化完成
|
|
||||||
yield return new WaitForSeconds(1);
|
|
||||||
// 激活角色
|
|
||||||
_curCharacter.SetActive(true);
|
|
||||||
|
|
||||||
characterData.isShow = false;
|
|
||||||
UpdateCharacterData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateCharacterData()
|
|
||||||
{
|
|
||||||
CharacterChangeEvent?.Invoke(characterData);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string ActiveLayer(Transform root, string layerName = null)
|
|
||||||
{
|
|
||||||
var childLayers = root.GetComponentsInChildren<SpriteRenderer>(true);
|
|
||||||
if (childLayers.Length == 0) return null;
|
|
||||||
|
|
||||||
foreach (var layer in childLayers)
|
|
||||||
{
|
|
||||||
layer.enabled = layer.gameObject.name == layerName;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果输入为空,就默认激活一层
|
|
||||||
if (layerName == null)
|
|
||||||
{
|
|
||||||
childLayers[0].enabled = true;
|
|
||||||
return childLayers[0].gameObject.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
return layerName;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetCharacterAlpha(float alpha)
|
|
||||||
{
|
|
||||||
_characterAlpha = alpha;
|
|
||||||
SpriteRenderer[] renderers = _curCharacter.GetComponentsInChildren<SpriteRenderer>(true);
|
|
||||||
Array.ForEach(renderers, spriteRenderer => { spriteRenderer.SetAlpha(alpha); });
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerator CharacterFadeIn(float duration = 1f)
|
|
||||||
{
|
|
||||||
if (_curCharacter)
|
|
||||||
{
|
|
||||||
yield return FadeCharacter(1, duration);
|
|
||||||
characterData.isShow = true;
|
|
||||||
UpdateCharacterData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerator CharacterFadeOut(float duration = 1f)
|
|
||||||
{
|
|
||||||
if (_curCharacter != null)
|
|
||||||
{
|
|
||||||
yield return FadeCharacter(0, duration);
|
|
||||||
characterData.isShow = false;
|
|
||||||
UpdateCharacterData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator FadeCharacter(float toAlpha, float duration)
|
|
||||||
{
|
|
||||||
yield return DOTween.To(() => _characterAlpha, x => SetCharacterAlpha(x), toAlpha, duration)
|
|
||||||
.WaitForCompletion();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SwitchPose(string poseName)
|
|
||||||
{
|
|
||||||
characterData.poseName = ActiveLayer(PoseGroup, poseName);
|
|
||||||
UpdateCharacterData();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SwitchFace(string faceName)
|
|
||||||
{
|
|
||||||
StopAutoBlink();
|
|
||||||
characterData.faceName = ActiveLayer(FaceGroup, faceName);
|
|
||||||
UpdateCharacterData();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Blink()
|
|
||||||
{
|
|
||||||
_blinkLayer.enabled = true;
|
|
||||||
_ = CommonUtil.Delay(100, () => { _blinkLayer.enabled = false; });
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AutoBlink()
|
|
||||||
{
|
|
||||||
StopAutoBlink();
|
|
||||||
_autoBlinkCoroutine = StartCoroutine(AutoBlinkAsync());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StopAutoBlink()
|
|
||||||
{
|
|
||||||
if (_autoBlinkCoroutine != null)
|
|
||||||
{
|
|
||||||
StopCoroutine(_autoBlinkCoroutine);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator AutoBlinkAsync()
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
yield return new WaitForSeconds(6f);
|
|
||||||
Blink();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddLinkDevice()
|
|
||||||
{
|
|
||||||
characterData.hasDevice = true;
|
|
||||||
UpdateCharacterData();
|
|
||||||
LinkDevice.gameObject.SetActive(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveLinkDevice()
|
|
||||||
{
|
|
||||||
characterData.hasDevice = false;
|
|
||||||
UpdateCharacterData();
|
|
||||||
LinkDevice.gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CharacterShow(string characterName = "")
|
|
||||||
{
|
|
||||||
if (_curCharacter != null)
|
|
||||||
{
|
|
||||||
characterData.isShow = true;
|
|
||||||
UpdateCharacterData();
|
|
||||||
// 将角色的透明度设置为 1
|
|
||||||
SetCharacterAlpha(1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogError($"Character {characterName} not found in loaded characters.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnDestroy()
|
|
||||||
{
|
|
||||||
characterData = new CharacterData();
|
|
||||||
UpdateCharacterData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public struct CharacterData
|
|
||||||
{
|
|
||||||
public string characterName;
|
|
||||||
public string faceName;
|
|
||||||
public string poseName;
|
|
||||||
public bool hasDevice;
|
|
||||||
public bool isShow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 26c6d766a411186449e3e0fd4c9f1ca5
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using AibisDream.FixSystem;
|
|
||||||
using UnityEngine;
|
|
||||||
using Yarn.Unity;
|
|
||||||
|
|
||||||
namespace AibisDream
|
|
||||||
{
|
|
||||||
public static class ClinicYarnCommand
|
|
||||||
{
|
|
||||||
private static ClinicSystem ClinicSystem => FixSystemCenter.SystemDic.Get<ClinicSystem>();
|
|
||||||
|
|
||||||
[YarnCommand("quit_clinic_new")]
|
|
||||||
public static IEnumerator Quit(float duration)
|
|
||||||
{
|
|
||||||
return ClinicSystem.Quit(duration);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region 角色展示相关
|
|
||||||
|
|
||||||
[YarnCommand("character_init_new")]
|
|
||||||
public static void CharacterInit(string characterName)
|
|
||||||
{
|
|
||||||
// return Character.CharacterInit(characterName);
|
|
||||||
Debug.Log("旧表情系统已废弃,请停止使用");
|
|
||||||
}
|
|
||||||
|
|
||||||
[YarnCommand("character_fade_in_new")]
|
|
||||||
public static void CharacterFadeIn()
|
|
||||||
{
|
|
||||||
// return Character.CharacterFadeIn();
|
|
||||||
Debug.Log("旧表情系统已废弃,请停止使用");
|
|
||||||
}
|
|
||||||
|
|
||||||
[YarnCommand("character_fade_out_new")]
|
|
||||||
public static void CharacterFadeOut()
|
|
||||||
{
|
|
||||||
// return Character.CharacterFadeOut();
|
|
||||||
Debug.Log("旧表情系统已废弃,请停止使用");
|
|
||||||
}
|
|
||||||
|
|
||||||
[YarnCommand("character_show_new")]
|
|
||||||
public static void CharacterShow(string characterName)
|
|
||||||
{
|
|
||||||
// Character.CharacterShow(characterName);
|
|
||||||
Debug.Log("旧表情系统已废弃,请停止使用");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 角色动作调整
|
|
||||||
|
|
||||||
[YarnCommand("character_face_new")]
|
|
||||||
public static void CharacterFace(string state)
|
|
||||||
{
|
|
||||||
// Character.SwitchFace(state);
|
|
||||||
Debug.Log("旧表情系统已废弃,请停止使用");
|
|
||||||
}
|
|
||||||
|
|
||||||
[YarnCommand("character_eye_new")]
|
|
||||||
public static void CharacterEye(string state)
|
|
||||||
{
|
|
||||||
// Character.SetEyeState(state);
|
|
||||||
Debug.LogWarning("该命令已废弃");
|
|
||||||
}
|
|
||||||
|
|
||||||
[YarnCommand("character_crying_new")]
|
|
||||||
public static void CharacterCrying(bool isCrying)
|
|
||||||
{
|
|
||||||
// Character.SetCrying(isCrying);
|
|
||||||
Debug.LogWarning("该命令已废弃");
|
|
||||||
}
|
|
||||||
|
|
||||||
[YarnCommand("character_pos")]
|
|
||||||
public static void SwitchPos(string poseName)
|
|
||||||
{
|
|
||||||
// Character.SwitchPose(poseName);
|
|
||||||
Debug.Log("旧表情系统已废弃,请停止使用");
|
|
||||||
}
|
|
||||||
|
|
||||||
[YarnCommand("character_auto_blink")]
|
|
||||||
public static void AutoBlink()
|
|
||||||
{
|
|
||||||
// Character.AutoBlink();
|
|
||||||
Debug.Log("旧表情系统已废弃,请停止使用");
|
|
||||||
}
|
|
||||||
|
|
||||||
[YarnCommand("character_stop_auto_blink")]
|
|
||||||
public static void StopAutoBlink()
|
|
||||||
{
|
|
||||||
// Character.StopAutoBlink();
|
|
||||||
Debug.Log("旧表情系统已废弃,请停止使用");
|
|
||||||
}
|
|
||||||
|
|
||||||
[YarnCommand("character_add_device")]
|
|
||||||
public static void AddLinkDevice()
|
|
||||||
{
|
|
||||||
// Character.AddLinkDevice();
|
|
||||||
Debug.Log("旧表情系统已废弃,请停止使用");
|
|
||||||
}
|
|
||||||
|
|
||||||
[YarnCommand("character_remove_device")]
|
|
||||||
public static void RemoveLinkDevice()
|
|
||||||
{
|
|
||||||
// Character.RemoveLinkDevice();
|
|
||||||
Debug.Log("旧表情系统已废弃,请停止使用");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a98db7194cd94b56a42e2bb8035cf2e7
|
|
||||||
timeCreated: 1734089013
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: d37d6eefb3cebe8409b623ca8f703ed3
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,905 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
using UnityEngine.Rendering.Universal;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using DG.Tweening;
|
|
||||||
|
|
||||||
namespace AibisDream.FixSystem
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 灯光系统控制器,管理呼吸灯、小灯、环境灯、面板灯和警报灯的状态
|
|
||||||
/// </summary>
|
|
||||||
public class FixLightSystem : MonoBehaviour
|
|
||||||
{
|
|
||||||
#region 枚举定义
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 灯光状态
|
|
||||||
/// </summary>
|
|
||||||
public enum LightState
|
|
||||||
{
|
|
||||||
Normal, // 正常状态
|
|
||||||
Warning, // 警告状态
|
|
||||||
Emergency // 紧急状态
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 常量定义
|
|
||||||
|
|
||||||
private const float SYSTEM_OFF_ENVIRONMENT_INTENSITY = 0.4f;
|
|
||||||
private const float SELF_CHECK_DELAY = 0.05f;
|
|
||||||
private const float SELF_CHECK_INTERVAL = 0.1f;
|
|
||||||
private const float ECG_WAVE_TOGGLE_DELAY = 0.1f;
|
|
||||||
private const float ECG_WAVE_FINAL_DELAY = 0.2f;
|
|
||||||
private const float BREATHING_LIGHT_START_DELAY = 0.5f;
|
|
||||||
private const float ALARM_LIGHT_MAX_INTENSITY = 4f;
|
|
||||||
private const float BREATHING_LIGHT_MAX_INTENSITY = 1f;
|
|
||||||
private const int SELF_CHECK_COUNT = 2;
|
|
||||||
private const int MIN_FLICKER_BLINK_COUNT = 2;
|
|
||||||
private const int MAX_FLICKER_BLINK_COUNT = 4;
|
|
||||||
private const float MIN_FLICKER_INTERVAL = 3f;
|
|
||||||
private const float MAX_FLICKER_INTERVAL = 8f;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 呼吸灯相关字段
|
|
||||||
|
|
||||||
[Header("呼吸灯设置")]
|
|
||||||
[SerializeField] private Light2D breathingLight;
|
|
||||||
[SerializeField] private float normalBreathingSpeed = 1f;
|
|
||||||
[SerializeField] private float warningBreathingSpeed = 2f;
|
|
||||||
[SerializeField] private float emergencyBreathingSpeed = 3f;
|
|
||||||
[SerializeField] private Color normalColor = Color.green;
|
|
||||||
[SerializeField] private Color warningColor = Color.yellow;
|
|
||||||
[SerializeField] private Color emergencyColor = Color.red;
|
|
||||||
[SerializeField] private RobotECGWave ecgWave;
|
|
||||||
|
|
||||||
private SpriteRenderer breathingLightSprite;
|
|
||||||
private Tween breathingTween;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 小灯相关字段
|
|
||||||
|
|
||||||
[Header("小灯设置")]
|
|
||||||
[SerializeField] private List<Light2D> smallLights = new List<Light2D>();
|
|
||||||
[SerializeField] private float smallLightBlinkInterval = 0.5f;
|
|
||||||
[SerializeField] private Color smallLightDefaultColor = Color.yellow;
|
|
||||||
[SerializeField] private Color smallLightNormalColor = Color.green;
|
|
||||||
[SerializeField] private Color smallLightErrorColor = Color.red;
|
|
||||||
[SerializeField] private float operationBlinkDuration = 1f;
|
|
||||||
[SerializeField] private float operationBlinkInterval = 0.1f;
|
|
||||||
|
|
||||||
private List<SpriteRenderer> smallLightSprites = new List<SpriteRenderer>();
|
|
||||||
private SmallLightState smallLightState = SmallLightState.Default;
|
|
||||||
private SmallLightStatus smallLightStatus = SmallLightStatus.Normal;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 环境灯相关字段
|
|
||||||
|
|
||||||
[Header("环境灯设置")]
|
|
||||||
[SerializeField] private Light2D environmentLight;
|
|
||||||
[SerializeField] private bool isEnvironmentLightFlickering = false;
|
|
||||||
[SerializeField] private float normalEnvironmentIntensity = 1f;
|
|
||||||
[SerializeField] private float warningEnvironmentIntensity = 1f;
|
|
||||||
[SerializeField] private float emergencyEnvironmentIntensity = 1f;
|
|
||||||
[SerializeField] private float brokenLightFlickerInterval = 0.1f;
|
|
||||||
[SerializeField] private float brokenLightFlickerDuration = 0.05f;
|
|
||||||
[SerializeField] private float brokenLightPatternInterval = 2f;
|
|
||||||
[SerializeField] private float brokenLightDarkDuration = 0.8f;
|
|
||||||
[SerializeField] private Color normalEnvironmentColor = Color.white;
|
|
||||||
[SerializeField] private Color warningEnvironmentColor = Color.yellow;
|
|
||||||
[SerializeField] private Color emergencyEnvironmentColor = Color.red;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 面板灯相关字段
|
|
||||||
|
|
||||||
[Header("面板灯设置")]
|
|
||||||
[SerializeField] private Light2D panelLight;
|
|
||||||
[SerializeField] private float panelLightIntensity = 1f;
|
|
||||||
[SerializeField] private float panelLightBlinkDuration = 0.2f;
|
|
||||||
[SerializeField] private int panelLightBlinkCount = 2;
|
|
||||||
[SerializeField] private Color panelLightColor = Color.white;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 警报灯相关字段
|
|
||||||
|
|
||||||
[Header("警报灯设置")]
|
|
||||||
[SerializeField] private Light2D alarmLight;
|
|
||||||
[SerializeField] private float alarmBlinkSpeed = 0.5f;
|
|
||||||
[SerializeField] private Color alarmLightColor = Color.red;
|
|
||||||
|
|
||||||
private Tween alarmTween;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 系统状态相关字段
|
|
||||||
|
|
||||||
[SerializeField] private bool isSystemOn = false;
|
|
||||||
private LightState currentState = LightState.Normal;
|
|
||||||
private bool isSystemStarting = false;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Unity生命周期方法
|
|
||||||
|
|
||||||
private void Awake()
|
|
||||||
{
|
|
||||||
// 初始化SpriteRenderer引用
|
|
||||||
InitializeSpriteRenderers();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Start()
|
|
||||||
{
|
|
||||||
InitializeSystemState();
|
|
||||||
SetEnvironmentLightBroken();
|
|
||||||
SetEnvironmentLightFlickering(isEnvironmentLightFlickering);
|
|
||||||
StartCoroutine(SmallLightsBlinkRoutine());
|
|
||||||
SetSmallLightState(SmallLightState.Default);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDestroy()
|
|
||||||
{
|
|
||||||
// 清理所有Tween
|
|
||||||
breathingTween?.Kill();
|
|
||||||
alarmTween?.Kill();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 初始化方法
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 初始化SpriteRenderer引用
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeSpriteRenderers()
|
|
||||||
{
|
|
||||||
// 自动获取呼吸灯的SpriteRenderer
|
|
||||||
if (breathingLight != null)
|
|
||||||
{
|
|
||||||
breathingLightSprite = breathingLight.GetComponentInParent<SpriteRenderer>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 自动获取小灯的SpriteRenderer
|
|
||||||
smallLightSprites.Clear();
|
|
||||||
foreach (var light in smallLights)
|
|
||||||
{
|
|
||||||
if (light != null)
|
|
||||||
{
|
|
||||||
var spriteRenderer = light.GetComponentInParent<SpriteRenderer>();
|
|
||||||
smallLightSprites.Add(spriteRenderer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 初始化系统状态
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeSystemState()
|
|
||||||
{
|
|
||||||
if (isSystemOn)
|
|
||||||
{
|
|
||||||
InitializeSystemOn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
InitializeSystemOff();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 系统开启时的初始化
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeSystemOn()
|
|
||||||
{
|
|
||||||
SetBreathingLight(normalColor, BREATHING_LIGHT_MAX_INTENSITY);
|
|
||||||
InitializeSmallLights(smallLightDefaultColor, BREATHING_LIGHT_MAX_INTENSITY);
|
|
||||||
SetPanelLight(panelLightColor, panelLightIntensity);
|
|
||||||
SetECGWaveActive(true);
|
|
||||||
SetEnvironmentLightIntensity(normalEnvironmentIntensity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 系统关闭时的初始化
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeSystemOff()
|
|
||||||
{
|
|
||||||
SetBreathingLight(normalColor, 0f, true);
|
|
||||||
TurnOffAllSmallLights();
|
|
||||||
SetPanelLight(panelLightColor, 0f);
|
|
||||||
SetECGWaveActive(false);
|
|
||||||
SetEnvironmentLightIntensity(SYSTEM_OFF_ENVIRONMENT_INTENSITY);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 公共方法 - 系统控制
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 检查系统是否开启
|
|
||||||
/// </summary>
|
|
||||||
public bool IsSystemOn()
|
|
||||||
{
|
|
||||||
return isSystemOn;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置系统电源状态
|
|
||||||
/// </summary>
|
|
||||||
public void SetSystemPower(bool isOn)
|
|
||||||
{
|
|
||||||
isSystemOn = isOn;
|
|
||||||
if (!isOn)
|
|
||||||
{
|
|
||||||
TurnOffAllLights();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateLightsState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 启动系统
|
|
||||||
/// </summary>
|
|
||||||
public IEnumerator StartSystem()
|
|
||||||
{
|
|
||||||
if (isSystemStarting || isSystemOn) yield break;
|
|
||||||
|
|
||||||
isSystemStarting = true;
|
|
||||||
yield return StartCoroutine(SystemStartSequence());
|
|
||||||
isSystemStarting = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 公共方法 - 灯光状态控制
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置灯光状态
|
|
||||||
/// </summary>
|
|
||||||
public void SetLightState(LightState newState)
|
|
||||||
{
|
|
||||||
if (!isSystemOn) return;
|
|
||||||
|
|
||||||
if (currentState != newState)
|
|
||||||
{
|
|
||||||
currentState = newState;
|
|
||||||
UpdateLightsState();
|
|
||||||
Debug.Log($"灯光状态已切换为: {newState}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置小灯状态
|
|
||||||
/// </summary>
|
|
||||||
public void SetSmallLightState(SmallLightState newState)
|
|
||||||
{
|
|
||||||
if (smallLightState != newState)
|
|
||||||
{
|
|
||||||
smallLightState = newState;
|
|
||||||
if (newState == SmallLightState.Default)
|
|
||||||
{
|
|
||||||
smallLightStatus = SmallLightStatus.Normal;
|
|
||||||
}
|
|
||||||
StartCoroutine(HandleSmallLightStateChange());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置小灯状态状态
|
|
||||||
/// </summary>
|
|
||||||
public void SetSmallLightStatus(SmallLightStatus newStatus)
|
|
||||||
{
|
|
||||||
if (smallLightStatus != newStatus)
|
|
||||||
{
|
|
||||||
smallLightStatus = newStatus;
|
|
||||||
UpdateSmallLightsStatus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置环境灯闪烁状态
|
|
||||||
/// </summary>
|
|
||||||
public void SetEnvironmentLightFlickering(bool isFlickering)
|
|
||||||
{
|
|
||||||
if (isEnvironmentLightFlickering != isFlickering)
|
|
||||||
{
|
|
||||||
isEnvironmentLightFlickering = isFlickering;
|
|
||||||
if (isFlickering)
|
|
||||||
{
|
|
||||||
StartCoroutine(EnvironmentLightFlickerRoutine());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置环境灯损坏状态
|
|
||||||
/// </summary>
|
|
||||||
public void SetEnvironmentLightBroken()
|
|
||||||
{
|
|
||||||
if (environmentLight != null)
|
|
||||||
{
|
|
||||||
environmentLight.color = GetEnvironmentColorByState(currentState);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置警报灯闪烁速度
|
|
||||||
/// </summary>
|
|
||||||
public void SetAlarmBlinkSpeed(float speed)
|
|
||||||
{
|
|
||||||
if (speed > 0)
|
|
||||||
{
|
|
||||||
alarmBlinkSpeed = speed;
|
|
||||||
// 如果当前正在闪烁,更新闪烁速度
|
|
||||||
if (currentState == LightState.Emergency && alarmLight != null)
|
|
||||||
{
|
|
||||||
StartAlarmLightBlink();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 停止警报灯
|
|
||||||
/// </summary>
|
|
||||||
public void StopAlarmLight()
|
|
||||||
{
|
|
||||||
if (alarmLight != null)
|
|
||||||
{
|
|
||||||
alarmTween?.Kill();
|
|
||||||
alarmLight.intensity = 0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 公共方法 - ECG波形控制
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取当前波形类型
|
|
||||||
/// </summary>
|
|
||||||
public RobotECGWave.WaveType GetCurrentWaveType()
|
|
||||||
{
|
|
||||||
return ecgWave?.waveType ?? RobotECGWave.WaveType.RobotECG;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置波形类型
|
|
||||||
/// </summary>
|
|
||||||
public void SetWaveType(RobotECGWave.WaveType waveType)
|
|
||||||
{
|
|
||||||
if (ecgWave != null)
|
|
||||||
{
|
|
||||||
ecgWave.SetWaveType(waveType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 私有方法 - 灯光状态更新
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新所有灯光状态
|
|
||||||
/// </summary>
|
|
||||||
private void UpdateLightsState()
|
|
||||||
{
|
|
||||||
var stateConfig = GetStateConfig(currentState);
|
|
||||||
|
|
||||||
UpdateAlarmLight(stateConfig);
|
|
||||||
UpdateBreathingLight(stateConfig);
|
|
||||||
UpdateECGWave(stateConfig);
|
|
||||||
UpdateEnvironmentLight(stateConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取状态配置
|
|
||||||
/// </summary>
|
|
||||||
private (Color color, float breathingSpeed, RobotECGWave.WaveType waveType, Color envColor, float envIntensity) GetStateConfig(LightState state)
|
|
||||||
{
|
|
||||||
return state switch
|
|
||||||
{
|
|
||||||
LightState.Normal => (normalColor, normalBreathingSpeed, RobotECGWave.WaveType.RobotECG, normalEnvironmentColor, normalEnvironmentIntensity),
|
|
||||||
LightState.Warning => (warningColor, warningBreathingSpeed, RobotECGWave.WaveType.Warning, warningEnvironmentColor, warningEnvironmentIntensity),
|
|
||||||
LightState.Emergency => (emergencyColor, emergencyBreathingSpeed, RobotECGWave.WaveType.Noise, normalEnvironmentColor, normalEnvironmentIntensity),
|
|
||||||
_ => (normalColor, normalBreathingSpeed, RobotECGWave.WaveType.RobotECG, normalEnvironmentColor, normalEnvironmentIntensity)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新警报灯
|
|
||||||
/// </summary>
|
|
||||||
private void UpdateAlarmLight((Color color, float breathingSpeed, RobotECGWave.WaveType waveType, Color envColor, float envIntensity) config)
|
|
||||||
{
|
|
||||||
if (alarmLight == null) return;
|
|
||||||
|
|
||||||
if (currentState == LightState.Emergency)
|
|
||||||
{
|
|
||||||
alarmLight.color = alarmLightColor;
|
|
||||||
StartAlarmLightBlink();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
StopAlarmLight();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 启动警报灯闪烁
|
|
||||||
/// </summary>
|
|
||||||
private void StartAlarmLightBlink()
|
|
||||||
{
|
|
||||||
if (alarmLight == null) return;
|
|
||||||
|
|
||||||
alarmTween?.Kill();
|
|
||||||
alarmTween = DOTween.To(
|
|
||||||
() => alarmLight.intensity,
|
|
||||||
x => alarmLight.intensity = x,
|
|
||||||
ALARM_LIGHT_MAX_INTENSITY,
|
|
||||||
alarmBlinkSpeed
|
|
||||||
)
|
|
||||||
.SetLoops(-1, LoopType.Yoyo)
|
|
||||||
.SetEase(Ease.InOutSine);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新呼吸灯
|
|
||||||
/// </summary>
|
|
||||||
private void UpdateBreathingLight((Color color, float breathingSpeed, RobotECGWave.WaveType waveType, Color envColor, float envIntensity) config)
|
|
||||||
{
|
|
||||||
if (breathingLight == null)
|
|
||||||
{
|
|
||||||
Debug.LogWarning("呼吸灯组件未设置!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetBreathingLight(config.color, BREATHING_LIGHT_MAX_INTENSITY);
|
|
||||||
StartBreathingEffect(config.breathingSpeed);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 启动呼吸效果
|
|
||||||
/// </summary>
|
|
||||||
private void StartBreathingEffect(float breathingSpeed)
|
|
||||||
{
|
|
||||||
breathingTween?.Kill();
|
|
||||||
breathingTween = DOTween.To(
|
|
||||||
() => breathingLight.intensity,
|
|
||||||
x => breathingLight.intensity = x,
|
|
||||||
BREATHING_LIGHT_MAX_INTENSITY,
|
|
||||||
1f / breathingSpeed
|
|
||||||
)
|
|
||||||
.SetLoops(-1, LoopType.Yoyo)
|
|
||||||
.SetEase(Ease.InOutSine);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新ECG波形
|
|
||||||
/// </summary>
|
|
||||||
private void UpdateECGWave((Color color, float breathingSpeed, RobotECGWave.WaveType waveType, Color envColor, float envIntensity) config)
|
|
||||||
{
|
|
||||||
if (ecgWave != null)
|
|
||||||
{
|
|
||||||
ecgWave.SetWaveType(config.waveType);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogWarning("ECG波形组件未设置!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新环境灯
|
|
||||||
/// </summary>
|
|
||||||
private void UpdateEnvironmentLight((Color color, float breathingSpeed, RobotECGWave.WaveType waveType, Color envColor, float envIntensity) config)
|
|
||||||
{
|
|
||||||
if (environmentLight == null) return;
|
|
||||||
|
|
||||||
environmentLight.color = config.envColor;
|
|
||||||
float targetIntensity = isSystemOn ? config.envIntensity : SYSTEM_OFF_ENVIRONMENT_INTENSITY;
|
|
||||||
environmentLight.intensity = targetIntensity;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 私有方法 - 灯光设置辅助方法
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置呼吸灯
|
|
||||||
/// </summary>
|
|
||||||
private void SetBreathingLight(Color color, float intensity, bool useTransparent = false)
|
|
||||||
{
|
|
||||||
if (breathingLight != null)
|
|
||||||
{
|
|
||||||
breathingLight.color = color;
|
|
||||||
breathingLight.intensity = intensity;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (breathingLightSprite != null)
|
|
||||||
{
|
|
||||||
breathingLightSprite.color = useTransparent
|
|
||||||
? new Color(color.r, color.g, color.b, 0f)
|
|
||||||
: color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置面板灯
|
|
||||||
/// </summary>
|
|
||||||
private void SetPanelLight(Color color, float intensity)
|
|
||||||
{
|
|
||||||
if (panelLight != null)
|
|
||||||
{
|
|
||||||
panelLight.color = color;
|
|
||||||
panelLight.intensity = intensity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置环境灯强度
|
|
||||||
/// </summary>
|
|
||||||
private void SetEnvironmentLightIntensity(float intensity)
|
|
||||||
{
|
|
||||||
if (environmentLight != null)
|
|
||||||
{
|
|
||||||
environmentLight.intensity = intensity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置ECG波形激活状态
|
|
||||||
/// </summary>
|
|
||||||
private void SetECGWaveActive(bool active)
|
|
||||||
{
|
|
||||||
if (ecgWave != null)
|
|
||||||
{
|
|
||||||
ecgWave.gameObject.SetActive(active);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 初始化小灯
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeSmallLights(Color color, float intensity)
|
|
||||||
{
|
|
||||||
SetSmallLightsColorAndIntensity(color, intensity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置小灯颜色和强度
|
|
||||||
/// </summary>
|
|
||||||
private void SetSmallLightsColorAndIntensity(Color color, float intensity)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < smallLights.Count; i++)
|
|
||||||
{
|
|
||||||
if (smallLights[i] != null)
|
|
||||||
{
|
|
||||||
smallLights[i].color = color;
|
|
||||||
smallLights[i].intensity = intensity;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i < smallLightSprites.Count && smallLightSprites[i] != null)
|
|
||||||
{
|
|
||||||
smallLightSprites[i].color = color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关闭所有小灯
|
|
||||||
/// </summary>
|
|
||||||
private void TurnOffAllSmallLights()
|
|
||||||
{
|
|
||||||
SetSmallLightsColorAndIntensity(Color.clear, 0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关闭所有灯光
|
|
||||||
/// </summary>
|
|
||||||
private void TurnOffAllLights()
|
|
||||||
{
|
|
||||||
SetBreathingLight(normalColor, 0f, true);
|
|
||||||
SetPanelLight(panelLightColor, 0f);
|
|
||||||
SetECGWaveActive(false);
|
|
||||||
TurnOffAllSmallLights();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 根据状态获取环境灯颜色
|
|
||||||
/// </summary>
|
|
||||||
private Color GetEnvironmentColorByState(LightState state)
|
|
||||||
{
|
|
||||||
return state switch
|
|
||||||
{
|
|
||||||
LightState.Normal => normalEnvironmentColor,
|
|
||||||
LightState.Warning => warningEnvironmentColor,
|
|
||||||
LightState.Emergency => emergencyEnvironmentColor,
|
|
||||||
_ => normalEnvironmentColor
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 私有方法 - 小灯相关
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 处理小灯状态变化
|
|
||||||
/// </summary>
|
|
||||||
private IEnumerator HandleSmallLightStateChange()
|
|
||||||
{
|
|
||||||
if (smallLightState == SmallLightState.Operation)
|
|
||||||
{
|
|
||||||
yield return StartCoroutine(OperationBlinkSequence());
|
|
||||||
SetSmallLightsToOperationState();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ResetSmallLightsToDefault();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 运行状态闪烁序列
|
|
||||||
/// </summary>
|
|
||||||
private IEnumerator OperationBlinkSequence()
|
|
||||||
{
|
|
||||||
float endTime = Time.time + operationBlinkDuration;
|
|
||||||
while (Time.time < endTime)
|
|
||||||
{
|
|
||||||
foreach (var light in smallLights)
|
|
||||||
{
|
|
||||||
if (light != null)
|
|
||||||
{
|
|
||||||
light.intensity = Random.value > 0.5f ? BREATHING_LIGHT_MAX_INTENSITY : 0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
yield return new WaitForSeconds(operationBlinkInterval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置小灯为运行状态
|
|
||||||
/// </summary>
|
|
||||||
private void SetSmallLightsToOperationState()
|
|
||||||
{
|
|
||||||
Color targetColor = GetSmallLightColorByState(currentState);
|
|
||||||
SetSmallLightsColorAndIntensity(targetColor, BREATHING_LIGHT_MAX_INTENSITY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 根据当前状态获取小灯颜色
|
|
||||||
/// </summary>
|
|
||||||
private Color GetSmallLightColorByState(LightState state)
|
|
||||||
{
|
|
||||||
return state switch
|
|
||||||
{
|
|
||||||
LightState.Normal => smallLightNormalColor,
|
|
||||||
LightState.Warning => warningColor,
|
|
||||||
LightState.Emergency => emergencyColor,
|
|
||||||
_ => smallLightNormalColor
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 重置小灯为默认状态
|
|
||||||
/// </summary>
|
|
||||||
private void ResetSmallLightsToDefault()
|
|
||||||
{
|
|
||||||
SetSmallLightsColorAndIntensity(smallLightDefaultColor, 0f);
|
|
||||||
|
|
||||||
// 只有第一个灯闪烁
|
|
||||||
if (smallLights.Count > 0 && smallLights[0] != null)
|
|
||||||
{
|
|
||||||
smallLights[0].intensity = BREATHING_LIGHT_MAX_INTENSITY;
|
|
||||||
if (smallLightSprites.Count > 0 && smallLightSprites[0] != null)
|
|
||||||
{
|
|
||||||
smallLightSprites[0].color = smallLightDefaultColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新小灯状态状态
|
|
||||||
/// </summary>
|
|
||||||
private void UpdateSmallLightsStatus()
|
|
||||||
{
|
|
||||||
Color targetColor = smallLightStatus == SmallLightStatus.Normal
|
|
||||||
? smallLightNormalColor
|
|
||||||
: smallLightErrorColor;
|
|
||||||
|
|
||||||
SetSmallLightsColorAndIntensity(targetColor, BREATHING_LIGHT_MAX_INTENSITY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 小灯闪烁协程
|
|
||||||
/// </summary>
|
|
||||||
private IEnumerator SmallLightsBlinkRoutine()
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
if (!isSystemOn)
|
|
||||||
{
|
|
||||||
TurnOffAllSmallLights();
|
|
||||||
}
|
|
||||||
else if (smallLightState == SmallLightState.Default)
|
|
||||||
{
|
|
||||||
ResetSmallLightsToDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
yield return new WaitForSeconds(smallLightBlinkInterval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 私有方法 - 环境灯相关
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 环境灯闪烁协程
|
|
||||||
/// </summary>
|
|
||||||
private IEnumerator EnvironmentLightFlickerRoutine()
|
|
||||||
{
|
|
||||||
while (isEnvironmentLightFlickering)
|
|
||||||
{
|
|
||||||
if (environmentLight == null)
|
|
||||||
{
|
|
||||||
yield return new WaitForSeconds(0.1f);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
float currentIntensity = GetEnvironmentIntensityByState(currentState);
|
|
||||||
environmentLight.intensity = currentIntensity;
|
|
||||||
|
|
||||||
// 等待随机间隔
|
|
||||||
yield return new WaitForSeconds(Random.Range(MIN_FLICKER_INTERVAL, MAX_FLICKER_INTERVAL));
|
|
||||||
|
|
||||||
// 随机闪烁
|
|
||||||
int blinkCount = Random.Range(MIN_FLICKER_BLINK_COUNT, MAX_FLICKER_BLINK_COUNT);
|
|
||||||
for (int i = 0; i < blinkCount; i++)
|
|
||||||
{
|
|
||||||
environmentLight.intensity = 0f;
|
|
||||||
yield return new WaitForSeconds(brokenLightFlickerDuration);
|
|
||||||
|
|
||||||
environmentLight.intensity = currentIntensity;
|
|
||||||
yield return new WaitForSeconds(brokenLightFlickerInterval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 确保灯光在停止闪烁时是亮着的
|
|
||||||
if (environmentLight != null)
|
|
||||||
{
|
|
||||||
environmentLight.intensity = GetEnvironmentIntensityByState(currentState);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 根据状态获取环境灯强度
|
|
||||||
/// </summary>
|
|
||||||
private float GetEnvironmentIntensityByState(LightState state)
|
|
||||||
{
|
|
||||||
return state switch
|
|
||||||
{
|
|
||||||
LightState.Normal => normalEnvironmentIntensity,
|
|
||||||
LightState.Warning => warningEnvironmentIntensity,
|
|
||||||
LightState.Emergency => emergencyEnvironmentIntensity,
|
|
||||||
_ => normalEnvironmentIntensity
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region 私有方法 - 系统启动序列
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 系统启动序列
|
|
||||||
/// </summary>
|
|
||||||
private IEnumerator SystemStartSequence()
|
|
||||||
{
|
|
||||||
// 1. ECG波形闪烁
|
|
||||||
yield return StartCoroutine(ECGWaveToggleSequence());
|
|
||||||
|
|
||||||
// 2. 小灯自检
|
|
||||||
yield return StartCoroutine(SmallLightsSelfCheck());
|
|
||||||
|
|
||||||
// 3. 启动呼吸灯
|
|
||||||
SetBreathingLight(normalColor, BREATHING_LIGHT_MAX_INTENSITY);
|
|
||||||
yield return new WaitForSeconds(BREATHING_LIGHT_START_DELAY);
|
|
||||||
|
|
||||||
// 4. 启动面板灯
|
|
||||||
yield return StartCoroutine(PanelLightStartSequence());
|
|
||||||
|
|
||||||
// 5. 设置系统状态为开启
|
|
||||||
SetSystemPower(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ECG波形闪烁序列
|
|
||||||
/// </summary>
|
|
||||||
private IEnumerator ECGWaveToggleSequence()
|
|
||||||
{
|
|
||||||
if (ecgWave == null) yield break;
|
|
||||||
|
|
||||||
ecgWave.gameObject.SetActive(true);
|
|
||||||
yield return new WaitForSeconds(ECG_WAVE_TOGGLE_DELAY);
|
|
||||||
ecgWave.gameObject.SetActive(false);
|
|
||||||
yield return new WaitForSeconds(ECG_WAVE_TOGGLE_DELAY);
|
|
||||||
ecgWave.gameObject.SetActive(true);
|
|
||||||
yield return new WaitForSeconds(ECG_WAVE_FINAL_DELAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 面板灯启动序列
|
|
||||||
/// </summary>
|
|
||||||
private IEnumerator PanelLightStartSequence()
|
|
||||||
{
|
|
||||||
if (panelLight == null) yield break;
|
|
||||||
|
|
||||||
for (int i = 0; i < panelLightBlinkCount; i++)
|
|
||||||
{
|
|
||||||
// 渐亮
|
|
||||||
DOTween.To(() => panelLight.intensity, x => panelLight.intensity = x, panelLightIntensity, panelLightBlinkDuration * 0.5f)
|
|
||||||
.SetEase(Ease.InOutQuad);
|
|
||||||
DOTween.To(() => environmentLight.intensity, x => environmentLight.intensity = x, normalEnvironmentIntensity, panelLightBlinkDuration * 0.5f)
|
|
||||||
.SetEase(Ease.InOutQuad);
|
|
||||||
yield return new WaitForSeconds(panelLightBlinkDuration);
|
|
||||||
|
|
||||||
// 渐暗
|
|
||||||
DOTween.To(() => panelLight.intensity, x => panelLight.intensity = x, 0f, panelLightBlinkDuration * 0.5f)
|
|
||||||
.SetEase(Ease.InOutQuad);
|
|
||||||
DOTween.To(() => environmentLight.intensity, x => environmentLight.intensity = x, 0f, panelLightBlinkDuration * 0.5f)
|
|
||||||
.SetEase(Ease.InOutQuad);
|
|
||||||
yield return new WaitForSeconds(panelLightBlinkDuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 最后渐亮到常亮状态
|
|
||||||
DOTween.To(() => panelLight.intensity, x => panelLight.intensity = x, panelLightIntensity, panelLightBlinkDuration * 0.5f)
|
|
||||||
.SetEase(Ease.InOutQuad);
|
|
||||||
DOTween.To(() => environmentLight.intensity, x => environmentLight.intensity = x, normalEnvironmentIntensity, panelLightBlinkDuration * 0.5f)
|
|
||||||
.SetEase(Ease.InOutQuad);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 小灯自检序列
|
|
||||||
/// </summary>
|
|
||||||
private IEnumerator SmallLightsSelfCheck()
|
|
||||||
{
|
|
||||||
// 关闭所有小灯
|
|
||||||
SetSmallLightsColorAndIntensity(Color.clear, 0f);
|
|
||||||
|
|
||||||
// 自检两次
|
|
||||||
for (int check = 0; check < SELF_CHECK_COUNT; check++)
|
|
||||||
{
|
|
||||||
// 从左到右点亮
|
|
||||||
for (int i = 0; i < smallLights.Count; i++)
|
|
||||||
{
|
|
||||||
if (smallLights[i] != null)
|
|
||||||
{
|
|
||||||
smallLights[i].color = smallLightDefaultColor;
|
|
||||||
smallLights[i].intensity = BREATHING_LIGHT_MAX_INTENSITY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i < smallLightSprites.Count && smallLightSprites[i] != null)
|
|
||||||
{
|
|
||||||
smallLightSprites[i].color = smallLightDefaultColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
yield return new WaitForSeconds(SELF_CHECK_DELAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 关闭所有灯
|
|
||||||
SetSmallLightsColorAndIntensity(Color.clear, 0f);
|
|
||||||
yield return new WaitForSeconds(SELF_CHECK_INTERVAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 恢复到默认状态(只有第一个灯闪烁)
|
|
||||||
ResetSmallLightsToDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 38591e07419b3674191c088bacecfed7
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Linq;
|
|
||||||
using AibisDream.Framework;
|
|
||||||
using AibisDream.Utility;
|
|
||||||
using Febucci.UI;
|
|
||||||
using Febucci.UI.Core;
|
|
||||||
using TMPro;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace AibisDream.FixSystem
|
|
||||||
{
|
|
||||||
public class ScreenSystem : MonoBehaviour, ILineView
|
|
||||||
{
|
|
||||||
#region 索引
|
|
||||||
|
|
||||||
[SerializeField] private TMP_Text title;
|
|
||||||
[SerializeField] private RectTransform textRoot;
|
|
||||||
[SerializeField] private TMP_Text textForEstimation;
|
|
||||||
[SerializeField] private int maxLineNum = 10;
|
|
||||||
|
|
||||||
private GameObject _textItemPrefab;
|
|
||||||
private Queue<TypewriterByCharacter> _lineQueue;
|
|
||||||
|
|
||||||
public BubbleSlotGroup BubbleSlotGroup { get; private set; }
|
|
||||||
|
|
||||||
public TaskScreen TaskScreen { get; private set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private void Awake()
|
|
||||||
{
|
|
||||||
InitComponentRefs();
|
|
||||||
Register();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitComponentRefs()
|
|
||||||
{
|
|
||||||
TaskScreen = GetComponentInChildren<TaskScreen>();
|
|
||||||
_lineQueue = new Queue<TypewriterByCharacter>();
|
|
||||||
_textItemPrefab = ResourceKit.LoadAssetSync<GameObject>(ConstRef.ScreenTextName);
|
|
||||||
BubbleSlotGroup = GetComponentInChildren<BubbleSlotGroup>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Register()
|
|
||||||
{
|
|
||||||
FixSystemCenter.SystemDic.Register(this);
|
|
||||||
DialogUIManager.Instance.RegisterScreenView(DialogViewType.Screen, this);
|
|
||||||
DialogUIManager.Instance.RegisterScreenView(DialogViewType.Task, TaskScreen);
|
|
||||||
// StorageSystem.Instance.RegisterData(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDestroy()
|
|
||||||
{
|
|
||||||
FixSystemCenter.SystemDic.Unregister<ScreenSystem>();
|
|
||||||
DialogUIManager.Instance.UnRegisterScreenView(DialogViewType.Screen);
|
|
||||||
DialogUIManager.Instance.UnRegisterScreenView(DialogViewType.Task);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region 基础功能
|
|
||||||
|
|
||||||
private void ShowTitle(string targetTitle)
|
|
||||||
{
|
|
||||||
title.text = targetTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ClearTextScreen()
|
|
||||||
{
|
|
||||||
while (_lineQueue.Count > 0)
|
|
||||||
{
|
|
||||||
var text = _lineQueue.Dequeue();
|
|
||||||
Destroy(text.gameObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
ShowTitle(string.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public void RunLine(LineSyncToken token)
|
|
||||||
{
|
|
||||||
// 空格延长一点避免报错
|
|
||||||
if (string.IsNullOrWhiteSpace(token.lineInfo.lineText))
|
|
||||||
{
|
|
||||||
token.lineInfo.lineText = " ";
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显示标题
|
|
||||||
ShowTitle(token.lineInfo.character.GetActorName());
|
|
||||||
// 显示文本
|
|
||||||
TypewriterCore textItemTypewriter = AddText(token);
|
|
||||||
|
|
||||||
token.TextStart();
|
|
||||||
// 强制更新布局
|
|
||||||
LayoutRebuilder.ForceRebuildLayoutImmediate(textRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
private float GetTextSpeedValue()
|
|
||||||
{
|
|
||||||
var textSpeedStr = SettingLoader.Instance.TryRead("TextSpeed", out string textSpeed) ? textSpeed : "1";
|
|
||||||
return float.TryParse(textSpeedStr, NumberStyles.Float, CultureInfo.InvariantCulture, out float result) ? result : 1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnTextShown(LineSyncToken syncToken, TypewriterCore typewriter)
|
|
||||||
{
|
|
||||||
typewriter.onTextShowed.RemoveAllListeners();
|
|
||||||
syncToken.TextShown();
|
|
||||||
}
|
|
||||||
|
|
||||||
private TypewriterByCharacter AddText(LineSyncToken token)
|
|
||||||
{
|
|
||||||
// 生成新文本组件
|
|
||||||
var textItem = Instantiate(_textItemPrefab, textRoot);
|
|
||||||
var textItemTypewriter = textItem.GetComponent<TypewriterByCharacter>();
|
|
||||||
// 估算文本高度
|
|
||||||
var newLineNum = EstimateLineNum(token.lineInfo.lineText);
|
|
||||||
var oldLineNum = CalcTotalLineNum();
|
|
||||||
if (newLineNum + oldLineNum > maxLineNum)
|
|
||||||
{
|
|
||||||
Destroy(_lineQueue.Dequeue().gameObject);
|
|
||||||
}
|
|
||||||
_lineQueue.Enqueue(textItemTypewriter);
|
|
||||||
|
|
||||||
// 播放文本
|
|
||||||
textItemTypewriter.SetTypewriterSpeed(GetTextSpeedValue());
|
|
||||||
textItemTypewriter.onTextShowed.AddListener(() => OnTextShown(token, textItemTypewriter));
|
|
||||||
textItemTypewriter.ShowText(token.lineInfo.lineText);
|
|
||||||
|
|
||||||
return textItemTypewriter;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int EstimateLineNum(string text)
|
|
||||||
{
|
|
||||||
textForEstimation.text = text;
|
|
||||||
textForEstimation.ForceMeshUpdate();
|
|
||||||
return textForEstimation.textInfo.lineCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int CalcTotalLineNum()
|
|
||||||
{
|
|
||||||
return _lineQueue.Select(x => x.GetComponent<TMP_Text>().textInfo.lineCount).Sum();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 238cb3d3aad51b84e93ef35bdd1c5536
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using AibisDream.Framework;
|
|
||||||
using AibisDream.Utility;
|
|
||||||
using TMPro;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace AibisDream
|
|
||||||
{
|
|
||||||
public class TaskScreen : MonoBehaviour, ILineView
|
|
||||||
{
|
|
||||||
#region 索引
|
|
||||||
|
|
||||||
private Transform _taskListParent;
|
|
||||||
private GameObject _taskItemPrefab;
|
|
||||||
private readonly Dictionary<string, GameObject> _taskDict = new();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private void Awake()
|
|
||||||
{
|
|
||||||
_taskListParent = transform.Find("Record");
|
|
||||||
_taskItemPrefab = ResourceKit.LoadAssetSync<GameObject>(ConstRef.TaskItemName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CompleteTask(string lineId)
|
|
||||||
{
|
|
||||||
if (_taskDict.Remove(lineId, out var taskItem))
|
|
||||||
{
|
|
||||||
Destroy(taskItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ClearTasks()
|
|
||||||
{
|
|
||||||
foreach (var task in _taskDict)
|
|
||||||
{
|
|
||||||
Destroy(task.Value);
|
|
||||||
}
|
|
||||||
_taskDict.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RunLine(LineSyncToken token)
|
|
||||||
{
|
|
||||||
if (_taskDict.ContainsKey(token.lineInfo.lineId))
|
|
||||||
{
|
|
||||||
EnumEventSystem.Global.Send(DialogEventEnum.LineShown);
|
|
||||||
token.ForceAdvance();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var taskItem = Instantiate(_taskItemPrefab, _taskListParent);
|
|
||||||
var task = taskItem.GetComponent<TMP_Text>();
|
|
||||||
task.text = $"\u25cf {token.lineInfo.lineText}";
|
|
||||||
token.TextStart();
|
|
||||||
|
|
||||||
_taskDict[token.lineInfo.lineId] = taskItem;
|
|
||||||
token.TextShown();
|
|
||||||
token.ForceAdvance();
|
|
||||||
LayoutRebuilder.ForceRebuildLayoutImmediate(_taskListParent.GetComponent<RectTransform>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 0f72dbb55b1a5ae4cb3de148301904ec
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Reference in New Issue
Block a user