window.dialogmanager = {


    InitDialgue() {
        this.nodeName = [];
        //文本打字速度 ms
        this.IntervalidTimeout = 50;

        this.nodeName.push("secretary");
        this.nodeName.push("worker");
        this.nodeName.push("businessman");
        this.nodeName.push("player");

        this.dialogName = [];
        this.dialogName.push("许默");
        this.dialogName.push("旅行者");

        this.dialogue = [];
        //0
        this.dialogue.push("        总裁您好！今天公司准备开始建设这块商业用地，我是您的小助理淼淼.");
        //1
        this.dialogue.push("        啊！惨了！今天公司新人来报道的事忘的一干二净了！");
        //2（2.1）
        this.dialogue.push("        对不起！还要麻烦总裁亲自安排住宿这种事，真是不好意思。");
        //3
        this.dialogue.push("        太好了，有房子了！也不知道这个公司的主管怎么想的！每一个员工都要有一个房子不是常识吗！");
        //4
        this.dialogue.push("        你好啊！我来旅游路过这里，看到你的水果很新鲜啊！我想收购一点回去，这里有100个金币，你就收下吧！");
        //5
        this.dialogue.push("        初期多种植果树，是一个赚钱的好办法。有了经济实力以后，可以建造更高级的商铺哦~");

        //6
        this.dialogue.push("        果树生产的水果可以出售给游客，还可以作为原材料在加工厂加工，制作出利润更高的商品销售。现在来种植一棵果树吧！");
        //7 (7.1)
        this.dialogue.push("        太好了！看来经过我的努力一切都已经走上了正轨了嘛~！");
        //8
        this.dialogue.push("        ");
        //9
        this.dialogue.push("        ");
        //10
        this.dialogue.push("        ");

        //11
        this.dialogue.push("        ");

        //12
        this.dialogue.push("        ");
        //13
        this.dialogue.push("        ");

        //14
        this.dialogue.push("        ");

        //15
        this.dialogue.push("        ");
        //16
        this.dialogue.push("        ");

        //17 (17.1)
        this.dialogue.push("        ");
        //18（2.2）
        this.dialogue.push("        要注意，建筑只能建造在空地上哦！" +
            "不可以建造在其他建筑上，也不能" +
            "建造在道路上！");

        //19（19.1）
        this.dialogue.push("        在你了解游戏的最基础功能后一定迫不及待的想要知道如何更快的成为首富吧~");
        //20（19.2）
        this.dialogue.push("        初期我们的收入基本来自于自然资源的交易。后期我们有了更多商铺的时候，" +
            "可以考虑在《管理》菜单中关闭自然资源的交易，防止加工厂出现原料短缺的情况。");
        //21（19.3）
        this.dialogue.push("        优秀的建筑布局是提高商业利润的有效手段" +
            "，你可以尝试把附加值更高的上商店建在靠近客商往来的道路边。");
        //22（19.4）
        this.dialogue.push("        同时你也可以重新规划道路，围绕着特殊建筑的加成效果来布局建筑，" +
            "能显著提升房屋对工人的体力恢复以及者商铺中商品的价格。");
        //23（19.4）
        this.dialogue.push("        好了！现在快快来建立你的商业帝国吧！");

        //24（7.2）
        this.dialogue.push("       …明明都是我亲力亲为的好吗！");
        //25 (17.2)
        this.dialogue.push(
            "       好了！我们快来点击“建造”，根据提示添加一个绿化带吧！");

        //26 (17.2)
        this.dialogue.push(
            "       总裁，我是您的助理许默.公司拍下的这块地已经可以开发了！");
        //27 (17.2)
        this.dialogue.push(
            "       现在我们先来规划一条道路吧!");
        //28 (17.2)
        this.dialogue.push(
            "       道路铺设成功~商业的繁华可是离不开道路的建设哦！");

        //29（7.3）
        // this.dialogue.push("       哎呀，先不要在乎这些细节嘛！！\n 现在当务之急是先要多雇佣一些人手吧！");
        //29（7）
        this.dialogue.push("       现在可以开始雇佣一些人手了！");

        //30（7.4）
        this.dialogue.push("       太好了！今天第一天来上班，心里不知为何有点小兴奋呢！");

        //31（6.1）
        this.dialogue.push("       太好了！公司终于正式开始运营了，许默以后也会帮助总裁运营公司的~");

        //32（6.2）
        this.dialogue.push("       加油一起赚更多的钱、打造更繁华的商业街吧！");

        // //33（6.3）
        // this.dialogue.push("       我所知的都以报告完毕，剩下的靠总裁自己经营了。");
    },

    init(nodeparent, callback, skipCallback, endCallback) {
        this.node = nodeparent;
        this.showDialogDetailTag = false;
        this.dialogNode = null;

        //创建引导面板预制
        task.addTaskTipsNoArr(this.node, "prefab/task/Dialog", 0, 0, "Dialog", (nodePrefabs) => {
            nodePrefabs.parent = this.node;
            this.dialogNode = nodePrefabs;
            if (callback != null) {
                callback(nodePrefabs);
            }

            var skipBtn = UtilsPrefabs.getNode("Skip", this.dialogNode);
            skipBtn.active = true;
            UtilsPrefabs.setOn(skipBtn, function () {
                UtilsPrefabs.setOff(skipBtn);
                if (skipCallback)
                    skipCallback();

                if (this.Intervalid)
                    clearInterval(this.Intervalid);
                this.removeNode();

            }.bind(this));

            var endBtn = UtilsPrefabs.getNode("End", this.dialogNode);
            endBtn.active = true;
            UtilsPrefabs.setOn(endBtn, function () {
                UtilsPrefabs.setOff(endBtn);
                if (endCallback)
                    endCallback();

                //任务结束
                task.onSetTaskEnd();
                if (this.Intervalid)
                    clearInterval(this.Intervalid);
                this.dialogNode.destroy();


            }.bind(this));
        });
    },



    //上来介绍 提示出来员工 准备去造房子
    //前三句话
    dialog1: function () {
        //出人
        this.showPersonnel(this.dialogNode, null, function () { }.bind(this));
        //美女助理：“xx总好！今天公司准备开业，我是您的小助理淼淼。”
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            //打字效果
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[0], function () {
                cc.find('GameNode/ManageTask').getComponent('ManageTask').onMoveCamera();
                //点击  点击之后
                this.showClick(function () {
                    // this.Buildingdormitory1();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },

    Buildingdormitory1: function () {
        //出人
        this.showPersonnel(this.dialogNode, null, function () { }.bind(this));
        //美女助理：“啊！惨了耶！今天公司新人来报道的事忘的一干二净了！”
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[1], function () {
                this.showClick(function () {
                    this.PlayerTalk('       ...!', () => {
                        this.Buildingdormitory2()
                    });
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    //玩家切入讲话
    PlayerTalk: function (_playerTalk, _talkEndCallback) {
        this.hidePersonnel(this.dialogNode, this.nodeName[0], function () {
            this.showPersonnel(this.dialogNode, this.nodeName[3], function () {
            }.bind(this));
            //玩家：“…”

            this.showDialogDetail(this.dialogNode, '我', function () {
                this.TypingAni(this.DialogDetail.getComponent(cc.Label), _playerTalk, function () {
                    this.showClick(function () {
                        if (_talkEndCallback)
                            _talkEndCallback();
                    }.bind(this));
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    Buildingdormitory2: function () {

        this.hidePersonnel(this.dialogNode, this.nodeName[1], function () {
            this.showPersonnel(this.dialogNode, this.nodeName[0], function () {
            }.bind(this));
            //美女助理：“对不起！第一天上班还要麻烦总裁亲自安排住宿这种事，真是不好意思。”
            //美女助理心里嘀咕：“搞不好第一天上班就要被辞退了呀！我要打起120分的精神！”。
            this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
                this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[2], function () {
                    this.showClick(function () {
                        this.removeNode();
                    }.bind(this));
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },

    //全恢复了就可以去劳动了。是不是
    pickUp: function (_pickUpDialogue) {
        this.hidePersonnel(this.dialogNode, this.nodeName[0], function () {
            //出人
            this.showPersonnel(this.dialogNode, this.nodeName[1], function () {
            }.bind(this));
            //出名字 说话内容
            this.showDialogDetail(this.dialogNode, '员工', function () {
                //打字效果
                this.TypingAni(this.DialogDetail.getComponent(cc.Label), _pickUpDialogue, function () {
                    //点击  点击之后
                    this.showClick(function () {
                        this.removeNode();
                    }.bind(this));
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    //农田第一次被别人买的时候
    buyFarming: function () {
        //移动camera 到农田对应位置
        cc.find('GameNode/ManageTask').getComponent('ManageTask').onMovePayFarmland();
        //出人
        this.showPersonnel(this.dialogNode, this.nodeName[2], function () {
        }.bind(this));
        //出名字 说话内容
        this.showDialogDetail(this.dialogNode, this.dialogName[1], function () {
            //打字效果
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[4], function () {

                this.showClick(function () {
                    this.buyFarming1();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    buyFarming1: function (callback) {
        //出人
        this.hidePersonnel(this.dialogNode, this.nodeName[2], function () {
            //出人
            this.showPersonnel(this.dialogNode, null, function () {
            }.bind(this));
            //出名字 说话内容
            this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
                //打字效果
                this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[5], function () {
                    //点击  点击之后
                    this.showClick(function () {
                        this.removeNode();
                    }.bind(this));
                }.bind(this));
            }.bind(this));
        }.bind(this));

    },



    //创建农田 任务1
    creatorFarming: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[6], function () {
                this.showClick(function () {
                    this.removeNode();
                }.bind(this));
            }.bind(this));
        }.bind(this));

    },


    //铺路 任务
    pave: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[26], function () {
                this.showClick(function () {
                    this.pave1();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    pave1: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[27], function () {
                this.showClick(function () {
                    this.removeNode();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    //铺路结束
    paveEnd: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[28], function () {
                this.showClick(function () {
                    this.removeNode();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    //招聘 任务开始
    // Recruit: function () {
    //     this.showPersonnel(this.dialogNode, null, function () {
    //
    //     }.bind(this));
    //     this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
    //         this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[7], function () {
    //             this.showClick(function () {
    //                 this.PlayerTalk(this.dialogue[24], () => {
    //                     this.Recruit2();
    //                 });
    //             }.bind(this));
    //         }.bind(this));
    //     }.bind(this));
    // },
    Recruit: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[29], function () {
                this.showClick(function () {
                    this.removeNode();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    Recruit2: function () {
        this.hidePersonnel(this.dialogNode, this.nodeName[1], function () {
            this.showPersonnel(this.dialogNode, this.nodeName[0], function () {
            }.bind(this));
            //美女助理：“对不起！第一天上班还要麻烦总裁亲自安排住宿这种事，真是不好意思。”
            //美女助理心里嘀咕：“搞不好第一天上班就要被辞退了呀！我要打起120分的精神！”。
            this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
                this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[29], function () {
                    this.showClick(function () {
                        this.removeNode();
                    }.bind(this));
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    // Recruit1: function () {
    //     this.showPersonnel(this.dialogNode, null, function () {

    //     }.bind(this));
    //     this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
    //         this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[24], function () {
    //             this.showClick(function () {
    //                 this.removeNode();
    //             }.bind(this));
    //         }.bind(this));
    //     }.bind(this));
    // },

    //任务分享游戏对话
    Share1: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[31], function () {
                this.showClick(function () {
                    this.PlayerTalk(this.dialogue[32], () => {
                        // this.Share2();
                        this.removeNode();
                    });
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    // Share2: function () {
    //     this.hidePersonnel(this.dialogNode, this.nodeName[1], function () {
    //         this.showPersonnel(this.dialogNode, this.nodeName[0], function () {
    //         }.bind(this));
    //         //美女助理：“对不起！第一天上班还要麻烦总裁亲自安排住宿这种事，真是不好意思。”
    //         //美女助理心里嘀咕：“搞不好第一天上班就要被辞退了呀！我要打起120分的精神！”。
    //         this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
    //             this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[33], function () {
    //                 this.showClick(function () {
    //                     this.removeNode();
    //                 }.bind(this));
    //             }.bind(this));
    //         }.bind(this));
    //     }.bind(this));
    // },

    //再创建一个农舍 任务3
    Buildingdormitorytoo: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[8], function () {
                this.showClick(function () {
                    this.removeNode();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    //收取钻石 任务4
    getDiamonds: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[9], function () {
                this.showClick(function () {
                    this.removeNode();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    //每日签到 任务5
    EveryDay: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[11], function () {
                this.showClick(function () {
                    this.removeNode();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    //抽奖 任务6
    goodluck: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[12], function () {
                this.showClick(function () {
                    this.removeNode();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    //得到3000元 任务7
    get3K: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[13], function () {
                this.showClick(function () {
                    this.removeNode();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    //创建一个加工厂 任务8
    creatorProcessingfactory: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[14], function () {
                this.showClick(function () {
                    this.removeNode();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    //创建商店 任务9
    creatorShop: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[15], function () {
                this.showClick(function () {
                    this.removeNode();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    //创建绿化带 任务10
    creatorGreen: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[16], function () {
                this.showClick(function () {
                    this.creatorGreen1();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    creatorGreen1: function () {
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[17], function () {
                this.showClick(function () {
                    this.creatorGreen2();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    creatorGreen2: function () {
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[25], function () {
                this.showClick(function () {
                    this.removeNode();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    creatorEnd: function () {
        this.showPersonnel(this.dialogNode, null, function () {

        }.bind(this));
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[19], function () {
                this.showClick(function () {
                    this.creatorEnd1();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    creatorEnd1: function () {
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[20], function () {
                this.showClick(function () {
                    this.creatorEnd2();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    creatorEnd2: function () {
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[21], function () {
                this.showClick(function () {
                    this.creatorEnd3();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    creatorEnd3: function () {
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[22], function () {
                this.showClick(function () {
                    this.creatorEnd4();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },
    creatorEnd4: function () {
        this.showDialogDetail(this.dialogNode, this.dialogName[0], function () {
            this.TypingAni(this.DialogDetail.getComponent(cc.Label), this.dialogue[23], function () {
                this.showClick(function () {
                    this.removeNode();
                }.bind(this));
            }.bind(this));
        }.bind(this));
    },

    showClick: function (callback) {
        var infoclick = UtilsPrefabs.getNode("infoclick", this.BGDetail);
        infoclick.active = true;
        var SureBtn = UtilsPrefabs.getNode("SureBtn", this.dialogNode);
        SureBtn.active = true;
        UtilsPrefabs.setOn(SureBtn, function () {
            // console.log("显示完毕");
            SureBtn.active = false;
            infoclick.active = false;
            UtilsPrefabs.setOff(SureBtn);
            if (callback != null) {
                callback();
            }
        }.bind(this));

    },


    //渐变 人 左面或者 右面 用名字控制
    showPersonnel: function (node, nodeName, callback) {
        if (nodeName == null) {
            nodeName = "secretary";
        }
        node.getComponent('Dialog').onSetCharacterSprite(nodeName);
        var Character = UtilsPrefabs.getNode("character", node);

        var fadeIn = cc.fadeTo(0.5, 255);
        var finished = cc.callFunc(function () {

            if (callback != null) {
                callback();
            }
        }.bind(this));
        var s = cc.sequence(fadeIn, finished);
        Character.runAction(s);
    },
    hidePersonnel: function (node, nodeName, callback) {
        if (nodeName == null) {
            nodeName = "secretary";
        }
        node.getComponent('Dialog').onSetCharacterSprite(nodeName);
        var Character = UtilsPrefabs.getNode("character", node);

        var fadeIn = cc.fadeTo(0.5, 0);
        var finished = cc.callFunc(function () {
            if (callback != null) {
                callback();
            }
        }.bind(this));
        var s = cc.sequence(fadeIn, finished);
        Character.runAction(s);

    },
    //显示 对话
    showDialogDetail: function (node, name, callback) {
        var DialogBG = this.DialogBG = UtilsPrefabs.getNode("DialogBG", node);

        var BGname = UtilsPrefabs.getNode("BGname", DialogBG);
        var DialogName = UtilsPrefabs.getNode("DialogName", BGname);
        DialogName.getComponent(cc.Label).string = name;
        var fadeIn = cc.fadeIn(1);
        if (this.showDialogDetailTag) {
            if (callback != null) {
                callback();
            }
        }
        var finished = cc.callFunc(function () {
            if (!this.showDialogDetailTag) {
                this.showDialogDetailTag = true
                if (callback != null) {
                    callback();
                }
            }
            // console.log("显示完毕写文字了吗");

        }.bind(this));
        var s = cc.sequence(fadeIn, finished);
        BGname.runAction(s);


        var BGDetail = this.BGDetail = UtilsPrefabs.getNode("BGDetail", DialogBG);
        var DialogDetail = this.DialogDetail = UtilsPrefabs.getNode("DialogDetail", BGDetail);
        DialogName.getComponent(cc.Label).string = name;
        var DetailfadeIn = cc.fadeIn(1);

        BGDetail.runAction(DetailfadeIn);

    },


    TypingAni: function (label, text, callback) {
        var self = this;
        var html = '';
        var arr = text.split('');
        var len = arr.length;
        var step = 0;
        self.func = function () {
            html += arr[step];
            label.string = html;
            if (++step == len) {
                // self.unschedule(self.func, self);
                clearInterval(this.Intervalid);
                callback && callback(self);
            }
        }.bind(this)
        this.Intervalid = setInterval(self.func, this.IntervalidTimeout)
        // self.schedule(self.func,0.05, cc.macro.REPEAT_FOREVER, 0)
    },
    removeNode: function (node) {
        if (node != null) {
            node.destroy();
        } else if (this.dialogNode != null) {
            this.dialogNode.destroy();
            if (this.closeDialogCallBack != null) {
                this.closeDialogCallBack();
                this.closeDialogCallBack = null;
            }
        }
    },

    //关闭dialog 的回调
    setOnCloseDialog: function (closeDialogCallBack) {
        this.closeDialogCallBack = closeDialogCallBack;
    },
    closeDialogCallBack: function () {

    },



    // update (dt) {},
};
