FDialogMonster.ts 857 B

123456789101112131415161718192021222324252627282930313233343536
  1. import FF from "../FF";
  2. import FSprite from "../object/FSprite";
  3. import WOneByone from "./map1/WOneByone";
  4. /**
  5. * 怪物战前对话
  6. */
  7. const {ccclass, property} = cc._decorator;
  8. @ccclass
  9. export default class FDialogMonster extends cc.Component {
  10. @property(cc.Prefab)
  11. mMapDialog: cc.Prefab = null;
  12. @property([cc.String])
  13. text: Array<string> = [];
  14. private ff:FF;
  15. public showDialog(){
  16. let dialogs = this.text;
  17. let node = cc.instantiate(this.mMapDialog);
  18. node.group = 'map'
  19. node.zIndex = 9999;
  20. node.x = this.node.x;
  21. node.y = this.node.y + this.node.height;
  22. node.parent = this.ff.mMap.mSprites;
  23. let obo = node.getComponent(WOneByone);
  24. obo.dialogs = dialogs;
  25. obo.setCallback(()=>{
  26. node.destroy();
  27. });
  28. obo._start();
  29. }
  30. }