12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import Home from "../../../home/Home";
- import FF from "../../FF";
- import WOneByone from "../map1/WOneByone";
- /**
- * 地图场景中对话
- */
- export default class FMapDialog {
- private ff:FF
- //对话框样式
- public mMapDialog:cc.Prefab;
-
- constructor(ff:FF,mMapDialog:cc.Prefab){
- this.ff = ff;
- this.mMapDialog = mMapDialog;
- }
- public showDialog(dialogs:Array<string>,//对话内容
- pos:cc.Vec2,//显示在地图中的位置
- spine:sp.Skeleton,//当前动画精灵
- callback:()=>void)//对话结束后的回调
- {
- let node = cc.instantiate(this.mMapDialog);
- node.group = 'map'
- node.zIndex = 9999;
- node.x = pos.x;
- node.y = pos.y;
- node.parent = this.ff.mMap.mSprites;
- let obo = node.getComponent(WOneByone);
- this.ff.mBlockInputEvents.active = true;
- obo.dialogs = dialogs;
- obo.spine = spine;
- obo.setCallback(()=>{
- node.destroy();
- this.ff.setBlockInputCallback(null);
- this.ff.mBlockInputEvents.active = false;
- callback();
- });
- this.ff.setBlockInputCallback(()=>{
- obo.jump();
- });
- obo._start();
- }
-
- }
|