Files
MatchMaster/assets/career/script/Career2.ts
2026-09-01 18:47:54 +08:00

69 lines
2.2 KiB
TypeScript

import Utils from "../../Script/module/Pay/Utils";
const { ccclass, property } = cc._decorator;
@ccclass
export default class Career extends cc.Component {
// 游戏当日闯关排行信息
private careerInfo: any = {};
// LIFE-CYCLE CALLBACKS:
// @property(cc.SpriteAtlas)
// UI: cc.SpriteAtlas = null;
private initialTouchOffset: cc.Vec2 = null;
private offsetTolerance = 100; // 偏移容忍度;
onLoad() {
}
start() {
console.log("根据服务器信息去拿当日前6,以及省市第一信息");
let careerInfo = Utils.getDailyQuestInfo(() => {
const careerDisabled = cc.fx.GameTool
&& cc.fx.GameTool.isLowMemoryMode
&& cc.fx.GameTool.isLowMemoryMode();
if (careerDisabled || !this.node || !cc.isValid(this.node, true)) {
return;
}
this.careerInfo = careerInfo;
this.init();
});
}
init() {
console.log("根据服务器信息去拿当日前6,以及省市第一信息", this.careerInfo);
var dailyQuestInfo = this.careerInfo.dailyQuestInfo;
if (dailyQuestInfo) {
let dailyQuestInfoList = dailyQuestInfo.dailyQuestInfoList;
if (dailyQuestInfoList) {
dailyQuestInfoList.forEach((item) => {
if (item.questId == 1) {
// 当日前6
console.log("当日前6", item);
let info = {
rank: item.rank,
score: item.score,
time: item.time,
}
cc.fx.StorageMessage.setStorage("dailyQuestInfoList", info);
// 省市第一
console.log("省市第一", item);
let rankOne = {
rank: item.rank,
score: item.score,
time: item.time,
}
cc.fx.StorageMessage.setStorage("provinceQuestInfoList", info);
}
});
}
}
}
}