import {getTexture} from './utils'

export default class TimeCounter extends engine.Container{
    timeCounter:engine.Sprite = new engine.Sprite(getTexture('b7d2a60a-9e60-4eca-be80-a991abea47c9'));
    timeText:any;
    time:number

    
    constructor(){
        super()
        this.time = 20
        this.addChild(this.timeCounter)

        this.timeCounter.x = 256;
        this.timeCounter.y = 50;
        // 计时文本
        this.timeText = new engine.TextInput();
        this.timeText.text = this.time +'s';
        this.timeText.size = 48;
        this.timeText.fillColor = '#7A83C5';
        this.timeCounter.addChild(this.timeText);
        this.timeText.x = 100;
        this.timeText.y = 15;

    }

    updateTime(time){
        this.time = time;
        this.timeText.text = this.time + 's'
    }


}