add trophy logic
This commit is contained in:
@@ -20,6 +20,9 @@
|
||||
"btn_trophy": {
|
||||
"_$ref": "ft6m7zwa"
|
||||
},
|
||||
"btn_trophy_red": {
|
||||
"_$ref": "zx15vggp"
|
||||
},
|
||||
"icon_trophy": {
|
||||
"_$ref": "e7a1ntdg"
|
||||
},
|
||||
@@ -146,7 +149,30 @@
|
||||
"height": 75,
|
||||
"skin": "res://4458c7de-47ff-496e-a28f-be808c0823b3",
|
||||
"useSourceSize": true,
|
||||
"color": "#ffffff"
|
||||
"color": "#ffffff",
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "zx15vggp",
|
||||
"_$type": "Sprite",
|
||||
"name": "Sprite",
|
||||
"x": 64,
|
||||
"y": -4,
|
||||
"width": 24,
|
||||
"height": 24,
|
||||
"_gcmds": [
|
||||
{
|
||||
"_$type": "DrawCircleCmd",
|
||||
"x": 0.5,
|
||||
"y": 0.5,
|
||||
"radius": 0.5,
|
||||
"percent": true,
|
||||
"lineWidth": 4,
|
||||
"lineColor": "rgba(255, 255, 255, 1)",
|
||||
"fillColor": "rgba(229, 34, 28, 1)"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"_$id": "e7a1ntdg",
|
||||
|
||||
169
assets/resources/TrophyClaim.lh
Normal file
169
assets/resources/TrophyClaim.lh
Normal file
@@ -0,0 +1,169 @@
|
||||
{
|
||||
"_$ver": 1,
|
||||
"_$id": "6l8gfnd1",
|
||||
"_$type": "Box",
|
||||
"name": "TrophyClaim",
|
||||
"width": 1080,
|
||||
"height": 1920,
|
||||
"left": 0,
|
||||
"right": 0,
|
||||
"top": 0,
|
||||
"bottom": 0,
|
||||
"_$comp": [
|
||||
{
|
||||
"_$type": "0550b681-b602-49fe-900f-e30866ce922c",
|
||||
"scriptPath": "../src/views/TrophyClaim.ts",
|
||||
"icon": {
|
||||
"_$ref": "ta6ji66s"
|
||||
},
|
||||
"label_date": {
|
||||
"_$ref": "a0u7wsik"
|
||||
},
|
||||
"btn_close": {
|
||||
"_$ref": "qgwt28k7"
|
||||
}
|
||||
}
|
||||
],
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "l3kqo0ly",
|
||||
"_$type": "Image",
|
||||
"name": "Image",
|
||||
"width": 1080,
|
||||
"height": 1920,
|
||||
"alpha": 0.8,
|
||||
"left": 0,
|
||||
"right": 0,
|
||||
"top": 0,
|
||||
"bottom": 0,
|
||||
"skin": "res://a98f334e-ce04-4cd0-8fc5-bbdf9b048609",
|
||||
"color": "#000000"
|
||||
},
|
||||
{
|
||||
"_$id": "21y8h6ei",
|
||||
"_$type": "Box",
|
||||
"name": "center",
|
||||
"y": 264,
|
||||
"width": 1080,
|
||||
"height": 1080,
|
||||
"centerX": 0,
|
||||
"centerY": -156,
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "vngawy58",
|
||||
"_$type": "Image",
|
||||
"name": "img_light_yellow",
|
||||
"width": 1080,
|
||||
"height": 1080,
|
||||
"centerX": 0,
|
||||
"centerY": 0,
|
||||
"skin": "res://0403c03d-0fbb-4930-8cf7-c4bf0f4d45b9",
|
||||
"useSourceSize": true,
|
||||
"color": "#ffffff"
|
||||
},
|
||||
{
|
||||
"_$id": "ta6ji66s",
|
||||
"_$type": "Image",
|
||||
"name": "trophy",
|
||||
"x": 123,
|
||||
"y": 123,
|
||||
"width": 834,
|
||||
"height": 834,
|
||||
"centerX": 0,
|
||||
"centerY": 0,
|
||||
"skin": "res://7d235ac1-6755-4409-ab86-23aaf41e1537",
|
||||
"color": "#ffffff"
|
||||
},
|
||||
{
|
||||
"_$id": "qgwt28k7",
|
||||
"_$type": "Box",
|
||||
"name": "btn_close",
|
||||
"x": 180,
|
||||
"y": 1140,
|
||||
"width": 720,
|
||||
"height": 156,
|
||||
"bottom": -216,
|
||||
"centerX": 0,
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "y8abda90",
|
||||
"_$type": "Sprite",
|
||||
"name": "Sprite",
|
||||
"width": 720,
|
||||
"height": 156,
|
||||
"mouseThrough": true,
|
||||
"_gcmds": [
|
||||
{
|
||||
"_$type": "DrawRoundRectCmd",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"lt": 20,
|
||||
"rt": 20,
|
||||
"lb": 20,
|
||||
"rb": 20,
|
||||
"percent": true,
|
||||
"lineWidth": 1,
|
||||
"fillColor": "#FFFFFF"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"_$id": "6v9udrtu",
|
||||
"_$type": "Label",
|
||||
"name": "label",
|
||||
"x": -90,
|
||||
"y": 28,
|
||||
"width": 900,
|
||||
"height": 100,
|
||||
"centerX": 0,
|
||||
"centerY": 0,
|
||||
"text": "Claim",
|
||||
"fontSize": 60,
|
||||
"color": "rgba(29, 92, 220, 1)",
|
||||
"align": "center",
|
||||
"valign": "middle",
|
||||
"padding": "0,0,0,0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"_$id": "0eaixmbm",
|
||||
"_$type": "Label",
|
||||
"name": "titlle",
|
||||
"x": 90,
|
||||
"y": -10,
|
||||
"width": 900,
|
||||
"height": 100,
|
||||
"top": -10,
|
||||
"centerX": 0,
|
||||
"text": "Conratulations!",
|
||||
"fontSize": 84,
|
||||
"color": "#FFFFFF",
|
||||
"align": "center",
|
||||
"valign": "middle",
|
||||
"padding": "0,0,0,0"
|
||||
},
|
||||
{
|
||||
"_$id": "a0u7wsik",
|
||||
"_$type": "Label",
|
||||
"name": "label_date",
|
||||
"x": 90,
|
||||
"y": 1010,
|
||||
"width": 900,
|
||||
"height": 60,
|
||||
"alpha": 0.8,
|
||||
"bottom": 10,
|
||||
"centerX": 0,
|
||||
"text": "Sep 11, 2024",
|
||||
"fontSize": 60,
|
||||
"color": "#FFFFFF",
|
||||
"align": "center",
|
||||
"valign": "middle",
|
||||
"padding": "0,0,0,0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
3
assets/resources/TrophyClaim.lh.meta
Normal file
3
assets/resources/TrophyClaim.lh.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"uuid": "b12ed6b6-072b-4dd9-ab6f-c544692a6422"
|
||||
}
|
||||
@@ -104,8 +104,8 @@
|
||||
"align": "center",
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "0cxaz0lv",
|
||||
"_$prefab": "381b129b-cb47-4a77-805d-6d4637bc67b8",
|
||||
"_$id": "g7t27k1h",
|
||||
"_$prefab": "ef797791-e197-4854-bf49-347fe92999f4",
|
||||
"name": "TrophyRoomYear",
|
||||
"active": true,
|
||||
"x": 0,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"_$ver": 1,
|
||||
"_$id": "qayij6fq",
|
||||
"_$id": "42qxmdwy",
|
||||
"_$type": "VBox",
|
||||
"name": "TrophyRoomCell",
|
||||
"y": 120,
|
||||
@@ -10,16 +10,16 @@
|
||||
"align": "center",
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "edutm8p9",
|
||||
"_$id": "od2un0s9",
|
||||
"_$type": "HBox",
|
||||
"name": "HBox",
|
||||
"width": 984,
|
||||
"height": 288,
|
||||
"space": 48,
|
||||
"space": 0,
|
||||
"align": "middle",
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "npywocl2",
|
||||
"_$id": "t4qzx693",
|
||||
"_$type": "Box",
|
||||
"name": "Box(1)",
|
||||
"width": 328,
|
||||
@@ -29,22 +29,22 @@
|
||||
"_$type": "79064920-30a6-4b11-a82e-bbdd4112c4e1",
|
||||
"scriptPath": "../src/views/TrophyUnit.ts",
|
||||
"bg_light": {
|
||||
"_$ref": "7a93ikng"
|
||||
"_$ref": "rnanoiet"
|
||||
},
|
||||
"icon": {
|
||||
"_$ref": "232cncr7"
|
||||
"_$ref": "cnlfb8yz"
|
||||
},
|
||||
"label_count": {
|
||||
"_$ref": "jafwv0lk"
|
||||
"_$ref": "2bldvkij"
|
||||
},
|
||||
"label_month": {
|
||||
"_$ref": "5ifvmsv6"
|
||||
"_$ref": "5wwqja5x"
|
||||
}
|
||||
}
|
||||
],
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "7a93ikng",
|
||||
"_$id": "rnanoiet",
|
||||
"_$type": "Image",
|
||||
"name": "bg_light",
|
||||
"x": 20,
|
||||
@@ -55,7 +55,7 @@
|
||||
"color": "#ffffff"
|
||||
},
|
||||
{
|
||||
"_$id": "232cncr7",
|
||||
"_$id": "cnlfb8yz",
|
||||
"_$type": "Image",
|
||||
"name": "icon",
|
||||
"x": 20,
|
||||
@@ -63,15 +63,14 @@
|
||||
"height": 288,
|
||||
"centerX": 0,
|
||||
"skin": "res://7d235ac1-6755-4409-ab86-23aaf41e1537",
|
||||
"useSourceSize": true,
|
||||
"color": "#ffffff"
|
||||
},
|
||||
{
|
||||
"_$id": "jafwv0lk",
|
||||
"_$id": "2bldvkij",
|
||||
"_$type": "Label",
|
||||
"name": "label_count",
|
||||
"x": 128,
|
||||
"y": 233,
|
||||
"y": 234,
|
||||
"width": 72,
|
||||
"height": 20,
|
||||
"centerX": 0,
|
||||
@@ -84,7 +83,7 @@
|
||||
"padding": "0,0,0,0"
|
||||
},
|
||||
{
|
||||
"_$id": "5ifvmsv6",
|
||||
"_$id": "5wwqja5x",
|
||||
"_$type": "Label",
|
||||
"name": "month",
|
||||
"x": 114,
|
||||
@@ -103,56 +102,59 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"_$id": "h293u30o",
|
||||
"_$id": "u3azxf82",
|
||||
"_$type": "Box",
|
||||
"name": "Box(2)",
|
||||
"x": 376,
|
||||
"width": 288,
|
||||
"x": 328,
|
||||
"width": 328,
|
||||
"height": 288,
|
||||
"_$comp": [
|
||||
{
|
||||
"_$type": "79064920-30a6-4b11-a82e-bbdd4112c4e1",
|
||||
"scriptPath": "../src/views/TrophyUnit.ts",
|
||||
"bg_light": {
|
||||
"_$ref": "tsk96lzw"
|
||||
"_$ref": "tnjynmgf"
|
||||
},
|
||||
"icon": {
|
||||
"_$ref": "vnxa59lv"
|
||||
"_$ref": "0qe74n99"
|
||||
},
|
||||
"label_count": {
|
||||
"_$ref": "3matj08s"
|
||||
"_$ref": "9dsn53bb"
|
||||
},
|
||||
"label_month": {
|
||||
"_$ref": "z4msejq5"
|
||||
"_$ref": "zse8y0wo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "tsk96lzw",
|
||||
"_$id": "tnjynmgf",
|
||||
"_$type": "Image",
|
||||
"name": "bg_light",
|
||||
"x": 20,
|
||||
"width": 288,
|
||||
"height": 288,
|
||||
"centerX": 0,
|
||||
"skin": "res://d0c3b007-6036-460a-b23d-09d6f2492886",
|
||||
"color": "#ffffff"
|
||||
},
|
||||
{
|
||||
"_$id": "vnxa59lv",
|
||||
"_$id": "0qe74n99",
|
||||
"_$type": "Image",
|
||||
"name": "icon",
|
||||
"x": 20,
|
||||
"width": 288,
|
||||
"height": 288,
|
||||
"centerX": 0,
|
||||
"skin": "res://7d235ac1-6755-4409-ab86-23aaf41e1537",
|
||||
"useSourceSize": true,
|
||||
"color": "#ffffff"
|
||||
},
|
||||
{
|
||||
"_$id": "3matj08s",
|
||||
"_$id": "9dsn53bb",
|
||||
"_$type": "Label",
|
||||
"name": "label_count",
|
||||
"x": 108,
|
||||
"y": 233,
|
||||
"x": 128,
|
||||
"y": 234,
|
||||
"width": 72,
|
||||
"height": 20,
|
||||
"centerX": 0,
|
||||
@@ -165,10 +167,10 @@
|
||||
"padding": "0,0,0,0"
|
||||
},
|
||||
{
|
||||
"_$id": "z4msejq5",
|
||||
"_$id": "zse8y0wo",
|
||||
"_$type": "Label",
|
||||
"name": "month",
|
||||
"x": 94,
|
||||
"x": 114,
|
||||
"y": 334,
|
||||
"width": 100,
|
||||
"height": 60,
|
||||
@@ -184,56 +186,59 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"_$id": "g7w60s1c",
|
||||
"_$id": "wle8hrmr",
|
||||
"_$type": "Box",
|
||||
"name": "Box(3)",
|
||||
"x": 712,
|
||||
"width": 288,
|
||||
"x": 656,
|
||||
"width": 328,
|
||||
"height": 288,
|
||||
"_$comp": [
|
||||
{
|
||||
"_$type": "79064920-30a6-4b11-a82e-bbdd4112c4e1",
|
||||
"scriptPath": "../src/views/TrophyUnit.ts",
|
||||
"bg_light": {
|
||||
"_$ref": "ka2embmi"
|
||||
"_$ref": "o57stpd9"
|
||||
},
|
||||
"icon": {
|
||||
"_$ref": "d1fdbz6w"
|
||||
"_$ref": "en1ghf80"
|
||||
},
|
||||
"label_count": {
|
||||
"_$ref": "6rod3nlm"
|
||||
"_$ref": "1znenn3j"
|
||||
},
|
||||
"label_month": {
|
||||
"_$ref": "tmao7m9v"
|
||||
"_$ref": "row347fk"
|
||||
}
|
||||
}
|
||||
],
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "ka2embmi",
|
||||
"_$id": "o57stpd9",
|
||||
"_$type": "Image",
|
||||
"name": "bg_light",
|
||||
"x": 20,
|
||||
"width": 288,
|
||||
"height": 288,
|
||||
"centerX": 0,
|
||||
"skin": "res://d0c3b007-6036-460a-b23d-09d6f2492886",
|
||||
"color": "#ffffff"
|
||||
},
|
||||
{
|
||||
"_$id": "d1fdbz6w",
|
||||
"_$id": "en1ghf80",
|
||||
"_$type": "Image",
|
||||
"name": "icon",
|
||||
"x": 20,
|
||||
"width": 288,
|
||||
"height": 288,
|
||||
"centerX": 0,
|
||||
"skin": "res://7d235ac1-6755-4409-ab86-23aaf41e1537",
|
||||
"useSourceSize": true,
|
||||
"color": "#ffffff"
|
||||
},
|
||||
{
|
||||
"_$id": "6rod3nlm",
|
||||
"_$id": "1znenn3j",
|
||||
"_$type": "Label",
|
||||
"name": "label_count",
|
||||
"x": 108,
|
||||
"y": 233,
|
||||
"x": 128,
|
||||
"y": 234,
|
||||
"width": 72,
|
||||
"height": 20,
|
||||
"centerX": 0,
|
||||
@@ -246,10 +251,10 @@
|
||||
"padding": "0,0,0,0"
|
||||
},
|
||||
{
|
||||
"_$id": "tmao7m9v",
|
||||
"_$id": "row347fk",
|
||||
"_$type": "Label",
|
||||
"name": "month",
|
||||
"x": 94,
|
||||
"x": 114,
|
||||
"y": 334,
|
||||
"width": 100,
|
||||
"height": 60,
|
||||
@@ -267,7 +272,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"_$id": "btspwass",
|
||||
"_$id": "so760lhs",
|
||||
"_$type": "Sprite",
|
||||
"name": "Sprite",
|
||||
"x": 12,
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"uuid": "c4bc91b4-43cc-4655-b508-946a63b6534f"
|
||||
"uuid": "770e3b0c-7e51-4656-9a08-46992057f0a2"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"_$ver": 1,
|
||||
"_$id": "4d6d3tpb",
|
||||
"_$id": "0cxaz0lv",
|
||||
"_$type": "VBox",
|
||||
"name": "TrophyRoomYear",
|
||||
"width": 984,
|
||||
@@ -9,14 +9,14 @@
|
||||
"align": "center",
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "ijq66j2p",
|
||||
"_$id": "kq3dv2lv",
|
||||
"_$type": "Box",
|
||||
"name": "year",
|
||||
"width": 984,
|
||||
"height": 120,
|
||||
"_$child": [
|
||||
{
|
||||
"_$id": "5y2etcc5",
|
||||
"_$id": "4v0nfps1",
|
||||
"_$type": "Sprite",
|
||||
"name": "Sprite",
|
||||
"y": 24,
|
||||
@@ -40,10 +40,10 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"_$id": "fkmnbowd",
|
||||
"_$id": "i7ttmqwh",
|
||||
"_$type": "Label",
|
||||
"name": "Label",
|
||||
"y": 48,
|
||||
"y": 24,
|
||||
"width": 984,
|
||||
"height": 72,
|
||||
"centerX": 0,
|
||||
@@ -58,8 +58,8 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"_$id": "6j7wol13",
|
||||
"_$prefab": "c4bc91b4-43cc-4655-b508-946a63b6534f",
|
||||
"_$id": "qn7hlno1",
|
||||
"_$prefab": "770e3b0c-7e51-4656-9a08-46992057f0a2",
|
||||
"name": "TrophyRoomCell",
|
||||
"active": true,
|
||||
"x": 0,
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"uuid": "381b129b-cb47-4a77-805d-6d4637bc67b8"
|
||||
"uuid": "ef797791-e197-4854-bf49-347fe92999f4"
|
||||
}
|
||||
@@ -19,6 +19,7 @@ export class Main extends Laya.Script {
|
||||
}
|
||||
|
||||
onLateUpdate(): void {
|
||||
StorageManager.getInstance().saveUser()
|
||||
StorageManager.getInstance().saveStage()
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import { respath } from "./respath";
|
||||
|
||||
|
||||
|
||||
@@ -38,21 +37,7 @@ 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: 2024, month: 12, begin: 0, dayCount: 31, icon_res: respath.trophy_12},
|
||||
{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_09},
|
||||
{year: 2025, month: 10, begin: 3, dayCount: 31, icon_res: respath.trophy_10},
|
||||
{year: 2025, month: 11, begin: 6, dayCount: 30, icon_res: respath.trophy_11},
|
||||
{year: 2025, month: 12, begin: 1, dayCount: 31, icon_res: respath.trophy_12},
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
export const respath = {
|
||||
home_ui_res: "resources/Home.lh",
|
||||
dc_ui_res: "resources/DailyChallenge.lh",
|
||||
trophy_claim_ui_res: "resources/TrophyClaim.lh",
|
||||
trophy_show_ui_res: "resources/TrophyShow.lh",
|
||||
trophy_ui_res: "resources/TrophyRoom.lh",
|
||||
trophy_year_ui_res: "resources/TrophyRoomYear.lh",
|
||||
trophy_cell_ui_res: "resources/TrophyRoomCell.lh",
|
||||
|
||||
59
src/models/DCManager.ts
Normal file
59
src/models/DCManager.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
|
||||
|
||||
|
||||
import { respath } from "../constants/respath"
|
||||
|
||||
|
||||
export const MONTH_LIST = [
|
||||
{year: 2024, month: 12, begin: 0, dayCount: 31, icon_res: respath.trophy_12},
|
||||
|
||||
{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_09},
|
||||
{year: 2025, month: 10, begin: 3, dayCount: 31, icon_res: respath.trophy_10},
|
||||
{year: 2025, month: 11, begin: 6, dayCount: 30, icon_res: respath.trophy_11},
|
||||
{year: 2025, month: 12, begin: 1, dayCount: 31, icon_res: respath.trophy_12},
|
||||
|
||||
{year: 2026, month: 1, begin: 4, dayCount: 31, icon_res: respath.trophy_01},
|
||||
{year: 2026, month: 2, begin: 0, dayCount: 30, icon_res: respath.trophy_02},
|
||||
{year: 2026, month: 3, begin: 0, dayCount: 31, icon_res: respath.trophy_03},
|
||||
{year: 2026, month: 4, begin: 3, dayCount: 30, icon_res: respath.trophy_04},
|
||||
{year: 2026, month: 5, begin: 5, dayCount: 31, icon_res: respath.trophy_05},
|
||||
{year: 2026, month: 6, begin: 1, dayCount: 30, icon_res: respath.trophy_06},
|
||||
{year: 2026, month: 7, begin: 3, dayCount: 31, icon_res: respath.trophy_07},
|
||||
{year: 2026, month: 8, begin: 6, dayCount: 31, icon_res: respath.trophy_08},
|
||||
{year: 2026, month: 9, begin: 2, dayCount: 30, icon_res: respath.trophy_09},
|
||||
{year: 2026, month: 10, begin: 4, dayCount: 31, icon_res: respath.trophy_10},
|
||||
{year: 2026, month: 11, begin: 0, dayCount: 30, icon_res: respath.trophy_11},
|
||||
{year: 2026, month: 12, begin: 2, dayCount: 31, icon_res: respath.trophy_12},
|
||||
]
|
||||
|
||||
|
||||
export function G_getMonthInfo(year: number, month: number): any {
|
||||
for (var i=0; i<MONTH_LIST.length; i++) {
|
||||
var obj = MONTH_LIST[i]
|
||||
if (obj.year == year && obj.month == month) {
|
||||
return obj
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export class DCManager {
|
||||
|
||||
private static instance: DCManager
|
||||
public static getInstance(): DCManager {
|
||||
if (!DCManager.instance) {
|
||||
DCManager.instance = new DCManager()
|
||||
}
|
||||
return DCManager.instance
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
3
src/models/DCManager.ts.meta
Normal file
3
src/models/DCManager.ts.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"uuid": "261c816d-1904-4442-9934-b0d91044ca02"
|
||||
}
|
||||
@@ -31,7 +31,7 @@ export class DOBlock {
|
||||
this.checked = show == this.get_correct()
|
||||
if (this.checked == false)
|
||||
this.set_score(0)
|
||||
StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onStageChanged()
|
||||
}
|
||||
|
||||
public get_score(): number {
|
||||
@@ -39,7 +39,7 @@ export class DOBlock {
|
||||
}
|
||||
public set_score(score: number): void {
|
||||
this.data.score = score
|
||||
StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onStageChanged()
|
||||
}
|
||||
|
||||
public get_notes(): Array<number> {
|
||||
@@ -48,20 +48,20 @@ export class DOBlock {
|
||||
public add_note(noteNumber: number): void {
|
||||
if (this.data.notes.indexOf(noteNumber) < 0) {
|
||||
this.data.notes.push(noteNumber)
|
||||
StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onStageChanged()
|
||||
}
|
||||
}
|
||||
public remove_note(noteNumber: number): void {
|
||||
var find = this.data.notes.indexOf(noteNumber)
|
||||
if (find >= 0) {
|
||||
this.data.notes.splice(find, 1)
|
||||
StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onStageChanged()
|
||||
}
|
||||
}
|
||||
public clean_notes(): void {
|
||||
if (this.data.notes.length > 0) {
|
||||
this.data.notes = new Array()
|
||||
StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onStageChanged()
|
||||
}
|
||||
}
|
||||
//====================================持久化数据
|
||||
|
||||
@@ -107,7 +107,7 @@ export class DOStage {
|
||||
}
|
||||
public set_mistake(mistake: number): void {
|
||||
this.data.mistake = mistake
|
||||
StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onStageChanged()
|
||||
}
|
||||
|
||||
public get_score(): number {
|
||||
@@ -115,7 +115,7 @@ export class DOStage {
|
||||
}
|
||||
public set_score(score: number): void {
|
||||
this.data.score = score
|
||||
StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onStageChanged()
|
||||
}
|
||||
|
||||
public get_duration(): number {
|
||||
@@ -123,7 +123,7 @@ export class DOStage {
|
||||
}
|
||||
public set_duration(duration: number): void {//关卡计时
|
||||
this.data.duration = duration
|
||||
StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onStageChanged()
|
||||
}
|
||||
|
||||
public get_note_open(): boolean {
|
||||
@@ -131,7 +131,7 @@ export class DOStage {
|
||||
}
|
||||
public set_note_open(note_open: boolean): void {
|
||||
this.data.note_open = note_open
|
||||
StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onStageChanged()
|
||||
}
|
||||
|
||||
public get_select_index(): number {
|
||||
@@ -139,7 +139,7 @@ export class DOStage {
|
||||
}
|
||||
public set_select_index(select_index: number): void {//当前选中
|
||||
this.data.select_index = select_index
|
||||
StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onStageChanged()
|
||||
}
|
||||
|
||||
public get_hint(): number {
|
||||
@@ -147,7 +147,7 @@ export class DOStage {
|
||||
}
|
||||
public set_hint(hint: number): void {//提示
|
||||
this.data.hint = hint
|
||||
StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onStageChanged()
|
||||
}
|
||||
|
||||
public get_undos(): Array<DataUndo> {
|
||||
@@ -163,14 +163,14 @@ export class DOStage {
|
||||
var dataUndo: DataUndo = {index: index, show: show, notes: _notes}
|
||||
console.log("add_undo >>>>>>>>>>>>>>>>>>>>>>>>>>>>", JSON.stringify(dataUndo))
|
||||
this.data.undos.push(dataUndo)
|
||||
StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onStageChanged()
|
||||
}
|
||||
public pop_undo(): DataUndo {
|
||||
var dataUndo: DataUndo
|
||||
if (this.data.undos.length > 0) {
|
||||
dataUndo = this.data.undos[this.data.undos.length-1]
|
||||
this.data.undos.splice(this.data.undos.length-1, 1)
|
||||
StorageManager.getInstance().onChanged()
|
||||
StorageManager.getInstance().onStageChanged()
|
||||
}
|
||||
return dataUndo
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DataProgress, DataUser, StageProgress } from "../types/global";
|
||||
import { DataProgress, DataUser, StageProgress, TrophyRecord } from "../types/global";
|
||||
import { StorageManager } from "./StorageManager"
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export class DOUser {
|
||||
}
|
||||
return 0
|
||||
}
|
||||
public get_doneCountBydate(year: number, month: number): number {
|
||||
public get_doneCountByDate(year: number, month: number): number {
|
||||
var count = 0
|
||||
var key = `${year}-${month}`
|
||||
this.mapDones.forEach((progres: number, stageID: string)=>{
|
||||
@@ -35,6 +35,16 @@ export class DOUser {
|
||||
})
|
||||
return count
|
||||
}
|
||||
public get_isAllDoneByDate(year: number, month: number): boolean {
|
||||
var boolean = true
|
||||
var key = `${year}-${month}`
|
||||
this.mapDones.forEach((progres: number, stageID: string)=>{
|
||||
if (stageID.startsWith(key) && progres < 1) {
|
||||
boolean = false
|
||||
}
|
||||
})
|
||||
return boolean
|
||||
}
|
||||
public update_stage_done(stageID: string, progress: number): void {
|
||||
var find: StageProgress
|
||||
for (var i=0; i<this.data.dones.length; i++) {
|
||||
@@ -52,9 +62,78 @@ export class DOUser {
|
||||
this.data.dones.push(find)
|
||||
}
|
||||
this.mapDones.set(find.stageID, find.progress)
|
||||
StorageManager.getInstance().saveUser()
|
||||
StorageManager.getInstance().onUserChanged()
|
||||
}
|
||||
|
||||
//================奖杯获得记录
|
||||
public get_trophyRecord(year: number, month: number): TrophyRecord {
|
||||
var find: TrophyRecord
|
||||
for (var i=0; i<this.data.trophy_records.length; i++) {
|
||||
var obj = this.data.trophy_records[i]
|
||||
if (obj.year == year && obj.month == month) {
|
||||
find = obj
|
||||
break
|
||||
}
|
||||
}
|
||||
return find
|
||||
}
|
||||
public get_trophyHasNew(): TrophyRecord {
|
||||
var find: TrophyRecord
|
||||
for (var i=0; i<this.data.trophy_records.length; i++) {
|
||||
var obj = this.data.trophy_records[i]
|
||||
if (obj.isNew) {
|
||||
find = obj
|
||||
break
|
||||
}
|
||||
}
|
||||
return find
|
||||
}
|
||||
public set_trophyNew(record: TrophyRecord, isNew: boolean): void {
|
||||
if (record.isNew != isNew) {
|
||||
record.isNew = isNew
|
||||
StorageManager.getInstance().onUserChanged()
|
||||
}
|
||||
}
|
||||
public get_trophyHasUnread(): boolean {
|
||||
var unread = false
|
||||
for (var i=0; i<this.data.trophy_records.length; i++) {
|
||||
var obj = this.data.trophy_records[i]
|
||||
if (obj.read == false) {
|
||||
unread = true
|
||||
break
|
||||
}
|
||||
}
|
||||
return unread
|
||||
}
|
||||
public set_trophyAllread(): void {
|
||||
var changed = false
|
||||
for (var i=0; i<this.data.trophy_records.length; i++) {
|
||||
var obj = this.data.trophy_records[i]
|
||||
if (obj.read == false) {
|
||||
obj.read = true
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
StorageManager.getInstance().onUserChanged()
|
||||
}
|
||||
}
|
||||
public add_trophy_record(year: number, month: number, day: number): void {
|
||||
var find
|
||||
for (var i=0; i<this.data.trophy_records.length; i++) {
|
||||
var obj = this.data.trophy_records[i]
|
||||
if (obj.year == year && obj.month == month) {
|
||||
find = obj
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!find) {
|
||||
this.data.trophy_records.push({year: year, month: month, day: day, isNew: true, read: false})
|
||||
StorageManager.getInstance().onUserChanged()
|
||||
}
|
||||
}
|
||||
|
||||
//=======关卡难度进度
|
||||
public get_progress(difficulty: string): number {
|
||||
var find: DataProgress
|
||||
for (var i=0; i<this.data.progresses.length; i++) {
|
||||
@@ -85,7 +164,7 @@ export class DOUser {
|
||||
find = {difficulty: difficulty, index: index}
|
||||
this.data.progresses.push(find)
|
||||
}
|
||||
StorageManager.getInstance().saveUser()
|
||||
StorageManager.getInstance().onUserChanged()
|
||||
}
|
||||
|
||||
//====================================持久化数据
|
||||
|
||||
@@ -17,6 +17,7 @@ export class StorageManager {
|
||||
}
|
||||
|
||||
private user: DOUser;
|
||||
private userChanged = false
|
||||
|
||||
private stageID: string = "";
|
||||
private stageChanged = false
|
||||
@@ -30,9 +31,11 @@ export class StorageManager {
|
||||
this.user = new DOUser(JSON.parse(jsonStr))
|
||||
}
|
||||
else {
|
||||
this.user = new DOUser({dones: new Array(), progresses: new Array()})
|
||||
this.user = new DOUser({dones: new Array(), trophy_records: new Array(), progresses: new Array()})
|
||||
}
|
||||
}
|
||||
this.userChanged = false
|
||||
|
||||
this.stageID = ""
|
||||
this.stageChanged = false
|
||||
}
|
||||
@@ -42,12 +45,17 @@ export class StorageManager {
|
||||
return this.user
|
||||
}
|
||||
public saveUser(): void {
|
||||
if (this.user) {
|
||||
var jsonStr = JSON.stringify(this.user.getData())
|
||||
Laya.LocalStorage.setItem("user", jsonStr)
|
||||
if (this.userChanged) {
|
||||
this.userChanged = false
|
||||
if (this.user) {
|
||||
var jsonStr = JSON.stringify(this.user.getData())
|
||||
Laya.LocalStorage.setItem("user", jsonStr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public onUserChanged(): void {
|
||||
this.userChanged = true
|
||||
}
|
||||
|
||||
public newStage(stageID: string, type: number, name: string, difficulty: string, index: number): DOStage {
|
||||
this.stageID = stageID
|
||||
@@ -104,13 +112,14 @@ export class StorageManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
public onChanged(): void {
|
||||
public onStageChanged(): void {
|
||||
this.stageChanged = true
|
||||
}
|
||||
|
||||
|
||||
public cleanAll(): void {
|
||||
this.user = new DOUser({dones: new Array(), progresses: new Array()})
|
||||
this.user = new DOUser({dones: new Array(), trophy_records: new Array(), progresses: new Array()})
|
||||
this.userChanged = false
|
||||
|
||||
this.stageID = ""
|
||||
this.stageChanged = false
|
||||
|
||||
@@ -2,6 +2,9 @@ import { respath } from "../constants/respath"
|
||||
import { StorageManager } from "./StorageManager"
|
||||
import { Stage } from "../views/Stage"
|
||||
import { DailyChallenge } from "../views/DailyChallenge"
|
||||
import { TrophyRecord } from "../types/global"
|
||||
import { TrophyClaim } from "../views/TrophyClaim"
|
||||
import { TrophyShow } from "../views/TrophyShow"
|
||||
|
||||
|
||||
const { regClass, property } = Laya
|
||||
@@ -45,6 +48,14 @@ export class UIManager extends Laya.Script {
|
||||
})
|
||||
}
|
||||
|
||||
public loadTrophyClaimUI(record: TrophyRecord): void {
|
||||
Laya.loader.load(respath.trophy_claim_ui_res).then((go)=>{
|
||||
var prefab = go.create()
|
||||
var obj = this.getUIRoot().addChild(prefab).getComponent(TrophyClaim)
|
||||
obj.onSetShow(record)
|
||||
})
|
||||
}
|
||||
|
||||
public loadTrophyUI(): void {
|
||||
Laya.loader.load(respath.trophy_ui_res).then((go)=>{
|
||||
var prefab = go.create()
|
||||
@@ -52,6 +63,14 @@ export class UIManager extends Laya.Script {
|
||||
})
|
||||
}
|
||||
|
||||
public loadTrophyShowUI(record: TrophyRecord): void {
|
||||
Laya.loader.load(respath.trophy_show_ui_res).then((go)=>{
|
||||
var prefab = go.create()
|
||||
var obj = this.getUIRoot().addChild(prefab).getComponent(TrophyShow)
|
||||
obj.onSetShow(record)
|
||||
})
|
||||
}
|
||||
|
||||
public loadStageUI(stageID: string): void {
|
||||
if (this.stage) {
|
||||
this.stage.onLoadStage(StorageManager.getInstance().loadStage(stageID))
|
||||
|
||||
@@ -17,7 +17,7 @@ export interface DataUndo {
|
||||
|
||||
//关卡数据
|
||||
export interface DataStage {
|
||||
id: string,
|
||||
id: string,//关卡ID dc关卡格式为:年-月-日
|
||||
type: number,
|
||||
name: string,
|
||||
difficulty: string,
|
||||
@@ -46,14 +46,22 @@ export function createDataStage(id: string, type: number, name: string, difficul
|
||||
|
||||
|
||||
export interface StageProgress {//关卡完成进度
|
||||
stageID: string,
|
||||
stageID: string,//关卡ID dc关卡格式为:年-月-日
|
||||
progress: number,
|
||||
}
|
||||
export interface DataProgress {
|
||||
export interface TrophyRecord {
|
||||
year: number,
|
||||
month: number,
|
||||
day: number,
|
||||
isNew: boolean,
|
||||
read: boolean,
|
||||
}
|
||||
export interface DataProgress {//关卡难度进度
|
||||
difficulty: string,
|
||||
index: number,
|
||||
}
|
||||
export interface DataUser {
|
||||
dones: Array<StageProgress>,//关卡完成进度
|
||||
trophy_records: Array<TrophyRecord>,//奖杯获得记录
|
||||
progresses: Array<DataProgress>,//主线各个难度进度
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { CalendarUnit } from "./CalendarUnit";
|
||||
import { LevelManager } from "../models/LevelManager";
|
||||
import { UIManager } from "../models/UIManager";
|
||||
import { respath } from "../constants/respath";
|
||||
import { MONTH_LIST } from "../models/DCManager";
|
||||
|
||||
|
||||
const { regClass, property } = Laya;
|
||||
@@ -16,6 +17,8 @@ export class DailyChallenge extends Laya.Script {
|
||||
public btn_back: Laya.Button
|
||||
@property(Laya.Image)
|
||||
public btn_trophy: Laya.Image
|
||||
@property(Laya.Sprite)
|
||||
public btn_trophy_red: Laya.Sprite
|
||||
@property(Laya.Image)
|
||||
public icon_trophy: Laya.Image
|
||||
@property(Laya.Box)
|
||||
@@ -62,9 +65,15 @@ export class DailyChallenge extends Laya.Script {
|
||||
UIManager.getInstance().loadHomeUI()
|
||||
this.owner.destroy()
|
||||
})
|
||||
|
||||
var user = StorageManager.getInstance().getUser()
|
||||
this.btn_trophy_red.visible = user.get_trophyHasUnread()
|
||||
this.btn_trophy.on(Laya.Event.CLICK, this, ()=>{
|
||||
user.set_trophyAllread()
|
||||
this.btn_trophy_red.visible = false
|
||||
UIManager.getInstance().loadTrophyUI()
|
||||
})
|
||||
|
||||
this.btn_play.on(Laya.Event.CLICK, this, (evt: Laya.Event)=>{
|
||||
// console.log(">>>>>>>>>>>>>>>>>>>>>>>", this.selectedUnit.day)
|
||||
var now = new Date()
|
||||
@@ -99,12 +108,12 @@ export class DailyChallenge extends Laya.Script {
|
||||
}
|
||||
}
|
||||
|
||||
this.indexMax = config.MONTH_LIST.length - 1
|
||||
this.indexMax = 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]
|
||||
for (var i=0; i<MONTH_LIST.length; i++) {
|
||||
var obj = MONTH_LIST[i]
|
||||
if (nowYear == obj.year && nowMonth == obj.month) {
|
||||
this.indexMax = i;
|
||||
break
|
||||
@@ -129,8 +138,8 @@ export class DailyChallenge extends Laya.Script {
|
||||
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]
|
||||
for (var i=0; i<MONTH_LIST.length; i++) {
|
||||
var obj = MONTH_LIST[i]
|
||||
if (nowYear == obj.year && nowMonth == obj.month) {
|
||||
this.currentIndex = i;
|
||||
break
|
||||
@@ -143,7 +152,7 @@ export class DailyChallenge extends Laya.Script {
|
||||
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 info = MONTH_LIST[index]
|
||||
var user = StorageManager.getInstance().getUser()
|
||||
var now = new Date()
|
||||
var nowYear = now.getFullYear()
|
||||
@@ -152,7 +161,7 @@ export class DailyChallenge extends Laya.Script {
|
||||
|
||||
this.icon_trophy.skin = info.icon_res
|
||||
//设置背景
|
||||
var starCount = user.get_doneCountBydate(info.year, info.month)
|
||||
var starCount = user.get_doneCountByDate(info.year, info.month)
|
||||
if (starCount >= info.dayCount) {
|
||||
this.bg_dc.skin = respath.dc_top_bg_month_finish
|
||||
}
|
||||
@@ -249,4 +258,13 @@ export class DailyChallenge extends Laya.Script {
|
||||
var unit = evt.target.getComponent(CalendarUnit)
|
||||
this.onApplyUnit(unit)
|
||||
}
|
||||
|
||||
onStart(): void {
|
||||
var user = StorageManager.getInstance().getUser()
|
||||
var find = user.get_trophyHasNew()
|
||||
if (find) {
|
||||
UIManager.getInstance().loadTrophyClaimUI(find)
|
||||
user.set_trophyNew(find, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import { Difficulty } from "./Difficulty";
|
||||
import { LevelManager } from "../models/LevelManager";
|
||||
import { config } from "../constants/config";
|
||||
import { Utility_ConvertSecondToString } from "../utils/utility";
|
||||
import { G_getMonthInfo } from "../models/DCManager";
|
||||
|
||||
const { regClass, property } = Laya
|
||||
|
||||
@@ -44,17 +45,11 @@ export class Home extends Laya.Script {
|
||||
var now = new Date()
|
||||
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
|
||||
}
|
||||
}
|
||||
var nowDay = now.getDate()
|
||||
var find = G_getMonthInfo(nowYear, nowMonth)
|
||||
if (find) {
|
||||
this.icon_dc.skin = find.icon_res
|
||||
if (user.get_doneCountBydate(nowYear, nowMonth) >= find.dayCount) {
|
||||
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"
|
||||
@@ -71,7 +66,6 @@ export class Home extends Laya.Script {
|
||||
this.label_dc_date.color = "#2d3138"
|
||||
}
|
||||
|
||||
var nowDay = new Date().getDate()
|
||||
var stageID = `${nowYear}-${nowMonth}-${nowDay}`
|
||||
this.label_dc_date.text = `${config.MONTH_ABBRS[nowMonth-1]} ${nowDay}`
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import { config } from "../constants/config";
|
||||
import { StorageManager } from "../models/StorageManager";
|
||||
import { Utility_ConvertSecondToString } from "../utils/utility";
|
||||
import { EVENT_TYPES, EventManager } from "../models/EventManager";
|
||||
import { G_getMonthInfo } from "../models/DCManager";
|
||||
|
||||
|
||||
const { regClass, property } = Laya;
|
||||
@@ -377,14 +378,31 @@ export class Stage extends Laya.Script {
|
||||
}
|
||||
}
|
||||
}
|
||||
user.update_stage_done(this.data.get_stageID(), finished/all)//更新关卡完成进度
|
||||
var progress = finished/all
|
||||
user.update_stage_done(this.data.get_stageID(), progress)//更新关卡完成进度
|
||||
if (this.getIsComplete()) {
|
||||
console.log("完成关卡")
|
||||
console.log("完成关卡", finished, all, progress)
|
||||
this.paused = true
|
||||
this.data.set_score(score)
|
||||
if (this.data.get_stageType() == config.STAGE_TYPE.MAIN) {//主线关卡更新难度进度
|
||||
user.update_progress(this.data.get_difficulty(), this.data.get_stageIndex()+1)
|
||||
}
|
||||
else if (this.data.get_stageType() == config.STAGE_TYPE.DC) {//dc
|
||||
if (progress >= 1) {//完成每日挑战关卡检查是否或者当月奖杯
|
||||
var now = new Date()
|
||||
var nowYear = now.getFullYear()
|
||||
var nowMonth = now.getMonth() + 1
|
||||
var doneCount = user.get_doneCountByDate(nowYear, nowMonth)
|
||||
var dayCount = 0
|
||||
var info = G_getMonthInfo(nowYear, nowMonth)
|
||||
if (info)
|
||||
dayCount = info.dayCount
|
||||
console.log("dc完成信息>>>>>>>>>>>>>>>", nowYear, nowMonth, doneCount, dayCount)
|
||||
if (doneCount >= dayCount) {//当月每日挑战全部完成
|
||||
user.add_trophy_record(nowYear, nowMonth, now.getDate())
|
||||
}
|
||||
}
|
||||
}
|
||||
UIManager.getInstance().loadGameDoneUI()
|
||||
}
|
||||
}
|
||||
|
||||
36
src/views/TrophyClaim.ts
Normal file
36
src/views/TrophyClaim.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { config } from "../constants/config";
|
||||
import { MONTH_LIST } from "../models/DCManager";
|
||||
import { TrophyRecord } from "../types/global";
|
||||
|
||||
const { regClass, property } = Laya;
|
||||
|
||||
@regClass()
|
||||
export class TrophyClaim extends Laya.Script {
|
||||
declare owner : Laya.Box;
|
||||
|
||||
@property(Laya.Image)
|
||||
public icon: Laya.Image
|
||||
|
||||
@property(Laya.Label)
|
||||
public label_date: Laya.Label
|
||||
|
||||
@property(Laya.Box)
|
||||
public btn_close: Laya.Box
|
||||
|
||||
public onSetShow(record: TrophyRecord): void {
|
||||
for (var i=0; i<MONTH_LIST.length; i++) {
|
||||
var obj = MONTH_LIST[i]
|
||||
if (obj.year == record.year && obj.month == record.month) {
|
||||
this.icon.skin = obj.icon_res
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
this.label_date.text = `${config.MONTH_ABBRS[record.month-1]} ${record.day},${record.year}`
|
||||
|
||||
this.btn_close.on(Laya.Event.CLICK, this, ()=>{
|
||||
this.owner.destroy()
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
3
src/views/TrophyClaim.ts.meta
Normal file
3
src/views/TrophyClaim.ts.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"uuid": "0550b681-b602-49fe-900f-e30866ce922c"
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
|
||||
|
||||
|
||||
import { config } from "../constants/config";
|
||||
|
||||
import { respath } from "../constants/respath";
|
||||
import { MONTH_LIST } from "../models/DCManager";
|
||||
import { TrophyUnit } from "./TrophyUnit";
|
||||
|
||||
const { regClass, property } = Laya;
|
||||
@@ -28,8 +29,8 @@ export class TrophyRoom extends Laya.Script {
|
||||
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]
|
||||
for (var i=0; i<MONTH_LIST.length; i++) {
|
||||
var obj = MONTH_LIST[i]
|
||||
infos.push(obj)
|
||||
if (obj.year == nowYear && obj.month == nowMonth) {
|
||||
break
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
|
||||
import { config } from "../constants/config";
|
||||
import { MONTH_LIST } from "../models/DCManager";
|
||||
import { TrophyRecord } from "../types/global";
|
||||
|
||||
|
||||
const { regClass, property } = Laya;
|
||||
|
||||
@regClass()
|
||||
@@ -13,7 +19,19 @@ export class TrophyShow extends Laya.Script {
|
||||
@property(Laya.Box)
|
||||
public btn_close: Laya.Box
|
||||
|
||||
public onSetShow(): void {
|
||||
public onSetShow(record: TrophyRecord): void {
|
||||
for (var i=0; i<MONTH_LIST.length; i++) {
|
||||
var obj = MONTH_LIST[i]
|
||||
if (obj.year == record.year && obj.month == record.month) {
|
||||
this.icon.skin = obj.icon_res
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
this.label_date.text = `${config.MONTH_ABBRS[record.month-1]} ${record.day},${record.year}`
|
||||
|
||||
this.btn_close.on(Laya.Event.CLICK, this, ()=>{
|
||||
this.owner.destroy()
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { config } from "../constants/config";
|
||||
import { respath } from "../constants/respath";
|
||||
import { StorageManager } from "../models/StorageManager";
|
||||
import { UIManager } from "../models/UIManager";
|
||||
|
||||
const { regClass, property } = Laya;
|
||||
|
||||
@@ -19,7 +20,7 @@ export class TrophyUnit extends Laya.Script {
|
||||
|
||||
public onInit(info: any): void {
|
||||
var user = StorageManager.getInstance().getUser()
|
||||
var starCount = user.get_doneCountBydate(info.year, info.month)
|
||||
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]
|
||||
@@ -35,7 +36,10 @@ export class TrophyUnit extends Laya.Script {
|
||||
}
|
||||
|
||||
this.icon.on(Laya.Event.CLICK, this, ()=>{
|
||||
|
||||
var find = user.get_trophyRecord(info.year, info.month)
|
||||
if (find) {
|
||||
UIManager.getInstance().loadTrophyShowUI(find)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user