调整dc默认月份逻辑

This commit is contained in:
2025-05-30 17:25:15 +08:00
parent 220d109058
commit 8f7d4c7194
4 changed files with 23 additions and 5 deletions

View File

@@ -66,6 +66,8 @@ export class UIManager extends Laya.Script {
private topbar: TopBar
private stage: Stage
private dc_ui: DailyChallenge
private dc_year: number = -1
private dc_month: number = -1
private trophyRoom: TrophyRoom
onStart(): void {
@@ -96,12 +98,23 @@ export class UIManager extends Laya.Script {
}
}
public setCurrentDCMonth(year: number, month: number): void {
this.dc_year = year
this.dc_month = month
console.log("setCurrentDCMonth >>>>>>>>>>>>>>>>>>>>", year, month)
}
public loadDCUI(): void {
this.mask.visible = true
Laya.loader.load(respath.dc_ui_res()).then((go) => {
const prefab = go.create()
this.dc_ui = this.getUIRoot().addChild(prefab).getComponent(DailyChallenge)
this.dc_ui.loadWithMonth()
if (this.dc_year <= 0 || this.dc_month <= 0) {
const now = new Date()
this.dc_year = now.getFullYear()
this.dc_month = now.getMonth() + 1
}
this.dc_ui.loadWithMonth(this.dc_year, this.dc_month)
this.mask.visible = false
})
}