add trophy logic

This commit is contained in:
2025-05-22 14:54:48 +08:00
parent 16a5eb9e6b
commit 2bf07ab8f6
27 changed files with 587 additions and 127 deletions

View File

@@ -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()
}
}