diff --git a/Assets/Scenes/GameScene3D.unity b/Assets/Scenes/GameScene3D.unity index 527f1a5..ec962d0 100644 --- a/Assets/Scenes/GameScene3D.unity +++ b/Assets/Scenes/GameScene3D.unity @@ -780,6 +780,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: Assembly-CSharp::MenuGameplayTransit menu: {fileID: 1122363137} + gameplay: {fileID: 1081324698} --- !u!4 &29868613 Transform: m_ObjectHideFlags: 0 @@ -6620,7 +6621,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMin.x @@ -6628,7 +6629,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_SizeDelta.x @@ -6668,11 +6669,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchoredPosition.x - value: 116.51001 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchoredPosition.y - value: -22.955 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -8146,7 +8147,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMin.x @@ -8154,7 +8155,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_SizeDelta.x @@ -8194,11 +8195,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchoredPosition.x - value: 271.19003 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchoredPosition.y - value: -22.955 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -12039,7 +12040,7 @@ GameObject: m_Component: - component: {fileID: 689075010} m_Layer: 5 - m_Name: "\u0433\u0440\u0443\u043F\u043F\u0430" + m_Name: LeftPanel m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -12061,13 +12062,14 @@ RectTransform: - {fileID: 2004955257} - {fileID: 1760265188} - {fileID: 1483985610} + - {fileID: 1779969964} m_Father: {fileID: 1081324697} 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: -722.3075, y: 151.75} - m_SizeDelta: {x: 299.9551, y: 332.3299} - m_Pivot: {x: 0.5, y: 0.5} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 506.9099, y: 857.92} + m_Pivot: {x: 1, y: 0} --- !u!1 &693044068 GameObject: m_ObjectHideFlags: 0 @@ -12812,7 +12814,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMin.x @@ -12820,7 +12822,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_SizeDelta.x @@ -12860,11 +12862,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchoredPosition.x - value: 348.53003 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchoredPosition.y - value: -22.955 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -17722,13 +17724,14 @@ GameObject: m_Component: - component: {fileID: 1081324697} - component: {fileID: 1081324696} + - component: {fileID: 1081324698} m_Layer: 5 m_Name: '[CANVAS GAMEPLAY]' m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!223 &1081324696 Canvas: m_ObjectHideFlags: 0 @@ -17765,6 +17768,7 @@ RectTransform: m_LocalScale: {x: 0, y: 0, z: 0} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 689075010} - {fileID: 963346424} - {fileID: 1060301112} - {fileID: 8917489125503085284} @@ -17774,8 +17778,6 @@ RectTransform: - {fileID: 4928797679491293975} - {fileID: 1049084793056958207} - {fileID: 365101956} - - {fileID: 689075010} - - {fileID: 1779969964} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -17783,6 +17785,29 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} +--- !u!114 &1081324698 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1081324695} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b7843dd7eada79f45b77a663e8a9ea8b, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::GameplayLayoutController + _leftPanel: {fileID: 689075010} + _leftOpenedPosition: 506.9099 + _panelsTransitionDuration: 0.5 + _panelsOpenEase: 27 + _panelsCloseEase: 26 + _board: {fileID: 1768372452} + _boardOpenedY: -5.93 + _boardClosedY: 8 + _boardTransitionDuration: 1 + _boardOpenEase: 30 + _boardCloseEase: 26 --- !u!1001 &1083634611 PrefabInstance: m_ObjectHideFlags: 0 @@ -18062,7 +18087,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMin.x @@ -18070,7 +18095,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_SizeDelta.x @@ -18110,11 +18135,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchoredPosition.x - value: 193.85 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchoredPosition.y - value: -22.955 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -18515,8 +18540,8 @@ MonoBehaviour: - {fileID: 6662214523308698938} _leftPanel: {fileID: 6665465969600127458} _rightPanel: {fileID: 558601564} - _transitionSpeed: 2500 - _ease: 14 + _transitionDuration: 0.5 + _ease: 5 --- !u!1 &1124603895 GameObject: m_ObjectHideFlags: 0 @@ -24673,7 +24698,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1483985609} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + 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 @@ -24683,7 +24708,7 @@ RectTransform: 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: 52.20752, y: -377.15} + m_AnchoredPosition: {x: 36.44507, y: -114.360016} m_SizeDelta: {x: 394.61, y: 81.46} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1483985611 @@ -27401,7 +27426,7 @@ GameObject: - component: {fileID: 1620402277} - component: {fileID: 1620402276} m_Layer: 5 - m_Name: Image + m_Name: BackToMenu m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -27414,7 +27439,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1620402274} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + 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 @@ -27426,7 +27451,7 @@ RectTransform: 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: -13.20258, y: 88.84995} + m_AnchoredPosition: {x: -28.964966, y: 351.63998} m_SizeDelta: {x: 273.55, y: 154.63} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1620402276 @@ -29354,7 +29379,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1760265187} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + 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 @@ -29364,7 +29389,7 @@ RectTransform: 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: 52.20752, y: -276.25} + m_AnchoredPosition: {x: 36.44507, y: -13.459991} m_SizeDelta: {x: 394.61, y: 81.46} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1760265189 @@ -29668,13 +29693,12 @@ Transform: m_GameObject: {fileID: 1768372451} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -40, y: -5.93, z: 0} + m_LocalPosition: {x: 0, y: 8, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 940435496} - {fileID: 1569685936} - - {fileID: 2064973393} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!212 &1768372453 @@ -30192,11 +30216,11 @@ RectTransform: - {fileID: 1815724544} - {fileID: 1242584385} - {fileID: 2058636337} - m_Father: {fileID: 1081324697} + m_Father: {fileID: 689075010} 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: -670.09, y: -360.31} + m_AnchoredPosition: {x: 36.45508, y: -249.27} m_SizeDelta: {x: 434, y: 134} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1779969965 @@ -33894,7 +33918,7 @@ GameObject: - component: {fileID: 2004955259} - component: {fileID: 2004955258} m_Layer: 5 - m_Name: Image + m_Name: Time&Moves m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -33907,7 +33931,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2004955256} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + 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 @@ -33918,7 +33942,7 @@ RectTransform: 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: -13.20258, y: -88.84997} + m_AnchoredPosition: {x: -28.964966, y: 173.94003} m_SizeDelta: {x: 273.55, y: 154.63} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2004955258 @@ -35397,97 +35421,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2062013011} m_CullTransparentMesh: 1 ---- !u!1 &2064973392 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2064973393} - - component: {fileID: 2064973394} - m_Layer: 0 - m_Name: stickedTest - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &2064973393 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2064973392} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 10.26, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1768372452} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &2064973394 -SpriteRenderer: - serializedVersion: 2 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2064973392} - 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_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_ForceMeshLod: -1 - m_MeshLodSelectionBias: 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_GlobalIlluminationMeshLod: 0 - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_MaskInteraction: 0 - m_Sprite: {fileID: 21300000, guid: f53dbac82ca6398489e90ff262e9d5b3, 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_SpriteSortPoint: 0 --- !u!1 &2068472955 GameObject: m_ObjectHideFlags: 0 @@ -37159,7 +37092,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMin.x @@ -37167,7 +37100,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_SizeDelta.x @@ -37207,11 +37140,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchoredPosition.x - value: 39.170002 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_AnchoredPosition.y - value: -22.955 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1909234588782507268, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -37225,10 +37158,22 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2112185026095414869, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2844448063283312442, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 5739653273790000795, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} propertyPath: m_Name value: levelbar cell objectReference: {fileID: 0} + - target: {fileID: 8857851165114916971, guid: e45c4d0b012452f40ad1dc153ae38811, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/Assets/Scripts/Gameplay/GameplayLayoutController.cs b/Assets/Scripts/Gameplay/GameplayLayoutController.cs new file mode 100644 index 0000000..14758f1 --- /dev/null +++ b/Assets/Scripts/Gameplay/GameplayLayoutController.cs @@ -0,0 +1,50 @@ +using DG.Tweening; +using System; +using UnityEngine; + +public class GameplayLayoutController : MonoBehaviour +{ + [Header("Панели")] + [SerializeField] private RectTransform _leftPanel; + [SerializeField] private float _leftOpenedPosition = 506.9099f; + [SerializeField] private float _panelsTransitionDuration; + [SerializeField] private Ease _panelsOpenEase; + [SerializeField] private Ease _panelsCloseEase; + + [Header("Доска")] + [SerializeField] private Transform _board; + [SerializeField] private float _boardOpenedY = -5.93f; + [SerializeField] private float _boardClosedY = 8; + [SerializeField] private float _boardTransitionDuration = 1; + [SerializeField] private Ease _boardOpenEase; + [SerializeField] private Ease _boardCloseEase; + + public Sequence GetOpenSequence() => GetSequenceByState(true); + public Sequence GetCloseSequence() => GetSequenceByState(false); + + private Sequence GetSequenceByState(bool open) + { + float leftTarget = open ? _leftOpenedPosition : 0; + float boardTarget = open ? _boardOpenedY : _boardClosedY; + Ease boardEase = open ? _boardOpenEase : _boardCloseEase; + Ease panelsEase = open ? _panelsOpenEase : _panelsCloseEase; + return GetTransitionSequence(leftTarget, boardTarget, boardEase, panelsEase); + } + + private Sequence GetTransitionSequence(float targetLeftX, float targetBoardY, Ease boardEase, Ease panelsEase) + { + if (_leftPanel == null || _board == null) + throw new Exception("Панели или доска не назначены!"); + + var sequence = DOTween.Sequence(); + Tween left = _leftPanel.DOAnchorPosX(targetLeftX, _panelsTransitionDuration) + .SetEase(panelsEase); + Tween board = _board.DOMoveY(targetBoardY, _boardTransitionDuration) + .SetEase(boardEase); + + sequence.Append(left); + sequence.Append(board); + + return sequence; + } +} diff --git a/Assets/Scripts/Gameplay/GameplayLayoutController.cs.meta b/Assets/Scripts/Gameplay/GameplayLayoutController.cs.meta new file mode 100644 index 0000000..22683ab --- /dev/null +++ b/Assets/Scripts/Gameplay/GameplayLayoutController.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b7843dd7eada79f45b77a663e8a9ea8b \ No newline at end of file diff --git a/Assets/Scripts/Menu/MenuLayoutController.cs b/Assets/Scripts/Menu/MenuLayoutController.cs index 0c31361..023cafc 100644 --- a/Assets/Scripts/Menu/MenuLayoutController.cs +++ b/Assets/Scripts/Menu/MenuLayoutController.cs @@ -7,8 +7,6 @@ using UnityEngine; public class MenuLayoutController : MonoBehaviour, IControlable { - public event Action OnTransitionFinished; - [Header("Панели")] [SerializeField] List _panels; int _panelIndex = 0; @@ -16,11 +14,11 @@ public class MenuLayoutController : MonoBehaviour, IControlable [Header("Анимация открытия/закрытия")] [SerializeField] private RectTransform _leftPanel; [SerializeField] private RectTransform _rightPanel; - [SerializeField] private float _transitionSpeed; + [SerializeField] private float _transitionDuration; [SerializeField] private Ease _ease; private float _leftOpenedPosition; private float _rightOpenedPosition; - private Sequence _sequence; + //private Sequence _sequence; public bool ControlsEnabled { get; set; } @@ -68,56 +66,30 @@ public class MenuLayoutController : MonoBehaviour, IControlable return dir_h; } - public void Open() => SetMenuState(true); - public void Close() => SetMenuState(false); + public Sequence GetOpenSequence() => GetSequenceByState(true); + public Sequence GetCloseSequence() => GetSequenceByState(false); - private void SetMenuState(bool open) + private Sequence GetSequenceByState(bool open) { float leftTarget = open ? _leftOpenedPosition : 0; float rightTarget = open ? _rightOpenedPosition : 0; - PerformTransition(leftTarget, rightTarget); + return GetTransitionSequence(leftTarget, rightTarget); } - private void PerformTransition(float targetLeftX, float targetRightX) + private Sequence GetTransitionSequence(float targetLeftX, float targetRightX) { if (_leftPanel == null || _rightPanel == null) - { - Debug.LogError("Панели не назначены!"); - return; - } + throw new Exception("Панели не назначены!"); - if (_sequence != null) - { - _sequence.Kill(complete: false); - _sequence = null; - } - - OnTransitionFinished = null; - - float distanceLeft = Mathf.Abs(targetLeftX - _leftPanel.anchoredPosition.x); - float distanceRight = Mathf.Abs(targetRightX - _rightPanel.anchoredPosition.x); - - float durationLeft = distanceLeft / _transitionSpeed; - float durationRight = distanceRight / _transitionSpeed; - float duration = Mathf.Max(durationLeft, durationRight); // Чтобы обе закончили вместе - - _sequence = DOTween.Sequence(); - - Tween left = _leftPanel.DOAnchorPosX(targetLeftX, duration) + var sequence = DOTween.Sequence(); + Tween left = _leftPanel.DOAnchorPosX(targetLeftX, _transitionDuration) .SetEase(_ease); - Tween right = _rightPanel.DOAnchorPosX(targetRightX, duration) + Tween right = _rightPanel.DOAnchorPosX(targetRightX, _transitionDuration) .SetEase(_ease); - _sequence.Join(left); - _sequence.Join(right); - - _sequence.OnComplete(() => - { - OnTransitionFinished?.Invoke(); - _sequence = null; - }); - - _sequence.PlayForward(); + sequence.Join(left); + sequence.Join(right); + return sequence; } } \ No newline at end of file diff --git a/Assets/Scripts/MenuGameplayTransit.cs b/Assets/Scripts/MenuGameplayTransit.cs index e4a5326..b68ecf2 100644 --- a/Assets/Scripts/MenuGameplayTransit.cs +++ b/Assets/Scripts/MenuGameplayTransit.cs @@ -1,36 +1,57 @@ -using UnityEngine; +using DG.Tweening; +using UnityEngine; public class MenuGameplayTransit : MonoBehaviour { [SerializeField] MenuLayoutController menu; + [SerializeField] GameplayLayoutController gameplay; + + Sequence _sequence; + bool locked = false; private void Update() { + if (locked) return; + if (Input.GetKeyDown(KeyCode.Alpha1)) StartGame(); else if (Input.GetKeyDown(KeyCode.Alpha2)) GotoMenu(); - } + public void StartGame() { - menu.Close(); - menu.OnTransitionFinished += OnClosed; + Lock(); + if (_sequence != null) + { + _sequence.Kill(); + _sequence = null; + } + + _sequence = DOTween.Sequence(); + _sequence.Append(menu.GetCloseSequence()); + _sequence.Append(gameplay.GetOpenSequence()); + _sequence.onComplete += Unlock; + + _sequence.PlayForward(); } public void GotoMenu() { - menu.Open(); - menu.OnTransitionFinished += OnOpened; + Lock(); + if (_sequence != null) + { + _sequence.Kill(); + _sequence = null; + } + + _sequence = DOTween.Sequence(); + _sequence.Append(gameplay.GetCloseSequence()); + _sequence.Append(menu.GetOpenSequence()); + _sequence.onComplete += Unlock; + + _sequence.PlayForward(); } - private void OnOpened() - { - menu.OnTransitionFinished -= OnOpened; - print("Меню открыто"); - } - - private void OnClosed() - { - print("Меню закрыто"); - } + private void Lock() => this.locked = true; + private void Unlock() => this.locked = false; }