import { playDragonBoneAnimation } from "./util";

cc.Class({
	extends: cc.Component,
    name: "Evaluate",
	properties: {
        items: {
			default: [],
			type: cc.Node,
        },
    },

    onLoad:function(){
        //this.node.active = false;
    },
    ctor: function () {
    },

    setEvaluate:function(idx, cb = null){
        this.node.active = true;
        for(let i = 0; i < this.items.length; i++){
            this.items[i].active = false;
        }
        this.items[idx].active = true;
        playDragonBoneAnimation(this.items[idx], 'newAnimation');
        cc.tween(this.node)
        .delay(1)
        .call(()=>{
            this.node.active = false;
            cb && cb();
        })
        .start();
    }

});
