From 6bdebcebbf293cc91d26fb6b56424c33d1d70da8 Mon Sep 17 00:00:00 2001 From: amm266 Date: Fri, 2 Apr 2021 16:26:52 +0430 Subject: [PATCH] add winner panel and update move camera --- Assets/Prefabs/UI.prefab | 304 ++++++++++++++++-- Assets/Scenes/MapScene.unity | 23 +- Assets/Scripts/LogScripts/GameLogReader.cs | 2 +- Assets/Scripts/LogScripts/Map.cs | 4 +- .../Scripts/LogScripts/dto/GameConfigDTO.cs | 1 + Assets/Scripts/Map/GameManager.cs | 39 ++- Assets/Scripts/MoveCamera.cs | 38 ++- ProjectSettings/InputManager.asset | 4 +- 8 files changed, 372 insertions(+), 43 deletions(-) diff --git a/Assets/Prefabs/UI.prefab b/Assets/Prefabs/UI.prefab index 7414100..fde6e56 100644 --- a/Assets/Prefabs/UI.prefab +++ b/Assets/Prefabs/UI.prefab @@ -1,5 +1,136 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &123243328 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 123243329} + - component: {fileID: 123243332} + - component: {fileID: 123243331} + - component: {fileID: 123243330} + m_Layer: 5 + m_Name: setting_team1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &123243329 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 123243328} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.6064154, y: 0.6064154, z: 0.6064154} + m_Children: [] + m_Father: {fileID: 8674794669486866727} + m_RootOrder: 15 + 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: -724, y: 283} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &123243332 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 123243328} + m_CullTransparentMesh: 0 +--- !u!114 &123243331 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 123243328} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.31132078, g: 0.31132078, b: 0.31132078, 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_Sprite: {fileID: 21300000, guid: 10d78c024582d744ab51ef91e39909aa, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &123243330 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 123243328} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 123243331} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 0} + m_TargetAssemblyTypeName: GameManager, Assembly-CSharp + m_MethodName: LeftStatsClicked + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!1 &201270613 GameObject: m_ObjectHideFlags: 0 @@ -39,7 +170,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: 112.99994, y: 223} + m_AnchoredPosition: {x: 734, y: 291} m_SizeDelta: {x: 77.190735, y: 54.38127} m_Pivot: {x: 0.5, y: 0.5} --- !u!82 &201270614 @@ -273,15 +404,15 @@ RectTransform: m_GameObject: {fileID: 520874197} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.7394999, y: 0.7394999, z: 0.7394999} + m_LocalScale: {x: 0.5193514, y: 0.5193514, z: 0.5193514} m_Children: [] m_Father: {fileID: 8674794669486866727} m_RootOrder: 11 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: 216.00005, y: 232} - m_SizeDelta: {x: 100, y: 100} + m_AnchoredPosition: {x: 695.77, y: 397} + m_SizeDelta: {x: 115.06003, y: 102.73825} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &520874201 CanvasRenderer: @@ -307,7 +438,7 @@ MonoBehaviour: 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_Maskable: 0 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -413,7 +544,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} - m_AnchoredPosition: {x: 312, y: 846} + m_AnchoredPosition: {x: 235, y: 846} m_SizeDelta: {x: 1.559418, y: 0.12857056} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &736659287 @@ -762,14 +893,14 @@ RectTransform: m_GameObject: {fileID: 1063152376} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.6064154, y: 0.6064154, z: 0.6064154} + m_LocalScale: {x: 0.4608757, y: 0.4608757, z: 0.4608757} m_Children: [] m_Father: {fileID: 8674794669486866727} m_RootOrder: 10 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: 319.00003, y: 236} + m_AnchoredPosition: {x: 762.2, y: 398.7} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1063152380 @@ -1074,6 +1205,137 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &1331234042 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1331234043} + - component: {fileID: 1331234046} + - component: {fileID: 1331234045} + - component: {fileID: 1331234044} + m_Layer: 5 + m_Name: setting_team0 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1331234043 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1331234042} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.6064154, y: 0.6064154, z: 0.6064154} + m_Children: [] + m_Father: {fileID: 8674794669486866727} + m_RootOrder: 16 + 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: 595, y: 283} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1331234046 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1331234042} + m_CullTransparentMesh: 0 +--- !u!114 &1331234045 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1331234042} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.6320754, g: 0.25740176, b: 0.19975968, 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_Sprite: {fileID: 21300000, guid: 10d78c024582d744ab51ef91e39909aa, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1331234044 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1331234042} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1331234045} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 0} + m_TargetAssemblyTypeName: GameManager, Assembly-CSharp + m_MethodName: RightStatsClicked + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!1 &1503478381 GameObject: m_ObjectHideFlags: 0 @@ -1317,7 +1579,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: 27, y: 297} + m_AnchoredPosition: {x: -40, y: 297} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &2119158206 @@ -1582,7 +1844,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} - m_AnchoredPosition: {x: -309, y: 846} + m_AnchoredPosition: {x: -386, y: 846} m_SizeDelta: {x: 1.559418, y: 0.12857056} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &897281233120809896 @@ -2920,7 +3182,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: 626, y: 431.39673} + m_AnchoredPosition: {x: 548.99994, y: 431.39673} m_SizeDelta: {x: 84, y: 76.8} m_Pivot: {x: 0, y: 1} --- !u!222 &614399322712682228 @@ -3033,7 +3295,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &6926317023456770789 RectTransform: m_ObjectHideFlags: 0 @@ -3593,7 +3855,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &4663512140528063356 RectTransform: m_ObjectHideFlags: 0 @@ -3603,7 +3865,7 @@ RectTransform: m_GameObject: {fileID: 8402233282379174966} 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_LocalScale: {x: 1.2, y: 1.2, z: 1} m_Children: - {fileID: 77464171590917603} - {fileID: 6192300162195527384} @@ -3618,7 +3880,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: 658.99994, y: 134} + m_AnchoredPosition: {x: 631, y: 119} m_SizeDelta: {x: 282.60553, y: 163.43549} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &6117394235859502419 @@ -3771,7 +4033,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} - m_AnchoredPosition: {x: -952.49976, y: -154.00006} + m_AnchoredPosition: {x: -1035.4999, y: -154.00006} m_SizeDelta: {x: 86.79547, y: 52.08075} m_Pivot: {x: 1, y: 1} --- !u!222 &8674794667775569189 @@ -4151,7 +4413,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: 361, y: 341} + m_AnchoredPosition: {x: 316, y: 341} m_SizeDelta: {x: 320, y: 100} m_Pivot: {x: 0.5, y: 1} --- !u!222 &8674794667942260729 @@ -4802,7 +5064,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: -689, y: 424.39673} + m_AnchoredPosition: {x: -766.00006, y: 424.39673} m_SizeDelta: {x: 84, y: 76.8} m_Pivot: {x: 0, y: 1} --- !u!222 &8674794668642842211 @@ -5380,7 +5642,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} - m_AnchoredPosition: {x: -815, y: -154} + m_AnchoredPosition: {x: -898, y: -154} m_SizeDelta: {x: 130.19318, y: 52.08075} m_Pivot: {x: 1, y: 1} --- !u!222 &8674794669103592193 @@ -5513,7 +5775,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: 800, y: 646.39685} + m_AnchoredPosition: {x: 722.99994, y: 646.39685} m_SizeDelta: {x: 319.3797, y: 175} m_Pivot: {x: 1, y: 1} --- !u!1 &8674794669362352844 @@ -5850,6 +6112,8 @@ RectTransform: - {fileID: 201270615} - {fileID: 4663512140528063356} - {fileID: 6926317023456770789} + - {fileID: 123243329} + - {fileID: 1331234043} m_Father: {fileID: 2495248660206519639} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: -14.502} diff --git a/Assets/Scenes/MapScene.unity b/Assets/Scenes/MapScene.unity index e800c66..3253080 100644 --- a/Assets/Scenes/MapScene.unity +++ b/Assets/Scenes/MapScene.unity @@ -280,7 +280,7 @@ GameObject: - component: {fileID: 123243331} - component: {fileID: 123243330} m_Layer: 5 - m_Name: Close (1) + m_Name: setting_team1 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -505,11 +505,11 @@ PrefabInstance: objectReference: {fileID: 1778195490} - target: {fileID: 1236313013, guid: c96875b7a845a7143be803fea0004d49, type: 3} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1236313013, guid: c96875b7a845a7143be803fea0004d49, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1537088302, guid: c96875b7a845a7143be803fea0004d49, type: 3} propertyPath: m_OnValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target @@ -525,15 +525,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 897281234955408375, guid: c96875b7a845a7143be803fea0004d49, type: 3} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 897281234955408375, guid: c96875b7a845a7143be803fea0004d49, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2495248660206519639, guid: c96875b7a845a7143be803fea0004d49, type: 3} propertyPath: m_LocalPosition.x - value: 43.020386 + value: 52 objectReference: {fileID: 0} - target: {fileID: 2495248660206519639, guid: c96875b7a845a7143be803fea0004d49, type: 3} propertyPath: m_LocalPosition.y @@ -579,6 +579,10 @@ PrefabInstance: propertyPath: m_Name value: UI objectReference: {fileID: 0} + - target: {fileID: 3241652078898949051, guid: c96875b7a845a7143be803fea0004d49, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} - target: {fileID: 4663512140528063356, guid: c96875b7a845a7143be803fea0004d49, type: 3} propertyPath: m_LocalScale.x value: 1.2 @@ -672,7 +676,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!114 &1003224826 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1104,7 +1108,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 0e6dda28b97103a4e89340af0863e0ed, type: 3} m_Name: m_EditorClassIdentifier: - dragSpeed: 0.5 + ArrowMoveSpeed: 4 + dragSpeed: 15 zoomSpeed: 1 myCamera: {fileID: 1509055357} --- !u!1 &1539077790 stripped @@ -1580,7 +1585,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!4 &2069621863 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/LogScripts/GameLogReader.cs b/Assets/Scripts/LogScripts/GameLogReader.cs index f95164a..0f4c7e0 100644 --- a/Assets/Scripts/LogScripts/GameLogReader.cs +++ b/Assets/Scripts/LogScripts/GameLogReader.cs @@ -42,7 +42,7 @@ public void MakeLog(string jsonStr) } Map map = new Map(cells, gameConfigDTO.base_health, gameConfigDTO.worker_health, - gameConfigDTO.soldier_health, gameConfigDTO.team0_name, gameConfigDTO.team1_name); + gameConfigDTO.soldier_health, gameConfigDTO.team0_name, gameConfigDTO.team1_name,gameConfigDTO.winner); //making turns Turn[] turns = new Turn[gameDTO.turns.Length]; diff --git a/Assets/Scripts/LogScripts/Map.cs b/Assets/Scripts/LogScripts/Map.cs index 5468407..1bc957e 100644 --- a/Assets/Scripts/LogScripts/Map.cs +++ b/Assets/Scripts/LogScripts/Map.cs @@ -11,8 +11,9 @@ public class Map public int SoldierHealth { get; set; } public string Team0Name { get; set; } public string Team1Name { get; set; } + public int WinnerTeam { get; set; } - public Map(int[][] cells, int baseHealth, int workerHealth, int soldierHealth, string team0Name, string team1Name) + public Map(int[][] cells, int baseHealth, int workerHealth, int soldierHealth, string team0Name, string team1Name, int winnerTeam) { this.cells = cells; this.BaseHealth = baseHealth; @@ -20,5 +21,6 @@ public Map(int[][] cells, int baseHealth, int workerHealth, int soldierHealth, s this.SoldierHealth = soldierHealth; this.Team0Name = team0Name; this.Team1Name = team1Name; + this.WinnerTeam = winnerTeam; } } \ No newline at end of file diff --git a/Assets/Scripts/LogScripts/dto/GameConfigDTO.cs b/Assets/Scripts/LogScripts/dto/GameConfigDTO.cs index d165cfc..ec46572 100644 --- a/Assets/Scripts/LogScripts/dto/GameConfigDTO.cs +++ b/Assets/Scripts/LogScripts/dto/GameConfigDTO.cs @@ -9,4 +9,5 @@ public class GameConfigDTO public CellTypeDTO[] cells_type; public string team0_name; public string team1_name; + public int winner; } diff --git a/Assets/Scripts/Map/GameManager.cs b/Assets/Scripts/Map/GameManager.cs index 59bbf42..00b563b 100644 --- a/Assets/Scripts/Map/GameManager.cs +++ b/Assets/Scripts/Map/GameManager.cs @@ -10,7 +10,8 @@ public class GameManager : MonoBehaviour { public GameObject InGame; public GameObject GameLogBrowser; - + [SerializeField] private GameObject winnerPanel; + [SerializeField] private TextMeshProUGUI winnerText; [SerializeField] private GameObject antPrefab; [SerializeField] private GameObject cell_empty; [SerializeField] private GameObject cell_wall; @@ -53,7 +54,8 @@ public void StartGameManager(GameLog gameLog) { GameLogBrowser.SetActive(false); InGame.SetActive(true); - + + winnerPanel.SetActive(false); baseTime = UIManager.Instance.BaseTime; this.gameLog = gameLog; base1.GetComponent().SetMaxHealth(gameLog.Map.BaseHealth); @@ -61,6 +63,14 @@ public void StartGameManager(GameLog gameLog) ShowMap(); FindObjectOfType().setMaid(gameLog.Map.cells.Length * width, gameLog.Map.cells[0].Length * haight); MaxTurns = gameLog.Turns.Length; + if (gameLog.Map.WinnerTeam==0) + { + winnerText.text = gameLog.Map.Team0Name; + } + else + { + winnerText.text = gameLog.Map.Team1Name; + } } public void ApplyLog(int turn, bool isAnim) @@ -69,19 +79,19 @@ public void ApplyLog(int turn, bool isAnim) if (currTurn == turn - 1 && isAnim) { playAnime = true; - StartCoroutine(ApplyTurnAnim(gameLog.Turns[turn - 1])); + StartCoroutine(ApplyTurnAnim(gameLog.Turns[turn - 1],turn == MaxTurns)); } else { playAnime = false; - ApplyTurnUnAnim(gameLog.Turns[turn - 1]); + ApplyTurnUnAnim(gameLog.Turns[turn - 1],turn == MaxTurns); } currTurn = turn; } - private void ApplyTurnUnAnim(Turn turn) + private void ApplyTurnUnAnim(Turn turn, bool lastTurn) { team0_alive_workers.text = turn.team0_alive_workers.ToString(); team0_alive_soldiers.text = turn.team0_alive_soldiers.ToString(); @@ -119,9 +129,18 @@ private void ApplyTurnUnAnim(Turn turn) antScript.Set(ant.Row, ant.Col, ant.Team, ant.Type, ant.Health, ant.Resource, ant.Id, numbers, n); AntsTable.Add(ant.Id, antObject); } + + if (lastTurn) + { + winnerPanel.SetActive(true); + } + else + { + winnerPanel.SetActive(false); + } } - private IEnumerator ApplyTurnAnim(Turn turn) + private IEnumerator ApplyTurnAnim(Turn turn,bool lastTurn) { team0_alive_workers.text = turn.team0_alive_workers.ToString(); team0_alive_soldiers.text = turn.team0_alive_soldiers.ToString(); @@ -220,6 +239,14 @@ private IEnumerator ApplyTurnAnim(Turn turn) // Debug.Log("end phase1"); yield return new WaitForSecondsRealtime((baseTime / 2) * UIManager.Instance.Speed); + if (lastTurn) + { + winnerPanel.SetActive(true); + } + else + { + winnerPanel.SetActive(false); + } if (playAnime) { //move ants time diff --git a/Assets/Scripts/MoveCamera.cs b/Assets/Scripts/MoveCamera.cs index d475489..c5e0fa0 100644 --- a/Assets/Scripts/MoveCamera.cs +++ b/Assets/Scripts/MoveCamera.cs @@ -4,9 +4,11 @@ using System; using UnityEngine; using System.Collections; +using UnityEngine.UIElements; public class MoveCamera : MonoBehaviour { + [SerializeField] private float ArrowMoveSpeed; public float dragSpeed = 2; private Vector3 dragOrigin; public float zoomSpeed = 10.0f; @@ -39,16 +41,44 @@ void Update() { myCamera.orthographicSize = 0; } - if (Input.GetMouseButtonDown(2)) + + Vector3 pos; + Vector3 move; + if (Input.GetAxis("Vertical") < 0) + { + pos = Vector3.up; + move = new Vector3(-pos.x * ArrowMoveSpeed * Time.deltaTime, -pos.y * ArrowMoveSpeed * Time.deltaTime, 0); + transform.Translate(move, Space.World); + } + if (Input.GetAxis("Vertical") > 0) + { + pos = Vector3.down; + move = new Vector3(-pos.x * ArrowMoveSpeed * Time.deltaTime, -pos.y * ArrowMoveSpeed * Time.deltaTime, 0); + transform.Translate(move, Space.World); + } + if (Input.GetAxis("Horizontal") < 0) + { + pos = Vector3.right; + move = new Vector3(-pos.x * ArrowMoveSpeed * Time.deltaTime, -pos.y * ArrowMoveSpeed * Time.deltaTime, 0); + transform.Translate(move, Space.World); + } + if (Input.GetAxis("Horizontal") > 0) + { + pos = Vector3.left; + move = new Vector3(-pos.x * ArrowMoveSpeed * Time.deltaTime, -pos.y * ArrowMoveSpeed * Time.deltaTime, 0); + transform.Translate(move, Space.World); + } + + if (Input.GetMouseButtonDown(0)) { dragOrigin = Input.mousePosition; return; } - if (!Input.GetMouseButton(2)) return; + if (!Input.GetMouseButton(0)) return; - Vector3 pos = Camera.main.ScreenToViewportPoint(Input.mousePosition - dragOrigin); - Vector3 move = new Vector3(-pos.x * dragSpeed, -pos.y * dragSpeed, 0); + pos = Camera.main.ScreenToViewportPoint(Input.mousePosition - dragOrigin); + move = new Vector3(-pos.x * dragSpeed * Time.deltaTime, -pos.y * dragSpeed * Time.deltaTime, 0); transform.Translate(move, Space.World); } diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset index b16147e..38d6859 100644 --- a/ProjectSettings/InputManager.asset +++ b/ProjectSettings/InputManager.asset @@ -13,7 +13,7 @@ InputManager: positiveButton: right altNegativeButton: a altPositiveButton: d - gravity: 3 + gravity: 50 dead: 0.001 sensitivity: 3 snap: 1 @@ -29,7 +29,7 @@ InputManager: positiveButton: up altNegativeButton: s altPositiveButton: w - gravity: 3 + gravity: 50 dead: 0.001 sensitivity: 3 snap: 1