补充UI细节 添加每日挑战
@@ -12,7 +12,8 @@
|
|||||||
"_$comp": [
|
"_$comp": [
|
||||||
{
|
{
|
||||||
"_$type": "7bad1742-6eed-4d8d-81c0-501dc5bf03d6",
|
"_$type": "7bad1742-6eed-4d8d-81c0-501dc5bf03d6",
|
||||||
"scriptPath": "../src/Main.ts"
|
"scriptPath": "../src/Main.ts",
|
||||||
|
"debug": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_$type": "cd70cd5e-b4cd-4277-ac0a-2224cfbe89ac",
|
"_$type": "cd70cd5e-b4cd-4277-ac0a-2224cfbe89ac",
|
||||||
|
|||||||
BIN
assets/atlas/comp/btn_back_white.png
Normal file
|
After Width: | Height: | Size: 340 B |
6
assets/atlas/comp/btn_back_white.png.meta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"uuid": "19283ae3-c041-4a01-8fab-3c03add31bf8",
|
||||||
|
"importer": {
|
||||||
|
"textureType": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/atlas/comp/icon_trophy.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
6
assets/atlas/comp/icon_trophy.png.meta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"uuid": "4458c7de-47ff-496e-a28f-be808c0823b3",
|
||||||
|
"importer": {
|
||||||
|
"textureType": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/atlas/comp/star.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
6
assets/atlas/comp/star.png.meta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"uuid": "c5e80bd0-632f-4460-bce3-ebf9669359e3",
|
||||||
|
"importer": {
|
||||||
|
"textureType": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/atlas/comp/star1.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
6
assets/atlas/comp/star1.png.meta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"uuid": "71d84f8a-b8bc-46ae-b68b-bbb43fd588d7",
|
||||||
|
"importer": {
|
||||||
|
"textureType": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/atlas/comp/star2.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
6
assets/atlas/comp/star2.png.meta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"uuid": "902e1f3a-6f95-4796-8449-974ae5354d72",
|
||||||
|
"importer": {
|
||||||
|
"textureType": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/atlas/images/bg_dc_top.png
Normal file
|
After Width: | Height: | Size: 216 KiB |
6
assets/atlas/images/bg_dc_top.png.meta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"uuid": "342d91e6-0434-4d52-b16c-3c536060f881",
|
||||||
|
"importer": {
|
||||||
|
"textureType": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/atlas/images/bg_done.png
Normal file
|
After Width: | Height: | Size: 283 KiB |
6
assets/atlas/images/bg_done.png.meta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"uuid": "2b008659-862a-4155-b094-ee87ba692be1",
|
||||||
|
"importer": {
|
||||||
|
"textureType": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/atlas/images/bg_done_light.png
Normal file
|
After Width: | Height: | Size: 206 KiB |
6
assets/atlas/images/bg_done_light.png.meta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"uuid": "ebbaa034-8dd8-4fb8-abd5-094cdd76f93a",
|
||||||
|
"importer": {
|
||||||
|
"textureType": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/atlas/images/bg_done_top.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
6
assets/atlas/images/bg_done_top.png.meta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"uuid": "14316514-e8bf-4d32-bf9c-ba375ea24798",
|
||||||
|
"importer": {
|
||||||
|
"textureType": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/atlas/images/img_dc_bg.png
Normal file
|
After Width: | Height: | Size: 530 KiB |
6
assets/atlas/images/img_dc_bg.png.meta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"uuid": "3e483f58-04bc-4a60-8aaa-695dfe115668",
|
||||||
|
"importer": {
|
||||||
|
"textureType": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/atlas/images/img_dc_bg_light.png
Normal file
|
After Width: | Height: | Size: 539 KiB |
6
assets/atlas/images/img_dc_bg_light.png.meta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"uuid": "56e0b9d3-d4ea-4e9d-9052-b67612598495",
|
||||||
|
"importer": {
|
||||||
|
"textureType": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/atlas/images/img_dc_finished.png
Normal file
|
After Width: | Height: | Size: 583 KiB |
6
assets/atlas/images/img_dc_finished.png.meta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"uuid": "4182ef3f-6065-44dd-83c2-70490f02e9cb",
|
||||||
|
"importer": {
|
||||||
|
"textureType": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/atlas/images/trophy.png
Normal file
|
After Width: | Height: | Size: 120 KiB |
6
assets/atlas/images/trophy.png.meta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"uuid": "0a33c495-5713-4f5d-bb30-d0021966cf7e",
|
||||||
|
"importer": {
|
||||||
|
"textureType": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
7433
assets/resources/DailyChallenge.lh
Normal file
3
assets/resources/DailyChallenge.lh.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"uuid": "ab0e47f1-b092-4e81-ac0c-ff02fc97c6a0"
|
||||||
|
}
|
||||||
@@ -42,9 +42,8 @@
|
|||||||
"width": 1080,
|
"width": 1080,
|
||||||
"height": 1360,
|
"height": 1360,
|
||||||
"_mouseState": 2,
|
"_mouseState": 2,
|
||||||
"left": 0,
|
|
||||||
"right": 0,
|
|
||||||
"bottom": -2440,
|
"bottom": -2440,
|
||||||
|
"centerX": 0,
|
||||||
"_$child": [
|
"_$child": [
|
||||||
{
|
{
|
||||||
"_$id": "bd1s5tvm",
|
"_$id": "bd1s5tvm",
|
||||||
|
|||||||
@@ -15,100 +15,501 @@
|
|||||||
{
|
{
|
||||||
"_$type": "13e020d1-5ab8-4082-80ca-c0d208342103",
|
"_$type": "13e020d1-5ab8-4082-80ca-c0d208342103",
|
||||||
"scriptPath": "../src/views/GameDone.ts",
|
"scriptPath": "../src/views/GameDone.ts",
|
||||||
|
"obj_top": {
|
||||||
|
"_$ref": "0nnrx7a2"
|
||||||
|
},
|
||||||
|
"obj_stars": {
|
||||||
|
"_$ref": "6pifil84"
|
||||||
|
},
|
||||||
|
"obj_star": {
|
||||||
|
"_$ref": "sxp0g4z9"
|
||||||
|
},
|
||||||
|
"label_diffucuty": {
|
||||||
|
"_$ref": "53v8r278"
|
||||||
|
},
|
||||||
|
"label_time": {
|
||||||
|
"_$ref": "o3ljtnq3"
|
||||||
|
},
|
||||||
|
"label_score": {
|
||||||
|
"_$ref": "yd0d9s4h"
|
||||||
|
},
|
||||||
"btn_new": {
|
"btn_new": {
|
||||||
"_$ref": "ljwrbqm7"
|
"_$ref": "nad0pj6b"
|
||||||
|
},
|
||||||
|
"btn_home": {
|
||||||
|
"_$ref": "s80wwm91"
|
||||||
|
},
|
||||||
|
"btn_continue": {
|
||||||
|
"_$ref": "jowyx0fm"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_$child": [
|
"_$child": [
|
||||||
{
|
{
|
||||||
"_$id": "ocyocuk7",
|
"_$id": "z7eqmeuo",
|
||||||
"_$type": "Image",
|
"_$type": "Image",
|
||||||
"name": "bg",
|
"name": "bg_done",
|
||||||
"x": 90,
|
"width": 1080,
|
||||||
"y": 482,
|
"height": 1920,
|
||||||
"width": 900,
|
"left": 0,
|
||||||
"height": 956,
|
"right": 0,
|
||||||
"_mouseState": 2,
|
"top": 0,
|
||||||
|
"bottom": 0,
|
||||||
|
"skin": "res://2b008659-862a-4155-b094-ee87ba692be1",
|
||||||
|
"useSourceSize": true,
|
||||||
|
"color": "#ffffff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "0nnrx7a2",
|
||||||
|
"_$type": "Box",
|
||||||
|
"name": "top",
|
||||||
|
"x": 48,
|
||||||
|
"y": 456,
|
||||||
|
"width": 984,
|
||||||
|
"height": 846,
|
||||||
"centerX": 0,
|
"centerX": 0,
|
||||||
"centerY": 0,
|
|
||||||
"skin": "res://6ad19646-ed7a-431c-a50e-65c2bcb40751",
|
|
||||||
"sizeGrid": "40,60,50,60,0",
|
|
||||||
"color": "#ffffff",
|
|
||||||
"_$child": [
|
"_$child": [
|
||||||
{
|
{
|
||||||
"_$id": "52u6rl70",
|
"_$id": "v3amkm36",
|
||||||
"_$type": "Image",
|
"_$type": "Image",
|
||||||
"name": "Image",
|
"name": "light",
|
||||||
"x": 322,
|
"x": -48,
|
||||||
"y": 54,
|
"y": -680,
|
||||||
"width": 128,
|
"width": 1080,
|
||||||
"height": 128,
|
"height": 1920,
|
||||||
"scaleX": 2,
|
|
||||||
"scaleY": 2,
|
|
||||||
"centerX": 0,
|
"centerX": 0,
|
||||||
"centerY": -296,
|
"skin": "res://ebbaa034-8dd8-4fb8-abd5-094cdd76f93a",
|
||||||
"skin": "res://120856c0-7081-4fde-8dca-ae0a78d684e2",
|
|
||||||
"useSourceSize": true,
|
|
||||||
"color": "#ffffff"
|
"color": "#ffffff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "mqwo6k43",
|
||||||
|
"_$type": "Image",
|
||||||
|
"name": "bg",
|
||||||
|
"width": 984,
|
||||||
|
"height": 180,
|
||||||
|
"skin": "res://14316514-e8bf-4d32-bf9c-ba375ea24798",
|
||||||
|
"color": "#ffffff",
|
||||||
|
"_$child": [
|
||||||
|
{
|
||||||
|
"_$id": "qxb59msp",
|
||||||
|
"_$type": "Sprite",
|
||||||
|
"name": "Sprite",
|
||||||
|
"y": 180,
|
||||||
|
"width": 984,
|
||||||
|
"height": 666,
|
||||||
|
"_gcmds": [
|
||||||
|
{
|
||||||
|
"_$type": "DrawRoundRectCmd",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 1,
|
||||||
|
"height": 1,
|
||||||
|
"lt": 0,
|
||||||
|
"rt": 0,
|
||||||
|
"lb": 30,
|
||||||
|
"rb": 30,
|
||||||
|
"percent": true,
|
||||||
|
"lineWidth": 1,
|
||||||
|
"fillColor": "#FFFFFF"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "9w23n5lc",
|
||||||
|
"_$type": "Sprite",
|
||||||
|
"name": "Sprite(1)",
|
||||||
|
"x": 44,
|
||||||
|
"y": 400,
|
||||||
|
"width": 888,
|
||||||
|
"height": 372,
|
||||||
|
"_gcmds": [
|
||||||
|
{
|
||||||
|
"_$type": "DrawRoundRectCmd",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 1,
|
||||||
|
"height": 1,
|
||||||
|
"lt": 0,
|
||||||
|
"rt": 0,
|
||||||
|
"lb": 30,
|
||||||
|
"rb": 30,
|
||||||
|
"percent": true,
|
||||||
|
"lineWidth": 1,
|
||||||
|
"fillColor": "rgba(245, 247, 251, 1)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "6pifil84",
|
||||||
|
"_$type": "Box",
|
||||||
|
"name": "stars",
|
||||||
|
"y": -148,
|
||||||
|
"width": 984,
|
||||||
|
"height": 300,
|
||||||
|
"visible": false,
|
||||||
|
"centerX": 0,
|
||||||
|
"_$child": [
|
||||||
|
{
|
||||||
|
"_$id": "qqrwgq7s",
|
||||||
|
"_$type": "Image",
|
||||||
|
"name": "check(1)",
|
||||||
|
"x": 69,
|
||||||
|
"y": 19,
|
||||||
|
"width": 308,
|
||||||
|
"height": 309,
|
||||||
|
"skin": "res://71d84f8a-b8bc-46ae-b68b-bbb43fd588d7",
|
||||||
|
"useSourceSize": true,
|
||||||
|
"color": "#ffffff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "ztzpvc3d",
|
||||||
|
"_$type": "Image",
|
||||||
|
"name": "check(2)",
|
||||||
|
"x": 339,
|
||||||
|
"width": 306,
|
||||||
|
"height": 307,
|
||||||
|
"centerX": 0,
|
||||||
|
"skin": "res://902e1f3a-6f95-4796-8449-974ae5354d72",
|
||||||
|
"useSourceSize": true,
|
||||||
|
"color": "#ffffff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "go8t9h1s",
|
||||||
|
"_$type": "Image",
|
||||||
|
"name": "check(3)",
|
||||||
|
"x": 696,
|
||||||
|
"y": -35,
|
||||||
|
"width": 308,
|
||||||
|
"height": 309,
|
||||||
|
"rotation": 26,
|
||||||
|
"gray": true,
|
||||||
|
"skin": "res://71d84f8a-b8bc-46ae-b68b-bbb43fd588d7",
|
||||||
|
"useSourceSize": true,
|
||||||
|
"color": "#ffffff"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "sxp0g4z9",
|
||||||
|
"_$type": "Image",
|
||||||
|
"name": "star",
|
||||||
|
"x": 362,
|
||||||
|
"y": -120,
|
||||||
|
"width": 108,
|
||||||
|
"height": 108,
|
||||||
|
"scaleX": 2.4,
|
||||||
|
"scaleY": 2.4,
|
||||||
|
"centerX": 0,
|
||||||
|
"skin": "res://c5e80bd0-632f-4460-bce3-ebf9669359e3",
|
||||||
|
"color": "#ffffff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "t0v4lr20",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "Label",
|
||||||
|
"y": 184,
|
||||||
|
"width": 984,
|
||||||
|
"height": 100,
|
||||||
|
"centerX": 0,
|
||||||
|
"centerY": -189,
|
||||||
|
"text": "Congratulations!",
|
||||||
|
"fontSize": 80,
|
||||||
|
"color": "rgba(0, 0, 0, 1)",
|
||||||
|
"bold": true,
|
||||||
|
"align": "center",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "4ku2eb3q",
|
||||||
|
"_$type": "VBox",
|
||||||
|
"name": "summary",
|
||||||
|
"x": 92,
|
||||||
|
"y": 453,
|
||||||
|
"width": 800,
|
||||||
|
"height": 300,
|
||||||
|
"centerX": 0,
|
||||||
|
"space": 0,
|
||||||
|
"_$child": [
|
||||||
|
{
|
||||||
|
"_$id": "1a0e2qp5",
|
||||||
|
"_$type": "Box",
|
||||||
|
"name": "Box(1)",
|
||||||
|
"width": 800,
|
||||||
|
"height": 100,
|
||||||
|
"_$child": [
|
||||||
|
{
|
||||||
|
"_$id": "sei6jyr4",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "left",
|
||||||
|
"width": 400,
|
||||||
|
"height": 100,
|
||||||
|
"text": "Difficuty",
|
||||||
|
"fontSize": 50,
|
||||||
|
"color": "rgba(123, 129, 140, 1)",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "53v8r278",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "right",
|
||||||
|
"x": 400,
|
||||||
|
"width": 400,
|
||||||
|
"height": 100,
|
||||||
|
"text": "Medium",
|
||||||
|
"fontSize": 50,
|
||||||
|
"color": "rgba(45, 49, 56, 1)",
|
||||||
|
"align": "right",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "vryuxz1k",
|
||||||
|
"_$type": "Box",
|
||||||
|
"name": "Box(2)",
|
||||||
|
"y": 100,
|
||||||
|
"width": 800,
|
||||||
|
"height": 100,
|
||||||
|
"_$child": [
|
||||||
|
{
|
||||||
|
"_$id": "tazeyyxv",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "left",
|
||||||
|
"width": 400,
|
||||||
|
"height": 100,
|
||||||
|
"text": "Time",
|
||||||
|
"fontSize": 50,
|
||||||
|
"color": "rgba(123, 129, 140, 1)",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "o3ljtnq3",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "right",
|
||||||
|
"x": 400,
|
||||||
|
"width": 400,
|
||||||
|
"height": 100,
|
||||||
|
"text": "Medium",
|
||||||
|
"fontSize": 50,
|
||||||
|
"color": "rgba(45, 49, 56, 1)",
|
||||||
|
"align": "right",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "8qj8gt9o",
|
||||||
|
"_$type": "Box",
|
||||||
|
"name": "Box(3)",
|
||||||
|
"y": 200,
|
||||||
|
"width": 800,
|
||||||
|
"height": 100,
|
||||||
|
"_$child": [
|
||||||
|
{
|
||||||
|
"_$id": "8ue5sakn",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "left",
|
||||||
|
"width": 400,
|
||||||
|
"height": 100,
|
||||||
|
"text": "Score",
|
||||||
|
"fontSize": 50,
|
||||||
|
"color": "rgba(123, 129, 140, 1)",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "yd0d9s4h",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "right",
|
||||||
|
"x": 400,
|
||||||
|
"width": 400,
|
||||||
|
"height": 100,
|
||||||
|
"text": "Medium",
|
||||||
|
"fontSize": 50,
|
||||||
|
"color": "rgba(45, 49, 56, 1)",
|
||||||
|
"align": "right",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_$id": "ljwrbqm7",
|
"_$id": "2tsqczlh",
|
||||||
"_$type": "Button",
|
"_$type": "Box",
|
||||||
"name": "btn_new",
|
"name": "bottom",
|
||||||
"x": 172,
|
"y": 1428,
|
||||||
"y": 1182,
|
"width": 1080,
|
||||||
"width": 736,
|
"height": 492,
|
||||||
"height": 152,
|
"left": 0,
|
||||||
"_mouseState": 2,
|
"right": 0,
|
||||||
"centerX": 0,
|
"bottom": 0,
|
||||||
"centerY": 298,
|
|
||||||
"stateNum": 1,
|
|
||||||
"skin": "res://2e8c9585-e650-4494-a329-807fd2d2a532",
|
|
||||||
"sizeGrid": "24,40,24,40,0",
|
|
||||||
"label": "新游戏",
|
|
||||||
"labelFont": "",
|
|
||||||
"labelSize": 60,
|
|
||||||
"labelBold": true,
|
|
||||||
"labelColors": "#1d5cdc,#1d5cdc,#1d5cdc",
|
|
||||||
"labelAlign": "center",
|
|
||||||
"labelVAlign": "middle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"_$id": "t0v4lr20",
|
|
||||||
"_$type": "Label",
|
|
||||||
"name": "Label",
|
|
||||||
"x": 172,
|
|
||||||
"y": 795,
|
|
||||||
"width": 736,
|
|
||||||
"height": 100,
|
|
||||||
"centerX": 0,
|
|
||||||
"centerY": -115,
|
|
||||||
"text": "Well done",
|
|
||||||
"font": "",
|
|
||||||
"fontSize": 80,
|
|
||||||
"color": "rgba(0, 0, 0, 1)",
|
|
||||||
"bold": true,
|
|
||||||
"align": "center",
|
|
||||||
"valign": "middle",
|
|
||||||
"padding": "0,0,0,0",
|
|
||||||
"_$child": [
|
"_$child": [
|
||||||
{
|
{
|
||||||
"_$id": "kx4e9y8p",
|
"_$id": "nad0pj6b",
|
||||||
"_$type": "Text",
|
"_$type": "Box",
|
||||||
"name": "Text",
|
"name": "btn_new",
|
||||||
"y": 120,
|
"x": 168,
|
||||||
"width": 736,
|
"y": 80,
|
||||||
|
"width": 744,
|
||||||
|
"height": 156,
|
||||||
|
"visible": false,
|
||||||
|
"centerX": 0,
|
||||||
|
"_$child": [
|
||||||
|
{
|
||||||
|
"_$id": "rryy0h1z",
|
||||||
|
"_$type": "Sprite",
|
||||||
|
"name": "Sprite",
|
||||||
|
"width": 744,
|
||||||
|
"height": 156,
|
||||||
|
"_gcmds": [
|
||||||
|
{
|
||||||
|
"_$type": "DrawRoundRectCmd",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 1,
|
||||||
|
"height": 1,
|
||||||
|
"lt": 20,
|
||||||
|
"rt": 20,
|
||||||
|
"lb": 20,
|
||||||
|
"rb": 20,
|
||||||
|
"percent": true,
|
||||||
|
"lineWidth": 1,
|
||||||
|
"fillColor": "rgba(29, 92, 220, 1)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "t0l9qw7l",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "Label",
|
||||||
|
"width": 744,
|
||||||
|
"height": 156,
|
||||||
|
"centerX": 0,
|
||||||
|
"centerY": 0,
|
||||||
|
"text": "New Game",
|
||||||
|
"fontSize": 72,
|
||||||
|
"color": "rgba(255, 255, 255, 1)",
|
||||||
|
"bold": true,
|
||||||
|
"align": "center",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "s80wwm91",
|
||||||
|
"_$type": "Box",
|
||||||
|
"name": "btn_home",
|
||||||
|
"x": 168,
|
||||||
|
"y": 274,
|
||||||
|
"width": 744,
|
||||||
|
"height": 156,
|
||||||
|
"visible": false,
|
||||||
|
"centerX": 0,
|
||||||
|
"_$child": [
|
||||||
|
{
|
||||||
|
"_$id": "xmj0kb6f",
|
||||||
|
"_$type": "Sprite",
|
||||||
|
"name": "Sprite",
|
||||||
|
"width": 744,
|
||||||
|
"height": 156,
|
||||||
|
"alpha": 0.18,
|
||||||
|
"_gcmds": [
|
||||||
|
{
|
||||||
|
"_$type": "DrawRoundRectCmd",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 1,
|
||||||
|
"height": 1,
|
||||||
|
"lt": 20,
|
||||||
|
"rt": 20,
|
||||||
|
"lb": 20,
|
||||||
|
"rb": 20,
|
||||||
|
"percent": true,
|
||||||
|
"lineWidth": 1,
|
||||||
|
"fillColor": "rgba(29, 92, 220, 1)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "d003qixi",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "Label",
|
||||||
|
"width": 744,
|
||||||
|
"height": 156,
|
||||||
|
"centerX": 0,
|
||||||
|
"centerY": 0,
|
||||||
|
"text": "Home",
|
||||||
|
"fontSize": 72,
|
||||||
|
"color": "rgba(29, 92, 220, 1)",
|
||||||
|
"bold": true,
|
||||||
|
"align": "center",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "jowyx0fm",
|
||||||
|
"_$type": "Box",
|
||||||
|
"name": "btn_continue",
|
||||||
|
"x": 168,
|
||||||
|
"y": 274,
|
||||||
|
"width": 200,
|
||||||
"height": 200,
|
"height": 200,
|
||||||
"text": "[color=#7b818c]你击败了[color=#f1bf44]80%[/color]的玩家[/color]",
|
"centerX": -272,
|
||||||
"font": "",
|
"_$child": [
|
||||||
"fontSize": 60,
|
{
|
||||||
"color": "#FFFFFF",
|
"_$id": "0oc03day",
|
||||||
"ubb": true,
|
"_$type": "Sprite",
|
||||||
"align": "center",
|
"name": "Sprite",
|
||||||
"leading": 2
|
"width": 744,
|
||||||
|
"height": 156,
|
||||||
|
"_gcmds": [
|
||||||
|
{
|
||||||
|
"_$type": "DrawRoundRectCmd",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 1,
|
||||||
|
"height": 1,
|
||||||
|
"lt": 20,
|
||||||
|
"rt": 20,
|
||||||
|
"lb": 20,
|
||||||
|
"rb": 20,
|
||||||
|
"percent": true,
|
||||||
|
"lineWidth": 1,
|
||||||
|
"fillColor": "rgba(29, 92, 220, 1)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "cwysgq4l",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "Label",
|
||||||
|
"width": 744,
|
||||||
|
"height": 156,
|
||||||
|
"centerX": 272,
|
||||||
|
"centerY": -22,
|
||||||
|
"text": "Continue",
|
||||||
|
"fontSize": 72,
|
||||||
|
"color": "rgba(255, 255, 255, 1)",
|
||||||
|
"bold": true,
|
||||||
|
"align": "center",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,11 @@
|
|||||||
"btn_restart": {
|
"btn_restart": {
|
||||||
"_$ref": "y7aniaui"
|
"_$ref": "y7aniaui"
|
||||||
},
|
},
|
||||||
"btn_new": {
|
"btn_newOrClose": {
|
||||||
"_$ref": "eepsaznr"
|
"_$ref": "eepsaznr"
|
||||||
|
},
|
||||||
|
"label_newOrClose": {
|
||||||
|
"_$ref": "2r6iotpo"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -181,7 +184,7 @@
|
|||||||
{
|
{
|
||||||
"_$id": "eepsaznr",
|
"_$id": "eepsaznr",
|
||||||
"_$type": "Sprite",
|
"_$type": "Sprite",
|
||||||
"name": "btn_new",
|
"name": "btn_newOrClose",
|
||||||
"y": 408,
|
"y": 408,
|
||||||
"width": 744,
|
"width": 744,
|
||||||
"height": 156,
|
"height": 156,
|
||||||
|
|||||||
@@ -14,10 +14,22 @@
|
|||||||
{
|
{
|
||||||
"_$type": "f2970e4d-7a09-4a9b-aef3-45d330c86f4f",
|
"_$type": "f2970e4d-7a09-4a9b-aef3-45d330c86f4f",
|
||||||
"scriptPath": "../src/views/Home.ts",
|
"scriptPath": "../src/views/Home.ts",
|
||||||
|
"label_dc_title": {
|
||||||
|
"_$ref": "zbppj6k0"
|
||||||
|
},
|
||||||
|
"btn_play": {
|
||||||
|
"_$ref": "ttv6dk1v"
|
||||||
|
},
|
||||||
|
"btn_continue": {
|
||||||
|
"_$ref": "ofvmzh0x"
|
||||||
|
},
|
||||||
|
"btn_more": {
|
||||||
|
"_$ref": "8mgjn0da"
|
||||||
|
},
|
||||||
"btn_new_blue": {
|
"btn_new_blue": {
|
||||||
"_$ref": "6irhm6t7"
|
"_$ref": "6irhm6t7"
|
||||||
},
|
},
|
||||||
"btn_continue": {
|
"btn_go": {
|
||||||
"_$ref": "9rcb0wtp"
|
"_$ref": "9rcb0wtp"
|
||||||
},
|
},
|
||||||
"btn_new_white": {
|
"btn_new_white": {
|
||||||
@@ -43,22 +55,205 @@
|
|||||||
"color": "#f5f7fb"
|
"color": "#f5f7fb"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_$id": "vxgd702p",
|
"_$id": "pnoy48ek",
|
||||||
"_$type": "Label",
|
"_$type": "Box",
|
||||||
"name": "Label",
|
"name": "dc",
|
||||||
"x": 144,
|
"x": 72,
|
||||||
"y": 760,
|
"y": 160,
|
||||||
"width": 792,
|
"width": 936,
|
||||||
"height": 400,
|
"height": 468,
|
||||||
|
"top": 160,
|
||||||
"centerX": 0,
|
"centerX": 0,
|
||||||
"centerY": 0,
|
"_$child": [
|
||||||
"text": "Classic\nSudoku",
|
{
|
||||||
"fontSize": 100,
|
"_$id": "7270vjom",
|
||||||
"color": "rgba(123, 129, 140, 1)",
|
"_$type": "Image",
|
||||||
"bold": true,
|
"name": "bg",
|
||||||
"align": "center",
|
"width": 936,
|
||||||
"valign": "middle",
|
"height": 468,
|
||||||
"padding": "0,0,0,0"
|
"skin": "res://342d91e6-0434-4d52-b16c-3c536060f881",
|
||||||
|
"useSourceSize": true,
|
||||||
|
"color": "#ffffff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "5ubzcrtp",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "Label",
|
||||||
|
"x": 85,
|
||||||
|
"y": 28,
|
||||||
|
"width": 767,
|
||||||
|
"height": 100,
|
||||||
|
"alpha": 0.6,
|
||||||
|
"centerX": 0,
|
||||||
|
"centerY": -156,
|
||||||
|
"text": "Daily Challenge",
|
||||||
|
"fontSize": 36,
|
||||||
|
"color": "rgba(45, 49, 56, 1)",
|
||||||
|
"bold": true,
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "zbppj6k0",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "title",
|
||||||
|
"x": 85,
|
||||||
|
"y": 107,
|
||||||
|
"width": 767,
|
||||||
|
"height": 100,
|
||||||
|
"centerX": 0,
|
||||||
|
"centerY": -77,
|
||||||
|
"text": "Mar 12",
|
||||||
|
"fontSize": 60,
|
||||||
|
"color": "rgba(45, 49, 56, 1)",
|
||||||
|
"bold": true,
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "h6dakob0",
|
||||||
|
"_$type": "Image",
|
||||||
|
"name": "trophy",
|
||||||
|
"x": 468,
|
||||||
|
"width": 468,
|
||||||
|
"height": 468,
|
||||||
|
"right": 0,
|
||||||
|
"skin": "res://0a33c495-5713-4f5d-bb30-d0021966cf7e",
|
||||||
|
"useSourceSize": true,
|
||||||
|
"color": "#ffffff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "ttv6dk1v",
|
||||||
|
"_$type": "Sprite",
|
||||||
|
"name": "btn_play",
|
||||||
|
"x": 72,
|
||||||
|
"y": 318,
|
||||||
|
"width": 195,
|
||||||
|
"height": 96,
|
||||||
|
"_gcmds": [
|
||||||
|
{
|
||||||
|
"_$type": "DrawRoundRectCmd",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 1,
|
||||||
|
"height": 1,
|
||||||
|
"lt": 10,
|
||||||
|
"rt": 10,
|
||||||
|
"lb": 10,
|
||||||
|
"rb": 10,
|
||||||
|
"percent": true,
|
||||||
|
"lineWidth": 1,
|
||||||
|
"fillColor": "#FFFFFF"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_$child": [
|
||||||
|
{
|
||||||
|
"_$id": "8s2b3obv",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "Label",
|
||||||
|
"width": 195,
|
||||||
|
"height": 96,
|
||||||
|
"centerX": 0,
|
||||||
|
"centerY": 0,
|
||||||
|
"text": "Play",
|
||||||
|
"fontSize": 48,
|
||||||
|
"color": "rgba(29, 92, 220, 1)",
|
||||||
|
"bold": true,
|
||||||
|
"align": "center",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "ofvmzh0x",
|
||||||
|
"_$type": "Sprite",
|
||||||
|
"name": "btn_continue",
|
||||||
|
"x": 72,
|
||||||
|
"y": 318,
|
||||||
|
"width": 309,
|
||||||
|
"height": 96,
|
||||||
|
"visible": false,
|
||||||
|
"_gcmds": [
|
||||||
|
{
|
||||||
|
"_$type": "DrawRoundRectCmd",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 1,
|
||||||
|
"height": 1,
|
||||||
|
"lt": 10,
|
||||||
|
"rt": 10,
|
||||||
|
"lb": 10,
|
||||||
|
"rb": 10,
|
||||||
|
"percent": true,
|
||||||
|
"lineWidth": 1,
|
||||||
|
"fillColor": "#FFFFFF"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_$child": [
|
||||||
|
{
|
||||||
|
"_$id": "2ou1bw71",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "Label",
|
||||||
|
"width": 309,
|
||||||
|
"height": 96,
|
||||||
|
"centerX": 0,
|
||||||
|
"centerY": 0,
|
||||||
|
"text": "Continue",
|
||||||
|
"fontSize": 48,
|
||||||
|
"color": "rgba(29, 92, 220, 1)",
|
||||||
|
"bold": true,
|
||||||
|
"align": "center",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "8mgjn0da",
|
||||||
|
"_$type": "Sprite",
|
||||||
|
"name": "btn_more",
|
||||||
|
"x": 72,
|
||||||
|
"y": 318,
|
||||||
|
"width": 216,
|
||||||
|
"height": 96,
|
||||||
|
"visible": false,
|
||||||
|
"_gcmds": [
|
||||||
|
{
|
||||||
|
"_$type": "DrawRoundRectCmd",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 1,
|
||||||
|
"height": 1,
|
||||||
|
"lt": 10,
|
||||||
|
"rt": 10,
|
||||||
|
"lb": 10,
|
||||||
|
"rb": 10,
|
||||||
|
"percent": true,
|
||||||
|
"lineWidth": 1,
|
||||||
|
"fillColor": "#FFFFFF"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_$child": [
|
||||||
|
{
|
||||||
|
"_$id": "w132wbbv",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "Label",
|
||||||
|
"width": 216,
|
||||||
|
"height": 96,
|
||||||
|
"centerX": 0,
|
||||||
|
"centerY": 0,
|
||||||
|
"text": "More",
|
||||||
|
"fontSize": 48,
|
||||||
|
"color": "rgba(29, 92, 220, 1)",
|
||||||
|
"bold": true,
|
||||||
|
"align": "center",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_$id": "6irhm6t7",
|
"_$id": "6irhm6t7",
|
||||||
@@ -115,7 +310,7 @@
|
|||||||
{
|
{
|
||||||
"_$id": "9rcb0wtp",
|
"_$id": "9rcb0wtp",
|
||||||
"_$type": "Box",
|
"_$type": "Box",
|
||||||
"name": "btn_continue",
|
"name": "btn_go",
|
||||||
"x": 144,
|
"x": 144,
|
||||||
"y": 1376,
|
"y": 1376,
|
||||||
"width": 792,
|
"width": 792,
|
||||||
@@ -276,6 +471,24 @@
|
|||||||
"padding": "0,0,0,0"
|
"padding": "0,0,0,0"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_$id": "vxgd702p",
|
||||||
|
"_$type": "Label",
|
||||||
|
"name": "Label",
|
||||||
|
"x": 144,
|
||||||
|
"y": 760,
|
||||||
|
"width": 792,
|
||||||
|
"height": 400,
|
||||||
|
"centerX": 0,
|
||||||
|
"centerY": 0,
|
||||||
|
"text": "Classic\nSudoku",
|
||||||
|
"fontSize": 100,
|
||||||
|
"color": "rgba(123, 129, 140, 1)",
|
||||||
|
"bold": true,
|
||||||
|
"align": "center",
|
||||||
|
"valign": "middle",
|
||||||
|
"padding": "0,0,0,0"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
"label_mistake": {
|
"label_mistake": {
|
||||||
"_$ref": "azfx9pw2"
|
"_$ref": "azfx9pw2"
|
||||||
},
|
},
|
||||||
"label_diff": {
|
"label_name": {
|
||||||
"_$ref": "qxei5ih3"
|
"_$ref": "qxei5ih3"
|
||||||
},
|
},
|
||||||
"label_time": {
|
"label_time": {
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
{
|
{
|
||||||
"_$id": "qxei5ih3",
|
"_$id": "qxei5ih3",
|
||||||
"_$type": "Label",
|
"_$type": "Label",
|
||||||
"name": "label_diff",
|
"name": "label_name",
|
||||||
"x": 372,
|
"x": 372,
|
||||||
"y": -58,
|
"y": -58,
|
||||||
"width": 300,
|
"width": 300,
|
||||||
|
|||||||
@@ -2,14 +2,18 @@
|
|||||||
|
|
||||||
import { StorageManager } from "./models/StorageManager";
|
import { StorageManager } from "./models/StorageManager";
|
||||||
import { LevelManager } from "./models/LevelManager";
|
import { LevelManager } from "./models/LevelManager";
|
||||||
|
import { config } from "./constants/config";
|
||||||
const { regClass, property } = Laya;
|
const { regClass, property } = Laya;
|
||||||
|
|
||||||
@regClass()
|
@regClass()
|
||||||
export class Main extends Laya.Script {
|
export class Main extends Laya.Script {
|
||||||
|
|
||||||
onAwake() {
|
@property(Boolean)
|
||||||
console.log("Game awake");
|
public debug: boolean = false
|
||||||
|
|
||||||
|
onAwake() {
|
||||||
|
console.log("Game onAwake")
|
||||||
|
config.DEBUG = this.debug
|
||||||
LevelManager.getInstance().init()
|
LevelManager.getInstance().init()
|
||||||
StorageManager.getInstance().init()
|
StorageManager.getInstance().init()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
|
|
||||||
BREAK_POINT: 1, // 竖版和横版的分界宽度
|
BREAK_POINT: 1, // 竖版和横版的分界宽度
|
||||||
|
|
||||||
DEBUG: true,
|
DEBUG: false,
|
||||||
OPEN_GUIDE: true,
|
OPEN_GUIDE: true,
|
||||||
|
|
||||||
MISTAKE_MAX: 3,//最大错误数
|
MISTAKE_MAX: 3,//最大错误数
|
||||||
@@ -24,6 +25,7 @@ export const config = {
|
|||||||
Expert: "Expert",
|
Expert: "Expert",
|
||||||
Extreme: "Extreme",
|
Extreme: "Extreme",
|
||||||
},
|
},
|
||||||
|
DIFFICULTY_LIST: ["Easy", "Medium", "Hard", "Expert", "Extreme"],
|
||||||
|
|
||||||
BLOCK_COLOR: {
|
BLOCK_COLOR: {
|
||||||
WHITE: "#ffffff",
|
WHITE: "#ffffff",
|
||||||
@@ -32,7 +34,7 @@ export const config = {
|
|||||||
BLUE: "#2559c0",
|
BLUE: "#2559c0",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
MONTH_ABBRS: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
export const respath = {
|
export const respath = {
|
||||||
home_ui_res: "resources/Home.lh",
|
home_ui_res: "resources/Home.lh",
|
||||||
|
dc_ui_res: "resources/DailyChallenge.lh",
|
||||||
stage_ui_res: "resources/Stage.lh",
|
stage_ui_res: "resources/Stage.lh",
|
||||||
gameover_ui_res: "resources/GameOver.lh",
|
gameover_ui_res: "resources/GameOver.lh",
|
||||||
gamedone_ui_res: "resources/GameDone.lh",
|
gamedone_ui_res: "resources/GameDone.lh",
|
||||||
|
|||||||
@@ -110,6 +110,14 @@ export class DOStage {
|
|||||||
StorageManager.getInstance().onChanged()
|
StorageManager.getInstance().onChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get_score(): number {
|
||||||
|
return this.data.score
|
||||||
|
}
|
||||||
|
public set_score(score: number): void {
|
||||||
|
this.data.score = score
|
||||||
|
StorageManager.getInstance().onChanged()
|
||||||
|
}
|
||||||
|
|
||||||
public get_duration(): number {
|
public get_duration(): number {
|
||||||
return this.data.duration
|
return this.data.duration
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { DataProgress, DataUser } from "../types/global";
|
import { DataProgress, DataUser, StageProgress } from "../types/global";
|
||||||
import { StorageManager } from "./StorageManager"
|
import { StorageManager } from "./StorageManager"
|
||||||
|
|
||||||
|
|
||||||
@@ -15,22 +15,37 @@ export class DOUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//====================================持久化数据
|
//====================================持久化数据
|
||||||
public get_isCompletedMain(): boolean {
|
public get_done(stageID: string): number {
|
||||||
return this.data.isCompletedMain
|
var find: StageProgress
|
||||||
}
|
for (var i=0; i<this.data.dones.length; i++) {
|
||||||
public set_isCompletedMain(isCompletedMain: boolean): void {
|
var obj = this.data.dones[i]
|
||||||
this.data.isCompletedMain = isCompletedMain
|
if (obj.stageID == stageID) {
|
||||||
StorageManager.getInstance().saveUser()
|
find = obj
|
||||||
}
|
break
|
||||||
|
}
|
||||||
public get_dones(): Array<string> {
|
|
||||||
return this.data.dones
|
|
||||||
}
|
|
||||||
public add_done(stageID: string): void {
|
|
||||||
if (this.data.dones.indexOf(stageID) < 0) {
|
|
||||||
this.data.dones.push(stageID)
|
|
||||||
StorageManager.getInstance().saveUser()
|
|
||||||
}
|
}
|
||||||
|
if (find) {
|
||||||
|
return find.progress
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
public update_stage_done(stageID: string, progress: number): void {
|
||||||
|
var find: StageProgress
|
||||||
|
for (var i=0; i<this.data.dones.length; i++) {
|
||||||
|
var obj = this.data.dones[i]
|
||||||
|
if (obj.stageID == stageID) {
|
||||||
|
find = obj
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (find) {
|
||||||
|
find.progress = progress
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
find = {stageID: stageID, progress: progress}
|
||||||
|
this.data.dones.push(find)
|
||||||
|
}
|
||||||
|
StorageManager.getInstance().saveUser()
|
||||||
}
|
}
|
||||||
|
|
||||||
public get_progress(difficulty: string): number {
|
public get_progress(difficulty: string): number {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export class EventManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DispatchEvent(eventID: string, arg: any): void {
|
public DispatchEvent(eventID: string, arg: any=null): void {
|
||||||
if (this.listeners.has(eventID)) {
|
if (this.listeners.has(eventID)) {
|
||||||
var list: Array<any> = this.listeners.get(eventID)
|
var list: Array<any> = this.listeners.get(eventID)
|
||||||
for (var i=0; i<list.length; i++) {
|
for (var i=0; i<list.length; i++) {
|
||||||
|
|||||||
@@ -141,6 +141,11 @@ export class LevelManager {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getLevelList(difficulty: string): Array<string> {
|
||||||
|
var list = this.levelMap.get(difficulty)
|
||||||
|
return list
|
||||||
|
}
|
||||||
|
|
||||||
public getLevelStr(difficulty: string, index: number): string {
|
public getLevelStr(difficulty: string, index: number): string {
|
||||||
var list = this.levelMap.get(difficulty)
|
var list = this.levelMap.get(difficulty)
|
||||||
if (list) {
|
if (list) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import { config } from "../constants/config"
|
||||||
import { DataStage, createDataStage } from "../types/global"
|
import { DataStage, createDataStage } from "../types/global"
|
||||||
import { DOStage } from "./DOStage"
|
import { DOStage } from "./DOStage"
|
||||||
import { DOUser } from "./DOUser"
|
import { DOUser } from "./DOUser"
|
||||||
@@ -29,7 +30,7 @@ export class StorageManager {
|
|||||||
this.user = new DOUser(JSON.parse(jsonStr))
|
this.user = new DOUser(JSON.parse(jsonStr))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.user = new DOUser({isCompletedMain: true, dones: new Array(), progresses: new Array()})
|
this.user = new DOUser({dones: new Array(), progresses: new Array()})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.stageID = ""
|
this.stageID = ""
|
||||||
@@ -47,15 +48,7 @@ export class StorageManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public cleanStage(stageID: string): void {
|
|
||||||
if (this.stageMap.has(stageID)) {
|
|
||||||
this.stageMap.delete(stageID)
|
|
||||||
}
|
|
||||||
Laya.LocalStorage.removeItem(stageID)
|
|
||||||
this.stageID = ""
|
|
||||||
this.stageChanged = false
|
|
||||||
}
|
|
||||||
public newStage(stageID: string, type: number, name: string, difficulty: string, index: number): DOStage {
|
public newStage(stageID: string, type: number, name: string, difficulty: string, index: number): DOStage {
|
||||||
this.stageID = stageID
|
this.stageID = stageID
|
||||||
this.stageChanged = false
|
this.stageChanged = false
|
||||||
@@ -82,6 +75,25 @@ export class StorageManager {
|
|||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
public getStage(): DOStage {//获取当前关卡数据对象,注意判空
|
||||||
|
if (this.stageID && this.stageMap) {
|
||||||
|
return this.stageMap.get(this.stageID)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
public cleanStage(): void {//清空当前关卡数据对象,注意判空
|
||||||
|
this.user.update_stage_done(this.stageID, 0)
|
||||||
|
if (this.stageMap.has(this.stageID)) {
|
||||||
|
this.stageMap.delete(this.stageID)
|
||||||
|
}
|
||||||
|
Laya.LocalStorage.removeItem(this.stageID)
|
||||||
|
this.stageID = ""
|
||||||
|
this.stageChanged = false
|
||||||
|
}
|
||||||
|
public cleanMainStage(): void {//清空主线关卡数据
|
||||||
|
this.stageID = config.DEFAULT_STAGE_ID
|
||||||
|
this.cleanStage()
|
||||||
|
}
|
||||||
public saveStage(): void {
|
public saveStage(): void {
|
||||||
if (this.stageChanged) {
|
if (this.stageChanged) {
|
||||||
this.stageChanged = false
|
this.stageChanged = false
|
||||||
@@ -98,7 +110,7 @@ export class StorageManager {
|
|||||||
|
|
||||||
|
|
||||||
public cleanAll(): void {
|
public cleanAll(): void {
|
||||||
this.user = new DOUser({isCompletedMain: true, dones: new Array(), progresses: new Array()})
|
this.user = new DOUser({dones: new Array(), progresses: new Array()})
|
||||||
|
|
||||||
this.stageID = ""
|
this.stageID = ""
|
||||||
this.stageChanged = false
|
this.stageChanged = false
|
||||||
|
|||||||
@@ -36,6 +36,13 @@ export class UIManager extends Laya.Script {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public loadDCUI(): void {
|
||||||
|
Laya.loader.load(respath.dc_ui_res).then((go)=>{
|
||||||
|
var prefab = go.create()
|
||||||
|
this.getUIRoot().addChild(prefab)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public loadStageUI(stageID: string): void {
|
public loadStageUI(stageID: string): void {
|
||||||
if (this.stage) {
|
if (this.stage) {
|
||||||
this.stage.onLoadStage(StorageManager.getInstance().loadStage(stageID))
|
this.stage.onLoadStage(StorageManager.getInstance().loadStage(stageID))
|
||||||
@@ -48,7 +55,6 @@ export class UIManager extends Laya.Script {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeStageUI(): void {
|
public closeStageUI(): void {
|
||||||
if (this.stage) {
|
if (this.stage) {
|
||||||
this.stage.owner.destroy()
|
this.stage.owner.destroy()
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export interface DataStage {
|
|||||||
difficulty: string,
|
difficulty: string,
|
||||||
index: number,
|
index: number,
|
||||||
mistake?: number,
|
mistake?: number,
|
||||||
|
score?: number,
|
||||||
duration?: number,
|
duration?: number,
|
||||||
note_open?: boolean,
|
note_open?: boolean,
|
||||||
hint?: number,
|
hint?: number,
|
||||||
@@ -33,6 +34,7 @@ export interface DataStage {
|
|||||||
export function createDataStage(id: string, type: number, name: string, difficulty: string, index: number): DataStage {
|
export function createDataStage(id: string, type: number, name: string, difficulty: string, index: number): DataStage {
|
||||||
var data: DataStage = {id: id, type: type, name: name, difficulty: difficulty, index: index}
|
var data: DataStage = {id: id, type: type, name: name, difficulty: difficulty, index: index}
|
||||||
data.mistake = 0
|
data.mistake = 0
|
||||||
|
data.score = 0
|
||||||
data.duration = 0
|
data.duration = 0
|
||||||
data.note_open = false
|
data.note_open = false
|
||||||
data.hint = 2
|
data.hint = 2
|
||||||
@@ -43,12 +45,15 @@ export function createDataStage(id: string, type: number, name: string, difficul
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export interface StageProgress {//关卡完成进度
|
||||||
|
stageID: string,
|
||||||
|
progress: number,
|
||||||
|
}
|
||||||
export interface DataProgress {
|
export interface DataProgress {
|
||||||
difficulty: string,
|
difficulty: string,
|
||||||
index: number,
|
index: number,
|
||||||
}
|
}
|
||||||
export interface DataUser {
|
export interface DataUser {
|
||||||
isCompletedMain: boolean,//当前主线是否已完成 默认true
|
dones: Array<StageProgress>,//关卡完成进度
|
||||||
dones: Array<string>,//已完成关卡
|
progresses: Array<DataProgress>,//主线各个难度进度
|
||||||
progresses: Array<DataProgress>,//已经完成的进度
|
|
||||||
}
|
}
|
||||||
115
src/views/CalendarUnit.ts
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
const { regClass, property } = Laya;
|
||||||
|
|
||||||
|
@regClass()
|
||||||
|
export class CalendarUnit extends Laya.Script {
|
||||||
|
declare owner : Laya.Box;
|
||||||
|
|
||||||
|
@property(Number)
|
||||||
|
public day: number = 0;
|
||||||
|
@property(Boolean)
|
||||||
|
public open: boolean = false;
|
||||||
|
@property(Number)
|
||||||
|
public progress: number = 0;
|
||||||
|
|
||||||
|
private selected: boolean = false
|
||||||
|
|
||||||
|
@property(Laya.Sprite)
|
||||||
|
public obj_selected: Laya.Sprite;
|
||||||
|
|
||||||
|
@property(Laya.Box)
|
||||||
|
public obj_pie: Laya.Box;
|
||||||
|
@property(Laya.Sprite)
|
||||||
|
public sprite_pie: Laya.Sprite;
|
||||||
|
|
||||||
|
@property(Laya.Sprite)
|
||||||
|
public obj_mask: Laya.Sprite;
|
||||||
|
@property(Laya.Sprite)
|
||||||
|
public sprite_mask: Laya.Sprite;
|
||||||
|
|
||||||
|
@property(Laya.Image)
|
||||||
|
public obj_star: Laya.Image;
|
||||||
|
|
||||||
|
@property(Laya.Label)
|
||||||
|
public label_show: Laya.Label;
|
||||||
|
|
||||||
|
|
||||||
|
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
||||||
|
onAwake(): void {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public onInit(day: number, open: boolean, progress: number, label_obj: Laya.Label, handler: any, func: any): void {
|
||||||
|
this.day = day;
|
||||||
|
this.open = open
|
||||||
|
this.progress = progress
|
||||||
|
this.label_show = label_obj
|
||||||
|
if (open) {
|
||||||
|
if (progress >= 1) {
|
||||||
|
this.label_show.text = ""
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.label_show.text = this.day.toString()
|
||||||
|
}
|
||||||
|
this.label_show.color = "#2d3138"
|
||||||
|
this.owner.on(Laya.Event.CLICK, handler, func)
|
||||||
|
this.updateUnit()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.label_show.text = this.day.toString()
|
||||||
|
this.label_show.color = "#d3d5db"
|
||||||
|
this.owner.on(Laya.Event.CLICK, this, (evt: Laya.Event)=>{
|
||||||
|
|
||||||
|
})
|
||||||
|
this.obj_selected.visible = false
|
||||||
|
this.obj_pie.visible = false
|
||||||
|
this.obj_mask.visible = false
|
||||||
|
this.obj_star.visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public setSelected(selected: boolean): void {
|
||||||
|
this.selected = selected
|
||||||
|
this.updateUnit()
|
||||||
|
}
|
||||||
|
|
||||||
|
updateUnit(): void {
|
||||||
|
if (this.open == false) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.obj_star.visible = this.progress >= 1
|
||||||
|
|
||||||
|
if (this.selected) {
|
||||||
|
this.label_show.color = "#ffffff"
|
||||||
|
this.obj_selected.visible = true
|
||||||
|
if (this.progress > 0) {
|
||||||
|
this.obj_pie.visible = true
|
||||||
|
this.obj_mask.visible = true
|
||||||
|
this.sprite_pie.graphics.clear()
|
||||||
|
this.sprite_pie.graphics.drawPie(48, 48, 48, 0, 360*this.progress, "#ffffff")
|
||||||
|
this.sprite_mask.graphics.clear()
|
||||||
|
this.sprite_mask.graphics.drawCircle(0.5, 0.5, 0.5, "#1d5cdc")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.obj_pie.visible = false
|
||||||
|
this.obj_mask.visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.label_show.color = "#2d3138"
|
||||||
|
this.obj_selected.visible = false
|
||||||
|
if (this.progress > 0 && this.progress < 1) {
|
||||||
|
this.obj_pie.visible = true
|
||||||
|
this.obj_mask.visible = true
|
||||||
|
this.sprite_pie.graphics.clear()
|
||||||
|
this.sprite_pie.graphics.drawPie(48, 48, 48, 0, 360*this.progress, "#2d3138")
|
||||||
|
this.sprite_mask.graphics.clear()
|
||||||
|
this.sprite_mask.graphics.drawCircle(0.5, 0.5, 0.5, "#ffffff")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.obj_pie.visible = false
|
||||||
|
this.obj_mask.visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
src/views/CalendarUnit.ts.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"uuid": "04c54914-715e-4e07-8a45-770f2a2c05a6"
|
||||||
|
}
|
||||||
161
src/views/DailyChallenge.ts
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
import { config } from "../constants/config";
|
||||||
|
import { Utility_ConvertSecondToString } from "../utils/utility";
|
||||||
|
import { StorageManager } from "../models/StorageManager";
|
||||||
|
import { CalendarUnit } from "./CalendarUnit";
|
||||||
|
import { LevelManager } from "../models/LevelManager";
|
||||||
|
import { UIManager } from "../models/UIManager";
|
||||||
|
|
||||||
|
const { regClass, property } = Laya;
|
||||||
|
|
||||||
|
@regClass()
|
||||||
|
export class DailyChallenge extends Laya.Script {
|
||||||
|
declare owner : Laya.Box;
|
||||||
|
|
||||||
|
@property(Laya.Button)
|
||||||
|
public btn_back: Laya.Button
|
||||||
|
|
||||||
|
@property(Laya.Label)
|
||||||
|
public label_year: Laya.Label;
|
||||||
|
@property(Laya.Label)
|
||||||
|
public label_month: Laya.Label;
|
||||||
|
@property(Laya.Label)
|
||||||
|
public label_star: Laya.Label;
|
||||||
|
|
||||||
|
@property(Laya.Box)
|
||||||
|
public btn_play: Laya.Box
|
||||||
|
@property(Laya.Label)
|
||||||
|
public label_play: Laya.Label
|
||||||
|
@property(Laya.Box)
|
||||||
|
public obj_summary: Laya.Box
|
||||||
|
@property(Laya.Label)
|
||||||
|
public label_date: Laya.Label;
|
||||||
|
@property(Laya.Label)
|
||||||
|
public label_diffucuty: Laya.Label
|
||||||
|
@property(Laya.Label)
|
||||||
|
public label_score: Laya.Label
|
||||||
|
@property(Laya.Label)
|
||||||
|
public label_time: Laya.Label
|
||||||
|
|
||||||
|
@property(Laya.Box)
|
||||||
|
public obj_items: Laya.Box;
|
||||||
|
@property(Laya.Box)
|
||||||
|
public obj_labels: Laya.Box;
|
||||||
|
private units: Array<CalendarUnit> = new Array();
|
||||||
|
private selectedUnit: CalendarUnit;
|
||||||
|
|
||||||
|
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
||||||
|
onAwake(): void {
|
||||||
|
this.btn_back.on(Laya.Event.CLICK, this, ()=>{
|
||||||
|
UIManager.getInstance().loadHomeUI()
|
||||||
|
this.owner.destroy()
|
||||||
|
})
|
||||||
|
|
||||||
|
var now = new Date()
|
||||||
|
var year = now.getFullYear()
|
||||||
|
var month = now.getMonth() + 1
|
||||||
|
var dayNow = new Date().getDate()
|
||||||
|
var stageID = `${year}-${month}-${day}`
|
||||||
|
|
||||||
|
this.label_year.text = year.toString()
|
||||||
|
this.label_month.text = config.MONTH_ABBRS[month-1]
|
||||||
|
var starCount = 0
|
||||||
|
var day = 1
|
||||||
|
var dayCount = 31
|
||||||
|
var begin = 4
|
||||||
|
var index = -1
|
||||||
|
for (var i=0; i<this.obj_items.numChildren; i++) {
|
||||||
|
var hbox = this.obj_items.getChildAt(i)
|
||||||
|
var l_hbox = this.obj_labels.getChildAt(i)
|
||||||
|
for (var j=0; j<hbox.numChildren; j++) {
|
||||||
|
var obj = hbox.getChildAt(j) as Laya.Box
|
||||||
|
var l_obj = l_hbox.getChildAt(j) as Laya.Label
|
||||||
|
index ++
|
||||||
|
if (index >= begin && index < begin+dayCount) {
|
||||||
|
obj.visible = true
|
||||||
|
l_obj.visible = true
|
||||||
|
var unit = obj.getComponent(CalendarUnit)
|
||||||
|
this.units.push(unit)
|
||||||
|
var stageID = `${year}-${month}-${day}`
|
||||||
|
var progress = StorageManager.getInstance().getUser().get_done(stageID)
|
||||||
|
unit.onInit(day, day<=dayNow, progress, l_obj, this, this.onClickUnit)
|
||||||
|
if (day == dayNow) {
|
||||||
|
this.selectedUnit = unit
|
||||||
|
}
|
||||||
|
if (progress >= 1) {
|
||||||
|
starCount ++
|
||||||
|
}
|
||||||
|
day ++
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
obj.visible = false
|
||||||
|
l_obj.visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.label_star.text = `${starCount}/${dayCount}`
|
||||||
|
|
||||||
|
this.onApplyUnit(this.selectedUnit)
|
||||||
|
|
||||||
|
this.btn_play.on(Laya.Event.CLICK, this, (evt: Laya.Event)=>{
|
||||||
|
// console.log(">>>>>>>>>>>>>>>>>>>>>>>", this.selectedUnit.day)
|
||||||
|
var now = new Date()
|
||||||
|
var year = now.getFullYear()
|
||||||
|
var month = now.getMonth() + 1
|
||||||
|
var dayNow = this.selectedUnit.day
|
||||||
|
var stageID = `${year}-${month}-${dayNow}`
|
||||||
|
var doStage = StorageManager.getInstance().loadStage(stageID)
|
||||||
|
console.log("play >>>>>>>>>>>>>>>>>>>>>>>", stageID, doStage)
|
||||||
|
if (!doStage) {
|
||||||
|
var random = Math.random()
|
||||||
|
var value = config.DIFFICULTY_LIST[Math.floor(random*config.DIFFICULTY_LIST.length)]
|
||||||
|
var list = LevelManager.getInstance().getLevelList(value)
|
||||||
|
random = Math.random()
|
||||||
|
var index = Math.floor(random*list.length)
|
||||||
|
var stageName = `${config.MONTH_ABBRS[month-1]} ${dayNow}`
|
||||||
|
console.log("随机一个关卡", value, index)
|
||||||
|
StorageManager.getInstance().newStage(stageID, config.STAGE_TYPE.DC, stageName, value, index)
|
||||||
|
}
|
||||||
|
UIManager.getInstance().loadStageUI(stageID);
|
||||||
|
this.owner.destroy()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
public onApplyUnit(unit: CalendarUnit): void {
|
||||||
|
this.selectedUnit.setSelected(false)
|
||||||
|
this.selectedUnit = unit
|
||||||
|
this.selectedUnit.setSelected(true)
|
||||||
|
|
||||||
|
var now = new Date()
|
||||||
|
var year = now.getFullYear()
|
||||||
|
var month = now.getMonth() + 1
|
||||||
|
var dayNow = unit.day
|
||||||
|
var stageID = `${year}-${month}-${dayNow}`
|
||||||
|
this.label_date.text = `${config.MONTH_ABBRS[month-1]} ${dayNow},${year}`
|
||||||
|
var user = StorageManager.getInstance().getUser()
|
||||||
|
var progress = user.get_done(stageID)
|
||||||
|
// console.log("onApplyUnit >>>>>", stageID, progress)
|
||||||
|
if (progress >= 1) {
|
||||||
|
this.btn_play.visible = false
|
||||||
|
this.obj_summary.visible = true
|
||||||
|
var doStage = StorageManager.getInstance().loadStage(stageID)
|
||||||
|
this.label_diffucuty.text = doStage.get_difficulty()
|
||||||
|
this.label_score.text = doStage.get_score().toString()
|
||||||
|
this.label_time.text = Utility_ConvertSecondToString(doStage.get_duration())
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.btn_play.visible = true
|
||||||
|
this.obj_summary.visible = false
|
||||||
|
var doStage = StorageManager.getInstance().loadStage(stageID)
|
||||||
|
if (doStage) {
|
||||||
|
this.label_play.text = "Continue"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.label_play.text = "Play"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public onClickUnit(evt: Laya.Event): void {
|
||||||
|
var unit = evt.target.getComponent(CalendarUnit)
|
||||||
|
this.onApplyUnit(unit)
|
||||||
|
}
|
||||||
|
}
|
||||||
3
src/views/DailyChallenge.ts.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"uuid": "3f68d98d-3867-41a7-b277-a24d279a22fa"
|
||||||
|
}
|
||||||
@@ -30,18 +30,12 @@ export class Difficulty extends Laya.Script {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public onInit(callback: any): void {
|
public onInit(callback: any): void {
|
||||||
var list: Array<string> = new Array()
|
for (var i=0; i<config.DIFFICULTY_LIST.length; i++) {
|
||||||
list.push(config.DIFFICULTY_TYPE.Easy)
|
|
||||||
list.push(config.DIFFICULTY_TYPE.Medium)
|
|
||||||
list.push(config.DIFFICULTY_TYPE.Hard)
|
|
||||||
list.push(config.DIFFICULTY_TYPE.Expert)
|
|
||||||
list.push(config.DIFFICULTY_TYPE.Extreme)
|
|
||||||
for (var i=0; i<list.length; i++) {
|
|
||||||
var obj = this.obj_items.getChildAt(i)
|
var obj = this.obj_items.getChildAt(i)
|
||||||
var Label = obj.getChildByName("Label") as Laya.Label
|
var Label = obj.getChildByName("Label") as Laya.Label
|
||||||
Label.text = list[i]
|
Label.text = config.DIFFICULTY_LIST[i]
|
||||||
var data = obj.getComponent(CommonData)
|
var data = obj.getComponent(CommonData)
|
||||||
data.strValue = list[i]
|
data.strValue = config.DIFFICULTY_LIST[i]
|
||||||
obj.on(Laya.Event.CLICK, this, (evt: Laya.Event)=>{
|
obj.on(Laya.Event.CLICK, this, (evt: Laya.Event)=>{
|
||||||
var data = evt.target.getComponent(CommonData)
|
var data = evt.target.getComponent(CommonData)
|
||||||
if (callback) {
|
if (callback) {
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import { UIManager } from "../models/UIManager";
|
import { UIManager } from "../models/UIManager";
|
||||||
import { StorageManager } from "../models/StorageManager";
|
import { StorageManager } from "../models/StorageManager";
|
||||||
|
import { Utility_ConvertSecondToString } from "../utils/utility";
|
||||||
|
import { respath } from "../constants/respath";
|
||||||
|
import { Difficulty } from "./Difficulty";
|
||||||
|
import { LevelManager } from "../models/LevelManager";
|
||||||
|
import { config } from "../constants/config";
|
||||||
|
|
||||||
const { regClass, property } = Laya;
|
const { regClass, property } = Laya;
|
||||||
|
|
||||||
@@ -7,15 +12,80 @@ const { regClass, property } = Laya;
|
|||||||
export class GameDone extends Laya.Script {
|
export class GameDone extends Laya.Script {
|
||||||
declare owner : Laya.Box;
|
declare owner : Laya.Box;
|
||||||
|
|
||||||
@property(Laya.Button)
|
@property(Laya.Box)
|
||||||
public btn_new: Laya.Button
|
public obj_top: Laya.Box
|
||||||
|
@property(Laya.Box)
|
||||||
|
public obj_stars: Laya.Box
|
||||||
|
@property(Laya.Image)
|
||||||
|
public obj_star: Laya.Image
|
||||||
|
|
||||||
|
@property(Laya.Label)
|
||||||
|
public label_diffucuty: Laya.Label
|
||||||
|
@property(Laya.Label)
|
||||||
|
public label_time: Laya.Label
|
||||||
|
@property(Laya.Label)
|
||||||
|
public label_score: Laya.Label
|
||||||
|
|
||||||
|
@property(Laya.Box)
|
||||||
|
public btn_new: Laya.Box
|
||||||
|
@property(Laya.Box)
|
||||||
|
public btn_home: Laya.Box
|
||||||
|
@property(Laya.Box)
|
||||||
|
public btn_continue: Laya.Box
|
||||||
|
|
||||||
|
|
||||||
|
onStart(): void {
|
||||||
|
var doStage = StorageManager.getInstance().getStage()
|
||||||
|
var type = doStage.get_stageType()
|
||||||
|
if (type == config.STAGE_TYPE.MAIN) {
|
||||||
|
this.obj_top.y = 356
|
||||||
|
this.obj_stars.visible = true
|
||||||
|
this.obj_star.visible = false
|
||||||
|
this.btn_new.visible = true
|
||||||
|
this.btn_home.visible = true
|
||||||
|
this.btn_continue.visible = false
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.obj_top.y = 456
|
||||||
|
this.obj_stars.visible = false
|
||||||
|
this.obj_star.visible = true
|
||||||
|
this.btn_new.visible = false
|
||||||
|
this.btn_home.visible = false
|
||||||
|
this.btn_continue.visible = true
|
||||||
|
}
|
||||||
|
this.label_diffucuty.text = doStage.get_difficulty()
|
||||||
|
this.label_time.text = Utility_ConvertSecondToString(doStage.get_duration())
|
||||||
|
this.label_score.text = doStage.get_score().toString()
|
||||||
|
|
||||||
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
|
||||||
onAwake(): void {
|
|
||||||
this.btn_new.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
this.btn_new.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
||||||
UIManager.getInstance().closeStage();
|
Laya.loader.load(respath.difficulty_ui_res).then((go)=>{
|
||||||
UIManager.getInstance().loadHome();
|
var prefab = go.create()
|
||||||
StorageManager.getInstance().cleanStage()
|
var d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
||||||
|
d.onInit((value: string)=> {
|
||||||
|
console.log("选择难度", value)
|
||||||
|
StorageManager.getInstance().cleanStage()
|
||||||
|
var user = StorageManager.getInstance().getUser()
|
||||||
|
var index = user.get_progress(value)
|
||||||
|
var levelStr = LevelManager.getInstance().getLevelStr(value, index)
|
||||||
|
if (!levelStr || levelStr.length <= 0) {//说明当前难度已经打通了,所以给他从头开始
|
||||||
|
user.update_progress(value, 0)
|
||||||
|
}
|
||||||
|
StorageManager.getInstance().newStage(config.DEFAULT_STAGE_ID, config.STAGE_TYPE.MAIN, value, value, user.get_progress(value))
|
||||||
|
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID);
|
||||||
|
this.owner.destroy()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
this.btn_home.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
||||||
|
UIManager.getInstance().loadHomeUI()
|
||||||
|
UIManager.getInstance().closeStageUI();
|
||||||
|
this.owner.destroy()
|
||||||
|
})
|
||||||
|
|
||||||
|
this.btn_continue.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
||||||
|
UIManager.getInstance().loadDCUI()
|
||||||
|
UIManager.getInstance().closeStageUI();
|
||||||
this.owner.destroy()
|
this.owner.destroy()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,49 +20,65 @@ export class GameOver extends Laya.Script {
|
|||||||
public btn_restart: Laya.Sprite
|
public btn_restart: Laya.Sprite
|
||||||
|
|
||||||
@property(Laya.Sprite)
|
@property(Laya.Sprite)
|
||||||
public btn_new: Laya.Sprite
|
public btn_newOrClose: Laya.Sprite
|
||||||
|
@property(Laya.Label)
|
||||||
|
public label_newOrClose: Laya.Label
|
||||||
|
|
||||||
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
||||||
onAwake(): void {
|
onAwake(): void {
|
||||||
|
|
||||||
this.btn_second.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
this.btn_second.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
||||||
var doStage = StorageManager.getInstance().loadStage(config.DEFAULT_STAGE_ID)
|
var doStage = StorageManager.getInstance().getStage()
|
||||||
doStage.set_mistake(doStage.get_mistake()-1)
|
doStage.set_mistake(doStage.get_mistake()-1)
|
||||||
EventManager.getInstance().DispatchEvent(EVENT_TYPES.NOT_UPDATE_MISTAKE, "adsf")
|
EventManager.getInstance().DispatchEvent(EVENT_TYPES.NOT_UPDATE_MISTAKE)
|
||||||
this.owner.destroy()
|
this.owner.destroy()
|
||||||
})
|
})
|
||||||
|
|
||||||
this.btn_restart.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
this.btn_restart.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
||||||
var doStage = StorageManager.getInstance().loadStage(config.DEFAULT_STAGE_ID)
|
var doStage = StorageManager.getInstance().getStage()
|
||||||
|
var stageID = doStage.get_stageID()
|
||||||
|
var type = doStage.get_stageType()
|
||||||
var difficulty = doStage.get_difficulty()
|
var difficulty = doStage.get_difficulty()
|
||||||
StorageManager.getInstance().cleanStage(config.DEFAULT_STAGE_ID)
|
StorageManager.getInstance().cleanStage()
|
||||||
var user = StorageManager.getInstance().getUser()
|
var user = StorageManager.getInstance().getUser()
|
||||||
user.set_isCompletedMain(false)
|
StorageManager.getInstance().newStage(stageID, type, difficulty, difficulty, user.get_progress(difficulty))
|
||||||
StorageManager.getInstance().newStage(config.DEFAULT_STAGE_ID, config.STAGE_TYPE.MAIN, difficulty, difficulty, user.get_progress(difficulty))
|
UIManager.getInstance().loadStageUI(stageID);
|
||||||
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID);
|
|
||||||
this.owner.destroy()
|
this.owner.destroy()
|
||||||
})
|
})
|
||||||
|
|
||||||
this.btn_new.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
var doStage = StorageManager.getInstance().getStage()
|
||||||
Laya.loader.load(respath.difficulty_ui_res).then((go)=>{
|
var type = doStage.get_stageType()
|
||||||
var prefab = go.create()
|
|
||||||
var d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
if (type == config.STAGE_TYPE.MAIN) {
|
||||||
d.onInit((value: string)=> {
|
this.label_newOrClose.text = "New Game"
|
||||||
console.log("选择难度", value)
|
this.btn_newOrClose.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
||||||
StorageManager.getInstance().cleanStage(config.DEFAULT_STAGE_ID)
|
Laya.loader.load(respath.difficulty_ui_res).then((go)=>{
|
||||||
var user = StorageManager.getInstance().getUser()
|
var prefab = go.create()
|
||||||
user.set_isCompletedMain(false)
|
var d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
||||||
var index = user.get_progress(value)
|
d.onInit((value: string)=> {
|
||||||
var levelStr = LevelManager.getInstance().getLevelStr(value, index)
|
console.log("选择难度", value)
|
||||||
if (!levelStr || levelStr.length <= 0) {//说明当前难度已经打通了,所以给他从头开始
|
StorageManager.getInstance().cleanStage()
|
||||||
user.update_progress(value, 0)
|
var user = StorageManager.getInstance().getUser()
|
||||||
}
|
var index = user.get_progress(value)
|
||||||
StorageManager.getInstance().newStage(config.DEFAULT_STAGE_ID, config.STAGE_TYPE.MAIN, value, value, user.get_progress(value))
|
var levelStr = LevelManager.getInstance().getLevelStr(value, index)
|
||||||
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID);
|
if (!levelStr || levelStr.length <= 0) {//说明当前难度已经打通了,所以给他从头开始
|
||||||
this.owner.destroy()
|
user.update_progress(value, 0)
|
||||||
|
}
|
||||||
|
StorageManager.getInstance().newStage(config.DEFAULT_STAGE_ID, config.STAGE_TYPE.MAIN, value, value, user.get_progress(value))
|
||||||
|
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID);
|
||||||
|
this.owner.destroy()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
else {
|
||||||
|
this.label_newOrClose.text = "Close"
|
||||||
|
this.btn_newOrClose.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
||||||
|
UIManager.getInstance().loadDCUI()
|
||||||
|
UIManager.getInstance().closeStageUI();
|
||||||
|
this.owner.destroy()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -13,11 +13,19 @@ const { regClass, property } = Laya
|
|||||||
export class Home extends Laya.Script {
|
export class Home extends Laya.Script {
|
||||||
declare owner : Laya.Box;
|
declare owner : Laya.Box;
|
||||||
|
|
||||||
@property(Laya.Box)
|
@property(Laya.Label)
|
||||||
public btn_new_blue: Laya.Box;
|
public label_dc_title: Laya.Label;
|
||||||
|
@property(Laya.Sprite)
|
||||||
|
public btn_play: Laya.Sprite;
|
||||||
|
@property(Laya.Sprite)
|
||||||
|
public btn_continue: Laya.Sprite;
|
||||||
|
@property(Laya.Sprite)
|
||||||
|
public btn_more: Laya.Sprite;
|
||||||
|
|
||||||
@property(Laya.Box)
|
@property(Laya.Box)
|
||||||
public btn_continue: Laya.Box;
|
public btn_new_blue: Laya.Box;
|
||||||
|
@property(Laya.Box)
|
||||||
|
public btn_go: Laya.Box;
|
||||||
@property(Laya.Box)
|
@property(Laya.Box)
|
||||||
public btn_new_white: Laya.Box;
|
public btn_new_white: Laya.Box;
|
||||||
|
|
||||||
@@ -26,34 +34,87 @@ export class Home extends Laya.Script {
|
|||||||
|
|
||||||
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
|
||||||
onAwake(): void {
|
onAwake(): void {
|
||||||
|
|
||||||
|
var user = StorageManager.getInstance().getUser()
|
||||||
|
|
||||||
|
var now = new Date()
|
||||||
|
var year = now.getFullYear()
|
||||||
|
var month = now.getMonth() + 1
|
||||||
|
var dayNow = new Date().getDate()
|
||||||
|
this.label_dc_title.text = `${config.MONTH_ABBRS[month-1]} ${dayNow}`
|
||||||
|
var stageID = `${year}-${month}-${dayNow}`
|
||||||
|
var progress = user.get_done(stageID)
|
||||||
|
if (progress <= 0) {
|
||||||
|
this.btn_play.visible = true
|
||||||
|
this.btn_continue.visible = false
|
||||||
|
this.btn_more.visible = false
|
||||||
|
this.btn_play.on(Laya.Event.CLICK, this, ()=>{//Play
|
||||||
|
var random = Math.random()
|
||||||
|
var value = config.DIFFICULTY_LIST[Math.floor(random*config.DIFFICULTY_LIST.length)]
|
||||||
|
var list = LevelManager.getInstance().getLevelList(value)
|
||||||
|
random = Math.random()
|
||||||
|
var index = Math.floor(random*list.length)
|
||||||
|
var stageName = `${config.MONTH_ABBRS[month-1]} ${dayNow}`
|
||||||
|
console.log("随机一个关卡", value, index)
|
||||||
|
StorageManager.getInstance().newStage(stageID, config.STAGE_TYPE.DC, stageName, value, index)
|
||||||
|
UIManager.getInstance().loadStageUI(stageID);
|
||||||
|
this.owner.destroy()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else if (progress >= 1) {
|
||||||
|
this.btn_play.visible = false
|
||||||
|
this.btn_continue.visible = false
|
||||||
|
this.btn_more.visible = true
|
||||||
|
this.btn_more.on(Laya.Event.CLICK, this, ()=>{//更多
|
||||||
|
UIManager.getInstance().loadDCUI();
|
||||||
|
this.owner.destroy()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.btn_play.visible = false
|
||||||
|
this.btn_continue.visible = true
|
||||||
|
this.btn_more.visible = false
|
||||||
|
this.btn_continue.on(Laya.Event.CLICK, this, ()=>{//继续
|
||||||
|
UIManager.getInstance().loadStageUI(stageID);
|
||||||
|
this.owner.destroy()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.btn_new_blue.on(Laya.Event.CLICK, this, this.onClickNew)
|
this.btn_new_blue.on(Laya.Event.CLICK, this, this.onClickNew)
|
||||||
this.btn_new_white.on(Laya.Event.CLICK, this, this.onClickNew)
|
this.btn_new_white.on(Laya.Event.CLICK, this, this.onClickNew)
|
||||||
this.btn_continue.on(Laya.Event.CLICK, this, (evt: Laya.Event)=>{
|
this.btn_go.on(Laya.Event.CLICK, this, (evt: Laya.Event)=>{
|
||||||
UIManager.getInstance().closeStageUI()
|
|
||||||
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID);
|
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID);
|
||||||
this.owner.destroy()
|
this.owner.destroy()
|
||||||
})
|
})
|
||||||
var user = StorageManager.getInstance().getUser()
|
var user = StorageManager.getInstance().getUser()
|
||||||
this.btn_new_blue.visible = user.get_isCompletedMain()
|
if (user.get_done(config.DEFAULT_STAGE_ID) >= 1) {
|
||||||
this.btn_new_white.visible = user.get_isCompletedMain() == false
|
console.log("当前主线关卡完成")
|
||||||
this.btn_continue.visible = user.get_isCompletedMain() == false
|
this.btn_new_blue.visible = true
|
||||||
if (user.get_isCompletedMain() == false) {
|
this.btn_new_white.visible = false
|
||||||
var label_time = this.btn_continue.getChildByName("time").getChildByName("label_time") as Laya.Label
|
this.btn_go.visible = false
|
||||||
var doStage = StorageManager.getInstance().loadStage(config.DEFAULT_STAGE_ID)
|
}
|
||||||
var duration = doStage.get_duration()
|
else {
|
||||||
var timeStr = Utility_ConvertSecondToString(duration)
|
var doStage = StorageManager.getInstance().loadStage(config.DEFAULT_STAGE_ID)
|
||||||
label_time.text = `${timeStr} - ${doStage.get_difficulty()}`
|
if (doStage) {
|
||||||
|
console.log("当前主线关卡进行中")
|
||||||
|
var label_time = this.btn_go.getChildByName("time").getChildByName("label_time") as Laya.Label
|
||||||
|
var duration = doStage.get_duration()
|
||||||
|
var timeStr = Utility_ConvertSecondToString(duration)
|
||||||
|
label_time.text = `${timeStr} - ${doStage.get_difficulty()}`
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log("当前主线关卡未开始")
|
||||||
|
this.btn_new_blue.visible = true
|
||||||
|
this.btn_new_white.visible = false
|
||||||
|
this.btn_go.visible = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//测试逻辑
|
//测试逻辑
|
||||||
this.btn_clean.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
this.btn_clean.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
|
||||||
console.log("btn_clean=", evt);
|
console.log("btn_clean=", evt);
|
||||||
StorageManager.getInstance().cleanAll()
|
StorageManager.getInstance().cleanAll()
|
||||||
user = StorageManager.getInstance().getUser()
|
|
||||||
this.btn_new_blue.visible = user.get_isCompletedMain()
|
|
||||||
this.btn_new_white.visible = user.get_isCompletedMain() == false
|
|
||||||
this.btn_continue.visible = user.get_isCompletedMain() == false
|
|
||||||
})
|
})
|
||||||
this.btn_clean.visible = config.DEBUG
|
this.btn_clean.visible = config.DEBUG
|
||||||
//======
|
//======
|
||||||
@@ -65,11 +126,8 @@ export class Home extends Laya.Script {
|
|||||||
var d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
var d = UIManager.getInstance().getUIRoot().addChild(prefab).getComponent(Difficulty)
|
||||||
d.onInit((value: string)=> {
|
d.onInit((value: string)=> {
|
||||||
console.log("选择难度", value)
|
console.log("选择难度", value)
|
||||||
UIManager.getInstance().closeStageUI()
|
StorageManager.getInstance().cleanMainStage()
|
||||||
|
|
||||||
StorageManager.getInstance().cleanStage(config.DEFAULT_STAGE_ID)
|
|
||||||
var user = StorageManager.getInstance().getUser()
|
var user = StorageManager.getInstance().getUser()
|
||||||
user.set_isCompletedMain(false)
|
|
||||||
var index = user.get_progress(value)
|
var index = user.get_progress(value)
|
||||||
var levelStr = LevelManager.getInstance().getLevelStr(value, index)
|
var levelStr = LevelManager.getInstance().getLevelStr(value, index)
|
||||||
if (!levelStr || levelStr.length <= 0) {//说明当前难度已经打通了,所以给他从头开始
|
if (!levelStr || levelStr.length <= 0) {//说明当前难度已经打通了,所以给他从头开始
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export class Stage extends Laya.Script {
|
|||||||
@property(Laya.Label)
|
@property(Laya.Label)
|
||||||
public label_mistake: Laya.Label;
|
public label_mistake: Laya.Label;
|
||||||
@property(Laya.Label)
|
@property(Laya.Label)
|
||||||
public label_diff: Laya.Label;
|
public label_name: Laya.Label;
|
||||||
@property(Laya.Label)
|
@property(Laya.Label)
|
||||||
public label_time: Laya.Label;
|
public label_time: Laya.Label;
|
||||||
|
|
||||||
@@ -59,8 +59,14 @@ export class Stage extends Laya.Script {
|
|||||||
onAwake(): void {
|
onAwake(): void {
|
||||||
Stage._instance = this
|
Stage._instance = this
|
||||||
this.btn_back.on(Laya.Event.CLICK, this, ()=>{
|
this.btn_back.on(Laya.Event.CLICK, this, ()=>{
|
||||||
UIManager.getInstance().loadHomeUI();
|
if (this.data.get_stageType() == config.STAGE_TYPE.MAIN) {
|
||||||
UIManager.getInstance().closeStageUI();
|
UIManager.getInstance().loadHomeUI();
|
||||||
|
UIManager.getInstance().closeStageUI();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
UIManager.getInstance().loadDCUI();
|
||||||
|
UIManager.getInstance().closeStageUI();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
for (var i=0; i<this.obj_blocks.numChildren; i++) {
|
for (var i=0; i<this.obj_blocks.numChildren; i++) {
|
||||||
var hbox = this.obj_blocks.getChildAt(i);
|
var hbox = this.obj_blocks.getChildAt(i);
|
||||||
@@ -116,7 +122,7 @@ export class Stage extends Laya.Script {
|
|||||||
this.data = doStage
|
this.data = doStage
|
||||||
|
|
||||||
this.onUpdateScore()
|
this.onUpdateScore()
|
||||||
this.label_diff.text = this.data.get_difficulty()
|
this.label_name.text = this.data.get_stageName()
|
||||||
this.onUpdateMistake()
|
this.onUpdateMistake()
|
||||||
var begin = Date.now()
|
var begin = Date.now()
|
||||||
Laya.timer.loop(1000, this, ()=>{
|
Laya.timer.loop(1000, this, ()=>{
|
||||||
@@ -143,13 +149,14 @@ export class Stage extends Laya.Script {
|
|||||||
this.onApplyBlock(this.selectedBlock)
|
this.onApplyBlock(this.selectedBlock)
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdateScore(): void {
|
onUpdateScore(): number {
|
||||||
var score = 0
|
var score = 0
|
||||||
var blocks = this.data.get_blocks()
|
var blocks = this.data.get_blocks()
|
||||||
for (var i=0; i<blocks.length; i++) {
|
for (var i=0; i<blocks.length; i++) {
|
||||||
score += blocks[i].get_score()
|
score += blocks[i].get_score()
|
||||||
}
|
}
|
||||||
this.label_score.text = `Score: ${score}`
|
this.label_score.text = `Score: ${score}`
|
||||||
|
return score
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdateMistake(): void {
|
onUpdateMistake(): void {
|
||||||
@@ -341,20 +348,28 @@ export class Stage extends Laya.Script {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var b = this.selectedBlock.setShowNumber(showNumber)
|
var b = this.selectedBlock.setShowNumber(showNumber)
|
||||||
this.onUpdateScore()
|
var score = this.onUpdateScore()
|
||||||
this.onSetBlock(this.selectedBlock, true)
|
this.onSetBlock(this.selectedBlock, true)
|
||||||
if (b) {
|
if (b) {
|
||||||
|
var user = StorageManager.getInstance().getUser()
|
||||||
|
var all = 0
|
||||||
|
var finished = 0
|
||||||
|
var blocks = this.data.get_blocks()
|
||||||
|
for (var i=0; i<blocks.length; i++) {
|
||||||
|
if (blocks[i].get_preset() == false) {
|
||||||
|
all ++
|
||||||
|
if (blocks[i].get_checked()) {
|
||||||
|
finished ++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
user.update_stage_done(this.data.get_stageID(), finished/all)//更新关卡完成进度
|
||||||
if (this.getIsComplete()) {
|
if (this.getIsComplete()) {
|
||||||
console.log("完成关卡")
|
console.log("完成关卡")
|
||||||
StorageManager.getInstance().cleanStage(this.data.get_stageID())//完成关卡清除关卡数据
|
this.data.set_score(score)
|
||||||
var user = StorageManager.getInstance().getUser()
|
if (this.data.get_stageType() == config.STAGE_TYPE.MAIN) {//主线关卡更新难度进度
|
||||||
if (this.data.get_stageType() == config.STAGE_TYPE.MAIN) {
|
|
||||||
user.set_isCompletedMain(true)
|
|
||||||
user.update_progress(this.data.get_difficulty(), this.data.get_stageIndex()+1)
|
user.update_progress(this.data.get_difficulty(), this.data.get_stageIndex()+1)
|
||||||
}
|
}
|
||||||
else if (this.data.get_stageType() == config.STAGE_TYPE.DC) {
|
|
||||||
user.add_done(this.data.get_stageID())
|
|
||||||
}
|
|
||||||
UIManager.getInstance().loadGameDoneUI()
|
UIManager.getInstance().loadGameDoneUI()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||