diff --git a/Assets/Resources/Art/Fix/Stone/身体维修界面.psb.meta b/Assets/Resources/Art/Fix/Stone/身体维修界面.psb.meta index c1e64d915..cfcb1a74f 100644 --- a/Assets/Resources/Art/Fix/Stone/身体维修界面.psb.meta +++ b/Assets/Resources/Art/Fix/Stone/身体维修界面.psb.meta @@ -32,7 +32,7 @@ ScriptedImporter: sRGBTexture: 1 spriteMode: 2 spriteExtrude: 1 - spriteMeshType: 1 + spriteMeshType: 0 alignment: 0 spritePivot: {x: 0.5, y: 0.5} spritePixelsToUnits: 200 @@ -390,8 +390,8 @@ ScriptedImporter: spritePosition: {x: 1172, y: 548} - name: "\u6CB9\u95E8" originalName: - pivot: {x: 0.5, y: 0.5} - alignment: 0 + pivot: {x: 1, y: 0} + alignment: 8 border: {x: 0, y: 0, z: 0, w: 0} rect: serializedVersion: 2 @@ -453,9 +453,9 @@ ScriptedImporter: spritePosition: {x: 920, y: 1372} - name: "\u55B7\u6CB9\u5EA6\u91CF" originalName: - pivot: {x: 0.5, y: 0.5} - alignment: 0 - border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0} + alignment: 7 + border: {x: 0, y: 8, z: 0, w: 8} rect: serializedVersion: 2 x: 3998 @@ -474,9 +474,9 @@ ScriptedImporter: spritePosition: {x: 1287, y: 1618} - name: "\u8FDB\u6C14\u5EA6\u91CF" originalName: - pivot: {x: 0.5, y: 0.5} - alignment: 0 - border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0.5, y: 0} + alignment: 7 + border: {x: 0, y: 8, z: 0, w: 9} rect: serializedVersion: 2 x: 4022 diff --git a/Assets/Scenes/ExpressFixScene.unity b/Assets/Scenes/ExpressFixScene.unity index 67be65987..42d698e3a 100644 --- a/Assets/Scenes/ExpressFixScene.unity +++ b/Assets/Scenes/ExpressFixScene.unity @@ -982,136 +982,6 @@ Transform: m_Children: [] m_Father: {fileID: 657112469} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &420163262 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 420163263} - - component: {fileID: 420163265} - - component: {fileID: 420163264} - m_Layer: 0 - m_Name: Down - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &420163263 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 420163262} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 2.004, y: -2.757, z: 0} - m_LocalScale: {x: 0.798, y: 0.3687, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 551825977} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!61 &420163264 -BoxCollider2D: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 420163262} - m_Enabled: 1 - m_Density: 1 - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_ForceSendLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_ForceReceiveLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_ContactCaptureLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_CallbackLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_IsTrigger: 0 - m_UsedByEffector: 0 - m_UsedByComposite: 0 - m_Offset: {x: 0, y: 0} - m_SpriteTilingProperty: - border: {x: 0, y: 0, z: 0, w: 0} - pivot: {x: 0.5, y: 0.5} - oldSize: {x: 1, y: 1} - newSize: {x: 1, y: 1} - adaptiveTilingThreshold: 0.5 - drawMode: 0 - adaptiveTiling: 0 - m_AutoTiling: 0 - serializedVersion: 2 - m_Size: {x: 1, y: 1} - m_EdgeRadius: 0 ---- !u!212 &420163265 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 420163262} - 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: 0 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 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: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 1, y: 1} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 --- !u!1 &463110380 GameObject: m_ObjectHideFlags: 0 @@ -1184,7 +1054,7 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 2 + m_SortingOrder: 6 m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} m_Color: {r: 1, g: 0, b: 0, a: 1} m_FlipX: 0 @@ -1269,13 +1139,15 @@ GameObject: m_Component: - component: {fileID: 551825977} - component: {fileID: 551825978} + - component: {fileID: 551825980} + - component: {fileID: 551825979} m_Layer: 0 m_Name: Air Gate - m_TagString: Untagged + m_TagString: Moveable m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!4 &551825977 Transform: m_ObjectHideFlags: 0 @@ -1285,12 +1157,10 @@ Transform: m_GameObject: {fileID: 551825976} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: -1.472, y: 0.19, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 626092707} - - {fileID: 420163263} + m_Children: [] m_Father: {fileID: 1112213369} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &551825978 @@ -1305,130 +1175,15 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4cba880bf0a3caf41b1d03057b9c01b1, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!1 &617420340 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 617420341} - - component: {fileID: 617420342} - m_Layer: 0 - m_Name: Pointer - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &617420341 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 617420340} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.0228, y: -2.95, z: 0} - m_LocalScale: {x: 0.3117446, y: 0.03467707, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 2019900043} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &617420342 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 617420340} - 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: 0 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 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: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 2 - m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} - m_Color: {r: 0, g: 0.16862059, b: 1, a: 1} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 1, y: 1} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 ---- !u!1 &626092706 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 626092707} - - component: {fileID: 626092709} - - component: {fileID: 626092708} - m_Layer: 0 - m_Name: Up - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &626092707 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 626092706} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 2.004, y: -2.227, z: 0} - m_LocalScale: {x: 0.798, y: 0.3687, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 551825977} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!61 &626092708 + maxY: 0.84 + minY: 0.19 +--- !u!61 &551825979 BoxCollider2D: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 626092706} + m_GameObject: {fileID: 551825976} m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} @@ -1458,22 +1213,22 @@ BoxCollider2D: m_SpriteTilingProperty: border: {x: 0, y: 0, z: 0, w: 0} pivot: {x: 0.5, y: 0.5} - oldSize: {x: 1, y: 1} - newSize: {x: 1, y: 1} + oldSize: {x: 0.53, y: 0.14} + newSize: {x: 0.53, y: 0.14} adaptiveTilingThreshold: 0.5 drawMode: 0 adaptiveTiling: 0 m_AutoTiling: 0 serializedVersion: 2 - m_Size: {x: 1, y: 1} + m_Size: {x: 0.53, y: 0.14} m_EdgeRadius: 0 ---- !u!212 &626092709 +--- !u!212 &551825980 SpriteRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 626092706} + m_GameObject: {fileID: 551825976} m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 @@ -1507,18 +1262,62 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 0 - m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} + m_SortingOrder: 4 + m_Sprite: {fileID: 7332487271438153921, guid: 6de0a74e5b5268b4998dc7a5c687fb95, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 1, y: 1} + m_Size: {x: 0.53, y: 0.14} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &574939131 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 574939132} + - component: {fileID: 574939133} + m_Layer: 0 + m_Name: Moveable System + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &574939132 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 574939131} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1874453573} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &574939133 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 574939131} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d755460ba0142f39c5677d8f948c777, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &650606349 GameObject: m_ObjectHideFlags: 0 @@ -1958,6 +1757,90 @@ MonoBehaviour: m_FirstSelected: {fileID: 0} m_sendNavigationEvents: 1 m_DragThreshold: 10 +--- !u!1 &796145091 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 796145092} + - component: {fileID: 796145093} + m_Layer: 0 + m_Name: Min Pointer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &796145092 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 796145091} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.00352, y: 0.00392, z: 0} + m_LocalScale: {x: 0.20462403, y: 0.02083913, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1691014403} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &796145093 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 796145091} + 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: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 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: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 3 + m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} + m_Color: {r: 0, g: 0.039215688, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &801129889 GameObject: m_ObjectHideFlags: 0 @@ -2113,7 +1996,7 @@ Transform: m_GameObject: {fileID: 863998404} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.844, y: 0.759, z: 0} + m_LocalPosition: {x: -0.848, y: 0.156, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -2171,12 +2054,12 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 3 + m_SortingOrder: 4 m_Sprite: {fileID: -7430884138805397470, guid: 6de0a74e5b5268b4998dc7a5c687fb95, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 - m_DrawMode: 0 + m_DrawMode: 1 m_Size: {x: 0.08, y: 1.215} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 @@ -2199,7 +2082,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!4 &885292092 Transform: m_ObjectHideFlags: 0 @@ -2209,7 +2092,7 @@ Transform: m_GameObject: {fileID: 885292091} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 7.19, y: -1.82, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: @@ -2303,7 +2186,7 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 1 + m_SortingOrder: 5 m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 @@ -2780,7 +2663,7 @@ Transform: m_GameObject: {fileID: 1104267850} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: -15, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: @@ -2822,7 +2705,6 @@ Transform: m_Children: - {fileID: 1964529542} - {fileID: 1691014403} - - {fileID: 2019900043} - {fileID: 863998405} - {fileID: 885292092} - {fileID: 1537489913} @@ -2897,11 +2779,18 @@ MonoBehaviour: oilUpRatio: 0.25 acceleratedSpeed: 1 resistance: 0.5 - airMaxRatio: 0.2 - airMinRatio: 0.1 + airMaxRatio: 1 + airMinRatio: 0.9 baseAirMax: 0.3 maxLevel: 5 ---- !u!1 &1170012391 + engineData: + curSpeed: 0 + curOil: 0 + curAir: 0 + curAirMin: 0 + curAirMax: 0 + curAirLevel: 0 +--- !u!1 &1172578103 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -2909,37 +2798,37 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 1170012392} - - component: {fileID: 1170012393} + - component: {fileID: 1172578104} + - component: {fileID: 1172578105} m_Layer: 0 - m_Name: Dial Plate + m_Name: Max Pointer m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &1170012392 +--- !u!4 &1172578104 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1170012391} + m_GameObject: {fileID: 1172578103} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.0129, y: -2.6655, z: 0} - m_LocalScale: {x: 0.33484638, y: 0.65489244, z: 1} + m_LocalPosition: {x: 0.00274, y: 0.00274, z: 0} + m_LocalScale: {x: 0.20112549, y: 0.01848743, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 2019900043} + m_Father: {fileID: 1691014403} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &1170012393 +--- !u!212 &1172578105 SpriteRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1170012391} + m_GameObject: {fileID: 1172578103} m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 @@ -2973,9 +2862,9 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 1 + m_SortingOrder: 4 m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 0, g: 0.03572154, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 @@ -3001,7 +2890,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &1301816245 Transform: m_ObjectHideFlags: 0 @@ -3174,14 +3063,14 @@ GameObject: - component: {fileID: 1537489913} - component: {fileID: 1537489916} - component: {fileID: 1537489915} - - component: {fileID: 1537489914} + - component: {fileID: 1537489917} m_Layer: 0 m_Name: Oil Gate m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!4 &1537489913 Transform: m_ObjectHideFlags: 0 @@ -3191,57 +3080,12 @@ Transform: m_GameObject: {fileID: 1537489912} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -4.511, y: -2.504, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalPosition: {x: -0.93, y: -1.779, z: 0} + m_LocalScale: {x: 0.92499995, y: 0.625, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1112213369} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!61 &1537489914 -BoxCollider2D: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1537489912} - m_Enabled: 1 - m_Density: 1 - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_ForceSendLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_ForceReceiveLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_ContactCaptureLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_CallbackLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_IsTrigger: 0 - m_UsedByEffector: 0 - m_UsedByComposite: 0 - m_Offset: {x: 0, y: 0} - m_SpriteTilingProperty: - border: {x: 0, y: 0, z: 0, w: 0} - pivot: {x: 0.5, y: 0.5} - oldSize: {x: 1, y: 1} - newSize: {x: 1, y: 1} - adaptiveTilingThreshold: 0.5 - drawMode: 0 - adaptiveTiling: 0 - m_AutoTiling: 0 - serializedVersion: 2 - m_Size: {x: 1, y: 1} - m_EdgeRadius: 0 --- !u!114 &1537489915 MonoBehaviour: m_ObjectHideFlags: 0 @@ -3294,18 +3138,63 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 1 - m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} + m_SortingOrder: 2 + m_Sprite: {fileID: 6738774341365589705, guid: 6de0a74e5b5268b4998dc7a5c687fb95, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 - m_DrawMode: 0 + m_DrawMode: 1 m_Size: {x: 1, y: 1} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 m_MaskInteraction: 0 - m_SpriteSortPoint: 0 + m_SpriteSortPoint: 1 +--- !u!61 &1537489917 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1537489912} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: -0.4625, y: 0.3125} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 1, y: 0} + oldSize: {x: 0.925, y: 0.625} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 1 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 0.925, y: 0.625} + m_EdgeRadius: 0 --- !u!1 &1590335072 GameObject: m_ObjectHideFlags: 0 @@ -3364,10 +3253,12 @@ Transform: m_GameObject: {fileID: 1691014402} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.427, y: 0.761, z: 0} + m_LocalPosition: {x: -0.427, y: 0.164, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 796145092} + - {fileID: 1172578104} m_Father: {fileID: 1112213369} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1691014404 @@ -3382,8 +3273,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 5758967c5b7371f4996079b044127a60, type: 3} m_Name: m_EditorClassIdentifier: - topPosY: -1 - bottomPosY: -2.95 + topPosY: 1.2 + bottomPosY: 0 --- !u!212 &1691014405 SpriteRenderer: m_ObjectHideFlags: 0 @@ -3429,7 +3320,7 @@ SpriteRenderer: m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 - m_DrawMode: 0 + m_DrawMode: 1 m_Size: {x: 0.08, y: 1.215} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 @@ -3452,7 +3343,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &1732205055 Transform: m_ObjectHideFlags: 0 @@ -3635,7 +3526,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &1814664091 Transform: m_ObjectHideFlags: 0 @@ -3749,7 +3640,7 @@ PrefabInstance: - target: {fileID: 3043662884828134004, guid: 4bc957ee60485f2439dca605f6d4035e, type: 3} propertyPath: m_Sprite value: - objectReference: {fileID: -3966184946834299664, guid: 6de0a74e5b5268b4998dc7a5c687fb95, type: 3} + objectReference: {fileID: 21300000, guid: 4b40fc0f65c85f14fbc9c7c5f40ca686, type: 3} - target: {fileID: 3043662884828134004, guid: 4bc957ee60485f2439dca605f6d4035e, type: 3} propertyPath: m_Color.a value: 1 @@ -3784,23 +3675,39 @@ PrefabInstance: objectReference: {fileID: 11400000, guid: 0b31f7a5b65969146ace2f70ffebf57e, type: 2} - target: {fileID: 6084533904510143880, guid: 4bc957ee60485f2439dca605f6d4035e, type: 3} propertyPath: shaftType - value: 0 + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 6084533904510143880, guid: 4bc957ee60485f2439dca605f6d4035e, type: 3} + propertyPath: targetSpeed + value: 0.5 objectReference: {fileID: 0} - target: {fileID: 6084533904510143880, guid: 4bc957ee60485f2439dca605f6d4035e, type: 3} propertyPath: initialSpeed value: 0.5 objectReference: {fileID: 0} + - target: {fileID: 6084533904510143880, guid: 4bc957ee60485f2439dca605f6d4035e, type: 3} + propertyPath: gearModel.radius + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6084533904510143880, guid: 4bc957ee60485f2439dca605f6d4035e, type: 3} + propertyPath: gearModel.spriteName + value: + objectReference: {fileID: 0} - target: {fileID: 6363828760380717502, guid: 4bc957ee60485f2439dca605f6d4035e, type: 3} propertyPath: m_Name value: Shaft objectReference: {fileID: 0} + - target: {fileID: 6363828760380717502, guid: 4bc957ee60485f2439dca605f6d4035e, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} - target: {fileID: 8196328002646668744, guid: 4bc957ee60485f2439dca605f6d4035e, type: 3} propertyPath: m_LocalPosition.x - value: -11.53 + value: 1.53 objectReference: {fileID: 0} - target: {fileID: 8196328002646668744, guid: 4bc957ee60485f2439dca605f6d4035e, type: 3} propertyPath: m_LocalPosition.y - value: 3.7 + value: 1.87 objectReference: {fileID: 0} - target: {fileID: 8196328002646668744, guid: 4bc957ee60485f2439dca605f6d4035e, type: 3} propertyPath: m_LocalPosition.z @@ -4012,6 +3919,7 @@ Transform: - {fileID: 223820136} - {fileID: 698344778} - {fileID: 1035218750} + - {fileID: 574939132} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1895751249 @@ -4490,54 +4398,6 @@ MonoBehaviour: soundName: modulePicList: [] modulePos: {x: 0, y: 0, z: 0} ---- !u!1 &2019900042 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2019900043} - - component: {fileID: 2019900044} - m_Layer: 0 - m_Name: Air Level Dashboard - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 0 ---- !u!4 &2019900043 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2019900042} - 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: 1170012392} - - {fileID: 617420341} - m_Father: {fileID: 1112213369} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &2019900044 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2019900042} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7e5ffd762a716d8409d0f37b763e6521, type: 3} - m_Name: - m_EditorClassIdentifier: - topPosY: -2.4 - bottomPosY: -2.95 --- !u!1 &2061960536 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Framework/Config/ConfigUtil.cs b/Assets/Scripts/Framework/Config/ConfigUtil.cs index 470685564..a8a2da8ac 100644 --- a/Assets/Scripts/Framework/Config/ConfigUtil.cs +++ b/Assets/Scripts/Framework/Config/ConfigUtil.cs @@ -1,6 +1,7 @@ +using System; using System.Collections.Generic; using System.Linq; -using Newtonsoft.Json.Serialization; +using Aibis.Utility; using UnityEngine; namespace AibisDream.Kit @@ -71,8 +72,72 @@ namespace AibisDream.Kit return _baseConfigDic.TryGetValue(key, out value); } - // public bool TryToLoadConfig(string path, string key, out T res) - // { - // } + /// + /// 按类型读取Json配置 + /// + /// 路径 + /// key + /// 结果 + /// 类型 + /// 是否成功 + public bool TryLoadConfig(string path, string key, out T res) + { + try + { + res = JsonUtil.ReadBean(path, key); + return true; + } + catch (Exception e) + { + res = default; + Debug.Log(e); + return false; + } + } + + /// + /// 按类型读取 + /// + /// 路径 + /// 结果 + /// 类型 + /// 是否成功 + public bool TryLoadConfig(string path, out T res) + { + try + { + res = JsonUtil.ReadBean(path); + return true; + } + catch (Exception e) + { + res = default; + Debug.Log(e); + return false; + } + } + + /// + /// 保存Bean + /// + /// + /// + /// + public void SaveConfig(T bean, string path) + { + JsonUtil.SaveBean(bean, path); + } + + /// + /// 保存配置 + /// + /// bean + /// 键 + /// 路径 + /// 类型 + public void SaveConfig(T bean, string key, string path) + { + JsonUtil.SaveBean(bean, key, path); + } } } \ No newline at end of file diff --git a/Assets/Scripts/Framework/Core/UnityTool.cs b/Assets/Scripts/Framework/Core/UnityTool.cs index 56ed6cae4..d3c8b2da3 100644 --- a/Assets/Scripts/Framework/Core/UnityTool.cs +++ b/Assets/Scripts/Framework/Core/UnityTool.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Reflection; using UnityEngine; @@ -18,7 +19,7 @@ namespace Framework.Core /// /// true => 查找对应名字对象的下一级子物体 通常名字为父物体名字 类型为子物体 /// false => 查找对应名字的对象 通常会将类型和名字对应 - public FindComponentAttribute(string goName = null, bool getChild = true) + public FindComponentAttribute(string goName = null, bool getChild = false) { this.goName = goName; this.getChild = getChild; @@ -82,7 +83,7 @@ namespace Framework.Core field.SetValue(mono, components[0]); return; } - + if (attribute.getChild) { foreach (var component in components) @@ -98,6 +99,11 @@ namespace Framework.Core { foreach (var component in components) { + if (attribute.goName == "Min Pointer") + { + Debug.Log(component.name); + } + if (component.name != attribute.goName) continue; field.SetValue(mono, component); break; @@ -114,7 +120,13 @@ namespace Framework.Core { if (dic.TryGetValue(type, out var components)) return components; - components = mono.GetComponentsInChildren(type, true); + var selfComponent = mono.GetComponent(type); + var childrenComponents = mono.GetComponentsInChildren(type, true); + components = selfComponent != null + ? new[] { selfComponent }.Concat(childrenComponents).ToArray() + : childrenComponents; + + if (components == null || components.Length == 0) { #if UNITY_EDITOR diff --git a/Assets/Scripts/MiniGame/Engine/AirDashboard.cs b/Assets/Scripts/MiniGame/Engine/AirDashboard.cs index 65725f81d..5f27cd4dd 100644 --- a/Assets/Scripts/MiniGame/Engine/AirDashboard.cs +++ b/Assets/Scripts/MiniGame/Engine/AirDashboard.cs @@ -1,6 +1,3 @@ -using System.Collections; -using System.Collections.Generic; -using DG.Tweening; using Framework.Core; using UnityEngine; @@ -8,23 +5,30 @@ namespace AibisDream { public class AirDashboard : Dashboard { - [FindComponent("Pointer")] private Transform _pointer; + [FindComponent] private SpriteRenderer _pointer; [FindComponent("Min Pointer")] private Transform _minPointer; [FindComponent("Max Pointer")] private Transform _maxPointer; [SerializeField] private float topPosY; [SerializeField] private float bottomPosY; - + + private float _pointerMaxHeight; + + protected override void OnStart() + { + _pointerMaxHeight = _pointer.size.y; + } + protected override void UpdateDashboard(EngineData data) { // 气门 - _pointer.DOScaleY(data.curAir, Time.deltaTime); - + _pointer.size = new Vector2(_pointer.size.x, data.curAir * _pointerMaxHeight); + // 气门上下限 var minPosY = (topPosY - bottomPosY) * data.curAirMin + bottomPosY; var maxPosY = (topPosY - bottomPosY) * data.curAirMax + bottomPosY; - _minPointer.position = new Vector3(_minPointer.position.x, minPosY, _minPointer.position.z); - _maxPointer.position = new Vector3(_maxPointer.position.x, maxPosY, _maxPointer.position.z); + _minPointer.localPosition = new Vector3(0, minPosY, 0); + _maxPointer.localPosition = new Vector3(0, maxPosY, 0); } } -} +} \ No newline at end of file diff --git a/Assets/Scripts/MiniGame/Engine/AirGate.cs b/Assets/Scripts/MiniGame/Engine/AirGate.cs index d38e14635..4d76c69b6 100644 --- a/Assets/Scripts/MiniGame/Engine/AirGate.cs +++ b/Assets/Scripts/MiniGame/Engine/AirGate.cs @@ -1,45 +1,55 @@ +using AibisDream.Framework; using UnityEngine; namespace AibisDream { - public class AirGate : MonoBehaviour + public class AirGate : MonoBehaviour, IMoveable { private EngineSystem _engineSystem; - private SpriteButton _upButton; - private SpriteButton _downButton; + [SerializeField] private int _curLevel; + + [SerializeField] private float heightY; + + private Vector3 _offset; private void Awake() { _engineSystem = transform.parent.GetComponent(); - - var up = transform.Find("Up").gameObject; - var down = transform.Find("Down").gameObject; - - _upButton = new SpriteButton(up); - _downButton = new SpriteButton(down); + _offset = transform.position; } - private void OnEnable() + public void StartMove() { - _upButton.OnButtonDown += AddAirLevel; - _downButton.OnButtonDown += SubtractAirLevel; + Debug.Log("Move"); } - private void Update() + public void Move(Vector2 mousePos) { - _upButton?.CheckButtonClick(); - _downButton?.CheckButtonClick(); + SwitchAirLevel(mousePos.y); + UpdateTransform(); + _engineSystem.UpdateAirLevel(_curLevel); } - private void AddAirLevel() + private void UpdateTransform() { - _engineSystem.AddAirLevel(); + float levelHeight = heightY / (_engineSystem.maxLevel - 1); + var curY = levelHeight * _curLevel + _offset.y; + transform.position = new Vector3(transform.position.x, curY, transform.position.z); } - private void SubtractAirLevel() + private void SwitchAirLevel(float mouseY) + { + mouseY -= _offset.y; + + float levelHeight = heightY / _engineSystem.maxLevel; + _curLevel = (int)((mouseY) / levelHeight); + if (_curLevel >= _engineSystem.maxLevel) _curLevel = _engineSystem.maxLevel - 1; + if (_curLevel < 0) _curLevel = 0; + } + + public void StopMove() { - _engineSystem.SubtractAirLevel(); } } } diff --git a/Assets/Scripts/MiniGame/Engine/EngineSystem.cs b/Assets/Scripts/MiniGame/Engine/EngineSystem.cs index ce0b2c2b4..0d90b28c4 100644 --- a/Assets/Scripts/MiniGame/Engine/EngineSystem.cs +++ b/Assets/Scripts/MiniGame/Engine/EngineSystem.cs @@ -15,13 +15,15 @@ namespace AibisDream [SerializeField] private float baseAirMax; [SerializeField] public int maxLevel; - private EngineData _engineData; + [Header("系统数据")] + [SerializeField] + private EngineData engineData; public event Action UpdateDashboard; private void OnEnable() { - _engineData = new EngineData(); + engineData = new EngineData(); } private void Update() @@ -29,16 +31,16 @@ namespace AibisDream // 更新部分按时间自然计算的指标 DataAutoChange(); // 更新看板 - UpdateDashboard?.Invoke(_engineData); + UpdateDashboard?.Invoke(engineData); } private void DataAutoChange() { // 自然减速 - _engineData.OilChange(-oilDownRatio); - _engineData.CalcAir(airMaxRatio, airMinRatio, baseAirMax); + engineData.OilChange(-oilDownRatio); + engineData.CalcAir(airMaxRatio, airMinRatio, baseAirMax); // 推算速度 - _engineData.CalcSpeed(acceleratedSpeed, resistance); + engineData.CalcSpeed(acceleratedSpeed, resistance); } /// @@ -46,20 +48,16 @@ namespace AibisDream /// public void AddOil() { - _engineData.OilChange(oilUpRatio); + engineData.OilChange(oilUpRatio); } - public void SubtractAirLevel() + public void UpdateAirLevel(int curLevel) { - _engineData.SubtractAirLevel(); - } - - public void AddAirLevel() - { - _engineData.AddAirLevel(); + engineData.UpdateAirLevel(curLevel, maxLevel); } } + [Serializable] public struct EngineData { public float curSpeed; @@ -92,26 +90,12 @@ namespace AibisDream curAirMin = curSpeed * (curAirLevel + 1) * airMinRatio; } - public void AddAirLevel() + public void UpdateAirLevel(int level, int maxLevel) { - curAirLevel += 1; - if (curAirLevel > 5) + curAirLevel = level; + if (curAirLevel > maxLevel) { - curAirLevel = 4; - } - - if (curAirLevel < 0) - { - curAirLevel = 0; - } - } - - public void SubtractAirLevel() - { - curAirLevel -= 1; - if (curAirLevel > 5) - { - curAirLevel = 4; + curAirLevel = maxLevel - 1; } if (curAirLevel < 0) diff --git a/Assets/Scripts/MiniGame/Engine/OilDashboard.cs b/Assets/Scripts/MiniGame/Engine/OilDashboard.cs index fc0953747..e2a85e109 100644 --- a/Assets/Scripts/MiniGame/Engine/OilDashboard.cs +++ b/Assets/Scripts/MiniGame/Engine/OilDashboard.cs @@ -1,13 +1,21 @@ -using DG.Tweening; +using Framework.Core; using UnityEngine; namespace AibisDream { public class OilDashBoard : Dashboard { + [FindComponent] private SpriteRenderer _pointer; + private float _pointerMaxHeight; + + protected override void OnStart() + { + _pointerMaxHeight = _pointer.size.y; + } + protected override void UpdateDashboard(EngineData data) { - transform.DOScaleY(data.curOil, Time.deltaTime); + _pointer.size = new Vector2(_pointer.size.x, data.curOil * _pointerMaxHeight); } } } diff --git a/Assets/Scripts/MiniGame/Engine/OilGate.cs b/Assets/Scripts/MiniGame/Engine/OilGate.cs index 0e20734b1..8912c9f2c 100644 --- a/Assets/Scripts/MiniGame/Engine/OilGate.cs +++ b/Assets/Scripts/MiniGame/Engine/OilGate.cs @@ -1,3 +1,4 @@ +using DG.Tweening; using UnityEngine; namespace AibisDream @@ -5,14 +6,11 @@ namespace AibisDream public class OilGate : MonoBehaviour { private SpriteButton _spriteButton; - private SpriteRenderer _spriteRenderer; - private EngineSystem _engineSystem; private void Start() { _engineSystem = transform.parent.GetComponent(); - _spriteRenderer = GetComponent(); } private void OnEnable() @@ -35,17 +33,14 @@ namespace AibisDream private void ButtonClick() { - // 改变按钮颜色 - _spriteRenderer.color = Color.gray; - // TODO + transform.DOPause(); + transform.DORotate(new Vector3(0, 0, 45), 5f); } private void ButtonUp() { - // 改变按钮颜色 - _spriteRenderer.color = Color.white; - // TODO - + transform.DOPause(); + transform.DORotate(new Vector3(0, 0, 0), 0.2f); } private void ButtonHold() diff --git a/Assets/Scripts/MiniGame/Engine/SpeedDashboard.cs b/Assets/Scripts/MiniGame/Engine/SpeedDashboard.cs index 987590d0e..027d1f139 100644 --- a/Assets/Scripts/MiniGame/Engine/SpeedDashboard.cs +++ b/Assets/Scripts/MiniGame/Engine/SpeedDashboard.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; namespace AibisDream @@ -19,7 +17,7 @@ namespace AibisDream protected override void UpdateDashboard(EngineData data) { var targetPosX = (rightPosX - leftPosX) * data.curSpeed + leftPosX; - _pointer.position = new Vector3(targetPosX, _pointer.position.y, _pointer.position.y); + _pointer.localPosition = new Vector3(targetPosX, _pointer.localPosition.y, _pointer.localPosition.y); } } } diff --git a/Assets/Scripts/MiniGame/Gear/Gear.cs b/Assets/Scripts/MiniGame/Gear/Gear.cs index 6009bb424..39383a47f 100644 --- a/Assets/Scripts/MiniGame/Gear/Gear.cs +++ b/Assets/Scripts/MiniGame/Gear/Gear.cs @@ -46,7 +46,7 @@ namespace AibisDream public void InitGearModel(GearModel gearModel) { // 给齿轮赋值 - spriteRenderer.sprite = Resources.Load(gearModel.spriteName); + spriteRenderer.sprite = gearModel.spriteName; circleCollider.radius = gearModel.radius; } diff --git a/Assets/Scripts/MiniGame/Gear/GearController.cs b/Assets/Scripts/MiniGame/Gear/GearController.cs index 3715b1924..d7a1bc338 100644 --- a/Assets/Scripts/MiniGame/Gear/GearController.cs +++ b/Assets/Scripts/MiniGame/Gear/GearController.cs @@ -82,11 +82,11 @@ namespace AibisDream /// 齿轮数据 /// 速度 /// 齿轮Obj - public GameObject InitGear(Vector3 pos, GearModel gearModel, float speed) + public GameObject InitGear(Vector3 pos, float radius, Sprite sprite, float speed) { GameObject gear = Instantiate(_gearPrefab, pos, Quaternion.identity); gear.transform.parent = transform.GetChild(0).transform; - gear.GetComponent().Data = gearModel; + // gear.GetComponent().Data = gearModel; return gear; } diff --git a/Assets/Scripts/MiniGame/Gear/GearModel.cs b/Assets/Scripts/MiniGame/Gear/GearModel.cs index 89806d358..adc5f8e93 100644 --- a/Assets/Scripts/MiniGame/Gear/GearModel.cs +++ b/Assets/Scripts/MiniGame/Gear/GearModel.cs @@ -8,7 +8,7 @@ namespace AibisDream { public int id; public float radius; - public string spriteName; + public Sprite spriteName; /// /// 读取齿轮图片 @@ -16,7 +16,7 @@ namespace AibisDream /// 齿轮Sprite public Sprite GetSprite() { - return Resources.Load(spriteName); + return spriteName; } } } diff --git a/Assets/Scripts/MiniGame/Gear/Shaft.cs b/Assets/Scripts/MiniGame/Gear/Shaft.cs index 1ae153831..365941634 100644 --- a/Assets/Scripts/MiniGame/Gear/Shaft.cs +++ b/Assets/Scripts/MiniGame/Gear/Shaft.cs @@ -1,4 +1,5 @@ -using AibisDream.Utility; +using System; +using AibisDream.Utility; using DG.Tweening; using UnityEngine; @@ -14,7 +15,9 @@ namespace AibisDream [SerializeField] private float initialSpeed; // 初始齿轮 - [SerializeField] private GearModel gearModel; + [SerializeField] private float radius; + [SerializeField] private Sprite sprite; + private GameObject childGear; // 目标角速度 @@ -43,7 +46,7 @@ namespace AibisDream } else { - return gearModel.radius; + return radius; } } } @@ -61,7 +64,7 @@ namespace AibisDream public void InitShaft() { // 如果不带齿轮 - if (gearModel == null) + if (sprite == null) { return; } @@ -79,7 +82,7 @@ namespace AibisDream // 添加齿轮图片 staticGear.SetActive(true); - staticGear.GetComponent().sprite = Resources.Load(gearModel.spriteName); + staticGear.GetComponent().sprite = sprite; // 如果有初速,就要开始转动了 if (!CommonUtil.IsZero(initialSpeed)) { @@ -92,7 +95,7 @@ namespace AibisDream private GameObject InitPluggableGear() { - return gearController.InitGear(transform.position, gearModel, initialSpeed); + return gearController.InitGear(transform.position, radius, sprite, initialSpeed); } public void PlugInGear(Gear gear) @@ -190,6 +193,12 @@ namespace AibisDream { return shaft1.GearRadius / shaft2.GearRadius; } + + public void OnDrawGizmos() + { + Gizmos.color = Color.red; + Gizmos.DrawWireSphere(transform.position, radius); + } } public enum ShaftType diff --git a/Assets/Scripts/Utility/CommonUtil.cs b/Assets/Scripts/Utility/CommonUtil.cs index 94b681822..cb20ad987 100644 --- a/Assets/Scripts/Utility/CommonUtil.cs +++ b/Assets/Scripts/Utility/CommonUtil.cs @@ -1,7 +1,6 @@ using System; using System.Threading.Tasks; using UnityEngine; -using UnityEngine.EventSystems; namespace AibisDream.Utility { diff --git a/Assets/Scripts/Utility/JsonUtil.cs b/Assets/Scripts/Utility/JsonUtil.cs index 8573a52a1..aa7741ec8 100644 --- a/Assets/Scripts/Utility/JsonUtil.cs +++ b/Assets/Scripts/Utility/JsonUtil.cs @@ -1,20 +1,36 @@ -using System.IO; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Serialization; -using UnityEngine.Device; -namespace Utility +namespace Aibis.Utility { public static class JsonUtil { - // public static T ReadBean(string path, string key) - // { - // // 加载自由结构Json - // string json = File.ReadAllText(path); - // var jObject = JObject.Parse(json); - // jObject.TryGetValue(key); - // } + public const string JsonSuffix = ".json"; + + /// + /// 按路径和Key加载 + /// + /// 路径 + /// key + /// 类型 + /// Bean + /// 错误 + public static T ReadBean(string path, string key) + { + string json = File.ReadAllText(path); + JObject jObject = JObject.Parse(json); + + if (jObject.ContainsKey(key)) + { + return jObject.ToObject(); + } + + throw new Exception("没有找到对应的Key"); + } /// /// 按路径加载Json @@ -39,5 +55,61 @@ namespace Utility string json = File.ReadAllText(path); return JsonConvert.DeserializeObject(json); } + + /// + /// 获取Json中的Key列表 + /// + /// 路径 + /// key列表 + public static string[] ReadKeys(string path) + { + string json = File.ReadAllText(path); + JObject jObject = JObject.Parse(json); + + return jObject.Properties().Select(jProp => jProp.Name).ToArray(); + } + + /// + /// 保存Bean + /// + /// bean + /// 路径 + /// 类型 + public static void SaveBean(T bean, string path) + { + string json = JsonConvert.SerializeObject(bean); + File.WriteAllText(path, json); + } + + /// + /// 保存类 + /// + /// 对象 + /// key + /// 保存配置 + /// 添加还是覆盖 + /// 类型 + public static void SaveBean(T bean, string key, string path, SaveMode saveMode = SaveMode.Add) + { + if (saveMode == SaveMode.Add && File.Exists(path)) + { + Dictionary originDic = JsonConvert.DeserializeObject>(path); + originDic.Add(key, bean); + string tempJson = JsonConvert.SerializeObject(originDic); + File.WriteAllText(path, tempJson); + } + else + { + Dictionary tempDic = new Dictionary { { key, bean } }; + string tempJson = JsonConvert.SerializeObject(tempDic); + File.WriteAllText(path, tempJson); + } + } + } + + public enum SaveMode + { + Replace, + Add } } \ No newline at end of file diff --git a/Packages/manifest.json b/Packages/manifest.json index df14eb2ea..bcb531915 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -14,7 +14,6 @@ "com.unity.ugui": "1.0.0", "com.unity.visualscripting": "1.8.0", "dev.yarnspinner.unity": "2.4.2", - "jillejr.newtonsoft.json-for-unity": "https://github.com/jilleJr/Newtonsoft.Json-for-Unity.git#upm", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", "com.unity.modules.animation": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 8450275b4..6747da215 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -310,13 +310,6 @@ "dependencies": {}, "url": "https://package.openupm.com" }, - "jillejr.newtonsoft.json-for-unity": { - "version": "https://github.com/jilleJr/Newtonsoft.Json-for-Unity.git#upm", - "depth": 0, - "source": "git", - "dependencies": {}, - "hash": "f2c6cb09817832dccd0600f291053d8d55298ee9" - }, "com.unity.modules.ai": { "version": "1.0.0", "depth": 0,