// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class GameData extends cc.Component {

    @property(cc.Label)
    label: cc.Label = null;

    @property
    text: string = 'hello';
    static _instance: any;
    GM_INFO: {};
    AudioManager: any;

    GAME_DATA: any[];
    CLICK_DATA: { type: number; success: boolean; round: number; totalSunCount: number; movedSunCount: number; sunSpeed: number; overlapSunCount: number; colorList: any[]; duration: number; difficultyLevel: number; sunList: any[]; stepTimeList: any[]; };
    LEVEL_INFO: { //第一难度
        number: number; //太阳总数 
        moveNumber: number; //太阳可移动个数
        moveSpeed: number; //太阳移动速度等级
        maxDistance: number; //布局后移动最大距离
        maxMove: number; //初始布局最大移动距离
        repeat: number; //是否重叠，现在0 不重叠 1 重叠1个
    }[];

    // LEVEL_INFO: { number: number; }[];
    // LEVEL_INFO:[];

    // LIFE-CYCLE CALLBACKS:

    
    onLoad () {
        if (GameData._instance == null) {
            GameData._instance = this;
            cc.game.addPersistRootNode(this.node);
         
            this.AudioManager = this.node.getComponent('BallAudioManager');
        }
        else {
            this.node.destroy();
            return;
        }
    }

    start () {
        this.GM_INFO = { 
            // isEnd: false,
            mean_Time:0,                //平均放箭速度
            total:0,                    //总共对的个数
            currSeed: 203213,           //用于随机数种子
            gameId:'100009',
            userId:200139,
            guide:true,                 //是否有引导
            url:"http://api.sparkus.cn",
            success:false,
            matchId:null,
            custom: 0
        };
        this.LEVEL_INFO = [
            {   //第一难度
                number:3,       //太阳总数 
                moveNumber:0,   //太阳可移动个数
                moveSpeed:0,    //太阳移动速度等级
                maxDistance:200, //布局后移动最大距离
                maxMove:1200,
                repeat:0        //是否重叠，现在0 不重叠 1 重叠1个
                
            },
            {   //第二难度
                number:4,
                moveNumber:0,
                moveSpeed:0,
                maxDistance:200,
                maxMove:1200,
                repeat:0
            },
            {   //第三难度
                number:5,
                moveNumber:1,
                moveSpeed:6,
                maxDistance:200,
                maxMove:1200,
                repeat:0
            },
            {   //第四难度
                number:5,
                moveNumber:1,
                moveSpeed:6,
                maxDistance:200,
                maxMove:1200,
                repeat:1
            },
            {   //第五难度
                number:6,
                moveNumber:2,
                moveSpeed:6,
                maxDistance:200,
                maxMove:1200,
                repeat:1
            },
            {   //第六难度
                number:7,
                moveNumber:3,
                moveSpeed:6,
                maxDistance:200,
                maxMove:1200,
                repeat:1
            },
            {   //第七难度
                number:8,
                moveNumber:4,
                moveSpeed:6,
                maxDistance:200,
                maxMove:1200,
                repeat:1
            },
            {   //第八难度
                number:9,
                moveNumber:5,
                moveSpeed:6,
                maxDistance:200,
                maxMove:1200,
                repeat:1
            },
            {   //第九难度
                number:10,
                moveNumber:5,
                moveSpeed:6,
                maxDistance:200,
                maxMove:1200,
                repeat:1
            },
            {   //11 这关会卡人
                number:3,
                moveNumber:0,
                moveSpeed:6,
                maxDistance:200,
                maxMove:1200,
                repeat:0
            },
            {   //12 这关会卡人
                number:4,
                moveNumber:0,
                moveSpeed:6,
                maxDistance:200,
                maxMove:1200,
                repeat:0
            },
            {   //12 这关会卡人
                number:5,
                moveNumber:0,
                moveSpeed:6,
                maxDistance:200,
                maxMove:1200,
                repeat:0
            },

        ]

        this.CLICK_DATA = 
            {
                type:1,
                success:false,
                round:0,
                totalSunCount:0,
                movedSunCount:0,
                sunSpeed:0,
                overlapSunCount:0,
                colorList:[],
                duration:0,
                difficultyLevel:0,
                sunList:[],
                stepTimeList:[]
            }

        this.GAME_DATA = [
            
        ]
    }

    CLICK_init(){
        this.CLICK_DATA = 
        {
            type:1,
            success:false,
            round:0,
            totalSunCount:0,
            movedSunCount:0,
            sunSpeed:0,
            overlapSunCount:0,
            colorList:[],
            duration:0,
            difficultyLevel:0,
            sunList:[],
            stepTimeList:[]
        }
    }

    // update (dt) {}
}
