import FF from "../FF";
import FSprite from "../object/FSprite";
import WOneByone from "./map1/WOneByone";

/**
 * 怪物战前对话
 */
const {ccclass, property} = cc._decorator;

@ccclass
export default class FDialogMonster extends cc.Component {

    @property(cc.Prefab)
    mMapDialog: cc.Prefab = null;

    @property([cc.String])
    text: Array<string> = [];

    private ff:FF;

    public showDialog(){
        let dialogs = this.text;
        let node = cc.instantiate(this.mMapDialog);
        node.group = 'map'
        node.zIndex = 9999;
        node.x = this.node.x;
        node.y = this.node.y + this.node.height;
        node.parent = this.ff.mMap.mSprites;
        let obo = node.getComponent(WOneByone);
        obo.dialogs = dialogs;
        obo.setCallback(()=>{
            node.destroy();
        });
        obo._start();
    }
}
