diff --git a/assets/Media/Images.meta b/assets/Media/Images.meta new file mode 100644 index 0000000..e4eccf5 --- /dev/null +++ b/assets/Media/Images.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.1.0", + "importer": "directory", + "imported": true, + "uuid": "8d33409a-75ec-4ab7-a741-513182fae646", + "files": [], + "subMetas": {}, + "userData": { + "compressionType": {}, + "isRemoteBundle": {} + } +} diff --git a/assets/Media/Images/pixel.png b/assets/Media/Images/pixel.png new file mode 100644 index 0000000..ee8c636 Binary files /dev/null and b/assets/Media/Images/pixel.png differ diff --git a/assets/Media/Images/pixel.png.meta b/assets/Media/Images/pixel.png.meta new file mode 100644 index 0000000..c9ad0dd --- /dev/null +++ b/assets/Media/Images/pixel.png.meta @@ -0,0 +1,134 @@ +{ + "ver": "1.0.25", + "importer": "image", + "imported": true, + "uuid": "0a917d5c-2810-46e1-8332-63f00395d63a", + "files": [ + ".json", + ".png" + ], + "subMetas": { + "6c48a": { + "importer": "texture", + "uuid": "0a917d5c-2810-46e1-8332-63f00395d63a@6c48a", + "displayName": "pixel", + "id": "6c48a", + "name": "texture", + "userData": { + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", + "imageUuidOrDatabaseUri": "0a917d5c-2810-46e1-8332-63f00395d63a", + "isUuid": true, + "visible": false, + "minfilter": "linear", + "magfilter": "linear", + "mipfilter": "none", + "anisotropy": 0 + }, + "ver": "1.0.22", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "0a917d5c-2810-46e1-8332-63f00395d63a@f9941", + "displayName": "pixel", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 1, + "height": 1, + "rawWidth": 1, + "rawHeight": 1, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -0.5, + -0.5, + 0, + 0.5, + -0.5, + 0, + -0.5, + 0.5, + 0, + 0.5, + 0.5, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0 + ], + "nuv": [ + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1 + ], + "minPos": [ + -0.5, + -0.5, + 0 + ], + "maxPos": [ + 0.5, + 0.5, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "0a917d5c-2810-46e1-8332-63f00395d63a@6c48a", + "atlasUuid": "" + }, + "ver": "1.0.11", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + } + }, + "userData": { + "type": "sprite-frame", + "fixAlphaTransparencyArtifacts": true, + "hasAlpha": false, + "redirect": "0a917d5c-2810-46e1-8332-63f00395d63a@f9941" + } +} diff --git a/assets/Media/Prefabs/Enemy.prefab b/assets/Media/Prefabs/Enemy.prefab index fe5eb3f..f1f9f62 100644 --- a/assets/Media/Prefabs/Enemy.prefab +++ b/assets/Media/Prefabs/Enemy.prefab @@ -107,9 +107,9 @@ "_dstBlendFactor": 4, "_color": { "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, + "r": 192, + "g": 192, + "b": 192, "a": 255 }, "_spriteFrame": { diff --git a/assets/Media/Prefabs/ModalWindows.meta b/assets/Media/Prefabs/ModalWindows.meta new file mode 100644 index 0000000..cdf5d90 --- /dev/null +++ b/assets/Media/Prefabs/ModalWindows.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.1.0", + "importer": "directory", + "imported": true, + "uuid": "b56428fb-2541-4daf-8ea4-37249ff660a8", + "files": [], + "subMetas": {}, + "userData": { + "compressionType": {}, + "isRemoteBundle": {} + } +} diff --git a/assets/Media/Prefabs/ModalWindows/LevelUpModalWindow.prefab b/assets/Media/Prefabs/ModalWindows/LevelUpModalWindow.prefab new file mode 100644 index 0000000..33c8078 --- /dev/null +++ b/assets/Media/Prefabs/ModalWindows/LevelUpModalWindow.prefab @@ -0,0 +1,812 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "LevelUpModalWindow", + "_objFlags": 0, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "persistent": false, + "asyncLoadAssets": false + }, + { + "__type__": "cc.Node", + "_name": "LevelUpModalWindow", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 8 + } + ], + "_active": true, + "_components": [ + { + "__id__": 32 + }, + { + "__id__": 34 + }, + { + "__id__": 36 + } + ], + "_prefab": { + "__id__": 38 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "Background", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 3 + }, + { + "__id__": 5 + } + ], + "_prefab": { + "__id__": 7 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 4 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 640, + "height": 960 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "c5lhLHKUVHb6b9KM4Q1B77" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 6 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 147 + }, + "_spriteFrame": { + "__uuid__": "0a917d5c-2810-46e1-8332-63f00395d63a@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "0dDC5jMI5PKbDuUYgdvo4A" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "a4H4MOZL1Lx4AKbYuogwSa" + }, + { + "__type__": "cc.Node", + "_name": "Layout", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 9 + }, + { + "__id__": 15 + }, + { + "__id__": 21 + } + ], + "_active": true, + "_components": [ + { + "__id__": 27 + }, + { + "__id__": 29 + } + ], + "_prefab": { + "__id__": 31 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "Sprite", + "_objFlags": 0, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + }, + { + "__id__": 12 + } + ], + "_prefab": { + "__id__": 14 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -145, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 9 + }, + "_enabled": true, + "__prefab": { + "__id__": 11 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 150, + "height": 200 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "29DUrlal5Oeo+bojwrLGqT" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 9 + }, + "_enabled": true, + "__prefab": { + "__id__": 13 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "0a917d5c-2810-46e1-8332-63f00395d63a@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "cawKs3VadHj4htx6vdXxKn" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "dbwp6z10dPxpV7uLE6XDbR" + }, + { + "__type__": "cc.Node", + "_name": "Sprite-001", + "_objFlags": 0, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 16 + }, + { + "__id__": 18 + } + ], + "_prefab": { + "__id__": 20 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 25, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 15 + }, + "_enabled": true, + "__prefab": { + "__id__": 17 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 150, + "height": 200 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "a7KrPqhvBCRb49NLkOeA79" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 15 + }, + "_enabled": true, + "__prefab": { + "__id__": 19 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "0a917d5c-2810-46e1-8332-63f00395d63a@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "a7zwH5eaxBSI2SdK5GabEc" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "b6yYytMIBHa4jMXvk7EtUk" + }, + { + "__type__": "cc.Node", + "_name": "Sprite-002", + "_objFlags": 0, + "_parent": { + "__id__": 8 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 22 + }, + { + "__id__": 24 + } + ], + "_prefab": { + "__id__": 26 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 195, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 21 + }, + "_enabled": true, + "__prefab": { + "__id__": 23 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 150, + "height": 200 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "14WSE6bF5G9rA8t1vnOmUN" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 21 + }, + "_enabled": true, + "__prefab": { + "__id__": 25 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "0a917d5c-2810-46e1-8332-63f00395d63a@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "686yWzy9xCKZQOUt+k7bAp" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "27xkEk2zZAlLGoS5Zzs3VK" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "__prefab": { + "__id__": 28 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 640, + "height": 960 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "4c3W9oHRVNabviUqvZtspz" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 8 + }, + "_enabled": true, + "__prefab": { + "__id__": 30 + }, + "_resizeMode": 0, + "_layoutType": 1, + "_cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_startAxis": 0, + "_paddingLeft": 100, + "_paddingRight": 0, + "_paddingTop": 0, + "_paddingBottom": 0, + "_spacingX": 20, + "_spacingY": 0, + "_verticalDirection": 1, + "_horizontalDirection": 0, + "_constraint": 0, + "_constraintNum": 2, + "_affectedByScale": false, + "_isAlign": true, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "38WuQXp3FLrLWzqizMViMW" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "f6PCsWkctEl43GZ0jbM9Uj" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 33 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 640, + "height": 960 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "2eO+M9deJI1KYyU2Otv4xD" + }, + { + "__type__": "f7ac68qK+pC7LXQWJdgAYVs", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 35 + }, + "testField": "TestFieldText", + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "2aI8pp8itH2YT/45eL9zIc" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 37 + }, + "_alignFlags": 45, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 100, + "_originalHeight": 100, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "67Ws0zREFMYKNYvOHw9C0b" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "32U/bJCUBDlaQxxGFNXZTu" + } +] \ No newline at end of file diff --git a/assets/Media/Prefabs/ModalWindows/LevelUpModalWindow.prefab.meta b/assets/Media/Prefabs/ModalWindows/LevelUpModalWindow.prefab.meta new file mode 100644 index 0000000..66968e1 --- /dev/null +++ b/assets/Media/Prefabs/ModalWindows/LevelUpModalWindow.prefab.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.40", + "importer": "prefab", + "imported": true, + "uuid": "663674aa-da1c-44b0-8049-49db9b020973", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": { + "syncNodeName": "LevelUpModalWindow" + } +} diff --git a/assets/Scenes/scene-2d.scene b/assets/Scenes/scene-2d.scene new file mode 100644 index 0000000..904bfaf --- /dev/null +++ b/assets/Scenes/scene-2d.scene @@ -0,0 +1,391 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "", + "_objFlags": 0, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_name": "scene-2d", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + } + ], + "_active": true, + "_components": [], + "_prefab": null, + "autoReleaseAssets": false, + "_globals": { + "__id__": 9 + }, + "_id": "1a3bccb5-bbb7-4058-846c-ed41b52415b0" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + } + ], + "_active": true, + "_components": [ + { + "__id__": 6 + }, + { + "__id__": 7 + }, + { + "__id__": 8 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 320, + "y": 480.00000000000006, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "beI88Z2HpFELqR4T5EMHpg" + }, + { + "__type__": "cc.Node", + "_name": "Sprite", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 4 + }, + { + "__id__": 5 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "d48yPBDBxC0rb7vKh/2se2" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 3 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "73Y2tSGG9AkLjwor4zDIda" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 3 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 235, + "g": 2, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 1, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "72StvrPGhHK4bp9R7RA2NO" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 640, + "height": 960 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "d6rUX5yfhMlKoWX2bSbawx" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_alignFlags": 45, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 5.684341886080802e-14, + "_bottom": 5.684341886080802e-14, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "c5V1EV8IpMtrIvY1OE9t2u" + }, + { + "__type__": "cc.RenderRoot2D", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_id": "2aCNE8+JdDk581XA25TXI9" + }, + { + "__type__": "cc.SceneGlobals", + "ambient": { + "__id__": 10 + }, + "shadows": { + "__id__": 11 + }, + "_skybox": { + "__id__": 12 + }, + "fog": { + "__id__": 13 + }, + "octree": { + "__id__": 14 + } + }, + { + "__type__": "cc.AmbientInfo", + "_skyColorHDR": { + "__type__": "cc.Vec4", + "x": 0, + "y": 0, + "z": 0, + "w": 0.520833125 + }, + "_skyColor": { + "__type__": "cc.Vec4", + "x": 0, + "y": 0, + "z": 0, + "w": 0.520833125 + }, + "_skyIllumHDR": 20000, + "_skyIllum": 20000, + "_groundAlbedoHDR": { + "__type__": "cc.Vec4", + "x": 0, + "y": 0, + "z": 0, + "w": 0 + }, + "_groundAlbedo": { + "__type__": "cc.Vec4", + "x": 0, + "y": 0, + "z": 0, + "w": 0 + }, + "_skyColorLDR": { + "__type__": "cc.Vec4", + "x": 0.2, + "y": 0.5, + "z": 0.8, + "w": 1 + }, + "_skyIllumLDR": 20000, + "_groundAlbedoLDR": { + "__type__": "cc.Vec4", + "x": 0.2, + "y": 0.2, + "z": 0.2, + "w": 1 + } + }, + { + "__type__": "cc.ShadowsInfo", + "_enabled": false, + "_type": 0, + "_normal": { + "__type__": "cc.Vec3", + "x": 0, + "y": 1, + "z": 0 + }, + "_distance": 0, + "_shadowColor": { + "__type__": "cc.Color", + "r": 76, + "g": 76, + "b": 76, + "a": 255 + }, + "_maxReceived": 4, + "_size": { + "__type__": "cc.Vec2", + "x": 512, + "y": 512 + } + }, + { + "__type__": "cc.SkyboxInfo", + "_envLightingType": 0, + "_envmapHDR": null, + "_envmap": null, + "_envmapLDR": null, + "_diffuseMapHDR": null, + "_diffuseMapLDR": null, + "_enabled": false, + "_useHDR": true, + "_editableMaterial": null, + "_reflectionHDR": null, + "_reflectionLDR": null, + "_rotationAngle": 0 + }, + { + "__type__": "cc.FogInfo", + "_type": 0, + "_fogColor": { + "__type__": "cc.Color", + "r": 200, + "g": 200, + "b": 200, + "a": 255 + }, + "_enabled": false, + "_fogDensity": 0.3, + "_fogStart": 0.5, + "_fogEnd": 300, + "_fogAtten": 5, + "_fogTop": 1.5, + "_fogRange": 1.2, + "_accurate": false + }, + { + "__type__": "cc.OctreeInfo", + "_enabled": false, + "_minPos": { + "__type__": "cc.Vec3", + "x": -1024, + "y": -1024, + "z": -1024 + }, + "_maxPos": { + "__type__": "cc.Vec3", + "x": 1024, + "y": 1024, + "z": 1024 + }, + "_depth": 8 + } +] \ No newline at end of file diff --git a/assets/Scenes/scene-2d.scene.meta b/assets/Scenes/scene-2d.scene.meta new file mode 100644 index 0000000..0a6d481 --- /dev/null +++ b/assets/Scenes/scene-2d.scene.meta @@ -0,0 +1,11 @@ +{ + "ver": "1.1.40", + "importer": "scene", + "imported": true, + "uuid": "1a3bccb5-bbb7-4058-846c-ed41b52415b0", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scenes/scene.scene b/assets/Scenes/scene.scene index 1c0eafc..c363889 100644 --- a/assets/Scenes/scene.scene +++ b/assets/Scenes/scene.scene @@ -21,11 +21,11 @@ "_active": true, "_components": [], "_prefab": { - "__id__": 79 + "__id__": 90 }, "autoReleaseAssets": false, "_globals": { - "__id__": 80 + "__id__": 91 }, "_id": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f" }, @@ -53,23 +53,23 @@ "_active": true, "_components": [ { - "__id__": 75 + "__id__": 86 }, { - "__id__": 76 + "__id__": 87 }, { - "__id__": 77 + "__id__": 88 }, { - "__id__": 78 + "__id__": 89 } ], "_prefab": null, "_lpos": { "__type__": "cc.Vec3", "x": 319.99999999999994, - "y": 479.99999999999994, + "y": 480.00000000000006, "z": 0 }, "_lrot": { @@ -1225,12 +1225,15 @@ }, { "__id__": 71 + }, + { + "__id__": 74 } ], "_active": true, "_components": [ { - "__id__": 74 + "__id__": 85 } ], "_prefab": null, @@ -1337,7 +1340,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": -320, - "y": 480, + "y": 480.0000000000001, "z": -1000 }, "_lrot": { @@ -2048,7 +2051,7 @@ "_prefab": null, "_lpos": { "__type__": "cc.Vec3", - "x": -422.023, + "x": -420, "y": 0, "z": -1000 }, @@ -2061,8 +2064,8 @@ }, "_lscale": { "__type__": "cc.Vec3", - "x": 10, - "y": 100, + "x": 1, + "y": 1, "z": 1 }, "_layer": 33554432, @@ -2085,8 +2088,8 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 20, - "height": 20 + "width": 200, + "height": 1200 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -2115,12 +2118,12 @@ "a": 255 }, "_spriteFrame": { - "__uuid__": "b730527c-3233-41c2-aaf7-7cdab58f9749@f9941", + "__uuid__": "0a917d5c-2810-46e1-8332-63f00395d63a@f9941", "__expectedType__": "cc.SpriteFrame" }, "_type": 0, "_fillType": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillCenter": { "__type__": "cc.Vec2", "x": 0, @@ -2153,7 +2156,7 @@ "_prefab": null, "_lpos": { "__type__": "cc.Vec3", - "x": 421.607, + "x": 420, "y": 0, "z": -1000 }, @@ -2166,8 +2169,8 @@ }, "_lscale": { "__type__": "cc.Vec3", - "x": 10, - "y": 100, + "x": 1, + "y": 1, "z": 1 }, "_layer": 1073741824, @@ -2177,7 +2180,7 @@ "y": 0, "z": 0 }, - "_id": "0bsPlR3A9BVLUEgdMPcMzQ" + "_id": "1a8DeB92RKpZ2bWNscXEm5" }, { "__type__": "cc.UITransform", @@ -2190,15 +2193,15 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 20, - "height": 20 + "width": 200, + "height": 1200 }, "_anchorPoint": { "__type__": "cc.Vec2", "x": 0.5, "y": 0.5 }, - "_id": "35c186pjlJjZpcolGrBSLw" + "_id": "4df7zo0uFDlbvRnKR5oiIZ" }, { "__type__": "cc.Sprite", @@ -2220,12 +2223,12 @@ "a": 255 }, "_spriteFrame": { - "__uuid__": "b730527c-3233-41c2-aaf7-7cdab58f9749@f9941", + "__uuid__": "0a917d5c-2810-46e1-8332-63f00395d63a@f9941", "__expectedType__": "cc.SpriteFrame" }, "_type": 0, "_fillType": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillCenter": { "__type__": "cc.Vec2", "x": 0, @@ -2236,7 +2239,7 @@ "_isTrimmedMode": true, "_useGrayscale": false, "_atlas": null, - "_id": "a4SeBfquZKppCAYtapBI6G" + "_id": "c4ZyiqWnBOoZ9iaNG7+wGL" }, { "__type__": "cc.Node", @@ -2259,20 +2262,20 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 583.668, + "y": 580, "z": -1000 }, "_lrot": { "__type__": "cc.Quat", "x": 0, "y": 0, - "z": 0.7071067811865475, - "w": 0.7071067811865476 + "z": 0, + "w": 1 }, "_lscale": { "__type__": "cc.Vec3", - "x": 10, - "y": 100, + "x": 1, + "y": 1, "z": 1 }, "_layer": 1073741824, @@ -2280,9 +2283,9 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": 90 + "z": 0 }, - "_id": "c4YoIxyxNNd4HAT0YfruY/" + "_id": "a8uRtS0PNJTqnGQMv7Zvew" }, { "__type__": "cc.UITransform", @@ -2295,15 +2298,15 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 20, - "height": 20 + "width": 1050, + "height": 200 }, "_anchorPoint": { "__type__": "cc.Vec2", "x": 0.5, "y": 0.5 }, - "_id": "03D5+XdJ1Eu5q0hhEBNAy2" + "_id": "955ruGeIhCLLGKefvVKFrQ" }, { "__type__": "cc.Sprite", @@ -2325,12 +2328,12 @@ "a": 255 }, "_spriteFrame": { - "__uuid__": "b730527c-3233-41c2-aaf7-7cdab58f9749@f9941", + "__uuid__": "0a917d5c-2810-46e1-8332-63f00395d63a@f9941", "__expectedType__": "cc.SpriteFrame" }, "_type": 0, "_fillType": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillCenter": { "__type__": "cc.Vec2", "x": 0, @@ -2341,7 +2344,7 @@ "_isTrimmedMode": true, "_useGrayscale": false, "_atlas": null, - "_id": "91rZOycgRB/q6qLN7CmHsX" + "_id": "0cgBSMsjRMoqF8HhSLG7RU" }, { "__type__": "cc.Node", @@ -2364,20 +2367,20 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": -581.241, + "y": -580, "z": -1000 }, "_lrot": { "__type__": "cc.Quat", "x": 0, "y": 0, - "z": 0.7071067811865475, - "w": 0.7071067811865476 + "z": 0, + "w": 1 }, "_lscale": { "__type__": "cc.Vec3", - "x": 10, - "y": 100, + "x": 1, + "y": 1, "z": 1 }, "_layer": 1073741824, @@ -2385,9 +2388,9 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": 90 + "z": 0 }, - "_id": "c3MvbHYdlAHomun1bzu9YB" + "_id": "b9a0rFzsNBuLH0JPOdIIKi" }, { "__type__": "cc.UITransform", @@ -2400,15 +2403,15 @@ "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 20, - "height": 20 + "width": 1050, + "height": 200 }, "_anchorPoint": { "__type__": "cc.Vec2", "x": 0.5, "y": 0.5 }, - "_id": "99+/imZNFLMbt5F9KEbob3" + "_id": "5eJBTwkANIVasmYlrnfRL3" }, { "__type__": "cc.Sprite", @@ -2430,12 +2433,12 @@ "a": 255 }, "_spriteFrame": { - "__uuid__": "b730527c-3233-41c2-aaf7-7cdab58f9749@f9941", + "__uuid__": "0a917d5c-2810-46e1-8332-63f00395d63a@f9941", "__expectedType__": "cc.SpriteFrame" }, "_type": 0, "_fillType": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillCenter": { "__type__": "cc.Vec2", "x": 0, @@ -2446,7 +2449,203 @@ "_isTrimmedMode": true, "_useGrayscale": false, "_atlas": null, - "_id": "c10GOwwXFMVLLPNmW6igZR" + "_id": "19tgsETE1COLWNZIXGAS1N" + }, + { + "__type__": "cc.Node", + "_name": "ModalWindowManager", + "_objFlags": 0, + "_parent": { + "__id__": 38 + }, + "_children": [ + { + "__id__": 75 + } + ], + "_active": true, + "_components": [ + { + "__id__": 83 + }, + { + "__id__": 84 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_layer": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "ddppxPynFF26nHKQloDmA6" + }, + { + "__type__": "cc.Node", + "_objFlags": 0, + "_parent": { + "__id__": 74 + }, + "_prefab": { + "__id__": 76 + }, + "__editorExtras__": {} + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 75 + }, + "asset": { + "__uuid__": "663674aa-da1c-44b0-8049-49db9b020973", + "__expectedType__": "cc.Prefab" + }, + "fileId": "32U/bJCUBDlaQxxGFNXZTu", + "instance": { + "__id__": 77 + } + }, + { + "__type__": "cc.PrefabInstance", + "fileId": "8eKgBWwsdBaKjljenemsQK", + "mountedChildren": [], + "mountedComponents": [], + "propertyOverrides": [ + { + "__id__": 78 + }, + { + "__id__": 80 + }, + { + "__id__": 81 + }, + { + "__id__": 82 + } + ], + "removedComponents": [] + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 79 + }, + "propertyPath": [ + "_name" + ], + "value": "LevelUpModalWindow" + }, + { + "__type__": "cc.TargetInfo", + "localID": [ + "32U/bJCUBDlaQxxGFNXZTu" + ] + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 79 + }, + "propertyPath": [ + "_lpos" + ], + "value": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 79 + }, + "propertyPath": [ + "_lrot" + ], + "value": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + } + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 79 + }, + "propertyPath": [ + "_euler" + ], + "value": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 74 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 640, + "height": 960 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "e6NGPUIRhA1YDaEW8zPdfq" + }, + { + "__type__": "c623fhj2b5Cyau8MBXLOmVF", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 74 + }, + "_enabled": true, + "__prefab": null, + "availableWindows": [ + { + "__uuid__": "663674aa-da1c-44b0-8049-49db9b020973", + "__expectedType__": "cc.Prefab" + } + ], + "_id": "1afHrrV8tIPrYb4xymz6bQ" }, { "__type__": "cc.Camera", @@ -2461,7 +2660,7 @@ "_priority": 1073741824, "_fov": 45, "_fovAxis": 0, - "_orthoHeight": 480, + "_orthoHeight": 480.00000000000006, "_near": 0, "_far": 2000, "_color": { @@ -2522,7 +2721,7 @@ "_enabled": true, "__prefab": null, "_cameraComponent": { - "__id__": 74 + "__id__": 85 }, "_alignCanvasWithScreen": true, "_id": "12O/ljcVlEqLmVm3U2gEOQ" @@ -2540,8 +2739,8 @@ "_target": null, "_left": -5.684341886080802e-14, "_right": 0, - "_top": 0, - "_bottom": -5.684341886080802e-14, + "_top": 1.1368683772161603e-13, + "_bottom": 5.684341886080802e-14, "_horizontalCenter": 0, "_verticalCenter": 0, "_isAbsLeft": true, @@ -2580,7 +2779,10 @@ "strikeDelay": 2, "collisionDelay": 0.5, "camera": { - "__id__": 74 + "__id__": 85 + }, + "gameUI": { + "__id__": 61 }, "requiredLevelXps": [ 5, @@ -2594,31 +2796,36 @@ 20, 20 ], - "gameUI": { - "__id__": 61 + "modalWindowManager": { + "__id__": 84 }, "_id": "3a9z1bqlFCGL4/WyDwU4L5" }, { "__type__": "cc.PrefabInfo", - "fileId": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f" + "fileId": "cffa5b19-2043-4cef-8221-1a10ab7a2c1f", + "nestedPrefabInstanceRoots": [ + { + "__id__": 75 + } + ] }, { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 81 + "__id__": 92 }, "shadows": { - "__id__": 82 + "__id__": 93 }, "_skybox": { - "__id__": 83 + "__id__": 94 }, "fog": { - "__id__": 84 + "__id__": 95 }, "octree": { - "__id__": 85 + "__id__": 96 } }, { diff --git a/assets/Scripts/Game/GameBootstrapper.ts b/assets/Scripts/Game/GameBootstrapper.ts index f7fe60a..444d509 100644 --- a/assets/Scripts/Game/GameBootstrapper.ts +++ b/assets/Scripts/Game/GameBootstrapper.ts @@ -1,4 +1,5 @@ -import { Camera, CCFloat, CCInteger, Component, KeyCode, _decorator } from "cc"; +import { Camera, CCFloat, CCInteger, Component, director, KeyCode, _decorator } from "cc"; +import { ModalWindowManager } from "../Services/ModalWindowSystem/ModalWindowManager"; import { PlayerCollisionSystem } from "./Collision/PlayerCollisionSystem"; import { WeaponCollisionSystem } from "./Collision/WeaponCollisionSystem"; import { EnemyManager } from "./Enemy/EnemyManager"; @@ -21,6 +22,8 @@ export class GameBootstrapper extends Component { @property(Camera) private camera: Camera; @property(GameUI) private gameUI: GameUI; @property(Number) private requiredLevelXps: number[] = []; + @property(ModalWindowManager) private modalWindowManager: ModalWindowManager; + private playerCollisionSystem: PlayerCollisionSystem; public start(): void { @@ -37,6 +40,8 @@ export class GameBootstrapper extends Component { this.enemyManager.init(this.player.node); this.gameUI.init(this.player); + + this.showModal(); } public update(deltaTime: number): void { @@ -46,4 +51,9 @@ export class GameBootstrapper extends Component { this.camera.node.worldPosition = this.player.node.worldPosition; } + + private async showModal(): Promise { + const result: string = await this.modalWindowManager.showModal("LevelUpModalWindow", "test params"); + console.log("Result: " + result); + } } diff --git a/assets/Scripts/Services/ModalWindowSystem.meta b/assets/Scripts/Services/ModalWindowSystem.meta new file mode 100644 index 0000000..4c16455 --- /dev/null +++ b/assets/Scripts/Services/ModalWindowSystem.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.1.0", + "importer": "directory", + "imported": true, + "uuid": "b7e00742-d8b5-4554-9f21-df67d6090eb5", + "files": [], + "subMetas": {}, + "userData": { + "compressionType": {}, + "isRemoteBundle": {} + } +} diff --git a/assets/Scripts/Services/ModalWindowSystem/LevelUpModalWindow.ts b/assets/Scripts/Services/ModalWindowSystem/LevelUpModalWindow.ts new file mode 100644 index 0000000..d136696 --- /dev/null +++ b/assets/Scripts/Services/ModalWindowSystem/LevelUpModalWindow.ts @@ -0,0 +1,16 @@ +import { CCString, _decorator } from "cc"; +import { delay } from "../Utils/AsyncUtils"; +import { ModalWindow } from "./ModalWindow"; +const { ccclass, property } = _decorator; + +@ccclass("LevelUpModalWindow") +export class LevelUpModalWindow extends ModalWindow { + @property(CCString) private testField: string; + + protected async setup(params: string): Promise { + console.log("TEST FIELD: " + this.testField + " params: " + params); + + await delay(10000); + this.dismiss("FInishedSuccessfuly"); + } +} diff --git a/assets/Scripts/Services/ModalWindowSystem/LevelUpModalWindow.ts.meta b/assets/Scripts/Services/ModalWindowSystem/LevelUpModalWindow.ts.meta new file mode 100644 index 0000000..81b143a --- /dev/null +++ b/assets/Scripts/Services/ModalWindowSystem/LevelUpModalWindow.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "f7ac6f2a-2bea-42ec-b5d0-58976001856c", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/Services/ModalWindowSystem/ModalWindow.ts b/assets/Scripts/Services/ModalWindowSystem/ModalWindow.ts new file mode 100644 index 0000000..acffa2f --- /dev/null +++ b/assets/Scripts/Services/ModalWindowSystem/ModalWindow.ts @@ -0,0 +1,21 @@ +import { Component } from "cc"; +import { delay } from "../Utils/AsyncUtils"; + +export abstract class ModalWindow extends Component { + private result: TResult; + private isDismissed = false; + + public async runAsync(params?: TParam): Promise { + this.setup(params); + while (!this.isDismissed) await delay(100); + + return this.result; + } + + protected abstract setup(params?: TParam): void; + + protected dismiss(result?: TResult): void { + this.result = result; + this.isDismissed = true; + } +} diff --git a/assets/Scripts/Services/ModalWindowSystem/ModalWindow.ts.meta b/assets/Scripts/Services/ModalWindowSystem/ModalWindow.ts.meta new file mode 100644 index 0000000..ccde23d --- /dev/null +++ b/assets/Scripts/Services/ModalWindowSystem/ModalWindow.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "69f011ff-f798-4e03-a1b1-6490acc8fb0f", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/Services/ModalWindowSystem/ModalWindowManager.ts b/assets/Scripts/Services/ModalWindowSystem/ModalWindowManager.ts new file mode 100644 index 0000000..f272468 --- /dev/null +++ b/assets/Scripts/Services/ModalWindowSystem/ModalWindowManager.ts @@ -0,0 +1,21 @@ +import { Component, instantiate, Node, Prefab, _decorator } from "cc"; +import { ModalWindow } from "./ModalWindow"; +const { ccclass, property } = _decorator; + +@ccclass("ModalWindowManager") +export class ModalWindowManager extends Component { + @property(Prefab) private availableWindows: Prefab[] = []; + + public async showModal(name: string, params: TParams): Promise { + const windowPrefab: Prefab = this.availableWindows.find((w) => w.name === name); + const windowNode: Node = instantiate(windowPrefab); + windowNode.setParent(this.node); + + const modalWindow: ModalWindow = >windowNode.getComponent(name); + + const result: TResult = await modalWindow.runAsync(params); + windowNode.destroy(); + + return result; + } +} diff --git a/assets/Scripts/Services/ModalWindowSystem/ModalWindowManager.ts.meta b/assets/Scripts/Services/ModalWindowSystem/ModalWindowManager.ts.meta new file mode 100644 index 0000000..4e0b45d --- /dev/null +++ b/assets/Scripts/Services/ModalWindowSystem/ModalWindowManager.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "c623f863-d9be-42c9-abbc-3015cb3a6545", + "files": [], + "subMetas": {}, + "userData": {} +}