import Panel from "../views/Panel";
import PlayScene from "../playScene/PlayScene";

export default class CountDownPanel extends Panel{
    protected get skinKey() { return 'CountDown' }
    
    public countnum:eui.Image;
    public tips:eui.Label;

    constructor(){
        super();
        this.initUI()
    }
    initUI(){
        egret.Tween.get(this.countnum)
        .set({source:"three_png"})
        .call(()=>{
            egret.Tween.get(this.countnum)
            .wait(1000)
            .set({source:"two_png"})
            .call(()=>{
                egret.Tween.get(this.countnum)
                .wait(1000)
                .set({source:"one_png"})
                .wait(1000)
                .call(()=>{
                    this.hidePanel();
                    PlayScene.instance.getEnterFrame();
                    let now = Date.now();
                    PlayScene.instance.createtime = now;
                })
            })
        })
        egret.Tween.get(this.tips)
        .set({text:"Tips:记得收集图书，\n提高自己的排名哦~"})
        .call(()=>{
            egret.Tween.get(this.tips)
            .wait(1000)
            .set({text:"Tips:注意躲避车辆和路障，\n碰倒3次障碍物，游戏就结束啦！"})
            .call(()=>{
                egret.Tween.get(this.tips)
                .wait(1000)
                .set({text:"Tips:按照箭头方向，\n就能控制KaDa前进方向哦~"})
                
            })
        })


    }
}