完善每日挑战逻辑

This commit is contained in:
2025-05-21 10:15:23 +08:00
parent 061b8bc042
commit 2e384f43e4
17 changed files with 450 additions and 158 deletions

BIN
assets/atlas/comp/left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

View File

@@ -0,0 +1,6 @@
{
"uuid": "01e2c8ef-cb3b-4633-acf1-85ae9e5e0062",
"importer": {
"textureType": 2
}
}

BIN
assets/atlas/comp/right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

View File

@@ -0,0 +1,6 @@
{
"uuid": "a40c7d39-0906-4227-8784-e7f3eebba541",
"importer": {
"textureType": 2
}
}

View File

@@ -20,6 +20,15 @@
"btn_trophy": {
"_$ref": "ft6m7zwa"
},
"icon_trophy": {
"_$ref": "e7a1ntdg"
},
"btn_left": {
"_$ref": "vy67efg7"
},
"btn_right": {
"_$ref": "55ije39v"
},
"bg_dc": {
"_$ref": "hdia0flx"
},
@@ -147,15 +156,14 @@
"y": 108,
"width": 468,
"height": 468,
"skin": "res://0a33c495-5713-4f5d-bb30-d0021966cf7e",
"useSourceSize": true,
"skin": "res://fb9b2754-ab4b-4558-8db0-f325afc06764",
"color": "#ffffff"
},
{
"_$id": "pohsc0lz",
"_$type": "Label",
"name": "label_year",
"x": 100,
"x": 133,
"y": 224,
"width": 200,
"height": 72,
@@ -170,7 +178,7 @@
"_$id": "syblrak9",
"_$type": "Label",
"name": "label_month",
"x": 100,
"x": 133,
"y": 300,
"width": 200,
"height": 72,
@@ -185,7 +193,7 @@
"_$id": "w9sm094p",
"_$type": "Box",
"name": "Box",
"x": 100,
"x": 133,
"y": 400,
"width": 213,
"height": 72,
@@ -240,6 +248,30 @@
"padding": "0,0,0,0"
}
]
},
{
"_$id": "vy67efg7",
"_$type": "Image",
"name": "btn_left",
"x": 50,
"y": 343,
"width": 21,
"height": 60,
"skin": "res://01e2c8ef-cb3b-4633-acf1-85ae9e5e0062",
"useSourceSize": true,
"color": "#ffffff"
},
{
"_$id": "55ije39v",
"_$type": "Image",
"name": "btn_right",
"x": 996,
"y": 337,
"width": 48,
"height": 97,
"skin": "res://a40c7d39-0906-4227-8784-e7f3eebba541",
"useSourceSize": true,
"color": "#ffffff"
}
]
},
@@ -307,6 +339,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -452,6 +486,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -595,6 +631,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -738,6 +776,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -881,6 +921,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -1024,6 +1066,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -1167,6 +1211,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -1321,6 +1367,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -1464,6 +1512,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -1607,6 +1657,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -1750,6 +1802,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -1893,6 +1947,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -2036,6 +2092,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -2179,6 +2237,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -2333,6 +2393,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -2476,6 +2538,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -2619,6 +2683,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -2762,6 +2828,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -2905,6 +2973,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -3048,6 +3118,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -3191,6 +3263,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -3345,6 +3419,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -3488,6 +3564,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -3631,6 +3709,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -3774,6 +3854,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -3917,6 +3999,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -4060,6 +4144,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -4203,6 +4289,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -4357,6 +4445,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -4500,6 +4590,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -4643,6 +4735,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -4786,6 +4880,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -4929,6 +5025,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -5072,6 +5170,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -5215,6 +5315,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -5369,6 +5471,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -5512,6 +5616,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -5655,6 +5761,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -5798,6 +5906,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -5941,6 +6051,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -6084,6 +6196,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,
@@ -6227,6 +6341,8 @@
{
"_$type": "04c54914-715e-4e07-8a45-770f2a2c05a6",
"scriptPath": "../src/views/CalendarUnit.ts",
"year": 0,
"month": 0,
"day": 0,
"open": false,
"progress": 0,

View File

@@ -17,6 +17,9 @@
"bg_dc": {
"_$ref": "7270vjom"
},
"icon_dc": {
"_$ref": "h6dakob0"
},
"label_dc_title": {
"_$ref": "5ubzcrtp"
},
@@ -255,8 +258,7 @@
"width": 468,
"height": 468,
"right": 0,
"skin": "res://0a33c495-5713-4f5d-bb30-d0021966cf7e",
"useSourceSize": true,
"skin": "res://bb1fa7d6-3640-46a5-aad3-b8aa0dacdd0e",
"color": "#ffffff"
}
]

View File

@@ -195,15 +195,16 @@
"_$id": "8f3q88gt",
"_$type": "Label",
"name": "label_count",
"x": 110,
"x": 108,
"y": 233,
"width": 72,
"height": 20,
"centerX": 2,
"centerX": 0,
"text": "03/20",
"fontSize": 24,
"color": "rgba(0, 0, 0, 1)",
"bold": true,
"align": "center",
"valign": "middle",
"padding": "0,0,0,0"
},
@@ -227,7 +228,7 @@
]
},
{
"_$id": "12v1zrhf",
"_$id": "5a72w6r6",
"_$type": "Box",
"name": "Box(2)",
"x": 336,
@@ -238,45 +239,46 @@
"_$type": "79064920-30a6-4b11-a82e-bbdd4112c4e1",
"scriptPath": "../src/views/TrophyUnit.ts",
"icon": {
"_$ref": "vqqolq5s"
"_$ref": "qtzrgk8b"
},
"label_count": {
"_$ref": "piu2wjzk"
"_$ref": "nejjxzap"
},
"label_month": {
"_$ref": "jvyb2bl8"
"_$ref": "kyfur82i"
}
}
],
"_$child": [
{
"_$id": "vqqolq5s",
"_$id": "qtzrgk8b",
"_$type": "Image",
"name": "icon",
"width": 289,
"width": 288,
"height": 288,
"skin": "res://bb1fa7d6-3640-46a5-aad3-b8aa0dacdd0e",
"skin": "res://7d235ac1-6755-4409-ab86-23aaf41e1537",
"useSourceSize": true,
"color": "#ffffff"
},
{
"_$id": "piu2wjzk",
"_$id": "nejjxzap",
"_$type": "Label",
"name": "label_count",
"x": 110,
"x": 108,
"y": 233,
"width": 72,
"height": 20,
"centerX": 2,
"centerX": 0,
"text": "03/20",
"fontSize": 24,
"color": "rgba(0, 0, 0, 1)",
"bold": true,
"align": "center",
"valign": "middle",
"padding": "0,0,0,0"
},
{
"_$id": "jvyb2bl8",
"_$id": "kyfur82i",
"_$type": "Label",
"name": "month",
"x": 94,
@@ -295,7 +297,7 @@
]
},
{
"_$id": "wn080pr7",
"_$id": "ou2bc7ya",
"_$type": "Box",
"name": "Box(3)",
"x": 672,
@@ -306,45 +308,46 @@
"_$type": "79064920-30a6-4b11-a82e-bbdd4112c4e1",
"scriptPath": "../src/views/TrophyUnit.ts",
"icon": {
"_$ref": "5ijlv0u5"
"_$ref": "60czvplu"
},
"label_count": {
"_$ref": "wp3kmm2v"
"_$ref": "z9p6fvm8"
},
"label_month": {
"_$ref": "up14gqcb"
"_$ref": "qt83mjyk"
}
}
],
"_$child": [
{
"_$id": "5ijlv0u5",
"_$id": "60czvplu",
"_$type": "Image",
"name": "icon",
"width": 289,
"width": 288,
"height": 288,
"skin": "res://fb9b2754-ab4b-4558-8db0-f325afc06764",
"skin": "res://7d235ac1-6755-4409-ab86-23aaf41e1537",
"useSourceSize": true,
"color": "#ffffff"
},
{
"_$id": "wp3kmm2v",
"_$id": "z9p6fvm8",
"_$type": "Label",
"name": "label_count",
"x": 110,
"x": 108,
"y": 233,
"width": 72,
"height": 20,
"centerX": 2,
"centerX": 0,
"text": "03/20",
"fontSize": 24,
"color": "rgba(0, 0, 0, 1)",
"bold": true,
"align": "center",
"valign": "middle",
"padding": "0,0,0,0"
},
{
"_$id": "up14gqcb",
"_$id": "qt83mjyk",
"_$type": "Label",
"name": "month",
"x": 94,
@@ -387,7 +390,7 @@
]
},
{
"_$id": "ovn0ouow",
"_$id": "qafamkwj",
"_$type": "Box",
"name": "Box(2)",
"y": 416,
@@ -395,7 +398,7 @@
"height": 288,
"_$child": [
{
"_$id": "0lvqvjcc",
"_$id": "pqcum5of",
"_$type": "HBox",
"name": "HBox",
"width": 960,
@@ -404,7 +407,7 @@
"align": "middle",
"_$child": [
{
"_$id": "bpnvv8bu",
"_$id": "r4wq2wm7",
"_$type": "Box",
"name": "Box(1)",
"width": 288,
@@ -414,45 +417,46 @@
"_$type": "79064920-30a6-4b11-a82e-bbdd4112c4e1",
"scriptPath": "../src/views/TrophyUnit.ts",
"icon": {
"_$ref": "5nc72uhs"
"_$ref": "f8qx50up"
},
"label_count": {
"_$ref": "roiu8xgz"
"_$ref": "sx3ojzwo"
},
"label_month": {
"_$ref": "k1vy02th"
"_$ref": "49lxnrrm"
}
}
],
"_$child": [
{
"_$id": "5nc72uhs",
"_$id": "f8qx50up",
"_$type": "Image",
"name": "icon",
"width": 289,
"width": 288,
"height": 288,
"skin": "res://3d104a8e-ef79-46c9-90ef-f0db298666b2",
"skin": "res://7d235ac1-6755-4409-ab86-23aaf41e1537",
"useSourceSize": true,
"color": "#ffffff"
},
{
"_$id": "roiu8xgz",
"_$id": "sx3ojzwo",
"_$type": "Label",
"name": "label_count",
"x": 110,
"x": 108,
"y": 233,
"width": 72,
"height": 20,
"centerX": 2,
"centerX": 0,
"text": "03/20",
"fontSize": 24,
"color": "rgba(0, 0, 0, 1)",
"bold": true,
"align": "center",
"valign": "middle",
"padding": "0,0,0,0"
},
{
"_$id": "k1vy02th",
"_$id": "49lxnrrm",
"_$type": "Label",
"name": "month",
"x": 94,
@@ -471,7 +475,7 @@
]
},
{
"_$id": "eqqlj32z",
"_$id": "fvekysyv",
"_$type": "Box",
"name": "Box(2)",
"x": 336,
@@ -482,45 +486,46 @@
"_$type": "79064920-30a6-4b11-a82e-bbdd4112c4e1",
"scriptPath": "../src/views/TrophyUnit.ts",
"icon": {
"_$ref": "eonu3pni"
"_$ref": "7er8q2x5"
},
"label_count": {
"_$ref": "dyei47qq"
"_$ref": "6vznujfd"
},
"label_month": {
"_$ref": "kqiusmti"
"_$ref": "0jjnp6zh"
}
}
],
"_$child": [
{
"_$id": "eonu3pni",
"_$id": "7er8q2x5",
"_$type": "Image",
"name": "icon",
"width": 288,
"height": 288,
"skin": "res://f84532c2-1750-4127-999b-9dd613301eb5",
"skin": "res://7d235ac1-6755-4409-ab86-23aaf41e1537",
"useSourceSize": true,
"color": "#ffffff"
},
{
"_$id": "dyei47qq",
"_$id": "6vznujfd",
"_$type": "Label",
"name": "label_count",
"x": 110,
"x": 108,
"y": 233,
"width": 72,
"height": 20,
"centerX": 2,
"centerX": 0,
"text": "03/20",
"fontSize": 24,
"color": "rgba(0, 0, 0, 1)",
"bold": true,
"align": "center",
"valign": "middle",
"padding": "0,0,0,0"
},
{
"_$id": "kqiusmti",
"_$id": "0jjnp6zh",
"_$type": "Label",
"name": "month",
"x": 94,
@@ -539,7 +544,7 @@
]
},
{
"_$id": "7v5iov33",
"_$id": "3sbxo969",
"_$type": "Box",
"name": "Box(3)",
"x": 672,
@@ -550,45 +555,46 @@
"_$type": "79064920-30a6-4b11-a82e-bbdd4112c4e1",
"scriptPath": "../src/views/TrophyUnit.ts",
"icon": {
"_$ref": "pbaarf42"
"_$ref": "xk7btt6d"
},
"label_count": {
"_$ref": "vysadw66"
"_$ref": "42lm20bs"
},
"label_month": {
"_$ref": "w2el6lze"
"_$ref": "ch29xisl"
}
}
],
"_$child": [
{
"_$id": "pbaarf42",
"_$id": "xk7btt6d",
"_$type": "Image",
"name": "icon",
"width": 288,
"height": 288,
"skin": "res://39efa94a-7d72-41e0-8970-51e3508f01f8",
"skin": "res://7d235ac1-6755-4409-ab86-23aaf41e1537",
"useSourceSize": true,
"color": "#ffffff"
},
{
"_$id": "vysadw66",
"_$id": "42lm20bs",
"_$type": "Label",
"name": "label_count",
"x": 110,
"x": 108,
"y": 233,
"width": 72,
"height": 20,
"centerX": 2,
"centerX": 0,
"text": "03/20",
"fontSize": 24,
"color": "rgba(0, 0, 0, 1)",
"bold": true,
"align": "center",
"valign": "middle",
"padding": "0,0,0,0"
},
{
"_$id": "w2el6lze",
"_$id": "ch29xisl",
"_$type": "Label",
"name": "month",
"x": 94,
@@ -609,7 +615,7 @@
]
},
{
"_$id": "3hdbfl3a",
"_$id": "fmb77cdv",
"_$type": "Sprite",
"name": "Sprite",
"y": 288,

View File

@@ -1,3 +1,4 @@
import { respath } from "./respath";
@@ -37,5 +38,20 @@ export const config = {
MONTH_ABBRS: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
MONTH_FULLNAMES: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
MONTH_LIST: [
{year: 2025, month: 1, begin: 3, dayCount: 31, icon_res: respath.trophy_01},
{year: 2025, month: 2, begin: 6, dayCount: 30, icon_res: respath.trophy_02},
{year: 2025, month: 3, begin: 6, dayCount: 31, icon_res: respath.trophy_03},
{year: 2025, month: 4, begin: 2, dayCount: 30, icon_res: respath.trophy_04},
{year: 2025, month: 5, begin: 4, dayCount: 31, icon_res: respath.trophy_05},
{year: 2025, month: 6, begin: 0, dayCount: 30, icon_res: respath.trophy_06},
{year: 2025, month: 7, begin: 2, dayCount: 31, icon_res: respath.trophy_07},
{year: 2025, month: 8, begin: 5, dayCount: 31, icon_res: respath.trophy_08},
{year: 2025, month: 9, begin: 1, dayCount: 30, icon_res: respath.trophy_01},
{year: 2025, month: 10, begin: 3, dayCount: 31, icon_res: respath.trophy_02},
{year: 2025, month: 11, begin: 6, dayCount: 30, icon_res: respath.trophy_03},
{year: 2025, month: 12, begin: 1, dayCount: 31, icon_res: respath.trophy_04},
]
}

View File

@@ -0,0 +1,3 @@
{
"uuid": "fb5508ba-9b4a-43b3-903e-1063df3deeb8"
}

View File

@@ -17,5 +17,14 @@ export const respath = {
dc_top_bg_normal: "atlas/images/img_dc_bg1.png",
dc_top_bg_day_finish: "atlas/images/img_dc_bg2.png",
dc_top_bg_month_finish: "atlas/images/img_dc_finished.png",
trophy_01: "atlas/trophys/trophy_01.png",
trophy_02: "atlas/trophys/trophy_02.png",
trophy_03: "atlas/trophys/trophy_03.png",
trophy_04: "atlas/trophys/trophy_04.png",
trophy_05: "atlas/trophys/trophy_05.png",
trophy_06: "atlas/trophys/trophy_06.png",
trophy_07: "atlas/trophys/trophy_07.png",
trophy_08: "atlas/trophys/trophy_08.png",
}

View File

@@ -1,6 +1,7 @@
import { respath } from "../constants/respath"
import { StorageManager } from "./StorageManager"
import { Stage } from "../views/Stage"
import { DailyChallenge } from "../views/DailyChallenge"
const { regClass, property } = Laya
@@ -39,7 +40,8 @@ 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)
var dc = this.getUIRoot().addChild(prefab).getComponent(DailyChallenge)
dc.loadWithMonth()
})
}

View File

@@ -4,6 +4,10 @@ const { regClass, property } = Laya;
export class CalendarUnit extends Laya.Script {
declare owner : Laya.Box;
@property(Number)
public year: number = 0;
@property(Number)
public month: number = 0;
@property(Number)
public day: number = 0;
@property(Boolean)
@@ -38,11 +42,17 @@ export class CalendarUnit extends Laya.Script {
}
public onInit(day: number, open: boolean, progress: number, label_obj: Laya.Label, handler: any, func: any): void {
this.day = day;
public onInit(label_obj: Laya.Label): void {
this.label_show = label_obj
}
public setCalendarUnit(year: number, month: number, day: number, open: boolean, progress: number, handler: any, func: any): void {
this.selected = false
this.year = year
this.month = month
this.day = day
this.open = open
this.progress = progress
this.label_show = label_obj
if (open) {
if (progress >= 1) {
this.label_show.text = ""

View File

@@ -6,8 +6,8 @@ import { LevelManager } from "../models/LevelManager";
import { UIManager } from "../models/UIManager";
import { respath } from "../constants/respath";
const { regClass, property } = Laya;
const { regClass, property } = Laya;
@regClass()
export class DailyChallenge extends Laya.Script {
declare owner : Laya.Box;
@@ -16,6 +16,12 @@ export class DailyChallenge extends Laya.Script {
public btn_back: Laya.Button
@property(Laya.Image)
public btn_trophy: Laya.Image
@property(Laya.Image)
public icon_trophy: Laya.Image
@property(Laya.Image)
public btn_left: Laya.Image
@property(Laya.Image)
public btn_right: Laya.Image
@property(Laya.Image)
public bg_dc: Laya.Image;
@@ -46,9 +52,11 @@ export class DailyChallenge extends Laya.Script {
@property(Laya.Box)
public obj_labels: Laya.Box;
private units: Array<CalendarUnit> = new Array();
private selectedUnit: CalendarUnit;
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
private selectedUnit: CalendarUnit;
private currentIndex: number
private indexMax: number
onAwake(): void {
this.btn_back.on(Laya.Event.CLICK, this, ()=>{
UIManager.getInstance().loadHomeUI()
@@ -57,64 +65,6 @@ export class DailyChallenge extends Laya.Script {
this.btn_trophy.on(Laya.Event.CLICK, this, ()=>{
UIManager.getInstance().loadTrophyUI()
})
var dayBegin = 4
var dayCount = 31
var user = StorageManager.getInstance().getUser()
var now = new Date()
var year = now.getFullYear()
var month = now.getMonth() + 1
var dayNow = new Date().getDate()
var stageID = `${year}-${month}-${dayNow}`
var starCount = user.get_doneCountBydate(year, month)
if (starCount >= dayCount) {
this.bg_dc.skin = respath.dc_top_bg_month_finish
}
else {
var progress = user.get_done(stageID)
console.log("progress >>>>>>>>>>>>>", stageID, progress)
if (progress >= 1) {
this.bg_dc.skin = respath.dc_top_bg_day_finish
}
else {
this.bg_dc.skin = respath.dc_top_bg_normal
}
}
this.label_year.text = year.toString()
this.label_month.text = config.MONTH_FULLNAMES[month-1]
this.label_star.text = `${starCount}/${dayCount}`
var day = 1
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 >= dayBegin && index < dayBegin+dayCount) {
obj.visible = true
l_obj.visible = true
var unit = obj.getComponent(CalendarUnit)
this.units.push(unit)
var stageID = `${year}-${month}-${day}`
var progress = user.get_done(stageID)
unit.onInit(day, day<=dayNow, progress, l_obj, this, this.onClickUnit)
if (day == dayNow) {
this.selectedUnit = unit
}
day ++
}
else {
obj.visible = false
l_obj.visible = false
}
}
}
this.onApplyUnit(this.selectedUnit)
this.btn_play.on(Laya.Event.CLICK, this, (evt: Laya.Event)=>{
// console.log(">>>>>>>>>>>>>>>>>>>>>>>", this.selectedUnit.day)
var now = new Date()
@@ -137,6 +87,132 @@ export class DailyChallenge extends Laya.Script {
UIManager.getInstance().loadStageUI(stageID);
this.owner.destroy()
})
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 unit = hbox.getChildAt(j).getComponent(CalendarUnit)
var l_obj = l_hbox.getChildAt(j) as Laya.Label
this.units.push(unit)
unit.onInit(l_obj)
}
}
this.indexMax = config.MONTH_LIST.length - 1
var now = new Date()
var nowYear = now.getFullYear()
var nowMonth = now.getMonth() + 1
for (var i=0; i<config.MONTH_LIST.length; i++) {
var obj = config.MONTH_LIST[i]
if (nowYear == obj.year && nowMonth == obj.month) {
this.indexMax = i;
break
}
}
this.btn_left.on(Laya.Event.CLICK, this, ()=>{
if (this.currentIndex > 0) {
this.currentIndex --
this.loadWithIndex(this.currentIndex)
}
})
this.btn_right.on(Laya.Event.CLICK, this, ()=>{
if (this.currentIndex < this.indexMax) {
this.currentIndex ++
this.loadWithIndex(this.currentIndex)
}
})
}
loadWithMonth(): void {
var now = new Date()
var nowYear = now.getFullYear()
var nowMonth = now.getMonth() + 1
this.currentIndex = 0
for (var i=0; i<config.MONTH_LIST.length; i++) {
var obj = config.MONTH_LIST[i]
if (nowYear == obj.year && nowMonth == obj.month) {
this.currentIndex = i;
break
}
}
console.log("DailyChallenge loadWithMonth >>>>>>>>>>>>>>>", nowYear, nowMonth, this.currentIndex)
this.loadWithIndex(this.currentIndex)
}
public loadWithIndex(index: number): void {
this.btn_left.visible = this.currentIndex > 0
this.btn_right.visible = this.currentIndex < this.indexMax
var info = config.MONTH_LIST[index]
var user = StorageManager.getInstance().getUser()
var now = new Date()
var nowYear = now.getFullYear()
var nowMonth = now.getMonth() + 1
var nowDay = new Date().getDate()
this.icon_trophy.skin = info.icon_res
//设置背景
var starCount = user.get_doneCountBydate(info.year, info.month)
if (starCount >= info.dayCount) {
this.bg_dc.skin = respath.dc_top_bg_month_finish
}
else {
if (info.year == nowYear && info.month == nowMonth) {//当前月份
var stageID = `${info.year}-${info.month}-${nowDay}`
var progress = user.get_done(stageID)
console.log("progress >>>>>>>>>>>>>", stageID, progress)
if (progress >= 1) {
this.bg_dc.skin = respath.dc_top_bg_day_finish
}
else {
this.bg_dc.skin = respath.dc_top_bg_normal
}
}
else {
this.bg_dc.skin = respath.dc_top_bg_normal
}
}
this.label_year.text = info.year.toString()
this.label_month.text = config.MONTH_FULLNAMES[info.month-1]
this.label_star.text = `${starCount}/${info.dayCount}`
this.selectedUnit = null
var day = 1
for (var i=0; i<this.units.length; i++) {
var unit = this.units[i]
if (i >= info.begin && i < info.begin+info.dayCount) {
unit.owner.visible = true
unit.label_show.visible = true
var open = true
if (info.year > nowYear) {
open = false
}
else if (info.year == nowYear) {
if (info.month > nowMonth) {
open = false
}
else if (info.month == nowMonth) {
if (day > nowDay) {
open = false
}
}
}
var stageID = `${info.year}-${info.month}-${day}`
var progress = user.get_done(stageID)
unit.setCalendarUnit(info.year, info.month, day, open, progress, this, this.onClickUnit)
if (info.year == nowYear && info.month == nowMonth && day == nowDay) {
this.selectedUnit = unit
}
day ++
}
else {
unit.owner.visible = false
unit.label_show.visible = false
}
}
if (this.selectedUnit == null)
this.selectedUnit = this.units[info.begin+info.dayCount-1]
this.onApplyUnit(this.selectedUnit)
}
public onApplyUnit(unit: CalendarUnit): void {
@@ -144,12 +220,8 @@ export class DailyChallenge extends Laya.Script {
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 stageID = `${unit.year}-${unit.month}-${unit.day}`
this.label_date.text = `${config.MONTH_ABBRS[unit.month-1]} ${unit.day},${unit.year}`
var user = StorageManager.getInstance().getUser()
var progress = user.get_done(stageID)
// console.log("onApplyUnit >>>>>", stageID, progress)

View File

@@ -15,6 +15,8 @@ export class Home extends Laya.Script {
@property(Laya.Image)
public bg_dc: Laya.Image;
@property(Laya.Image)
public icon_dc: Laya.Image;
@property(Laya.Label)
public label_dc_title: Laya.Label;
@property(Laya.Label)
@@ -40,15 +42,28 @@ export class Home extends Laya.Script {
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()
var stageID = `${year}-${month}-${dayNow}`
if (user.get_doneCountBydate(year, month) >= 31) {
this.bg_dc.skin = respath.home_top_dc_bg_finish
this.label_dc_title.color = "#ffffff"
this.label_dc_date.color = "#ffffff"
var nowYear = now.getFullYear()
var nowMonth = now.getMonth() + 1
var find
for (var i=0; i<config.MONTH_LIST.length; i++) {
var obj = config.MONTH_LIST[i]
if (obj.year == nowYear && obj.month == nowMonth) {
find = obj
break
}
}
if (find) {
this.icon_dc.skin = find.icon_res
if (user.get_doneCountBydate(nowYear, nowMonth) >= find.dayCount) {
this.bg_dc.skin = respath.home_top_dc_bg_finish
this.label_dc_title.color = "#ffffff"
this.label_dc_date.color = "#ffffff"
}
else {
this.bg_dc.skin = respath.home_top_dc_bg_normal
this.label_dc_title.color = "#2d3138"
this.label_dc_date.color = "#2d3138"
}
}
else {
this.bg_dc.skin = respath.home_top_dc_bg_normal
@@ -56,7 +71,9 @@ export class Home extends Laya.Script {
this.label_dc_date.color = "#2d3138"
}
this.label_dc_date.text = `${config.MONTH_ABBRS[month-1]} ${dayNow}`
var nowDay = new Date().getDate()
var stageID = `${nowYear}-${nowMonth}-${nowDay}`
this.label_dc_date.text = `${config.MONTH_ABBRS[nowMonth-1]} ${nowDay}`
var progress = user.get_done(stageID)
if (progress <= 0) {
@@ -69,7 +86,7 @@ export class Home extends Laya.Script {
var list = LevelManager.getInstance().getLevelList(value)
random = Math.random()
var index = Math.floor(random*list.length)
var stageName = `${config.MONTH_ABBRS[month-1]} ${dayNow}`
var stageName = `${config.MONTH_ABBRS[nowMonth-1]} ${nowDay}`
console.log("随机一个关卡", value, index)
StorageManager.getInstance().newStage(stageID, config.STAGE_TYPE.DC, stageName, value, index)
UIManager.getInstance().loadStageUI(stageID);

View File

@@ -1,6 +1,7 @@
import { config } from "../constants/config";
import { TrophyUnit } from "./TrophyUnit";
const { regClass, property } = Laya;
@@ -23,14 +24,32 @@ export class TrophyRoom extends Laya.Script {
this.owner.destroy()
})
var month = 5
var list: Array<any> = new Array()
var now = new Date()
var nowYear = now.getFullYear()
var nowMonth = now.getMonth() + 1
for (var i=0; i<config.MONTH_LIST.length; i++) {
var obj = config.MONTH_LIST[i]
list.push(obj)
if (obj.year == nowYear && obj.month == nowMonth) {
break
}
}
list.reverse()
var index = -1
for (var i=0; i<this.obj_items.numChildren; i++) {
var hbox = this.obj_items.getChildAt(i).getChildByName("HBox")
for (var j=0; j<hbox.numChildren; j++) {
var obj = hbox.getChildAt(j).getComponent(TrophyUnit)
this.items.push(obj)
obj.onInit(2025, month)
month ++
var unit = hbox.getChildAt(j).getComponent(TrophyUnit)
index ++
if (index < list.length) {
unit.owner.visible = true
unit.onInit(list[index])
}
else {
unit.owner.visible = false
}
}
}
}

View File

@@ -14,11 +14,19 @@ export class TrophyUnit extends Laya.Script {
@property(Laya.Label)
public label_month: Laya.Label;
public onInit(year: number, month: number): void {
public onInit(info: any): void {
var user = StorageManager.getInstance().getUser()
var starCount = user.get_doneCountBydate(year, month)
this.label_count.text = `${starCount}/31`
this.label_month.text = config.MONTH_ABBRS[month-1]
var starCount = user.get_doneCountBydate(info.year, info.month)
this.icon.skin = info.icon_res
this.label_count.text = `${starCount}/${info.dayCount}`
this.label_month.text = config.MONTH_ABBRS[info.month-1]
if (starCount >= info.dayCount) {
this.icon.gray = false
this.label_month.color = "#2d3138"
}
else {
this.icon.gray = true
this.label_month.color = "#a7abb3"
}
}
}