[Fix] Refactoring (Remove GameView) TEMP

This commit is contained in:
2026-06-07 00:18:30 +07:00
parent a9767c5301
commit 79a928ae52
34 changed files with 965 additions and 805 deletions
+17
View File
@@ -10,6 +10,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 2854659401256325699} - component: {fileID: 2854659401256325699}
- component: {fileID: 5452205749846460716} - component: {fileID: 5452205749846460716}
- component: {fileID: -4096144217532421454}
m_Layer: 0 m_Layer: 0
m_Name: BoardGrid m_Name: BoardGrid
m_TagString: Untagged m_TagString: Untagged
@@ -60,3 +61,19 @@ MonoBehaviour:
m_Spacing: {x: 0, y: 0} m_Spacing: {x: 0, y: 0}
m_Constraint: 0 m_Constraint: 0
m_ConstraintCount: 2 m_ConstraintCount: 2
--- !u!114 &-4096144217532421454
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 463985621338212375}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8e5eb8dfe520e3b40af304e66728dcfb, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Minesweeper.Presentation.Views.BoardView
root: {fileID: 463985621338212375}
boardPanel: {fileID: 2854659401256325699}
gridLayoutGroup: {fileID: 5452205749846460716}
uiConfig: {fileID: 11400000, guid: c8b7785713c7c8b49b853f7e5028a4fa, type: 2}
+3 -3
View File
@@ -2669,19 +2669,19 @@ MonoBehaviour:
minText: {fileID: 4504773017523582976} minText: {fileID: 4504773017523582976}
maxText: {fileID: 6866883084726833735} maxText: {fileID: 6866883084726833735}
valueText: {fileID: 4474316482196456833} valueText: {fileID: 4474316482196456833}
valueLabel: 'Size X:' valueLabel: 'Size X: '
sizeYSlider: sizeYSlider:
slider: {fileID: 4051923562216906313} slider: {fileID: 4051923562216906313}
minText: {fileID: 1453579952739003993} minText: {fileID: 1453579952739003993}
maxText: {fileID: 8013579874201281113} maxText: {fileID: 8013579874201281113}
valueText: {fileID: 8926983590126121119} valueText: {fileID: 8926983590126121119}
valueLabel: 'Size Y:' valueLabel: 'Size Y: '
minesSlider: minesSlider:
slider: {fileID: 6456819381917595383} slider: {fileID: 6456819381917595383}
minText: {fileID: 3264166992253475585} minText: {fileID: 3264166992253475585}
maxText: {fileID: 6204093840248163070} maxText: {fileID: 6204093840248163070}
valueText: {fileID: 7868341748139096968} valueText: {fileID: 7868341748139096968}
valueLabel: 'Mines count:' valueLabel: 'Mines count: '
--- !u!1 &7723311763242053893 --- !u!1 &7723311763242053893
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
+168 -106
View File
@@ -12,7 +12,7 @@ GameObject:
- component: {fileID: 1323395922687814} - component: {fileID: 1323395922687814}
- component: {fileID: 2396570544786180172} - component: {fileID: 2396570544786180172}
m_Layer: 0 m_Layer: 0
m_Name: Label m_Name: Text (Continue)
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@@ -59,7 +59,7 @@ MonoBehaviour:
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
@@ -67,8 +67,8 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: Continue m_text: Continue
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontAsset: {fileID: 11400000, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: -6188865965018868098, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
@@ -92,10 +92,10 @@ MonoBehaviour:
m_faceColor: m_faceColor:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4294967295
m_fontSize: 42.95 m_fontSize: 30
m_fontSizeBase: 36 m_fontSizeBase: 30
m_fontWeight: 400 m_fontWeight: 400
m_enableAutoSizing: 1 m_enableAutoSizing: 0
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
@@ -131,12 +131,118 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0 m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1 m_useMaxVisibleDescender: 1
m_pageToDisplay: 1 m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0} m_margin: {x: 10, y: 10, z: 10, w: 10}
m_isUsingLegacyAnimationComponent: 0 m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0 m_isVolumetricText: 0
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0} m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &1586981547480857339
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6224274704053806388}
- component: {fileID: 4145956972674934222}
- component: {fileID: 6660518877729283613}
- component: {fileID: 8534273822372783954}
m_Layer: 0
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6224274704053806388
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1586981547480857339}
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: 5608047556670537065}
- {fileID: 5707606247840532089}
- {fileID: 9043826669907694646}
- {fileID: 8881365639295328946}
m_Father: {fileID: 8980764968637402581}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 483.0835, y: 328}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4145956972674934222
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1586981547480857339}
m_CullTransparentMesh: 1
--- !u!114 &6660518877729283613
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1586981547480857339}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 3130755090995886313, guid: 4c4c10e49c2777748899d811a0e67689, type: 3}
m_Type: 1
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 &8534273822372783954
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1586981547480857339}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.VerticalLayoutGroup
m_Padding:
m_Left: 15
m_Right: 15
m_Top: 15
m_Bottom: 15
m_ChildAlignment: 4
m_Spacing: 16
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1 &2637081591348788270 --- !u!1 &2637081591348788270
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -163,18 +269,18 @@ RectTransform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2637081591348788270} m_GameObject: {fileID: 2637081591348788270}
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_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1294402234449297828} - {fileID: 1294402234449297828}
m_Father: {fileID: 8980764968637402581} m_Father: {fileID: 6224274704053806388}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 180, y: 48} m_SizeDelta: {x: 400, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3470312087431380435 --- !u!222 &3470312087431380435
CanvasRenderer: CanvasRenderer:
@@ -204,8 +310,8 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Sprite: {fileID: 0} m_Sprite: {fileID: -4571551822685222379, guid: 4c4c10e49c2777748899d811a0e67689, type: 3}
m_Type: 0 m_Type: 1
m_PreserveAspect: 0 m_PreserveAspect: 0
m_FillCenter: 1 m_FillCenter: 1
m_FillMethod: 4 m_FillMethod: 4
@@ -213,7 +319,7 @@ MonoBehaviour:
m_FillClockwise: 1 m_FillClockwise: 1
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1 m_PixelsPerUnitMultiplier: 1.94
--- !u!114 &6836717569141764482 --- !u!114 &6836717569141764482
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -284,18 +390,18 @@ RectTransform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2638123625286085122} m_GameObject: {fileID: 2638123625286085122}
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_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 897987131459102557} - {fileID: 897987131459102557}
m_Father: {fileID: 8980764968637402581} m_Father: {fileID: 6224274704053806388}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 180, y: 48} m_SizeDelta: {x: 400, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7002517246287558728 --- !u!222 &7002517246287558728
CanvasRenderer: CanvasRenderer:
@@ -325,8 +431,8 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Sprite: {fileID: 0} m_Sprite: {fileID: -4571551822685222379, guid: 4c4c10e49c2777748899d811a0e67689, type: 3}
m_Type: 0 m_Type: 1
m_PreserveAspect: 0 m_PreserveAspect: 0
m_FillCenter: 1 m_FillCenter: 1
m_FillMethod: 4 m_FillMethod: 4
@@ -334,7 +440,7 @@ MonoBehaviour:
m_FillClockwise: 1 m_FillClockwise: 1
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1 m_PixelsPerUnitMultiplier: 1.94
--- !u!114 &623936683249341502 --- !u!114 &623936683249341502
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -389,8 +495,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 8980764968637402581} - component: {fileID: 8980764968637402581}
- component: {fileID: 8794113368554700498} - component: {fileID: 8794113368554700498}
- component: {fileID: 2001891034146769603} - component: {fileID: 7010459690024596299}
- component: {fileID: 3188781103839045936}
m_Layer: 0 m_Layer: 0
m_Name: PausePanel m_Name: PausePanel
m_TagString: Untagged m_TagString: Untagged
@@ -410,10 +515,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 5608047556670537065} - {fileID: 6224274704053806388}
- {fileID: 5707606247840532089}
- {fileID: 9043826669907694646}
- {fileID: 8881365639295328946}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
@@ -429,7 +531,7 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2814582388565546678} m_GameObject: {fileID: 2814582388565546678}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!114 &2001891034146769603 --- !u!114 &7010459690024596299
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@@ -438,53 +540,13 @@ MonoBehaviour:
m_GameObject: {fileID: 2814582388565546678} m_GameObject: {fileID: 2814582388565546678}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Script: {fileID: 11500000, guid: 548c3a1ddca35cc4d823c260a88dcecf, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image m_EditorClassIdentifier: Assembly-CSharp::Minesweeper.Presentation.Views.PauseView
m_Material: {fileID: 0} root: {fileID: 2814582388565546678}
m_Color: {r: 0.08, g: 0.08, b: 0.08, a: 0.72} restartButton: {fileID: 6144314195671038853}
m_RaycastTarget: 1 resumeButton: {fileID: 623936683249341502}
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} mainMenuButton: {fileID: 6836717569141764482}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
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 &3188781103839045936
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2814582388565546678}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.VerticalLayoutGroup
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 4
m_Spacing: 16
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1 &4212380874842696201 --- !u!1 &4212380874842696201
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -497,7 +559,7 @@ GameObject:
- component: {fileID: 6029337994669973288} - component: {fileID: 6029337994669973288}
- component: {fileID: 5250592819783767390} - component: {fileID: 5250592819783767390}
m_Layer: 0 m_Layer: 0
m_Name: PauseTitle m_Name: Text (Pause)
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@@ -510,12 +572,12 @@ RectTransform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4212380874842696201} m_GameObject: {fileID: 4212380874842696201}
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_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 8980764968637402581} m_Father: {fileID: 6224274704053806388}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
@@ -552,15 +614,15 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: PAUSED m_text: PAUSED
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontAsset: {fileID: 11400000, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: -6188865965018868098, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
m_fontColor32: m_fontColor32:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4278190080
m_fontColor: {r: 1, g: 1, b: 1, a: 1} m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0 m_enableVertexGradient: 0
m_colorMode: 3 m_colorMode: 3
m_fontColorGradient: m_fontColorGradient:
@@ -577,13 +639,13 @@ MonoBehaviour:
m_faceColor: m_faceColor:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4294967295
m_fontSize: 57.25 m_fontSize: 44.7
m_fontSizeBase: 36 m_fontSizeBase: 44.7
m_fontWeight: 400 m_fontWeight: 400
m_enableAutoSizing: 1 m_enableAutoSizing: 0
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 1
m_HorizontalAlignment: 2 m_HorizontalAlignment: 2
m_VerticalAlignment: 512 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
@@ -634,7 +696,7 @@ GameObject:
- component: {fileID: 1027039822612322709} - component: {fileID: 1027039822612322709}
- component: {fileID: 263772625500567369} - component: {fileID: 263772625500567369}
m_Layer: 0 m_Layer: 0
m_Name: Label m_Name: Text (Restart)
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@@ -681,7 +743,7 @@ MonoBehaviour:
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
@@ -689,8 +751,8 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: Restart m_text: Restart
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontAsset: {fileID: 11400000, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: -6188865965018868098, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
@@ -714,10 +776,10 @@ MonoBehaviour:
m_faceColor: m_faceColor:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4294967295
m_fontSize: 42.95 m_fontSize: 30
m_fontSizeBase: 36 m_fontSizeBase: 30
m_fontWeight: 400 m_fontWeight: 400
m_enableAutoSizing: 1 m_enableAutoSizing: 0
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
@@ -753,7 +815,7 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0 m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1 m_useMaxVisibleDescender: 1
m_pageToDisplay: 1 m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0} m_margin: {x: 10, y: 10, z: 10, w: 10}
m_isUsingLegacyAnimationComponent: 0 m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0 m_isVolumetricText: 0
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
@@ -771,7 +833,7 @@ GameObject:
- component: {fileID: 6171265826240314641} - component: {fileID: 6171265826240314641}
- component: {fileID: 6864102600949450015} - component: {fileID: 6864102600949450015}
m_Layer: 0 m_Layer: 0
m_Name: Label m_Name: Text (MainMenu)
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@@ -818,7 +880,7 @@ MonoBehaviour:
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
@@ -826,8 +888,8 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: Main Menu m_text: Main Menu
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontAsset: {fileID: 11400000, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: -6188865965018868098, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
@@ -851,10 +913,10 @@ MonoBehaviour:
m_faceColor: m_faceColor:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4294967295
m_fontSize: 36.4 m_fontSize: 30
m_fontSizeBase: 36 m_fontSizeBase: 30
m_fontWeight: 400 m_fontWeight: 400
m_enableAutoSizing: 1 m_enableAutoSizing: 0
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
@@ -890,7 +952,7 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0 m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1 m_useMaxVisibleDescender: 1
m_pageToDisplay: 1 m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0} m_margin: {x: 10, y: 10, z: 10, w: 10}
m_isUsingLegacyAnimationComponent: 0 m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0 m_isVolumetricText: 0
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
@@ -922,18 +984,18 @@ RectTransform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8998480090649882076} m_GameObject: {fileID: 8998480090649882076}
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_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 5392971194067563766} - {fileID: 5392971194067563766}
m_Father: {fileID: 8980764968637402581} m_Father: {fileID: 6224274704053806388}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 180, y: 48} m_SizeDelta: {x: 400, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2049058910800172261 --- !u!222 &2049058910800172261
CanvasRenderer: CanvasRenderer:
@@ -963,8 +1025,8 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Sprite: {fileID: 0} m_Sprite: {fileID: -4571551822685222379, guid: 4c4c10e49c2777748899d811a0e67689, type: 3}
m_Type: 0 m_Type: 1
m_PreserveAspect: 0 m_PreserveAspect: 0
m_FillCenter: 1 m_FillCenter: 1
m_FillMethod: 4 m_FillMethod: 4
@@ -972,7 +1034,7 @@ MonoBehaviour:
m_FillClockwise: 1 m_FillClockwise: 1
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1 m_PixelsPerUnitMultiplier: 1.94
--- !u!114 &6144314195671038853 --- !u!114 &6144314195671038853
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
+280 -80
View File
@@ -1,5 +1,142 @@
%YAML 1.1 %YAML 1.1
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!1 &287223920623125733
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4593031335885359894}
- component: {fileID: 2402291059127653790}
- component: {fileID: 6396269881041885796}
m_Layer: 0
m_Name: Text (Result)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4593031335885359894
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 287223920623125733}
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: 552927392666894915}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 317.9436, y: 51}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2402291059127653790
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 287223920623125733}
m_CullTransparentMesh: 1
--- !u!114 &6396269881041885796
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 287223920623125733}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Result
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_sharedMaterial: {fileID: -6188865965018868098, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 30
m_fontSizeBase: 30
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterHorizontalScale: 1
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 5, y: 5, z: 5, w: 5}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &999041870156624000 --- !u!1 &999041870156624000
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -12,7 +149,7 @@ GameObject:
- component: {fileID: 8382717949319705333} - component: {fileID: 8382717949319705333}
- component: {fileID: 7260907240647165918} - component: {fileID: 7260907240647165918}
m_Layer: 0 m_Layer: 0
m_Name: Label m_Name: Text (MainMenu)
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@@ -59,7 +196,7 @@ MonoBehaviour:
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
@@ -67,14 +204,14 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: Main Menu m_text: Main Menu
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontAsset: {fileID: 11400000, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: -6188865965018868098, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
m_fontColor32: m_fontColor32:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1} m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0 m_enableVertexGradient: 0
m_colorMode: 3 m_colorMode: 3
@@ -87,15 +224,15 @@ MonoBehaviour:
m_spriteAsset: {fileID: 0} m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0 m_tintAllSprites: 0
m_StyleSheet: {fileID: 0} m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: 0 m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0 m_overrideHtmlColors: 0
m_faceColor: m_faceColor:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4294967295
m_fontSize: 36 m_fontSize: 30
m_fontSizeBase: 36 m_fontSizeBase: 30
m_fontWeight: 400 m_fontWeight: 400
m_enableAutoSizing: 1 m_enableAutoSizing: 0
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
@@ -131,7 +268,7 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0 m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1 m_useMaxVisibleDescender: 1
m_pageToDisplay: 1 m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0} m_margin: {x: 5, y: 5, z: 5, w: 5}
m_isUsingLegacyAnimationComponent: 0 m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0 m_isVolumetricText: 0
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
@@ -149,7 +286,7 @@ GameObject:
- component: {fileID: 5737558796278534139} - component: {fileID: 5737558796278534139}
- component: {fileID: 6423146057671714179} - component: {fileID: 6423146057671714179}
m_Layer: 0 m_Layer: 0
m_Name: Label m_Name: Text (Restart)
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@@ -196,7 +333,7 @@ MonoBehaviour:
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
m_OnCullStateChanged: m_OnCullStateChanged:
@@ -204,14 +341,14 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: Restart m_text: Restart
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontAsset: {fileID: 11400000, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: -6188865965018868098, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
m_fontColor32: m_fontColor32:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1} m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0 m_enableVertexGradient: 0
m_colorMode: 3 m_colorMode: 3
@@ -224,15 +361,15 @@ MonoBehaviour:
m_spriteAsset: {fileID: 0} m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0 m_tintAllSprites: 0
m_StyleSheet: {fileID: 0} m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: 0 m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0 m_overrideHtmlColors: 0
m_faceColor: m_faceColor:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4294967295
m_fontSize: 36 m_fontSize: 30
m_fontSizeBase: 36 m_fontSizeBase: 30
m_fontWeight: 400 m_fontWeight: 400
m_enableAutoSizing: 1 m_enableAutoSizing: 0
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
@@ -268,7 +405,7 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0 m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1 m_useMaxVisibleDescender: 1
m_pageToDisplay: 1 m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0} m_margin: {x: 5, y: 5, z: 5, w: 5}
m_isUsingLegacyAnimationComponent: 0 m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0 m_isVolumetricText: 0
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
@@ -300,18 +437,18 @@ RectTransform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6011430087630309393} m_GameObject: {fileID: 6011430087630309393}
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_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 7716741039240103859} - {fileID: 7716741039240103859}
m_Father: {fileID: 1711089644684175522} m_Father: {fileID: 552927392666894915}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 180, y: 48} m_SizeDelta: {x: 320, y: 48}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5645585721074283479 --- !u!222 &5645585721074283479
CanvasRenderer: CanvasRenderer:
@@ -341,8 +478,8 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Sprite: {fileID: 0} m_Sprite: {fileID: -4571551822685222379, guid: 4c4c10e49c2777748899d811a0e67689, type: 3}
m_Type: 0 m_Type: 1
m_PreserveAspect: 0 m_PreserveAspect: 0
m_FillCenter: 1 m_FillCenter: 1
m_FillMethod: 4 m_FillMethod: 4
@@ -350,7 +487,7 @@ MonoBehaviour:
m_FillClockwise: 1 m_FillClockwise: 1
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1 m_PixelsPerUnitMultiplier: 2
--- !u!114 &8067593845912844089 --- !u!114 &8067593845912844089
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -420,18 +557,18 @@ RectTransform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6734942153781218244} m_GameObject: {fileID: 6734942153781218244}
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_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 1711089644684175522} m_Father: {fileID: 552927392666894915}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 300, y: 64} m_SizeDelta: {x: 330, y: 64}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 1}
--- !u!222 &8517643472744692661 --- !u!222 &8517643472744692661
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -462,15 +599,15 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: GAME OVER m_text: GAME OVER
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontAsset: {fileID: 11400000, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: -6188865965018868098, guid: a9e574c3959daac439febd16011e9205, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
m_fontColor32: m_fontColor32:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4278190080
m_fontColor: {r: 1, g: 1, b: 1, a: 1} m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0 m_enableVertexGradient: 0
m_colorMode: 3 m_colorMode: 3
m_fontColorGradient: m_fontColorGradient:
@@ -482,18 +619,18 @@ MonoBehaviour:
m_spriteAsset: {fileID: 0} m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0 m_tintAllSprites: 0
m_StyleSheet: {fileID: 0} m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: 0 m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0 m_overrideHtmlColors: 0
m_faceColor: m_faceColor:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4294967295
m_fontSize: 36 m_fontSize: 40
m_fontSizeBase: 36 m_fontSizeBase: 40
m_fontWeight: 400 m_fontWeight: 400
m_enableAutoSizing: 1 m_enableAutoSizing: 0
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 1
m_HorizontalAlignment: 2 m_HorizontalAlignment: 2
m_VerticalAlignment: 512 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
@@ -542,15 +679,14 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 1711089644684175522} - component: {fileID: 1711089644684175522}
- component: {fileID: 2645373253716865156} - component: {fileID: 2645373253716865156}
- component: {fileID: 3592721359535107435} - component: {fileID: -2277025653673582644}
- component: {fileID: 732723309192048358}
m_Layer: 0 m_Layer: 0
m_Name: ResultPanel m_Name: ResultPanel
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!224 &1711089644684175522 --- !u!224 &1711089644684175522
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -563,9 +699,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 8189959685470005628} - {fileID: 552927392666894915}
- {fileID: 1427833870319099182}
- {fileID: 5791868949534554285}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
@@ -581,7 +715,7 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6869455415096409219} m_GameObject: {fileID: 6869455415096409219}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!114 &3592721359535107435 --- !u!114 &-2277025653673582644
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@@ -590,34 +724,62 @@ MonoBehaviour:
m_GameObject: {fileID: 6869455415096409219} m_GameObject: {fileID: 6869455415096409219}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Script: {fileID: 11500000, guid: b0b04ab8a2ef00b4e8d36a96e4f034d8, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image m_EditorClassIdentifier: Assembly-CSharp::Minesweeper.Presentation.Views.ResultView
m_Material: {fileID: 0} root: {fileID: 6869455415096409219}
m_Color: {r: 0.08, g: 0.08, b: 0.08, a: 0.72} restartButton: {fileID: 4556636970913567574}
m_RaycastTarget: 1 mainMenuButton: {fileID: 8067593845912844089}
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} resultText: {fileID: 6396269881041885796}
m_Maskable: 1 --- !u!1 &8309714601234156502
m_OnCullStateChanged: GameObject:
m_PersistentCalls: m_ObjectHideFlags: 0
m_Calls: [] m_CorrespondingSourceObject: {fileID: 0}
m_Sprite: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_Type: 0 m_PrefabAsset: {fileID: 0}
m_PreserveAspect: 0 serializedVersion: 6
m_FillCenter: 1 m_Component:
m_FillMethod: 4 - component: {fileID: 552927392666894915}
m_FillAmount: 1 - component: {fileID: 4744414248438308959}
m_FillClockwise: 1 - component: {fileID: 3970833251751774975}
m_FillOrigin: 0 - component: {fileID: 4674113591805833902}
m_UseSpriteMesh: 0 m_Layer: 0
m_PixelsPerUnitMultiplier: 1 m_Name: Content
--- !u!114 &732723309192048358 m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &552927392666894915
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8309714601234156502}
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: 8189959685470005628}
- {fileID: 1427833870319099182}
- {fileID: 5791868949534554285}
- {fileID: 4593031335885359894}
m_Father: {fileID: 1711089644684175522}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 400, y: 350}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &4744414248438308959
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6869455415096409219} m_GameObject: {fileID: 8309714601234156502}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
@@ -637,6 +799,44 @@ MonoBehaviour:
m_ChildScaleWidth: 0 m_ChildScaleWidth: 0
m_ChildScaleHeight: 0 m_ChildScaleHeight: 0
m_ReverseArrangement: 0 m_ReverseArrangement: 0
--- !u!222 &3970833251751774975
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8309714601234156502}
m_CullTransparentMesh: 1
--- !u!114 &4674113591805833902
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8309714601234156502}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 3130755090995886313, guid: 4c4c10e49c2777748899d811a0e67689, type: 3}
m_Type: 1
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!1 &8555883531386717516 --- !u!1 &8555883531386717516
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -663,18 +863,18 @@ RectTransform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8555883531386717516} m_GameObject: {fileID: 8555883531386717516}
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_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 4475925576080504750} - {fileID: 4475925576080504750}
m_Father: {fileID: 1711089644684175522} m_Father: {fileID: 552927392666894915}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 180, y: 48} m_SizeDelta: {x: 320, y: 48}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2044360681731469335 --- !u!222 &2044360681731469335
CanvasRenderer: CanvasRenderer:
@@ -704,8 +904,8 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Sprite: {fileID: 0} m_Sprite: {fileID: -4571551822685222379, guid: 4c4c10e49c2777748899d811a0e67689, type: 3}
m_Type: 0 m_Type: 1
m_PreserveAspect: 0 m_PreserveAspect: 0
m_FillCenter: 1 m_FillCenter: 1
m_FillMethod: 4 m_FillMethod: 4
@@ -713,7 +913,7 @@ MonoBehaviour:
m_FillClockwise: 1 m_FillClockwise: 1
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1 m_PixelsPerUnitMultiplier: 2
--- !u!114 &4556636970913567574 --- !u!114 &4556636970913567574
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -21,7 +21,9 @@ namespace Minesweeper.Infrastructure
[SerializeField] private Transform contentRoot; [SerializeField] private Transform contentRoot;
[SerializeField] private TopPanelView topPanelView; [SerializeField] private TopPanelView topPanelView;
[SerializeField] private MainMenuView mainMenuView; [SerializeField] private MainMenuView mainMenuView;
[SerializeField] private GameView gameView; [SerializeField] private BoardView boardView;
[SerializeField] private PauseView pauseView;
[SerializeField] private ResultView resultView;
protected override void Configure(IContainerBuilder builder) protected override void Configure(IContainerBuilder builder)
{ {
@@ -45,9 +47,19 @@ namespace Minesweeper.Infrastructure
mainMenuView = screenRefs.MainMenuView; mainMenuView = screenRefs.MainMenuView;
} }
if (gameView != null && screenRefs.BoardPanel != null) if (screenRefs.BoardView != null)
{ {
gameView.BindScreens(screenRefs); boardView = screenRefs.BoardView;
}
if (screenRefs.PauseView != null)
{
pauseView = screenRefs.PauseView;
}
if (screenRefs.ResultView != null)
{
resultView = screenRefs.ResultView;
} }
if (topPanelView != null) if (topPanelView != null)
@@ -69,14 +81,32 @@ namespace Minesweeper.Infrastructure
builder.Register<NullMainMenuView>(Lifetime.Singleton).As<IMainMenuView>(); builder.Register<NullMainMenuView>(Lifetime.Singleton).As<IMainMenuView>();
} }
if (gameView != null) if (boardView != null)
{ {
gameView.BindConfig(resolvedUiConfig); boardView.BindConfig(resolvedUiConfig);
builder.RegisterComponent(gameView).As<IGameView>(); builder.RegisterComponent(boardView).As<IBoardView>();
} }
else else
{ {
builder.Register<NullGameView>(Lifetime.Singleton).As<IGameView>(); builder.Register<NullBoardView>(Lifetime.Singleton).As<IBoardView>();
}
if (pauseView != null)
{
builder.RegisterComponent(pauseView).As<IPauseView>();
}
else
{
builder.Register<NullPauseView>(Lifetime.Singleton).As<IPauseView>();
}
if (resultView != null)
{
builder.RegisterComponent(resultView).As<IResultView>();
}
else
{
builder.Register<NullResultView>(Lifetime.Singleton).As<IResultView>();
} }
builder.Register<SelectFieldCommandHandler>(Lifetime.Singleton); builder.Register<SelectFieldCommandHandler>(Lifetime.Singleton);
@@ -1,18 +1,12 @@
using Minesweeper.Config; using Minesweeper.Config;
using Minesweeper.Core; using Minesweeper.Core;
using Minesweeper.Presentation.Views; using Minesweeper.Presentation.Views;
using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
namespace Minesweeper.Presentation.Factories namespace Minesweeper.Presentation.Factories
{ {
public sealed class CellViewFactory : ICellViewFactory public sealed class CellViewFactory : ICellViewFactory
{ {
private const string ContentImagePath = "Content/Image";
private const string ContentLabelPath = "Content/Text (TMP)";
private const string ContentPath = "Content";
private readonly MinesweeperUiConfig uiConfig; private readonly MinesweeperUiConfig uiConfig;
public CellViewFactory(MinesweeperUiConfig uiConfig) public CellViewFactory(MinesweeperUiConfig uiConfig)
@@ -23,22 +17,23 @@ namespace Minesweeper.Presentation.Factories
public CellView CreateCell(BoardCellData cell, Transform parent) public CellView CreateCell(BoardCellData cell, Transform parent)
{ {
var prefab = uiConfig.CellButtonPrefab; var prefab = uiConfig.CellButtonPrefab;
var go = prefab != null ? Object.Instantiate(prefab, parent) : CreateFallbackCell(parent); if (prefab == null)
{
Debug.LogError("CellViewFactory failed: CellButtonPrefab is not assigned.");
return null;
}
var go = Object.Instantiate(prefab, parent);
go.name = BuildCellName(cell.X, cell.Y, cell.DisplayValue); go.name = BuildCellName(cell.X, cell.Y, cell.DisplayValue);
var view = go.GetComponent<CellView>(); var view = go.GetComponent<CellView>();
if (view == null) if (view == null)
{ {
view = go.AddComponent<CellView>(); Debug.LogError($"CellViewFactory failed: '{prefab.name}' is missing CellView.");
Object.Destroy(go);
return null;
} }
var button = go.GetComponent<Button>();
var backgroundImage = go.GetComponent<Image>();
var contentRoot = FindComponent<RectTransform>(go.transform, ContentPath);
var contentImage = FindComponent<Image>(go.transform, ContentImagePath);
var label = FindComponent<TMP_Text>(go.transform, ContentLabelPath);
view.Bind(button, backgroundImage, contentRoot, contentImage, label);
view.AutoBind();
view.Initialize(cell.X, cell.Y); view.Initialize(cell.X, cell.Y);
return view; return view;
} }
@@ -53,41 +48,5 @@ namespace Minesweeper.Presentation.Factories
return $"bt_{x}_{y}_{displayValue}"; return $"bt_{x}_{y}_{displayValue}";
} }
private static T FindComponent<T>(Transform root, string path) where T : Component
{
var child = root.Find(path);
return child != null ? child.GetComponent<T>() : null;
}
private static GameObject CreateFallbackCell(Transform parent)
{
var go = new GameObject("Cell", typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(Button));
go.transform.SetParent(parent, false);
var content = new GameObject("Content", typeof(RectTransform));
content.transform.SetParent(go.transform, false);
Stretch(content.GetComponent<RectTransform>());
var image = new GameObject("Image", typeof(RectTransform), typeof(CanvasRenderer), typeof(Image));
image.transform.SetParent(content.transform, false);
Stretch(image.GetComponent<RectTransform>());
var text = new GameObject("Text (TMP)", typeof(RectTransform), typeof(CanvasRenderer), typeof(TextMeshProUGUI));
text.transform.SetParent(content.transform, false);
Stretch(text.GetComponent<RectTransform>());
var label = text.GetComponent<TextMeshProUGUI>();
label.alignment = TextAlignmentOptions.Center;
label.enableAutoSizing = true;
return go;
}
private static void Stretch(RectTransform rectTransform)
{
rectTransform.anchorMin = Vector2.zero;
rectTransform.anchorMax = Vector2.one;
rectTransform.offsetMin = Vector2.zero;
rectTransform.offsetMax = Vector2.zero;
}
} }
} }
@@ -1,8 +1,6 @@
using Minesweeper.Config; using Minesweeper.Config;
using Minesweeper.Presentation.Views; using Minesweeper.Presentation.Views;
using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
namespace Minesweeper.Presentation.Factories namespace Minesweeper.Presentation.Factories
{ {
@@ -12,10 +10,6 @@ namespace Minesweeper.Presentation.Factories
private const string BoardGridName = "BoardGrid"; private const string BoardGridName = "BoardGrid";
private const string PausePanelName = "PausePanel"; private const string PausePanelName = "PausePanel";
private const string ResultPanelName = "ResultPanel"; private const string ResultPanelName = "ResultPanel";
private const string RestartButtonPath = "RestartButton";
private const string ContinueButtonPath = "ContinueButton";
private const string MainMenuButtonPath = "MainMenuButton";
private const string ResultTextPath = "ResultText";
public MinesweeperScreenRefs Spawn(Transform contentRoot, MinesweeperScreenCatalog catalog) public MinesweeperScreenRefs Spawn(Transform contentRoot, MinesweeperScreenCatalog catalog)
{ {
@@ -39,20 +33,20 @@ namespace Minesweeper.Presentation.Factories
var result = SpawnScreen(catalog.ResultPanelPrefab, contentRoot, ResultPanelName, 3); var result = SpawnScreen(catalog.ResultPanelPrefab, contentRoot, ResultPanelName, 3);
var mainMenuView = RequireComponent<MainMenuView>(mainMenu.transform, MainMenuPanelName); var mainMenuView = RequireComponent<MainMenuView>(mainMenu.transform, MainMenuPanelName);
mainMenuView.BindRoot(mainMenu); if (mainMenuView != null)
{
mainMenuView.BindRoot(mainMenu);
}
var boardView = RequireComponent<BoardView>(board.transform, BoardGridName);
var pauseView = RequireComponent<PauseView>(pause.transform, PausePanelName);
var resultView = RequireComponent<ResultView>(result.transform, ResultPanelName);
var refs = new MinesweeperScreenRefs( var refs = new MinesweeperScreenRefs(
mainMenuView, mainMenuView,
RequireComponent<RectTransform>(board.transform, BoardGridName), boardView,
RequireComponent<GridLayoutGroup>(board.transform, BoardGridName), pauseView,
pause, resultView);
RequireChildComponent<Button>(pause.transform, RestartButtonPath),
RequireChildComponent<Button>(pause.transform, ContinueButtonPath),
RequireChildComponent<Button>(pause.transform, MainMenuButtonPath),
result,
RequireChildComponent<Button>(result.transform, RestartButtonPath),
RequireChildComponent<Button>(result.transform, MainMenuButtonPath),
RequireChildComponent<TMP_Text>(result.transform, ResultTextPath));
mainMenu.SetActive(false); mainMenu.SetActive(false);
board.SetActive(false); board.SetActive(false);
@@ -92,24 +86,6 @@ namespace Minesweeper.Presentation.Factories
return component; return component;
} }
private static T RequireChildComponent<T>(Transform root, string path) where T : Component
{
var child = root.Find(path);
if (child == null)
{
Debug.LogError($"Minesweeper screen bootstrap failed: '{root.name}/{path}' was not found.");
return null;
}
var component = child.GetComponent<T>();
if (component == null)
{
Debug.LogError($"Minesweeper screen bootstrap failed: '{root.name}/{path}' is missing {typeof(T).Name}.");
}
return component;
}
private static void Stretch(RectTransform rectTransform) private static void Stretch(RectTransform rectTransform)
{ {
if (rectTransform == null) if (rectTransform == null)
@@ -13,82 +13,57 @@ namespace Minesweeper.Presentation.Presenters
private readonly IGamePauseService pauseService; private readonly IGamePauseService pauseService;
private readonly IGameReadModel readModel; private readonly IGameReadModel readModel;
private readonly IGameStateService gameStateService; private readonly IGameStateService gameStateService;
private readonly IGameTimerService timerService;
private readonly TopPanelPresenter topPanelPresenter; private readonly TopPanelPresenter topPanelPresenter;
private readonly IGameView view; private readonly IBoardView boardView;
private readonly IPauseView pauseView;
private readonly IResultView resultView;
private bool boardBuilt; private bool boardBuilt;
public GamePresenter(IGameCommandDispatcher commandDispatcher, ICellViewFactory cellViewFactory, IGamePauseService pauseService, IGameReadModel readModel, IGameStateService gameStateService, IGameTimerService timerService, TopPanelPresenter topPanelPresenter, IGameView view = null) public GamePresenter(IGameCommandDispatcher commandDispatcher, ICellViewFactory cellViewFactory, IGamePauseService pauseService, IGameReadModel readModel, IGameStateService gameStateService, TopPanelPresenter topPanelPresenter, IBoardView boardView, IPauseView pauseView, IResultView resultView)
{ {
this.commandDispatcher = commandDispatcher; this.commandDispatcher = commandDispatcher;
this.cellViewFactory = cellViewFactory; this.cellViewFactory = cellViewFactory;
this.pauseService = pauseService; this.pauseService = pauseService;
this.readModel = readModel; this.readModel = readModel;
this.gameStateService = gameStateService; this.gameStateService = gameStateService;
this.timerService = timerService;
this.topPanelPresenter = topPanelPresenter; this.topPanelPresenter = topPanelPresenter;
this.view = view; this.boardView = boardView;
this.pauseView = pauseView;
this.resultView = resultView;
} }
public void Initialize() public void Initialize()
{ {
if (view != null) boardView.CellPressStarted += OnCellPressStarted;
{ boardView.CellPressEnded += OnCellPressEnded;
view.RestartRequested += OnRestartRequested; boardView.PauseRequested += OnPauseRequested;
view.GoToMenuRequested += OnGoToMenuRequested; boardView.CellOpenRequested += OnCellOpenRequested;
view.PauseRequested += OnPauseRequested; boardView.CellFlagRequested += OnCellFlagRequested;
view.ResumeRequested += OnResumeRequested; pauseView.RestartRequested += OnRestartRequested;
view.CellPressStarted += OnCellPressStarted; pauseView.ResumeRequested += OnResumeRequested;
view.CellPressEnded += OnCellPressEnded; pauseView.GoToMenuRequested += OnGoToMenuRequested;
view.CellOpenRequested += OnCellOpenRequested; resultView.RestartRequested += OnRestartRequested;
view.CellFlagRequested += OnCellFlagRequested; resultView.GoToMenuRequested += OnGoToMenuRequested;
gameStateService.StateChanged += OnStateChanged; gameStateService.StateChanged += OnStateChanged;
pauseService.PauseChanged += OnPauseChanged; pauseService.PauseChanged += OnPauseChanged;
timerService.TimeChanged += OnTimeChanged; OnStateChanged(gameStateService.Current);
OnStateChanged(gameStateService.Current); OnPauseChanged(pauseService.IsPaused);
OnPauseChanged(pauseService.IsPaused);
OnTimeChanged(timerService.ElapsedSeconds);
}
} }
public void Dispose() public void Dispose()
{ {
if (view != null) boardView.CellPressStarted -= OnCellPressStarted;
{ boardView.CellPressEnded -= OnCellPressEnded;
view.RestartRequested -= OnRestartRequested; boardView.PauseRequested -= OnPauseRequested;
view.GoToMenuRequested -= OnGoToMenuRequested; boardView.CellOpenRequested -= OnCellOpenRequested;
view.PauseRequested -= OnPauseRequested; boardView.CellFlagRequested -= OnCellFlagRequested;
view.ResumeRequested -= OnResumeRequested; pauseView.RestartRequested -= OnRestartRequested;
view.CellPressStarted -= OnCellPressStarted; pauseView.ResumeRequested -= OnResumeRequested;
view.CellPressEnded -= OnCellPressEnded; pauseView.GoToMenuRequested -= OnGoToMenuRequested;
view.CellOpenRequested -= OnCellOpenRequested; resultView.RestartRequested -= OnRestartRequested;
view.CellFlagRequested -= OnCellFlagRequested; resultView.GoToMenuRequested -= OnGoToMenuRequested;
gameStateService.StateChanged -= OnStateChanged; gameStateService.StateChanged -= OnStateChanged;
pauseService.PauseChanged -= OnPauseChanged; pauseService.PauseChanged -= OnPauseChanged;
timerService.TimeChanged -= OnTimeChanged;
}
}
private void OnRestartRequested()
{
commandDispatcher.Dispatch(new RestartCommand());
RebuildBoard();
topPanelPresenter.RefreshCounters();
}
private void OnGoToMenuRequested()
{
commandDispatcher.Dispatch(new GoToMenuCommand());
}
private void OnPauseRequested()
{
commandDispatcher.Dispatch(new PauseCommand());
}
private void OnResumeRequested()
{
commandDispatcher.Dispatch(new ResumeCommand());
} }
private void OnCellOpenRequested(int x, int y) private void OnCellOpenRequested(int x, int y)
@@ -123,22 +98,22 @@ namespace Minesweeper.Presentation.Presenters
if (state == GameState.FieldSelection) if (state == GameState.FieldSelection)
{ {
boardBuilt = false; boardBuilt = false;
view.HideGame(); boardView.Hide();
view.HidePause(); pauseView.Hide();
view.HideResult(); resultView.Hide();
return; return;
} }
view.ShowGame(); boardView.Show();
if (state == GameState.Won || state == GameState.Lost) if (state == GameState.Won || state == GameState.Lost)
{ {
view.HidePause(); pauseView.Hide();
view.ShowResult(state); resultView.Show(state);
} }
else else
{ {
view.HideResult(); resultView.Hide();
} }
if (!boardBuilt || state == GameState.Preparing) if (!boardBuilt || state == GameState.Preparing)
@@ -157,26 +132,20 @@ namespace Minesweeper.Presentation.Presenters
{ {
if (isPaused && gameStateService.Current == GameState.Playing) if (isPaused && gameStateService.Current == GameState.Playing)
{ {
view.ShowPause(); pauseView.Show();
} }
else else
{ {
view.HidePause(); pauseView.Hide();
} }
UpdateBoardInput(); UpdateBoardInput();
} }
private void OnTimeChanged(float seconds)
{
view.SetTimer(seconds);
}
private void RebuildBoard() private void RebuildBoard()
{ {
var cells = readModel.GetCells(); var cells = readModel.GetCells();
view.SetMineCount(readModel.MinesCount); boardView.Rebuild(cells, readModel.Width, readModel.Height, cellViewFactory, IsFinalState());
view.RebuildBoard(cells, readModel.Width, readModel.Height, cellViewFactory, IsFinalState());
boardBuilt = true; boardBuilt = true;
topPanelPresenter.RefreshCounters(); topPanelPresenter.RefreshCounters();
UpdateBoardInput(); UpdateBoardInput();
@@ -184,7 +153,7 @@ namespace Minesweeper.Presentation.Presenters
private void RefreshBoard() private void RefreshBoard()
{ {
view.RefreshBoard(readModel.GetCells(), IsFinalState()); boardView.Refresh(readModel.GetCells(), IsFinalState());
} }
private bool IsFinalState() private bool IsFinalState()
@@ -196,7 +165,29 @@ namespace Minesweeper.Presentation.Presenters
private void UpdateBoardInput() private void UpdateBoardInput()
{ {
var state = gameStateService.Current; var state = gameStateService.Current;
view.SetBoardInputEnabled(!pauseService.IsPaused && (state == GameState.Preparing || state == GameState.Playing)); boardView.SetInputEnabled(!pauseService.IsPaused && (state == GameState.Preparing || state == GameState.Playing));
}
private void OnRestartRequested()
{
commandDispatcher.Dispatch(new RestartCommand());
RebuildBoard();
topPanelPresenter.RefreshCounters();
}
private void OnGoToMenuRequested()
{
commandDispatcher.Dispatch(new GoToMenuCommand());
}
private void OnResumeRequested()
{
commandDispatcher.Dispatch(new ResumeCommand());
}
private void OnPauseRequested()
{
commandDispatcher.Dispatch(new PauseCommand());
} }
} }
} }
@@ -3,13 +3,12 @@ using System.Collections.Generic;
using Minesweeper.Config; using Minesweeper.Config;
using Minesweeper.Core; using Minesweeper.Core;
using Minesweeper.Presentation.Factories; using Minesweeper.Presentation.Factories;
using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
namespace Minesweeper.Presentation.Views namespace Minesweeper.Presentation.Views
{ {
public sealed class GameView : MonoBehaviour, IGameView public sealed class BoardView : MonoBehaviour, IBoardView
{ {
private const float ResizeRefreshDelaySeconds = 0.5f; private const float ResizeRefreshDelaySeconds = 0.5f;
private const float ResizeSizeEpsilon = 0.5f; private const float ResizeSizeEpsilon = 0.5f;
@@ -18,25 +17,14 @@ namespace Minesweeper.Presentation.Views
private const float ContentPaddingReferencePadding = 15f; private const float ContentPaddingReferencePadding = 15f;
private const float MinimumContentPadding = 1f; private const float MinimumContentPadding = 1f;
[SerializeField] private GameObject gameRoot; [SerializeField] private GameObject root;
[SerializeField] private GameObject pauseRoot;
[SerializeField] private GameObject resultRoot;
[SerializeField] private RectTransform boardPanel; [SerializeField] private RectTransform boardPanel;
[SerializeField] private GridLayoutGroup gridLayoutGroup; [SerializeField] private GridLayoutGroup gridLayoutGroup;
[SerializeField] private Button pauseButton;
[SerializeField] private Button restartButton;
[SerializeField] private Button resumeButton;
[SerializeField] private Button mainMenuButton;
[SerializeField] private Button resultRestartButton;
[SerializeField] private Button resultMainMenuButton;
[SerializeField] private TMP_Text resultText;
[SerializeField] private TMP_Text timerText;
[SerializeField] private TMP_Text mineText;
[SerializeField] private MinesweeperUiConfig uiConfig; [SerializeField] private MinesweeperUiConfig uiConfig;
private readonly Dictionary<int, CellView> cellsByCoordinate = new Dictionary<int, CellView>(); private readonly Dictionary<int, CellView> cellsByCoordinate = new Dictionary<int, CellView>();
private IReadOnlyList<BoardCellData> currentCells; private IReadOnlyList<BoardCellData> currentCells;
private bool boardInputEnabled = true; private bool inputEnabled = true;
private bool currentRevealUnflaggedMines; private bool currentRevealUnflaggedMines;
private bool resizeRefreshPending; private bool resizeRefreshPending;
private int currentBoardWidth; private int currentBoardWidth;
@@ -46,101 +34,30 @@ namespace Minesweeper.Presentation.Views
private float resizeStableAt; private float resizeStableAt;
private Vector2 lastObservedLayoutSize; private Vector2 lastObservedLayoutSize;
public event Action RestartRequested; private GameObject Root => root != null ? root : gameObject;
public event Action GoToMenuRequested;
public event Action PauseRequested;
public event Action ResumeRequested;
public event Action CellPressStarted; public event Action CellPressStarted;
public event Action CellPressEnded; public event Action CellPressEnded;
public event Action PauseRequested;
public event Action<int, int> CellOpenRequested; public event Action<int, int> CellOpenRequested;
public event Action<int, int> CellFlagRequested; public event Action<int, int> CellFlagRequested;
private void Awake() private void Awake()
{ {
if (gameRoot == null) if (root == null)
{ {
gameRoot = gameObject; root = gameObject;
} }
}
private void OnEnable() if (boardPanel == null)
{ {
AddButtonListeners(); boardPanel = transform as RectTransform;
} }
private void OnDisable()
{
RemoveButtonListeners();
} }
private void Update() private void Update()
{ {
TrackBoardResize(); TrackResize();
}
public void ShowGame()
{
gameRoot.SetActive(true);
SetBoardRootActive(true);
}
public void HideGame()
{
gameRoot.SetActive(true);
SetBoardRootActive(false);
}
public void ShowPause()
{
if (pauseRoot != null)
{
pauseRoot.SetActive(true);
}
}
public void HidePause()
{
if (pauseRoot != null)
{
pauseRoot.SetActive(false);
}
}
public void ShowResult(GameState state)
{
if (resultRoot != null)
{
resultRoot.SetActive(true);
}
if (resultText != null)
{
resultText.text = state == GameState.Won ? "YOU WIN" : "GAME OVER";
}
}
public void HideResult()
{
if (resultRoot != null)
{
resultRoot.SetActive(false);
}
}
public void SetTimer(float seconds)
{
if (timerText != null)
{
timerText.text = Mathf.FloorToInt(seconds).ToString("00000");
}
}
public void SetMineCount(int minesCount)
{
if (mineText != null)
{
mineText.text = minesCount.ToString("00000");
}
} }
public void BindConfig(MinesweeperUiConfig config) public void BindConfig(MinesweeperUiConfig config)
@@ -148,34 +65,20 @@ namespace Minesweeper.Presentation.Views
uiConfig = config; uiConfig = config;
} }
public void BindScreens(MinesweeperScreenRefs refs) public void Show()
{ {
if (isActiveAndEnabled) Root.SetActive(true);
{
RemoveButtonListeners();
}
boardPanel = refs.BoardPanel;
gridLayoutGroup = refs.BoardGrid;
pauseRoot = refs.PauseRoot;
restartButton = refs.PauseRestartButton;
resumeButton = refs.PauseResumeButton;
mainMenuButton = refs.PauseMainMenuButton;
resultRoot = refs.ResultRoot;
resultRestartButton = refs.ResultRestartButton;
resultMainMenuButton = refs.ResultMainMenuButton;
resultText = refs.ResultText;
ResetResizeTracking(); ResetResizeTracking();
if (isActiveAndEnabled)
{
AddButtonListeners();
}
} }
public void RebuildBoard(IReadOnlyList<BoardCellData> cells, int width, int height, ICellViewFactory cellViewFactory, bool revealUnflaggedMines) public void Hide()
{ {
ClearBoard(); Root.SetActive(false);
}
public void Rebuild(IReadOnlyList<BoardCellData> cells, int width, int height, ICellViewFactory cellViewFactory, bool revealUnflaggedMines)
{
Clear();
currentBoardWidth = width; currentBoardWidth = width;
currentBoardHeight = height; currentBoardHeight = height;
currentCells = cells; currentCells = cells;
@@ -187,10 +90,10 @@ namespace Minesweeper.Presentation.Views
CreateCell(cells[i], cellViewFactory); CreateCell(cells[i], cellViewFactory);
} }
RefreshBoard(cells, revealUnflaggedMines); Refresh(cells, revealUnflaggedMines);
} }
public void RefreshBoard(IReadOnlyList<BoardCellData> cells, bool revealUnflaggedMines) public void Refresh(IReadOnlyList<BoardCellData> cells, bool revealUnflaggedMines)
{ {
currentCells = cells; currentCells = cells;
currentRevealUnflaggedMines = revealUnflaggedMines; currentRevealUnflaggedMines = revealUnflaggedMines;
@@ -205,95 +108,16 @@ namespace Minesweeper.Presentation.Views
} }
} }
public void SetBoardInputEnabled(bool enabled) public void SetInputEnabled(bool enabled)
{ {
boardInputEnabled = enabled; inputEnabled = enabled;
foreach (var cell in cellsByCoordinate.Values) foreach (var cell in cellsByCoordinate.Values)
{ {
cell.SetInputEnabled(enabled); cell.SetInputEnabled(enabled);
} }
} }
private void AddButtonListeners() private void TrackResize()
{
if (pauseButton != null)
{
pauseButton.onClick.AddListener(OnPauseClicked);
}
if (restartButton != null)
{
restartButton.onClick.AddListener(OnRestartClicked);
}
if (resumeButton != null)
{
resumeButton.onClick.AddListener(OnResumeClicked);
}
if (mainMenuButton != null)
{
mainMenuButton.onClick.AddListener(OnMainMenuClicked);
}
if (resultRestartButton != null)
{
resultRestartButton.onClick.AddListener(OnRestartClicked);
}
if (resultMainMenuButton != null)
{
resultMainMenuButton.onClick.AddListener(OnMainMenuClicked);
}
}
private void RemoveButtonListeners()
{
if (pauseButton != null)
{
pauseButton.onClick.RemoveListener(OnPauseClicked);
}
if (restartButton != null)
{
restartButton.onClick.RemoveListener(OnRestartClicked);
}
if (resumeButton != null)
{
resumeButton.onClick.RemoveListener(OnResumeClicked);
}
if (mainMenuButton != null)
{
mainMenuButton.onClick.RemoveListener(OnMainMenuClicked);
}
if (resultRestartButton != null)
{
resultRestartButton.onClick.RemoveListener(OnRestartClicked);
}
if (resultMainMenuButton != null)
{
resultMainMenuButton.onClick.RemoveListener(OnMainMenuClicked);
}
}
private void SetBoardRootActive(bool active)
{
if (boardPanel != null)
{
boardPanel.gameObject.SetActive(active);
}
if (active)
{
ResetResizeTracking();
}
}
private void TrackBoardResize()
{ {
if (boardPanel == null || !boardPanel.gameObject.activeInHierarchy || currentCells == null || currentBoardWidth <= 0 || currentBoardHeight <= 0) if (boardPanel == null || !boardPanel.gameObject.activeInHierarchy || currentCells == null || currentBoardWidth <= 0 || currentBoardHeight <= 0)
{ {
@@ -317,19 +141,19 @@ namespace Minesweeper.Presentation.Views
if (resizeRefreshPending && Time.unscaledTime >= resizeStableAt) if (resizeRefreshPending && Time.unscaledTime >= resizeStableAt)
{ {
resizeRefreshPending = false; resizeRefreshPending = false;
RefreshBoardLayout(); RefreshLayout();
} }
} }
private void RefreshBoardLayout() private void RefreshLayout()
{ {
ConfigureGrid(currentBoardWidth, currentBoardHeight); ConfigureGrid(currentBoardWidth, currentBoardHeight);
RefreshBoard(currentCells, currentRevealUnflaggedMines); Refresh(currentCells, currentRevealUnflaggedMines);
} }
private void ConfigureGrid(int width, int height) private void ConfigureGrid(int width, int height)
{ {
if (gridLayoutGroup == null || boardPanel == null) if (gridLayoutGroup == null || boardPanel == null || uiConfig == null)
{ {
return; return;
} }
@@ -358,11 +182,6 @@ namespace Minesweeper.Presentation.Views
lastObservedLayoutSize = layoutSize; lastObservedLayoutSize = layoutSize;
} }
private static float CalculateContentPadding(float cellSize)
{
return Mathf.Max(MinimumContentPadding, cellSize * ContentPaddingReferencePadding / ContentPaddingReferenceCellSize);
}
private Vector2 GetLayoutSourceSize() private Vector2 GetLayoutSourceSize()
{ {
var parentRect = boardPanel.parent as RectTransform; var parentRect = boardPanel.parent as RectTransform;
@@ -379,11 +198,6 @@ namespace Minesweeper.Presentation.Views
} }
} }
private static bool HasSizeChanged(Vector2 current, Vector2 previous)
{
return Mathf.Abs(current.x - previous.x) > ResizeSizeEpsilon || Mathf.Abs(current.y - previous.y) > ResizeSizeEpsilon;
}
private float CalculateCellSize(float panelWidth, float panelHeight, int width, int height) private float CalculateCellSize(float panelWidth, float panelHeight, int width, int height)
{ {
var widthUnits = width + 2f * uiConfig.BoardPaddingRatio + Mathf.Max(0, width - 1) * uiConfig.GridSpacingRatio; var widthUnits = width + 2f * uiConfig.BoardPaddingRatio + Mathf.Max(0, width - 1) * uiConfig.GridSpacingRatio;
@@ -395,8 +209,18 @@ namespace Minesweeper.Presentation.Views
private void CreateCell(BoardCellData cell, ICellViewFactory cellViewFactory) private void CreateCell(BoardCellData cell, ICellViewFactory cellViewFactory)
{ {
if (gridLayoutGroup == null)
{
return;
}
var view = cellViewFactory.CreateCell(cell, gridLayoutGroup.transform); var view = cellViewFactory.CreateCell(cell, gridLayoutGroup.transform);
view.SetInputEnabled(boardInputEnabled); if (view == null)
{
return;
}
view.SetInputEnabled(inputEnabled);
view.OpenRequested += OnCellOpenRequested; view.OpenRequested += OnCellOpenRequested;
view.FlagRequested += OnCellFlagRequested; view.FlagRequested += OnCellFlagRequested;
view.PressStarted += OnCellPressStarted; view.PressStarted += OnCellPressStarted;
@@ -404,7 +228,7 @@ namespace Minesweeper.Presentation.Views
cellsByCoordinate[ToKey(cell.X, cell.Y)] = view; cellsByCoordinate[ToKey(cell.X, cell.Y)] = view;
} }
private void ClearBoard() private void Clear()
{ {
foreach (var cell in cellsByCoordinate.Values) foreach (var cell in cellsByCoordinate.Values)
{ {
@@ -455,19 +279,14 @@ namespace Minesweeper.Presentation.Views
PauseRequested?.Invoke(); PauseRequested?.Invoke();
} }
private void OnRestartClicked() private static float CalculateContentPadding(float cellSize)
{ {
RestartRequested?.Invoke(); return Mathf.Max(MinimumContentPadding, cellSize * ContentPaddingReferencePadding / ContentPaddingReferenceCellSize);
} }
private void OnResumeClicked() private static bool HasSizeChanged(Vector2 current, Vector2 previous)
{ {
ResumeRequested?.Invoke(); return Mathf.Abs(current.x - previous.x) > ResizeSizeEpsilon || Mathf.Abs(current.y - previous.y) > ResizeSizeEpsilon;
}
private void OnMainMenuClicked()
{
GoToMenuRequested?.Invoke();
} }
private static int ToKey(int x, int y) private static int ToKey(int x, int y)
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8e5eb8dfe520e3b40af304e66728dcfb
@@ -10,10 +10,6 @@ namespace Minesweeper.Presentation.Views
{ {
public sealed class CellView : MonoBehaviour, IPointerClickHandler, IPointerDownHandler, IPointerUpHandler public sealed class CellView : MonoBehaviour, IPointerClickHandler, IPointerDownHandler, IPointerUpHandler
{ {
private const string ContentImagePath = "Content/Image";
private const string ContentLabelPath = "Content/Text (TMP)";
private const string ContentPath = "Content";
[SerializeField] private Button button; [SerializeField] private Button button;
[SerializeField] private Image backgroundImage; [SerializeField] private Image backgroundImage;
[SerializeField] private RectTransform contentRoot; [SerializeField] private RectTransform contentRoot;
@@ -39,46 +35,6 @@ namespace Minesweeper.Presentation.Views
this.label = label; this.label = label;
} }
public void AutoBind()
{
if (button == null)
{
button = GetComponent<Button>();
}
if (backgroundImage == null)
{
backgroundImage = GetComponent<Image>();
}
if (contentRoot == null)
{
var contentTransform = transform.Find(ContentPath);
if (contentTransform != null)
{
contentRoot = contentTransform.GetComponent<RectTransform>();
}
}
if (contentImage == null)
{
var contentImageTransform = transform.Find(ContentImagePath);
if (contentImageTransform != null)
{
contentImage = contentImageTransform.GetComponent<Image>();
}
}
if (label == null)
{
var labelTransform = transform.Find(ContentLabelPath);
if (labelTransform != null)
{
label = labelTransform.GetComponent<TMP_Text>();
}
}
}
public void Initialize(int x, int y) public void Initialize(int x, int y)
{ {
this.x = x; this.x = x;
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 1c906a10872edd04480e534703fc4fea
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using Minesweeper.Core;
using Minesweeper.Presentation.Factories;
namespace Minesweeper.Presentation.Views
{
public interface IBoardView : IView
{
event Action CellPressStarted;
event Action CellPressEnded;
event Action PauseRequested;
event Action<int, int> CellOpenRequested;
event Action<int, int> CellFlagRequested;
void Show();
void Hide();
void Rebuild(IReadOnlyList<BoardCellData> cells, int width, int height, ICellViewFactory cellViewFactory, bool revealUnflaggedMines);
void Refresh(IReadOnlyList<BoardCellData> cells, bool revealUnflaggedMines);
void SetInputEnabled(bool enabled);
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: cfdc53be4df29994fa56373d71a3b43a
@@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using Minesweeper.Core;
using Minesweeper.Presentation.Factories;
namespace Minesweeper.Presentation.Views
{
public interface IGameView : IView
{
event Action RestartRequested;
event Action GoToMenuRequested;
event Action PauseRequested;
event Action ResumeRequested;
event Action CellPressStarted;
event Action CellPressEnded;
event Action<int, int> CellOpenRequested;
event Action<int, int> CellFlagRequested;
void ShowGame();
void HideGame();
void ShowPause();
void HidePause();
void ShowResult(GameState state);
void HideResult();
void SetMineCount(int minesCount);
void SetTimer(float seconds);
void RebuildBoard(IReadOnlyList<BoardCellData> cells, int width, int height, ICellViewFactory cellViewFactory, bool revealUnflaggedMines);
void RefreshBoard(IReadOnlyList<BoardCellData> cells, bool revealUnflaggedMines);
void SetBoardInputEnabled(bool enabled);
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: a8c5423ea37354a4e82b05aadfbf239f
@@ -0,0 +1,14 @@
using System;
namespace Minesweeper.Presentation.Views
{
public interface IPauseView : IView
{
event Action RestartRequested;
event Action ResumeRequested;
event Action GoToMenuRequested;
void Show();
void Hide();
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 68d5d80ca9e50564b8616608563e8d73
@@ -0,0 +1,14 @@
using System;
using Minesweeper.Core;
namespace Minesweeper.Presentation.Views
{
public interface IResultView : IView
{
event Action RestartRequested;
event Action GoToMenuRequested;
void Show(GameState state);
void Hide();
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ab5a37a62d4a8284ea45b6d2c835a4d1
@@ -1,47 +1,22 @@
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace Minesweeper.Presentation.Views namespace Minesweeper.Presentation.Views
{ {
public readonly struct MinesweeperScreenRefs public readonly struct MinesweeperScreenRefs
{ {
public MinesweeperScreenRefs( public MinesweeperScreenRefs(
MainMenuView mainMenuView, MainMenuView mainMenuView,
RectTransform boardPanel, BoardView boardView,
GridLayoutGroup boardGrid, PauseView pauseView,
GameObject pauseRoot, ResultView resultView)
Button pauseRestartButton,
Button pauseResumeButton,
Button pauseMainMenuButton,
GameObject resultRoot,
Button resultRestartButton,
Button resultMainMenuButton,
TMP_Text resultText)
{ {
MainMenuView = mainMenuView; MainMenuView = mainMenuView;
BoardPanel = boardPanel; BoardView = boardView;
BoardGrid = boardGrid; PauseView = pauseView;
PauseRoot = pauseRoot; ResultView = resultView;
PauseRestartButton = pauseRestartButton;
PauseResumeButton = pauseResumeButton;
PauseMainMenuButton = pauseMainMenuButton;
ResultRoot = resultRoot;
ResultRestartButton = resultRestartButton;
ResultMainMenuButton = resultMainMenuButton;
ResultText = resultText;
} }
public MainMenuView MainMenuView { get; } public MainMenuView MainMenuView { get; }
public RectTransform BoardPanel { get; } public BoardView BoardView { get; }
public GridLayoutGroup BoardGrid { get; } public PauseView PauseView { get; }
public GameObject PauseRoot { get; } public ResultView ResultView { get; }
public Button PauseRestartButton { get; }
public Button PauseResumeButton { get; }
public Button PauseMainMenuButton { get; }
public GameObject ResultRoot { get; }
public Button ResultRestartButton { get; }
public Button ResultMainMenuButton { get; }
public TMP_Text ResultText { get; }
} }
} }
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using Minesweeper.Core;
using Minesweeper.Presentation.Factories;
namespace Minesweeper.Presentation.Views
{
public sealed class NullBoardView : IBoardView
{
public event Action CellPressStarted { add { } remove { } }
public event Action CellPressEnded { add { } remove { } }
public event Action PauseRequested { add { } remove { } }
public event Action<int, int> CellOpenRequested { add { } remove { } }
public event Action<int, int> CellFlagRequested { add { } remove { } }
public void Show() { }
public void Hide() { }
public void Rebuild(IReadOnlyList<BoardCellData> cells, int width, int height, ICellViewFactory cellViewFactory, bool revealUnflaggedMines) { }
public void Refresh(IReadOnlyList<BoardCellData> cells, bool revealUnflaggedMines) { }
public void SetInputEnabled(bool enabled) { }
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0e79bb89d6efdcb4a8c7462de1871790
@@ -1,102 +0,0 @@
using System;
using System.Collections.Generic;
using Minesweeper.Core;
using Minesweeper.Presentation.Factories;
namespace Minesweeper.Presentation.Views
{
public sealed class NullGameView : IGameView
{
public event Action RestartRequested
{
add { }
remove { }
}
public event Action GoToMenuRequested
{
add { }
remove { }
}
public event Action PauseRequested
{
add { }
remove { }
}
public event Action ResumeRequested
{
add { }
remove { }
}
public event Action CellPressStarted
{
add { }
remove { }
}
public event Action CellPressEnded
{
add { }
remove { }
}
public event Action<int, int> CellOpenRequested
{
add { }
remove { }
}
public event Action<int, int> CellFlagRequested
{
add { }
remove { }
}
public void ShowGame()
{
}
public void HideGame()
{
}
public void ShowPause()
{
}
public void HidePause()
{
}
public void ShowResult(GameState state)
{
}
public void HideResult()
{
}
public void SetMineCount(int minesCount)
{
}
public void SetTimer(float seconds)
{
}
public void RebuildBoard(IReadOnlyList<BoardCellData> cells, int width, int height, ICellViewFactory cellViewFactory, bool revealUnflaggedMines)
{
}
public void RefreshBoard(IReadOnlyList<BoardCellData> cells, bool revealUnflaggedMines)
{
}
public void SetBoardInputEnabled(bool enabled)
{
}
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: c800a42df535f9347bea10f164fd2e15
@@ -0,0 +1,13 @@
using System;
namespace Minesweeper.Presentation.Views
{
public sealed class NullPauseView : IPauseView
{
public event Action RestartRequested { add { } remove { } }
public event Action ResumeRequested { add { } remove { } }
public event Action GoToMenuRequested { add { } remove { } }
public void Show() { }
public void Hide() { }
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a2128d569219f1240ba7bb7c146fa1fd
@@ -0,0 +1,13 @@
using System;
using Minesweeper.Core;
namespace Minesweeper.Presentation.Views
{
public sealed class NullResultView : IResultView
{
public event Action RestartRequested { add { } remove { } }
public event Action GoToMenuRequested { add { } remove { } }
public void Show(GameState state) { }
public void Hide() { }
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b1db865929a8fc24097435b51a80e818
@@ -0,0 +1,99 @@
using System;
using UnityEngine;
using UnityEngine.UI;
namespace Minesweeper.Presentation.Views
{
public sealed class PauseView : MonoBehaviour, IPauseView
{
[SerializeField] private GameObject root;
[SerializeField] private Button restartButton;
[SerializeField] private Button resumeButton;
[SerializeField] private Button mainMenuButton;
public event Action RestartRequested;
public event Action ResumeRequested;
public event Action GoToMenuRequested;
private GameObject Root => root != null ? root : gameObject;
private void Awake()
{
if (root == null)
{
root = gameObject;
}
}
private void OnEnable()
{
AddListeners();
}
private void OnDisable()
{
RemoveListeners();
}
public void Show()
{
Root.SetActive(true);
}
public void Hide()
{
Root.SetActive(false);
}
private void AddListeners()
{
if (restartButton != null)
{
restartButton.onClick.AddListener(OnRestartClicked);
}
if (resumeButton != null)
{
resumeButton.onClick.AddListener(OnResumeClicked);
}
if (mainMenuButton != null)
{
mainMenuButton.onClick.AddListener(OnMainMenuClicked);
}
}
private void RemoveListeners()
{
if (restartButton != null)
{
restartButton.onClick.RemoveListener(OnRestartClicked);
}
if (resumeButton != null)
{
resumeButton.onClick.RemoveListener(OnResumeClicked);
}
if (mainMenuButton != null)
{
mainMenuButton.onClick.RemoveListener(OnMainMenuClicked);
}
}
private void OnRestartClicked()
{
RestartRequested?.Invoke();
}
private void OnResumeClicked()
{
ResumeRequested?.Invoke();
}
private void OnMainMenuClicked()
{
GoToMenuRequested?.Invoke();
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 548c3a1ddca35cc4d823c260a88dcecf
@@ -0,0 +1,89 @@
using System;
using Minesweeper.Core;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace Minesweeper.Presentation.Views
{
public sealed class ResultView : MonoBehaviour, IResultView
{
[SerializeField] private GameObject root;
[SerializeField] private Button restartButton;
[SerializeField] private Button mainMenuButton;
[SerializeField] private TMP_Text resultText;
public event Action RestartRequested;
public event Action GoToMenuRequested;
private GameObject Root => root != null ? root : gameObject;
private void Awake()
{
if (root == null)
{
root = gameObject;
}
}
private void OnEnable()
{
AddListeners();
}
private void OnDisable()
{
RemoveListeners();
}
public void Show(GameState state)
{
Root.SetActive(true);
if (resultText != null)
{
resultText.text = state == GameState.Won ? "YOU WIN" : "GAME OVER";
}
}
public void Hide()
{
Root.SetActive(false);
}
private void AddListeners()
{
if (restartButton != null)
{
restartButton.onClick.AddListener(OnRestartClicked);
}
if (mainMenuButton != null)
{
mainMenuButton.onClick.AddListener(OnMainMenuClicked);
}
}
private void RemoveListeners()
{
if (restartButton != null)
{
restartButton.onClick.RemoveListener(OnRestartClicked);
}
if (mainMenuButton != null)
{
mainMenuButton.onClick.RemoveListener(OnMainMenuClicked);
}
}
private void OnRestartClicked()
{
RestartRequested?.Invoke();
}
private void OnMainMenuClicked()
{
GoToMenuRequested?.Invoke();
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b0b04ab8a2ef00b4e8d36a96e4f034d8
+13 -2
View File
@@ -326,6 +326,15 @@ MonoBehaviour:
timerText: {fileID: 751542998} timerText: {fileID: 751542998}
mineText: {fileID: 805410199} mineText: {fileID: 805410199}
uiConfig: {fileID: 0} uiConfig: {fileID: 0}
boardInputEnabled: 1
currentRevealUnflaggedMines: 0
resizeRefreshPending: 0
currentBoardWidth: 0
currentBoardHeight: 0
currentContentPadding: 1
currentPixelsPerUnitMultiplier: 1
resizeStableAt: 0
lastObservedLayoutSize: {x: 0, y: 0}
--- !u!1 &519420028 --- !u!1 &519420028
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -627,8 +636,10 @@ MonoBehaviour:
<ResultPanelPrefab>k__BackingField: {fileID: 6869455415096409219, guid: 73d5a09dc8885e64a8c20a68ea82c5dc, type: 3} <ResultPanelPrefab>k__BackingField: {fileID: 6869455415096409219, guid: 73d5a09dc8885e64a8c20a68ea82c5dc, type: 3}
contentRoot: {fileID: 1373940536} contentRoot: {fileID: 1373940536}
topPanelView: {fileID: 1101876296} topPanelView: {fileID: 1101876296}
mainMenuView: {fileID: 0} mainMenuView: {fileID: 5456992800552396061, guid: 66407cd7142d6a945b37ca8dc5e7c6b7, type: 3}
gameView: {fileID: 289057772} boardView: {fileID: -4096144217532421454, guid: 91c5885a4fbe47540abf4bfd814a32d0, type: 3}
pauseView: {fileID: 7010459690024596299, guid: ec358f6fec19e3b469f516bd1ade70cd, type: 3}
resultView: {fileID: -2277025653673582644, guid: 73d5a09dc8885e64a8c20a68ea82c5dc, type: 3}
--- !u!4 &1287266282 --- !u!4 &1287266282
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0