123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import BaseEvent from "../base/BaseEvent";
- import WOneByone from "../map1/WOneByone";
- /**
- * 门的提示
- */
- const {ccclass, property} = cc._decorator;
- @ccclass
- export default class FDoorTips extends BaseEvent {
- @property(cc.Prefab)
- mMapDialog: cc.Prefab = null;
- @property([cc.String])
- text: Array<string> = [];
- @property({
- displayName: '提示图标',
- type: cc.SpriteFrame
- })
- mTipsIcon: cc.SpriteFrame = null;
- @property({
- displayName: '出现的机关',
- type: cc.Node
- })
- mGearNode: cc.Node = null;
- onLoad() {
- super.onLoad()
- if(this.mGearNode){
- this.mGearNode.active = false
- }
- }
- onBegin(tag:number){
- if (tag == 1) {
- this.showOpt(this.mTipsIcon, () => {
- this.dialog(0)
- })
- }
- }
- onEnd(tag:number){
- if (tag == 1) {
- this.closeOpt()
- }
- }
- private dialog(index:number){
- if(index >= this.text.length){
- if(this.mGearNode){
- this.mGearNode.active = true
- }
- this.closeOpt()
- return;
- }
- let texts = this.text[index].split('|')
- let mid = parseInt(texts.shift());
- if(mid == -1){//主角
- let my = this.ff.mainSprite.node;
- this.showDialog(my,texts,()=>{
- index ++;
- this.dialog(index);
- });
- }
- }
- }
|