window.__require = function e(t, n, r) {
  function s(o, u) {
    if (!n[o]) {
      if (!t[o]) {
        var b = o.split("/");
        b = b[b.length - 1];
        if (!t[b]) {
          var a = "function" == typeof __require && __require;
          if (!u && a) return a(b, !0);
          if (i) return i(b, !0);
          throw new Error("Cannot find module '" + o + "'");
        }
        o = b;
      }
      var f = n[o] = {
        exports: {}
      };
      t[o][0].call(f.exports, function(e) {
        var n = t[o][1][e];
        return s(n || e);
      }, f, f.exports, e, t, n, r);
    }
    return n[o].exports;
  }
  var i = "function" == typeof __require && __require;
  for (var o = 0; o < r.length; o++) s(r[o]);
  return s;
}({
  scene: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "1e6c5bmzb5Cw7tGU+6pyb+T", "scene");
    "use strict";
    var _util = require("./util");
    function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
      try {
        var info = gen[key](arg);
        var value = info.value;
      } catch (error) {
        reject(error);
        return;
      }
      info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
    }
    function _asyncToGenerator(fn) {
      return function() {
        var self = this, args = arguments;
        return new Promise(function(resolve, reject) {
          var gen = fn.apply(self, args);
          function _next(value) {
            asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
          }
          function _throw(err) {
            asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
          }
          _next(void 0);
        });
      };
    }
    cc.Class({
      extends: cc.Component,
      properties: {
        baseWidth: {
          default: 1280,
          type: cc.Integer
        },
        baseHeight: {
          default: 720,
          type: cc.Integer
        }
      },
      onLoad: function onLoad() {
        console.log(" in onload");
        cc.debug.setDisplayStats(false);
        this.initSceneData();
        this.initSize();
      },
      initSceneData: function initSceneData() {
        this._imageResList = [];
        this._audioResList = [];
        this._animaResList = [];
      },
      _designSize: null,
      _frameSize: null,
      _mapScaleMin: null,
      _mapScaleMax: null,
      _cocosScale: null,
      canvas: null,
      initSize: function initSize() {
        var screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height;
        var design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height;
        var f = screen_size >= design_size;
        cc.Canvas.instance.fitHeight = f;
        cc.Canvas.instance.fitWidth = !f;
        var frameSize = cc.view.getFrameSize();
        this._frameSize = frameSize;
        this._designSize = cc.view.getDesignResolutionSize();
        var sx = cc.winSize.width / frameSize.width;
        var sy = cc.winSize.height / frameSize.height;
        this._cocosScale = Math.min(sx, sy);
        sx = frameSize.width / this._designSize.width;
        sy = frameSize.height / this._designSize.height;
        this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
        this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
        this.canvas = cc.find("Canvas");
      },
      isTeacher: null,
      serverAllUser: null,
      start: function start() {
        var _this = this;
        var getData = this.getData.bind(this);
        window && window.courseware && (getData = window.courseware.getData);
        getData(function(data, aspect) {
          var _window$air, _window$air$airClassI, _window$air$airClassI2;
          "tea" == (null == (_window$air = window["air"]) ? void 0 : null == (_window$air$airClassI = _window$air.airClassInfo) ? void 0 : null == (_window$air$airClassI2 = _window$air$airClassI.user) ? void 0 : _window$air$airClassI2.classRole) && (_this.isTeacher = true);
          if (aspect) {
            console.log("aspect : ", aspect);
            _this.serverAllUser = aspect.all_user;
            _this.initPageData(aspect);
          }
          console.log("data:", data);
          _this.data = data || _this.getDefaultData();
          _this.preloadItem();
        });
      },
      jumpId: null,
      checkIsJump: function checkIsJump() {
        var arr = this.serverAllUser;
        for (var i = 0; i < arr.length; i++) if ("tea" == arr[i].user.classRole) {
          var aspectData = JSON.parse(arr[i].aspect || "{}");
          aspectData && "jump" == aspectData.name && (this.jumpId = aspectData.id);
          return;
        }
      },
      pageData: null,
      initPageData: function initPageData(aspect) {
        var _aspect$page_aspect;
        var pageDataStr = null == aspect ? void 0 : null == (_aspect$page_aspect = aspect.page_aspect) ? void 0 : _aspect$page_aspect.pagedata;
        this.pageData = pageDataStr ? JSON.parse(pageDataStr) : {};
        console.log("this.pageData: ", this.pageData);
      },
      setPageData: function setPageData(key, value) {
        if (this.pageData) {
          this.pageData[key] = value;
          this.sendPageData();
        }
      },
      getPageData: function getPageData(key) {
        if (this.pageData && this.pageData[key]) return this.pageData[key];
      },
      sendPageData: function sendPageData() {
        var data = this.pageData;
        if (window && window.courseware) {
          var storePageAspect = window.courseware.storePageAspect;
          if (storePageAspect) {
            storePageAspect(data);
            console.log("storePageAspect : ", data);
          }
        }
      },
      _imageResList: null,
      _audioResList: null,
      _animaResList: null,
      preloadItem: function preloadItem() {
        this.preload();
      },
      getData: function getData(func) {
        func(this.getDefaultData());
      },
      getDefaultData: function getDefaultData() {
        var dataJson = '{"customAction":{"type":"text","changeStart":[["color","#ff00ff"],["size","30px"]],"changeEnd":[["color","#ffffff"],["size","33px"]],"changeTime":"0.5","pic_url":"http://staging-teach.cdn.ireadabc.com/071c713ba8b0bc9c6399a42ac8811082.png","text":"aaaa"},"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/c2cb9a9f65af3b853e57a22a6602e481.png","rect":{"x":209.51,"y":0,"width":851.97,"height":479}},"hotZoneItemArr":[{"id":"1614839864479","index":0,"audio_url":"http://staging-teach.cdn.ireadabc.com/32258b839eca32b6ccf94f3dd6c86e0c.mp3","itemType":"rect","fontScale":0.99296875,"imgScale":1,"mapScale":0.99296875,"gIdx":"2","rect":{"x":554.19,"y":138.28,"width":76.37,"height":72.85}},{"id":"1614840901996","index":1,"pic_url":"http://staging-teach.cdn.ireadabc.com/c8abf7383d65bcbdba8f390785cece60.png","itemType":"pic","fontScale":0.99296875,"imgScale":0.4963768115942029,"mapScale":0.99296875,"gIdx":"1","rect":{"x":699.35,"y":162.22,"width":137,"height":137}},{"id":"1614840912007","index":2,"audio_url":"http://staging-teach.cdn.ireadabc.com/85cff126986f5cc11b05e95181da5869.mp3","itemType":"text","fontScale":0.99296875,"imgScale":1,"mapScale":0.99296875,"gIdx":"3","actionData_3":{"type":"text","changeStart":[],"changeEnd":[],"changeTime":0.3,"changeOption":[["fontColor","#00ffff","#00ffff"],["fontSize","100","100"],["opacity","0","100"]],"text":"dddddg","audio_url":"http://staging-teach.cdn.ireadabc.com/5285e1e88a26a08783757e9c43a8653f.mp3"},"rect":{"width":371.17,"height":99.3,"x":306.63,"y":8.14}},{"id":"1614842879059","index":3,"audio_url":"http://staging-teach.cdn.ireadabc.com/cd8daa8b4d8ff707b3a3680e80bc4761.mp3","itemType":"rect","fontScale":0.99296875,"imgScale":1,"mapScale":0.99296875,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c5c80dbe4df2fe619f67b4d8a99d15c8.json","name":"a_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/df141aa05ea55b3835ef2ebfc6685d48.json","name":"a_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/adbfe4292df235154c88737fe22cdba0.png","name":"a_tex.png"},"gIdx":"0","rect":{"x":111.27,"y":277.23,"width":76.31,"height":76.31}},{"id":"1614932660076","index":4,"itemType":"pic","fontScale":0.99296875,"imgScale":1.134480587666508,"mapScale":0.99296875,"gIdx":"4","actionData_4":{"type":"pic","skeJsonData":{},"texJsonData":{},"texPngData":{},"changeStart":[],"changeEnd":[],"changeTime":0.3,"changeOption":[["scale","1"],["opacity","50","100"]],"pic_url":"http://staging-teach.cdn.ireadabc.com/97eb28e4c023f92efde4310d590be985.png","audio_url":"http://staging-teach.cdn.ireadabc.com/c693181b18d5b8e018cdd0dbbd8a8466.mp3"},"rect":{"x":715.92,"y":310,"width":110.04,"height":144.08}},{"id":"1616741577774","index":5,"itemType":"rect","fontScale":0.99296875,"imgScale":1,"mapScale":0.99296875,"gIdx":"5","actionData_5":{"type":"anima","skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c5c80dbe4df2fe619f67b4d8a99d15c8.json","name":"a_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/df141aa05ea55b3835ef2ebfc6685d48.json","name":"a_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/adbfe4292df235154c88737fe22cdba0.png","name":"a_tex.png"},"changeStart":[],"changeEnd":[],"changeTime":0.3,"changeOption":[["scale","1"],["opacity","0","100"]],"audio_url":"http://staging-teach.cdn.ireadabc.com/c693181b18d5b8e018cdd0dbbd8a8466.mp3"},"rect":{"x":11.48,"y":7,"width":147.01,"height":147.01}}],"title":"Look and Say","title_audio_url":"http://staging-teach.cdn.ireadabc.com/85cff126986f5cc11b05e95181da5869.mp3"}';
        var data1 = JSON.parse(dataJson);
        return data1;
      },
      preload: function preload() {
        var _this2 = this;
        var preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
        cc.assetManager.loadAny(preloadArr, null, null, function(err, data) {
          _this2.addServerListener();
          window && window["air"] && window["air"].hideAirClassLoading();
        });
      },
      addPreloadImage: function addPreloadImage() {
        var _this3 = this;
        this.data.bgItem && this._imageResList.push({
          url: this.data.bgItem.url
        });
        if (!this.data.hotZoneItemArr) return;
        this.data.hotZoneItemArr.forEach(function(item) {
          item.pic_url && _this3._imageResList.push({
            url: item.pic_url
          });
        });
      },
      addPreloadAudio: function addPreloadAudio() {
        var _this4 = this;
        this._audioResList.push({
          url: this.data.title_audio_url || ""
        });
        if (!this.data.hotZoneItemArr) return;
        this.data.hotZoneItemArr.forEach(function(item) {
          _this4._audioResList.push({
            url: item.audio_url
          });
        });
      },
      addPreloadAnima: function addPreloadAnima() {
        var _this5 = this;
        if (!this.data.hotZoneItemArr) return;
        this.data.hotZoneItemArr.forEach(function(item) {
          if (item.skeJsonData) {
            _this5._animaResList.push({
              url: item.skeJsonData.url || ""
            });
            _this5._animaResList.push({
              url: item.texJsonData.url || ""
            });
            _this5._animaResList.push({
              url: item.texPngData.url || ""
            });
          }
        });
      },
      loadEnd: function loadEnd() {
        console.log("bbb");
        this.initData();
        this.initView();
      },
      initMusic: function initMusic() {
        cc.assetManager.loadRemote(this.data.bg_audio_url, function(err, clip) {
          cc.audioEngine.setMusicVolume(.3);
          var audioID = cc.audioEngine.playMusic(clip, true);
        });
      },
      isDebug: null,
      treeType: null,
      treeTypeArr: null,
      typeIndex: null,
      btnArr: null,
      fruitArr: null,
      modelLevel: null,
      initData: function initData() {
        this.treeTypeArr = [ "apple", "banana", "orange" ];
        this.typeIndex = 0;
        this.treeType = this.treeTypeArr[0];
        this.initAudioEffect();
      },
      bgClip: null,
      walkClip: null,
      appearClip: null,
      magicClip: null,
      realFruitClip: null,
      popClip: null,
      btnStarClip: null,
      stripClip: null,
      goodjobClip: null,
      clickClip: null,
      tipClip: null,
      finishClip: null,
      appleClip: null,
      bananaClip: null,
      orangeClip: null,
      appleSentenceClip: null,
      bananaSentenceClip: null,
      orangeSentenceClip: null,
      appleGroupClip: null,
      bananaGroupClip: null,
      orangeGroupClip: null,
      initAudioEffect: function initAudioEffect() {
        this.bgClip = cc.find("Canvas/res/audio/bg").getComponent(cc.AudioSource).clip;
        this.walkClip = cc.find("Canvas/res/audio/walk").getComponent(cc.AudioSource).clip;
        this.appearClip = cc.find("Canvas/res/audio/fruit_appear").getComponent(cc.AudioSource).clip;
        this.magicClip = cc.find("Canvas/res/audio/magic_appear").getComponent(cc.AudioSource).clip;
        this.realFruitClip = cc.find("Canvas/res/audio/real_fruit").getComponent(cc.AudioSource).clip;
        this.btnStarClip = cc.find("Canvas/res/audio/btn_star").getComponent(cc.AudioSource).clip;
        this.popClip = cc.find("Canvas/res/audio/pop").getComponent(cc.AudioSource).clip;
        this.stripClip = cc.find("Canvas/res/audio/strip").getComponent(cc.AudioSource).clip;
        this.goodjobClip = cc.find("Canvas/res/audio/goodjob").getComponent(cc.AudioSource).clip;
        this.clickClip = cc.find("Canvas/res/audio/click").getComponent(cc.AudioSource).clip;
        this.tipClip = cc.find("Canvas/res/audio/tip").getComponent(cc.AudioSource).clip;
        this.finishClip = cc.find("Canvas/res/audio/finish").getComponent(cc.AudioSource).clip;
        this.appleClip = cc.find("Canvas/res/audio/apple").getComponent(cc.AudioSource).clip;
        this.bananaClip = cc.find("Canvas/res/audio/banana").getComponent(cc.AudioSource).clip;
        this.orangeClip = cc.find("Canvas/res/audio/orange").getComponent(cc.AudioSource).clip;
        this.appleSentenceClip = cc.find("Canvas/res/audio/sentence_apples").getComponent(cc.AudioSource).clip;
        this.bananaSentenceClip = cc.find("Canvas/res/audio/sentence_bananas").getComponent(cc.AudioSource).clip;
        this.orangeSentenceClip = cc.find("Canvas/res/audio/sentence_oranges").getComponent(cc.AudioSource).clip;
        this.appleGroupClip = [];
        this.appleGroupClip[0] = cc.find("Canvas/res/audio/drop_group/apple1").getComponent(cc.AudioSource).clip;
        this.appleGroupClip[1] = cc.find("Canvas/res/audio/drop_group/apple2").getComponent(cc.AudioSource).clip;
        this.appleGroupClip[2] = cc.find("Canvas/res/audio/drop_group/apple3").getComponent(cc.AudioSource).clip;
        this.bananaGroupClip = [];
        this.bananaGroupClip[0] = cc.find("Canvas/res/audio/drop_group/banana1").getComponent(cc.AudioSource).clip;
        this.bananaGroupClip[1] = cc.find("Canvas/res/audio/drop_group/banana2").getComponent(cc.AudioSource).clip;
        this.bananaGroupClip[2] = cc.find("Canvas/res/audio/drop_group/banana3").getComponent(cc.AudioSource).clip;
        this.orangeGroupClip = [];
        this.orangeGroupClip[0] = cc.find("Canvas/res/audio/drop_group/orange1").getComponent(cc.AudioSource).clip;
        this.orangeGroupClip[1] = cc.find("Canvas/res/audio/drop_group/orange2").getComponent(cc.AudioSource).clip;
        this.orangeGroupClip[2] = cc.find("Canvas/res/audio/drop_group/orange3").getComponent(cc.AudioSource).clip;
      },
      playBgMusic: function playBgMusic() {
        var _this6 = this;
        (0, _util.playAudio)(this.bgClip, function() {
          _this6.playBgMusic();
        });
      },
      sendServerEvent: function sendServerEvent(key, data) {
        if (this.isDebug) {
          this.addServerListenerTest(key, data);
          return;
        }
        var c = window.courseware;
        c && c.sendEvent(key, data);
      },
      addServerListener: function addServerListener() {
        var _this7 = this;
        console.log(" in addServerListener");
        var gameStart = function gameStart() {
          console.log("in gameStart");
          _this7.showTemplateStartAnima();
          _this7.loadEnd();
        };
        window.air && (window.air.onCourseInScreen = function(next) {
          gameStart();
          next();
        });
        var c = window.courseware;
        if (!c) return;
        c.onEvent("fruit_panel_sound_click", function(data, next) {
          console.log("in fruit_panel_sound_click : ", data);
          _this7.fruitPanelSoundClick();
          next();
        });
        c.onEvent("sentence_panel_sound_click", function(data, next) {
          console.log("in sentence_panel_sound_click : ", data);
          _this7.sentencePanelSoundClick();
          next();
        });
        c.onEvent("word_layer_sound_click", function(data, next) {
          console.log("in word_layer_sound_click : ", data);
          _this7.wordLayerSoundClick();
          next();
        });
        c.onEvent("sentence_layer_sound_click", function(data, next) {
          console.log("in sentence_layer_sound_click : ", data);
          _this7.sentenceLayerSoundClick();
          next();
        });
        c.onEvent("fruit_panel_speak_click", function(data, next) {
          console.log("in fruit_panel_speak_click : ", data);
          _this7.fruitPanelSpeakClick();
          next();
        });
        c.onEvent("sentence_panel_speak_click", function(data, next) {
          console.log("in sentence_panel_speak_click : ", data);
          _this7.sentencePanelSpeakClick();
          next();
        });
        c.onEvent("chinese_btn_click", function(data, next) {
          console.log("in chinese_btn_click : ", data);
          _this7.chineseBtnClick();
          next();
        });
        c.onEvent("bottom_tip_btn_click", function(data, next) {
          console.log("in bottom_tip_btn_click : ", data);
          _this7.bottomTipBtnClick(data.btnIndex);
          next();
        });
        c.onEvent("next_btn_click", function(data, next) {
          console.log("in next_btn_click : ", data);
          _this7.nextBtnClick();
          next();
        });
        c.onEvent("jump_btn_click", function(data, next) {
          console.log("in jump_btn_click : ", data);
          _this7.jumpBtnClick(data.id);
          next();
        });
      },
      addServerListenerTest: function addServerListenerTest(event, data) {
        console.log("event: ", event);
        console.log("data: ", data);
        switch (event) {
         case "fruit_panel_sound_click":
          this.fruitPanelSoundClick();
          break;

         case "sentence_panel_sound_click":
          this.sentencePanelSoundClick();
          break;

         case "word_layer_sound_click":
          this.wordLayerSoundClick();
          break;

         case "sentence_layer_sound_click":
          this.sentenceLayerSoundClick();
          break;

         case "fruit_panel_speak_click":
          this.fruitPanelSpeakClick();
          break;

         case "sentence_panel_speak_click":
          this.sentencePanelSpeakClick();
          break;

         case "chinese_btn_click":
          this.chineseBtnClick();
          break;

         case "bottom_tip_btn_click":
          this.bottomTipBtnClick(data.btnIndex);
          break;

         case "next_btn_click":
          this.nextBtnClick();
        }
      },
      showTemplateStartAnima: function showTemplateStartAnima() {
        var resDragonBone = cc.find("Canvas/res/anima/pageturn");
        var pageturn = cc.instantiate(resDragonBone);
        pageturn.scale = this._mapScaleMax;
        var canvas = cc.find("Canvas");
        canvas.addChild(pageturn, 100);
        var dragonDisplay = pageturn.getComponent(dragonBones.ArmatureDisplay);
        dragonDisplay.on(dragonBones.EventObject.COMPLETE, function() {
          pageturn.removeFromParent();
        });
        dragonDisplay.playAnimation("pageturn2", 1);
      },
      showTemplateEndAnima: function showTemplateEndAnima() {
        var _this8 = this;
        var resDragonBone = cc.find("Canvas/res/anima/pageturn");
        var pageturn = cc.instantiate(resDragonBone);
        pageturn.scale = this._mapScaleMax;
        var canvas = cc.find("Canvas");
        canvas.addChild(pageturn, 100);
        var dragonDisplay = pageturn.getComponent(dragonBones.ArmatureDisplay);
        dragonDisplay.on(dragonBones.EventObject.COMPLETE, function() {
          cc.tween({}).delay(1).call(function() {
            window && window.courseware && _this8.isTeacher && window.courseware.nextPage();
          }).start();
        });
        dragonDisplay.playAnimation("pageturn", 1);
      },
      initView: function initView() {
        this.initBg();
        this.initTree();
        this.initNextBtn();
        this.initRole();
        this.initMagicBasket();
        this.setCurStopX();
        this.initTitle();
        this.initWordLayer();
        this.initSentenceLayer();
        this.initGoodJobLayer();
        this.initEndLayer();
        this.initJumpBtn();
        this.playBgMusic();
        this.refreshStateByPageData();
        cc.debug.setDisplayStats(true);
      },
      jumpBtnArr: null,
      jumpBtnLayer: null,
      initJumpBtn: function initJumpBtn() {
        this.jumpBtnLayer = new cc.Node();
        this.jumpBtnLayer.opacity = 0;
        this.canvas.addChild(this.jumpBtnLayer, 20);
        this.jumpBtnArr = [];
        var baseX = -this.canvas.width / 2 + 70 * this._mapScaleMin;
        var baseY = this.canvas.height / 2 - 100 * this._mapScaleMin;
        var disW = 50 * this._mapScaleMin;
        for (var i = 1; i <= 3; i++) {
          var btn = this.getJumpBtn(i);
          btn.x = baseX + i * disW;
          btn.y = baseY;
          this.jumpBtnLayer.addChild(btn, 10);
          this.jumpBtnArr.push(btn);
        }
        this.isTeacher || (this.jumpBtnLayer.active = false);
      },
      getJumpBtn: function getJumpBtn(id) {
        var _this9 = this;
        var btn = (0, _util.getSprNode)("jump_btn/btn_" + id);
        btn.scale = this._mapScaleMin;
        btn.id = id;
        btn.addComponent(cc.Button);
        btn.on("click", function() {
          if (_this9.jumpBtnLayer.opacity < 1) return;
          _this9.setState(1 + 3 * (id - 1), {}, true);
          _this9.sendServerEvent("jump_btn_click", {
            name: "jump",
            id: id
          });
        });
        var btnLight = (0, _util.getSprNode)("jump_btn/btn_" + id + "click");
        btn.addChild(btnLight);
        btnLight.opacity = 0;
        btn.light = btnLight;
        return btn;
      },
      hideAllJumpBtn: function hideAllJumpBtn() {
        for (var i = 0; i < this.jumpBtnArr.length; i++) this.jumpBtnArr[i].light.opacity = 0;
      },
      jumpBtnClick: function jumpBtnClick(id) {
        if (this.jumpBtnLayer.opacity < 1) return;
        this.hideJumpBtnLayer();
        this.hideFruitPanel();
        this.hideSentencePanel();
        this.typeIndex = id - 1;
        var type = this.treeTypeArr[this.typeIndex];
        this.treeType = type;
        this.setCurStopX();
        this.resetMagicBasket();
        this.jumpStep(id);
      },
      jumpStep: function jumpStep(id) {
        var jumpBtn = this.jumpBtnArr[id - 1];
        var step = 1;
        switch (jumpBtn.id) {
         case 1:
          step = 1;
          break;

         case 2:
          step = 4;
          break;

         case 3:
          step = 7;
        }
        switch (step) {
         case 1:
          this.stopAppleTreeState();
          break;

         case 4:
          this.stopBananaTreeState();
          break;

         case 7:
          this.stopOrangeTreeState();
        }
      },
      showJumpBtnLayer: function showJumpBtnLayer() {
        console.log(" in showJumpBtnLayer");
        this.hideAllJumpBtn();
        var id = this.typeIndex + 1;
        var jumpBtn = this.jumpBtnArr[id - 1];
        jumpBtn.light.opacity = 255;
        this.jumpBtnLayer.opacity = 255;
      },
      hideJumpBtnLayer: function hideJumpBtnLayer() {
        this.jumpBtnLayer.opacity = 0;
      },
      state: null,
      initState: function initState() {
        this.state = {};
        var stateData = {};
        this.setState(0, stateData);
        return this.state;
      },
      setState: function setState(step, stepData, isForce) {
        void 0 === stepData && (stepData = {});
        void 0 === isForce && (isForce = false);
        console.log("this.state: ", JSON.stringify(this.state));
        if (null != this.state.step && step < this.state.step && !isForce) return;
        console.log("this.state success ");
        this.state.step = step;
        this.state.stepData = stepData;
        this.setPageData("state", this.state);
      },
      refreshStateByPageData: function refreshStateByPageData() {
        var state = this.getPageData("state");
        state || (state = this.initState());
        this.state = state;
        console.log("state: ", state);
        var _state = state, step = _state.step, stepData = _state.stepData;
        switch (step) {
         case 0:
          this.startState();
          break;

         case 1:
          this.stopAppleTreeState();
          break;

         case 2:
          this.showFruitPanelState(stepData);
          break;

         case 3:
          this.moveBananaTreeState();
          break;

         case 4:
          this.stopBananaTreeState();
          break;

         case 5:
          this.showBananaPanelState(stepData);
          break;

         case 6:
          this.moveOrangeTreeState();
          break;

         case 7:
          this.stopOrangeTreeState();
          break;

         case 8:
          this.showOrangePanelState(stepData);
          break;

         case 9:
          this.showEndLayerState();
        }
      },
      startState: function startState() {
        this.roleMove();
      },
      stopAppleTreeState: function stopAppleTreeState() {
        this.role.x = this.curStopX;
        this.setMapPosByRolePos();
        this.roleMoveEnd();
      },
      showFruitPanelState: function showFruitPanelState(data) {
        this.role.x = this.curStopX;
        this.setMapPosByRolePos();
        this.roleIdle();
        var fruitPanel = this.getFruitPanel();
        fruitPanel.x = this.role.x + 600;
        fruitPanel.y = this.role.y - 80;
        fruitPanel.parent = this.role.parent;
        fruitPanel.anchorX = 1;
        fruitPanel.zIndex = 1e3;
        this.curFruitPanel = fruitPanel;
        this.showTi(2);
        var sentencePanel = this.getSentencePanel();
        sentencePanel.anchorX = 0;
        sentencePanel.anchorY = 0;
        sentencePanel.x = 60;
        sentencePanel.y = 80;
        this.curSentencePanel = sentencePanel;
        this.role.addChild(sentencePanel);
        console.log("data: ", data);
        data.isHideFruitSpeak && (this.curFruitPanel.speakIcon.active = false);
        data.isHideSentenceSpeak && (this.curSentencePanel.speakIcon.active = false);
        if (data.isShowWordLayer) {
          this.resetWordLayer();
          this.showWordLayer();
          if (data.finishStarBtnArr) {
            var arr = data.finishStarBtnArr;
            for (var i = 0; i < arr.length; i++) {
              var btnIndex = arr[i];
              var btn = this.wordLayer.tiBtnArr[btnIndex];
              this.showWordLayerStar(btn.starNum);
              this.addSmallBasketFruit();
            }
          }
        }
        if (data.isShowSentenceLayer) {
          this.resetSentenceLayer();
          this.showSentenceLayer();
          if (data.finishStarBtnArr) {
            var _arr = data.finishStarBtnArr;
            for (var _i = 0; _i < _arr.length; _i++) {
              var _btnIndex = _arr[_i];
              var _btn = this.sentenceLayer.tiBtnArr[_btnIndex];
              this.showSentenceLayerStar(_btn.starNum);
              this.addBigBasketFruit();
            }
          }
        }
        if (data.isHideFruitSpeak && data.isHideSentenceSpeak) {
          this.hideFruitPanel();
          this.hideSentencePanel();
          this.hideCurTi();
          if (this.typeIndex > 1) this.enterNextTree(); else {
            this.showNextBtn();
            this.showTi(3);
          }
        }
        data.isHideFruitSpeak || data.isHideSentenceSpeak || this.showJumpBtnLayer();
      },
      moveBananaTreeState: function moveBananaTreeState() {
        this.role.x = this.curStopX;
        this.setMapPosByRolePos();
        this.typeIndex++;
        var type = this.treeTypeArr[this.typeIndex];
        this.treeType = type;
        this.setCurStopX();
        this.roleMove();
      },
      stopBananaTreeState: function stopBananaTreeState() {
        this.typeIndex = 1;
        var type = this.treeTypeArr[this.typeIndex];
        this.treeType = type;
        this.setCurStopX();
        this.role.x = this.curStopX;
        console.log("in stopBananaTreeState");
        this.setMapPosByRolePos();
        this.roleMoveEnd();
      },
      showBananaPanelState: function showBananaPanelState(data) {
        this.typeIndex = 1;
        this.treeType = this.treeTypeArr[this.typeIndex];
        this.setCurStopX();
        this.showFruitPanelState(data);
      },
      moveOrangeTreeState: function moveOrangeTreeState() {
        this.typeIndex = 1;
        this.treeType = this.treeTypeArr[this.typeIndex];
        this.setCurStopX();
        this.role.x = this.curStopX;
        this.setMapPosByRolePos();
        this.typeIndex++;
        this.treeType = this.treeTypeArr[this.typeIndex];
        this.setCurStopX();
        this.roleMove();
      },
      stopOrangeTreeState: function stopOrangeTreeState() {
        this.typeIndex = 2;
        this.treeType = this.treeTypeArr[this.typeIndex];
        this.setCurStopX();
        this.role.x = this.curStopX;
        this.setMapPosByRolePos();
        this.roleMoveEnd();
      },
      showOrangePanelState: function showOrangePanelState(data) {
        this.typeIndex = 2;
        this.treeType = this.treeTypeArr[this.typeIndex];
        this.setCurStopX();
        this.showFruitPanelState(data);
      },
      showEndLayerState: function showEndLayerState() {
        this.showEndLayer();
      },
      setMapPosByRolePos: function setMapPosByRolePos() {
        var oldX = this.bgGround.x;
        this.bgGround.x = -this.canvas.width / 2 - this.typeIndex * this.canvas.width;
        var disX = this.bgGround.x - oldX;
        this.bgBack.x += disX * this.bgBack.speedRate;
      },
      chineseBtn: null,
      chineseLabel: null,
      initTitle: function initTitle() {
        var _this10 = this;
        var title = (0, _util.getSprNode)("bg_title");
        title.scale = this._mapScaleMin;
        title.anchorX = 0;
        title.anchorY = 1;
        title.x = -this.canvas.width / 2 + 20 * this._mapScaleMin;
        title.y = this.canvas.height / 2 - 20 * this._mapScaleMin;
        this.canvas.addChild(title);
        var chineseBtn = cc.find("Canvas/btn_chinese");
        chineseBtn.scale = this._mapScaleMin;
        chineseBtn.x = this.canvas.width / 2 - (20 + chineseBtn.width / 2) * this._mapScaleMin;
        chineseBtn.y = this.canvas.height / 2 - (20 + chineseBtn.height / 2) * this._mapScaleMin;
        chineseBtn.active = true;
        chineseBtn.on(cc.Node.EventType.TOUCH_START, function() {
          _this10.sendServerEvent("chinese_btn_click", {});
        });
        var chineseBg = (0, _util.getSprNode)("bg_chinese");
        chineseBg.scale = this._mapScaleMin;
        chineseBg.x = chineseBtn.x + 5 * this._mapScaleMin;
        chineseBg.y = chineseBtn.y - 170 * this._mapScaleMin;
        this.canvas.addChild(chineseBg, 2);
        chineseBg.opacity = 0;
        chineseBtn.labelBg = chineseBg;
        var labelNode = new cc.Node();
        chineseBg.addChild(labelNode);
        var richText = labelNode.addComponent(cc.RichText);
        richText.string = "Dear kid, please say the word and the sentence louder to get fruit.";
        richText.fontSize = 24;
        richText.font = cc.find("Canvas/res/font/GOTHICB_1").getComponent(cc.Label).font;
        richText.maxWidth = .9 * chineseBg.width;
        labelNode.x = .05 * chineseBg.width;
        this.chineseLabel = richText;
        this.chineseBtn = chineseBtn;
        this.isTeacher || (chineseBtn.active = false);
      },
      chineseBtnClick: function chineseBtnClick() {
        this.tipClipId && cc.audioEngine.stop(this.tipClipId);
        this.speakVoice();
      },
      voiceInterval: null,
      speakVoice: function speakVoice() {
        var _this11 = this;
        var audioId = (0, _util.playAudio)(this.tipClip);
        this.tipClipId = audioId;
        this.showVoiceBg();
        var string = "Dear kid, please say the word and the sentence louder to get fruit.";
        void 0 !== this.voiceInterval && clearInterval(this.voiceInterval);
        this.voiceInterval = setInterval(function() {
          var label = _this11.chineseLabel;
          var currentTime = cc.audioEngine.getCurrentTime(audioId);
          var duration = cc.audioEngine.getDuration(audioId);
          var rate = currentTime / duration;
          var stringBeforeList = [];
          var stringAfterList = [];
          string.split(" ").forEach(function(letter, idx, list) {
            idx / list.length < rate ? stringBeforeList.push(letter) : stringAfterList.push(letter);
          });
          label.string = "<color=#9ef0ff>" + stringBeforeList.join(" ") + "</c> <color=#ffffff>" + stringAfterList.join(" ") + "</color>";
        }, 1e3 / 60);
        cc.audioEngine.setFinishCallback(audioId, function() {
          _this11.hideVoiceBg();
          clearInterval(_this11.voiceInterval);
          _this11.voiceInterval = null;
        });
      },
      showVoiceBg: function showVoiceBg() {
        if (!this.isTeacher) return;
        var bg = this.chineseBtn.labelBg;
        cc.tween(bg).to(.3, {
          opacity: 255
        }).start();
      },
      hideVoiceBg: function hideVoiceBg() {
        var bg = this.chineseBtn.labelBg;
        cc.tween(bg).to(.3, {
          opacity: 0
        }).start();
      },
      bgGround: null,
      bgBack: null,
      bgSky: null,
      groundMinX: null,
      initBg: function initBg() {
        var bgGround = cc.find("Canvas/bg_ground");
        bgGround.scale = 3 * this.canvas.width / bgGround.width;
        bgGround.x = -this.canvas.width / 2;
        bgGround.y = -this.canvas.height / 2;
        this.bgGround = bgGround;
        this.groundMinX = -this.bgGround.width * this.bgGround.scaleX + this.canvas.width / 2;
        var bgBack = cc.find("Canvas/bg_back");
        bgBack.scale = bgGround.scale;
        bgBack.x = -this.canvas.width / 2;
        bgBack.y = -this.canvas.height / 2;
        this.bgBack = bgBack;
        var backOffX = -500 * bgBack.scale;
        bgBack.speedRate = (bgBack.width + 2 * backOffX) / bgBack.width;
        bgBack.x += backOffX;
        var bgSky = cc.find("Canvas/bg_sky");
        bgSky.scaleX = bgGround.scaleX;
        bgSky.scaleY = this.canvas.height / bgSky.height;
        bgSky.x = -this.canvas.width / 2;
        bgSky.y = -this.canvas.height / 2;
        this.bgSky = bgSky;
      },
      role: null,
      roleBaseX: null,
      initRole: function initRole() {
        var resDragonBone = cc.find("Canvas/res/anima/role");
        var role = cc.instantiate(resDragonBone);
        var dragonDisplay = role.getComponent(dragonBones.ArmatureDisplay);
        dragonDisplay.playAnimation("normal", 1);
        role.anima = dragonDisplay;
        role.anchorY = 0;
        role.x = -100;
        role.y = 300;
        this.bgGround.addChild(role, 1e3);
        this.role = role;
        this.roleBaseX = this.canvas.width / 4;
      },
      curMagicBasket: null,
      initMagicBasket: function initMagicBasket() {
        var mbNode = new cc.Node();
        this.role.addChild(mbNode);
        mbNode.x = 180;
        mbNode.y = -100;
        var magicBasket = this.getMagicBasket();
        this.curMagicBasket = magicBasket;
        mbNode.addChild(magicBasket);
        var baseY = mbNode.y;
        var time = 1.5;
        var line = 30;
        cc.tween(mbNode).to(time, {
          y: baseY + line
        }, {
          easing: "sineInOut"
        }).to(time, {
          y: baseY
        }, {
          easing: "sineInOut"
        }).union().repeatForever().start();
      },
      getMagicBasket: function getMagicBasket() {
        var basketBack = (0, _util.getSprNode)("basket_back");
        var basketBottom = (0, _util.getSprNode)("basket_bottom");
        basketBack.addChild(basketBottom);
        var basketFront = (0, _util.getSprNode)("basket_front");
        basketBack.addChild(basketFront, 10);
        basketBack.fruitCount = 0;
        return basketBack;
      },
      wordLayer: null,
      curSmallBasket: null,
      wordLayerSoundBtn: null,
      initWordLayer: function initWordLayer() {
        var _this12 = this;
        var wordLayer = new cc.Node();
        this.wordLayer = wordLayer;
        this.canvas.addChild(wordLayer, 20);
        var bgBlack = (0, _util.getSprNode)("bg_black");
        bgBlack.scaleX = this.canvas.width / bgBlack.width;
        bgBlack.scaleY = this.canvas.height / bgBlack.height;
        wordLayer.addChild(bgBlack);
        bgBlack.addComponent(cc.BlockInputEvents);
        var bg = (0, _util.getSprNode)("bg_word");
        bg.scale = this._mapScaleMin;
        wordLayer.addChild(bg);
        wordLayer.bg = bg;
        bg.y += 100 * this._mapScaleMin;
        var realFruit = cc.instantiate(this.curRealFruit);
        realFruit.scale = 1.5 * this._mapScaleMin;
        realFruit.x = -430;
        realFruit.y = -10;
        bg.addChild(realFruit);
        wordLayer.realFruit = realFruit;
        var text = this.getWordLayerText();
        bg.addChild(text);
        text.x = -60;
        wordLayer.text = text;
        var baseY = text.y + text.height / 2 - 20;
        for (var i = 0; i < 3; i++) {
          var stripBg = (0, _util.getSprNode)("bg_strip");
          stripBg.x = 230;
          stripBg.y = baseY - stripBg.height / 2 - 85 * i;
          bg.addChild(stripBg);
          var strip = (0, _util.getSprNode)("strip_" + (3 - i));
          stripBg.addChild(strip);
          strip.scaleX = 0;
          strip.anchorX = 0;
          strip.x = -stripBg.width / 2;
          var star = this.getEmptyStar(3 - i);
          star.x = stripBg.x + 170;
          star.y = stripBg.y;
          bg.addChild(star);
          var fillStar = this.getFillStar(3 - i);
          fillStar.x = star.x;
          fillStar.y = star.y;
          fillStar.opacity = 0;
          bg.addChild(fillStar);
          wordLayer["strip_" + (3 - i)] = strip;
          wordLayer["star_" + (3 - i)] = fillStar;
        }
        var sound_1 = cc.find("Canvas/res/anima/sound_1");
        var soundIcon = cc.instantiate(sound_1);
        bg.addChild(soundIcon);
        soundIcon.x = -230;
        soundIcon.y = 170;
        soundIcon.addComponent(cc.Button);
        soundIcon.on("click", function() {
          _this12.sendServerEvent("word_layer_sound_click", {});
        });
        var anima = soundIcon.getComponent(cc.Animation);
        soundIcon.anima = anima;
        this.wordLayerSoundBtn = soundIcon;
        var basket = (0, _util.getSprNode)("basket_small/icon_basket");
        bg.addChild(basket);
        basket.x = 540;
        basket.y = -190;
        this.curSmallBasket = basket;
        this.initBottomTi(wordLayer);
        this.wordLayer.active = false;
      },
      wordLayerSoundClick: function wordLayerSoundClick() {
        var soundIcon = this.wordLayerSoundBtn;
        if (!soundIcon || soundIcon.isClicked) return;
        soundIcon.isClicked = true;
        var anima = soundIcon.anima;
        anima.play("sound_1");
        (0, _util.playAudio)(this.curFruit.clip, function() {
          soundIcon.isClicked = false;
          anima.play("sound_1", 0);
          anima.sample("sound_1");
          anima.stop();
        });
      },
      sentenceLayer: null,
      initSentenceLayer: function initSentenceLayer() {
        var _this13 = this;
        var sentenceLayer = new cc.Node();
        this.sentenceLayer = sentenceLayer;
        this.canvas.addChild(sentenceLayer, 20);
        var bgBlack = (0, _util.getSprNode)("bg_black");
        bgBlack.scaleX = this.canvas.width / bgBlack.width;
        bgBlack.scaleY = this.canvas.height / bgBlack.height;
        sentenceLayer.addChild(bgBlack);
        bgBlack.addComponent(cc.BlockInputEvents);
        var bg = (0, _util.getSprNode)("bg_sentence");
        bg.scale = this._mapScaleMin;
        sentenceLayer.addChild(bg);
        sentenceLayer.bg = bg;
        var basket = (0, _util.getSprNode)("basket_big/icon_basket");
        bg.addChild(basket);
        basket.x = -450;
        this.curBigBasket = basket;
        var text = this.getSentenceLayerText();
        bg.addChild(text);
        text.x = -60;
        sentenceLayer.text = text;
        var baseX = 255;
        var baseY = text.y + text.height / 2 - 5;
        for (var i = 0; i < 3; i++) {
          var stripBg = (0, _util.getSprNode)("bg_strip");
          stripBg.x = baseX;
          stripBg.y = baseY - stripBg.height / 2 - 85 * i;
          bg.addChild(stripBg);
          var strip = (0, _util.getSprNode)("strip_" + (3 - i));
          stripBg.addChild(strip);
          strip.scaleX = 0;
          strip.anchorX = 0;
          strip.x = -stripBg.width / 2;
          var star = this.getEmptyStar(3 - i);
          star.x = stripBg.x + 170;
          star.y = stripBg.y;
          bg.addChild(star);
          var fillStar = this.getFillStar(3 - i);
          fillStar.x = star.x;
          fillStar.y = star.y;
          fillStar.opacity = 0;
          bg.addChild(fillStar);
          sentenceLayer["strip_" + (3 - i)] = strip;
          sentenceLayer["star_" + (3 - i)] = fillStar;
        }
        var sound_1 = cc.find("Canvas/res/anima/sound_1");
        var soundIcon = cc.instantiate(sound_1);
        bg.addChild(soundIcon);
        soundIcon.x = -230;
        soundIcon.y = 170;
        soundIcon.addComponent(cc.Button);
        soundIcon.on("click", function() {
          _this13.sendServerEvent("sentence_layer_sound_click", {});
        });
        var anima = soundIcon.getComponent(cc.Animation);
        soundIcon.anima = anima;
        this.sentenceLayerSoundBtn = soundIcon;
        this.initBottomTi(sentenceLayer);
        this.sentenceLayer.active = false;
      },
      sentenceLayerSoundClick: function sentenceLayerSoundClick() {
        var soundIcon = this.sentenceLayerSoundBtn;
        if (!soundIcon || soundIcon.isClicked) return;
        soundIcon.isClicked = true;
        var anima = soundIcon.anima;
        anima.play("sound_1");
        (0, _util.playAudio)(this.curSentenceClip, function() {
          soundIcon.isClicked = false;
          anima.play("sound_1", 0);
          anima.sample("sound_1");
          anima.stop();
        });
      },
      goodJobLayer: null,
      initGoodJobLayer: function initGoodJobLayer() {
        var goodJobLayer = new cc.Node();
        goodJobLayer.width = this.canvas.width;
        goodJobLayer.height = this.canvas.height;
        this.canvas.addChild(goodJobLayer, 40);
        var bgBlack = (0, _util.getSprNode)("bg_black");
        bgBlack.scaleX = this.canvas.width / bgBlack.width;
        bgBlack.scaleY = this.canvas.height / bgBlack.height;
        goodJobLayer.addChild(bgBlack);
        this.goodJobLayer = goodJobLayer;
        this.goodJobLayer.active = false;
      },
      initBottomTi: function initBottomTi(bg) {
        var ti = (0, _util.getSprNode)("bg_ti");
        ti.scale = this._mapScaleMin;
        ti.anchorY = 0;
        ti.y = -this.canvas.height / 2;
        bg.addChild(ti);
        var baseX = 155;
        var disW = 180;
        var goodBtn = (0, _util.getSprNode)("btn_good");
        ti.addChild(goodBtn);
        goodBtn.y = ti.height / 2 - 20;
        goodBtn.x = baseX;
        var star1 = (0, _util.getSprNode)("btn_star_1");
        goodBtn.addChild(star1);
        star1.y = 24;
        goodBtn.star = star1;
        goodBtn.starNum = 1;
        var greatBtn = (0, _util.getSprNode)("btn_great");
        ti.addChild(greatBtn);
        greatBtn.x = baseX + disW;
        greatBtn.y = goodBtn.y;
        var star2 = (0, _util.getSprNode)("btn_star_2");
        greatBtn.addChild(star2);
        star2.y = star1.y;
        greatBtn.star = star2;
        greatBtn.starNum = 2;
        greatBtn.otherNeedShowArr = [ 0 ];
        var perfectBtn = (0, _util.getSprNode)("btn_perfect");
        ti.addChild(perfectBtn);
        perfectBtn.x = baseX + 2 * disW;
        perfectBtn.y = goodBtn.y;
        var star3 = (0, _util.getSprNode)("btn_star_3");
        perfectBtn.addChild(star3);
        star3.y = star1.y;
        perfectBtn.star = star3;
        perfectBtn.starNum = 3;
        perfectBtn.otherNeedShowArr = [ 1, 0 ];
        bg.tiBtnArr = [ goodBtn, greatBtn, perfectBtn ];
        this.addTiBtnListener(0, bg.tiBtnArr);
        this.addTiBtnListener(1, bg.tiBtnArr);
        this.addTiBtnListener(2, bg.tiBtnArr);
        this.isTeacher || (ti.active = false);
      },
      addTiBtnListener: function addTiBtnListener(btnIndex, tiBtnArr) {
        var _this14 = this;
        var btn = tiBtnArr[btnIndex];
        btn.on(cc.Node.EventType.TOUCH_START, function() {
          (0, _util.showBtnAnima)(btn);
          _this14.sendServerEvent("bottom_tip_btn_click", {
            btnIndex: btnIndex
          });
        });
      },
      bottomTipBtnClick: function bottomTipBtnClick(index) {
        var _this15 = this;
        var btn;
        btn = this.wordLayer.active ? this.wordLayer.tiBtnArr[index] : this.sentenceLayer.tiBtnArr[index];
        if (btn.isClicked) return;
        btn.isClicked = true;
        if (btn.otherNeedShowArr) {
          var _loop = function _loop(i) {
            (0, _util.delayCall)(.2 * (i + 1), function() {
              _this15.bottomTipBtnClick(btn.otherNeedShowArr[i]);
            });
          };
          for (var i = 0; i < btn.otherNeedShowArr.length; i++) _loop(i);
        }
        cc.tween(btn.star).to(.3, {
          opacity: 0
        }, {
          easing: "cubicIn"
        }).call(function() {
          if (_this15.wordLayer.active) {
            _this15.showWordLayerStar(btn.starNum);
            _this15.addSmallBasketFruit();
          } else {
            _this15.showSentenceLayerStar(btn.starNum);
            _this15.addBigBasketFruit();
          }
        }).start();
        (0, _util.playAudio)(this.stripClip);
        (0, _util.playAudio)(this.btnStarClip);
        this.setFruitPanelState();
      },
      showWordLayerStar: function showWordLayerStar(starNum) {
        var _this16 = this;
        var fillStar = this.wordLayer["star_" + starNum];
        cc.tween(fillStar).to(.5, {
          opacity: 255
        }, {
          easing: "cubicOut"
        }).start();
        var strip = this.wordLayer["strip_" + starNum];
        cc.tween(strip).to(.5, {
          scaleX: 1
        }, {
          easing: "cubicOut"
        }).call(function() {
          _this16.checkHideWordLayer();
        }).start();
      },
      showSentenceLayerStar: function showSentenceLayerStar(starNum) {
        var _this17 = this;
        var fillStar = this.sentenceLayer["star_" + starNum];
        cc.tween(fillStar).to(.5, {
          opacity: 255
        }, {
          easing: "cubicOut"
        }).start();
        var strip = this.sentenceLayer["strip_" + starNum];
        cc.tween(strip).to(.5, {
          scaleX: 1
        }, {
          easing: "cubicOut"
        }).call(function() {
          _this17.checkHideSentenceLayer();
        }).start();
      },
      smallBasketFruitCount: null,
      addSmallBasketFruit: function addSmallBasketFruit() {
        this.smallBasketFruitCount || (this.smallBasketFruitCount = 1);
        if (this.smallBasketFruitCount > 3) return;
        var resName;
        switch (this.treeType) {
         case this.treeTypeArr[0]:
          resName = "basket_small/icon_basket_1_" + this.smallBasketFruitCount;
          break;

         case this.treeTypeArr[1]:
          resName = "basket_small/icon_basket_2_" + this.smallBasketFruitCount;
          break;

         case this.treeTypeArr[2]:
          resName = "basket_small/icon_basket_3_" + this.smallBasketFruitCount;
        }
        console.log("resName: ", resName);
        var oldBasket = this.curSmallBasket;
        var newBasket = (0, _util.getSprNode)(resName);
        newBasket.parent = oldBasket.parent;
        newBasket.x = oldBasket.x;
        newBasket.y = oldBasket.y;
        this.curSmallBasket = newBasket;
        this.smallBasketFruitCount++;
        this.changePicAnima(oldBasket, newBasket);
      },
      bigBasketFruitCount: null,
      curBigBasket: null,
      addBigBasketFruit: function addBigBasketFruit() {
        this.bigBasketFruitCount || (this.bigBasketFruitCount = 1);
        if (this.bigBasketFruitCount > 3) return;
        var resName;
        switch (this.treeType) {
         case this.treeTypeArr[0]:
          resName = "basket_big/icon_basket_1_" + this.bigBasketFruitCount;
          break;

         case this.treeTypeArr[1]:
          resName = "basket_big/icon_basket_2_" + this.bigBasketFruitCount;
          break;

         case this.treeTypeArr[2]:
          resName = "basket_big/icon_basket_3_" + this.bigBasketFruitCount;
        }
        console.log("resName: ", resName);
        var oldBasket = this.curBigBasket;
        var newBasket = (0, _util.getSprNode)(resName);
        newBasket.parent = oldBasket.parent;
        newBasket.x = oldBasket.x;
        newBasket.y = oldBasket.y;
        this.curBigBasket = newBasket;
        this.bigBasketFruitCount++;
        this.changePicAnima(oldBasket, newBasket);
      },
      changePicAnima: function changePicAnima(oldPic, newPic) {
        var _this18 = this;
        newPic.opacity = 0;
        this.showDropFruitAnima(newPic, function() {
          _this18.changePicAnimaStart(oldPic, newPic);
        });
      },
      changePicAnimaStart: function changePicAnimaStart(oldPic, newPic) {
        newPic.opacity = 0;
        var changeTime = .5;
        cc.tween(newPic).to(changeTime, {
          opacity: 255
        }, {
          easing: "cubicOut"
        }).call(function() {
          cc.tween(oldPic).to(changeTime, {
            opacity: 0
          }).call(function() {
            oldPic.removeFromParent();
          }).start();
        }).start();
      },
      showDropFruitAnima: function showDropFruitAnima(pic, cb) {
        var resName;
        switch (this.treeType) {
         case this.treeTypeArr[0]:
          resName = "icon_apple";
          break;

         case this.treeTypeArr[1]:
          resName = "icon_banana";
          break;

         case this.treeTypeArr[2]:
          resName = "icon_orange";
        }
        var time = .7;
        var maxLen = pic.width * pic.scaleX * .33;
        var _loop2 = function _loop2(i) {
          var fruit = (0, _util.getSprNode)(resName);
          fruit.scale = maxLen / fruit.width;
          fruit.angle = 360 * Math.random();
          fruit.x = pic.x + 60 * Math.random() - 30;
          fruit.y = pic.y + 60 * Math.random() - 30 + 200;
          fruit.parent = pic.parent;
          fruit.opacity = 0;
          var delayTime = .1 + i * Math.random() * .3;
          cc.tween(fruit).delay(delayTime).to(time, {
            y: pic.y
          }, {
            easing: "cubicIn"
          }).call(function() {
            fruit.removeFromParent();
          }).start();
          cc.tween(fruit).delay(delayTime).to(.1 * time, {
            opacity: 255
          }).to(.9 * time, {
            opacity: 0
          }, {
            easing: "cubicIn"
          }).start();
        };
        for (var i = 0; i < 2; i++) _loop2(i);
        (0, _util.delayCall)(.8, function() {
          cb();
        });
      },
      checkHideWordLayer: function checkHideWordLayer() {
        console.log("this.wordLayer: ", this.wordLayer);
        for (var i = 1; i <= 3; i++) {
          var star = this.wordLayer["star_" + i];
          if (0 == star.opacity) return;
        }
        console.log(" hidelayer ");
        this.hideLayerLayer(this.wordLayer);
        if (this.fruitPanelSpeakBtn) {
          this.fruitPanelSpeakBtn.active = false;
          this.fruitPanelSpeakBtn.isClicked = true;
        }
      },
      hideLayerLayer: function hideLayerLayer(layer) {
        var _this19 = this;
        if (layer.isHide) return;
        layer.isHide = true;
        cc.tween(layer).delay(1).to(.5, {
          opacity: 0
        }, {
          easing: "cubicIn"
        }).call(function() {
          layer.active = false;
          _this19.checkEnterNextTree();
          _this19.setFruitPanelState();
        }).start();
      },
      checkHideSentenceLayer: function checkHideSentenceLayer() {
        for (var i = 1; i <= 3; i++) {
          var star = this.sentenceLayer["star_" + i];
          if (0 == star.opacity) return;
        }
        this.hideLayerLayer(this.sentenceLayer);
        if (this.sentencePanelSpeakBtn) {
          this.sentencePanelSpeakBtn.active = false;
          this.sentencePanelSpeakBtn.isClicked = true;
        }
      },
      getEmptyStar: function getEmptyStar(num) {
        var emptyStarResName = "icon_empty_star_" + num;
        var star = (0, _util.getSprNode)(emptyStarResName);
        star.anchorX = 0;
        return star;
      },
      getFillStar: function getFillStar(num) {
        var fillStarResName = "icon_fill_star_" + num;
        var star = (0, _util.getSprNode)(fillStarResName);
        star.anchorX = 0;
        return star;
      },
      getWordLayerText: function getWordLayerText() {
        var resName;
        switch (this.treeType) {
         case this.treeTypeArr[0]:
          resName = "text_apple";
          break;

         case this.treeTypeArr[1]:
          resName = "text_banana";
          break;

         case this.treeTypeArr[2]:
          resName = "text_orange";
        }
        var wordLayerText = (0, _util.getSprNode)(resName);
        return wordLayerText;
      },
      getSentenceLayerText: function getSentenceLayerText() {
        var resName;
        switch (this.treeType) {
         case this.treeTypeArr[0]:
          resName = "text_apples";
          break;

         case this.treeTypeArr[1]:
          resName = "text_bananas";
          break;

         case this.treeTypeArr[2]:
          resName = "text_oranges";
        }
        var text = (0, _util.getSprNode)(resName);
        return text;
      },
      isShowEndLayer: null,
      curStopX: null,
      curFruit: null,
      jumpTimes: null,
      curGroupClip: null,
      curSentenceClip: null,
      setCurStopX: function setCurStopX() {
        this.jumpTimes = 0;
        switch (this.treeType) {
         case this.treeTypeArr[0]:
          this.curStopX = this.apple.baseX - 300;
          this.curFruit = this.apple;
          this.curRealFruit = this.realApple;
          this.curGroupClip = this.appleGroupClip;
          this.curSentenceClip = this.appleSentenceClip;
          break;

         case this.treeTypeArr[1]:
          this.curStopX = this.banana.baseX - 300;
          this.curFruit = this.banana;
          this.curRealFruit = this.realBanana;
          this.curGroupClip = this.bananaGroupClip;
          this.curSentenceClip = this.bananaSentenceClip;
          break;

         case this.treeTypeArr[2]:
          this.curStopX = this.orange.baseX - 300;
          this.curFruit = this.orange;
          this.curRealFruit = this.realOrange;
          this.curGroupClip = this.orangeGroupClip;
          this.curSentenceClip = this.orangeSentenceClip;
          break;

         default:
          this.curStopX = this.bgGround.width + this.role.width * this.role.scaleX;
          this.isShowEndLayer = true;
        }
        this.curFruit.scale = this.curFruit.baseS;
        this.curFruit.x = this.curFruit.baseX;
        this.curFruit.y = this.curFruit.baseY;
        this.curFruit.magic && this.curFruit.magic.removeFromParent();
        this.curFruit.opacity = 0;
      },
      showFruit: function showFruit() {
        var _this20 = this;
        var time = .7;
        cc.tween(this.curFruit).to(time, {
          opacity: 255,
          y: this.role.y - 130
        }, {
          easing: "cubicIn"
        }).call(function() {
          _this20.fruitJump();
        }).start();
        (0, _util.playAudio)(this.appearClip);
      },
      fruitJump: function fruitJump() {
        var _this21 = this;
        var audioTime = this.curGroupClip[0].duration;
        console.log("audioTime: ", audioTime);
        var actionJump = cc.jumpBy(2 * audioTime, cc.v2(100, 0), 140, 1);
        var callFunc = cc.callFunc(function() {
          _this21.jumpTimes++;
          _this21.jumpTimes < 3 ? _this21.fruitJump() : _this21.fruitJumpEnd();
        });
        cc.tween(this.curFruit).to(audioTime, {
          scale: 1.3 * this.curFruit.scale
        }, {
          easing: "sineInOut"
        }).start();
        var seq = cc.sequence(actionJump, callFunc);
        this.curFruit.runAction(seq);
        (0, _util.playAudio)(this.curGroupClip[this.jumpTimes]);
      },
      fruitJumpEnd: function fruitJumpEnd() {
        this.showFruitMagic();
      },
      showFruitMagic: function showFruitMagic() {
        var _this22 = this;
        var fruitMagic = (0, _util.getSprNode)("icon_magiccircle");
        this.curFruit.addChild(fruitMagic);
        this.curFruit.magic = fruitMagic;
        fruitMagic.scale = 0;
        cc.tween(fruitMagic).by(1, {
          angle: 180
        }).repeatForever().start();
        cc.tween(fruitMagic).to(.5, {
          scale: 1
        }, {
          easing: "sineOut"
        }).start();
        var time = 1;
        cc.tween(this.curFruit).to(time, {
          y: this.curFruit.y + 50
        }, {
          easing: "cubicInOut"
        }).call(function() {
          _this22.showFruitPanel();
          _this22.setFruitPanelState();
          _this22.cleanCurFruit();
        }).start();
        (0, _util.playAudio)(this.magicClip);
      },
      cleanCurFruit: function cleanCurFruit() {},
      curFruitPanel: null,
      showFruitPanel: function showFruitPanel() {
        var fruitPanel = this.getFruitPanel();
        fruitPanel.x = this.curFruit.x;
        fruitPanel.y = this.curFruit.y;
        fruitPanel.parent = this.curFruit.parent;
        fruitPanel.anchorX = 1;
        fruitPanel.zIndex = 1e3;
        fruitPanel.scale = 0;
        this.curFruitPanel = fruitPanel;
        this.changeRealFruit();
        this.showTi(2);
        console.log("this.curFruit.x: ", this.curFruit.x);
        console.log("this.curFruit.y: ", this.curFruit.y);
        console.log("this.role.x: ", this.role.x);
        console.log("this.role.y: ", this.role.y);
      },
      changeRealFruit: function changeRealFruit() {
        var _this23 = this;
        cc.tween(this.curFruit).to(.4, {
          scale: 0
        }, {
          easing: "cubicIn"
        }).call(function() {
          cc.tween(_this23.curFruitPanel).to(.9, {
            scale: _this23._mapScaleMin
          }, {
            easing: "elasticOut"
          }).call(function() {
            _this23.playSentenceAudio();
          }).start();
          (0, _util.delayCall)(.2, function() {
            (0, _util.playAudio)(_this23.realFruitClip);
          });
        }).start();
      },
      curSentencePanel: null,
      showSentencePanel: function showSentencePanel() {
        var _this24 = this;
        var sentencePanel = this.getSentencePanel();
        sentencePanel.anchorX = 0;
        sentencePanel.anchorY = 0;
        sentencePanel.scale = 0;
        sentencePanel.x = 60;
        sentencePanel.y = 80;
        this.curSentencePanel = sentencePanel;
        this.role.addChild(sentencePanel);
        cc.tween(sentencePanel).to(.5, {
          scale: 1
        }, {
          easing: "cubicOut"
        }).call(function() {
          _this24.showJumpBtnLayer();
        }).start();
      },
      playSentenceAudio: function playSentenceAudio() {
        var _this25 = this;
        this.roleSpeak();
        this.showSentencePanel();
        (0, _util.playAudio)(this.curSentenceClip, function() {
          _this25.roleIdle();
        });
      },
      sentencePanelSoundBtn: null,
      sentencePanelSpeakBtn: null,
      getSentencePanel: function getSentencePanel() {
        var _this26 = this;
        var resName;
        switch (this.treeType) {
         case this.treeTypeArr[0]:
          resName = "bg_ilike_apple";
          break;

         case this.treeTypeArr[1]:
          resName = "bg_ilike_banana";
          break;

         case this.treeTypeArr[2]:
          resName = "bg_ilike_orange";
        }
        var panel = (0, _util.getSprNode)(resName);
        var sound_1 = cc.find("Canvas/res/anima/sound_1");
        var soundIcon = cc.instantiate(sound_1);
        panel.addChild(soundIcon);
        soundIcon.x = 70;
        soundIcon.y = panel.height + 10;
        soundIcon.addComponent(cc.Button);
        soundIcon.on("click", function() {
          _this26.sendServerEvent("sentence_panel_sound_click", {});
        });
        var anima = soundIcon.getComponent(cc.Animation);
        soundIcon.anima = anima;
        this.sentencePanelSoundBtn = soundIcon;
        var speakIcon = (0, _util.getSprNode)("btn_speak");
        speakIcon.anchorX = 0;
        speakIcon.x = panel.width - 20;
        speakIcon.y = panel.height - 20;
        panel.addChild(speakIcon);
        panel.speakIcon = speakIcon;
        speakIcon.addComponent(cc.Button);
        speakIcon.on("click", function() {
          if (!_this26.isTeacher) return;
          _this26.sendServerEvent("sentence_panel_speak_click");
          _this26.hideJumpBtnLayer();
        });
        this.sentencePanelSpeakBtn = speakIcon;
        this.isTeacher || (speakIcon.opacity = 0);
        return panel;
      },
      sentencePanelSpeakClick: function sentencePanelSpeakClick() {
        var _this27 = this;
        var speakIcon = this.sentencePanelSpeakBtn;
        if (!speakIcon) {
          this.resetSentenceLayer();
          this.showSentenceLayer();
          return;
        }
        if (!speakIcon || speakIcon.isClicked) return;
        speakIcon.isClicked = true;
        this.resetSentenceLayer();
        this.showSentenceLayer();
        cc.tween(speakIcon).to(.3, {
          opacity: 0
        }, {
          easing: "cubicOut"
        }).call(function() {
          speakIcon.active = false;
          _this27.setFruitPanelState();
        }).start();
      },
      sentencePanelSoundClick: function sentencePanelSoundClick() {
        var _this28 = this;
        var soundIcon = this.sentencePanelSoundBtn;
        if (!soundIcon || soundIcon.isClicked) return;
        soundIcon.isClicked = true;
        this.roleSpeak();
        var anima = soundIcon.anima;
        anima.play("sound_1");
        (0, _util.playAudio)(this.curSentenceClip, function() {
          soundIcon.isClicked = false;
          anima.play("sound_1", 0);
          anima.sample("sound_1");
          anima.stop();
          _this28.roleIdle();
        });
        this.addMagicBasketFruit();
      },
      magciBasketFruitCount: null,
      addMagicBasketFruit: function addMagicBasketFruit() {
        this.magciBasketFruitCount || (this.magciBasketFruitCount = 1);
        if (this.magciBasketFruitCount > 6) return;
        var resId = this.curMagicBasket.fruitCount + 1;
        resId > 6 && (resId = Math.ceil(6 * Math.random()));
        var resName;
        switch (this.treeType) {
         case this.treeTypeArr[0]:
          resName = "magic_basket/apple" + resId;
          break;

         case this.treeTypeArr[1]:
          resName = "magic_basket/banana" + resId;
          break;

         case this.treeTypeArr[2]:
          resName = "magic_basket/orange" + resId;
        }
        this.addMagicBasketFruitByResName(resName);
        console.log("resName: ", resName);
        this.magciBasketFruitCount++;
        this.curMagicBasket.fruitCount++;
      },
      addMagicBasketFruitByResName: function addMagicBasketFruitByResName(resName) {
        var spr = (0, _util.getSprNode)(resName);
        this.curMagicBasket.addChild(spr);
        spr.opacity = 0;
        this.showDropFruitAnima(this.curMagicBasket, function() {
          cc.tween(spr).to(.3, {
            opacity: 255
          }).start();
        });
      },
      resetMagicBasket: function resetMagicBasket() {
        if (2 == this.typeIndex) return;
        this.magciBasketFruitCount = 1;
      },
      fruitPanelSoundBtn: null,
      fruitPanelSpeakBtn: null,
      getFruitPanel: function getFruitPanel() {
        var _this29 = this;
        var resName;
        var speakIconOffX = 0;
        switch (this.treeType) {
         case this.treeTypeArr[0]:
          resName = "bg_apple_panel";
          break;

         case this.treeTypeArr[1]:
          resName = "bg_banana_panel";
          speakIconOffX = -75;
          break;

         case this.treeTypeArr[2]:
          resName = "bg_orange_panel";
        }
        var panel = (0, _util.getSprNode)(resName);
        var realFruit = this.curRealFruit;
        realFruit.parent && realFruit.removeFromParent();
        panel.addChild(realFruit);
        var sound_1 = cc.find("Canvas/res/anima/sound_1");
        var soundIcon = cc.instantiate(sound_1);
        panel.addChild(soundIcon);
        soundIcon.x = -270;
        soundIcon.y = 60;
        soundIcon.addComponent(cc.Button);
        soundIcon.on("click", function() {
          _this29.sendServerEvent("fruit_panel_sound_click", {});
        });
        var anima = soundIcon.getComponent(cc.Animation);
        soundIcon.anima = anima;
        soundIcon.realFruit = realFruit;
        this.fruitPanelSoundBtn = soundIcon;
        var speakIcon = (0, _util.getSprNode)("btn_speak");
        speakIcon.anchorX = 0;
        speakIcon.x = speakIcon.width / 2 + speakIconOffX;
        speakIcon.y = speakIcon.height / 4;
        panel.addChild(speakIcon);
        panel.speakIcon = speakIcon;
        speakIcon.addComponent(cc.Button);
        speakIcon.on("click", function() {
          if (!_this29.isTeacher) return;
          _this29.sendServerEvent("fruit_panel_speak_click");
          _this29.hideJumpBtnLayer();
        });
        this.fruitPanelSpeakBtn = speakIcon;
        this.isTeacher || (speakIcon.opacity = 0);
        return panel;
      },
      fruitPanelSpeakClick: function fruitPanelSpeakClick() {
        var _this30 = this;
        var speakIcon = this.fruitPanelSpeakBtn;
        if (!speakIcon) {
          this.resetWordLayer();
          this.showWordLayer();
          return;
        }
        if (speakIcon.isClicked) return;
        speakIcon.isClicked = true;
        this.resetWordLayer();
        this.showWordLayer();
        cc.tween(speakIcon).to(.3, {
          opacity: 0
        }, {
          easing: "cubicOut"
        }).call(function() {
          speakIcon.active = false;
          _this30.setFruitPanelState();
        }).start();
      },
      fruitPanelSoundClick: function fruitPanelSoundClick() {
        var soundIcon = this.fruitPanelSoundBtn;
        if (!soundIcon || soundIcon.isClicked) return;
        soundIcon.isClicked = true;
        var anima = soundIcon.anima;
        anima.play("sound_1");
        (0, _util.jellyShake)(soundIcon.realFruit);
        (0, _util.playAudio)(this.curFruit.clip, function() {
          soundIcon.isClicked = false;
          anima.play("sound_1", 0);
          anima.sample("sound_1");
          anima.stop();
        });
      },
      resetWordLayer: function resetWordLayer() {
        this.smallBasketFruitCount = 1;
        var layer = this.wordLayer;
        var bg = layer.bg;
        layer.realFruit.removeFromParent();
        layer.isHide = false;
        var realFruit = cc.instantiate(this.curRealFruit);
        realFruit.scale = 1.5 * this._mapScaleMin;
        realFruit.x = -430;
        realFruit.y = -10;
        bg.addChild(realFruit);
        layer.realFruit = realFruit;
        layer.text.removeFromParent();
        var text = this.getWordLayerText();
        bg.addChild(text);
        text.x = -60;
        layer.text = text;
        for (var i = 0; i < 3; i++) {
          layer["strip_" + (3 - i)].scaleX = 0;
          layer["star_" + (3 - i)].opacity = 0;
        }
        console.log(" aaa bb ");
        this.curSmallBasket.removeFromParent();
        var basket = (0, _util.getSprNode)("basket_small/icon_basket");
        bg.addChild(basket);
        basket.x = 540;
        basket.y = -190;
        this.curSmallBasket = basket;
        var btnArr = this.wordLayer.tiBtnArr;
        console.log("btnArr: ", this.btnArr);
        for (var _i2 = 0; _i2 < btnArr.length; _i2++) {
          btnArr[_i2].star.opacity = 255;
          btnArr[_i2].isClicked = false;
        }
      },
      showWordLayer: function showWordLayer() {
        this.wordLayer.active = true;
        this.wordLayer.opacity = 0;
        cc.tween(this.wordLayer).to(.7, {
          opacity: 255
        }, {
          easing: "cubicOut"
        }).start();
        (0, _util.playAudio)(this.popClip);
      },
      showSentenceLayer: function showSentenceLayer() {
        this.sentenceLayer.active = true;
        this.sentenceLayer.opacity = 0;
        cc.tween(this.sentenceLayer).to(.7, {
          opacity: 255
        }, {
          easing: "cubicOut"
        }).start();
        (0, _util.playAudio)(this.popClip);
      },
      resetSentenceLayer: function resetSentenceLayer() {
        this.bigBasketFruitCount = 1;
        var layer = this.sentenceLayer;
        var bg = layer.bg;
        this.curBigBasket.removeFromParent();
        layer.isHide = false;
        var basket = (0, _util.getSprNode)("basket_big/icon_basket");
        bg.addChild(basket);
        basket.x = -450;
        this.curBigBasket = basket;
        layer.text.removeFromParent();
        var text = this.getSentenceLayerText();
        bg.addChild(text);
        text.x = -60;
        layer.text = text;
        for (var i = 0; i < 3; i++) {
          layer["strip_" + (3 - i)].scaleX = 0;
          layer["star_" + (3 - i)].opacity = 0;
        }
        var btnArr = layer.tiBtnArr;
        for (var _i3 = 0; _i3 < btnArr.length; _i3++) {
          btnArr[_i3].star.opacity = 255;
          btnArr[_i3].isClicked = false;
        }
      },
      curWalkAudioId: null,
      playWalkAudio: function playWalkAudio() {
        var _this31 = this;
        this.curWalkAudioId = (0, _util.playAudio)(this.walkClip, function() {
          _this31.role.isMoving && _this31.playWalkAudio();
        });
      },
      stopWalkAudio: function stopWalkAudio() {
        console.log("in curWalkAudioId: ", this.curWalkAudioId);
        cc.audioEngine.stop(this.curWalkAudioId);
      },
      roleMove: function roleMove() {
        console.log("this.roleMove");
        this.role.speedX = 3.2;
        this.role.isMoving = true;
        this.role.anima.playAnimation("walk", -1);
        this.isMoveNextTree = true;
        this.playWalkAudio();
      },
      roleIdle: function roleIdle() {
        this.role.isMoving = false;
        this.role.anima.playAnimation("normal", -1);
        this.stopWalkAudio();
      },
      roleSpeak: function roleSpeak() {
        this.role.isMoving = false;
        this.role.anima.playAnimation("speak", -1);
        this.stopWalkAudio();
      },
      checkEnterNextTree: function checkEnterNextTree() {
        var _this32 = this;
        if (this.curFruitPanel.speakIcon.active) return;
        if (this.curSentencePanel.speakIcon.active) return;
        this.hideFruitPanel();
        this.hideSentencePanel();
        (0, _util.delayCall)(.4, function() {
          _this32.showGoodJob();
          _this32.showTi(3);
        });
        (0, _util.playAudio)(this.goodjobClip);
        this.hideCurTi();
      },
      showGoodJob: function showGoodJob() {
        var _this33 = this;
        var resName = "";
        switch (this.treeType) {
         case this.treeTypeArr[0]:
          resName = "good_job/bg_goodjob_1";
          break;

         case this.treeTypeArr[1]:
          resName = "good_job/bg_goodjob_2";
          break;

         default:
          resName = "good_job/bg_goodjob_3";
        }
        var goodJobLayer = this.goodJobLayer;
        goodJobLayer.active = true;
        goodJobLayer.opacity = 0;
        var showLayerTime = .4;
        var showIconTime = 1.2;
        var delayTime = 1;
        cc.tween(goodJobLayer).to(showLayerTime, {
          opacity: 255
        }).delay(showIconTime).delay(delayTime).to(showLayerTime, {
          opacity: 0
        }).call(function() {
          goodJobLayer.active = false;
          _this33.typeIndex > 1 ? _this33.enterNextTree() : _this33.showNextBtn();
        }).start();
        if (goodJobLayer.icon) {
          goodJobLayer.icon.removeFromParent();
          goodJobLayer.icon = null;
        }
        var goodJob = (0, _util.getSprNode)(resName);
        goodJobLayer.addChild(goodJob);
        goodJob.scale = 0;
        goodJobLayer.icon = goodJob;
        cc.tween(goodJob).delay(showLayerTime).to(showIconTime, {
          scale: this._mapScaleMin
        }, {
          easing: "elasticOut"
        }).start();
        var p = goodJob.position;
        this.showOneFirework(p, goodJobLayer, cc.find("paperBase").children, 300, 500, 30, 1);
      },
      isMoveNextTree: null,
      enterNextTree: function enterNextTree() {
        if (this.isMoveNextTree) return;
        this.hideCurTi();
        this.hideNextBtn();
        this.resetMagicBasket();
        this.typeIndex++;
        var type = this.treeTypeArr[this.typeIndex];
        this.treeType = type;
        this.setCurStopX();
        this.roleMove();
        this.setMoveNextTreeState();
      },
      setMoveNextTreeState: function setMoveNextTreeState() {
        switch (this.typeIndex) {
         case 1:
          this.setState(3);
          break;

         case 2:
          this.setState(6);
          break;

         case 3:
          this.setState(9);
        }
      },
      hideFruitPanel: function hideFruitPanel() {
        var _this34 = this;
        cc.tween(this.curFruitPanel).to(.3, {
          opacity: 0
        }).call(function() {
          _this34.curFruitPanel.removeFromParent();
        }).start();
      },
      hideSentencePanel: function hideSentencePanel() {
        var _this35 = this;
        cc.tween(this.curSentencePanel).to(.3, {
          opacity: 0
        }).call(function() {
          _this35.curSentencePanel.removeFromParent();
        }).start();
      },
      endLayer: null,
      initEndLayer: function initEndLayer() {
        var node = new cc.Node();
        this.canvas.addChild(node, 40);
        node.active = false;
        this.endLayer = node;
        var endBg = (0, _util.getSprNode)("finish/bg_finish");
        node.addChild(endBg);
        endBg.scale = this._mapScaleMax;
        var resDragonBone = cc.find("Canvas/res/anima/clamphands");
        var clamphands = cc.instantiate(resDragonBone);
        var dragonDisplay = clamphands.getComponent(dragonBones.ArmatureDisplay);
        dragonDisplay.playAnimation("clamphands", -1);
        clamphands.scale = this._mapScaleMin;
        clamphands.x = -this.canvas.width / 2 + clamphands.width / 2 * this._mapScaleMin;
        clamphands.y = -this.canvas.height / 2 + clamphands.height / 2 * this._mapScaleMin;
        node.addChild(clamphands);
      },
      showEndMask: function showEndMask() {
        var _this36 = this;
        var bgBlack = (0, _util.getSprNode)("black");
        bgBlack.scaleX = this.canvas.width / bgBlack.width;
        bgBlack.scaleY = this.canvas.height / bgBlack.height;
        this.canvas.addChild(bgBlack, 41);
        bgBlack.opacity = 0;
        var time = 1;
        cc.tween(bgBlack).to(time, {
          opacity: 255
        }, {
          easing: "cubicIn"
        }).call(function() {
          _this36.endLayer.active = true;
        }).to(time / 2, {
          opacity: 0
        }, {
          easing: "sineOut"
        }).call(function() {
          _this36.showEndLayer();
        }).start();
      },
      showEndLayer: function showEndLayer() {
        var _this37 = this;
        console.log("show end layer");
        var endBg = this.endLayer;
        endBg.height = this.canvas.height;
        endBg.active = true;
        var endIcon = (0, _util.getSprNode)("finish/bg_finish_icon");
        endIcon.scale = 0;
        endIcon.x = 200 * this._mapScaleMin;
        endIcon.y = -50 * this._mapScaleMin;
        endBg.addChild(endIcon, 1);
        cc.tween(endIcon).to(1, {
          scale: this._mapScaleMin
        }, {
          easing: "elasticOut"
        }).start();
        var bgLight = (0, _util.getSprNode)("finish/bg_light");
        bgLight.scale = this._mapScaleMin;
        endBg.addChild(bgLight);
        bgLight.x = endIcon.x;
        bgLight.y = endIcon.y;
        cc.tween(bgLight).to(.3, {
          opacity: 255
        }).start();
        cc.tween(bgLight).by(10, {
          angle: 360
        }).repeatForever().start();
        (0, _util.delayCall)(3, function() {
          _this37.showTemplateEndAnima();
        });
        this.showOneFirework(bgLight.position, endBg, cc.find("paperBase").children, 400, 600, 30);
        (0, _util.playAudio)(this.finishClip);
      },
      showOneFirework: function showOneFirework(pos, parentNode, nodeList, w, h, n, timeRate) {
        var _this38 = this;
        return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
          var i;
          return regeneratorRuntime.wrap(function _callee$(_context) {
            while (1) switch (_context.prev = _context.next) {
             case 0:
              void 0 === timeRate && (timeRate = 1);
              i = 0;

             case 2:
              if (!(i < 3)) {
                _context.next = 9;
                break;
              }
              _this38.showFirework(pos, parentNode, nodeList, w, h, n, timeRate);
              _context.next = 6;
              return (0, _util.asyncDelay)(.1);

             case 6:
              i++;
              _context.next = 2;
              break;

             case 9:
             case "end":
              return _context.stop();
            }
          }, _callee);
        }))();
      },
      showFirework: function showFirework(pos, parentNode, nodeList, width, height, number, timeRate) {
        void 0 === width && (width = 200);
        void 0 === height && (height = 500);
        void 0 === number && (number = 30);
        void 0 === timeRate && (timeRate = 1);
        for (var i = 0; i < number; i++) {
          var quad = this.createQuads(pos, parentNode, nodeList);
          var targetX = (0, _util.RandomInt)(width / 2, -width / 2);
          var targetY = (0, _util.RandomInt)(height);
          cc.tween(quad).by(.5 * timeRate, {
            x: targetX
          }).by((2 + 2 * Math.random()) * timeRate, {
            x: 2 * targetX
          }).start();
          cc.tween(quad).by(.5 * timeRate, {
            y: targetY
          }, {
            easing: "quadOut"
          }).to((3 + 2 * Math.random()) * timeRate, {
            y: 2 * -parentNode.height
          }, {
            easing: "quadIn"
          }).removeSelf().start();
          cc.tween(quad).delay(1 * timeRate).to((.5 + 2 * Math.random()) * timeRate, {
            opacity: 0
          }).start();
        }
      },
      createQuads: function createQuads(pos, parentNode, nodeList) {
        var quadBase = cc.instantiate(nodeList[(0, _util.RandomInt)(nodeList.length)]);
        quadBase.x = pos.x;
        quadBase.y = pos.y;
        quadBase.z = pos.z;
        quadBase.angle = (0, _util.RandomInt)(180);
        quadBase.parent = parentNode;
        var quad = quadBase.getChildByName("quad");
        quad.x = 0;
        quad.y = 0;
        quad.angle = (0, _util.RandomInt)(180);
        var paper = quad.getChildByName("paper");
        paper.scaleX = .8 * Math.random() + .2;
        paper.scaleY = .8 * Math.random() + .2;
        quadBase.scaleX = Math.random();
        cc.tween(quadBase).to(.3 * (1 - quadBase.scaleX), {
          scaleX: 1
        }).call(function() {
          var time = .2 * Math.random();
          cc.tween(quadBase).to(.1 + time, {
            scaleX: -1
          }).to(.1 + time, {
            scaleX: 1
          }).union().repeatForever().start();
        }).start();
        return quadBase;
      },
      curTi: null,
      showTi: function showTi(id) {
        var ti = (0, _util.getSprNode)("bg_ti_" + id);
        this.canvas.addChild(ti);
        ti.y = -this.canvas.height / 2;
        ti.anchorY = 0;
        ti.opacity = 0;
        ti.scale = this._mapScaleMin;
        this.curTi = ti;
        cc.tween(ti).to(.5, {
          opacity: 255
        }, {
          easing: "cubicOut"
        }).start();
        this.isTeacher || (ti.active = false);
      },
      hideCurTi: function hideCurTi() {
        cc.tween(this.curTi).to(.5, {
          opacity: 0
        }, {
          easing: "cubitOut"
        }).start();
      },
      setFruitPanelState: function setFruitPanelState() {
        var step;
        switch (this.typeIndex) {
         case 0:
          step = 2;
          break;

         case 1:
          step = 5;
          break;

         case 2:
          step = 8;
        }
        var stepData = {};
        this.fruitPanelSpeakBtn && !this.fruitPanelSpeakBtn.active && (stepData.isHideFruitSpeak = true);
        this.sentencePanelSpeakBtn && !this.sentencePanelSpeakBtn.active && (stepData.isHideSentenceSpeak = true);
        this.wordLayer.active && (stepData.isShowWordLayer = true);
        this.sentenceLayer.active && (stepData.isShowSentenceLayer = true);
        var finishStarBtnArr = [];
        var btnArr;
        btnArr = this.wordLayer.active ? this.wordLayer.tiBtnArr : this.sentenceLayer.tiBtnArr;
        for (var i = 0; i < btnArr.length; i++) {
          var btn = btnArr[i];
          btn.isClicked && finishStarBtnArr.push(i);
        }
        stepData.finishStarBtnArr = finishStarBtnArr;
        stepData.magciBasketFruitCount = this.magciBasketFruitCount;
        this.setState(step, stepData);
      },
      countNum: null,
      countDown: function countDown() {
        var _this39 = this;
        var dateTime = this.getPageData("dateTime");
        if (dateTime) {
          this.gameStart();
          return;
        }
        if (!this.countNum) {
          this.countNum = 3;
          (0, _util.playAudio)(this.countDownClip);
        }
        var countSpr = (0, _util.getSprNode)("text_" + this.countNum);
        countSpr.scale = this._mapScaleMin;
        this.canvas.addChild(countSpr, 30);
        countSpr.opacity = 0;
        cc.tween(countSpr).to(.2, {
          opacity: 255
        }, {
          easing: "cubicOut"
        }).delay(.8).to(.2, {
          opacity: 0
        }, {
          easing: "cubicOut"
        }).call(function() {
          countSpr.removeFromParent();
        }).start();
        (0, _util.delayCall)(1, function() {
          _this39.countNum--;
          _this39.countNum > 0 ? _this39.countDown() : _this39.gameStart();
        });
      },
      gameStart: function gameStart() {
        this.initKnife();
        this.isTeacher ? this.setGameEndTime() : this.addItem();
      },
      setGameEndTime: function setGameEndTime() {
        var _this40 = this;
        var time = 60;
        var dateTime = this.getPageData("dateTime");
        if (dateTime) {
          var subTime = (new Date().getTime() - dateTime) / 1e3;
          time -= subTime;
          (time < 0 || time > 60) && (time = 0);
        } else {
          dateTime = new Date().getTime();
          this.setPageData("dateTime", dateTime);
        }
        console.log("time: ", time);
        (0, _util.delayCall)(time, function() {
          _this40.gameEnd();
        });
      },
      addItem: function addItem() {
        var _this41 = this;
        if (this.isGameEnd) return;
        Math.random() < .1 ? this.addBomb() : this.addFruit();
        var time = this.canvas.height / (200 * this.baseSpeed);
        (0, _util.delayCall)(time, function() {
          _this41.addItem();
        });
      },
      addBomb: function addBomb(data) {
        void 0 === data && (data = null);
        var bomb = this.getBomb(data);
        this.fruitArr.push(bomb);
        this.isTeacher || this.sendServerEvent("add_bomb", {
          send_data: bomb.data
        });
      },
      addFruit: function addFruit(data) {
        void 0 === data && (data = null);
        var fruit = this.getFruit(data);
        this.fruitArr.push(fruit);
        this.isTeacher || this.sendServerEvent("add_fruit", {
          send_data: fruit.data
        });
      },
      getBomb: function getBomb(data) {
        void 0 === data && (data = null);
        var node = (0, _util.getSprNode)("icon_bomb");
        var maxW = this.canvas.width - 300 * this._mapScaleMin;
        if (!data) {
          data = {};
          data.xRandom = Math.random();
          data.sRandom = Math.random();
          data.id = new Date().getTime();
        }
        node.x = -maxW / 2 + data.xRandom * maxW;
        node.y = this.canvas.height / 2 + 150 * this._mapScaleMin;
        node.scale = (.7 + .3 * data.sRandom) * this._mapScaleMin;
        this.canvas.addChild(node);
        node.data = data;
        this.addBombListener(node);
        this.setFruitSpeed(node);
        return node;
      },
      getFruit: function getFruit(data) {
        void 0 === data && (data = null);
        if (!data) {
          data = {};
          data.xRandom = Math.random();
          data.rRandom = Math.random();
          data.sRandom = Math.random();
          data.speedRandom = Math.random();
          data.id = new Date().getTime();
          data.fruitId = 1 + Math.floor(7 * Math.random());
        }
        var id = data.fruitId;
        var maxW = this.canvas.width - 300 * this._mapScaleMin;
        var node = new cc.Node();
        node.x = -maxW / 2 + data.xRandom * maxW;
        node.y = this.canvas.height / 2 + 150 * this._mapScaleMin;
        node.angle = 360 * data.rRandom;
        node.scale = (.7 + .3 * data.sRandom) * this._mapScaleMin;
        this.canvas.addChild(node);
        node.speedR = .5 * data.speedRandom - .25;
        node.id = id;
        node.data = data;
        var icon = (0, _util.getSprNode)("fruit/" + id + "_icon");
        node.addChild(icon);
        node.icon = icon;
        var iconLeft = (0, _util.getSprNode)("fruit/" + id + "_icon_l");
        node.addChild(iconLeft, 1);
        node.iconLeft = iconLeft;
        iconLeft.active = false;
        var iconRight = (0, _util.getSprNode)("fruit/" + id + "_icon_r");
        node.addChild(iconRight, 1);
        node.iconRight = iconRight;
        iconRight.active = false;
        var iconPop = (0, _util.getSprNode)("fruit/" + id + "_pop");
        node.addChild(iconPop);
        node.iconPop = iconPop;
        iconPop.active = false;
        this.addFruitListener(node);
        this.setFruitSpeed(node);
        return node;
      },
      addFruitListener: function addFruitListener(fruit) {
        var _this42 = this;
        var icon = fruit.icon;
        icon.on(cc.Node.EventType.TOUCH_START, function() {
          console.log("touch fruit");
          if (fruit.isPop) return;
          if (_this42.isStopUpdate) return;
          if (_this42.isTeacher) return;
          _this42.touchFruit(fruit);
        });
      },
      serverTouchFruit: function serverTouchFruit(dataId) {
        var arr = this.fruitArr;
        for (var i = 0; i < arr.length; i++) {
          var _arr$i, _arr$i$data;
          if ((null == (_arr$i = arr[i]) ? void 0 : null == (_arr$i$data = _arr$i.data) ? void 0 : _arr$i$data.id) == dataId) {
            this.touchFruit(arr[i], true);
            break;
          }
        }
      },
      touchFruit: function touchFruit(fruit, isServer) {
        void 0 === isServer && (isServer = false);
        isServer || this.isTeacher || this.sendServerEvent("touch_fruit", {
          data_id: fruit.data.id
        });
        this.knifeOnFruit(fruit);
        this.showScore(fruit);
        this.fruitPop(fruit);
      },
      addBombListener: function addBombListener(bomb) {
        var _this43 = this;
        bomb.on(cc.Node.EventType.TOUCH_START, function() {
          console.log("touch bomb");
          if (bomb.isPop) return;
          if (_this43.isStopUpdate) return;
          _this43.touchBomb(bomb);
        });
      },
      serverTouchBomb: function serverTouchBomb(dataId) {
        var arr = this.fruitArr;
        for (var i = 0; i < arr.length; i++) {
          var _arr$i2, _arr$i2$data;
          if ((null == (_arr$i2 = arr[i]) ? void 0 : null == (_arr$i2$data = _arr$i2.data) ? void 0 : _arr$i2$data.id) == dataId) {
            this.touchBomb(arr[i], true);
            break;
          }
        }
      },
      touchBomb: function touchBomb(bomb, isServer) {
        void 0 === isServer && (isServer = false);
        isServer || this.isTeacher || this.sendServerEvent("touch_bomb", {
          data_id: bomb.data.id
        });
        this.knifeOnFruit(bomb);
        this.showBombAnima(bomb);
      },
      isStopUpdate: null,
      showBombAnima: function showBombAnima(bomb) {
        var _this44 = this;
        this.isStopUpdate = true;
        bomb.isPop = true;
        var bgBlack = (0, _util.getSprNode)("bg_black");
        bgBlack.scaleX = this.canvas.width / bgBlack.width * 1.5;
        bgBlack.scaleY = this.canvas.height / bgBlack.height * 1.5;
        this.canvas.addChild(bgBlack, 41);
        var bgBlackLight = (0, _util.getSprNode)("bg_blacklight");
        bgBlackLight.scaleX = 1 / bgBlack.scaleX * this._mapScaleMax;
        bgBlackLight.scaleY = 1 / bgBlack.scaleY * this._mapScaleMax;
        bgBlack.addChild(bgBlackLight);
        var resDragonBone = cc.find("Canvas/res/anima/bomb");
        var magic = cc.instantiate(resDragonBone);
        var dragonDisplay = magic.getComponent(dragonBones.ArmatureDisplay);
        dragonDisplay.on(dragonBones.EventObject.COMPLETE, function() {
          cc.tween(bgBlack).to(.5, {
            opacity: 0
          }).call(function() {
            bgBlack.removeFromParent();
            magic.removeFromParent();
          }).start();
          _this44.isGameEnd || (_this44.isStopUpdate = false);
        });
        dragonDisplay.playAnimation("bomb", 1);
        magic.x = bomb.x;
        magic.y = bomb.y;
        magic.scale = bomb.scale;
        this.canvas.addChild(magic, 42);
        this.removeBomb(bomb);
        (0, _util.delayCall)(.55, function() {
          _this44.shakeScreen();
          (0, _util.playAudio)(_this44.popClip);
        });
      },
      shakeScreen: function shakeScreen() {
        var camera = cc.find("Canvas/Main Camera");
        var time = .4;
        var rate = -2;
        cc.tween(camera).to(time / 4 / 2, {
          x: 12 * rate,
          y: 12 * rate
        }, {
          easing: "sineInOut"
        }).to(time / 4, {
          x: -8 * rate,
          y: -8 * rate
        }, {
          easing: "sineInOut"
        }).to(time / 4, {
          x: 5 * rate,
          y: 5 * rate
        }, {
          easing: "sineInOut"
        }).to(time / 4, {
          x: -1 * rate,
          y: -1 * rate
        }, {
          easing: "sineInOut"
        }).to(time / 4, {
          x: 0 * rate,
          y: 0 * rate
        }, {
          easing: "sineInOut"
        }).start();
      },
      removeBomb: function removeBomb(bomb) {
        (0, _util.removeFromArr)(this.fruitArr, bomb);
        bomb.removeFromParent();
      },
      knifeOnFruit: function knifeOnFruit(fruit) {
        this.knife.x = fruit.x + 30 * this._mapScaleMin;
        this.knife.y = fruit.y;
      },
      fruitPop: function fruitPop(fruit) {
        (0, _util.playAudio)(this.fruitClip);
        (0, _util.removeFromArr)(this.fruitArr, fruit);
        fruit.isPop = true;
        var rTween = fruit.tween;
        rTween && rTween.stop();
        fruit.speedR = 0;
        var tmpAngle = fruit.angle % 360;
        fruit.icon.active = false;
        var iconLeft = fruit.iconLeft;
        var iconRight = fruit.iconRight;
        var iconPop = fruit.iconPop;
        iconLeft.active = true;
        iconRight.active = true;
        iconPop.active = true;
        fruit.angle = 0;
        iconLeft.angle = 43;
        iconRight.angle = 43;
        var knifeLight = (0, _util.getSprNode)("bg_knifelight");
        knifeLight.angle = 30;
        knifeLight.x = 20;
        knifeLight.y = 25;
        iconPop.addChild(knifeLight);
        knifeLight.scale = 0;
        cc.tween(knifeLight).to(.3, {
          scale: 1
        }, {
          easing: "cubicOut"
        }).delay(.2).to(.3, {
          opacity: 0
        }).start();
        var actionTo = cc.jumpTo(1.5, cc.v2(100 * Math.random() - 300, -300), 270 + 100 * Math.random(), 1);
        iconLeft.runAction(actionTo);
        var actionTo = cc.jumpTo(1.5, cc.v2(300 + 100 * Math.random(), -300), 270 + 100 * Math.random(), 1);
        iconRight.runAction(actionTo);
        2 == fruit.id && (iconRight.anchorX = .75);
        if (5 == fruit.id) {
          iconLeft.anchorY = .25;
          iconRight.anchorY = .25;
        }
        var leftAngleSpeed = .5 * tmpAngle;
        var rightAngleSpeed = .5 * -tmpAngle;
        cc.tween(iconLeft).by(1, {
          angle: leftAngleSpeed
        }).repeatForever().start();
        cc.tween(iconRight).by(1, {
          angle: rightAngleSpeed
        }).repeatForever().start();
        iconPop.opacity = 0;
        cc.tween(iconPop).to(.7, {
          opacity: 255
        }, {
          easing: "expoOut"
        }).delay(.2).to(.5, {
          opacity: 0
        }, {
          easing: "cubicIn"
        }).start();
        cc.tween(iconRight).to(1.5, {
          opacity: 0
        }, {
          easing: "cubicIn"
        }).start();
        cc.tween(iconLeft).to(1.5, {
          opacity: 0
        }, {
          easing: "cubicIn"
        }).call(function() {
          fruit.removeFromParent();
        }).start();
      },
      showScore: function showScore(fruit) {
        (0, _util.playAudio)(this.scoreClip);
        var score = (0, _util.getSprNode)("text_10");
        score.opacity = 0;
        this.canvas.addChild(score);
        score.x = fruit.x;
        score.y = fruit.y;
        cc.tween(score).by(.5, {
          opacity: 255,
          y: 120 * this._mapScaleMin
        }, {
          easing: "cubicOut"
        }).delay(.5).to(.3, {
          opacity: 0
        }, {
          easing: "sineIn"
        }).call(function() {
          score.removeFromParent();
        }).start();
      },
      knife: null,
      initKnife: function initKnife() {
        var knife = (0, _util.getSprNode)("icon_knife");
        knife.x = 300 * this._mapScaleMin;
        knife.y = -200 * this._mapScaleMin;
        knife.zIndex = 40;
        knife.anchorY = .75;
        knife.anchorX = .15;
        this.canvas.addChild(knife);
        knife.opacity = 0;
        cc.tween(knife).to(.3, {
          opacity: 255
        }).start();
        this.knife = knife;
      },
      ti: null,
      initTi: function initTi() {
        var ti = (0, _util.getSprNode)("bg_ti");
        ti.scale = this._mapScaleMin;
        ti.anchorX = 0;
        ti.anchorY = 0;
        ti.x = -this.canvas.width / 2 + 10 * this._mapScaleMin;
        ti.y = -this.canvas.height / 2 + 30 * this._mapScaleMin;
        this.canvas.addChild(ti, 51);
        this.ti = ti;
        this.isTeacher || (this.ti.active = false);
      },
      initTeacherBtn: function initTeacherBtn() {
        var btnNode = new cc.Node();
        btnNode.scale = this._mapScaleMin;
        btnNode.parent = this.canvas;
        btnNode.zIndex = 60;
        btnNode.x = this.canvas.width / 2 - 520 * this._mapScaleMin;
        btnNode.y = -this.canvas.height / 2 + 70 * this._mapScaleMin;
        var disW = 10;
        var btnLv1 = (0, _util.getSprNode)("btn_easy1");
        btnLv1.x = btnLv1.width / 2;
        btnNode.addChild(btnLv1);
        btnLv1.level = 1;
        var btnLv1Light = (0, _util.getSprNode)("btn_easy2");
        btnLv1Light.x = btnLv1.x;
        btnNode.addChild(btnLv1Light);
        btnLv1Light.opacity = 0;
        this.addBtnListener(btnLv1, btnLv1Light);
        var btnLv2 = (0, _util.getSprNode)("btn_medium1");
        btnLv2.x = btnLv1.x + btnLv1.width / 2 + disW + btnLv2.width / 2;
        btnNode.addChild(btnLv2);
        btnLv2.level = 2;
        var btnLv2Light = (0, _util.getSprNode)("btn_medium2");
        btnLv2Light.x = btnLv2.x;
        btnNode.addChild(btnLv2Light);
        btnLv2Light.opacity = 0;
        this.addBtnListener(btnLv2, btnLv2Light);
        var btnLv3 = (0, _util.getSprNode)("btn_hard1");
        btnLv3.x = btnLv2.x + btnLv2.width / 2 + disW + btnLv3.width / 2;
        btnNode.addChild(btnLv3);
        btnLv3.level = 3;
        var btnLv3Light = (0, _util.getSprNode)("btn_hard2");
        btnLv3Light.x = btnLv3.x;
        btnNode.addChild(btnLv3Light);
        btnLv3Light.opacity = 0;
        this.addBtnListener(btnLv3, btnLv3Light);
        this.btnArr = [ btnLv1, btnLv2, btnLv3 ];
        if (!this.isTeacher) {
          btnLv1.active = false;
          btnLv2.active = false;
          btnLv3.active = false;
          btnLv1Light.active = false;
          btnLv2Light.active = false;
          btnLv3Light.active = false;
        }
      },
      addBtnListener: function addBtnListener(btn, btnLight) {
        var _this45 = this;
        btn.light = btnLight;
        if (!this.isTeacher) return;
        btn.addComponent(cc.Button);
        btn.on("click", function() {
          _this45.clickLevelBtn(btn.level);
        });
      },
      clickLevelBtn: function clickLevelBtn(level, isServer) {
        void 0 === isServer && (isServer = false);
        !isServer && this.isTeacher && this.sendServerEvent("click_level", {
          level: level
        });
        this.setLevel(level);
        this.hideTi();
      },
      setLevel: function setLevel(level) {
        for (var i = 0; i < this.btnArr.length; i++) if (this.btnArr[i].level == level) {
          this.changeBtn(this.btnArr[i]);
          this.modelLevel = this.btnArr[i].level;
          this.setBaseSpeed();
          return;
        }
      },
      changeBtn: function changeBtn(btn) {
        if (0 != btn.opacity) {
          this.hideAllBtn();
          btn.opacity = 0;
          btn.light.opacity = 255;
        }
      },
      hideTi: function hideTi() {
        if (this.ti) {
          var ti = this.ti;
          cc.tween(ti).to(.3, {
            opacity: 0
          }, {
            easing: "cubicIn"
          }).call(function() {
            ti.removeFromParent();
          }).start();
          this.ti = null;
        }
      },
      hideAllBtn: function hideAllBtn() {
        for (var i = 0; i < this.btnArr.length; i++) {
          this.btnArr[i].opacity = 255;
          this.btnArr[i].light.opacity = 0;
        }
      },
      baseSpeed: null,
      setBaseSpeed: function setBaseSpeed(level) {
        void 0 === level && (level = null);
        level || (level = this.modelLevel);
        this.baseSpeed = 1 + 1 * level;
      },
      setFruitSpeed: function setFruitSpeed(fruit) {
        fruit.speedY = this.baseSpeed;
      },
      updateFruit: function updateFruit() {
        var fruitArr = this.fruitArr;
        if (!fruitArr) return;
        for (var i = 0; i < fruitArr.length; i++) {
          fruitArr[i].y -= fruitArr[i].speedY;
          fruitArr[i].angle += fruitArr[i].speedR;
        }
        for (var _i4 = 0; _i4 < fruitArr.length; _i4++) {
          var fruit = fruitArr[_i4];
          if (fruit && fruit.y <= -this.canvas.height) {
            this.fruitArr.splice(_i4, 1);
            fruit.removeFromParent();
            _i4--;
            console.log("remove one fruit");
          }
        }
      },
      checkRoleStop: function checkRoleStop() {
        this.role.x >= this.curStopX && this.roleMoveEnd();
      },
      roleMoveEnd: function roleMoveEnd() {
        this.roleIdle();
        if (this.isShowEndLayer) this.showEndMask(); else {
          switch (this.typeIndex) {
           case 0:
            this.setState(1);
            break;

           case 1:
            this.setState(4);
            break;

           case 2:
            this.setState(7);
          }
          this.showFruit();
        }
        this.isMoveNextTree = false;
      },
      updateRole: function updateRole() {
        if (!this.role) return;
        if (this.role.isMoving) {
          this.role.x += this.role.speedX;
          if (this.role.x > this.roleBaseX && this.bgGround.x > this.groundMinX) {
            this.bgGround.x -= this.role.speedX * this.bgGround.scaleX;
            this.bgBack.x -= this.role.speedX * this.bgGround.scaleX * this.bgBack.speedRate;
          }
          this.checkRoleStop();
        }
      },
      update: function update() {
        this.updateRole();
      },
      initListener: function initListener() {
        var _this46 = this;
        var canvas = cc.find("Canvas");
        var downFlag = false;
        var touchStart = function touchStart(e) {
          _this46.canvasTouchStart(e);
          console.log("touch start");
          canvas.hasEventListener(cc.Node.EventType.MOUSE_DOWN) && canvas.off(cc.Node.EventType.MOUSE_DOWN, mouseDown);
        };
        var mouseDown = function mouseDown(e) {
          if (!downFlag) return;
          _this46.canvasTouchStart(e);
          console.log("mouse down");
          if (canvas.hasEventListener(cc.Node.EventType.TOUCH_MOVE)) {
            canvas.off(cc.Node.EventType.TOUCH_MOVE, touchMove);
            _this46.removeHtmlCanvasListener("touchmove");
          }
        };
        var touchMove = function touchMove(e) {
          _this46.canvasTouchMove(e);
          console.log("touch move");
          canvas.hasEventListener(cc.Node.EventType.MOUSE_MOVE) && canvas.off(cc.Node.EventType.MOUSE_MOVE, mouseMove);
        };
        var mouseMove = function mouseMove(e) {
          if (!downFlag) return;
          _this46.canvasTouchMove(e);
          console.log("mouse move");
          if (canvas.hasEventListener(cc.Node.EventType.TOUCH_MOVE)) {
            canvas.off(cc.Node.EventType.TOUCH_MOVE, touchMove);
            _this46.removeHtmlCanvasListener("touchmove");
          }
        };
        var touchEnd = function touchEnd(e) {
          downFlag = false;
          _this46.canvasTouchEnd(e);
          canvas.hasEventListener(cc.Node.EventType.MOUSE_UP) && canvas.off(cc.Node.EventType.MOUSE_UP, mouseUp);
          canvas.hasEventListener(cc.Node.EventType.MOUSE_LEAVE) && canvas.off(cc.Node.EventType.MOUSE_LEAVE, mouseUp);
          _this46.removeHtmlTouchEnd();
        };
        var mouseUp = function mouseUp(e) {
          downFlag = false;
          _this46.canvasTouchEnd(e);
          canvas.hasEventListener(cc.Node.EventType.TOUCH_END) && canvas.off(cc.Node.EventType.TOUCH_END, touchEnd);
          canvas.hasEventListener(cc.Node.EventType.TOUCH_CANCEL) && canvas.off(cc.Node.EventType.TOUCH_CANCEL, touchEnd);
        };
        canvas.on(cc.Node.EventType.TOUCH_START, touchStart);
        canvas.on(cc.Node.EventType.MOUSE_DOWN, mouseDown);
        canvas.on(cc.Node.EventType.TOUCH_MOVE, touchMove);
        canvas.on(cc.Node.EventType.MOUSE_MOVE, mouseMove);
        canvas.on(cc.Node.EventType.TOUCH_END, touchEnd);
        canvas.on(cc.Node.EventType.TOUCH_CANCEL, touchEnd);
        canvas.on(cc.Node.EventType.MOUSE_UP, mouseUp);
      },
      canvasTouchStart: function canvasTouchStart(e) {
        var pos = e.getLocation();
        this.knife.x = pos.x - e.currentTarget.width / 2;
        this.knife.y = pos.y - e.currentTarget.height / 2;
      },
      canvasTouchMove: function canvasTouchMove(e) {
        var pos = e.getLocation();
        this.knife.x = pos.x - e.currentTarget.width / 2;
        this.knife.y = pos.y - e.currentTarget.height / 2;
      },
      canvasTouchEnd: function canvasTouchEnd(e) {
        if (!this._curShowItem) return;
        this._curShowItem = null;
      },
      removeHtmlCanvasListener: function removeHtmlCanvasListener(type) {},
      removeHtmlTouchEnd: function removeHtmlTouchEnd() {},
      isGameEnd: null,
      gameEnd: function gameEnd(isServer) {
        void 0 === isServer && (isServer = false);
        !isServer && this.isTeacher && this.sendServerEvent("game_end", {});
        this.isGameEnd = true;
        this.isStopUpdate = true;
        (0, _util.playAudio)(this.endClip);
        var goodJob = (0, _util.getSprNode)("text_good-job");
        this.canvas.addChild(goodJob, 70);
        goodJob.scale = 0;
        cc.tween(goodJob).to(.7, {
          scale: this._mapScaleMin
        }, {
          easing: "elasticOut"
        }).start();
      },
      showSound: function showSound() {
        var _this47 = this;
        this.showPanel1();
        (0, _util.playAudio)(this.tip1Clip, function() {
          _this47.tip1ShowEnd();
        });
      },
      tip1ShowEnd: function tip1ShowEnd() {
        var _this48 = this;
        this.showMagic();
        (0, _util.playAudio)(this.tip2Clip, function() {
          _this48.tip2ShowEnd();
        });
      },
      tip2ShowEnd: function tip2ShowEnd() {
        this.showBtn();
        this.showPanel2();
      },
      panel1: null,
      showPanel1: function showPanel1() {
        if (!this.isTeacher) return;
        var panel1 = (0, _util.getSprNode)("bg_ti1");
        panel1.scale = this._mapScaleMin;
        panel1.parent = cc.find("Canvas");
        panel1.zIndex = 20;
        panel1.anchorY = 0;
        panel1.y = -this.canvas.height / 2;
        this.panel1 = panel1;
        panel1.baseY = panel1.y;
        panel1.y -= panel1.height / 2 * panel1.scaleY;
        cc.tween(panel1).to(1, {
          y: panel1.baseY
        }, {
          easing: "cubicOut"
        }).start();
      },
      panel2: null,
      showPanel2: function showPanel2() {
        if (!this.isTeacher) return;
        var panel2 = (0, _util.getSprNode)("bg_ti2");
        panel2.scale = this._mapScaleMin;
        panel2.parent = cc.find("Canvas");
        panel2.zIndex = 30;
        panel2.anchorY = 0;
        panel2.y = -this.canvas.height / 2;
        panel2.opacity = 0;
        this.panel2 = panel2;
        cc.tween(this.panel1).delay(.3).to(.3, {
          opacity: 0
        }).start();
        cc.tween(panel2).to(.3, {
          opacity: 255
        }).start();
      },
      showMagic: function showMagic() {
        console.log("in showMagic");
        var resDragonBone = cc.find("Canvas/res/anima/magic");
        var magic = cc.instantiate(resDragonBone);
        var dragonDisplay = magic.getComponent(dragonBones.ArmatureDisplay);
        dragonDisplay.on(dragonBones.EventObject.COMPLETE, function() {
          dragonDisplay.playAnimation("spinturn", -1);
        });
        dragonDisplay.playAnimation("appear", 1);
        magic.parent = cc.find("Canvas/bg_door");
        (0, _util.playAudio)(this.magicAppearClip);
      },
      btn: null,
      _showBtn: function _showBtn() {
        var _this49 = this;
        console.log("in showBtn");
        var btn = (0, _util.getSprNode)("btn_go");
        btn.parent = this.canvas;
        btn.zIndex = 50;
        btn.scale = this._mapScaleMin;
        btn.x = 230 * this._mapScaleMin;
        btn.y = -this.canvas.height / 2 + 230 * this._mapScaleMin;
        btn.addComponent(cc.Button);
        btn.on("click", function() {
          _this49.sendServerEvent("btn_click");
        });
        btn.opacity = 0;
        this.btn = btn;
        cc.tween(btn).to(.5, {
          opacity: 255
        }).start();
        this.showHand();
      },
      btnClick: function btnClick() {
        if (0 == this.btn.opacity) return;
        this.btn.opacity = 0;
        (0, _util.playAudio)(this.btnClip);
        (0, _util.playAudio)(this.tip3Clip);
      },
      initSmog: function initSmog() {
        this.addSmog(-this.canvas.width / 1.5, false);
        this.addSmog(-this.canvas.width / 2, false);
        this.addSmog(-this.canvas.width / 2 + this.canvas.width / 3, false);
        this.addSmog(-this.canvas.width / 2 + this.canvas.width / 3 * 2);
      },
      addSmog: function addSmog(px, isCreateNext) {
        var _this50 = this;
        void 0 === isCreateNext && (isCreateNext = true);
        var parent = cc.find("Canvas/bg_door");
        var smog;
        if (this.smogArr.length > 0) smog = this.smogArr.pop(); else {
          smog = (0, _util.getSprNode)("bg_smog");
          parent.addChild(smog);
        }
        smog.scale = this._mapScaleMin * (.5 + .7 * Math.random());
        smog.x = px;
        smog.y = 80 * Math.random() - 140;
        smog.zIndex = 10;
        Math.random() > .5 && (smog.scaleX *= -1);
        var time = 30 + 10 * Math.random();
        cc.tween(smog).to(time, {
          x: this.canvas.width
        }).call(function() {
          _this50.smogArr.push(smog);
        }).start();
        isCreateNext && (0, _util.delayCall)(time / 10 + time / 10 * Math.random(), function() {
          _this50.addSmog(-_this50.canvas.width);
        });
      },
      nextBtn: null,
      initNextBtn: function initNextBtn() {
        var _this51 = this;
        var nextBtn = (0, _util.getSprNode)("btn_next");
        this.bgGround.addChild(nextBtn, 20);
        var worldX = this.canvas.width / 2;
        var localPos = this.bgGround.convertToNodeSpaceAR(this.canvas.convertToWorldSpaceAR(cc.v2(worldX, 0)));
        nextBtn.x = localPos.x;
        nextBtn.y = 150;
        nextBtn.scale = this._mapScaleMin;
        this.nextBtn = nextBtn;
        nextBtn.active = false;
        nextBtn.addComponent(cc.Button);
        nextBtn.on("click", function() {
          _this51.sendServerEvent("next_btn_click", {});
        });
        this.initHand(nextBtn);
        this.showHandAnima(nextBtn);
      },
      nextBtnClick: function nextBtnClick() {
        var nextBtn = this.nextBtn;
        if (nextBtn.isClicked) return;
        nextBtn.isClicked = true;
        this.enterNextTree();
        (0, _util.playAudio)(this.clickClip);
      },
      initHand: function initHand(btn) {
        console.log("in showHand");
        var hand1 = (0, _util.getSprNode)("icon_hand1");
        hand1.parent = btn;
        hand1.x = 70;
        hand1.y = -80;
        var hand2 = (0, _util.getSprNode)("icon_hand2");
        hand2.parent = btn;
        hand2.x = hand1.x;
        hand2.y = hand1.y;
        hand2.opacity = 0;
        btn.hand1 = hand1;
        btn.hand2 = hand2;
      },
      showNextBtn: function showNextBtn() {
        var btn = this.nextBtn;
        btn.active = true;
        btn.opacity = 0;
        cc.tween(btn).to(.5, {
          opacity: 255
        }, {
          easing: "cubicOut"
        }).start();
        var worldX = this.canvas.width / 2 - 100 * this._mapScaleMin;
        var localPos = this.bgGround.convertToNodeSpaceAR(this.canvas.convertToWorldSpaceAR(cc.v2(worldX, 0)));
        btn.x = localPos.x;
        btn.isClicked = false;
      },
      showHandAnima: function showHandAnima(btn) {
        var _this52 = this;
        var hand1 = btn.hand1;
        var hand2 = btn.hand2;
        if (0 == hand1.opacity) {
          var delayTime = .2;
          cc.tween(btn).delay(delayTime).call(function() {
            hand1.opacity = 255;
            hand2.opacity = 0;
            _this52.showHandAnima(btn);
          }).start();
        } else {
          var _delayTime = .5;
          cc.tween(btn).delay(_delayTime).call(function() {
            hand1.opacity = 0;
            hand2.opacity = 255;
            _this52.showHandAnima(btn);
          }).start();
        }
      },
      hideNextBtn: function hideNextBtn() {
        var _this53 = this;
        cc.tween(this.nextBtn).to(.3, {
          opacity: 0
        }, {
          easing: "cubicIn"
        }).call(function() {
          _this53.nextBtn.active = false;
        }).start();
        this.fruitPanelSpeakBtn = null;
        this.sentencePanelSpeakBtn = null;
      },
      initTree: function initTree() {
        this.initAppleTree();
        this.initBananaTree();
        this.initOrangeTree();
      },
      apple: null,
      realApple: null,
      initAppleTree: function initAppleTree() {
        var parent = cc.find("Canvas/bg_ground");
        var tmpX = 0;
        var tmpY = 0;
        var rate = 1.15;
        var treeDataArr = [ [ tmpX + 108 * rate, tmpY + 238, .9 ], [ tmpX + 332 * rate, tmpY + 238, .7 ], [ tmpX + 556 * rate, tmpY + 197, 1 ], [ tmpX + 783 * rate, tmpY + 227, .6 ], [ tmpX + 968 * rate, tmpY + 217, .77 ] ];
        for (var i = 0; i < treeDataArr.length; i++) {
          var treeData = treeDataArr[i];
          var appleTree = (0, _util.getSprNode)("bg_appletree");
          appleTree.x = treeData[0];
          appleTree.y = treeData[1];
          appleTree.scale = treeData[2];
          appleTree.anchorY = 0;
          parent.addChild(appleTree, 999 - appleTree.y);
          this.addTreeAnima(appleTree);
          if (1 == appleTree.scale) {
            var apple = (0, _util.getSprNode)("icon_apple");
            apple.x = appleTree.x;
            apple.y = appleTree.y + appleTree.height / 2;
            apple.parent = appleTree.parent;
            apple.zIndex = appleTree.zIndex;
            apple.opacity = 0;
            apple.scale = 50 / apple.width;
            this.apple = apple;
            this.apple.baseS = this.apple.scale;
            this.apple.baseX = this.apple.x;
            this.apple.baseY = this.apple.y;
            apple.clip = this.appleClip;
            var realApple = (0, _util.getSprNode)("icon_realapple");
            this.realApple = realApple;
          }
        }
      },
      banana: null,
      realBanana: null,
      initBananaTree: function initBananaTree() {
        var parent = cc.find("Canvas/bg_ground");
        var tmpX = this.bgGround.width / 3 + 90;
        var tmpY = 40;
        var rate = 1.3;
        var treeDataArr = [ [ tmpX + 54 * rate, tmpY + 202, .78 ], [ tmpX + 240 * rate, tmpY + 150, .86 ], [ tmpX + 447 * rate, tmpY + 145, 1 ], [ tmpX + 569 * rate, tmpY + 198, .7 ], [ tmpX + 672 * rate, tmpY + 200, .58 ], [ tmpX + 803 * rate, tmpY + 170, .8 ] ];
        for (var i = 0; i < treeDataArr.length; i++) {
          var treeData = treeDataArr[i];
          var bananaTree = (0, _util.getSprNode)("bg_bananatree");
          bananaTree.x = treeData[0];
          bananaTree.y = treeData[1];
          bananaTree.scale = treeData[2];
          bananaTree.anchorY = 0;
          parent.addChild(bananaTree, 999 - bananaTree.y);
          this.addTreeAnima(bananaTree);
          if (1 == bananaTree.scale) {
            var fruit = (0, _util.getSprNode)("icon_banana");
            fruit.x = bananaTree.x;
            fruit.y = bananaTree.y + bananaTree.height / 2;
            fruit.parent = bananaTree.parent;
            fruit.zIndex = bananaTree.zIndex;
            fruit.opacity = 0;
            fruit.scale = 50 / fruit.width;
            this.banana = fruit;
            this.banana.baseS = this.banana.scale;
            this.banana.baseX = this.banana.x;
            this.banana.baseY = this.banana.y;
            fruit.clip = this.bananaClip;
            var realBanana = (0, _util.getSprNode)("icon_realbanana");
            this.realBanana = realBanana;
          }
        }
      },
      orange: null,
      realOrange: null,
      initOrangeTree: function initOrangeTree() {
        var parent = cc.find("Canvas/bg_ground");
        var tmpX = this.bgGround.width / 3 * 2;
        var tmpY = 0;
        var rate = 1.05;
        var treeDataArr = [ [ tmpX + 147 * rate, tmpY + 228, .77 ], [ tmpX + 349 * rate, tmpY + 199, .72 ], [ tmpX + 602 * rate, tmpY + 178, 1 ], [ tmpX + 848 * rate, tmpY + 240, .54 ], [ tmpX + 1047 * rate, tmpY + 201, .8 ] ];
        for (var i = 0; i < treeDataArr.length; i++) {
          var treeData = treeDataArr[i];
          var orangeTree = (0, _util.getSprNode)("bg_orangetree");
          orangeTree.x = treeData[0];
          orangeTree.y = treeData[1];
          orangeTree.scale = treeData[2];
          orangeTree.anchorY = 0;
          parent.addChild(orangeTree, 999 - orangeTree.y);
          this.addTreeAnima(orangeTree);
          if (1 == orangeTree.scale) {
            var fruit = (0, _util.getSprNode)("icon_orange");
            fruit.x = orangeTree.x;
            fruit.y = orangeTree.y + orangeTree.height / 2;
            fruit.parent = orangeTree.parent;
            fruit.zIndex = orangeTree.zIndex;
            fruit.opacity = 0;
            fruit.scale = 50 / fruit.width;
            this.orange = fruit;
            this.orange.baseS = this.orange.scale;
            this.orange.baseX = this.orange.x;
            this.orange.baseY = this.orange.y;
            fruit.clip = this.orangeClip;
            var realOrange = (0, _util.getSprNode)("icon_realorange");
            this.realOrange = realOrange;
          }
        }
      },
      addTreeAnima: function addTreeAnima(tree) {
        var _this54 = this;
        var wind = 1 + 1 * Math.random();
        var shakeLine = 8 * wind;
        var time = 4 * wind;
        cc.tween(tree).to(time / 3 / 2, {
          skewX: .3 * shakeLine
        }, {
          easing: "sineInOut"
        }).to(time / 3 / 1.2, {
          skewX: -.1 * shakeLine
        }, {
          easing: "sineInOut"
        }).to(time / 3, {
          skewX: .05 * shakeLine
        }, {
          easing: "sineInOut"
        }).to(time / 3, {
          skewX: 0 * shakeLine
        }, {
          easing: "sineInOut"
        }).start();
        (0, _util.delayCall)(time + 1.5 * Math.random(), function() {
          _this54.addTreeAnima(tree);
        });
      },
      initHotZone: function initHotZone() {
        this.initHotZoneBg();
      },
      hotZoneBg: null,
      initHotZoneBg: function initHotZoneBg() {
        var _this55 = this;
        this.hotZoneBg = new cc.Node();
        this.hotZoneBg.name = "hotZoneBg";
        this.hotZoneBg.parent = cc.find("Canvas");
        var titleH = 107 * this._mapScaleMin + 22;
        if (!this.data.bgItem) return;
        cc.loader.load({
          url: this.data.bgItem.url
        }, function(err, img) {
          _this55.hotZoneBg.width = img.width;
          _this55.hotZoneBg.height = img.height;
          var sprNode = new cc.Node();
          sprNode.name = "bgItemSpr";
          var sf = new cc.SpriteFrame(img);
          var spr = sprNode.addComponent(cc.Sprite);
          spr.spriteFrame = sf;
          sprNode.width = _this55.hotZoneBg.width;
          sprNode.height = _this55.hotZoneBg.height;
          sprNode.parent = _this55.hotZoneBg;
          window["bg"] = sprNode;
          var sx = _this55.canvas.width / _this55.hotZoneBg.width;
          var sy = (_this55.canvas.height - titleH) / _this55.hotZoneBg.height;
          var s = Math.min(sx, sy);
          _this55.hotZoneBg.scale = s;
          _this55.hotZoneBg.y = 0 - titleH / 2;
          _this55.initHotZoneItem();
        });
      },
      initHotZoneItem: function initHotZoneItem() {
        var _this56 = this;
        this.data.hotZoneItemArr.forEach(function(item) {
          switch (item.gIdx) {
           case "0":
            _this56.setOneAnimaSmall(item);
            break;

           case "1":
            _this56.setOnePic(item);
            break;

           case "2":
            _this56.setOneRect(item);
            break;

           case "3":
           case "4":
           case "5":
            _this56.setOneAction(item);
          }
        });
      },
      addMask: function addMask(node) {
        var mask = node.addComponent(cc.Mask);
        mask.type = cc.Mask.Type.RECT;
      },
      setOneAction: function setOneAction(data) {
        var rate = this.hotZoneBg.scale * this.hotZoneBg.width / this.data.bgItem.rect.width;
        var rectNode = new cc.Node();
        rectNode.name = "rect" + data.index;
        this.hotZoneBg.addChild(rectNode);
        var ctx = rectNode.addComponent(cc.Graphics);
        ctx.lineWidth = 4;
        ctx.strokeColor = cc.Color.BLACK;
        ctx.fillColor = cc.Color.WHITE.setA(100);
        var scale = rate / this.hotZoneBg.scaleY;
        rectNode.width = data.rect.width * scale;
        rectNode.height = data.rect.height * scale;
        rectNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale;
        rectNode.y = this.hotZoneBg.height / 2 - data.rect.height * scale - data.rect.y * scale;
        var x = rectNode.x, y = rectNode.y, width = rectNode.width, height = rectNode.height;
        rectNode.anchorX = rectNode.anchorY = 0;
        this.data.bgItem.isShowDebugLine && ctx.rect(0, 0, rectNode.width, rectNode.height);
        ctx.stroke();
        ctx.fill();
        console.log("setOneAction ~~ data: ", data);
        var actionData = data["actionData_" + data.gIdx];
        if (!actionData) return;
        if ("text" == actionData.type) {
          var label = this.setOneActionText(rectNode, actionData);
          label.node.scale = scale * data.fontScale;
          label["_forceUpdateRenderData"](true);
        } else if ("pic" == actionData.type) var pic = this.setOneActionPic(rectNode, actionData); else if ("anima" == actionData.type) var anima = this.setOneActionAnima(rectNode, actionData);
      },
      setOneActionText: function setOneActionText(rectNode, actionData) {
        var labelNode = new cc.Node();
        labelNode.parent = rectNode;
        var label = labelNode.addComponent(cc.Label);
        label.font = cc.find("Canvas/res/font/aharoni").getComponent(cc.Label).font;
        label.string = actionData.text;
        labelNode.color = cc.Color.BLACK;
        var opArr = actionData.changeOption;
        var tweenArr = [];
        for (var i = 0; i < opArr.length; i++) {
          var opData = opArr[i];
          console.log("opArr[0]", opArr[i]);
          if ("fontColor" == opData[0]) {
            var color = new cc.Color();
            cc.Color.fromHEX(color, opData[1]);
            labelNode.color = color;
          } else if ("opacity" == opData[0]) {
            labelNode.opacity = Number(opData[1] / 100 * 255) + .1;
            tweenArr.push({
              item: labelNode,
              option: '{"' + opData[0] + '" : ' + opData[2] / 100 * 255 + "}",
              optionName: opData[0]
            });
          } else {
            label[opData[0]] = opData[1];
            tweenArr.push({
              item: label,
              option: '{"' + opData[0] + '" : ' + opData[2] + "}",
              optionName: opData[0]
            });
          }
        }
        actionData.audio_url && cc.assetManager.loadRemote(actionData.audio_url, function(err, audioClip) {
          labelNode.audioClip = audioClip;
        });
        label.lineHeight = label.fontSize;
        labelNode.y += rectNode.height / 2;
        labelNode.x += rectNode.width / 2;
        rectNode.addComponent(cc.Button);
        rectNode.on("click", function() {
          if (labelNode.audioClip) {
            cc.audioEngine.stopAllEffects();
            cc.audioEngine.playEffect(labelNode.audioClip, false, .8);
          }
          labelNode.isClicked;
          labelNode.isClicked = true;
          for (var _i5 = 0; _i5 < tweenArr.length; _i5++) {
            var tweenData = tweenArr[_i5];
            if ("opacity" == tweenData.optionName) {
              console.log("~~~ ", tweenData.item[tweenData.optionName]);
              cc.tween(tweenData.item).to(actionData.changeTime, JSON.parse(tweenData.option)).start();
            }
          }
        });
        return label;
      },
      setOneActionPic: function setOneActionPic(rectNode, actionData) {
        console.log("setOneActionPic actionData: ", actionData);
        var picNode = new cc.Node();
        rectNode.addChild(picNode);
        cc.loader.load({
          url: actionData.pic_url
        }, function(err, img) {
          var spr = picNode.addComponent(cc.Sprite);
          spr.spriteFrame = new cc.SpriteFrame(img);
          picNode.y += rectNode.height / 2;
          picNode.x += rectNode.width / 2;
          picNode.scaleX = rectNode.width / picNode.width;
          picNode.scaleY = rectNode.height / picNode.height;
          var opArr = actionData.changeOption;
          var tweenArr = [];
          for (var i = 0; i < opArr.length; i++) {
            var opData = opArr[i];
            console.log("opData: ~~~ ", opData);
            if ("opacity" == opData[0]) {
              picNode.opacity = Number(opData[1] / 100 * 255) + .1;
              console.log(picNode.opacity);
              tweenArr.push({
                item: picNode,
                option: '{"' + opData[0] + '" : ' + opData[2] / 100 * 255 + "}",
                optionName: opData[0]
              });
            }
            actionData.audio_url && cc.assetManager.loadRemote(actionData.audio_url, function(err, audioClip) {
              rectNode.audioClip = audioClip;
            });
            rectNode.addComponent(cc.Button);
            rectNode.on("click", function() {
              if (rectNode.audioClip) {
                cc.audioEngine.stopAllEffects();
                cc.audioEngine.playEffect(rectNode.audioClip, false, .8);
              }
              rectNode.isClicked;
              rectNode.isClicked = true;
              for (var _i6 = 0; _i6 < tweenArr.length; _i6++) {
                var tweenData = tweenArr[_i6];
                "opacity" == tweenData.optionName && cc.tween(tweenData.item).to(actionData.changeTime, JSON.parse(tweenData.option)).start();
              }
            });
          }
        });
      },
      setOneActionAnima: function setOneActionAnima(rectNode, actionData) {
        var animaNode = new cc.Node();
        rectNode.addChild(animaNode);
        actionData.audio_url && cc.assetManager.loadRemote(actionData.audio_url, function(err, audioClip) {
          rectNode.audioClip = audioClip;
        });
        var data = actionData;
        var dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
        if (!data.texPngData) return;
        var image = data.texPngData.url;
        var ske = data.skeJsonData.url;
        var atlas = data.texJsonData.url;
        cc.loader.load(image, function(error, texture) {
          cc.loader.load({
            url: atlas,
            type: "txt"
          }, function(error, atlasJson) {
            cc.loader.load({
              url: ske,
              type: "txt"
            }, function(error, dragonBonesJson) {
              var atlas = new dragonBones.DragonBonesAtlasAsset();
              atlas.atlasJson = atlasJson;
              atlas.texture = texture;
              var asset = new dragonBones.DragonBonesAsset();
              asset.dragonBonesJson = dragonBonesJson;
              dragonDisplay.dragonAtlasAsset = atlas;
              dragonDisplay.dragonAsset = asset;
              var json = JSON.parse(asset.dragonBonesJson);
              var armatures = json["armature"];
              var armatureNames = [];
              for (var i = 0; i < armatures.length; i++) armatureNames.push(armatures[i].name);
              var animationNames = [];
              if (armatureNames.length > 0) {
                var defaultArmatureName = armatureNames[0];
                dragonDisplay.armatureName = defaultArmatureName;
                var defaultArmature = armatures[0];
                var animations = defaultArmature.animation;
                for (var _i7 = 0; _i7 < animations.length; _i7++) animationNames.push(animations[_i7].name);
              }
              animaNode.y += rectNode.height / 2;
              animaNode.x += rectNode.width / 2;
              animaNode.scaleX = rectNode.width / animaNode.width;
              animaNode.scaleY = rectNode.height / animaNode.height;
              var opArr = actionData.changeOption;
              var tweenArr = [];
              for (var _i8 = 0; _i8 < opArr.length; _i8++) {
                var opData = opArr[_i8];
                console.log("opData: ~~~ ", opData);
                if ("opacity" == opData[0]) {
                  animaNode.opacity = Number(opData[1] / 100 * 255) + .1;
                  console.log(animaNode.opacity);
                  tweenArr.push({
                    item: animaNode,
                    option: '{"' + opData[0] + '" : ' + opData[2] / 100 * 255 + "}",
                    optionName: null == opData[2] ? "" : opData[0]
                  });
                }
                actionData.audio_url && cc.assetManager.loadRemote(actionData.audio_url, function(err, audioClip) {
                  rectNode.audioClip = audioClip;
                });
                rectNode.addComponent(cc.Button);
                rectNode.on("click", function() {
                  if (rectNode.audioClip) {
                    cc.audioEngine.stopAllEffects();
                    cc.audioEngine.playEffect(rectNode.audioClip, false, .8);
                  }
                  rectNode.isClicked;
                  rectNode.isClicked = true;
                  for (var j = 0; j < tweenArr.length; j++) {
                    var tweenData = tweenArr[j];
                    console.log("tweenData: ", tweenData);
                    tweenData.optionName && cc.tween(tweenData.item).to(actionData.changeTime, JSON.parse(tweenData.option)).start();
                  }
                  animationNames.length > 0 && dragonDisplay.playAnimation(animationNames[0], 1);
                });
              }
            });
          });
        });
      },
      setOneAnimaSmall: function setOneAnimaSmall(data) {
        var rate = this.hotZoneBg.scale * this.hotZoneBg.width / this.data.bgItem.rect.width;
        var rectNode = new cc.Node();
        rectNode.name = "rect" + data.index;
        this.hotZoneBg.addChild(rectNode);
        var ctx = rectNode.addComponent(cc.Graphics);
        ctx.lineWidth = 4;
        ctx.strokeColor = cc.Color.BLACK;
        ctx.fillColor = cc.Color.WHITE.setA(100);
        var scale = rate / this.hotZoneBg.scaleY;
        rectNode.width = data.rect.width * scale;
        rectNode.height = data.rect.height * scale;
        rectNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale;
        rectNode.y = this.hotZoneBg.height / 2 - data.rect.height * scale - data.rect.y * scale;
        rectNode.anchorX = rectNode.anchorY = 0;
        this.data.bgItem.isShowDebugLine && ctx.rect(0, 0, rectNode.width, rectNode.height);
        ctx.stroke();
        ctx.fill();
        var animaNode = new cc.Node();
        animaNode.name = "anima_" + data.index;
        this.hotZoneBg.addChild(animaNode);
        data.audio_url && cc.assetManager.loadRemote(data.audio_url, function(err, audioClip) {
          animaNode.audioClip = audioClip;
        });
        var dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
        if (!data.texPngData) return;
        var image = data.texPngData.url;
        var ske = data.skeJsonData.url;
        var atlas = data.texJsonData.url;
        cc.loader.load(image, function(error, texture) {
          cc.loader.load({
            url: atlas,
            type: "txt"
          }, function(error, atlasJson) {
            cc.loader.load({
              url: ske,
              type: "txt"
            }, function(error, dragonBonesJson) {
              var atlas = new dragonBones.DragonBonesAtlasAsset();
              atlas.atlasJson = atlasJson;
              atlas.texture = texture;
              var asset = new dragonBones.DragonBonesAsset();
              asset.dragonBonesJson = dragonBonesJson;
              dragonDisplay.dragonAtlasAsset = atlas;
              dragonDisplay.dragonAsset = asset;
              var json = JSON.parse(asset.dragonBonesJson);
              var armatures = json["armature"];
              var armatureNames = [];
              for (var i = 0; i < armatures.length; i++) armatureNames.push(armatures[i].name);
              if (armatureNames.length > 0) {
                var defaultArmatureName = armatureNames[0];
                dragonDisplay.armatureName = defaultArmatureName;
                var defaultArmature = armatures[0];
                var animations = defaultArmature.animation;
                var animationNames = [];
                for (var _i9 = 0; _i9 < animations.length; _i9++) animationNames.push(animations[_i9].name);
                rectNode.addComponent(cc.Button);
                rectNode.on("click", function() {
                  rectNode.isClicked;
                  rectNode.isClicked = true;
                  console.log("clicked");
                  if (animaNode.audioClip) {
                    cc.audioEngine.stopAllEffects();
                    cc.director.emit("STOP_ALL_AUDIO");
                    cc.audioEngine.playEffect(animaNode.audioClip, false, .8);
                  }
                  animationNames.length > 0 && dragonDisplay.playAnimation(animationNames[0], 1);
                });
              }
              animaNode.x = rectNode.x + rectNode.width / 2;
              animaNode.y = rectNode.y + rectNode.height / 2;
              var sx = rectNode.width / animaNode.width;
              var sy = rectNode.height / animaNode.height;
              var scale = Math.min(sx, sy);
              animaNode.scale = scale;
            });
          });
        });
      },
      setOnePic: function setOnePic(data) {
        var _this57 = this;
        var rate = this.hotZoneBg.scale * this.hotZoneBg.width / this.data.bgItem.rect.width;
        var picNode = new cc.Node();
        picNode.name = "pic" + data.index;
        picNode.data = data;
        this.hotZoneBg.addChild(picNode);
        cc.loader.load({
          url: data.pic_url
        }, function(err, img) {
          var spr = picNode.addComponent(cc.Sprite);
          spr.spriteFrame = new cc.SpriteFrame(img);
          var scale = rate / _this57.hotZoneBg.scaleY;
          picNode.width = data.rect.width * scale;
          picNode.height = data.rect.height * scale;
          picNode.x = -_this57.hotZoneBg.width / 2 + data.rect.x * scale;
          picNode.y = _this57.hotZoneBg.height / 2 - data.rect.height * scale - data.rect.y * scale;
          picNode.anchorX = picNode.anchorY = 0;
          data.audio_url && _this57.addPicAudio(picNode);
        });
      },
      setOneRect: function setOneRect(data) {
        var rate = this.hotZoneBg.scale * this.hotZoneBg.width / this.data.bgItem.rect.width;
        var rectNode = new cc.Node();
        rectNode.name = "rect" + data.index;
        this.hotZoneBg.addChild(rectNode);
        var ctx = rectNode.addComponent(cc.Graphics);
        ctx.lineWidth = 4;
        ctx.strokeColor = cc.Color.BLACK;
        ctx.fillColor = cc.Color.WHITE.setA(100);
        var scale = rate / this.hotZoneBg.scaleY;
        rectNode.width = data.rect.width * scale;
        rectNode.height = data.rect.height * scale;
        rectNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale;
        rectNode.y = this.hotZoneBg.height / 2 - data.rect.height * scale - data.rect.y * scale;
        rectNode.anchorX = rectNode.anchorY = 0;
        this.data.bgItem.isShowDebugLine && ctx.rect(0, 0, rectNode.width, rectNode.height);
        ctx.stroke();
        ctx.fill();
        data.audio_url && cc.assetManager.loadRemote(data.audio_url, function(err, audioClip) {
          rectNode.audioClip = audioClip;
        });
        rectNode.addComponent(cc.Button);
        rectNode.on("click", function() {
          rectNode.isClicked;
          rectNode.isClicked = true;
          console.log("clicked");
          if (rectNode.audioClip) {
            cc.audioEngine.stopAllEffects();
            cc.audioEngine.playEffect(rectNode.audioClip, false, .8);
          }
        });
      },
      addPicAudio: function addPicAudio(picNode) {
        var data = picNode.data;
        cc.assetManager.loadRemote(data.audio_url, function(err, audioClip) {
          picNode.audioClip = audioClip;
        });
        picNode.addComponent(cc.Button);
        picNode.on("click", function() {
          if (picNode.audioClip) {
            cc.audioEngine.stopAllEffects();
            cc.audioEngine.playEffect(picNode.audioClip, false, .8);
          }
        });
      }
    });
    cc._RF.pop();
  }, {
    "./util": "util"
  } ],
  util: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "25ccfBBvfNLaoaDwk5MOf7U", "util");
    "use strict";
    exports.__esModule = true;
    exports.getPosByAngle = getPosByAngle;
    exports.getAngleByPos = getAngleByPos;
    exports.exchangeNodePos = exchangeNodePos;
    exports.RandomInt = RandomInt;
    exports.randomSortByArr = randomSortByArr;
    exports.setSprNodeMaxLen = setSprNodeMaxLen;
    exports.getSpriteFrimeByUrl = getSpriteFrimeByUrl;
    exports.getSprNode = getSprNode;
    exports.getSprNodeByUrl = getSprNodeByUrl;
    exports.playAudio = playAudio;
    exports.playAudioByUrl = playAudioByUrl;
    exports.asyncDelay = asyncDelay;
    exports.showFireworks = showFireworks;
    exports.asyncTweenTo = asyncTweenTo;
    exports.asyncTweenBy = asyncTweenBy;
    exports.showTrebleFirework = showTrebleFirework;
    exports.delayCall = delayCall;
    exports.removeFromArr = removeFromArr;
    exports.showBtnAnima = showBtnAnima;
    exports.jellyShake = jellyShake;
    exports.FireworkSettings = void 0;
    function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
      try {
        var info = gen[key](arg);
        var value = info.value;
      } catch (error) {
        reject(error);
        return;
      }
      info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
    }
    function _asyncToGenerator(fn) {
      return function() {
        var self = this, args = arguments;
        return new Promise(function(resolve, reject) {
          var gen = fn.apply(self, args);
          function _next(value) {
            asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
          }
          function _throw(err) {
            asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
          }
          _next(void 0);
        });
      };
    }
    function getPosByAngle(angle, len) {
      var radian = angle * Math.PI / 180;
      var x = Math.sin(radian) * len;
      var y = Math.cos(radian) * len;
      return {
        x: x,
        y: y
      };
    }
    function getAngleByPos(px, py, mx, my) {
      var x = Math.abs(px - mx);
      var y = Math.abs(py - my);
      var z = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
      var cos = y / z;
      var radina = Math.acos(cos);
      var angle = Math.floor(180 / (Math.PI / radina) * 100) / 100;
      mx > px && my > py && (angle = 180 - angle);
      mx === px && my > py && (angle = 180);
      mx > px && my === py && (angle = 90);
      mx < px && my > py && (angle = 180 + angle);
      mx < px && my === py && (angle = 270);
      mx < px && my < py && (angle = 360 - angle);
      return angle;
    }
    function exchangeNodePos(baseNode, targetNode) {
      return baseNode.convertToNodeSpaceAR(targetNode._parent.convertToWorldSpaceAR(cc.v2(targetNode.x, targetNode.y)));
    }
    function RandomInt(a, b) {
      void 0 === b && (b = 0);
      var max = Math.max(a, b);
      var min = Math.min(a, b);
      return Math.floor(Math.random() * (max - min) + min);
    }
    function randomSortByArr(arr) {
      var newArr = [];
      var tmpArr = arr.concat();
      while (tmpArr.length > 0) {
        var randomIndex = Math.floor(tmpArr.length * Math.random());
        newArr.push(tmpArr[randomIndex]);
        tmpArr.splice(randomIndex, 1);
      }
      return newArr;
    }
    function setSprNodeMaxLen(sprNode, maxW, maxH) {
      var sx = maxW / sprNode.width;
      var sy = maxH / sprNode.height;
      var s = Math.min(sx, sy);
      sprNode.scale = Math.round(1e3 * s) / 1e3;
    }
    function getSpriteFrimeByUrl(url, cb) {
      cc.loader.load({
        url: url
      }, function(err, img) {
        var spriteFrame = new cc.SpriteFrame(img);
        cb && cb(spriteFrame);
      });
    }
    function getSprNode(resName) {
      var sf = cc.find("Canvas/res/img/" + resName).getComponent(cc.Sprite).spriteFrame;
      var node = new cc.Node();
      node.addComponent(cc.Sprite).spriteFrame = sf;
      return node;
    }
    function getSprNodeByUrl(url, cb) {
      var node = new cc.Node();
      var spr = node.addComponent(cc.Sprite);
      getSpriteFrimeByUrl(url, function(sf) {
        spr.spriteFrame = sf;
        cb && cb(spr);
      });
    }
    function playAudio(audioClip, cb) {
      void 0 === cb && (cb = null);
      if (audioClip) {
        var audioId = cc.audioEngine.playEffect(audioClip, false, .8);
        cb && cc.audioEngine.setFinishCallback(audioId, function() {
          cb();
        });
        return audioId;
      }
    }
    function playAudioByUrl(audio_url, cb) {
      void 0 === cb && (cb = null);
      audio_url && cc.assetManager.loadRemote(audio_url, function(err, audioClip) {
        playAudio(audioClip, cb);
      });
    }
    function asyncDelay(_x) {
      return _asyncDelay.apply(this, arguments);
    }
    function _asyncDelay() {
      _asyncDelay = _asyncToGenerator(regeneratorRuntime.mark(function _callee(time) {
        return regeneratorRuntime.wrap(function _callee$(_context) {
          while (1) switch (_context.prev = _context.next) {
           case 0:
            return _context.abrupt("return", new Promise(function(resolve, reject) {
              try {
                setTimeout(function() {
                  resolve();
                }, 1e3 * time);
              } catch (e) {
                reject(e);
              }
            }));

           case 1:
           case "end":
            return _context.stop();
          }
        }, _callee);
      }));
      return _asyncDelay.apply(this, arguments);
    }
    var FireworkSettings = function() {
      function FireworkSettings(baseNode, nodeList, pos, side, range, number, scalseRange) {
        void 0 === pos && (pos = cc.v2(0, 0));
        void 0 === side && (side = cc.v2(0, 100));
        void 0 === range && (range = 50);
        void 0 === number && (number = 100);
        void 0 === scalseRange && (scalseRange = 0);
        this.baseNode = void 0;
        this.nodeList = void 0;
        this.pos = void 0;
        this.side = void 0;
        this.range = void 0;
        this.number = void 0;
        this.scalseRange = void 0;
        this.baseNode = baseNode;
        this.nodeList = nodeList;
        this.pos = pos;
        this.side = side;
        this.range = range;
        this.number = number;
        this.scalseRange = scalseRange;
      }
      FireworkSettings.copy = function copy(firework) {
        return new FireworkSettings(firework.baseNode, firework.nodeList, firework.pos, firework.side, firework.range, firework.number);
      };
      return FireworkSettings;
    }();
    exports.FireworkSettings = FireworkSettings;
    function showFireworks(_x2) {
      return _showFireworks.apply(this, arguments);
    }
    function _showFireworks() {
      _showFireworks = _asyncToGenerator(regeneratorRuntime.mark(function _callee3(fireworkSettings) {
        var baseNode, nodeList, pos, side, range, number, scalseRange;
        return regeneratorRuntime.wrap(function _callee3$(_context3) {
          while (1) switch (_context3.prev = _context3.next) {
           case 0:
            baseNode = fireworkSettings.baseNode, nodeList = fireworkSettings.nodeList, pos = fireworkSettings.pos, 
            side = fireworkSettings.side, range = fireworkSettings.range, number = fireworkSettings.number, 
            scalseRange = fireworkSettings.scalseRange;
            new Array(number).fill(" ").forEach(function() {
              var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee2(_, i) {
                var rabbonNode, node, rate, angle;
                return regeneratorRuntime.wrap(function _callee2$(_context2) {
                  while (1) switch (_context2.prev = _context2.next) {
                   case 0:
                    rabbonNode = new cc.Node();
                    rabbonNode.parent = baseNode;
                    rabbonNode.x = pos.x;
                    rabbonNode.y = pos.y;
                    rabbonNode.angle = 60 * Math.random() - 30;
                    node = cc.instantiate(nodeList[RandomInt(nodeList.length)]);
                    node.parent = rabbonNode;
                    node.active = true;
                    node.x = 0;
                    node.y = 0;
                    node.angle = 0;
                    node.scale = (Math.random() - .5) * scalseRange + 1;
                    rate = Math.random();
                    angle = Math.PI * (2 * Math.random() - 1);
                    _context2.next = 16;
                    return asyncTweenBy(rabbonNode, .3, {
                      x: side.x * rate + Math.cos(angle) * range * rate,
                      y: side.y * rate + Math.sin(angle) * range * rate
                    }, {
                      easing: "quadIn"
                    });

                   case 16:
                    cc.tween(rabbonNode).by(8, {
                      y: -2e3
                    }).start();
                    cc.tween(rabbonNode).to(5, {
                      scale: (Math.random() - .5) * scalseRange + 1
                    }).start();
                    rabbonFall(rabbonNode);
                    _context2.next = 21;
                    return asyncDelay(Math.random());

                   case 21:
                    cc.tween(node).by(.15, {
                      x: -10,
                      angle: -10
                    }).by(.3, {
                      x: 20,
                      angle: 20
                    }).by(.15, {
                      x: -10,
                      angle: -10
                    }).union().repeatForever().start();
                    cc.tween(rabbonNode).delay(5).to(.3, {
                      opacity: 0
                    }).call(function() {
                      node.stopAllActions();
                      node.active = false;
                      node.parent = null;
                      node = null;
                    }).start();

                   case 23:
                   case "end":
                    return _context2.stop();
                  }
                }, _callee2);
              }));
              return function(_x12, _x13) {
                return _ref.apply(this, arguments);
              };
            }());

           case 2:
           case "end":
            return _context3.stop();
          }
        }, _callee3);
      }));
      return _showFireworks.apply(this, arguments);
    }
    function rabbonFall(_x3) {
      return _rabbonFall.apply(this, arguments);
    }
    function _rabbonFall() {
      _rabbonFall = _asyncToGenerator(regeneratorRuntime.mark(function _callee4(node) {
        var time, offsetX;
        return regeneratorRuntime.wrap(function _callee4$(_context4) {
          while (1) switch (_context4.prev = _context4.next) {
           case 0:
            time = 1 + Math.random();
            offsetX = RandomInt(-200, 200) * time;
            _context4.next = 4;
            return asyncTweenBy(node, time, {
              x: offsetX,
              angle: 60 * offsetX / 200
            });

           case 4:
            rabbonFall(node);

           case 5:
           case "end":
            return _context4.stop();
          }
        }, _callee4);
      }));
      return _rabbonFall.apply(this, arguments);
    }
    function asyncTweenTo(_x4, _x5, _x6, _x7) {
      return _asyncTweenTo.apply(this, arguments);
    }
    function _asyncTweenTo() {
      _asyncTweenTo = _asyncToGenerator(regeneratorRuntime.mark(function _callee5(node, duration, obj, ease) {
        return regeneratorRuntime.wrap(function _callee5$(_context5) {
          while (1) switch (_context5.prev = _context5.next) {
           case 0:
            void 0 === ease && (ease = void 0);
            return _context5.abrupt("return", new Promise(function(resolve, reject) {
              try {
                cc.tween(node).to(duration, obj, ease).call(function() {
                  resolve();
                }).start();
              } catch (e) {
                reject(e);
              }
            }));

           case 2:
           case "end":
            return _context5.stop();
          }
        }, _callee5);
      }));
      return _asyncTweenTo.apply(this, arguments);
    }
    function asyncTweenBy(_x8, _x9, _x10, _x11) {
      return _asyncTweenBy.apply(this, arguments);
    }
    function _asyncTweenBy() {
      _asyncTweenBy = _asyncToGenerator(regeneratorRuntime.mark(function _callee6(node, duration, obj, ease) {
        return regeneratorRuntime.wrap(function _callee6$(_context6) {
          while (1) switch (_context6.prev = _context6.next) {
           case 0:
            void 0 === ease && (ease = void 0);
            return _context6.abrupt("return", new Promise(function(resolve, reject) {
              try {
                cc.tween(node).by(duration, obj, ease).call(function() {
                  resolve();
                }).start();
              } catch (e) {
                reject(e);
              }
            }));

           case 2:
           case "end":
            return _context6.stop();
          }
        }, _callee6);
      }));
      return _asyncTweenBy.apply(this, arguments);
    }
    function showTrebleFirework(baseNode, rabbonList) {
      var middle = new FireworkSettings(baseNode, rabbonList);
      middle.pos = cc.v2(0, -400);
      middle.side = cc.v2(0, 1e3);
      middle.range = 200;
      middle.number = 100;
      middle.scalseRange = .4;
      var left = FireworkSettings.copy(middle);
      left.pos = cc.v2(-600, -400);
      left.side = cc.v2(200, 1e3);
      var right = FireworkSettings.copy(middle);
      right.pos = cc.v2(600, -400);
      right.side = cc.v2(-200, 1e3);
      showFireworks(middle);
      showFireworks(left);
      showFireworks(right);
    }
    function delayCall(time, cb) {
      return cc.tween({}).delay(time).call(function() {
        cb && cb();
      }).start();
    }
    function removeFromArr(arr, item) {
      var index = arr.indexOf(item);
      if (-1 != index) {
        arr.splice(index, 1);
        return true;
      }
      return false;
    }
    function showBtnAnima(btn) {
      var baseS = btn.scale;
      cc.tween(btn).to(.05, {
        scale: .9 * baseS
      }).to(.05, {
        scale: 1 * baseS
      }).call(function() {}).start();
    }
    function jellyShake(node) {
      var baseS = node.scale;
      var time = 1;
      cc.tween(node).to(time / 5 / 2, {
        scaleX: .8 * baseS,
        scaleY: 1.2 * baseS
      }, {
        easing: "sineInOut"
      }).to(time / 5, {
        scaleX: 1.1 * baseS,
        scaleY: .9 * baseS
      }, {
        easing: "sineInOut"
      }).to(time / 5, {
        scaleX: .95 * baseS,
        scaleY: 1.15 * baseS
      }, {
        easing: "sineInOut"
      }).to(time / 5, {
        scaleX: 1.02 * baseS,
        scaleY: .98 * baseS
      }, {
        easing: "sineInOut"
      }).to(time / 5, {
        scaleX: 1 * baseS,
        scaleY: 1 * baseS
      }, {
        easing: "sineInOut"
      }).start();
    }
    cc._RF.pop();
  }, {} ]
}, {}, [ "scene", "util" ]);