diff --git a/assets/Scenes/Menu.scene b/assets/Scenes/Menu.scene index 63ecd55..552b3d6 100644 --- a/assets/Scenes/Menu.scene +++ b/assets/Scenes/Menu.scene @@ -18,17 +18,17 @@ "__id__": 2 }, { - "__id__": 12 + "__id__": 22 } ], "_active": true, "_components": [], "_prefab": { - "__id__": 81 + "__id__": 94 }, "autoReleaseAssets": false, "_globals": { - "__id__": 82 + "__id__": 95 }, "_id": "1a3bccb5-bbb7-4058-846c-ed41b52415b0" }, @@ -55,7 +55,12 @@ "fileId": "f6TS0IBq9EGpNVBB7WXcF6", "instance": { "__id__": 4 - } + }, + "targetOverrides": [ + { + "__id__": 12 + } + ] }, { "__type__": "cc.PrefabInstance", @@ -163,6 +168,137 @@ "3cU8u+g/ZHqZh/QeLhRGlh" ] }, + { + "__type__": "cc.TargetOverrideInfo", + "source": null, + "sourceInfo": null, + "propertyPath": [ + "y8" + ], + "target": { + "__id__": 13 + }, + "targetInfo": { + "__id__": 21 + } + }, + { + "__type__": "cc.Node", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_prefab": { + "__id__": 14 + }, + "__editorExtras__": {} + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 13 + }, + "asset": { + "__uuid__": "f668086a-2bff-40eb-a029-dd891718441d", + "__expectedType__": "cc.Prefab" + }, + "fileId": "5da9o8mwlJl5XD861jGbYx", + "instance": { + "__id__": 15 + } + }, + { + "__type__": "cc.PrefabInstance", + "fileId": "56Xvr+wxdEcqGuJ2/9Drtp", + "prefabRootNode": { + "__id__": 2 + }, + "mountedChildren": [], + "mountedComponents": [], + "propertyOverrides": [ + { + "__id__": 16 + }, + { + "__id__": 18 + }, + { + "__id__": 19 + }, + { + "__id__": 20 + } + ], + "removedComponents": [] + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 17 + }, + "propertyPath": [ + "_name" + ], + "value": "Y8" + }, + { + "__type__": "cc.TargetInfo", + "localID": [ + "5da9o8mwlJl5XD861jGbYx" + ] + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 17 + }, + "propertyPath": [ + "_lpos" + ], + "value": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 17 + }, + "propertyPath": [ + "_lrot" + ], + "value": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + } + }, + { + "__type__": "CCPropertyOverrideInfo", + "targetInfo": { + "__id__": 17 + }, + "propertyPath": [ + "_euler" + ], + "value": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "__type__": "cc.TargetInfo", + "localID": [ + "9cOBr9gAFNWbvsaSX5dfaa" + ] + }, { "__type__": "cc.Node", "_name": "Menu", @@ -172,58 +308,58 @@ }, "_children": [ { - "__id__": 13 + "__id__": 23 }, { - "__id__": 16 + "__id__": 26 }, { - "__id__": 19 + "__id__": 29 }, { - "__id__": 25 + "__id__": 35 }, { - "__id__": 31 + "__id__": 41 }, { - "__id__": 34 + "__id__": 44 }, { - "__id__": 37 + "__id__": 47 }, { - "__id__": 43 + "__id__": 53 }, { - "__id__": 52 + "__id__": 62 }, { - "__id__": 61 + "__id__": 74 }, { - "__id__": 70 + "__id__": 83 }, { - "__id__": 73 + "__id__": 86 } ], "_active": true, "_components": [ { - "__id__": 76 + "__id__": 89 }, { - "__id__": 77 + "__id__": 90 }, { - "__id__": 78 + "__id__": 91 }, { - "__id__": 79 + "__id__": 92 }, { - "__id__": 80 + "__id__": 93 } ], "_prefab": null, @@ -260,16 +396,16 @@ "_name": "Background", "_objFlags": 0, "_parent": { - "__id__": 12 + "__id__": 22 }, "_children": [], "_active": true, "_components": [ { - "__id__": 14 + "__id__": 24 }, { - "__id__": 15 + "__id__": 25 } ], "_prefab": null, @@ -306,7 +442,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 13 + "__id__": 23 }, "_enabled": true, "__prefab": null, @@ -327,7 +463,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 13 + "__id__": 23 }, "_enabled": true, "__prefab": null, @@ -365,16 +501,16 @@ "_name": "BackgroundGradient", "_objFlags": 0, "_parent": { - "__id__": 12 + "__id__": 22 }, "_children": [], "_active": true, "_components": [ { - "__id__": 17 + "__id__": 27 }, { - "__id__": 18 + "__id__": 28 } ], "_prefab": null, @@ -411,7 +547,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 16 + "__id__": 26 }, "_enabled": true, "__prefab": null, @@ -432,7 +568,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 16 + "__id__": 26 }, "_enabled": true, "__prefab": null, @@ -470,20 +606,20 @@ "_name": "TopGradient", "_objFlags": 0, "_parent": { - "__id__": 12 + "__id__": 22 }, "_children": [ { - "__id__": 20 + "__id__": 30 } ], "_active": true, "_components": [ { - "__id__": 23 + "__id__": 33 }, { - "__id__": 24 + "__id__": 34 } ], "_prefab": null, @@ -520,16 +656,16 @@ "_name": "RectAddon-001", "_objFlags": 0, "_parent": { - "__id__": 19 + "__id__": 29 }, "_children": [], "_active": true, "_components": [ { - "__id__": 21 + "__id__": 31 }, { - "__id__": 22 + "__id__": 32 } ], "_prefab": null, @@ -566,7 +702,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 20 + "__id__": 30 }, "_enabled": true, "__prefab": null, @@ -587,7 +723,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 20 + "__id__": 30 }, "_enabled": true, "__prefab": null, @@ -625,7 +761,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 19 + "__id__": 29 }, "_enabled": true, "__prefab": null, @@ -646,7 +782,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 19 + "__id__": 29 }, "_enabled": true, "__prefab": null, @@ -684,20 +820,20 @@ "_name": "BottomGradient", "_objFlags": 0, "_parent": { - "__id__": 12 + "__id__": 22 }, "_children": [ { - "__id__": 26 + "__id__": 36 } ], "_active": true, "_components": [ { - "__id__": 29 + "__id__": 39 }, { - "__id__": 30 + "__id__": 40 } ], "_prefab": null, @@ -734,16 +870,16 @@ "_name": "RectAddon", "_objFlags": 0, "_parent": { - "__id__": 25 + "__id__": 35 }, "_children": [], "_active": true, "_components": [ { - "__id__": 27 + "__id__": 37 }, { - "__id__": 28 + "__id__": 38 } ], "_prefab": null, @@ -780,7 +916,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 26 + "__id__": 36 }, "_enabled": true, "__prefab": null, @@ -801,7 +937,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 26 + "__id__": 36 }, "_enabled": true, "__prefab": null, @@ -839,7 +975,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 25 + "__id__": 35 }, "_enabled": true, "__prefab": null, @@ -860,7 +996,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 25 + "__id__": 35 }, "_enabled": true, "__prefab": null, @@ -898,16 +1034,16 @@ "_name": "LogoImage", "_objFlags": 0, "_parent": { - "__id__": 12 + "__id__": 22 }, "_children": [], "_active": true, "_components": [ { - "__id__": 32 + "__id__": 42 }, { - "__id__": 33 + "__id__": 43 } ], "_prefab": null, @@ -944,7 +1080,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 31 + "__id__": 41 }, "_enabled": true, "__prefab": null, @@ -965,7 +1101,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 31 + "__id__": 41 }, "_enabled": true, "__prefab": null, @@ -1003,16 +1139,16 @@ "_name": "SunImage", "_objFlags": 0, "_parent": { - "__id__": 12 + "__id__": 22 }, "_children": [], "_active": true, "_components": [ { - "__id__": 35 + "__id__": 45 }, { - "__id__": 36 + "__id__": 46 } ], "_prefab": null, @@ -1049,7 +1185,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 34 + "__id__": 44 }, "_enabled": true, "__prefab": null, @@ -1070,7 +1206,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 34 + "__id__": 44 }, "_enabled": true, "__prefab": null, @@ -1108,20 +1244,20 @@ "_name": "HordeImage", "_objFlags": 0, "_parent": { - "__id__": 12 + "__id__": 22 }, "_children": [ { - "__id__": 38 + "__id__": 48 } ], "_active": true, "_components": [ { - "__id__": 41 + "__id__": 51 }, { - "__id__": 42 + "__id__": 52 } ], "_prefab": null, @@ -1158,16 +1294,16 @@ "_name": "RectAddon", "_objFlags": 0, "_parent": { - "__id__": 37 + "__id__": 47 }, "_children": [], "_active": true, "_components": [ { - "__id__": 39 + "__id__": 49 }, { - "__id__": 40 + "__id__": 50 } ], "_prefab": null, @@ -1204,7 +1340,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 38 + "__id__": 48 }, "_enabled": true, "__prefab": null, @@ -1225,7 +1361,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 38 + "__id__": 48 }, "_enabled": true, "__prefab": null, @@ -1263,7 +1399,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 37 + "__id__": 47 }, "_enabled": true, "__prefab": null, @@ -1284,7 +1420,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 37 + "__id__": 47 }, "_enabled": true, "__prefab": null, @@ -1322,29 +1458,29 @@ "_name": "PlayBtn", "_objFlags": 0, "_parent": { - "__id__": 12 + "__id__": 22 }, "_children": [ { - "__id__": 44 + "__id__": 54 } ], "_active": true, "_components": [ { - "__id__": 47 + "__id__": 57 }, { - "__id__": 48 + "__id__": 58 }, { - "__id__": 49 + "__id__": 59 }, { - "__id__": 50 + "__id__": 60 }, { - "__id__": 51 + "__id__": 61 } ], "_prefab": null, @@ -1381,16 +1517,16 @@ "_name": "Label", "_objFlags": 512, "_parent": { - "__id__": 43 + "__id__": 53 }, "_children": [], "_active": true, "_components": [ { - "__id__": 45 + "__id__": 55 }, { - "__id__": 46 + "__id__": 56 } ], "_prefab": null, @@ -1427,7 +1563,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 44 + "__id__": 54 }, "_enabled": true, "__prefab": null, @@ -1448,7 +1584,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 44 + "__id__": 54 }, "_enabled": true, "__prefab": null, @@ -1489,7 +1625,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 43 + "__id__": 53 }, "_enabled": true, "__prefab": null, @@ -1510,7 +1646,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 43 + "__id__": 53 }, "_enabled": true, "__prefab": null, @@ -1548,7 +1684,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 43 + "__id__": 53 }, "_enabled": true, "__prefab": null, @@ -1602,7 +1738,7 @@ "_duration": 0.1, "_zoomScale": 0.92, "_target": { - "__id__": 43 + "__id__": 53 }, "_id": "abjYBOPMJCK7GsAsqNfoj3" }, @@ -1611,7 +1747,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 43 + "__id__": 53 }, "_enabled": true, "__prefab": null, @@ -1622,12 +1758,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 43 + "__id__": 53 }, "_enabled": true, "__prefab": null, "button": { - "__id__": 50 + "__id__": 60 }, "_id": "3f/GLS2YxHJI360Fym4+Nl" }, @@ -1636,29 +1772,32 @@ "_name": "UpgradesBtn", "_objFlags": 0, "_parent": { - "__id__": 12 + "__id__": 22 }, "_children": [ { - "__id__": 53 + "__id__": 63 + }, + { + "__id__": 66 } ], "_active": true, "_components": [ { - "__id__": 56 + "__id__": 69 }, { - "__id__": 57 + "__id__": 70 }, { - "__id__": 58 + "__id__": 71 }, { - "__id__": 59 + "__id__": 72 }, { - "__id__": 60 + "__id__": 73 } ], "_prefab": null, @@ -1695,16 +1834,16 @@ "_name": "Label", "_objFlags": 512, "_parent": { - "__id__": 52 + "__id__": 62 }, "_children": [], "_active": true, "_components": [ { - "__id__": 54 + "__id__": 64 }, { - "__id__": 55 + "__id__": 65 } ], "_prefab": null, @@ -1741,7 +1880,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 53 + "__id__": 63 }, "_enabled": true, "__prefab": null, @@ -1762,7 +1901,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 53 + "__id__": 63 }, "_enabled": true, "__prefab": null, @@ -1798,12 +1937,120 @@ "_cacheMode": 0, "_id": "a6pM9EFa1JnoBLTshXcD+3" }, + { + "__type__": "cc.Node", + "_name": "UpgradeAvailableIndicator", + "_objFlags": 0, + "_parent": { + "__id__": 62 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 67 + }, + { + "__id__": 68 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 69.482, + "y": -13.615, + "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": "c4p1dqPvNM3qY+F2+XYur4" + }, { "__type__": "cc.UITransform", "_name": "", "_objFlags": 0, "node": { - "__id__": 52 + "__id__": 66 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 20, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "afHAVu2JZPjKd8JoAC1WZy" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 66 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 0, + "b": 0, + "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": { + "__uuid__": "c4872559-07b2-44e5-9613-5f22506b1989", + "__expectedType__": "cc.SpriteAtlas" + }, + "_id": "3bWZb/wFFM7r06bUvHUkcc" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 62 }, "_enabled": true, "__prefab": null, @@ -1824,7 +2071,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 52 + "__id__": 62 }, "_enabled": true, "__prefab": null, @@ -1862,7 +2109,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 52 + "__id__": 62 }, "_enabled": true, "__prefab": null, @@ -1916,7 +2163,7 @@ "_duration": 0.1, "_zoomScale": 0.92, "_target": { - "__id__": 52 + "__id__": 62 }, "_id": "02km9/CjtM4LntV5ZcaVeR" }, @@ -1925,7 +2172,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 52 + "__id__": 62 }, "_enabled": true, "__prefab": null, @@ -1936,12 +2183,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 52 + "__id__": 62 }, "_enabled": true, "__prefab": null, "button": { - "__id__": 59 + "__id__": 72 }, "_id": "adNyH1o7lEPoaiPeZSxUCn" }, @@ -1950,29 +2197,29 @@ "_name": "AudioSettingsBtn", "_objFlags": 0, "_parent": { - "__id__": 12 + "__id__": 22 }, "_children": [ { - "__id__": 62 + "__id__": 75 } ], "_active": true, "_components": [ { - "__id__": 65 + "__id__": 78 }, { - "__id__": 66 + "__id__": 79 }, { - "__id__": 67 + "__id__": 80 }, { - "__id__": 68 + "__id__": 81 }, { - "__id__": 69 + "__id__": 82 } ], "_prefab": null, @@ -2009,16 +2256,16 @@ "_name": "Label", "_objFlags": 512, "_parent": { - "__id__": 61 + "__id__": 74 }, "_children": [], "_active": true, "_components": [ { - "__id__": 63 + "__id__": 76 }, { - "__id__": 64 + "__id__": 77 } ], "_prefab": null, @@ -2055,7 +2302,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 62 + "__id__": 75 }, "_enabled": true, "__prefab": null, @@ -2076,7 +2323,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 62 + "__id__": 75 }, "_enabled": true, "__prefab": null, @@ -2117,7 +2364,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 61 + "__id__": 74 }, "_enabled": true, "__prefab": null, @@ -2138,7 +2385,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 61 + "__id__": 74 }, "_enabled": true, "__prefab": null, @@ -2176,7 +2423,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 61 + "__id__": 74 }, "_enabled": true, "__prefab": null, @@ -2230,7 +2477,7 @@ "_duration": 0.1, "_zoomScale": 0.92, "_target": { - "__id__": 61 + "__id__": 74 }, "_id": "83MUZ70BBPoqpCJzA3nVTN" }, @@ -2239,7 +2486,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 61 + "__id__": 74 }, "_enabled": true, "__prefab": null, @@ -2250,12 +2497,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 61 + "__id__": 74 }, "_enabled": true, "__prefab": null, "button": { - "__id__": 68 + "__id__": 81 }, "_id": "6bWmS+us9G55ZQR94w+B3i" }, @@ -2264,16 +2511,16 @@ "_name": "HighscoreLabel", "_objFlags": 0, "_parent": { - "__id__": 12 + "__id__": 22 }, "_children": [], "_active": true, "_components": [ { - "__id__": 71 + "__id__": 84 }, { - "__id__": 72 + "__id__": 85 } ], "_prefab": null, @@ -2310,7 +2557,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 70 + "__id__": 83 }, "_enabled": true, "__prefab": null, @@ -2331,7 +2578,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 70 + "__id__": 83 }, "_enabled": true, "__prefab": null, @@ -2372,16 +2619,16 @@ "_name": "Y8Logo", "_objFlags": 0, "_parent": { - "__id__": 12 + "__id__": 22 }, "_children": [], "_active": true, "_components": [ { - "__id__": 74 + "__id__": 87 }, { - "__id__": 75 + "__id__": 88 } ], "_prefab": null, @@ -2418,7 +2665,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 73 + "__id__": 86 }, "_enabled": true, "__prefab": null, @@ -2439,7 +2686,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 73 + "__id__": 86 }, "_enabled": true, "__prefab": null, @@ -2477,7 +2724,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 12 + "__id__": 22 }, "_enabled": true, "__prefab": null, @@ -2498,7 +2745,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 12 + "__id__": 22 }, "_enabled": true, "__prefab": null, @@ -2511,7 +2758,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 12 + "__id__": 22 }, "_enabled": true, "__prefab": null, @@ -2540,24 +2787,27 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 12 + "__id__": 22 }, "_enabled": true, "__prefab": null, "playBtn": { - "__id__": 50 + "__id__": 60 }, "upgradeBtn": { - "__id__": 59 + "__id__": 72 + }, + "upgradeAvailableIndicator": { + "__id__": 66 }, "audioSettingsBtn": { - "__id__": 68 + "__id__": 81 }, "menuCanvas": { - "__id__": 77 + "__id__": 90 }, "highscoreLabel": { - "__id__": 72 + "__id__": 85 }, "_id": "4cQFnvx1xB65sFsTPGRrB7" }, @@ -2566,7 +2816,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 12 + "__id__": 22 }, "_enabled": true, "__prefab": null, @@ -2595,19 +2845,19 @@ { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 83 + "__id__": 96 }, "shadows": { - "__id__": 84 + "__id__": 97 }, "_skybox": { - "__id__": 85 + "__id__": 98 }, "fog": { - "__id__": 86 + "__id__": 99 }, "octree": { - "__id__": 87 + "__id__": 100 } }, { diff --git a/assets/Scripts/AppRoot/SaveSystem.ts b/assets/Scripts/AppRoot/SaveSystem.ts index c721ce6..9ad7174 100644 --- a/assets/Scripts/AppRoot/SaveSystem.ts +++ b/assets/Scripts/AppRoot/SaveSystem.ts @@ -2,7 +2,7 @@ import { sys } from "cc"; import { UserData } from "../Game/Data/UserData"; export class SaveSystem { - private userDataIdentifier = "user-dse"; + private userDataIdentifier = "user-dseeee"; public save(userData: UserData): void { sys.localStorage.setItem(this.userDataIdentifier, JSON.stringify(userData)); } diff --git a/assets/Scripts/Menu/Menu.ts b/assets/Scripts/Menu/Menu.ts index d460cf3..2523e7c 100644 --- a/assets/Scripts/Menu/Menu.ts +++ b/assets/Scripts/Menu/Menu.ts @@ -1,9 +1,9 @@ -import { Canvas, Component, Label, _decorator } from "cc"; +import { approx, Canvas, Component, Label, Node, _decorator } from "cc"; import { AppRoot } from "../AppRoot/AppRoot"; import { requireAppRootAsync } from "../AppRoot/AppRootUtils"; -import { ModalWindowManager } from "../Services/ModalWindowSystem/ModalWindowManager"; +import { MetaUpgradeSettings } from "../Game/Data/GameSettings"; +import { MetaUpgradesData } from "../Game/Data/UserData"; import { UIButton } from "../Services/UI/Button/UIButton"; -import { OpenCloseAnimator } from "../Utils/OpenCloseAnimator"; import { GameRunner } from "./GameRunner"; import { MenuModalLauncher } from "./ModalWindows/MenuModalLauncher"; @@ -13,6 +13,7 @@ const { ccclass, property } = _decorator; export class Menu extends Component { @property(UIButton) private playBtn: UIButton; @property(UIButton) private upgradeBtn: UIButton; + @property(Node) private upgradeAvailableIndicator: Node; @property(UIButton) private audioSettingsBtn: UIButton; @property(Canvas) private menuCanvas: Canvas; @property(Label) private highscoreLabel: Label; @@ -30,6 +31,35 @@ export class Menu extends Component { this.menuModalLauncher = new MenuModalLauncher(AppRoot.Instance.ModalWindowManager); this.highscoreLabel.string = `Highscore: ${Math.floor(AppRoot.Instance.LiveUserData.game.highscore)}`; + + this.updateUpgradeIndicator(); + } + + private updateUpgradeIndicator(): void { + this.upgradeAvailableIndicator.active = this.isUpgradeAffordable(); + } + + private isUpgradeAffordable(): boolean { + const goldCoins: number = AppRoot.Instance.LiveUserData.game.goldCoins; + const metaUpgrades: MetaUpgradesData = AppRoot.Instance.LiveUserData.game.metaUpgrades; + + const metaUpgradesSettings = AppRoot.Instance.Settings.metaUpgrades; + + const costs: number[] = []; + this.tryPushLowestCost(metaUpgrades.goldGathererLevel, metaUpgradesSettings.goldGatherer, costs); + this.tryPushLowestCost(metaUpgrades.healthLevel, metaUpgradesSettings.health, costs); + this.tryPushLowestCost(metaUpgrades.movementSpeedLevel, metaUpgradesSettings.movementSpeed, costs); + this.tryPushLowestCost(metaUpgrades.overallDamageLevel, metaUpgradesSettings.overallDamage, costs); + this.tryPushLowestCost(metaUpgrades.projectilePiercingLevel, metaUpgradesSettings.projectilePiercing, costs); + this.tryPushLowestCost(metaUpgrades.xpGathererLevel, metaUpgradesSettings.xpGatherer, costs); + + return 0 < costs.length ? Math.min(...costs) <= goldCoins : false; + } + + private tryPushLowestCost(upgradeLevel: number, metaUpgradeSettings: MetaUpgradeSettings, costs: number[]): void { + if (upgradeLevel < metaUpgradeSettings.costs.length) { + costs.push(metaUpgradeSettings.costs[upgradeLevel]); + } } private startGame(): void { @@ -37,8 +67,9 @@ export class Menu extends Component { GameRunner.Instance.playGame(); } - private openUpgradesWindow(): void { - this.menuModalLauncher.openUpgradesWindow(); + private async openUpgradesWindow(): Promise { + await this.menuModalLauncher.openUpgradesWindow(); + this.updateUpgradeIndicator(); } private openAudioSettingsWindow(): void {