Compare commits
4 Commits
main
...
e69d524bb6
Author | SHA1 | Date | |
---|---|---|---|
e69d524bb6 | |||
56956f351f | |||
9713ad9129 | |||
f4ce4fcf1f |
@ -27,7 +27,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 5021031438404678310}
|
m_GameObject: {fileID: 5021031438404678310}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -6.6943, y: -0.3652, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
306
Client/Assets/Resources/Prefab/Button3D.prefab
Normal file
306
Client/Assets/Resources/Prefab/Button3D.prefab
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &2412502657045938467
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 709533242955877997}
|
||||||
|
- component: {fileID: 5821092905185152964}
|
||||||
|
- component: {fileID: 3254240173477692892}
|
||||||
|
- component: {fileID: 2649725512596744611}
|
||||||
|
- component: {fileID: 8989378577537570065}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Button3D
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &709533242955877997
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2412502657045938467}
|
||||||
|
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:
|
||||||
|
- {fileID: 7795760929196660143}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!33 &5821092905185152964
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2412502657045938467}
|
||||||
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!23 &3254240173477692892
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2412502657045938467}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_StaticShadowCaster: 0
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||||
|
m_RayTracingAccelStructBuildFlags: 1
|
||||||
|
m_SmallMeshCulling: 1
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!65 &2649725512596744611
|
||||||
|
BoxCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2412502657045938467}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_LayerOverridePriority: 0
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_ProvidesContacts: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 3
|
||||||
|
m_Size: {x: 1, y: 1, z: 1}
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &8989378577537570065
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2412502657045938467}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 0d5e1709fa6d5c54f93ac068f067e20b, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
OnClick:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
renderer: {fileID: 3254240173477692892}
|
||||||
|
outlineMaterial: {fileID: 2100000, guid: 7b32baf03e8f4bd448cf625f4299f5ce, type: 2}
|
||||||
|
text: {fileID: 3761108353443528858}
|
||||||
|
--- !u!1 &3805996714208757134
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 7795760929196660143}
|
||||||
|
- component: {fileID: 5919324744879230529}
|
||||||
|
- component: {fileID: 3761108353443528858}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Text (TMP)
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &7795760929196660143
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3805996714208757134}
|
||||||
|
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: 709533242955877997}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 2}
|
||||||
|
m_SizeDelta: {x: 5, y: 2}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!23 &5919324744879230529
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3805996714208757134}
|
||||||
|
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_RayTracingAccelStructBuildFlagsOverride: 0
|
||||||
|
m_RayTracingAccelStructBuildFlags: 1
|
||||||
|
m_SmallMeshCulling: 1
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: -1361428157011412921, guid: 317edb274e9c5144a9916937bdbf7716, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!114 &3761108353443528858
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3805996714208757134}
|
||||||
|
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: Sample text
|
||||||
|
m_isRightToLeft: 0
|
||||||
|
m_fontAsset: {fileID: 11400000, guid: 317edb274e9c5144a9916937bdbf7716, type: 2}
|
||||||
|
m_sharedMaterial: {fileID: -1361428157011412921, guid: 317edb274e9c5144a9916937bdbf7716, 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: 5
|
||||||
|
m_fontSizeBase: 5
|
||||||
|
m_fontWeight: 400
|
||||||
|
m_enableAutoSizing: 0
|
||||||
|
m_fontSizeMin: 18
|
||||||
|
m_fontSizeMax: 72
|
||||||
|
m_fontStyle: 0
|
||||||
|
m_HorizontalAlignment: 2
|
||||||
|
m_VerticalAlignment: 1024
|
||||||
|
m_textAlignment: 65535
|
||||||
|
m_characterSpacing: 0
|
||||||
|
m_wordSpacing: 0
|
||||||
|
m_lineSpacing: 0
|
||||||
|
m_lineSpacingMax: 0
|
||||||
|
m_paragraphSpacing: 0
|
||||||
|
m_charWidthMaxAdj: 0
|
||||||
|
m_TextWrappingMode: 1
|
||||||
|
m_wordWrappingRatios: 0.4
|
||||||
|
m_overflowMode: 0
|
||||||
|
m_linkedTextComponent: {fileID: 0}
|
||||||
|
parentLinkedComponent: {fileID: 0}
|
||||||
|
m_enableKerning: 0
|
||||||
|
m_ActiveFontFeatures: 6e72656b
|
||||||
|
m_enableExtraPadding: 0
|
||||||
|
checkPaddingRequired: 0
|
||||||
|
m_isRichText: 1
|
||||||
|
m_EmojiFallbackSupport: 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: 5919324744879230529}
|
||||||
|
m_maskType: 0
|
7
Client/Assets/Resources/Prefab/Button3D.prefab.meta
Normal file
7
Client/Assets/Resources/Prefab/Button3D.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 04bb56c29e3de4248a236f83c889ca7d
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -37,7 +37,7 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: -160.92151, y: -93.26492}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 160, y: 30}
|
m_SizeDelta: {x: 160, y: 30}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &6659858081700418582
|
--- !u!222 &6659858081700418582
|
||||||
|
@ -124,6 +124,7 @@ Transform:
|
|||||||
- {fileID: 5549544358816209289}
|
- {fileID: 5549544358816209289}
|
||||||
- {fileID: 1697214530303839877}
|
- {fileID: 1697214530303839877}
|
||||||
- {fileID: 1404278780950315184}
|
- {fileID: 1404278780950315184}
|
||||||
|
- {fileID: 4504455988891581487}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &3332598847335032684
|
--- !u!114 &3332598847335032684
|
||||||
@ -364,3 +365,65 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 605f185650fe46d89a6e0d60fb8fb11c, type: 3}
|
m_Script: {fileID: 11500000, guid: 605f185650fe46d89a6e0d60fb8fb11c, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!1001 &5211884413447499418
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 697189026367054479}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 5021031438404678310, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: WeaponTexture
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3}
|
||||||
|
--- !u!4 &4504455988891581487 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 5211884413447499418}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
@ -27,7 +27,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 5309816858037840717}
|
m_GameObject: {fileID: 5309816858037840717}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -5.781, y: -0.39, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
@ -37,7 +37,7 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
m_AnchoredPosition: {x: 342, y: -198}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.1, y: 0.9}
|
m_Pivot: {x: 0.1, y: 0.9}
|
||||||
--- !u!222 &6098472552964198111
|
--- !u!222 &6098472552964198111
|
||||||
|
@ -35,7 +35,7 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: -1.0921326, y: -54.256577}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 200, y: 14.01}
|
m_SizeDelta: {x: 200, y: 14.01}
|
||||||
m_Pivot: {x: 0.5, y: 1}
|
m_Pivot: {x: 0.5, y: 1}
|
||||||
--- !u!222 &6803973761688315705
|
--- !u!222 &6803973761688315705
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,43 +1,70 @@
|
|||||||
// C#
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic; // 新增,用于List
|
using System.Collections.Generic; // 提供List等通用集合类型
|
||||||
using Logging;
|
using Logging; // 提供日志记录功能
|
||||||
using Managers; // 确保日志命名空间正确
|
using Managers; // 提供管理器接口和实现
|
||||||
using TMPro;
|
using TMPro; // TextMeshPro文本组件命名空间
|
||||||
using UnityEngine;
|
using UnityEngine; // Unity引擎核心命名空间
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement; // 场景管理命名空间
|
||||||
|
|
||||||
namespace Base
|
namespace Base
|
||||||
{
|
{
|
||||||
// 请确保你在Unity Editor中将 'projectile' 的Inspector引用从 Gradient 更改为 CustomProgressBar
|
/// <summary>
|
||||||
// 或者替换为你实际的进度条组件类型。
|
/// <c>Launcher</c> 类负责管理游戏的初始化加载流程,包括管理器加载、进度条显示和场景切换。
|
||||||
// 如果你没有 CustomProgressBar,而想用 Image 或者别的,这些 Progress/Opacity 属性需要大幅修改。
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>请注意:虽然此处的 <c>progressBar</c> 变量类型被声明为 <c>Gradient</c>,
|
||||||
|
/// 但其在代码中的使用方式(如访问 <c>color1</c>, <c>color2</c> 属性和调用 <c>Refresh()</c> 方法)
|
||||||
|
/// 强烈暗示它应引用一个具有类似 API 的自定义进度条组件,例如 <c>CustomProgressBar</c>。</para>
|
||||||
|
/// <para>如果您使用的是标准 <c>UnityEngine.UI.Image</c> 或其他组件来显示进度,
|
||||||
|
/// 则 <c>Progress</c> 和 <c>Opacity</c> 属性的实现逻辑需要根据实际组件的 API 进行大幅修改。</para>
|
||||||
|
/// </remarks>
|
||||||
public class Launcher : MonoBehaviour
|
public class Launcher : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 加载界面UI的根游戏对象。
|
||||||
|
/// </summary>
|
||||||
public GameObject loadingUI;
|
public GameObject loadingUI;
|
||||||
// 假设 CustomProgressBar 是一个自定义组件,其 API 与原代码使用方式一致
|
|
||||||
// 如果这里是 UnityEngine.UI.Image,需要完全改变 Progress 和 Opacity 的实现
|
|
||||||
public Gradient progressBar; // 自定义进度条组件
|
|
||||||
public TMP_Text describeText; // 描述文本
|
|
||||||
|
|
||||||
public float duration = 0.5f; // 每个步骤的过渡时间
|
/// <summary>
|
||||||
public float fadeDuration = 2f; // 不透明度渐隐的时间
|
/// 用于显示加载进度的自定义进度条组件。
|
||||||
|
/// <para>请参阅类注释以了解其声明类型与预期API的差异。</para>
|
||||||
|
/// </summary>
|
||||||
|
public Gradient progressBar;
|
||||||
|
|
||||||
private float _currentProgressValue = 0f; // 实际的当前进度值(0-1)
|
/// <summary>
|
||||||
private Color _initialTextColor; // 原始文本颜色,用于渐隐
|
/// 用于显示当前加载步骤描述的文本组件。
|
||||||
private Color _initialProgressBarColor1; // 原始进度条颜色1
|
/// </summary>
|
||||||
private Color _initialProgressBarColor2; // 原始进度条颜色2
|
public TMP_Text describeText;
|
||||||
|
|
||||||
// 存储所有需要加载和清理的管理器
|
/// <summary>
|
||||||
|
/// 进度条每个加载步骤的平滑过渡时间(秒)。
|
||||||
|
/// </summary>
|
||||||
|
public float duration = 0.5f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载完成后UI元素渐隐的时间(秒)。
|
||||||
|
/// </summary>
|
||||||
|
public float fadeDuration = 2f;
|
||||||
|
|
||||||
|
private float _currentProgressValue = 0f; // 实际的当前进度值(在0到1之间)
|
||||||
|
private Color _initialTextColor; // 描述文本的原始颜色,用于渐隐效果
|
||||||
|
private Color _initialProgressBarColor1; // 进度条颜色1的原始值,用于渐变
|
||||||
|
private Color _initialProgressBarColor2; // 进度条颜色2的原始值,用于渐变
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 存储所有需要在启动时加载和在重载时清理的管理器实例列表。
|
||||||
|
/// </summary>
|
||||||
private List<ILaunchManager> _managersToLoad;
|
private List<ILaunchManager> _managersToLoad;
|
||||||
|
|
||||||
// Progress 属性,更新进度条和颜色
|
/// <summary>
|
||||||
|
/// 获取或设置加载进度值,范围为0到1。
|
||||||
|
/// 设置此属性将更新进度条的视觉显示和颜色。
|
||||||
|
/// </summary>
|
||||||
public float Progress
|
public float Progress
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// 确保进度值在0到1之间,提高健壮性
|
// 确保进度值在0到1之间,提高系统健壮性
|
||||||
_currentProgressValue = Mathf.Clamp01(value);
|
_currentProgressValue = Mathf.Clamp01(value);
|
||||||
|
|
||||||
if (progressBar)
|
if (progressBar)
|
||||||
@ -50,17 +77,23 @@ namespace Base
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 后半段:color2 保持白色,color1 从初始色渐变到白色
|
|
||||||
progressBar.color2 = Color.white;
|
progressBar.color2 = Color.white;
|
||||||
|
// 后半段:color2 保持白色,color1 从初始色渐变到白色
|
||||||
progressBar.color1 = Color.Lerp(_initialProgressBarColor1, Color.white, (_currentProgressValue - 0.5f) * 2);
|
progressBar.color1 = Color.Lerp(_initialProgressBarColor1, Color.white, (_currentProgressValue - 0.5f) * 2);
|
||||||
}
|
}
|
||||||
progressBar.Refresh(); // 通知自定义进度条组件更新显示
|
// 通知自定义进度条组件更新显示。
|
||||||
|
// 注意:UnityEngine.Gradient 作为数据结构没有 Refresh() 方法,
|
||||||
|
// 此调用表明 progressBar 实际上预期是一个具有此方法的自定义组件。
|
||||||
|
progressBar.Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get => _currentProgressValue;
|
get => _currentProgressValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opacity 属性,更新 UI 元素的透明度
|
/// <summary>
|
||||||
|
/// 获取或设置UI元素的整体不透明度,范围0(完全透明)到1(完全不透明)。
|
||||||
|
/// 设置此属性将更新进度条和描述文本的透明度。
|
||||||
|
/// </summary>
|
||||||
public float Opacity
|
public float Opacity
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
@ -78,38 +111,43 @@ namespace Base
|
|||||||
c2.a = alpha;
|
c2.a = alpha;
|
||||||
progressBar.color2 = c2;
|
progressBar.color2 = c2;
|
||||||
|
|
||||||
|
// 通知自定义进度条组件更新显示。
|
||||||
|
// 注意:UnityEngine.Gradient 作为数据结构没有 Refresh() 方法,
|
||||||
|
// 此调用表明 progressBar 实际上预期是一个具有此方法的自定义组件。
|
||||||
progressBar.Refresh();
|
progressBar.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (describeText)
|
if (describeText)
|
||||||
{
|
{
|
||||||
// 更新描述文本颜色的透明度
|
// 更新描述文本颜色的透明度
|
||||||
// 渐隐时,描述文本的透明度在 Opacity > 0.5f 时才开始渐变可见
|
// 渐隐时,描述文本的透明度在 Opacity > 0.5f 时才开始从0渐变到其原始透明度
|
||||||
var textAlpha = alpha > 0.5f ? Mathf.Lerp(0f, _initialTextColor.a, (alpha - 0.5f) * 2) : 0f;
|
var textAlpha = alpha > 0.5f ? Mathf.Lerp(0f, _initialTextColor.a, (alpha - 0.5f) * 2) : 0f;
|
||||||
describeText.color = new Color(_initialTextColor.r, _initialTextColor.g, _initialTextColor.b, textAlpha);
|
describeText.color = new Color(_initialTextColor.r, _initialTextColor.g, _initialTextColor.b, textAlpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当脚本实例被启用时调用一次。
|
||||||
|
/// 用于初始化管理器列表并缓存UI元素的初始颜色。
|
||||||
|
/// </summary>
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
// 在 Awake 中初始化管理器列表并注册,确保在 Start 之前完成
|
// 在 Awake 中初始化管理器列表,确保在 Start 之前完成所有管理器实例的注册
|
||||||
_managersToLoad = new List<ILaunchManager>
|
_managersToLoad = new List<ILaunchManager>
|
||||||
{
|
{
|
||||||
new Logging.LoggerManagerWrapper(), // UnityLogger的包装器
|
new LoggerManagerWrapper(), // Unity日志的包装器
|
||||||
Managers.DefineManager.Instance,
|
DefineManager.Instance,
|
||||||
Managers.PackagesImageManager.Instance,
|
PackagesImageManager.Instance,
|
||||||
Managers.TileManager.Instance,
|
TileManager.Instance,
|
||||||
Managers.AffiliationManager.Instance,
|
AffiliationManager.Instance,
|
||||||
Managers.ItemResourceManager.Instance
|
ItemResourceManager.Instance,
|
||||||
// 当未来有新的管理器时,只需在这里添加 Managers.NewManager.Instance
|
EventManager.Instance,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 缓存UI的初始颜色,以便后续操作或重置
|
// 缓存UI的初始颜色,以便后续操作(如渐隐)或重置
|
||||||
if (describeText != null)
|
_initialTextColor = describeText != null ? describeText.color : Color.white; // 如果为空,则使用默认值
|
||||||
{
|
|
||||||
_initialTextColor = describeText.color;
|
|
||||||
}
|
|
||||||
if (progressBar != null)
|
if (progressBar != null)
|
||||||
{
|
{
|
||||||
_initialProgressBarColor1 = progressBar.color1;
|
_initialProgressBarColor1 = progressBar.color1;
|
||||||
@ -117,61 +155,66 @@ namespace Base
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogWarning("CustomProgressBar component not assigned to Launcher. Progress bar display may not work.");
|
// 警告日志:自定义进度条组件未赋值给启动器。
|
||||||
|
Debug.LogWarning("自定义进度条组件未赋值给启动器,进度条可能无法正常显示。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 在Awake方法之后、首次帧更新之前调用。
|
||||||
|
/// 用于判断是否需要执行完整的加载流程,并根据需要启动加载或隐藏加载UI。
|
||||||
|
/// </summary>
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
// 如果 Program.Instance.needLoad 为 true,表示需要完整的(重新)加载流程
|
// 如果 Program.Instance.needLoad 为 false,表示游戏已加载或不需要重新加载,直接隐藏加载UI
|
||||||
// 否则,如果不需要加载,直接禁用UI并返回
|
|
||||||
if (!Program.Instance.needLoad)
|
if (!Program.Instance.needLoad)
|
||||||
{
|
{
|
||||||
loadingUI.SetActive(false);
|
loadingUI.SetActive(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据 Program.Instance.needLoad 的含义(需要重载),
|
// 如果需要加载,则先清理所有管理器(用于重载或确保干净启动),再启动加载流程
|
||||||
// 在开始新的加载流程之前,先清理所有可能存在的旧管理器状态。
|
ClearAllManagers();
|
||||||
// 这确保了每次需要加载时,系统都处于一个干净的初始状态。
|
|
||||||
ClearAllManagers(); // <--- 关键修改:在Load()之前调用ClearAllManagers()
|
// 初始化游戏设置
|
||||||
|
Setting.Instance.Init();
|
||||||
|
|
||||||
// 初始化设置
|
|
||||||
Base.Setting.Instance.Init();
|
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
// 在非DEBUG模式下,从设置中获取过渡时间
|
// 在非DEBUG模式下,从游戏设置中获取加载和渐隐的持续时间
|
||||||
duration = Base.Setting.Instance.CurrentSettings.progressStepDuration;
|
duration = Base.Setting.Instance.CurrentSettings.progressStepDuration;
|
||||||
fadeDuration = Base.Setting.Instance.CurrentSettings.exitAnimationDuration;
|
fadeDuration = Base.Setting.Instance.CurrentSettings.exitAnimationDuration;
|
||||||
#endif
|
#endif
|
||||||
Load(); // 启动加载流程(内部会调用LoadAllManagers)
|
Load(); // 启动加载流程(内部会调用LoadAllManagers)
|
||||||
Program.Instance.needLoad = false; // 加载完成后重置标志
|
Program.Instance.needLoad = false; // 加载完成后重置加载标志
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动游戏的加载流程。
|
/// 启动游戏的加载流程。
|
||||||
|
/// 该方法会激活加载UI,重置进度与透明度,并启动所有管理器的异步加载协程。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Load()
|
public void Load()
|
||||||
{
|
{
|
||||||
loadingUI.SetActive(true); // 激活加载UI
|
loadingUI.SetActive(true); // 激活加载UI
|
||||||
Progress = 0f; // 重置进度
|
Progress = 0f; // 将进度重置为0
|
||||||
Opacity = 1f; // 重置透明度为完全不透明
|
Opacity = 1f; // 将UI透明度重置为完全不透明
|
||||||
StartCoroutine(LoadAllManagers());
|
StartCoroutine(LoadAllManagers());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清理所有管理器,然后重新加载。用于游戏重载或场景切换后需要重新初始化所有数据的情况。
|
/// 清理所有管理器,然后重新加载游戏数据。
|
||||||
|
/// 此方法适用于游戏重载、场景切换后需要重新初始化所有数据的情况。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Reload()
|
public void Reload()
|
||||||
{
|
{
|
||||||
Debug.Log("<color=yellow>Performing a full reload of all managers...</color>");
|
// 日志:正在执行所有管理器的完整重新加载...
|
||||||
|
Debug.Log("<color=yellow>正在执行所有管理器的完整重新加载...</color>");
|
||||||
StopAllCoroutines(); // 停止当前所有正在运行的加载协程,避免冲突
|
StopAllCoroutines(); // 停止当前所有正在运行的加载协程,避免冲突
|
||||||
ClearAllManagers(); // 清理所有管理器
|
ClearAllManagers(); // 清理所有管理器数据
|
||||||
Load(); // 重新加载游戏数据
|
Load(); // 重新加载游戏数据
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 遍历所有已注册的管理器并调用它们的 Clear 方法。
|
/// 遍历所有已注册的管理器,并安全地调用它们的 Clear 方法以释放资源或重置状态。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void ClearAllManagers()
|
private void ClearAllManagers()
|
||||||
{
|
{
|
||||||
@ -183,37 +226,39 @@ namespace Base
|
|||||||
}
|
}
|
||||||
catch (System.Exception ex)
|
catch (System.Exception ex)
|
||||||
{
|
{
|
||||||
Debug.LogError($"<color=red>Error clearing manager {manager.StepDescription}:</color> {ex.Message}\n{ex.StackTrace}");
|
// 错误日志:清理管理器时发生异常。
|
||||||
|
Debug.LogError($"<color=red>清理管理器 '{manager.StepDescription}' 时出错:</color> {ex.Message}\n{ex.StackTrace}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 协程:按顺序加载所有管理器。
|
/// 协程:按顺序加载所有注册的管理器。
|
||||||
|
/// 该方法会在加载过程中更新描述文本、平滑过渡进度条,并安全初始化每个管理器。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <returns>一个 <see cref="IEnumerator"/>,用于协程。</returns>
|
||||||
private IEnumerator LoadAllManagers()
|
private IEnumerator LoadAllManagers()
|
||||||
{
|
{
|
||||||
for (var i = 0; i < _managersToLoad.Count; i++)
|
for (var i = 0; i < _managersToLoad.Count; i++)
|
||||||
{
|
{
|
||||||
var manager = _managersToLoad[i];
|
var manager = _managersToLoad[i];
|
||||||
|
|
||||||
// 更新描述文本,从管理器实例中获取
|
// 更新描述文本,显示当前正在加载的管理器步骤描述
|
||||||
if (describeText != null)
|
if (describeText != null)
|
||||||
{
|
{
|
||||||
describeText.text = manager.StepDescription;
|
describeText.text = manager.StepDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算当前阶段的目标进度
|
// 计算当前阶段的目标进度值
|
||||||
var targetProgress = (float)(i + 1) / _managersToLoad.Count;
|
var targetProgress = (float)(i + 1) / _managersToLoad.Count;
|
||||||
|
|
||||||
// 平滑过渡进度条到下一个目标进度
|
// 平滑过渡进度条到下一个目标进度
|
||||||
yield return SmoothTransitionTo(targetProgress);
|
yield return SmoothTransitionTo(targetProgress);
|
||||||
|
|
||||||
// 初始化对应的管理器,并进行异常处理
|
// 初始化对应的管理器,并处理可能发生的异常
|
||||||
yield return InitializeManagerSafely(manager);
|
yield return InitializeManagerSafely(manager);
|
||||||
|
|
||||||
// 模拟耗时,如果管理器Init方法本身很快,可以 uncomment
|
// yield return new WaitForSeconds(0.1f); // 此行代码可用于模拟每个管理器加载的耗时,默认不启用。
|
||||||
// yield return new WaitForSeconds(0.1f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 所有管理器加载完成后的处理
|
// 所有管理器加载完成后的处理
|
||||||
@ -221,19 +266,22 @@ namespace Base
|
|||||||
{
|
{
|
||||||
describeText.text = "加载完成!";
|
describeText.text = "加载完成!";
|
||||||
}
|
}
|
||||||
Progress = 1f; // 确保进度条最终达到100%
|
// 确保进度条最终达到100%
|
||||||
|
Progress = 1f;
|
||||||
|
|
||||||
// 开始渐隐效果
|
// 启动加载UI的渐隐效果
|
||||||
yield return FadeOutProgressBar();
|
yield return FadeOutProgressBar();
|
||||||
|
|
||||||
// 所有加载和动画结束后,可以考虑卸载加载UI,或跳转到主场景
|
// 所有加载和动画结束后,可以考虑卸载加载UI,或跳转到主场景
|
||||||
// ToScene("MainGameScene"); // 如果有需要,在这里跳转到主游戏场景
|
// ToScene("MainGameScene"); // 如果有需要,可以在此处调用静态方法跳转到主游戏场景
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 尝试安全地初始化单个管理器,并捕获任何异常。
|
/// 尝试安全地初始化单个管理器实例,并捕获任何可能发生的异常。
|
||||||
|
/// 如果初始化失败,将记录错误日志并更新UI提示。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="manager">要初始化的管理器实例。</param>
|
/// <param name="manager">要初始化的管理器实例。</param>
|
||||||
|
/// <returns>一个 <see cref="IEnumerator"/>,用于协程。</returns>
|
||||||
private IEnumerator InitializeManagerSafely(ILaunchManager manager)
|
private IEnumerator InitializeManagerSafely(ILaunchManager manager)
|
||||||
{
|
{
|
||||||
var initSuccess = false;
|
var initSuccess = false;
|
||||||
@ -241,36 +289,38 @@ namespace Base
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
manager.Init(); // 调用管理器的 Init 方法
|
manager.Init(); // 调用管理器的 Init 方法进行初始化
|
||||||
initSuccess = true;
|
initSuccess = true;
|
||||||
}
|
}
|
||||||
catch (System.Exception ex)
|
catch (System.Exception ex)
|
||||||
{
|
{
|
||||||
initException = ex; // 捕获异常
|
initException = ex; // 捕获初始化过程中抛出的异常
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!initSuccess && initException != null)
|
if (!initSuccess && initException != null)
|
||||||
{
|
{
|
||||||
// 记录错误日志
|
// 记录错误日志:初始化管理器时出现错误。
|
||||||
Debug.LogError($"<color=red>初始化管理器 '{manager.StepDescription}' 时出错:</color> {initException.Message}\n{initException.StackTrace}");
|
Debug.LogError($"<color=red>初始化管理器 '{manager.StepDescription}' 时出错:</color> {initException.Message}\n{initException.StackTrace}");
|
||||||
if (describeText != null)
|
if (describeText != null)
|
||||||
{
|
{
|
||||||
describeText.text = $"{manager.StepDescription} (初始化失败)";
|
describeText.text = $"{manager.StepDescription} (初始化失败)"; // 更新UI显示失败信息
|
||||||
}
|
}
|
||||||
// 这里可以添加更复杂的错误处理,例如显示错误弹窗,或者重试逻辑
|
// 这里可以添加更复杂的错误处理逻辑,例如显示错误弹窗、记录到特定日志文件或允许用户选择重试。
|
||||||
// yield break; // 如果错误严重,可以选择停止后续加载
|
// yield break; // 如果错误严重到无法继续,可以选择停止后续加载流程。
|
||||||
}
|
}
|
||||||
|
|
||||||
yield return null; // 确保协程继续执行,即使没有做任何事
|
yield return null; // 确保协程继续执行,无论初始化成功与否
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 协程:平滑过渡进度条到指定的目标进度。
|
/// 协程:平滑地过渡进度条的当前值到指定的目标进度。
|
||||||
|
/// 使用 <c>Mathf.SmoothStep</c> 实现自然加速和减速的过渡效果。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="targetProgress">目标进度值 (0-1)。</param>
|
/// <param name="targetProgress">目标进度值 (0到1之间)。</param>
|
||||||
|
/// <returns>一个 <see cref="IEnumerator"/>,用于协程。</returns>
|
||||||
private IEnumerator SmoothTransitionTo(float targetProgress)
|
private IEnumerator SmoothTransitionTo(float targetProgress)
|
||||||
{
|
{
|
||||||
var startProgress = _currentProgressValue; // 获取当前进度作为起始点
|
var startProgress = _currentProgressValue; // 获取当前进度作为过渡的起始点
|
||||||
var elapsedTime = 0f;
|
var elapsedTime = 0f;
|
||||||
|
|
||||||
while (elapsedTime < duration)
|
while (elapsedTime < duration)
|
||||||
@ -278,7 +328,7 @@ namespace Base
|
|||||||
elapsedTime += Time.deltaTime;
|
elapsedTime += Time.deltaTime;
|
||||||
// 使用 SmoothStep 实现更自然的加速和减速过渡效果
|
// 使用 SmoothStep 实现更自然的加速和减速过渡效果
|
||||||
var t = Mathf.SmoothStep(0f, 1f, elapsedTime / duration);
|
var t = Mathf.SmoothStep(0f, 1f, elapsedTime / duration);
|
||||||
Progress = Mathf.Lerp(startProgress, targetProgress, t);
|
Progress = Mathf.Lerp(startProgress, targetProgress, t); // 在起始和目标进度之间插值
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,8 +336,9 @@ namespace Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 协程:渐隐加载UI的透明度。
|
/// 协程:平滑渐隐加载UI的所有元素,使其透明度从完全不透明过渡到完全透明。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <returns>一个 <see cref="IEnumerator"/>,用于协程。</returns>
|
||||||
private IEnumerator FadeOutProgressBar()
|
private IEnumerator FadeOutProgressBar()
|
||||||
{
|
{
|
||||||
var elapsedTime = 0f;
|
var elapsedTime = 0f;
|
||||||
@ -306,7 +357,7 @@ namespace Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 静态方法:加载指定名称的场景。
|
/// 静态方法:加载指定名称的Unity场景。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scene">要加载的场景名称。</param>
|
/// <param name="scene">要加载的场景名称。</param>
|
||||||
public static void ToScene(string scene)
|
public static void ToScene(string scene)
|
||||||
@ -314,7 +365,4 @@ namespace Base
|
|||||||
SceneManager.LoadScene(scene);
|
SceneManager.LoadScene(scene);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
124
Client/Assets/Scripts/Data/AttributesOffsetDef.cs
Normal file
124
Client/Assets/Scripts/Data/AttributesOffsetDef.cs
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
using Entity;
|
||||||
|
|
||||||
|
namespace Data
|
||||||
|
{
|
||||||
|
public class AttributesOffsetDef : Define
|
||||||
|
{
|
||||||
|
// ======================================================================
|
||||||
|
// 绝对值偏移 (Added/Subtracted directly)
|
||||||
|
// ======================================================================
|
||||||
|
public float healthOffset = 0f;
|
||||||
|
public float moveSpeedOffset = 0f;
|
||||||
|
public float attackOffset = 0f;
|
||||||
|
public float defenseOffset = 0f;
|
||||||
|
public float attackSpeedOffset = 0f;
|
||||||
|
public float attackRangeOffset = 0f;
|
||||||
|
|
||||||
|
public float attackTargetCountOffset = 0f;
|
||||||
|
|
||||||
|
// ======================================================================
|
||||||
|
// 百分比偏移 (Multiplied as a factor, e.g., 0.1 for +10%)
|
||||||
|
// ======================================================================
|
||||||
|
// 注意:百分比偏移通常是乘法因子。
|
||||||
|
// 0f 表示没有百分比变化,0.1f 表示增加10%,-0.1f 表示减少10%。
|
||||||
|
// 应用时: baseValue * (1 + percentageOffset)
|
||||||
|
// 或者对于更直接的乘法,可以直接用 multiplyRatio,例如 1.1 表示增加 10%。
|
||||||
|
public float healthPercentOffset = 0f; // 例如 0.1 表示 +10%
|
||||||
|
public float moveSpeedPercentOffset = 0f;
|
||||||
|
public float attackPercentOffset = 0f;
|
||||||
|
public float defensePercentOffset = 0f;
|
||||||
|
public float attackSpeedPercentOffset = 0f;
|
||||||
|
public float attackRangePercentOffset = 0f;
|
||||||
|
|
||||||
|
public float attackTargetCountPercentOffset = 0f;
|
||||||
|
|
||||||
|
// ======================================================================
|
||||||
|
// 数组偏移 / 集合偏移 (更复杂的情况,如果原始属性是数组/集合)
|
||||||
|
// 因为你的Attributes类目前都是单一值,所以这里先按单一值处理。
|
||||||
|
// 如果 future Attributes.attackTargets 变成 List<string> 或者 int[],
|
||||||
|
// 这里就需要 List<string> addedAttackTargets 或 List<int> addedAttackTargetCounts
|
||||||
|
// 来表示要添加/移除的元素。
|
||||||
|
// 示例:如果将来有一个属性是效果列表,这里可以定义要添加的效果
|
||||||
|
// public List<string> addedEffects = new List<string>();
|
||||||
|
// public List<string> removedEffects = new List<string>();
|
||||||
|
// 如果 `attackTargetCount` 实际代表可以攻击的目标ID数组,那么:
|
||||||
|
// public List<int> addedAttackTargets = new List<int>();
|
||||||
|
// public List<int> removedAttackTargets = new List<int>();
|
||||||
|
// 注意:对于 `attackTargetCount` 来说,它本身是一个 int,
|
||||||
|
// 上面的 `attackTargetCountOffset` 已经足够处理“增加攻击目标数量”的需求。
|
||||||
|
// "数组偏移"通常指的是当原始属性本身是一个集合时,你想要修改这个集合的元素。
|
||||||
|
// 如果 `Attributes` 类保持其当前形式 (都是单一数值),那么不需要专门的数组偏移。
|
||||||
|
// ======================================================================
|
||||||
|
// 构造函数 (可选,用于方便初始化)
|
||||||
|
// ======================================================================
|
||||||
|
public AttributesOffsetDef()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// 可以添加带参数的构造函数,方便快速设置
|
||||||
|
public AttributesOffsetDef(float healthAbs = 0f, float moveSpeedAbs = 0f, float attackAbs = 0f,
|
||||||
|
float defenseAbs = 0f, float attackSpeedAbs = 0f, float attackRangeAbs = 0f,
|
||||||
|
float attackTargetCountAbs = 0f,
|
||||||
|
float healthPct = 0f, float moveSpeedPct = 0f, float attackPct = 0f,
|
||||||
|
float defensePct = 0f, float attackSpeedPct = 0f, float attackRangePct = 0f,
|
||||||
|
float attackTargetCountPct = 0f)
|
||||||
|
{
|
||||||
|
healthOffset = healthAbs;
|
||||||
|
moveSpeedOffset = moveSpeedAbs;
|
||||||
|
attackOffset = attackAbs;
|
||||||
|
defenseOffset = defenseAbs;
|
||||||
|
attackSpeedOffset = attackSpeedAbs;
|
||||||
|
attackRangeOffset = attackRangeAbs;
|
||||||
|
attackTargetCountOffset = attackTargetCountAbs;
|
||||||
|
healthPercentOffset = healthPct;
|
||||||
|
moveSpeedPercentOffset = moveSpeedPct;
|
||||||
|
attackPercentOffset = attackPct;
|
||||||
|
defensePercentOffset = defensePct;
|
||||||
|
attackSpeedPercentOffset = attackSpeedPct;
|
||||||
|
attackRangePercentOffset = attackRangePct;
|
||||||
|
attackTargetCountPercentOffset = attackTargetCountPct;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ======================================================================
|
||||||
|
// 应用偏移的方法
|
||||||
|
// ======================================================================
|
||||||
|
/// <summary>
|
||||||
|
/// 将此偏移应用到给定的Attributes实例上。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="baseAttributes">要应用偏移的基础Attributes。</param>
|
||||||
|
/// <returns>应用偏移后的新Attributes实例。</returns>
|
||||||
|
public Attributes ApplyTo(Attributes baseAttributes)
|
||||||
|
{
|
||||||
|
// 创建一个新的Attributes实例以避免修改原始实例
|
||||||
|
// 或者如果需要直接修改,可以返回 void
|
||||||
|
Attributes modifiedAttributes = new Attributes
|
||||||
|
{
|
||||||
|
health = baseAttributes.health,
|
||||||
|
moveSpeed = baseAttributes.moveSpeed,
|
||||||
|
attack = baseAttributes.attack,
|
||||||
|
defense = baseAttributes.defense,
|
||||||
|
attackSpeed = baseAttributes.attackSpeed,
|
||||||
|
attackRange = baseAttributes.attackRange,
|
||||||
|
attackTargetCount = baseAttributes.attackTargetCount
|
||||||
|
};
|
||||||
|
// 首先应用百分比偏移
|
||||||
|
modifiedAttributes.health = (int)(modifiedAttributes.health * (1f + healthPercentOffset));
|
||||||
|
modifiedAttributes.moveSpeed *= (1f + moveSpeedPercentOffset);
|
||||||
|
modifiedAttributes.attack = (int)(modifiedAttributes.attack * (1f + attackPercentOffset));
|
||||||
|
modifiedAttributes.defense = (int)(modifiedAttributes.defense * (1f + defensePercentOffset));
|
||||||
|
modifiedAttributes.attackSpeed = (int)(modifiedAttributes.attackSpeed * (1f + attackSpeedPercentOffset));
|
||||||
|
modifiedAttributes.attackRange = (int)(modifiedAttributes.attackRange * (1f + attackRangePercentOffset));
|
||||||
|
modifiedAttributes.attackTargetCount =
|
||||||
|
(int)(modifiedAttributes.attackTargetCount * (1f + attackTargetCountPercentOffset));
|
||||||
|
// 然后应用绝对值偏移
|
||||||
|
modifiedAttributes.health += (int)healthOffset;
|
||||||
|
modifiedAttributes.moveSpeed += moveSpeedOffset;
|
||||||
|
modifiedAttributes.attack += (int)attackOffset;
|
||||||
|
modifiedAttributes.defense += (int)defenseOffset;
|
||||||
|
modifiedAttributes.attackSpeed += (int)attackSpeedOffset;
|
||||||
|
modifiedAttributes.attackRange += (int)attackRangeOffset;
|
||||||
|
modifiedAttributes.attackTargetCount += (int)attackTargetCountOffset;
|
||||||
|
return modifiedAttributes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Client/Assets/Scripts/Data/AttributesOffsetDef.cs.meta
Normal file
3
Client/Assets/Scripts/Data/AttributesOffsetDef.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fb6190c213d44e04946784c3a5063e83
|
||||||
|
timeCreated: 1756302637
|
@ -231,7 +231,7 @@ namespace Data
|
|||||||
public List<DrawNodeDef> nodes = new();
|
public List<DrawNodeDef> nodes = new();
|
||||||
public string nodeName;
|
public string nodeName;
|
||||||
public Vector2 position = new(0, 0);
|
public Vector2 position = new(0, 0);
|
||||||
public float FPS = 0.5f;
|
public float FPS = 1f;
|
||||||
|
|
||||||
public override bool Init(XElement xmlDef)
|
public override bool Init(XElement xmlDef)
|
||||||
{
|
{
|
||||||
|
21
Client/Assets/Scripts/Data/EntityEventDef.cs
Normal file
21
Client/Assets/Scripts/Data/EntityEventDef.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Data
|
||||||
|
{
|
||||||
|
public class EntityEventDef:Define
|
||||||
|
{
|
||||||
|
public BuildingDef buildingDef;
|
||||||
|
public MonsterDef monster;
|
||||||
|
public CharacterDef character; // 要生成的实体Def的defName
|
||||||
|
public int count = 1; // 生成的数量
|
||||||
|
|
||||||
|
public float minRadius = 0f; // 最小距离(以格数单位)
|
||||||
|
public float maxRadius = 10f; // 最大距离(以格数单位)
|
||||||
|
public int width = 5; // 宽度(以格数单位),指定一个方形区域
|
||||||
|
public int height = 5; // 高度(以格数单位)
|
||||||
|
public bool allowNearWalls = true; // 是否允许靠近墙壁生成
|
||||||
|
public bool allowSpawnOnPawn = false; // 是否允许直接生成在角色身上
|
||||||
|
// 可以添加更多约束,如:
|
||||||
|
public List<string> allowedTerrainTags; // 允许生成的地形标签
|
||||||
|
}
|
||||||
|
}
|
3
Client/Assets/Scripts/Data/EntityEventDef.cs.meta
Normal file
3
Client/Assets/Scripts/Data/EntityEventDef.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9b4cf168bf1e41d4a63e78cb734453bd
|
||||||
|
timeCreated: 1756305435
|
@ -1,21 +1,8 @@
|
|||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
public enum EventType
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
SpawnCharacter,
|
|
||||||
SpawnBuilding,
|
|
||||||
SpawnBullet,
|
|
||||||
SpawnPickup,
|
|
||||||
SpawnDefaultEntity,
|
|
||||||
}
|
|
||||||
public class EventDef : Define
|
public class EventDef : Define
|
||||||
{
|
{
|
||||||
public EventType eventType = EventType.None;
|
public HediffEventDef hediffEvent;
|
||||||
public EntityDef entityDef_Character; // 用于 EventType.SpawnCharacter
|
public EntityEventDef entityEvent;
|
||||||
public BuildingDef entityDef_Building; // 用于 EventType.SpawnBuilding
|
|
||||||
public BulletDef entityDef_Bullet; // 用于 EventType.SpawnBullet
|
|
||||||
public ItemDef entityDef_Pickup; // 用于 EventType.SpawnPickup
|
|
||||||
public EventDef() { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
17
Client/Assets/Scripts/Data/HediffCompDef.cs
Normal file
17
Client/Assets/Scripts/Data/HediffCompDef.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace Data
|
||||||
|
{
|
||||||
|
public class HediffCompDef:Define
|
||||||
|
{
|
||||||
|
public Type compClass;
|
||||||
|
public override bool Init(XElement xmlDef)
|
||||||
|
{
|
||||||
|
base.Init(xmlDef);
|
||||||
|
var name = xmlDef.Attribute("class")?.Value??"";
|
||||||
|
compClass=Type.GetType(name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Client/Assets/Scripts/Data/HediffCompDef.cs.meta
Normal file
3
Client/Assets/Scripts/Data/HediffCompDef.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 92779af4b74648a99930c10376760af6
|
||||||
|
timeCreated: 1756303386
|
13
Client/Assets/Scripts/Data/HediffDef.cs
Normal file
13
Client/Assets/Scripts/Data/HediffDef.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Data
|
||||||
|
{
|
||||||
|
public class HediffDef:Define
|
||||||
|
{
|
||||||
|
public float time = -1;
|
||||||
|
// Hediff的发展阶段列表
|
||||||
|
public List<HediffStageDef> stages = new List<HediffStageDef>();
|
||||||
|
// 附加的组件列表
|
||||||
|
public List<HediffCompDef> comps = new List<HediffCompDef>();
|
||||||
|
}
|
||||||
|
}
|
3
Client/Assets/Scripts/Data/HediffDef.cs.meta
Normal file
3
Client/Assets/Scripts/Data/HediffDef.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a4311115be2f4da8a5a27e1bb298928e
|
||||||
|
timeCreated: 1756303757
|
11
Client/Assets/Scripts/Data/HediffEventDef.cs
Normal file
11
Client/Assets/Scripts/Data/HediffEventDef.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
namespace Data
|
||||||
|
{
|
||||||
|
public class HediffEventDef:Define
|
||||||
|
{
|
||||||
|
public HediffDef hediff; // 要添加的HediffDef的defName
|
||||||
|
public float hediffSeverity = 1.0f; // 添加时Hediff的严重程度或进度
|
||||||
|
public AffiliationDef affiliation; // 目标的派系DefName
|
||||||
|
public bool forAllPawnsInFaction = false; // 是否为该派系的所有Pawns添加Hediff
|
||||||
|
public int specificPawnCount = 1; // 如果不是所有Pawns,指定数量
|
||||||
|
}
|
||||||
|
}
|
3
Client/Assets/Scripts/Data/HediffEventDef.cs.meta
Normal file
3
Client/Assets/Scripts/Data/HediffEventDef.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d495178bf0c943fe9da8009592e20400
|
||||||
|
timeCreated: 1756305417
|
8
Client/Assets/Scripts/Data/HediffStageDef.cs
Normal file
8
Client/Assets/Scripts/Data/HediffStageDef.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace Data
|
||||||
|
{
|
||||||
|
public class HediffStageDef:Define
|
||||||
|
{
|
||||||
|
public float start;
|
||||||
|
public AffiliationDef attributesOffset = new();
|
||||||
|
}
|
||||||
|
}
|
3
Client/Assets/Scripts/Data/HediffStageDef.cs.meta
Normal file
3
Client/Assets/Scripts/Data/HediffStageDef.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 59d3b562e68e40fdaa65e5e6431c58e0
|
||||||
|
timeCreated: 1756304101
|
@ -4,7 +4,6 @@ namespace Data
|
|||||||
{
|
{
|
||||||
public class ImageDef : Define
|
public class ImageDef : Define
|
||||||
{
|
{
|
||||||
public string name;
|
|
||||||
public string path;
|
public string path;
|
||||||
public int wCount;
|
public int wCount;
|
||||||
public int hCount;
|
public int hCount;
|
||||||
@ -13,7 +12,6 @@ namespace Data
|
|||||||
public override bool Init(XElement xmlDef)
|
public override bool Init(XElement xmlDef)
|
||||||
{
|
{
|
||||||
base.Init(xmlDef);
|
base.Init(xmlDef);
|
||||||
name = defName;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
Client/Assets/Scripts/Data/StoryDef.cs
Normal file
13
Client/Assets/Scripts/Data/StoryDef.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace Data
|
||||||
|
{
|
||||||
|
public class StoryStageDef : Define
|
||||||
|
{
|
||||||
|
public float lastWaitTime = 0;
|
||||||
|
public EventDef eventDef;
|
||||||
|
public float nextWaitTime = 0;
|
||||||
|
}
|
||||||
|
public class StoryDef:Define
|
||||||
|
{
|
||||||
|
public StoryStageDef[] storyStage;
|
||||||
|
}
|
||||||
|
}
|
3
Client/Assets/Scripts/Data/StoryDef.cs.meta
Normal file
3
Client/Assets/Scripts/Data/StoryDef.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e11d701b7d8b4af0a947d630884bfeab
|
||||||
|
timeCreated: 1756306428
|
@ -25,6 +25,7 @@ namespace Entity
|
|||||||
var maxIndex = Inventory != null && Inventory.Capacity > 0 ? Inventory.Capacity - 1 : 0;
|
var maxIndex = Inventory != null && Inventory.Capacity > 0 ? Inventory.Capacity - 1 : 0;
|
||||||
var clampedValue = Mathf.Clamp(value, 0, maxIndex);
|
var clampedValue = Mathf.Clamp(value, 0, maxIndex);
|
||||||
_currentSelected = clampedValue;
|
_currentSelected = clampedValue;
|
||||||
|
InitWeaponAnimator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,29 +69,6 @@ namespace Entity
|
|||||||
return remainingQuantity;
|
return remainingQuantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public override void TryAttack()
|
|
||||||
// {
|
|
||||||
// if (IsAttacking)
|
|
||||||
// return;
|
|
||||||
// if (!DefineManager.Instance.defines.TryGetValue(nameof(BulletDef), out var def))
|
|
||||||
// return;
|
|
||||||
// // 修正:First() 可能会在一个空的 Values 集合上抛出异常。
|
|
||||||
// // 更好的做法是使用 TryGetValue 或 FirstOrDefault 并检查结果。
|
|
||||||
// // 这里假设至少有一个 BulletDef 存在,如果不是,需要更复杂的错误处理。
|
|
||||||
// var bulletDefEntry = def.Values.FirstOrDefault();
|
|
||||||
// if (bulletDefEntry == null)
|
|
||||||
// {
|
|
||||||
// Debug.LogError("No BulletDef found in DefineManager. Cannot attack.");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// var bulletDef = (BulletDef)bulletDefEntry;
|
|
||||||
//
|
|
||||||
// Vector3 dir = MousePosition.GetWorldPosition();
|
|
||||||
// EntityManage.Instance.GenerateBulletEntity(Program.Instance.FocusedDimensionId, bulletDef, Position,
|
|
||||||
// dir - Position, this);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public override WeaponResource GetCurrentWeapon()
|
public override WeaponResource GetCurrentWeapon()
|
||||||
{
|
{
|
||||||
var currentSelectItem = Inventory.GetSlot(CurrentSelected);
|
var currentSelectItem = Inventory.GetSlot(CurrentSelected);
|
||||||
|
@ -32,6 +32,12 @@ namespace Entity
|
|||||||
|
|
||||||
public EntityPrefab entityPrefab;
|
public EntityPrefab entityPrefab;
|
||||||
public EntityDef entityDef;
|
public EntityDef entityDef;
|
||||||
|
/// <summary>
|
||||||
|
/// 手上拿着显示的贴图
|
||||||
|
/// </summary>
|
||||||
|
public GameObject weaponAnimator;
|
||||||
|
|
||||||
|
public ITick[] weaponAnimatorNodeList;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 人工智能行为树,定义实体的行为逻辑。
|
/// 人工智能行为树,定义实体的行为逻辑。
|
||||||
@ -163,6 +169,7 @@ namespace Entity
|
|||||||
// 协程引用
|
// 协程引用
|
||||||
private Coroutine _attackCoroutine;
|
private Coroutine _attackCoroutine;
|
||||||
|
|
||||||
|
protected List<Hediff> hediffs;
|
||||||
|
|
||||||
|
|
||||||
[SerializeField] private float _hitBarUIShowTime = 5;
|
[SerializeField] private float _hitBarUIShowTime = 5;
|
||||||
@ -183,13 +190,32 @@ namespace Entity
|
|||||||
this.entityDef = entityDef;
|
this.entityDef = entityDef;
|
||||||
|
|
||||||
HideHealthBar();
|
HideHealthBar();
|
||||||
|
InitWeaponAnimator();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void InitWeaponAnimator()
|
||||||
|
{
|
||||||
|
for (var i = 0; i < weaponAnimator.transform.childCount; i++)
|
||||||
|
{
|
||||||
|
Destroy(weaponAnimator.transform.GetChild(i).gameObject);
|
||||||
|
weaponAnimatorNodeList = null;
|
||||||
|
}
|
||||||
|
var weapon = GetCurrentWeapon();
|
||||||
|
if (weapon == null)
|
||||||
|
{
|
||||||
|
weaponAnimator.SetActive(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var weaponAnimation = weapon.InstantiateAttackAnimation(weaponAnimator.transform);
|
||||||
|
weaponAnimatorNodeList = weaponAnimation.animationComponents;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始化实体的身体部分,包括不同朝向下的绘图节点。
|
/// 初始化实体的身体部分,包括不同朝向下的绘图节点。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="drawingOrder">绘制顺序定义。</param>
|
/// <param name="drawingOrder">绘制顺序定义。</param>
|
||||||
public virtual void InitBody(DrawingOrderDef drawingOrder)
|
protected virtual void InitBody(DrawingOrderDef drawingOrder)
|
||||||
{
|
{
|
||||||
// 预缓存枚举值(避免每次循环重复调用 Enum.GetValues)
|
// 预缓存枚举值(避免每次循环重复调用 Enum.GetValues)
|
||||||
var states = Enum.GetValues(typeof(EntityState)).Cast<EntityState>().ToArray();
|
var states = Enum.GetValues(typeof(EntityState)).Cast<EntityState>().ToArray();
|
||||||
@ -295,7 +321,7 @@ namespace Entity
|
|||||||
/// <param name="drawNode">绘图节点定义。</param>
|
/// <param name="drawNode">绘图节点定义。</param>
|
||||||
/// <param name="parent">父节点对象。</param>
|
/// <param name="parent">父节点对象。</param>
|
||||||
/// <returns>创建的GameObject,如果失败则返回null</returns>
|
/// <returns>创建的GameObject,如果失败则返回null</returns>
|
||||||
public virtual GameObject InitBodyPart(DrawNodeDef drawNode, GameObject parent)
|
protected virtual GameObject InitBodyPart(DrawNodeDef drawNode, GameObject parent)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -470,6 +496,13 @@ namespace Entity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (weaponAnimatorNodeList != null)
|
||||||
|
{
|
||||||
|
foreach (var tick in weaponAnimatorNodeList)
|
||||||
|
{
|
||||||
|
tick.Tick();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (IsShowingHealthBarUI)
|
if (IsShowingHealthBarUI)
|
||||||
{
|
{
|
||||||
_hitBarUIShowTimer -= Time.deltaTime;
|
_hitBarUIShowTimer -= Time.deltaTime;
|
||||||
|
15
Client/Assets/Scripts/Entity/Hediff.cs
Normal file
15
Client/Assets/Scripts/Entity/Hediff.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using Data;
|
||||||
|
|
||||||
|
namespace Entity
|
||||||
|
{
|
||||||
|
public class Hediff
|
||||||
|
{
|
||||||
|
public float Duration{get;private set;}
|
||||||
|
|
||||||
|
|
||||||
|
public Hediff(HediffDef def)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Client/Assets/Scripts/Entity/Hediff.cs.meta
Normal file
3
Client/Assets/Scripts/Entity/Hediff.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: afec36ba23b944cf94ca944a8f8f35f4
|
||||||
|
timeCreated: 1756308924
|
@ -1,181 +1,75 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Data;
|
using Data;
|
||||||
|
using Entity;
|
||||||
|
using Prefab;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using EventType = Data.EventType;
|
using Utils;
|
||||||
|
using Random = System.Random;
|
||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
// 新增私有结构体,用于在事件队列中存储事件定义及其运行时上下文
|
class EventManager:Singleton<EventManager>,ILaunchManager
|
||||||
public struct EventPayload // Make it public if EventManager exposes it directly
|
|
||||||
{
|
{
|
||||||
public string DimensionId;
|
private static Random _random = new();
|
||||||
public EventDef EventDefinition;
|
public EventDef[] EventDefs { get; private set; }
|
||||||
public Vector3 Position; // 适用于 Character, Bullet, Pickup, DefaultEntity
|
public string StepDescription => "正在载入事件";
|
||||||
public Vector3 Direction; // 仅适用于 Bullet
|
|
||||||
public Entity.Entity SourceEntity; // 仅适用于 Bullet (发射源)
|
|
||||||
public Vector3Int GridPosition; // 仅适用于 Building
|
|
||||||
}
|
|
||||||
|
|
||||||
public class EventManager : Utils.MonoSingleton<EventManager>
|
public void Init()
|
||||||
{
|
|
||||||
private Queue<EventPayload> _eventQueue = new Queue<EventPayload>();
|
|
||||||
|
|
||||||
private EventManager()
|
|
||||||
{
|
{
|
||||||
/* Private constructor for singleton */
|
if(EventDefs!=null)
|
||||||
}
|
|
||||||
|
|
||||||
// ===================================
|
|
||||||
// 公共入队方法
|
|
||||||
// ===================================
|
|
||||||
public void EnqueueCharacterSpawnEvent(string dimensionId, EventDef eventDef, Vector3 pos)
|
|
||||||
{
|
|
||||||
if (eventDef == null || eventDef.eventType != EventType.SpawnCharacter ||
|
|
||||||
eventDef.entityDef_Character == null)
|
|
||||||
{
|
|
||||||
Debug.LogError(
|
|
||||||
$"EnqueueCharacterSpawnEvent: Invalid EventDef, mismatched EventType ({eventDef?.eventType}), or missing characterDef for event '{eventDef?.defName ?? "Unknown"}'.");
|
|
||||||
return;
|
return;
|
||||||
}
|
EventDefs = DefineManager.Instance.QueryDefinesByType<EventDef>();
|
||||||
|
|
||||||
_eventQueue.Enqueue(new EventPayload
|
|
||||||
{
|
|
||||||
DimensionId = dimensionId,
|
|
||||||
EventDefinition = eventDef,
|
|
||||||
Position = pos,
|
|
||||||
});
|
|
||||||
Debug.Log($"Event '{eventDef.defName}' (SpawnCharacter) enqueued for dimension {dimensionId} at {pos}.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnqueueBuildingSpawnEvent(string dimensionId, EventDef eventDef, Vector3Int gridPos)
|
public void Clear()
|
||||||
{
|
{
|
||||||
if (eventDef == null || eventDef.eventType != EventType.SpawnBuilding ||
|
EventDefs = null;
|
||||||
eventDef.entityDef_Building == null)
|
}
|
||||||
{
|
|
||||||
Debug.LogError(
|
public static void ExecuteEvent(EventDef eventDef)
|
||||||
$"EnqueueBuildingSpawnEvent: Invalid EventDef, mismatched EventType ({eventDef?.eventType}), or missing buildingDef for event '{eventDef?.defName ?? "Unknown"}'.");
|
{
|
||||||
|
if(eventDef == null)
|
||||||
return;
|
return;
|
||||||
}
|
if (eventDef.hediffEvent != null)
|
||||||
|
|
||||||
_eventQueue.Enqueue(new EventPayload
|
|
||||||
{
|
{
|
||||||
DimensionId = dimensionId,
|
var entityList = EntityManage.Instance.FindEntitiesByFaction(Program.Instance.FocusedDimensionId,
|
||||||
EventDefinition = eventDef,
|
eventDef.hediffEvent.affiliation.defName);
|
||||||
GridPosition = gridPos,
|
List<Entity.Entity> filteredEntitiesTraditional = new();
|
||||||
});
|
foreach (var prefab in entityList)
|
||||||
Debug.Log($"Event '{eventDef.defName}' (SpawnBuilding) enqueued for dimension {dimensionId} at grid {gridPos}.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EnqueueBulletSpawnEvent(string dimensionId, EventDef eventDef, Vector3 pos, Vector3 dir,
|
|
||||||
Entity.Entity source = null)
|
|
||||||
{
|
|
||||||
if (eventDef == null || eventDef.eventType != EventType.SpawnBullet || eventDef.entityDef_Bullet == null)
|
|
||||||
{
|
|
||||||
Debug.LogError(
|
|
||||||
$"EnqueueBulletSpawnEvent: Invalid EventDef, mismatched EventType ({eventDef?.eventType}), or missing bulletDef for event '{eventDef?.defName ?? "Unknown"}'.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_eventQueue.Enqueue(new EventPayload
|
|
||||||
{
|
|
||||||
DimensionId = dimensionId,
|
|
||||||
EventDefinition = eventDef,
|
|
||||||
Position = pos,
|
|
||||||
Direction = dir,
|
|
||||||
SourceEntity = source,
|
|
||||||
});
|
|
||||||
Debug.Log($"Event '{eventDef.defName}' (SpawnBullet) enqueued for dimension {dimensionId} at {pos}, dir {dir}.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EnqueuePickupSpawnEvent(string dimensionId, EventDef eventDef, Vector3 pos)
|
|
||||||
{
|
|
||||||
if (eventDef == null || eventDef.eventType != EventType.SpawnPickup || eventDef.entityDef_Pickup == null)
|
|
||||||
{
|
|
||||||
Debug.LogError(
|
|
||||||
$"EnqueuePickupSpawnEvent: Invalid EventDef, mismatched EventType ({eventDef?.eventType}), or missing itemDef for event '{eventDef?.defName ?? "Unknown"}'.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_eventQueue.Enqueue(new EventPayload
|
|
||||||
{
|
|
||||||
DimensionId = dimensionId,
|
|
||||||
EventDefinition = eventDef,
|
|
||||||
Position = pos,
|
|
||||||
});
|
|
||||||
Debug.Log($"Event '{eventDef.defName}' (SpawnPickup) enqueued for dimension {dimensionId} at {pos}.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EnqueueDefaultEntitySpawnEvent(string dimensionId, EventDef eventDef, Vector3 pos)
|
|
||||||
{
|
|
||||||
if (eventDef == null || eventDef.eventType != EventType.SpawnDefaultEntity)
|
|
||||||
{
|
|
||||||
Debug.LogError(
|
|
||||||
$"EnqueueDefaultEntitySpawnEvent: Invalid EventDef or mismatched EventType ({eventDef?.eventType}) for event '{eventDef?.defName ?? "Unknown"}'.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_eventQueue.Enqueue(new EventPayload
|
|
||||||
{
|
|
||||||
DimensionId = dimensionId,
|
|
||||||
EventDefinition = eventDef,
|
|
||||||
Position = pos,
|
|
||||||
});
|
|
||||||
Debug.Log($"Event '{eventDef.defName}' (SpawnDefaultEntity) enqueued for dimension {dimensionId} at {pos}.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===================================
|
|
||||||
// 事件处理方法
|
|
||||||
// ===================================
|
|
||||||
/// <summary>
|
|
||||||
/// 处理所有在队列中的待处理事件。
|
|
||||||
/// </summary>
|
|
||||||
public void ProcessEvents()
|
|
||||||
{
|
|
||||||
while (_eventQueue.Count > 0)
|
|
||||||
{
|
|
||||||
EventPayload eventData = _eventQueue.Dequeue();
|
|
||||||
if (!Program.Instance.GetDimension(eventData.DimensionId))
|
|
||||||
{
|
{
|
||||||
Debug.LogWarning(
|
var entity = prefab.entity;
|
||||||
$"Event '{eventData.EventDefinition.defName}' for dimension {eventData.DimensionId} dropped as dimension is no longer active.");
|
if (entity is Character || entity is Monster)
|
||||||
continue;
|
{
|
||||||
|
filteredEntitiesTraditional.Add(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
var selectedElements = SelectRandomElements_FisherYates(filteredEntitiesTraditional, eventDef.hediffEvent.specificPawnCount);
|
||||||
// 核心:调用 EntityManage.Instance 的现有公共方法
|
foreach (var selectedElement in selectedElements)
|
||||||
switch (eventData.EventDefinition.eventType)
|
|
||||||
{
|
{
|
||||||
case EventType.SpawnCharacter:
|
|
||||||
EntityManage.Instance.GenerateEntity(eventData.DimensionId,
|
|
||||||
eventData.EventDefinition.entityDef_Character, eventData.Position);
|
|
||||||
break;
|
|
||||||
case EventType.SpawnBuilding:
|
|
||||||
EntityManage.Instance.GenerateBuildingEntity(eventData.DimensionId,
|
|
||||||
eventData.EventDefinition.entityDef_Building, eventData.GridPosition);
|
|
||||||
break;
|
|
||||||
case EventType.SpawnBullet:
|
|
||||||
EntityManage.Instance.GenerateBulletEntity(eventData.DimensionId,
|
|
||||||
eventData.EventDefinition.entityDef_Bullet, eventData.Position, eventData.Direction,
|
|
||||||
eventData.SourceEntity);
|
|
||||||
break;
|
|
||||||
case EventType.SpawnPickup:
|
|
||||||
EntityManage.Instance.GeneratePickupEntity(eventData.DimensionId,
|
|
||||||
eventData.EventDefinition.entityDef_Pickup, eventData.Position);
|
|
||||||
break;
|
|
||||||
case EventType.SpawnDefaultEntity:
|
|
||||||
EntityManage.Instance.GenerateDefaultEntity(eventData.DimensionId, eventData.Position);
|
|
||||||
break;
|
|
||||||
case EventType.None:
|
|
||||||
default:
|
|
||||||
Debug.LogWarning(
|
|
||||||
$"EventManager: Unhandled or invalid event type: {eventData.EventDefinition.eventType} for event '{eventData.EventDefinition.defName}'.");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static List<T> SelectRandomElements_FisherYates<T>(List<T> sourceList, int count)
|
||||||
protected override void OnStart()
|
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
if (sourceList == null) throw new ArgumentNullException(nameof(sourceList));
|
||||||
|
if (count < 0) throw new ArgumentOutOfRangeException(nameof(count), "Count cannot be negative.");
|
||||||
|
if (count == 0) return new List<T>();
|
||||||
|
if (count >= sourceList.Count) return new List<T>(sourceList); // 如果n大于等于列表大小,则返回所有元素副本
|
||||||
|
|
||||||
|
List<T> result = new List<T>(count); // 预分配容量
|
||||||
|
List<T> temp = new List<T>(sourceList); // 创建一个副本以避免修改原始列表
|
||||||
|
|
||||||
|
int n = temp.Count;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
int k = _random.Next(i, n);
|
||||||
|
result.Add(temp[k]);
|
||||||
|
(temp[k], temp[i]) = (temp[i], temp[k]);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -22,20 +22,14 @@ namespace Managers
|
|||||||
public Sprite defaultSprite;
|
public Sprite defaultSprite;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 存储所有已加载的纹理,按包ID和图像名称索引。
|
/// 存储所有已加载的纹理,按图像名称(全局唯一的DefName)索引。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
public Dictionary<string, Texture2D> packagesImages = new();
|
||||||
/// 外层字典键是包ID,内层字典键是图像名称。
|
|
||||||
/// </remarks>
|
|
||||||
public Dictionary<string, Dictionary<string, Texture2D>> packagesImages = new();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 存储所有已创建的精灵,按包ID和精灵名称索引。
|
/// 存储所有已创建的精灵,按精灵名称(全局唯一的DefName或其带索引后缀)索引。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
public Dictionary<string, Sprite> sprites = new();
|
||||||
/// 外层字典键是包ID,内层字典键是精灵名称(如果纹理被分割,会包含索引后缀)。
|
|
||||||
/// </remarks>
|
|
||||||
public Dictionary<string, Dictionary<string, Sprite>> sprites = new();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取当前启动步骤的描述。
|
/// 获取当前启动步骤的描述。
|
||||||
@ -49,21 +43,15 @@ namespace Managers
|
|||||||
{
|
{
|
||||||
if (packagesImages.Count > 0)
|
if (packagesImages.Count > 0)
|
||||||
{
|
{
|
||||||
// 如果已经加载过,直接返回。
|
// 如果已经有数据,则跳过初始化,防止重复加载。
|
||||||
StepDescription = "包图像管理器已初始化。";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StepDescription = "正在加载默认精灵..."; // 更新加载步骤描述
|
|
||||||
defaultSprite = Resources.Load<Sprite>("Default/DefaultImage");
|
defaultSprite = Resources.Load<Sprite>("Default/DefaultImage");
|
||||||
if (defaultSprite == null)
|
if (defaultSprite == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning("无法加载默认精灵 'Resources/Default/DefaultImage'。请确保文件存在。");
|
Debug.LogWarning("无法加载默认精灵 'Resources/Default/DefaultImage'。请确保文件存在。");
|
||||||
}
|
}
|
||||||
|
|
||||||
StepDescription = "正在处理图像定义并创建精灵..."; // 更新加载步骤描述
|
|
||||||
InitImageDef();
|
InitImageDef();
|
||||||
StepDescription = "包图像管理器初始化完成。"; // 完成加载
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -76,7 +64,7 @@ namespace Managers
|
|||||||
|
|
||||||
if (imageDef == null || !imageDef.Any())
|
if (imageDef == null || !imageDef.Any())
|
||||||
{
|
{
|
||||||
Debug.Log($"在 DefineManager 中未找到任何 ImageDef 定义。({typeof(ImageDef).Name})");
|
Debug.Log($"在定义管理器中未找到任何图像定义。({nameof(ImageDef)})");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +72,7 @@ namespace Managers
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(ima.path) || string.IsNullOrEmpty(ima.packID))
|
if (string.IsNullOrEmpty(ima.path) || string.IsNullOrEmpty(ima.packID))
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"跳过图像定义 '{ima?.name ?? "未知"}',因为它包含空路径或包ID。(路径: '{ima?.path ?? ""}', 包ID: '{ima?.packID ?? ""}')");
|
Debug.LogWarning($"跳过图像定义 '{ima?.defName ?? "未知"}',因为它包含空路径或包ID。(路径: '{ima?.path ?? ""}', 包ID: '{ima?.packID ?? ""}')");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +107,7 @@ namespace Managers
|
|||||||
var packageRoot = Managers.DefineManager.Instance.GetPackagePath(packageID);
|
var packageRoot = Managers.DefineManager.Instance.GetPackagePath(packageID);
|
||||||
if (string.IsNullOrEmpty(packageRoot))
|
if (string.IsNullOrEmpty(packageRoot))
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"图像定义 '{ima.name}' (包ID: {ima.packID}): 引用的包ID '{packageID}' 未找到或没有根路径。跳过图像加载。");
|
Debug.LogWarning($"图像定义 '{ima.defName}' (包ID: {ima.packID}): 引用的包ID '{packageID}' 未找到或没有根路径。跳过图像加载。");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +128,7 @@ namespace Managers
|
|||||||
var pack = Managers.DefineManager.Instance.GetDefinePackage(ima);
|
var pack = Managers.DefineManager.Instance.GetDefinePackage(ima);
|
||||||
if (pack == null)
|
if (pack == null)
|
||||||
{
|
{
|
||||||
Debug.LogError($"图像定义 '{ima.name}' (包ID: {ima.packID}): 源图像未找到对应的定义包。无法确定 '{ima.path}' 的完整路径。跳过。");
|
Debug.LogError($"图像定义 '{ima.defName}' (包ID: {ima.packID}): 源图像未找到对应的定义包。无法确定 '{ima.path}' 的完整路径。跳过。");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var fullPath = Path.Combine(pack.packRootPath, ima.path).Replace('\\', '/');
|
var fullPath = Path.Combine(pack.packRootPath, ima.path).Replace('\\', '/');
|
||||||
@ -158,31 +146,20 @@ namespace Managers
|
|||||||
// 资源加载失败
|
// 资源加载失败
|
||||||
if (!texture)
|
if (!texture)
|
||||||
{
|
{
|
||||||
Debug.LogError($"未能加载图像定义所在的纹理: '{ima.name}' (路径: '{ima.path}', 包ID: '{ima.packID}')。请验证路径和文件是否存在。");
|
Debug.LogError($"未能加载图像定义关联的纹理: '{ima.defName}' (路径: '{ima.path}', 包ID: '{ima.packID}')。请验证路径和文件是否存在。");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 存储到包纹理字典(使用定义自身的 packID)
|
packagesImages[ima.defName] = texture;
|
||||||
var packId = ima.packID;
|
|
||||||
if (!packagesImages.ContainsKey(packId))
|
|
||||||
packagesImages[packId] = new Dictionary<string, Texture2D>();
|
|
||||||
|
|
||||||
// 警告:如果图片名重复,则覆盖
|
|
||||||
if (packagesImages[packId].ContainsKey(ima.name))
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"包 '{packId}' 中名为 '{ima.name}' 的图像被多次定义。将覆盖之前的纹理引用。这可能表示配置错误。");
|
|
||||||
}
|
|
||||||
packagesImages[packId][ima.name] = texture; // 覆盖或添加
|
|
||||||
|
|
||||||
|
|
||||||
// 切分精灵
|
// 切分精灵
|
||||||
SplitTextureIntoSprites(packId, ima.name, texture, ima.hCount, ima.wCount, ima.pixelsPerUnit);
|
SplitTextureIntoSprites(ima.defName, texture, ima.hCount, ima.wCount, ima.pixelsPerUnit);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// 捕获异常并打印详细错误信息
|
// 捕获异常并打印详细错误信息
|
||||||
Debug.LogError(
|
Debug.LogError(
|
||||||
$"处理图像定义时出错: '{ima.name}' (路径: '{ima.path}', 包ID: '{ima.packID}')。异常: {ex.GetType().Name}: {ex.Message}\n堆栈跟踪: {ex.StackTrace}");
|
$"处理图像定义时出错: '{ima.defName}' (路径: '{ima.path}', 包ID: '{ima.packID}')。异常: {ex.GetType().Name}: {ex.Message}\n堆栈跟踪: {ex.StackTrace}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,14 +167,12 @@ namespace Managers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 将纹理按指定行数和列数分割成多个精灵,并存储起来。
|
/// 将纹理按指定行数和列数分割成多个精灵,并存储起来。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packId">精灵所属的包ID。</param>
|
/// <param name="baseName">精灵的基础名称(全局唯一的DefName)。</param>
|
||||||
/// <param name="baseName">精灵的基础名称。</param>
|
|
||||||
/// <param name="texture">要分割的 <see cref="Texture2D"/> 对象。</param>
|
/// <param name="texture">要分割的 <see cref="Texture2D"/> 对象。</param>
|
||||||
/// <param name="rows">水平分割的行数。</param>
|
/// <param name="rows">水平分割的行数。</param>
|
||||||
/// <param name="cols">垂直分割的列数。</param>
|
/// <param name="cols">垂直分割的列数。</param>
|
||||||
/// <param name="pixelsPerUnit">每个单元的像素数,用于Sprite.Create。</param>
|
/// <param name="pixelsPerUnit">每个单元的像素数,用于Sprite.Create。</param>
|
||||||
private void SplitTextureIntoSprites(
|
private void SplitTextureIntoSprites(
|
||||||
string packId,
|
|
||||||
string baseName,
|
string baseName,
|
||||||
Texture2D texture,
|
Texture2D texture,
|
||||||
int rows,
|
int rows,
|
||||||
@ -206,7 +181,7 @@ namespace Managers
|
|||||||
{
|
{
|
||||||
if (!texture)
|
if (!texture)
|
||||||
{
|
{
|
||||||
Debug.LogError($"SplitTextureIntoSprites: 包 '{packId}' 中 '{baseName}' 提供的纹理为空。无法分割。");
|
Debug.LogError($"SplitTextureIntoSprites: '{baseName}' 提供的纹理为空。无法分割。");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,19 +192,11 @@ namespace Managers
|
|||||||
var textureWidth = texture.width;
|
var textureWidth = texture.width;
|
||||||
var textureHeight = texture.height;
|
var textureHeight = texture.height;
|
||||||
|
|
||||||
if (!sprites.ContainsKey(packId))
|
// 创建未分割的完整精灵,使用原始名称 (baseName,即 ImageDef.name)
|
||||||
sprites[packId] = new Dictionary<string, Sprite>();
|
|
||||||
|
|
||||||
// 创建未分割的完整精灵,使用原始名称
|
|
||||||
var fullSpriteRect = new Rect(0, 0, textureWidth, textureHeight);
|
var fullSpriteRect = new Rect(0, 0, textureWidth, textureHeight);
|
||||||
// 警告:如果精灵名重复,则覆盖
|
|
||||||
if (sprites[packId].ContainsKey(baseName))
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"包 '{packId}' 中名为 '{baseName}' 的精灵已存在。将覆盖之前的完整精灵定义。");
|
|
||||||
}
|
|
||||||
var fullSprite = Sprite.Create(texture, fullSpriteRect, new Vector2(0.5f, 0.5f), pixelsPerUnit);
|
var fullSprite = Sprite.Create(texture, fullSpriteRect, new Vector2(0.5f, 0.5f), pixelsPerUnit);
|
||||||
fullSprite.name = baseName; // 确保 Sprite.name 被设置
|
fullSprite.name = baseName; // 确保 Sprite.name 被设置
|
||||||
sprites[packId][baseName] = fullSprite;
|
sprites[baseName] = fullSprite;
|
||||||
|
|
||||||
// 如果不分割(rows和cols都为1),提前返回
|
// 如果不分割(rows和cols都为1),提前返回
|
||||||
if (rows == 1 && cols == 1)
|
if (rows == 1 && cols == 1)
|
||||||
@ -240,7 +207,7 @@ namespace Managers
|
|||||||
// 检查纹理尺寸是否可被分割数整除
|
// 检查纹理尺寸是否可被分割数整除
|
||||||
if (textureWidth % cols != 0 || textureHeight % rows != 0)
|
if (textureWidth % cols != 0 || textureHeight % rows != 0)
|
||||||
{
|
{
|
||||||
Debug.LogError($"包 '{packId}' 中 '{baseName}' 的纹理尺寸 ({textureWidth}x{textureHeight}) 不能被指定的行数 ({rows}) 和列数 ({cols}) 完美整除。子精灵将不会生成或可能不正确。仅显示完整精灵。");
|
Debug.LogError($"'{baseName}' 的纹理尺寸 ({textureWidth}x{textureHeight}) 不能被指定的行数 ({rows}) 和列数 ({cols}) 完美整除。子精灵将不会生成或可能不正确。仅显示完整精灵。");
|
||||||
return; // 终止子精灵分割,只保留完整的精灵
|
return; // 终止子精灵分割,只保留完整的精灵
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,18 +220,11 @@ namespace Managers
|
|||||||
{
|
{
|
||||||
Rect spriteRect = new(col * tileWidth, row * tileHeight, tileWidth, tileHeight);
|
Rect spriteRect = new(col * tileWidth, row * tileHeight, tileWidth, tileHeight);
|
||||||
var sprite = Sprite.Create(texture, spriteRect, new Vector2(0.5f, 0.5f), pixelsPerUnit);
|
var sprite = Sprite.Create(texture, spriteRect, new Vector2(0.5f, 0.5f), pixelsPerUnit);
|
||||||
|
|
||||||
// 精灵索引计算方式
|
// 精灵索引计算方式
|
||||||
var index = (rows - row - 1) * cols + col;
|
var index = (rows - row - 1) * cols + col;
|
||||||
var spriteName = $"{baseName}_{index}";
|
var spriteName = $"{baseName}_{index}";
|
||||||
sprite.name = spriteName;
|
sprite.name = spriteName;
|
||||||
|
sprites[spriteName] = sprite;
|
||||||
// 警告:如果子精灵名重复,则覆盖
|
|
||||||
if (sprites[packId].ContainsKey(spriteName))
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"包 '{packId}' 中名为 '{spriteName}' 的精灵已存在。将覆盖之前的子精灵定义。这可能表示配置错误。");
|
|
||||||
}
|
|
||||||
sprites[packId][spriteName] = sprite;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,36 +259,24 @@ namespace Managers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据 <see cref="ImageDef"/> 对象获取对应的精灵。
|
/// 根据 <see cref="ImageDef"/> 对象获取对应的精灵。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ima">包含精灵包ID和名称的 <see cref="ImageDef"/> 对象。</param>
|
/// <param name="ima">包含精灵名称的 <see cref="ImageDef"/> 对象。</param>
|
||||||
/// <returns>如果找到对应的精灵,则返回该精灵;否则返回 <see cref="defaultSprite"/>。</returns>
|
/// <returns>如果找到对应的精灵,则返回该精灵;否则返回 <see cref="defaultSprite"/>。</returns>
|
||||||
public Sprite GetSprite(ImageDef ima)
|
public Sprite GetSprite(ImageDef ima)
|
||||||
{
|
{
|
||||||
if (ima == null) return defaultSprite;
|
if (ima == null) return defaultSprite;
|
||||||
return GetSprite(ima.packID, ima.name);
|
return GetSprite(ima.packID, ima.defName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据包ID和精灵名称获取对应的精灵。
|
/// 根据包ID和精灵名称获取对应的精灵。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packID">精灵所属的包ID。如果为空,则会遍历所有包查找。</param>
|
/// <param name="packID">精灵所属的包ID。此参数在此版本中已不再用于字典查找,但为保持兼容性而保留。</param>
|
||||||
/// <param name="name">精灵的名称。</param>
|
/// <param name="name">精灵的名称(全局唯一的DefName)。</param>
|
||||||
/// <returns>如果找到对应的精灵,则返回该精灵;否则返回 <see cref="defaultSprite"/>。</returns>
|
/// <returns>如果找到对应的精灵,则返回该精灵;否则返回 <see cref="defaultSprite"/>。</returns>
|
||||||
public Sprite GetSprite(string packID, string name)
|
public Sprite GetSprite(string packID, string name)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(packID))
|
if (sprites.TryGetValue(name, out var sprite))
|
||||||
{
|
return sprite;
|
||||||
// 如果packID为空,遍历所有包以name查找
|
|
||||||
foreach (var kvp in sprites)
|
|
||||||
{
|
|
||||||
if (kvp.Value.TryGetValue(name, out var sprite))
|
|
||||||
return sprite;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (sprites.TryGetValue(packID, out var dict))
|
|
||||||
{
|
|
||||||
if (dict.TryGetValue(name, out var sprite))
|
|
||||||
return sprite;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果未找到,返回默认精灵
|
// 如果未找到,返回默认精灵
|
||||||
return defaultSprite;
|
return defaultSprite;
|
||||||
@ -337,14 +285,40 @@ namespace Managers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据包ID、基础名称和索引获取被分割的子精灵。
|
/// 根据包ID、基础名称和索引获取被分割的子精灵。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packID">精灵所属的包ID。</param>
|
/// <param name="packID">精灵所属的包ID。此参数在此版本中已不再用于字典查找,但为保持兼容性而保留。</param>
|
||||||
/// <param name="name">精灵的基础名称。</param>
|
/// <param name="name">精灵的基础名称(全局唯一的DefName)。</param>
|
||||||
/// <param name="index">子精灵的索引。</param>
|
/// <param name="index">子精灵的索引。</param>
|
||||||
/// <returns>如果找到对应的子精灵,则返回该精灵;否则返回 <see cref="defaultSprite"/>。</returns>
|
/// <returns>如果找到对应的子精灵,则返回该精灵;否则返回 <see cref="defaultSprite"/>。</returns>
|
||||||
public Sprite GetSprite(string packID, string name, int index)
|
public Sprite GetSprite(string packID, string name, int index)
|
||||||
{
|
{
|
||||||
var fullName = $"{name}_{index}";
|
var fullName = $"{name}_{index}";
|
||||||
return GetSprite(packID, fullName);
|
return GetSprite(packID, fullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- 新增的查询接口 ----------
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据精灵名称(全局唯一的DefName)获取对应的精灵。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">精灵的名称。</param>
|
||||||
|
/// <returns>如果找到对应的精灵,则返回该精灵;否则返回 <see cref="defaultSprite"/>。</returns>
|
||||||
|
public Sprite GetSprite(string name)
|
||||||
|
{
|
||||||
|
if (sprites.TryGetValue(name, out var sprite))
|
||||||
|
return sprite;
|
||||||
|
return defaultSprite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据基础名称(全局唯一的DefName)和索引获取被分割的子精灵。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">精灵的基础名称。</param>
|
||||||
|
/// <param name="index">子精灵的索引。</param>
|
||||||
|
/// <returns>如果找到对应的子精灵,则返回该精灵;否则返回 <see cref="defaultSprite"/>。</returns>
|
||||||
|
public Sprite GetSprite(string name, int index)
|
||||||
|
{
|
||||||
|
var fullName = $"{name}_{index}";
|
||||||
|
return GetSprite(fullName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
141
Client/Assets/Scripts/UI/Button3D.cs
Normal file
141
Client/Assets/Scripts/UI/Button3D.cs
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
|
||||||
|
using System.Linq; // 用于可能的LINQ操作,但在此版本中可能不直接使用
|
||||||
|
using TMPro; // 用于 TextMeshPro 组件
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events; // 用于 UnityEvent
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public class Button3D : MonoBehaviour
|
||||||
|
{
|
||||||
|
[Tooltip("当按钮被点击时触发的UnityEvent。可以在Inspector中配置.")]
|
||||||
|
public UnityEvent OnClick;
|
||||||
|
|
||||||
|
public MeshRenderer renderer; // 请确保在Inspector中拖拽赋值
|
||||||
|
public Material outlineMaterial; // 请确保在Inspector中拖拽赋值
|
||||||
|
|
||||||
|
public TMP_Text text; // 文本组件
|
||||||
|
|
||||||
|
private Material[] _originalMaterials; // 用于存储按钮的原始材质,以便正确添加和移除描边
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
if (renderer == null)
|
||||||
|
{
|
||||||
|
Debug.LogError("Button3D: MeshRenderer is not assigned. Please assign it in the Inspector.", this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (outlineMaterial == null)
|
||||||
|
{
|
||||||
|
Debug.LogWarning(
|
||||||
|
"Button3D: Outline Material is not assigned. Outline effect will not work. Please assign it in the Inspector.",
|
||||||
|
this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text == null)
|
||||||
|
{
|
||||||
|
Debug.LogWarning("Button3D: TMP_Text is not assigned. Text features will not work. Please assign it in the Inspector.", this);
|
||||||
|
// 这里不return,允许按钮无文本运行
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 存储原始材质数组,以便在添加和移除描边时正确操作
|
||||||
|
// .ToArray() 是为了确保我们拿到的是拷贝,而不是引用,防止外部意外修改
|
||||||
|
_originalMaterials = renderer.materials.ToArray();
|
||||||
|
|
||||||
|
// 确保初始化时没有边框材质
|
||||||
|
// Important: 调用RemoveOutlineMaterialInternal()可能会清除_originalMaterials,所以要确保先保存
|
||||||
|
RemoveOutlineMaterialInternal(); // 这一步会根据_originalMaterials重新设置renderer.materials
|
||||||
|
|
||||||
|
// 初始时隐藏文本
|
||||||
|
if (text != null)
|
||||||
|
{
|
||||||
|
text.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
// 文本始终朝向摄像机
|
||||||
|
if (text != null && text.IsActive() && Camera.main != null)
|
||||||
|
{
|
||||||
|
text.transform.LookAt(text.transform.position + Camera.main.transform.rotation * Vector3.forward,
|
||||||
|
Camera.main.transform.rotation * Vector3.up);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMouseEnter()
|
||||||
|
{
|
||||||
|
if (renderer == null) return;
|
||||||
|
|
||||||
|
// 鼠标进入时显示文本
|
||||||
|
if (text != null)
|
||||||
|
{
|
||||||
|
text.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果没有描边材质,或者渲染器已经有描边材质,就没必要再添加了
|
||||||
|
// 检查当前材质数组长度是否已经大于等于_originalMaterials的长度+1
|
||||||
|
// 这样可以避免重复添加
|
||||||
|
if (outlineMaterial == null || renderer.materials.Length > _originalMaterials.Length)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果当前材质数组和_originalMaterials不一致,说明可能被其他逻辑修改了,
|
||||||
|
// 稳妥起见,最好先恢复到_originalMaterials
|
||||||
|
if (!renderer.materials.SequenceEqual(_originalMaterials))
|
||||||
|
{
|
||||||
|
//Debug.LogWarning("Button3D: Renderer materials were unexpectedly modified before OnMouseEnter. Restoring original materials.");
|
||||||
|
// 通常不应该发生,除非有其他脚本在修改
|
||||||
|
renderer.materials = _originalMaterials;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建一个新数组,包含原始材质和描边材质
|
||||||
|
Material[] newMaterials = new Material[_originalMaterials.Length + 1];
|
||||||
|
System.Array.Copy(_originalMaterials, newMaterials, _originalMaterials.Length);
|
||||||
|
newMaterials[_originalMaterials.Length] = outlineMaterial;
|
||||||
|
renderer.materials = newMaterials;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMouseExit()
|
||||||
|
{
|
||||||
|
if (renderer == null) return;
|
||||||
|
|
||||||
|
// 鼠标离开时隐藏文本
|
||||||
|
if (text != null)
|
||||||
|
{
|
||||||
|
text.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用内部方法移除边框材质
|
||||||
|
RemoveOutlineMaterialInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMouseDown()
|
||||||
|
{
|
||||||
|
// 触发UnityEvent
|
||||||
|
OnClick.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 移除渲染器上的边框材质(如果存在),恢复到按钮的原始材质。
|
||||||
|
/// </summary>
|
||||||
|
private void RemoveOutlineMaterialInternal()
|
||||||
|
{
|
||||||
|
if (renderer == null) return;
|
||||||
|
// 即使_originalMaterials == null(因为Awake中的LogError),也可以安全赋值空数组
|
||||||
|
// 但如果_originalMaterials确实是null,说明Awake有问题,后续操作也可能继续出错
|
||||||
|
if (_originalMaterials == null)
|
||||||
|
{
|
||||||
|
Debug.LogError("Button3D: _originalMaterials is null. Cannot remove outline. Check Awake method.", this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 直接将渲染器材质恢复为_originalMaterials的副本
|
||||||
|
renderer.materials = _originalMaterials.ToArray(); // 使用ToArray()确保赋值一个副本,避免_originalMaterials被意外修改
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
2
Client/Assets/Scripts/UI/Button3D.cs.meta
Normal file
2
Client/Assets/Scripts/UI/Button3D.cs.meta
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0d5e1709fa6d5c54f93ac068f067e20b
|
8
Client/Assets/Shader.meta
Normal file
8
Client/Assets/Shader.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8d4583fea28dea54cac2f29cde1b99c3
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
910
Client/Assets/Shader/OutlineShader.shadergraph
Normal file
910
Client/Assets/Shader/OutlineShader.shadergraph
Normal file
@ -0,0 +1,910 @@
|
|||||||
|
{
|
||||||
|
"m_SGVersion": 3,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.GraphData",
|
||||||
|
"m_ObjectId": "4c4fc4006449490dbe343b50970f353c",
|
||||||
|
"m_Properties": [
|
||||||
|
{
|
||||||
|
"m_Id": "966cc5eb0a8a4289b76db1c1fb9a20b4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "aee9bea820ab495ebea1fd16e6e4426d"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"m_Keywords": [],
|
||||||
|
"m_Dropdowns": [],
|
||||||
|
"m_CategoryData": [
|
||||||
|
{
|
||||||
|
"m_Id": "77b7ab57f4994f77bc06b85fd1862a13"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"m_Nodes": [
|
||||||
|
{
|
||||||
|
"m_Id": "59a780e466d342afa011b55a3d95b15b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "92c6bf1708bc4eefa9f708ccedf82e7b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "3da1fcb014254517857c0f1757f89dee"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "275d38d75fd947068131f18e2ea8f88b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "9d575cc9818041d0b0b195bdab8bb293"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "cd0010223c1344559b11ffc2f918a831"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "1f4e07b0db3c459b906693c887f3e252"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "d22f0b20543941d4b21cdb5780053b49"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "23cf3544aed047c38359d49bc9bfd39c"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"m_GroupDatas": [],
|
||||||
|
"m_StickyNoteDatas": [],
|
||||||
|
"m_Edges": [
|
||||||
|
{
|
||||||
|
"m_OutputSlot": {
|
||||||
|
"m_Node": {
|
||||||
|
"m_Id": "1f4e07b0db3c459b906693c887f3e252"
|
||||||
|
},
|
||||||
|
"m_SlotId": 2
|
||||||
|
},
|
||||||
|
"m_InputSlot": {
|
||||||
|
"m_Node": {
|
||||||
|
"m_Id": "59a780e466d342afa011b55a3d95b15b"
|
||||||
|
},
|
||||||
|
"m_SlotId": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_OutputSlot": {
|
||||||
|
"m_Node": {
|
||||||
|
"m_Id": "23cf3544aed047c38359d49bc9bfd39c"
|
||||||
|
},
|
||||||
|
"m_SlotId": 0
|
||||||
|
},
|
||||||
|
"m_InputSlot": {
|
||||||
|
"m_Node": {
|
||||||
|
"m_Id": "275d38d75fd947068131f18e2ea8f88b"
|
||||||
|
},
|
||||||
|
"m_SlotId": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_OutputSlot": {
|
||||||
|
"m_Node": {
|
||||||
|
"m_Id": "cd0010223c1344559b11ffc2f918a831"
|
||||||
|
},
|
||||||
|
"m_SlotId": 0
|
||||||
|
},
|
||||||
|
"m_InputSlot": {
|
||||||
|
"m_Node": {
|
||||||
|
"m_Id": "1f4e07b0db3c459b906693c887f3e252"
|
||||||
|
},
|
||||||
|
"m_SlotId": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_OutputSlot": {
|
||||||
|
"m_Node": {
|
||||||
|
"m_Id": "d22f0b20543941d4b21cdb5780053b49"
|
||||||
|
},
|
||||||
|
"m_SlotId": 0
|
||||||
|
},
|
||||||
|
"m_InputSlot": {
|
||||||
|
"m_Node": {
|
||||||
|
"m_Id": "1f4e07b0db3c459b906693c887f3e252"
|
||||||
|
},
|
||||||
|
"m_SlotId": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"m_VertexContext": {
|
||||||
|
"m_Position": {
|
||||||
|
"x": -95.0000228881836,
|
||||||
|
"y": 76.00000762939453
|
||||||
|
},
|
||||||
|
"m_Blocks": [
|
||||||
|
{
|
||||||
|
"m_Id": "59a780e466d342afa011b55a3d95b15b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "92c6bf1708bc4eefa9f708ccedf82e7b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "3da1fcb014254517857c0f1757f89dee"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"m_FragmentContext": {
|
||||||
|
"m_Position": {
|
||||||
|
"x": -95.0000228881836,
|
||||||
|
"y": 286.0000305175781
|
||||||
|
},
|
||||||
|
"m_Blocks": [
|
||||||
|
{
|
||||||
|
"m_Id": "275d38d75fd947068131f18e2ea8f88b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "9d575cc9818041d0b0b195bdab8bb293"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"m_PreviewData": {
|
||||||
|
"serializedMesh": {
|
||||||
|
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
|
||||||
|
"m_Guid": ""
|
||||||
|
},
|
||||||
|
"preventRotation": false
|
||||||
|
},
|
||||||
|
"m_Path": "Shader Graphs",
|
||||||
|
"m_GraphPrecision": 1,
|
||||||
|
"m_PreviewMode": 2,
|
||||||
|
"m_OutputNode": {
|
||||||
|
"m_Id": ""
|
||||||
|
},
|
||||||
|
"m_SubDatas": [],
|
||||||
|
"m_ActiveTargets": [
|
||||||
|
{
|
||||||
|
"m_Id": "4cc1a064f7874a9b8aa521d595d5092d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot",
|
||||||
|
"m_ObjectId": "17ef39b9aa3f4f9b9b545bd0a4d867f5",
|
||||||
|
"m_Id": 0,
|
||||||
|
"m_DisplayName": "Color",
|
||||||
|
"m_SlotType": 1,
|
||||||
|
"m_Hidden": false,
|
||||||
|
"m_ShaderOutputName": "Out",
|
||||||
|
"m_StageCapability": 3,
|
||||||
|
"m_Value": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0,
|
||||||
|
"w": 0.0
|
||||||
|
},
|
||||||
|
"m_DefaultValue": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0,
|
||||||
|
"w": 0.0
|
||||||
|
},
|
||||||
|
"m_Labels": []
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.MultiplyNode",
|
||||||
|
"m_ObjectId": "1f4e07b0db3c459b906693c887f3e252",
|
||||||
|
"m_Group": {
|
||||||
|
"m_Id": ""
|
||||||
|
},
|
||||||
|
"m_Name": "Multiply",
|
||||||
|
"m_DrawState": {
|
||||||
|
"m_Expanded": true,
|
||||||
|
"m_Position": {
|
||||||
|
"serializedVersion": "2",
|
||||||
|
"x": -329.0,
|
||||||
|
"y": 76.0,
|
||||||
|
"width": 208.0,
|
||||||
|
"height": 302.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"m_Slots": [
|
||||||
|
{
|
||||||
|
"m_Id": "a89ab5333ae449e59da03aa1ab9d9022"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "32a29b201337425ea089343d5247233d"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "6785395363af428fbc58da381fe55359"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"synonyms": [
|
||||||
|
"multiplication",
|
||||||
|
"times",
|
||||||
|
"x"
|
||||||
|
],
|
||||||
|
"m_Precision": 0,
|
||||||
|
"m_PreviewExpanded": false,
|
||||||
|
"m_DismissedVersion": 0,
|
||||||
|
"m_PreviewMode": 0,
|
||||||
|
"m_CustomColors": {
|
||||||
|
"m_SerializableColors": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
|
||||||
|
"m_ObjectId": "23cf3544aed047c38359d49bc9bfd39c",
|
||||||
|
"m_Group": {
|
||||||
|
"m_Id": ""
|
||||||
|
},
|
||||||
|
"m_Name": "Property",
|
||||||
|
"m_DrawState": {
|
||||||
|
"m_Expanded": true,
|
||||||
|
"m_Position": {
|
||||||
|
"serializedVersion": "2",
|
||||||
|
"x": -251.00001525878907,
|
||||||
|
"y": 325.0,
|
||||||
|
"width": 105.0,
|
||||||
|
"height": 34.000030517578128
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"m_Slots": [
|
||||||
|
{
|
||||||
|
"m_Id": "17ef39b9aa3f4f9b9b545bd0a4d867f5"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"synonyms": [],
|
||||||
|
"m_Precision": 0,
|
||||||
|
"m_PreviewExpanded": true,
|
||||||
|
"m_DismissedVersion": 0,
|
||||||
|
"m_PreviewMode": 0,
|
||||||
|
"m_CustomColors": {
|
||||||
|
"m_SerializableColors": []
|
||||||
|
},
|
||||||
|
"m_Property": {
|
||||||
|
"m_Id": "aee9bea820ab495ebea1fd16e6e4426d"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||||
|
"m_ObjectId": "275d38d75fd947068131f18e2ea8f88b",
|
||||||
|
"m_Group": {
|
||||||
|
"m_Id": ""
|
||||||
|
},
|
||||||
|
"m_Name": "SurfaceDescription.BaseColor",
|
||||||
|
"m_DrawState": {
|
||||||
|
"m_Expanded": true,
|
||||||
|
"m_Position": {
|
||||||
|
"serializedVersion": "2",
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"width": 0.0,
|
||||||
|
"height": 0.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"m_Slots": [
|
||||||
|
{
|
||||||
|
"m_Id": "64edbafd8dfd47a2ad97435827012ad2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"synonyms": [],
|
||||||
|
"m_Precision": 0,
|
||||||
|
"m_PreviewExpanded": true,
|
||||||
|
"m_DismissedVersion": 0,
|
||||||
|
"m_PreviewMode": 0,
|
||||||
|
"m_CustomColors": {
|
||||||
|
"m_SerializableColors": []
|
||||||
|
},
|
||||||
|
"m_SerializedDescriptor": "SurfaceDescription.BaseColor"
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot",
|
||||||
|
"m_ObjectId": "32a29b201337425ea089343d5247233d",
|
||||||
|
"m_Id": 1,
|
||||||
|
"m_DisplayName": "B",
|
||||||
|
"m_SlotType": 0,
|
||||||
|
"m_Hidden": false,
|
||||||
|
"m_ShaderOutputName": "B",
|
||||||
|
"m_StageCapability": 3,
|
||||||
|
"m_Value": {
|
||||||
|
"e00": 2.0,
|
||||||
|
"e01": 2.0,
|
||||||
|
"e02": 2.0,
|
||||||
|
"e03": 2.0,
|
||||||
|
"e10": 2.0,
|
||||||
|
"e11": 2.0,
|
||||||
|
"e12": 2.0,
|
||||||
|
"e13": 2.0,
|
||||||
|
"e20": 2.0,
|
||||||
|
"e21": 2.0,
|
||||||
|
"e22": 2.0,
|
||||||
|
"e23": 2.0,
|
||||||
|
"e30": 2.0,
|
||||||
|
"e31": 2.0,
|
||||||
|
"e32": 2.0,
|
||||||
|
"e33": 2.0
|
||||||
|
},
|
||||||
|
"m_DefaultValue": {
|
||||||
|
"e00": 1.0,
|
||||||
|
"e01": 0.0,
|
||||||
|
"e02": 0.0,
|
||||||
|
"e03": 0.0,
|
||||||
|
"e10": 0.0,
|
||||||
|
"e11": 1.0,
|
||||||
|
"e12": 0.0,
|
||||||
|
"e13": 0.0,
|
||||||
|
"e20": 0.0,
|
||||||
|
"e21": 0.0,
|
||||||
|
"e22": 1.0,
|
||||||
|
"e23": 0.0,
|
||||||
|
"e30": 0.0,
|
||||||
|
"e31": 0.0,
|
||||||
|
"e32": 0.0,
|
||||||
|
"e33": 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||||
|
"m_ObjectId": "3da1fcb014254517857c0f1757f89dee",
|
||||||
|
"m_Group": {
|
||||||
|
"m_Id": ""
|
||||||
|
},
|
||||||
|
"m_Name": "VertexDescription.Tangent",
|
||||||
|
"m_DrawState": {
|
||||||
|
"m_Expanded": true,
|
||||||
|
"m_Position": {
|
||||||
|
"serializedVersion": "2",
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"width": 0.0,
|
||||||
|
"height": 0.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"m_Slots": [
|
||||||
|
{
|
||||||
|
"m_Id": "b4c90de2ecc947c0ba37d42e034cb369"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"synonyms": [],
|
||||||
|
"m_Precision": 0,
|
||||||
|
"m_PreviewExpanded": true,
|
||||||
|
"m_DismissedVersion": 0,
|
||||||
|
"m_PreviewMode": 0,
|
||||||
|
"m_CustomColors": {
|
||||||
|
"m_SerializableColors": []
|
||||||
|
},
|
||||||
|
"m_SerializedDescriptor": "VertexDescription.Tangent"
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 1,
|
||||||
|
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget",
|
||||||
|
"m_ObjectId": "4cc1a064f7874a9b8aa521d595d5092d",
|
||||||
|
"m_Datas": [],
|
||||||
|
"m_ActiveSubTarget": {
|
||||||
|
"m_Id": "7d6d58b2f6734a4fa425de949a55a7c4"
|
||||||
|
},
|
||||||
|
"m_AllowMaterialOverride": false,
|
||||||
|
"m_SurfaceType": 1,
|
||||||
|
"m_ZTestMode": 4,
|
||||||
|
"m_ZWriteControl": 0,
|
||||||
|
"m_AlphaMode": 0,
|
||||||
|
"m_RenderFace": 1,
|
||||||
|
"m_AlphaClip": false,
|
||||||
|
"m_CastShadows": true,
|
||||||
|
"m_ReceiveShadows": true,
|
||||||
|
"m_DisableTint": false,
|
||||||
|
"m_AdditionalMotionVectorMode": 0,
|
||||||
|
"m_AlembicMotionVectors": false,
|
||||||
|
"m_SupportsLODCrossFade": false,
|
||||||
|
"m_CustomEditorGUI": "",
|
||||||
|
"m_SupportVFX": false
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||||
|
"m_ObjectId": "59a780e466d342afa011b55a3d95b15b",
|
||||||
|
"m_Group": {
|
||||||
|
"m_Id": ""
|
||||||
|
},
|
||||||
|
"m_Name": "VertexDescription.Position",
|
||||||
|
"m_DrawState": {
|
||||||
|
"m_Expanded": true,
|
||||||
|
"m_Position": {
|
||||||
|
"serializedVersion": "2",
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"width": 0.0,
|
||||||
|
"height": 0.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"m_Slots": [
|
||||||
|
{
|
||||||
|
"m_Id": "673631bf98b24d6a9c127d8c2bbe71bc"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"synonyms": [],
|
||||||
|
"m_Precision": 0,
|
||||||
|
"m_PreviewExpanded": true,
|
||||||
|
"m_DismissedVersion": 0,
|
||||||
|
"m_PreviewMode": 0,
|
||||||
|
"m_CustomColors": {
|
||||||
|
"m_SerializableColors": []
|
||||||
|
},
|
||||||
|
"m_SerializedDescriptor": "VertexDescription.Position"
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
|
||||||
|
"m_ObjectId": "64edbafd8dfd47a2ad97435827012ad2",
|
||||||
|
"m_Id": 0,
|
||||||
|
"m_DisplayName": "Base Color",
|
||||||
|
"m_SlotType": 0,
|
||||||
|
"m_Hidden": false,
|
||||||
|
"m_ShaderOutputName": "BaseColor",
|
||||||
|
"m_StageCapability": 2,
|
||||||
|
"m_Value": {
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 0.5,
|
||||||
|
"z": 0.5
|
||||||
|
},
|
||||||
|
"m_DefaultValue": {
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 0.5,
|
||||||
|
"z": 0.5
|
||||||
|
},
|
||||||
|
"m_Labels": [],
|
||||||
|
"m_ColorMode": 0,
|
||||||
|
"m_DefaultColor": {
|
||||||
|
"r": 0.5,
|
||||||
|
"g": 0.5,
|
||||||
|
"b": 0.5,
|
||||||
|
"a": 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot",
|
||||||
|
"m_ObjectId": "673631bf98b24d6a9c127d8c2bbe71bc",
|
||||||
|
"m_Id": 0,
|
||||||
|
"m_DisplayName": "Position",
|
||||||
|
"m_SlotType": 0,
|
||||||
|
"m_Hidden": false,
|
||||||
|
"m_ShaderOutputName": "Position",
|
||||||
|
"m_StageCapability": 1,
|
||||||
|
"m_Value": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"m_DefaultValue": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"m_Labels": [],
|
||||||
|
"m_Space": 0
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot",
|
||||||
|
"m_ObjectId": "6785395363af428fbc58da381fe55359",
|
||||||
|
"m_Id": 2,
|
||||||
|
"m_DisplayName": "Out",
|
||||||
|
"m_SlotType": 1,
|
||||||
|
"m_Hidden": false,
|
||||||
|
"m_ShaderOutputName": "Out",
|
||||||
|
"m_StageCapability": 3,
|
||||||
|
"m_Value": {
|
||||||
|
"e00": 0.0,
|
||||||
|
"e01": 0.0,
|
||||||
|
"e02": 0.0,
|
||||||
|
"e03": 0.0,
|
||||||
|
"e10": 0.0,
|
||||||
|
"e11": 0.0,
|
||||||
|
"e12": 0.0,
|
||||||
|
"e13": 0.0,
|
||||||
|
"e20": 0.0,
|
||||||
|
"e21": 0.0,
|
||||||
|
"e22": 0.0,
|
||||||
|
"e23": 0.0,
|
||||||
|
"e30": 0.0,
|
||||||
|
"e31": 0.0,
|
||||||
|
"e32": 0.0,
|
||||||
|
"e33": 0.0
|
||||||
|
},
|
||||||
|
"m_DefaultValue": {
|
||||||
|
"e00": 1.0,
|
||||||
|
"e01": 0.0,
|
||||||
|
"e02": 0.0,
|
||||||
|
"e03": 0.0,
|
||||||
|
"e10": 0.0,
|
||||||
|
"e11": 1.0,
|
||||||
|
"e12": 0.0,
|
||||||
|
"e13": 0.0,
|
||||||
|
"e20": 0.0,
|
||||||
|
"e21": 0.0,
|
||||||
|
"e22": 1.0,
|
||||||
|
"e23": 0.0,
|
||||||
|
"e30": 0.0,
|
||||||
|
"e31": 0.0,
|
||||||
|
"e32": 0.0,
|
||||||
|
"e33": 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.CategoryData",
|
||||||
|
"m_ObjectId": "77b7ab57f4994f77bc06b85fd1862a13",
|
||||||
|
"m_Name": "",
|
||||||
|
"m_ChildObjectList": [
|
||||||
|
{
|
||||||
|
"m_Id": "966cc5eb0a8a4289b76db1c1fb9a20b4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"m_Id": "aee9bea820ab495ebea1fd16e6e4426d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 2,
|
||||||
|
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalUnlitSubTarget",
|
||||||
|
"m_ObjectId": "7d6d58b2f6734a4fa425de949a55a7c4"
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot",
|
||||||
|
"m_ObjectId": "8169db28379542af9cdd62d5a1b89de0",
|
||||||
|
"m_Id": 0,
|
||||||
|
"m_DisplayName": "Normal",
|
||||||
|
"m_SlotType": 0,
|
||||||
|
"m_Hidden": false,
|
||||||
|
"m_ShaderOutputName": "Normal",
|
||||||
|
"m_StageCapability": 1,
|
||||||
|
"m_Value": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"m_DefaultValue": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"m_Labels": [],
|
||||||
|
"m_Space": 0
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||||
|
"m_ObjectId": "92c6bf1708bc4eefa9f708ccedf82e7b",
|
||||||
|
"m_Group": {
|
||||||
|
"m_Id": ""
|
||||||
|
},
|
||||||
|
"m_Name": "VertexDescription.Normal",
|
||||||
|
"m_DrawState": {
|
||||||
|
"m_Expanded": true,
|
||||||
|
"m_Position": {
|
||||||
|
"serializedVersion": "2",
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"width": 0.0,
|
||||||
|
"height": 0.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"m_Slots": [
|
||||||
|
{
|
||||||
|
"m_Id": "8169db28379542af9cdd62d5a1b89de0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"synonyms": [],
|
||||||
|
"m_Precision": 0,
|
||||||
|
"m_PreviewExpanded": true,
|
||||||
|
"m_DismissedVersion": 0,
|
||||||
|
"m_PreviewMode": 0,
|
||||||
|
"m_CustomColors": {
|
||||||
|
"m_SerializableColors": []
|
||||||
|
},
|
||||||
|
"m_SerializedDescriptor": "VertexDescription.Normal"
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||||
|
"m_ObjectId": "936f470cf96b4c65a1750ba068d23d51",
|
||||||
|
"m_Id": 0,
|
||||||
|
"m_DisplayName": "Alpha",
|
||||||
|
"m_SlotType": 0,
|
||||||
|
"m_Hidden": false,
|
||||||
|
"m_ShaderOutputName": "Alpha",
|
||||||
|
"m_StageCapability": 2,
|
||||||
|
"m_Value": 1.0,
|
||||||
|
"m_DefaultValue": 1.0,
|
||||||
|
"m_Labels": []
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 1,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty",
|
||||||
|
"m_ObjectId": "966cc5eb0a8a4289b76db1c1fb9a20b4",
|
||||||
|
"m_Guid": {
|
||||||
|
"m_GuidSerialized": "05553a18-36ca-4f4b-8dcb-3d0622846b4c"
|
||||||
|
},
|
||||||
|
"m_Name": "Scale",
|
||||||
|
"m_DefaultRefNameVersion": 1,
|
||||||
|
"m_RefNameGeneratedByDisplayName": "Scale",
|
||||||
|
"m_DefaultReferenceName": "_Scale",
|
||||||
|
"m_OverrideReferenceName": "",
|
||||||
|
"m_GeneratePropertyBlock": true,
|
||||||
|
"m_UseCustomSlotLabel": false,
|
||||||
|
"m_CustomSlotLabel": "",
|
||||||
|
"m_DismissedVersion": 0,
|
||||||
|
"m_Precision": 0,
|
||||||
|
"overrideHLSLDeclaration": false,
|
||||||
|
"hlslDeclarationOverride": 0,
|
||||||
|
"m_Hidden": false,
|
||||||
|
"m_Value": 0.0,
|
||||||
|
"m_FloatType": 0,
|
||||||
|
"m_RangeValues": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||||
|
"m_ObjectId": "9d575cc9818041d0b0b195bdab8bb293",
|
||||||
|
"m_Group": {
|
||||||
|
"m_Id": ""
|
||||||
|
},
|
||||||
|
"m_Name": "SurfaceDescription.Alpha",
|
||||||
|
"m_DrawState": {
|
||||||
|
"m_Expanded": true,
|
||||||
|
"m_Position": {
|
||||||
|
"serializedVersion": "2",
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"width": 0.0,
|
||||||
|
"height": 0.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"m_Slots": [
|
||||||
|
{
|
||||||
|
"m_Id": "936f470cf96b4c65a1750ba068d23d51"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"synonyms": [],
|
||||||
|
"m_Precision": 0,
|
||||||
|
"m_PreviewExpanded": true,
|
||||||
|
"m_DismissedVersion": 0,
|
||||||
|
"m_PreviewMode": 0,
|
||||||
|
"m_CustomColors": {
|
||||||
|
"m_SerializableColors": []
|
||||||
|
},
|
||||||
|
"m_SerializedDescriptor": "SurfaceDescription.Alpha"
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot",
|
||||||
|
"m_ObjectId": "a89ab5333ae449e59da03aa1ab9d9022",
|
||||||
|
"m_Id": 0,
|
||||||
|
"m_DisplayName": "A",
|
||||||
|
"m_SlotType": 0,
|
||||||
|
"m_Hidden": false,
|
||||||
|
"m_ShaderOutputName": "A",
|
||||||
|
"m_StageCapability": 3,
|
||||||
|
"m_Value": {
|
||||||
|
"e00": 0.0,
|
||||||
|
"e01": 0.0,
|
||||||
|
"e02": 0.0,
|
||||||
|
"e03": 0.0,
|
||||||
|
"e10": 0.0,
|
||||||
|
"e11": 0.0,
|
||||||
|
"e12": 0.0,
|
||||||
|
"e13": 0.0,
|
||||||
|
"e20": 0.0,
|
||||||
|
"e21": 0.0,
|
||||||
|
"e22": 0.0,
|
||||||
|
"e23": 0.0,
|
||||||
|
"e30": 0.0,
|
||||||
|
"e31": 0.0,
|
||||||
|
"e32": 0.0,
|
||||||
|
"e33": 0.0
|
||||||
|
},
|
||||||
|
"m_DefaultValue": {
|
||||||
|
"e00": 1.0,
|
||||||
|
"e01": 0.0,
|
||||||
|
"e02": 0.0,
|
||||||
|
"e03": 0.0,
|
||||||
|
"e10": 0.0,
|
||||||
|
"e11": 1.0,
|
||||||
|
"e12": 0.0,
|
||||||
|
"e13": 0.0,
|
||||||
|
"e20": 0.0,
|
||||||
|
"e21": 0.0,
|
||||||
|
"e22": 1.0,
|
||||||
|
"e23": 0.0,
|
||||||
|
"e30": 0.0,
|
||||||
|
"e31": 0.0,
|
||||||
|
"e32": 0.0,
|
||||||
|
"e33": 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 3,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.Internal.ColorShaderProperty",
|
||||||
|
"m_ObjectId": "aee9bea820ab495ebea1fd16e6e4426d",
|
||||||
|
"m_Guid": {
|
||||||
|
"m_GuidSerialized": "79218567-43f6-4d23-b803-a064a7a527b0"
|
||||||
|
},
|
||||||
|
"m_Name": "Color",
|
||||||
|
"m_DefaultRefNameVersion": 1,
|
||||||
|
"m_RefNameGeneratedByDisplayName": "Color",
|
||||||
|
"m_DefaultReferenceName": "_Color",
|
||||||
|
"m_OverrideReferenceName": "",
|
||||||
|
"m_GeneratePropertyBlock": true,
|
||||||
|
"m_UseCustomSlotLabel": false,
|
||||||
|
"m_CustomSlotLabel": "",
|
||||||
|
"m_DismissedVersion": 0,
|
||||||
|
"m_Precision": 0,
|
||||||
|
"overrideHLSLDeclaration": false,
|
||||||
|
"hlslDeclarationOverride": 0,
|
||||||
|
"m_Hidden": false,
|
||||||
|
"m_Value": {
|
||||||
|
"r": 0.0,
|
||||||
|
"g": 0.0,
|
||||||
|
"b": 0.0,
|
||||||
|
"a": 1.0
|
||||||
|
},
|
||||||
|
"isMainColor": false,
|
||||||
|
"m_ColorMode": 1
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot",
|
||||||
|
"m_ObjectId": "b4c90de2ecc947c0ba37d42e034cb369",
|
||||||
|
"m_Id": 0,
|
||||||
|
"m_DisplayName": "Tangent",
|
||||||
|
"m_SlotType": 0,
|
||||||
|
"m_Hidden": false,
|
||||||
|
"m_ShaderOutputName": "Tangent",
|
||||||
|
"m_StageCapability": 1,
|
||||||
|
"m_Value": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"m_DefaultValue": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"m_Labels": [],
|
||||||
|
"m_Space": 0
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 1,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.PositionNode",
|
||||||
|
"m_ObjectId": "cd0010223c1344559b11ffc2f918a831",
|
||||||
|
"m_Group": {
|
||||||
|
"m_Id": ""
|
||||||
|
},
|
||||||
|
"m_Name": "Position",
|
||||||
|
"m_DrawState": {
|
||||||
|
"m_Expanded": true,
|
||||||
|
"m_Position": {
|
||||||
|
"serializedVersion": "2",
|
||||||
|
"x": -596.0,
|
||||||
|
"y": 123.00000762939453,
|
||||||
|
"width": 208.00003051757813,
|
||||||
|
"height": 314.00006103515627
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"m_Slots": [
|
||||||
|
{
|
||||||
|
"m_Id": "d1f1ce54627b45e1856f7d362b461a97"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"synonyms": [
|
||||||
|
"location"
|
||||||
|
],
|
||||||
|
"m_Precision": 1,
|
||||||
|
"m_PreviewExpanded": true,
|
||||||
|
"m_DismissedVersion": 0,
|
||||||
|
"m_PreviewMode": 2,
|
||||||
|
"m_CustomColors": {
|
||||||
|
"m_SerializableColors": []
|
||||||
|
},
|
||||||
|
"m_Space": 0,
|
||||||
|
"m_PositionSource": 0
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
|
||||||
|
"m_ObjectId": "d1f1ce54627b45e1856f7d362b461a97",
|
||||||
|
"m_Id": 0,
|
||||||
|
"m_DisplayName": "Out",
|
||||||
|
"m_SlotType": 1,
|
||||||
|
"m_Hidden": false,
|
||||||
|
"m_ShaderOutputName": "Out",
|
||||||
|
"m_StageCapability": 3,
|
||||||
|
"m_Value": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"m_DefaultValue": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"m_Labels": []
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
|
||||||
|
"m_ObjectId": "d22f0b20543941d4b21cdb5780053b49",
|
||||||
|
"m_Group": {
|
||||||
|
"m_Id": ""
|
||||||
|
},
|
||||||
|
"m_Name": "Property",
|
||||||
|
"m_DrawState": {
|
||||||
|
"m_Expanded": true,
|
||||||
|
"m_Position": {
|
||||||
|
"serializedVersion": "2",
|
||||||
|
"x": -492.0,
|
||||||
|
"y": 89.0,
|
||||||
|
"width": 104.00003051757813,
|
||||||
|
"height": 34.00000762939453
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"m_Slots": [
|
||||||
|
{
|
||||||
|
"m_Id": "d7622898365f4568be7c6a1fd7941832"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"synonyms": [],
|
||||||
|
"m_Precision": 0,
|
||||||
|
"m_PreviewExpanded": true,
|
||||||
|
"m_DismissedVersion": 0,
|
||||||
|
"m_PreviewMode": 0,
|
||||||
|
"m_CustomColors": {
|
||||||
|
"m_SerializableColors": []
|
||||||
|
},
|
||||||
|
"m_Property": {
|
||||||
|
"m_Id": "966cc5eb0a8a4289b76db1c1fb9a20b4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"m_SGVersion": 0,
|
||||||
|
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||||
|
"m_ObjectId": "d7622898365f4568be7c6a1fd7941832",
|
||||||
|
"m_Id": 0,
|
||||||
|
"m_DisplayName": "Scale",
|
||||||
|
"m_SlotType": 1,
|
||||||
|
"m_Hidden": false,
|
||||||
|
"m_ShaderOutputName": "Out",
|
||||||
|
"m_StageCapability": 3,
|
||||||
|
"m_Value": 0.0,
|
||||||
|
"m_DefaultValue": 0.0,
|
||||||
|
"m_Labels": []
|
||||||
|
}
|
||||||
|
|
10
Client/Assets/Shader/OutlineShader.shadergraph.meta
Normal file
10
Client/Assets/Shader/OutlineShader.shadergraph.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 11268f83bf2cc2447b1f0e995112ca43
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
60
Client/Assets/Shader/Shader Graphs_OutlineShader.mat
Normal file
60
Client/Assets/Shader/Shader Graphs_OutlineShader.mat
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &-2119912562947499068
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 11
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
version: 10
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 8
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Shader Graphs_OutlineShader
|
||||||
|
m_Shader: {fileID: -6465566751694194690, guid: 11268f83bf2cc2447b1f0e995112ca43, type: 3}
|
||||||
|
m_Parent: {fileID: 0}
|
||||||
|
m_ModifiedSerializedProperties: 0
|
||||||
|
m_ValidKeywords: []
|
||||||
|
m_InvalidKeywords: []
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap: {}
|
||||||
|
disabledShaderPasses:
|
||||||
|
- MOTIONVECTORS
|
||||||
|
m_LockedProperties:
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- unity_Lightmaps:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_LightmapsInd:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_ShadowMasks:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Ints: []
|
||||||
|
m_Floats:
|
||||||
|
- _QueueControl: 0
|
||||||
|
- _QueueOffset: 0
|
||||||
|
- _Scale: 1.05
|
||||||
|
m_Colors:
|
||||||
|
- _Color: {r: 1.8490566, g: 1.6566842, b: 0.61925954, a: 1}
|
||||||
|
m_BuildTextureStacks: []
|
||||||
|
m_AllowLocking: 1
|
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7b32baf03e8f4bd448cf625f4299f5ce
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 2100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Reference in New Issue
Block a user