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;
}({
  ak_08: [ function(require, module, exports) {
    "use strict";
    cc._RF.push(module, "7445c4C861Fd75bJdQDO9vS", "ak_08");
    "use strict";
    var _util = require("../script/util");
    cc.Class({
      extends: cc.Component,
      properties: {
        baseWidth: {
          default: 1280,
          type: cc.Integer
        },
        baseHeight: {
          default: 720,
          type: cc.Integer
        }
      },
      onLoad: function 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);
          }
          _this.data = data || _this.getDefaultData();
          console.log("data:", _this.data);
          _this.preloadItem();
        });
      },
      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, isSend) {
        void 0 === isSend && (isSend = true);
        if (this.pageData) {
          console.log("this.pageData: ", this.pageData);
          this.pageData[key] = value;
          isSend && this.sendPageData();
        }
      },
      getPageData: function getPageData(key) {
        if (this.pageData && null != 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.addPreloadAudio();
        this.preload();
      },
      getData: function getData(func) {
        func(this.getDefaultData());
      },
      getDefaultData: function getDefaultData() {
        var dataJson = '{"video_url":"http://staging-teach.cdn.ireadabc.com/537aa38d43627c3997b28da1f1cc43da.mp4","lrcData":{"audio_url":"http://staging-teach.cdn.ireadabc.com/c5bc3378e4e0be11b67fc6cf625dfdf7.mp3","fontSize":24,"lineHeight":32,"lyrics":[{"time":0,"data":"","newLine":false},{"time":4.105990000000002,"data":"Apple, apple. I like apples.","newLine":false},{"time":7.992413,"data":"I like apples.","newLine":false},{"time":10.024486,"data":"What about you?","newLine":false},{"time":11.666604,"data":"","newLine":false},{"time":15.850838,"data":"Banana, banana. I like bananas.","newLine":false},{"time":20.004074,"data":"I like bananas.","newLine":false},{"time":21.992325,"data":"What about you?","newLine":false},{"time":23.618069,"data":"","newLine":false},{"time":27.853187,"data":"Orange, orange. I like oranges.","newLine":false},{"time":31.986444,"data":"I like oranges.","newLine":false},{"time":34.104426999999994,"data":"What about you?","newLine":false},{"time":35.690391,"data":"","newLine":false}]},"accompany_audio_url":"http://staging-teach.cdn.ireadabc.com/6d59bf82e77182bcb6520e3a3593b579.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 _this$data, _this$data$lrcData;
        this._audioResList.push({
          url: this.data.video_url
        });
        this._audioResList.push({
          url: this.data.accompany_audio_url
        });
        this._audioResList.push({
          url: null == (_this$data = this.data) ? void 0 : null == (_this$data$lrcData = _this$data.lrcData) ? void 0 : _this$data$lrcData.audio_url
        });
      },
      addPreloadAnima: function addPreloadAnima() {
        var _this4 = this;
        if (!this.data.hotZoneItemArr) return;
        this.data.hotZoneItemArr.forEach(function(item) {
          if (item.skeJsonData) {
            _this4._animaResList.push({
              url: item.skeJsonData.url || ""
            });
            _this4._animaResList.push({
              url: item.texJsonData.url || ""
            });
            _this4._animaResList.push({
              url: item.texPngData.url || ""
            });
          }
        });
      },
      loadEnd: function loadEnd(cb) {
        this.initData();
        this.initView(cb);
      },
      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,
      STATE_STOP: null,
      STATE_PLAYING: null,
      STATE_PAUSE: null,
      isSupportRecord: null,
      readyStartTime: null,
      readyEndTime: null,
      initData: function initData() {
        var _window$air2, _window$air2$airClass;
        this.STATE_STOP = 0;
        this.STATE_PLAYING = 1;
        this.STATE_PAUSE = 2;
        this.isSupportRecord = null == (_window$air2 = window.air) ? void 0 : null == (_window$air2$airClass = _window$air2.airClassInfo) ? void 0 : _window$air2$airClass.supportRecord;
        console.log("this.isSupportRecord : ", this.isSupportRecord);
        this.readyStartTime = 3;
        this.readyEndTime = 1;
        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() {},
      playBgMusic: function playBgMusic() {
        var _this5 = this;
        (0, _util.playAudio)(this.bgClip, function() {
          _this5.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 _this6 = this;
        console.log(" in addServerListener");
        var c = window.courseware;
        if (!c) return;
        if (!window.air) {
          console.log(" window air err !!!!!!!!");
          return;
        }
        window.air.onCourseInScreen = function(next) {
          _this6.showTemplateStartAnima();
          _this6.loadEnd(function() {
            next();
          });
        };
        c.onEvent("top_btn_click", function(data, next) {
          console.log("in top_btn_click : ", data);
          _this6.topBtnClick(data.index);
          next();
        });
        c.onEvent("play_video", function(data, next) {
          console.log("in play_video : ", data);
          _this6.playVideo(data.time);
          next();
        });
        c.onEvent("pause_video", function(data, next) {
          console.log("in pause_video : ", data);
          _this6.pauseVideo(data.time);
          next();
        });
        c.onEvent("icon_listen_click", function(data, next) {
          console.log("in icon_listen_click : ", data);
          _this6.iconListenClick(data.index);
          next();
        });
        c.onEvent("icon_sing_click", function(data, next) {
          console.log("in icon_sing_click : ", data);
          _this6.iconSingClick(data.index);
          next();
        });
        c.onEvent("icon_right_click", function(data, next) {
          console.log("in icon_right_click : ", data);
          _this6.iconRightClick(data.index);
          next();
        });
        c.onEvent("show_template_end_anima", function(data, next) {
          console.log("in show_template_end_anima : ", data);
          _this6.showTemplateEndAnima();
          next();
        });
        c.onEvent("record_end", function(data, next) {
          console.log("in record_end : ", data);
          _this6.serverRecordEnd(data);
          next();
        });
      },
      addServerListenerTest: function addServerListenerTest(event, data) {
        console.log("event: ", event);
        console.log("data: ", data);
        switch (event) {
         case "top_btn_click":
          this.topBtnClick(data.index);
          break;

         case "play_video":
          this.playVideo(data.time);
          break;

         case "pause_video":
          this.pauseVideo(data.time);
          break;

         case "icon_listen_click":
          this.iconListenClick(data.index);
          break;

         case "icon_sing_click":
          this.iconSingClick(data.index);
          break;

         case "icon_right_click":
          this.iconRightClick(data.index);
          break;

         case "show_template_end_anima":
          this.showTemplateEndAnima();
        }
      },
      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);
      },
      isShowEndAnima: null,
      showTemplateEndAnima: function showTemplateEndAnima() {
        var _this7 = this;
        if (this.isShowEndAnima) return;
        this.isShowEndAnima = true;
        window && window.courseware && this.isTeacher && window.courseware.nextPage();
        return;
        var resDragonBone;
        var pageturn;
        var canvas;
        var dragonDisplay;
      },
      initView: function initView(cb) {
        var _this8 = this;
        this.setTransparentCanvas();
        this.initBg();
        this.initHand();
        this.initTop();
        this.initVideo();
        this.initSing();
        this.initNextBtn();
        this.curTopBtnIndex = 0;
        this.showTopBtn(this.topBtnArr[0]);
        this.videoPlayer.node.on("ready-to-play", function() {
          console.log(" IN ready-to-play  !!!");
          _this8.videoPlayer.play();
          checkIsPlaying();
        });
        var checkIsPlaying = function checkIsPlaying() {
          (0, _util.delayCall)(.01, function() {
            if (_this8.videoPlayer.currentTime) {
              _this8.pauseVideo();
              _this8.showVideo();
              _this8.refreshByPageData();
              cb();
            } else checkIsPlaying();
          });
        };
      },
      setTransparentCanvas: function setTransparentCanvas() {
        cc.Camera.main.backgroundColor = new cc.Color(0, 0, 0, 0);
        cc.game.canvas.style.backgroundColor = "transparent";
      },
      initVideo: function initVideo() {
        this.initVideoPlayer();
        this.initVideoView();
      },
      videoPlayer: null,
      initVideoPlayer: function initVideoPlayer() {
        var _this9 = this;
        var videoNode = cc.find("Canvas/video");
        var vPlayer = cc.find("Canvas/video/player").getComponent(cc.VideoPlayer);
        vPlayer.remoteURL = this.data.video_url;
        this.videoPlayer = vPlayer;
        videoNode.zIndex = 0;
        videoNode.width = this.canvas.width;
        videoNode.height = this.canvas.height;
        vPlayer.stayOnBottom = true;
        vPlayer.node.on("completed", function() {
          console.log(" in completed!!!!");
          _this9.videoPlayEnd();
        });
      },
      vPlayBtn: null,
      vPauseBtn: null,
      stripBtn: null,
      strip: null,
      stripBg: null,
      initVideoView: function initVideoView() {
        var _this10 = this;
        var vNode = new cc.Node();
        this.canvas.addChild(vNode);
        var vPlayBtn = (0, _util.getSprNode)("video/video_play");
        vNode.addChild(vPlayBtn);
        vPlayBtn.scale = this._mapScaleMin;
        vPlayBtn.on(cc.Node.EventType.TOUCH_START, function() {
          console.log(" in vPlayBtn");
          console.log("this.videoPlayer.currentTime: ", _this10.videoPlayer.currentTime);
          var time = 0;
          if (_this10.videoPlayer.isEnd) _this10.sendServerEvent("play_video", {
            time: time
          }); else {
            console.log("```this.videoPlayer.currentTime: ", _this10.videoPlayer.currentTime);
            if (_this10.videoPlayer.curServerTime) {
              time = _this10.videoPlayer.curServerTime;
              _this10.videoPlayer.curServerTime = null;
            } else time = _this10.videoPlayer.currentTime;
            _this10.sendServerEvent("play_video", {
              time: time
            });
          }
          _this10.setPageData("videoState", _this10.STATE_PLAYING, false);
          _this10.setPageData("videoStartTime", time, false);
          _this10.setPageData("videoStartDate", new Date().getTime());
        });
        this.vPlayBtn = vPlayBtn;
        var vPauseBtn = (0, _util.getSprNode)("video/video_pause");
        vNode.addChild(vPauseBtn);
        vPauseBtn.scale = this._mapScaleMin;
        vPauseBtn.active = false;
        vPauseBtn.on(cc.Node.EventType.TOUCH_START, function() {
          _this10.sendServerEvent("pause_video", {
            time: _this10.videoPlayer.currentTime
          });
          _this10.setPageData("videoState", _this10.STATE_PAUSE, false);
          _this10.setPageData("videoStartTime", _this10.videoPlayer.currentTime);
        });
        this.vPauseBtn = vPauseBtn;
        var stripBg = (0, _util.getSprNode)("video/video_strip_bg");
        vNode.addChild(stripBg, 1);
        stripBg.y = -200 * this._mapScaleMin;
        this.stripBg = stripBg;
        var strip = (0, _util.getSprNode)("video/video_strip");
        strip.anchorX = 0;
        strip.x = -strip.width / 2;
        stripBg.addChild(strip);
        strip.baseW = strip.width;
        this.strip = strip;
        var stripBtn = (0, _util.getSprNode)("video/video_strip_btn");
        stripBg.addChild(stripBtn, 1);
        this.stripBtn = stripBtn;
        this.updateStrip(true);
        this.isTeacher || (vNode.active = false);
      },
      updateStrip: function updateStrip(force) {
        var _this$videoPlayer;
        void 0 === force && (force = false);
        if (!force && !(null != (_this$videoPlayer = this.videoPlayer) && _this$videoPlayer.isPlaying())) return;
        var percent;
        var duration = this.videoPlayer.getDuration();
        percent = duration ? this.videoPlayer.currentTime / duration : 0;
        percent = Math.round(1e4 * percent) / 1e4;
        this.stripBtn.x = this.stripBg.width * percent - this.stripBg.width / 2;
        var sf = this.strip.getComponent(cc.Sprite).spriteFrame;
        this.strip.width = this.strip.baseW * percent;
        var tmpRect = new cc.Rect(0, 0, this.strip.baseW * percent, this.strip.height);
        sf.setRect(tmpRect);
      },
      initSing: function initSing() {
        this.initSingAudio();
        this.initSingLayer();
        this.initSingText();
        this.initSingStrip();
        this.showTi2();
        this.initSingBigIcon();
        this.setSingLayerOpacity();
        this.singLayer.active = false;
      },
      singAudioClip: null,
      accompanyClip: null,
      initSingAudio: function initSingAudio() {
        var _this11 = this;
        if (!this.data.lrcData || !this.data.lrcData.audio_url) return;
        cc.assetManager.loadRemote(this.data.lrcData.audio_url, function(err, audioClip) {
          _this11.singAudioClip = audioClip;
        });
        this.data.accompany_audio_url && cc.loader.load({
          url: this.data.accompany_audio_url
        }, function(err, clip) {
          _this11.accompanyClip = clip;
        });
      },
      singLayer: null,
      initSingLayer: function initSingLayer() {
        var layer = new cc.Node();
        this.canvas.addChild(layer, 3);
        layer.width = this.canvas.width;
        layer.height = this.canvas.height;
        this.singLayer = layer;
      },
      lyrics: null,
      singLabelLayer: null,
      singLabelArr: null,
      initSingText: function initSingText() {
        var _this$data2, _this$data2$lrcData;
        var lyrics = (null == (_this$data2 = this.data) ? void 0 : null == (_this$data2$lrcData = _this$data2.lrcData) ? void 0 : _this$data2$lrcData.lyrics) || [];
        if (!lyrics) return;
        this.lyrics = lyrics;
        this.singLabelArr = [];
        for (var i = 0; i < lyrics.length; i++) {
          var data = lyrics[i];
          if (data && !data.data) {
            lyrics.splice(i, 1);
            i--;
          }
        }
        var labelLayer = new cc.Node();
        this.singLayer.addChild(labelLayer);
        this.singLabelLayer = labelLayer;
        var baseY = 0;
        var disH = 100 * this._mapScaleMin;
        for (var _i = 0; _i < lyrics.length; _i++) {
          lyrics[_i].index = _i;
          var labelNode = this.getOneSingLabel(lyrics[_i]);
          labelLayer.addChild(labelNode);
          labelNode.y = baseY - disH * _i;
          labelNode.index = _i;
          var tailNode = new cc.Node();
          tailNode.parent = labelNode.parent;
          labelNode.iconNode.parent = tailNode;
          labelNode.tailNode = tailNode;
          tailNode.y = labelNode.y;
          this.singLabelArr.push(labelNode);
        }
      },
      addLabelReadyDot: function addLabelReadyDot(label) {
        var dotLabel = this.getLabel();
        var dotNode = dotLabel.node;
        label.node.addChild(dotNode);
        dotNode.x = -label.textW / 2 - 20;
        dotNode.color = cc.Color.fromHEX(new cc.Color(), "#733e00");
        dotNode.anchorX = 1;
        dotNode.active = false;
        label.dotLabel = dotLabel;
      },
      showDotLabelAnima: function showDotLabelAnima(label) {
        label.node.active = true;
        label.dotNum = 2;
        label.string = this.getDotString(label.dotNum);
        this.subDotNum(label);
      },
      subDotNum: function subDotNum(label) {
        var _this12 = this;
        (0, _util.delayCall)(1, function() {
          if (_this12.isDestroy) return;
          if (label.dotNum > 0) {
            label.dotNum--;
            label.string = _this12.getDotString(label.dotNum);
            _this12.subDotNum(label);
          }
        });
      },
      getDotString: function getDotString(dotNum) {
        var str = "";
        for (var i = 0; i < dotNum; i++) str += "\u25cf ";
        return str;
      },
      isSingBarTouch: null,
      singStripBtn: null,
      singStripBg: null,
      textTotalH: null,
      initSingStrip: function initSingStrip() {
        var _this13 = this;
        var stripBg = (0, _util.getSprNode)("sing/sing_strip_bg");
        this.singLayer.addChild(stripBg);
        stripBg.x = this.singLayer.width / 2 - 20 * this._mapScaleMin;
        stripBg.y = -20 * this._mapScaleMin;
        var stripRealBg = new cc.Node();
        stripRealBg.x = stripBg.x;
        stripRealBg.y = stripBg.y;
        stripRealBg.width = stripBg.width;
        stripRealBg.height = stripBg.height;
        this.singLayer.addChild(stripRealBg);
        this.singStripBg = stripRealBg;
        var stripBtn = (0, _util.getSprNode)("sing/sing_strip_btn");
        stripRealBg.addChild(stripBtn);
        stripRealBg.height -= .8 * stripBtn.height;
        stripBtn.y = stripRealBg.height / 2;
        this.singStripBtn = stripBtn;
        this.singLabelArr && this.singLabelArr.length > 0 ? this.textTotalH = Math.abs(this.singLabelArr[this.singLabelArr.length - 1].y) : this.textTotalH = 0;
        if (!this.isTeacher) {
          stripBg.active = false;
          stripRealBg.active = false;
        }
        stripBtn.on(cc.Node.EventType.TOUCH_START, function(e) {
          _this13.isSingBarTouch = true;
          _this13.stopSing();
          _this13.stopSingLabelToCenter();
        });
        this.singLayer.on(cc.Node.EventType.TOUCH_MOVE, function(e) {
          if (!_this13.isSingBarTouch) return;
          _this13.setStripBtnPos(e);
          _this13.setSingLayerPos();
          _this13.setSingLayerOpacity();
        });
        this.singLayer.on(cc.Node.EventType.TOUCH_END, function(e) {
          console.log(" touch end ");
          if (!_this13.isSingBarTouch) return;
          _this13.curCenterLabel && _this13.setSingLabelToCenter(_this13.curCenterLabel);
          _this13.isSingBarTouch = false;
        });
      },
      setStripBtnPos: function setStripBtnPos(e) {
        var pos = e.getLocation();
        var stripBtn = this.singStripBtn;
        var stripBg = this.singStripBg;
        stripBtn.y = (pos.y - e.currentTarget.height / 2 - stripBg.y) / stripBg.scaleY;
        stripBtn.y < -stripBg.height / 2 && (stripBtn.y = -stripBg.height / 2);
        stripBtn.y > stripBg.height / 2 && (stripBtn.y = stripBg.height / 2);
      },
      setSingLayerPos: function setSingLayerPos() {
        var stripBtn = this.singStripBtn;
        var stripBg = this.singStripBg;
        var rate = (stripBg.height / 2 - stripBtn.y) / stripBg.height;
        var layerY = this.textTotalH * rate;
        this.singLabelLayer.y = layerY;
      },
      curCenterLabel: null,
      setSingLayerOpacity: function setSingLayerOpacity() {
        var layer = this.singLabelLayer;
        var arr = this.singLabelArr;
        var rate = 1.2;
        for (var i = 0; i < arr.length; i++) {
          var label = arr[i];
          var opacity = 255 - Math.abs(layer.y + label.y) * rate;
          opacity = Math.round(1e3 * opacity) / 1e3;
          opacity < 0 && (opacity = 0);
          if (opacity < 200) {
            label.iconNode.active = false;
            label.smallRight && (label.smallRight.active = false);
          } else {
            label.iconNode.active = true;
            label.smallRight && (label.smallRight.active = true);
            this.curCenterLabel = label;
          }
          this.isTeacher || (label.iconNode.active = false);
          label.scale = .6 + opacity / 255 * .4;
          label.opacity = opacity;
        }
      },
      stopSingLabelToCenter: function stopSingLabelToCenter() {
        if (this.toCenterLabelTween) {
          this.toCenterLabelTween.stop();
          clearInterval(this.toCenterLabelTweenUpdateId);
        }
      },
      toCenterLabelTween: null,
      toCenterLabelTweenUpdateId: null,
      setSingLabelToCenter: function setSingLabelToCenter(singLabel) {
        var _this14 = this;
        this.stopSingLabelToCenter();
        var updateId;
        var updateAction = function updateAction() {
          updateId = setInterval(function() {
            _this14.setSingBarPos();
            _this14.setSingLayerOpacity();
          }, 1e3 / 60);
          _this14.toCenterLabelTweenUpdateId = updateId;
        };
        var stopUpdate = function stopUpdate() {
          clearInterval(updateId);
          _this14.toCenterLabelTween = null;
          _this14.toCenterLabelTweenUpdateId = null;
          _this14.setSingLayerOpacity();
        };
        this.toCenterLabelTween = cc.tween(this.singLabelLayer).call(function() {
          updateAction();
        }).to(.7, {
          y: -singLabel.y
        }).call(function() {
          stopUpdate();
        }).start();
      },
      setSingBarPos: function setSingBarPos() {
        var stripBtn = this.singStripBtn;
        var stripBg = this.singStripBg;
        var rate = this.singLabelLayer.y / this.textTotalH;
        stripBtn.y = stripBg.height / 2 - stripBg.height * rate;
      },
      bigSingIcon: null,
      bigListenIcon: null,
      initSingBigIcon: function initSingBigIcon() {
        if (!this.isTeacher) {
          var offX = 120 * this._mapScaleMin;
          var bigListenIcon = (0, _util.getSprNode)("sing/icon_listen_big");
          bigListenIcon.scale = this._mapScaleMin;
          this.singLayer.addChild(bigListenIcon);
          bigListenIcon.x = this.singLayer.width / 2 - offX;
          bigListenIcon.opacity = 0;
          this.bigListenIcon = bigListenIcon;
          var bigSingIcon = (0, _util.getSprNode)("sing/icon_sing_big");
          bigSingIcon.scale = this._mapScaleMin;
          this.singLayer.addChild(bigSingIcon);
          bigSingIcon.x = this.singLayer.width / 2 - offX;
          bigSingIcon.opacity = 0;
          this.bigSingIcon = bigSingIcon;
        }
      },
      curSingLabel: null,
      getOneSingLabel: function getOneSingLabel(data) {
        var _this15 = this;
        var text = data.data;
        var label = this.getLabel();
        var labelNode = label.node;
        labelNode.color = cc.Color.fromHEX(new cc.Color(), "#733e00");
        labelNode.data = data;
        label.string = text;
        label.fontSize = 54;
        label.lineHeight = 54;
        label.height = 54;
        label.data = data;
        label["_forceUpdateRenderData"](true);
        var textW = label.textW = label.node.width;
        label.HorizontalAlign = cc.Label.HorizontalAlign.LEFT;
        var labelNode2 = cc.instantiate(labelNode);
        labelNode2.parent = labelNode;
        var label2 = labelNode2.getComponent(cc.Label);
        label2.string = "";
        label.label2 = label2;
        labelNode2.x = -textW / 2;
        var labelNode3 = cc.instantiate(labelNode);
        labelNode3.parent = labelNode;
        var label3 = labelNode3.getComponent(cc.Label);
        label3.string = "";
        label.label3 = label3;
        labelNode2.anchorX = 0;
        labelNode3.anchorX = 0;
        var iconNode = new cc.Node();
        iconNode.x = textW / 2 + 70;
        labelNode.addChild(iconNode);
        labelNode.iconNode = iconNode;
        var listenBtn = (0, _util.getSprNode)("sing/icon_listen");
        iconNode.addChild(listenBtn, 1);
        listenBtn.anchorY = .3;
        listenBtn.anchorX = .4;
        labelNode.listenBtn = listenBtn;
        listenBtn.on(cc.Node.EventType.TOUCH_START, function() {
          _this15.sendServerEvent("icon_listen_click", {
            index: data.index
          });
          _this15.setPageData("curCenterLabelIndex", data.index);
        });
        this.addIconBtnBg(listenBtn);
        var singBtn = (0, _util.getSprNode)("sing/icon_sing");
        iconNode.addChild(singBtn, 1);
        singBtn.anchorY = .3;
        singBtn.x = listenBtn.x + 70;
        labelNode.singBtn = singBtn;
        singBtn.on(cc.Node.EventType.TOUCH_START, function() {
          _this15.sendServerEvent("icon_sing_click", {
            index: data.index
          });
          _this15.setPageData("curCenterLabelIndex", data.index);
        });
        this.addIconBtnBg(singBtn);
        var rightBtn = (0, _util.getSprNode)("sing/icon_right");
        iconNode.addChild(rightBtn);
        rightBtn.x = singBtn.x + 70;
        labelNode.rightBtn = rightBtn;
        rightBtn.on(cc.Node.EventType.TOUCH_START, function() {
          _this15.sendServerEvent("icon_right_click", {
            index: data.index
          });
          labelNode.isRight = true;
          _this15.setPageData("curCenterLabelIndex", data.index, false);
          _this15.setRightLabelObj();
        });
        this.addLabelReadyDot(label);
        return labelNode;
      },
      setRightLabelObj: function setRightLabelObj() {
        var rightLabelObj = {};
        var arr = this.singLabelArr;
        for (var i = 0; i < arr.length; i++) arr[i].isRight && (rightLabelObj[i.toString()] = {
          url: arr[i].audio_url || ""
        });
        this.setPageData("rightLabelObj", rightLabelObj);
      },
      loadRecord: function loadRecord(label) {
        label.audio_url && cc.loader.load({
          url: label.audio_url
        }, function(err, clip) {
          label.data.clip = clip;
          console.log("label audio load end ~~~ data: ", label.data);
        });
      },
      showBigListenIcon: function showBigListenIcon() {
        cc.tween(this.bigListenIcon).to(0, {
          opacity: 255
        }).start();
      },
      hideBigListenIcon: function hideBigListenIcon() {
        cc.tween(this.bigListenIcon).to(0, {
          opacity: 0
        }).start();
      },
      showBigSingIcon: function showBigSingIcon() {
        cc.tween(this.bigSingIcon).to(0, {
          opacity: 255
        }).start();
      },
      hideBigSingIcon: function hideBigSingIcon() {
        cc.tween(this.bigSingIcon).to(0, {
          opacity: 0
        }).start();
      },
      iconListenClick: function iconListenClick(index) {
        var richTextNode = this.singLabelArr[index];
        var richText = richTextNode.getComponent(cc.Label);
        var listenBtn = richTextNode.listenBtn;
        var singBtn = richTextNode.singBtn;
        (0, _util.showBtnAnima)(listenBtn);
        this.playSong(richText);
        this.resetLabelColor(richText);
        this.setSingLabelToCenter(richTextNode);
        singBtn.light.opacity = 0;
        listenBtn.light.opacity = 255;
        this.curSingLabel = richText;
        if (!this.isTeacher) {
          this.showBigListenIcon();
          this.hideBigSingIcon();
        }
      },
      iconSingClick: function iconSingClick(index) {
        var richTextNode = this.singLabelArr[index];
        var richText = richTextNode.getComponent(cc.Label);
        var listenBtn = richTextNode.listenBtn;
        var singBtn = richTextNode.singBtn;
        (0, _util.showBtnAnima)(singBtn);
        this.playAccompany(richText);
        this.resetLabelColor(richText);
        this.setSingLabelToCenter(richTextNode);
        this.beganRecording();
        richTextNode.rightBtn.scale = .6;
        singBtn.light.opacity = 255;
        listenBtn.light.opacity = 0;
        this.curSingLabel = richText;
        if (!this.isTeacher) {
          this.hideBigListenIcon();
          this.showBigSingIcon();
        }
      },
      iconRightClick: function iconRightClick(index) {
        var richTextNode = this.singLabelArr[index];
        var richText = richTextNode.getComponent(cc.Label);
        var rightBtn = richTextNode.rightBtn;
        if (!rightBtn.active) return;
        (0, _util.showBtnAnima)(rightBtn);
        this.stopSing();
        this.setSingLabelRight(richText);
        this.jumpNextSingLabel(richText);
        this.loadRecord(richText);
        this.checkCanTouchNextBtn();
        this.curSingLabel = null;
        if (!this.isTeacher) {
          this.hideBigListenIcon();
          this.hideBigSingIcon();
        }
      },
      addIconBtnBg: function addIconBtnBg(btn) {
        var normalBg = (0, _util.getSprNode)("sing/icon_bg_normal");
        btn.parent.addChild(normalBg);
        normalBg.x = btn.x;
        normalBg.y = btn.y;
        var lightBg = (0, _util.getSprNode)("sing/icon_bg_light");
        btn.parent.addChild(lightBg);
        lightBg.x = btn.x;
        lightBg.y = btn.y;
        lightBg.opacity = 0;
        btn.normal = normalBg;
        btn.light = lightBg;
      },
      stopSing: function stopSing() {
        if (null != this.singId) {
          cc.audioEngine.stopEffect(this.singId);
          clearInterval(this.voiceInterval);
          this.voiceInterval = null;
        }
      },
      setSingLabelRight: function setSingLabelRight(label) {
        label.node.color = cc.Color.fromHEX(new cc.Color(), "#007317");
        label.string = label.data.data;
        label.label2.string = "";
        label.label3.string = "";
        var smallRight = (0, _util.getSprNode)("sing/icon_right_s");
        smallRight.x = -label.textW / 2 - 50;
        smallRight.y = label.node.y;
        label.node.parent.addChild(smallRight);
        label.node.smallRight = smallRight;
        label.node.isRight = true;
        var rightBtn = label.node.rightBtn;
        rightBtn.active = false;
      },
      jumpNextSingLabel: function jumpNextSingLabel(label) {
        var nextIndex = label.node.index + 1;
        if (!this.singLabelArr[nextIndex]) return;
        this.setSingLabelToCenter(this.singLabelArr[nextIndex]);
      },
      checkCanTouchNextBtn: function checkCanTouchNextBtn() {
        var count = 0;
        var arr = this.singLabelArr;
        for (var i = 0; i < arr.length; i++) {
          if (!arr[i].isRight) return;
          arr[i].isRight && count++;
        }
        3 != count && count != this.singLabelArr.length || this.singEnd();
      },
      singEnd: function singEnd() {
        var topBtn = this.topBtnArr[2];
        if (topBtn.light.opacity > 254) return;
        if (this.isTeacher && topBtn.light.opacity <= 1) {
          this.showTi1();
          this.showHand(topBtn);
          this.setPageData("isTopLight3", true);
        }
        this.hideTi2();
        topBtn.light.opacity = 255;
      },
      beganRecording: function beganRecording() {
        if (this.isTeacher) return;
        console.log(" in beganRecording");
        if (this.isSupportRecord && window && window.courseware) {
          var beganRecording = window.courseware.beganRecording;
          beganRecording();
          console.log(" \u5f00\u59cb\u5f55\u97f3 ");
        }
      },
      endRecording: function endRecording(label) {
        var _this16 = this;
        if (this.isTeacher) return;
        console.log(" in endRecording ");
        if (!this.isSupportRecord) {
          this.sendServerEvent("record_end", {
            index: label.data.index,
            url: ""
          });
          return;
        }
        if (window && window.courseware) {
          var endRecording = window.courseware.endRecording;
          endRecording(function(audio_url) {
            audio_url && _this16.sendServerEvent("record_end", {
              index: label.data.index,
              url: audio_url
            });
            console.log(" \u5f55\u97f3\u7ed3\u675f ");
          });
        }
      },
      serverRecordEnd: function serverRecordEnd(data) {
        console.log(" in serverRecordEnd data: ", data);
        var index = data.index, url = data.url;
        var richTextNode = this.singLabelArr[index];
        if (richTextNode) {
          var richText = richTextNode.getComponent(cc.Label);
          richText.audio_url = url;
          richTextNode.audio_url = url;
          richTextNode.rightBtn.scale = 1;
        }
      },
      resetLabelColor: function resetLabelColor(label) {
        if (this.curSingLabel && this.curSingLabel != label) {
          var text = this.curSingLabel.data.data;
          this.curSingLabel.string = text;
          this.curSingLabel.node.isRight && this.setSingLabelRight(this.curSingLabel);
          console.log("in change color ");
        }
      },
      playAccompany: function playAccompany(label) {
        null != this.singId && cc.audioEngine.stopEffect(this.singId);
        var data = label.data;
        this.singId = cc.audioEngine.playEffect(this.accompanyClip, false, .8);
        var playTime = data.time - this.readyStartTime;
        playTime < 0 && (playTime = 0);
        cc.audioEngine.setCurrentTime(this.singId, playTime);
        label.node.isRight || this.showDotLabelAnima(label.dotLabel);
        var text = label.data.data;
        label.string = text;
        this.updateOneSingLight(label, true);
      },
      accompanyId: null,
      playAccompanyAndRecord: function playAccompanyAndRecord(time) {
        this.accompanyId = cc.audioEngine.playEffect(this.accompanyClip, false, .8);
        cc.audioEngine.setCurrentTime(this.accompanyId, time);
        console.log("accompanyId: ", this.accompanyId);
      },
      pauseAccompanyAndRecord: function pauseAccompanyAndRecord(time) {
        console.log(" in pauseAccompanyAndRecord ");
        if (null == this.accompanyId) return;
        console.log(" in pauseAccompanyAndRecord 2");
        cc.audioEngine.pauseEffect(this.accompanyId, time);
      },
      singId: null,
      playSong: function playSong(label) {
        null != this.singId && cc.audioEngine.stopEffect(this.singId);
        var data = label.data;
        this.singId = cc.audioEngine.playEffect(this.singAudioClip, false, .8);
        cc.audioEngine.setCurrentTime(this.singId, data.time);
        this.updateOneSingLight(label, false);
      },
      voiceInterval: null,
      updateOneSingLight: function updateOneSingLight(label, isRecord) {
        var _this17 = this;
        var lightColor;
        lightColor = isRecord ? "#007317" : "#d54419";
        void 0 !== this.voiceInterval && clearInterval(this.voiceInterval);
        var data = label.data;
        var text = data.data;
        var string = text;
        var curLineTime = data.time;
        var nextLineTime = this.getNextLineTime(data.index);
        var audioId = this.singId;
        this.voiceInterval = setInterval(function() {
          var currentTime = cc.audioEngine.getCurrentTime(audioId) - curLineTime;
          var duration = Number(nextLineTime) - Number(curLineTime);
          var rate = currentTime / duration;
          rate >= 1 && (rate = 1);
          var stringBeforeList = [];
          var stringAfterList = [];
          string.split(" ").forEach(function(letter, idx, list) {
            idx / list.length < rate ? stringBeforeList.push(letter) : stringAfterList.push(letter);
          });
          var label2 = label.label2;
          var label3 = label.label3;
          if (0 == stringAfterList.length) {
            label2.node.color = cc.Color.fromHEX(new cc.Color(), lightColor);
            label2.string = stringBeforeList.join(" ");
            label.string = "";
            label3.string = "";
          } else if (stringBeforeList.length > 0) {
            label.string = "";
            label2.node.color = cc.Color.fromHEX(new cc.Color(), lightColor);
            label2.string = stringBeforeList.join(" ");
            label2["_forceUpdateRenderData"](true);
            label3.node.color = cc.Color.fromHEX(new cc.Color(), "#733e00");
            label3.string = " " + stringAfterList.join(" ");
            label3.node.x = label2.node.x + label2.node.width;
          } else {
            label.node.color = cc.Color.fromHEX(new cc.Color(), "#733e00");
            label2.string = "";
            label3.string = "";
          }
          if (1 == rate) {
            clearInterval(_this17.voiceInterval);
            _this17.voiceInterval = null;
            if (!isRecord) {
              cc.audioEngine.stopEffect(audioId);
              return;
            }
            (0, _util.delayCall)(_this17.readyEndTime, function() {
              if (_this17.isDestroy) return;
              cc.audioEngine.stopEffect(audioId);
              isRecord && _this17.endRecording(label);
            });
          }
        }, 1e3 / 60);
      },
      getNextLineTime: function getNextLineTime(curLineIndex) {
        return this.lyrics[curLineIndex + 1] ? this.lyrics[curLineIndex + 1].time : cc.audioEngine.getDuration(this.singId);
      },
      showVideo: function showVideo() {
        this.bgBlock.enabled = false;
        this.videoPlayer.node.width = this.canvas.width;
        this.videoPlayer.node.height = this.canvas.height;
        this.videoPlayer.currentTime = 0;
        this.updateStrip(true);
        cc.tween(this.bg).to(0, {
          opacity: 0
        }).start();
      },
      hideVideo: function hideVideo() {
        var _this18 = this;
        this.bgBlock.enabled = true;
        cc.tween(this.bg).to(0, {
          opacity: 255
        }).call(function() {
          _this18.videoPlayer.node.width = 0;
          _this18.videoPlayer.node.height = 0;
        }).start();
      },
      playVideo: function playVideo(time) {
        this.vPlayBtn.active = false;
        this.vPauseBtn.active = true;
        this.videoPlayer.currentTime = time;
        this.isVideoPlayEnd = false;
        if (this.isSupportRecord && 2 == this.curTopBtnIndex) {
          this.playRecordVideo();
          this.playAccompanyAndRecord(time);
          this.videoPlayer.volume = 0;
        } else this.videoPlayer.volume = 1;
        this.videoPlayer.play();
        this.videoPlayer.isEnd = false;
        this.hideTopAnima();
        this.hideNextBtn();
        this.hideTi3();
      },
      isPlayRecord: null,
      playRecordVideo: function playRecordVideo() {
        console.log(" in playRecordVideo");
        this.isPlayRecord = true;
        if (this.curRecordId) {
          var state = cc.audioEngine.getState(this.curRecordId);
          state == cc.audioEngine.AudioState.PAUSED && cc.audioEngine.resume(this.curRecordId);
        }
      },
      pauseRecordVideo: function pauseRecordVideo() {
        this.isPlayRecord = false;
        if (this.curRecordId) {
          var state = cc.audioEngine.getState(this.curRecordId);
          state == cc.audioEngine.AudioState.PLAYING && cc.audioEngine.pause(this.curRecordId);
        }
      },
      pauseVideo: function pauseVideo(time) {
        void 0 === time && (time = null);
        this.videoPlayer.pause();
        this.vPlayBtn.active = true;
        this.vPauseBtn.active = false;
        time && (this.videoPlayer.currentTime = time);
        console.log("this.curTopBtnIndex: ", this.curTopBtnIndex);
        if (this.isSupportRecord && 2 == this.curTopBtnIndex) {
          this.pauseRecordVideo();
          this.pauseAccompanyAndRecord(time);
        }
      },
      isVideoPlayEnd: null,
      videoPlayEnd: function videoPlayEnd() {
        this.vPlayBtn.active = true;
        this.vPauseBtn.active = false;
        this.videoPlayer.isEnd = true;
        var topBtn = this.topBtnArr[1];
        if (this.isTeacher) {
          if (topBtn.light.opacity <= 1) {
            this.showTi1();
            this.showHand(topBtn);
            this.setPageData("isTopLight2", true, false);
          }
          this.setPageData("videoState", this.STATE_STOP);
          this.checkShowNextBtn();
        }
        topBtn.light.opacity = 255;
        this.showTopAnima();
        this.isVideoPlayEnd = true;
        this.isPlayedRecordObj = {};
      },
      bg: null,
      bgBlock: null,
      initBg: function initBg() {
        var bg = cc.find("Canvas/bg");
        bg.scale = this._mapScaleMax;
        this.bg = bg;
        bg.zIndex = 2;
        var blockInputEvents = bg.addComponent(cc.BlockInputEvents);
        this.bgBlock = blockInputEvents;
      },
      initTop: function initTop() {
        this.initTitle();
        this.initTopBtn();
      },
      initTitle: function initTitle() {
        var off = 10 * this._mapScaleMin;
        var title = (0, _util.getSprNode)("title");
        this.canvas.addChild(title, 10);
        title.anchorX = 0;
        title.anchorY = 1;
        title.x = -this.canvas.width / 2 + off;
        title.y = this.canvas.height / 2 - off;
      },
      topBtnArr: null,
      topNode: null,
      initTopBtn: function initTopBtn() {
        var _this19 = this;
        this.topBtnArr = [];
        var textArr = [ "top_text_1", "top_text_2", "top_text_3" ];
        this.isSupportRecord || (textArr[1] = "top_text_4", textArr[2] = "top_text_2");
        var topNode = new cc.Node();
        this.topNode = topNode;
        this.canvas.addChild(topNode, 10);
        var baseX = this.canvas.width / 2 - 500 * this._mapScaleMin;
        var disW = 190 * this._mapScaleMin;
        var _loop = function _loop(i) {
          var btnNode = new cc.Node();
          btnNode.scale = _this19._mapScaleMin;
          btnNode.x = baseX + i * disW;
          btnNode.y = _this19.canvas.height / 2;
          btnNode.anchorY = 1;
          btnNode.baseY = btnNode.y;
          topNode.addChild(btnNode);
          var normal = (0, _util.getSprNode)("btn_top_normal");
          btnNode.addChild(normal);
          normal.anchorY = 1;
          var light = (0, _util.getSprNode)("btn_top_light");
          btnNode.addChild(light);
          light.anchorY = 1;
          light.y = 25;
          0 != i && (light.opacity = 0);
          btnNode.light = light;
          var numBg = (0, _util.getSprNode)("top_num_bg");
          btnNode.addChild(numBg);
          numBg.y = -20;
          var numLabel = _this19.getLabel();
          var numLabelNode = numLabel.node;
          numBg.addChild(numLabelNode);
          numLabel.font = cc.find("Canvas/res/font/GOTHICB_1").getComponent(cc.Label).font;
          numLabel.string = i + 1;
          numLabel.fontSize = 24;
          numLabel.lineHeight = 24;
          numLabelNode.color = cc.Color.fromHEX(new cc.Color(), "#9e6205");
          var btnLabelNode = new cc.Node();
          btnLabelNode.x = 5;
          btnLabelNode.y = -70;
          btnNode.addChild(btnLabelNode);
          var pic = (0, _util.getSprNode)(textArr[i]);
          pic.y = -5;
          btnLabelNode.addChild(pic);
          _this19.topBtnArr.push(btnNode);
          btnLabelNode.pauseSystemEvents(true);
          btnNode.width = light.width;
          btnNode.height = light.height;
          btnNode.addComponent(cc.Button);
          btnNode.on("click", function() {
            console.log("light click");
            if (!_this19.isTeacher) return;
            _this19.sendServerEvent("top_btn_click", {
              index: i
            });
            _this19.setPageData("curTopBtnIndex", i);
          });
        };
        for (var i = 0; i < 3; i++) _loop(i);
      },
      curTopBtnIndex: null,
      topBtnClick: function topBtnClick(btnIndex) {
        var btn = this.topBtnArr[btnIndex];
        if (btn.light.opacity < 254) return;
        if (this.curTopBtnIndex == btnIndex) return;
        this.pauseVideo();
        this.hideTi1();
        this.hideTi3();
        this.hideHand();
        this.hideNextBtn();
        console.log("in topBtnClick : ", btnIndex);
        switch (btnIndex) {
         case 0:
          this.showVideo();
          this.hideSingLayer();
          break;

         case 1:
          this.hideVideo();
          this.showSingLayer();
          break;

         case 2:
          this.initRecordData();
          this.showVideo();
          this.hideSingLayer();
        }
        this.showTopBtn(btn, function() {});
        this.isTeacher || this.showTopAnima();
        this.curTopBtnIndex = btnIndex;
      },
      showTopAnima: function showTopAnima() {
        if (this.isTeacher) return;
        cc.tween(this.topNode).to(0, {
          opacity: 255
        }).start();
      },
      hideTopAnima: function hideTopAnima() {
        if (this.isTeacher) return;
        cc.tween(this.topNode).to(0, {
          opacity: 0
        }).start();
      },
      isPlayedRecordObj: null,
      initRecordData: function initRecordData() {
        this.isPlayedRecordObj = {};
        this.curRecordId = null;
      },
      singLayerTween: null,
      showSingLayer: function showSingLayer() {
        console.log(" in showSingLayer");
        this.singLayerTween && this.singLayerTween.stop();
        this.singLayer.active = true;
        this.singLayer.opacity = 0;
        this.singLayerTween = cc.tween(this.singLayer).to(0, {
          opacity: 255
        }).start();
      },
      hideSingLayer: function hideSingLayer() {
        var _this20 = this;
        this.singLayerTween && this.singLayerTween.stop();
        this.singLayerTween = cc.tween(this.singLayer).to(0, {
          opacity: 0
        }).call(function() {
          _this20.singLayer.active = false;
        }).start();
      },
      showTopBtn: function showTopBtn(topBtn, cb) {
        void 0 === cb && (cb = null);
        if (topBtn.y != topBtn.baseY) return;
        var moveY = topBtn.baseY - 24 * this._mapScaleMin;
        cc.tween(topBtn).to(.5, {
          y: moveY
        }, {
          easing: "cubicOut"
        }).call(function() {
          cb && cb();
        }).start();
        for (var i = 0; i < this.topBtnArr.length; i++) {
          var tmpBtn = this.topBtnArr[i];
          tmpBtn != topBtn && this.hideTopBtn(tmpBtn);
        }
      },
      hideTopBtn: function hideTopBtn(topBtn) {
        var moveY = topBtn.baseY;
        cc.tween(topBtn).to(.5, {
          y: moveY
        }, {
          easing: "cubicOut"
        }).start();
      },
      ti1: null,
      showTi1: function showTi1() {
        var ti = (0, _util.getSprNode)("ti_1");
        ti.scale = this._mapScaleMin;
        this.canvas.addChild(ti, 9);
        ti.anchorY = 1;
        ti.y = -this.canvas.height / 2;
        this.ti1 = ti;
        var targetY = -this.canvas.height / 2 + ti.height * ti.scaleY;
        cc.tween(ti).to(1, {
          y: targetY
        }, {
          easing: "cubicOut"
        }).start();
      },
      ti2: null,
      showTi2: function showTi2() {
        var ti;
        if (!this.ti2) {
          var resName = "sing/ti_2";
          this.isSupportRecord || (resName += "_2");
          ti = (0, _util.getSprNode)(resName);
          ti.scale = this._mapScaleMin;
          this.singLayer.addChild(ti, 15);
          ti.anchorY = 0;
          ti.y = -this.singLayer.height / 2 + 20 * this._mapScaleMin;
          this.ti2 = ti;
          console.log("ti2 :", ti);
        }
        ti = this.ti2;
        this.isTeacher || (ti.active = false);
        this.ti2 && cc.tween(this.ti2).to(0, {
          opacity: 255
        }).start();
      },
      hideTi2: function hideTi2() {
        this.ti2 && cc.tween(this.ti2).to(0, {
          opacity: 0
        }).start();
      },
      hideTi1: function hideTi1() {
        this.ti1 && cc.tween(this.ti1).to(0, {
          opacity: 0
        }).start();
      },
      checkShowNextBtn: function checkShowNextBtn() {
        if (2 == this.curTopBtnIndex) {
          this.showNextBtn();
          this.showTi3();
        }
      },
      ti3: null,
      showTi3: function showTi3() {
        if (!this.ti3) {
          var ti = (0, _util.getSprNode)("ti_3");
          ti.scale = this._mapScaleMin;
          this.canvas.addChild(ti, 15);
          ti.anchorY = 1;
          ti.y = -this.singLayer.height / 2;
          ti.baseY = ti.y;
          this.ti3 = ti;
        }
        this.isTeacher || (this.ti3.active = false);
        var targetY = -this.canvas.height / 2 + this.ti3.height * this.ti3.scaleY;
        cc.tween(this.ti3).to(1, {
          y: targetY
        }, {
          easing: "cubicOut"
        }).start();
      },
      hideTi3: function hideTi3() {
        this.ti3 && cc.tween(this.ti3).to(1, {
          y: this.ti3.baseY
        }, {
          easing: "cubicOut"
        }).start();
      },
      showHand: function showHand(pos) {
        var offX = -50 * this._mapScaleMin;
        var offY = -100 * this._mapScaleMin;
        this.hand.x = pos.x + offX;
        this.hand.y = pos.y + offY;
        cc.tween(this.hand).to(0, {
          opacity: 255
        }).start();
      },
      hideHand: function hideHand() {
        this.hand && cc.tween(this.hand).to(0, {
          opacity: 0
        }).start();
      },
      hand: null,
      initHand: function initHand() {
        console.log("in showHand");
        var hand = new cc.Node();
        this.canvas.addChild(hand, 11);
        this.hand = hand;
        var hand1 = (0, _util.getSprNode)("icon_hand1");
        hand1.parent = hand;
        hand1.x = 100;
        hand1.y = -60;
        var hand2 = (0, _util.getSprNode)("icon_hand2");
        hand2.parent = hand;
        hand2.x = hand1.x;
        hand2.y = hand1.y;
        hand2.opacity = 0;
        hand.hand1 = hand1;
        hand.hand2 = hand2;
        this.showHandAnima();
        hand.opacity = 0;
      },
      showHandAnima: function showHandAnima() {
        var _this21 = this;
        var hand1 = this.hand.hand1;
        var hand2 = this.hand.hand2;
        if (0 == hand1.opacity) {
          var delayTime = .2;
          (0, _util.delayCall)(delayTime, function() {
            if (_this21.isDestroy) return;
            hand1.opacity = 255;
            hand2.opacity = 0;
            _this21.showHandAnima();
          });
        } else {
          var _delayTime = .5;
          (0, _util.delayCall)(_delayTime, function() {
            if (_this21.isDestroy) return;
            hand1.opacity = 0;
            hand2.opacity = 255;
            _this21.showHandAnima();
          });
        }
      },
      refreshByPageData: function refreshByPageData() {
        this.refreshTopByPageData();
        if (null == this.curTopBtnIndex) return;
        switch (this.curTopBtnIndex) {
         case 0:
          this.refreshGroup1();
          break;

         case 1:
          this.refreshGroup2();
          break;

         case 2:
          this.refreshGroup2();
          this.refreshGroup1();
        }
      },
      refreshTopByPageData: function refreshTopByPageData() {
        var isTopLight2 = this.getPageData("isTopLight2");
        isTopLight2 && (this.topBtnArr[1].light.opacity = 255);
        var isTopLight3 = this.getPageData("isTopLight3");
        isTopLight3 && (this.topBtnArr[2].light.opacity = 255);
        var curTopBtnIndex = this.getPageData("curTopBtnIndex");
        console.log("curTopBtnIndex: ", curTopBtnIndex);
        if (null != curTopBtnIndex) {
          this.topBtnClick(curTopBtnIndex);
          this.curTopBtnIndex = curTopBtnIndex;
        }
      },
      refreshGroup1: function refreshGroup1() {
        var videoState = this.getPageData("videoState");
        console.log(" in refreshGroup1 videoState: ", videoState);
        switch (videoState) {
         case this.STATE_STOP:
          this.videoPlayEnd();
          break;

         case this.STATE_PAUSE:
          var time = this.getPageData("videoStartTime");
          if (time >= this.videoPlayer.getDuration()) {
            this.videoPlayEnd();
            return;
          }
          this.pauseVideo(time);
          this.videoPlayer.curServerTime = time;
          this.videoPlayer.currentTime = time;
          break;

         case this.STATE_PLAYING:
          var startTime = this.getPageData("videoStartTime");
          var startDate = this.getPageData("videoStartDate");
          var curDate = new Date().getTime();
          var subTime = (curDate - startDate) / 1e3;
          var curTime = startTime + subTime;
          if (curTime >= this.videoPlayer.getDuration()) {
            this.videoPlayEnd();
            return;
          }
          this.videoPlayer.currentTime = this.videoPlayer.getDuration();
          console.log("startTime: ", startTime);
          console.log("startDate: ", startDate);
          console.log("curDate: ", curDate);
          console.log("subTime: ", subTime);
          console.log("curTime: ", curTime);
          this.playVideo(curTime);
        }
      },
      refreshGroup2: function refreshGroup2() {
        var curCenterLabelIndex = this.getPageData("curCenterLabelIndex") || 0;
        var label = this.singLabelArr[curCenterLabelIndex];
        console.log(" in refreshGroup2: curCenterLabelIndex ", curCenterLabelIndex);
        console.log(" in refreshGroup2: label: ", label);
        this.setSingLabelToCenter(label);
        var rightLabelObj = this.getPageData("rightLabelObj");
        rightLabelObj || (rightLabelObj = {});
        var arr = this.singLabelArr;
        console.log("rightLabelObj:  ", rightLabelObj);
        for (var i = 0; i < arr.length; i++) if (rightLabelObj[i.toString()]) {
          console.log(" enter setSingLabelRight ");
          var richText = arr[i].getComponent(cc.Label);
          this.setSingLabelRight(richText);
          richText.audio_url = rightLabelObj[i.toString()].url;
          this.loadRecord(richText);
        }
      },
      refreshGroup3: function refreshGroup3() {},
      updatePlayRecord: function updatePlayRecord() {
        if (!this.isPlayRecord) return;
        if (this.isVideoPlayEnd) return;
        var labelArr = this.singLabelArr;
        var curTime = this.videoPlayer.currentTime;
        this.accompanyId && (curTime = cc.audioEngine.getCurrentTime(this.accompanyId));
        for (var i = labelArr.length - 1; i >= 0; i--) {
          var data = labelArr[i].data;
          var key = i.toString();
          var playTime = data.time - this.readyStartTime;
          playTime < 0 && (playTime = 0);
          if (curTime >= playTime && data.clip && !this.isPlayedRecordObj[key]) {
            console.log(" in playOneRecord");
            this.playOneRecord(data);
            this.isPlayedRecordObj[key] = data;
          }
        }
      },
      playOneRecord: function playOneRecord(data) {
        this.curRecordId = cc.audioEngine.playEffect(data.clip, false, .8);
      },
      update: function update() {
        if (this.isDestroy) return;
        this.updateStrip();
        this.updatePlayRecord();
      },
      initListener: function initListener() {
        var _this22 = this;
        var canvas = cc.find("Canvas");
        var downFlag = false;
        var touchStart = function touchStart(e) {
          _this22.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;
          _this22.canvasTouchStart(e);
          console.log("mouse down");
          if (canvas.hasEventListener(cc.Node.EventType.TOUCH_MOVE)) {
            canvas.off(cc.Node.EventType.TOUCH_MOVE, touchMove);
            _this22.removeHtmlCanvasListener("touchmove");
          }
        };
        var touchMove = function touchMove(e) {
          _this22.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;
          _this22.canvasTouchMove(e);
          console.log("mouse move");
          if (canvas.hasEventListener(cc.Node.EventType.TOUCH_MOVE)) {
            canvas.off(cc.Node.EventType.TOUCH_MOVE, touchMove);
            _this22.removeHtmlCanvasListener("touchmove");
          }
        };
        var touchEnd = function touchEnd(e) {
          downFlag = false;
          _this22.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);
          _this22.removeHtmlTouchEnd();
        };
        var mouseUp = function mouseUp(e) {
          downFlag = false;
          _this22.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();
      },
      nextBtn: null,
      initNextBtn: function initNextBtn() {
        var _this23 = this;
        var nextBtn = (0, _util.getSprNode)("next_btn");
        this.canvas.addChild(nextBtn, 10);
        nextBtn.scale = this._mapScaleMin;
        nextBtn.x = this.canvas.width / 2 - nextBtn.width / 2 * nextBtn.scale;
        nextBtn.y = -this.canvas.height / 2 + nextBtn.height / 2 * nextBtn.scale;
        this.nextBtn = nextBtn;
        this.nextBtn.active = false;
        var nextText = (0, _util.getSprNode)("next_text");
        nextText.y = 55;
        nextBtn.addChild(nextText);
        nextBtn.on(cc.Node.EventType.TOUCH_START, function() {
          console.log(" in click");
          _this23.sendServerEvent("show_template_end_anima");
        });
      },
      nextBtnTween: null,
      showNextBtn: function showNextBtn() {
        this.nextBtnTween && this.nextBtnTween.stop();
        this.nextBtn.active = true;
        this.nextBtnTween = cc.tween(this.nextBtn).to(.3, {
          opacity: 255
        }).start();
        var pos = {
          x: this.nextBtn.x,
          y: this.nextBtn.y + 130 * this._mapScaleMin
        };
        this.showHand(pos);
      },
      hideNextBtn: function hideNextBtn() {
        var _this24 = this;
        if (!this.nextBtn) return;
        this.nextBtnTween && this.nextBtnTween.stop();
        this.nextBtnTween = cc.tween(this.nextBtn).to(.3, {
          opacity: 0
        }).call(function() {
          _this24.nextBtn.active = false;
        }).start();
        this.hideHand();
      },
      initHotZone: function initHotZone() {
        this.initHotZoneBg();
      },
      hotZoneBg: null,
      initHotZoneBg: function initHotZoneBg() {
        var _this25 = 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) {
          _this25.hotZoneBg.width = img.width;
          _this25.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 = _this25.hotZoneBg.width;
          sprNode.height = _this25.hotZoneBg.height;
          sprNode.parent = _this25.hotZoneBg;
          window["bg"] = sprNode;
          var sx = _this25.canvas.width / _this25.hotZoneBg.width;
          var sy = (_this25.canvas.height - titleH) / _this25.hotZoneBg.height;
          var s = Math.min(sx, sy);
          _this25.hotZoneBg.scale = s;
          _this25.hotZoneBg.y = 0 - titleH / 2;
          _this25.initHotZoneItem();
        });
      },
      initHotZoneItem: function initHotZoneItem() {
        var _this26 = this;
        this.data.hotZoneItemArr.forEach(function(item) {
          switch (item.gIdx) {
           case "0":
            _this26.setOneAnimaSmall(item);
            break;

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

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

           case "3":
           case "4":
           case "5":
            _this26.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 label = this.getLabel();
        var labelNode = label.node;
        labelNode.parent = rectNode;
        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 _i2 = 0; _i2 < tweenArr.length; _i2++) {
            var tweenData = tweenArr[_i2];
            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 _i3 = 0; _i3 < tweenArr.length; _i3++) {
                var tweenData = tweenArr[_i3];
                "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 _i4 = 0; _i4 < animations.length; _i4++) animationNames.push(animations[_i4].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 _i5 = 0; _i5 < opArr.length; _i5++) {
                var opData = opArr[_i5];
                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 _i6 = 0; _i6 < animations.length; _i6++) animationNames.push(animations[_i6].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 _this27 = 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 / _this27.hotZoneBg.scaleY;
          picNode.width = data.rect.width * scale;
          picNode.height = data.rect.height * scale;
          picNode.x = -_this27.hotZoneBg.width / 2 + data.rect.x * scale;
          picNode.y = _this27.hotZoneBg.height / 2 - data.rect.height * scale - data.rect.y * scale;
          picNode.anchorX = picNode.anchorY = 0;
          data.audio_url && _this27.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);
          }
        });
      },
      getLabel: function getLabel() {
        var resLabel = cc.find("Canvas/res/label");
        var labelNode = cc.instantiate(resLabel);
        var label = labelNode.getComponent(cc.Label);
        return label;
      },
      isDestroy: null,
      onDestroy: function onDestroy() {
        this.isDestroy = true;
        cc.game.canvas.style.backgroundColor = "#000000";
      }
    });
    cc._RF.pop();
  }, {
    "../script/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.showLog = showLog;
    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 spr = cc.find("Canvas/res/img/" + resName).getComponent(cc.Sprite);
      spr.srcBlendFactor = cc.macro.BlendFactor.ONE;
      var sf = spr.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, cb) {
      void 0 === cb && (cb = null);
      var baseS = btn.scale;
      cc.tween(btn).to(.05, {
        scale: .9 * baseS
      }).to(.05, {
        scale: 1 * baseS
      }).call(function() {
        cb && cb();
      }).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();
    }
    function showLog(text) {
      var canvas = cc.find("Canvas");
      if (!canvas.logRt) {
        var node = new cc.Node();
        canvas.addChild(node, 999);
        node.width = .8 * canvas.width;
        node.color = cc.Color.BLACK;
        var rt = node.addComponent(cc.RichText);
        canvas.logRt = rt;
      }
      canvas.logRt.string += "<br/>" + text;
    }
    cc._RF.pop();
  }, {} ]
}, {}, [ "ak_08", "util" ]);