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(() => {
            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);
                    }
                });
            }
        }
    }

}


