const GameProgress = cc.Enum ({
    default:0,
    Race:1,
    LongJump:2,
    Hurdle:3,
    RideBike:4,
    Javelin:5,
});

cc.Class({
    extends: cc.Component,
    properties: {
        CurrentTime:0,
        CurrentProgress: {
            default : GameProgress.Race,
            type : cc.Enum(GameProgress)
        },
        HostName:'',
        BWaitingToConnect:false,
        bConnect:false,
		bReadyToRun:false,
        BStartGame:false,
        myRandomc : [],
        EnterStartLinePlayersArray:[],
        EnterFinishLinePlayersArray:[],
        EndLinePositionX:0,
        StartLinePositionX:0,
        ReadyToRunDuration:2,
        bPreTransport:false,
        bStopAllAnimationAndSchedule:false,
        bSyncPositionXRange:20,
        strCureentLevel:'Sprint',


        //是不是机器人
        isRobot:false,

        startTime:0,
        endTime:0,
        playTime:0,
        dtTime:0,
        textNode:null,
        bHasStartGame:false,
        bHasEndGame:false,

        uploadValue:0,//记录当前上传的值


         //slam todo
         getHero:null,
         getRivel:null,
         getHeroControl:null,
         getRivelControl:null,
         getLevel:null,
         getLevelControl:null,
    },
    onLoad(){
        this.getHero = cc.find('Hero');
        this.getRivel = cc.find('Rivel');
        this.getHeroControl = this.getHero.getComponent("HeroControl");
        this.getRivelControl =  this.getRivel.getComponent("HeroControl");

        this.getLevel = cc.find("Level");
        this.getLevelControl = this.getLevel.getComponent('LevelControl');

    },

    start () {
        this.bConnect=false;
        this.bReadyToRun=false;
        this.myRandomc = [];
        this.StartLinePositionX = 0;
        this.bStopAllAnimationAndSchedule = false;
        this.isRobot = false;
        this.textNode = cc.find('test').getComponent(cc.Label);
    },
    update : function (dt) {
        if(this.bHasStartGame && !this.bHasEndGame){
            this.dtTime += dt;
        }
        // cc.log('CurrentProgress='+this.CurrentProgress);

        // this.textNode.string = Math.floor(this.dtTime*1000).toString();
        // cc.log(this.dtTime);
    },
    getMyRandomc : function () {
        return this.myRandomc;
    }
});

var myRandomcs = {
    myRandomc : []
}

module.exports = {
    GameProgress : cc.Enum(GameProgress),
    myRandomc :myRandomcs.myRandomc
};