From ce90518d065d14e8630779a23bee2007bd198759 Mon Sep 17 00:00:00 2001 From: yangwen Date: Tue, 3 Jun 2025 19:36:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=8E=86=E6=B7=BB=E5=8A=A0=E5=B7=A6?= =?UTF-8?q?=E5=8F=B3=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/resources/dc/DailyChallenge.lh | 74 +++++++++++++++++++++++-- assets/resources/dc/DailyChallenge_H.lh | 70 +++++++++++++++++++++++ src/views/dc/DailyChallenge.ts | 41 ++++++++++---- 3 files changed, 168 insertions(+), 17 deletions(-) diff --git a/assets/resources/dc/DailyChallenge.lh b/assets/resources/dc/DailyChallenge.lh index 2a2b401..5629ba3 100644 --- a/assets/resources/dc/DailyChallenge.lh +++ b/assets/resources/dc/DailyChallenge.lh @@ -3,8 +3,8 @@ "_$id": "r0x6htig", "_$type": "Box", "name": "DailyChallenge", - "width": 1920, - "height": 1080, + "width": 1080, + "height": 1920, "_mouseState": 2, "left": 0, "right": 0, @@ -35,6 +35,12 @@ "btn_right": { "_$ref": "e2xuqxps" }, + "btn_left2": { + "_$ref": "ybbojil0" + }, + "btn_right2": { + "_$ref": "rp3gmpnp" + }, "bg_dc": { "_$ref": "hdia0flx" }, @@ -78,7 +84,6 @@ "_$id": "jfzgpbyj", "_$type": "Box", "name": "top", - "x": 420, "width": 1080, "height": 1080, "_mouseState": 2, @@ -366,8 +371,7 @@ "_$id": "rq2jiwrh", "_$type": "Box", "name": "bottom", - "x": 420, - "y": -265, + "y": 575, "width": 1080, "height": 1345, "bottom": 0, @@ -7156,6 +7160,66 @@ "valign": "middle", "padding": "0,0,0,0" }, + { + "_$id": "ybbojil0", + "_$type": "Box", + "name": "btn_left", + "x": -61, + "y": -490, + "width": 48, + "height": 96, + "_mouseState": 2, + "_$comp": [ + { + "_$type": "a541bdfc-e8e1-4795-b68e-7138c5190f17", + "scriptPath": "../src/views/common/CommonHover.ts", + "hoverAlpha": true + } + ], + "_$child": [ + { + "_$id": "wmm7xhim", + "_$type": "Image", + "name": "Image", + "width": 48, + "height": 97, + "mouseThrough": true, + "skin": "res://535f9c82-7994-4fd9-a6b5-e7d08199cd4f", + "useSourceSize": true, + "color": "#5b86b1" + } + ] + }, + { + "_$id": "rp3gmpnp", + "_$type": "Box", + "name": "btn_right", + "x": 951, + "y": -490, + "width": 48, + "height": 96, + "_mouseState": 2, + "_$comp": [ + { + "_$type": "a541bdfc-e8e1-4795-b68e-7138c5190f17", + "scriptPath": "../src/views/common/CommonHover.ts", + "hoverAlpha": true + } + ], + "_$child": [ + { + "_$id": "hxt6cgnk", + "_$type": "Image", + "name": "Image", + "width": 48, + "height": 97, + "mouseThrough": true, + "skin": "res://25320e1c-b60c-45af-9122-cdc433872fa7", + "useSourceSize": true, + "color": "#5b86b1" + } + ] + }, { "_$id": "mv2bgo4b", "_$type": "HBox", diff --git a/assets/resources/dc/DailyChallenge_H.lh b/assets/resources/dc/DailyChallenge_H.lh index 339055b..9cadd33 100644 --- a/assets/resources/dc/DailyChallenge_H.lh +++ b/assets/resources/dc/DailyChallenge_H.lh @@ -32,6 +32,12 @@ "btn_right": { "_$ref": "cesch3ua" }, + "btn_left2": { + "_$ref": "ooo778f6" + }, + "btn_right2": { + "_$ref": "9u1eta96" + }, "bg_dc": { "_$ref": "s1tpy9gm" }, @@ -7322,6 +7328,70 @@ ] } ] + }, + { + "_$id": "ooo778f6", + "_$type": "Box", + "name": "btn_left", + "x": 18, + "y": 308, + "width": 36, + "height": 72, + "_mouseState": 2, + "_$comp": [ + { + "_$type": "a541bdfc-e8e1-4795-b68e-7138c5190f17", + "scriptPath": "../src/views/common/CommonHover.ts", + "hoverAlpha": true + } + ], + "_$child": [ + { + "_$id": "c58rx218", + "_$type": "Image", + "name": "Image", + "width": 48, + "height": 97, + "scaleX": 0.75, + "scaleY": 0.75, + "mouseThrough": true, + "skin": "res://535f9c82-7994-4fd9-a6b5-e7d08199cd4f", + "useSourceSize": true, + "color": "#748290" + } + ] + }, + { + "_$id": "9u1eta96", + "_$type": "Box", + "name": "btn_right", + "x": 1140, + "y": 308, + "width": 36, + "height": 72, + "_mouseState": 2, + "_$comp": [ + { + "_$type": "a541bdfc-e8e1-4795-b68e-7138c5190f17", + "scriptPath": "../src/views/common/CommonHover.ts", + "hoverAlpha": true + } + ], + "_$child": [ + { + "_$id": "te6v8xqq", + "_$type": "Image", + "name": "Image", + "width": 48, + "height": 97, + "scaleX": 0.75, + "scaleY": 0.75, + "mouseThrough": true, + "skin": "res://25320e1c-b60c-45af-9122-cdc433872fa7", + "useSourceSize": true, + "color": "#748290" + } + ] } ] } diff --git a/src/views/dc/DailyChallenge.ts b/src/views/dc/DailyChallenge.ts index 1415e53..982fbc5 100644 --- a/src/views/dc/DailyChallenge.ts +++ b/src/views/dc/DailyChallenge.ts @@ -33,6 +33,12 @@ export class DailyChallenge extends Laya.Script { @property(Laya.Box) public btn_right: Laya.Box + @property(Laya.Box) + public btn_left2: Laya.Box + + @property(Laya.Box) + public btn_right2: Laya.Box + @property(Laya.Image) public bg_dc: Laya.Image @@ -128,18 +134,12 @@ export class DailyChallenge extends Laya.Script { 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) - } - }) + + + this.btn_left.on(Laya.Event.CLICK, this, this.onClickLeft) + this.btn_right.on(Laya.Event.CLICK, this, this.onClickRight) + this.btn_left2.on(Laya.Event.CLICK, this, this.onClickLeft) + this.btn_right2.on(Laya.Event.CLICK, this, this.onClickRight) EventManager.getInstance().RegisterEvent(EVENT_TYPES.NOT_SET_TROPHY_BUTTON, DailyChallenge.EventUpdateTrophyButton) } @@ -169,6 +169,8 @@ 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 + this.btn_left2.visible = this.currentIndex > 0 + this.btn_right2.visible = this.currentIndex < this.indexMax const info = MONTH_LIST[index] UIManager.getInstance().setCurrentDCMonth(info.year, info.month) console.log("DailyChallenge loadWithIndex >>>>>>>>>>>>>>>", info.year, info.month) @@ -274,6 +276,21 @@ export class DailyChallenge extends Laya.Script { this.onApplyUnit(unit) } + + onClickLeft(): void { + if (this.currentIndex > 0) { + this.currentIndex-- + this.loadWithIndex(this.currentIndex) + } + } + + onClickRight(): void { + if (this.currentIndex < this.indexMax) { + this.currentIndex++ + this.loadWithIndex(this.currentIndex) + } + } + onStart(): void { const user = StorageManager.getInstance().getUser() const find = user.get_trophyHasNew()