// 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

import MapConroler from "../Map";
import NumberToImage from "../NumberToImage";

const { ccclass, property } = cc._decorator;



@ccclass
export default class AddTime extends cc.Component {
    static _instance: any;
    time: number = 60;
    over: boolean = false;

    // mapInfo: number[][] = [];

    onLoad() {
        this.over = false;
    }

    start() {
        this.over = false;
    }

    init(time) {
        if (time) this.time = time;
        this.node.getChildByName("time").active = true;
        NumberToImage.numberToImageNodes(this.time, 20, 8, "lock_", this.node.getChildByName("time"), false);
        // if (this.node.name == "boom") {
        //     NumberToImage.numberToImageNodes(this.time, 20, 8, "lock_", this.node.getChildByName("time"), false);
        // }
        // else if (this.node.name == "boom2") {
        //     NumberToImage.numberToImageNodes(this.time, 26, 8, "half_black_", this.node.getChildByName("time"), false);
        //     if (this.node.getChildByName("time").children.length > 1) {
        //         this.node.getChildByName("time").children[0].scale = 0.7;
        //         this.node.getChildByName("time").children[1].scale = 0.7;
        //         this.node.getChildByName("time").children[0].x -= 2;
        //         this.node.getChildByName("time").children[0].x -= 3;
        //     }
        // }
        // this.node.getChildByName("time").getComponent(cc.Label).string = this.time.toString();
    }














    // update (dt) {}
}
