"use strict";
cc._RF.push(module, 'f0fbdUPvrVHsbHaxYd/uuAF', 'OP13');
// OP13/scene/OP13.js

"use strict";

var _DefaultData = require("../script/DefaultData");

var _utils = require("../script/utils");

var saveKey = "DataKey_Cocos_FT14";

var BaseUI = require('BaseUI');

var POS = {
  LeftPage: {
    x: -239,
    y: -5
  },
  RightPage: {
    x: 239,
    y: -5
  }
};
cc.Class({
  "extends": BaseUI,
  properties: {
    testPanel: cc.Node,
    touchPanel: cc.Node,
    audTurnPage: cc.AudioClip,
    pfbItemPage: cc.Prefab,
    pfbItemTurnPage: cc.Prefab,
    pfbItemTurnPage2: cc.Prefab,
    tipFirst: cc.Node,
    tipLast: cc.Node,
    // verletRender: VerletRender,
    capture: require('capture_to_web')
  },
  // 生命周期 onLoad
  onLoad: function onLoad() {
    this._timeoutIds = [];
    this._intervalIds = [];

    this._super();

    this.initNodes();
    this.initSceneData();
    this.initSize();
  },
  initNodes: function initNodes() {},
  onEnable: function onEnable() {},
  onDisable: function onDisable() {},
  _resList: null,
  initSceneData: function initSceneData() {
    this._resList = [];
    window.GameData = {};
  },
  _designSize: null,
  // 设计分辨率
  _frameSize: null,
  // 屏幕分辨率
  _mapScaleMin: null,
  // 场景中常用缩放（取大值）
  _mapScaleMax: null,
  // 场景中常用缩放（取小值）
  _cocosScale: null,
  // cocos 自缩放 （较少用到）
  initSize: function initSize() {},
  // 生命周期 start
  start: function start() {
    var _this = this;

    this.getData(function (data) {
      console.log('data:', data);
      _this.data = data;

      if (data) {
        _this.preloadItem();
      }
    });
  },
  getData: function getData(cb) {
    var _this2 = this;

    // 获取数据
    if (window.courseware) {
      var getData = window.courseware.getData;
      getData(function (data) {
        data = data || _this2.getDefaultData();
        cb && cb(data);
      }, saveKey);
    } else {
      cb && cb(this.getDefaultData());
    }
  },
  getDefaultData: function getDefaultData() {
    var data = _DefaultData.DefaultData; // return data;

    return {
      "haveCover": false,
      "coverType": "Image",
      "coverImage": "",
      "coverAudio": "",
      "coverText": "",
      "coverDragonBone": {
        "skeJsonData": {
          "url": ""
        },
        "texJsonData": {
          "url": ""
        },
        "texPngData": {
          "url": ""
        }
      },
      "titleAudio": "",
      "titleText": "",
      "titleTextColor": "A",
      "pageList": [{
        "pageType": "Image",
        "pageAudio": "http://staging-teach.cdn.ireadabc.com/cc5b1a8730bc275ecac85185d5ce2c5b.mp3",
        "pageText": "",
        "pageImage": "",
        "textColor": "A",
        "pageDragonBone": {
          "skeJsonData": {
            "url": "http://staging-teach.cdn.ireadabc.com/679fed26daa464819d553de6331b3552.json",
            "name": "alien-pro.json"
          },
          "texJsonData": {
            "url": "http://staging-teach.cdn.ireadabc.com/65d8214c6b5c5d0496e17adb0408276a.atlas",
            "name": "alien-pro.atlas"
          },
          "texPngData": {
            "url": "http://staging-teach.cdn.ireadabc.com/a319b372899239325b90bb4ec07b4970.png",
            "name": "alien-pro.png"
          },
          "animType": "spine"
        }
      }, {
        "pageType": "Image",
        "pageAudio": "http://staging-teach.cdn.ireadabc.com/fd877ad376fdffdb0dfc62122065a78f.mp3",
        "pageText": "",
        "pageImage": "",
        "textColor": "A",
        "pageDragonBone": {
          "skeJsonData": {
            "url": "http://staging-teach.cdn.ireadabc.com/d1f859d3fba84bd03565e543c986fb28.json",
            "name": "6_4_ske.json"
          },
          "texJsonData": {
            "url": "http://staging-teach.cdn.ireadabc.com/70f96e1cc7f013e27ed1952c503fb750.json",
            "name": "6_4_tex.json"
          },
          "texPngData": {
            "url": "http://staging-teach.cdn.ireadabc.com/b06f9b90018a6eb0175a01e355b9ced6.png",
            "name": "6_4_tex.png"
          },
          "animType": "dragonBone"
        }
      }, {
        "pageType": "Image",
        "pageAudio": "http://staging-teach.cdn.ireadabc.com/dff6748c93f6bf3de8cb7105fa9ba5de.mp3",
        "pageText": "",
        "pageImage": "",
        "textColor": "A",
        "pageDragonBone": {
          "skeJsonData": {
            "url": "http://staging-teach.cdn.ireadabc.com/a278a56fe77dfade7366829e9c65c815.json",
            "name": "6_3_ske.json"
          },
          "texJsonData": {
            "url": "http://staging-teach.cdn.ireadabc.com/96680527a570cec4d7c9818c91ec434a.json",
            "name": "6_3_tex.json"
          },
          "texPngData": {
            "url": "http://staging-teach.cdn.ireadabc.com/5c441810b0a5bc73248c50d8c32b4899.png",
            "name": "6_3_tex.png"
          },
          "animType": "dragonBone"
        }
      }]
    };
  },
  preloadItem: function preloadItem() {
    this.addPreloadItem();
    this.preload();
  },
  addPreloadItem: function addPreloadItem() {
    this._resList.push({
      url: this.data.coverImage
    });

    this._resList.push({
      url: this.data.coverDragonBone.skeJsonData.url
    });

    this._resList.push({
      url: this.data.coverDragonBone.texJsonData.url
    });

    this._resList.push({
      url: this.data.coverDragonBone.texPngData.url
    });

    this._resList.push({
      url: this.data.titleAudio
    });

    for (var i = 0; i < this.data.pageList.length; i++) {
      this._resList.push({
        url: this.data.pageList[i].pageAudio
      });

      this._resList.push({
        url: this.data.pageList[i].pageImage
      });

      this._resList.push({
        url: this.data.pageList[i].pageDragonBone.skeJsonData.url
      });

      this._resList.push({
        url: this.data.pageList[i].pageDragonBone.texJsonData.url
      });

      this._resList.push({
        url: this.data.pageList[i].pageDragonBone.texPngData.url
      });
    }
  },
  preload: function preload() {
    var _this3 = this;

    cc.assetManager.loadAny(this._resList, null, null, function (err, data) {
      if (window && window["air"]) {
        // cc.find('Canvas').opacity = 0;
        window.air.onCourseInScreen = function (next) {
          // cc.find('Canvas').opacity = 255;
          _this3.loadEnd();

          next();
        };

        window.air.hideAirClassLoading();
      } else {
        _this3.loadEnd();
      }

      cc.debug.setDisplayStats(false);
    });
  },
  loadEnd: function loadEnd() {
    this.initDataBoot();
    this.initData();
    this.initEvent();
    this.startGame();
  },
  initDataBoot: function initDataBoot() {
    GameData.pageIndex = 0;
    this.pageList = [];
    this._turnLeft = false;
    this._turnRight = false;
    this._angle = 0;
  },
  onTouchLeft: function onTouchLeft() {
    var _this4 = this;

    return new Promise(function (resolve, reject) {
      if (_this4.verletRender) {
        return resolve('');
      }

      if (GameData.isPlaying) {
        return resolve('');
      }

      GameData.isPlaying = true;
      var page = _this4.pageList[GameData.pageIndex];
      var itemPage = page.getComponent('ItemPage');
      itemPage.playAudio();
      itemPage.playSpine().then(function () {
        resolve('');
      });
    });
  },
  onTouchRight: function onTouchRight() {
    var _this5 = this;

    return new Promise(function (resolve, reject) {
      if (_this5.verletRender) {
        return resolve('');
      }

      if (GameData.isPlaying) {
        return resolve('');
      }

      var page = _this5.pageList[GameData.pageIndex + 1];

      if (!page) {
        (0, _utils.onHomeworkFinish)();
        return resolve('');
      }

      GameData.isPlaying = true;
      var itemPage = page.getComponent('ItemPage');
      itemPage.playAudio();
      itemPage.playSpine().then(function () {
        if (_this5.pageList.length - GameData.pageIndex <= 2) {
          (0, _utils.onHomeworkFinish)();
        }

        resolve('');
      });
    });
  },
  initData: function initData() {
    this.data.haveCover = false; // 所有全局变量 默认都是null 

    GameData.audioCount = 0;
    this.initTitle();
  },
  initEvent: function initEvent() {
    // this.touchPanel._touchListener && this.touchPanel._touchListener.setSwallowTouches(false);
    // this.touchPanel._touchListener.swallowTouches = false;
    this.touchPanel.on(cc.Node.EventType.TOUCH_END, this.onTouchPanel, this);
  },
  cons: function cons(data) {
    console.log(this.touchPanel._touchListener.swallowTouches + "  |  " + "btn->" + data);
  },
  startGame: function startGame() {
    var _this6 = this;

    // this.playAudioEntrer();
    this.initPageUI();
    this.initArrowBtn();
    this.initPages().then(function () {
      _this6.updateBtnStatus();

      _this6.autoPlay();
    });
  },
  initArrowBtn: function initArrowBtn() {
    var _this7 = this;

    var lastBtn = this.lastBtn = cc.find("Canvas/left_arrow");
    var nextBtn = this.nextBtn = cc.find("Canvas/right_arrow");
    lastBtn.on("touchstart", function () {
      var isSuccess = _this7.onTouchPanelLeft();

      isSuccess && (0, _utils.jelly)(lastBtn);
    });
    nextBtn.on("touchstart", function () {
      var isSuccess = _this7.onTouchPanelRight();

      isSuccess && (0, _utils.jelly)(nextBtn);
    });
  },
  checkShowArrowBtn: function checkShowArrowBtn() {
    var _this8 = this;

    setTimeout(function () {
      _this8.lastBtn.active = !_this8.nodeDict.btnLast.children[1].active;
      _this8.nextBtn.active = !_this8.nodeDict.btnNext.children[1].active;
    }, 220);
  },
  autoPlay: function autoPlay() {
    var _this9 = this;

    //自动开始播放动画，及触发动画效果
    this.inited = false;
    this.onTouchLeft().then(function () {
      _this9.onTouchRight().then(function () {
        _this9.inited = true;
        _this9.isTruning = false;
      });
    });
  },
  initTitle: function initTitle() {// let label = this.nodeDict.labTitle.getComponent(cc.Label);
    // label.string = this.data.titleText;
    // label._forceUpdateRenderData();
    // if (this.nodeDict.labTitle.width > 250) {
    // 	this.nodeDict.labTitle.scale = 250 / this.nodeDict.labTitle.width
    // }
  },
  initPageUI: function initPageUI() {
    if (this.data.haveCover) {
      this.nodeDict.nodUI1.active = false;
      this.nodeDict.nodUI2.active = true;
    } else {
      this.nodeDict.nodUI1.active = true;
      this.nodeDict.nodUI2.active = false;
    }
  },
  initPages: function initPages() {
    var _this10 = this;

    return new Promise(function (resolve, reject) {
      _this10.pageIndex = 0;
      if (_this10.data.pageList.length === 0) return resolve('');
      var count = _this10.data.pageList.length;
      var node = cc.instantiate(_this10.pfbItemPage);
      node.parent = _this10.nodeDict.nodPages;
      var itemPage = node.getComponent('ItemPage');
      itemPage.init(_this10.data.pageList[0], false, _this10.pageIndex).then(function () {
        count--;
        if (count == 0) return resolve('');
      });

      _this10.pageList.push(node);

      _this10.pageIndex++;
      node.zIndex = -1;
      node.x = POS.LeftPage.x;
      node.y = POS.LeftPage.y;

      for (var i = 1; i < _this10.data.pageList.length; i++) {
        var _node = cc.instantiate(_this10.pfbItemPage);

        _node.parent = _this10.nodeDict.nodPages;

        var _itemPage = _node.getComponent('ItemPage');

        _itemPage.init(_this10.data.pageList[i], false, _this10.pageIndex).then(function () {
          count--;
          if (count == 0) return resolve('');
        });

        _this10.pageList.push(_node);

        _node.x = POS.RightPage.x;
        _node.y = POS.RightPage.y;
        _this10.pageIndex++;
        _node.zIndex = -1 - i;
      }

      _this10.resetPages();
    });
  },
  onTouchPanel: function onTouchPanel(e) {
    if (!this.inited) return; //滑动监听以及单击监听， 通过使用节点与panel碰撞来进行判断

    var evt = e;
    var target = e.target;
    var touches = evt.getTouches();
    var startPoint = touches[0].getStartLocation();
    var point = touches[0].getLocation();
    var moveX = point.x - startPoint.x;

    if (Math.abs(moveX) < 50) {
      //点击
      this.onTouchPanelClick(target, point);
    } else if (moveX > 0) {
      //向右滑
      this.onTouchPanelLeft();
    } else {
      //向左滑
      this.onTouchPanelRight();
    }
  },
  onTouchPanelClick: function onTouchPanelClick(target, point) {
    var pointXY = new cc.Vec2(point.x - 1280 / 2, point.y - 720 / 2);
    var leftPanel = this.nodeDict.nodLeftPage;
    var rightPanel = this.nodeDict.nodRightPage;
    var rectLeft = new cc.Rect(leftPanel.position.x, leftPanel.position.y, leftPanel.width, leftPanel.height);
    var rectRight = new cc.Rect(rightPanel.position.x, rightPanel.position.y, rightPanel.width, rightPanel.height);

    if (this.contains(rectLeft, pointXY)) {
      //与左侧相交
      this.onTouchLeftAni();
    } else if (this.contains(rectRight, pointXY)) {
      //与右侧相交
      this.onTouchRightAni();
    }
  },
  contains: function contains(rect, point) {
    var mx = Math.abs(point.x - rect.x);
    var my = Math.abs(point.y - rect.y);
    return mx * 2 <= rect.width && my * 2 <= rect.height;
  },
  onTouchLeftAni: function onTouchLeftAni() {
    this.onTouchLeft();
  },
  onTouchRightAni: function onTouchRightAni() {
    this.onTouchRight();
  },
  onTouchPanelLeft: function onTouchPanelLeft() {
    var _this11 = this;

    if (this.isTruning) {
      return false;
    }

    if (GameData.isPlaying) {
      return false;
    }

    this.onTurnLast();

    this._timeoutIds.push(setTimeout(function () {
      _this11.autoPlay();
    }, 1000));

    return true;
  },
  onTouchPanelRight: function onTouchPanelRight() {
    var _this12 = this;

    if (this.isTruning) {
      return false;
    }

    if (GameData.isPlaying) {
      return false;
    }

    this.onTurnNext();

    this._timeoutIds.push(setTimeout(function () {
      _this12.autoPlay();
    }, 1000));

    return true;
  },
  playAudioEntrer: function playAudioEntrer() {
    var _this13 = this;

    GameData.audioCount++;
    var id = cc.audioEngine.play(this.audEnter, false, 1);
    cc.audioEngine.setFinishCallback(id, function () {
      GameData.audioCount--;

      _this13.playAudioQuestion();
    });
  },
  playAudioPage: function playAudioPage(isBtn, cb) {
    var _this14 = this;

    GameData.audioCount++;
    var url = this.data.questionList[GameData.questionIndex].pageAudio; // url = 'http://127.0.0.1/iamflying.mp3';

    cc.assetManager.loadRemote(url, null, function (err, clip) {
      if (err) {
        console.log(err);

        _this14.startStepDone();

        return;
      }

      var id = cc.audioEngine.play(clip, false, 1);
      cc.audioEngine.setFinishCallback(id, function () {
        GameData.audioCount--;
        cb && cb();

        if (!isBtn) {
          _this14.startStepDone();
        }
      });
    });
  },
  playAudioQuestion: function playAudioQuestion() {
    var _this15 = this;

    GameData.audioCount++;
    var url = this.data.questionAudio; // url = 'http://127.0.0.1/iamflying.mp3';

    cc.assetManager.loadRemote(url, null, function (err, clip) {
      if (err) {
        console.log(err);
        return;
      }

      var id = cc.audioEngine.play(clip, false, 1);
      cc.audioEngine.setFinishCallback(id, function () {
        GameData.audioCount--;

        _this15.playAudioPage();
      });
    });
  },
  updateBtnStatus: function updateBtnStatus() {
    if (GameData.pageIndex <= 0) {
      this.nodeDict.btnLast.children[1].active = true;
    } else {
      this.nodeDict.btnLast.children[1].active = false;
    }

    if (GameData.pageIndex >= this.data.pageList.length - 2) {
      this.nodeDict.btnNext.children[1].active = true;
    } else {
      this.nodeDict.btnNext.children[1].active = false;
    }

    this.checkShowArrowBtn();
  },
  checkCover: function checkCover() {
    if (!this.data.haveCover) {
      return;
    }

    if (GameData.pageIndex === -1) {
      this.nodeDict.nodUI1.active = false;
      this.nodeDict.nodUI2.active = true;
    }
  },
  playAudioTurnPage: function playAudioTurnPage() {
    GameData.audioCount++;
    var id = cc.audioEngine.play(this.audTurnPage, false, 1);
    cc.audioEngine.setFinishCallback(id, function () {
      GameData.audioCount--;
    });
  },
  onTurnLast: function onTurnLast() {
    var _this16 = this;

    if (GameData.pageIndex <= 0) {
      this.tipAni(this.tipFirst);
      return;
    }

    this.isTruning = true;

    if (this.verletRender) {
      this.verletRender.node.destroy();
      this.verletRender = null;
    }

    this.playAudioTurnPage();
    this._angle = 0;
    var page0 = this.pageList[GameData.pageIndex + 1];
    var page1 = this.pageList[GameData.pageIndex]; // let spf1 = this.capture.doCapture(page1, true);
    // this.scheduleOnce(() => {
    // 	page1.opacity = 0;
    // 	page1.x = POS.RightPage.x;
    // })
    // let spf2 = spf1;

    cc.tween(page1).to(1, {
      opacity: 0
    }).start();
    var page2 = this.pageList[GameData.pageIndex - 1];

    if (page2) {
      page2.opacity = 0; // spf2 = this.capture.doCapture(page2);
      // page2.opacity = 0;
      // this.scheduleOnce(() => {

      page2.x = POS.RightPage.x; // })

      if (page0) {
        cc.tween(page0) // .delay(1)
        .to(1, {
          opacity: 0
        }).start();
      }

      cc.tween(page2) // .delay(1)
      .to(1, {
        opacity: 255
      }).call(function () {
        _this16.resetPages();
      }).start();
    }

    var page3 = this.pageList[GameData.pageIndex - 2];

    if (page3) {
      // this.scheduleOnce(() => {
      page3.opacity = 0; // })

      cc.tween(page3) // .delay(1)
      .to(1, {
        opacity: 255
      }).call(function () {}).start();
    } // let node = cc.instantiate(this.pfbItemTurnPage2);
    // node.parent = this.node;
    // node.opacity = 0;
    // cc.tween(node)
    // 	.to(0.1, { opacity: 255 })
    // 	.to(1, { x: POS.LeftPage.x })
    // 	.call(() => {
    // 		this.checkCover();
    // 	})
    // 	.delay(1)
    // 	.start()
    // this.verletRender = node.getComponent(BezierRender);
    // this.verletRender.textureList[0] = spf1._texture;
    // this.verletRender.textureList[1] = spf2._texture;
    // this.verletRender.updateAngle(this._angle);
    // this.verletRender.init();
    // this._turnLeft = true;
    // this._turnRight = false;
    // this.scheduleOnce(() => {
    // 	this.verletRender.node.opacity = 255;
    // })


    GameData.pageIndex -= 2;
    this.updateBtnStatus();
  },
  onTurnNext: function onTurnNext() {
    var _this17 = this;

    if (GameData.pageIndex >= this.data.pageList.length - 2) {
      this.tipAni(this.tipLast);
      return;
    }

    this.isTruning = true;

    if (this.verletRender) {
      this.resetPages();
      this.verletRender.node.destroy();
      this.verletRender = null;
    }

    this.playAudioTurnPage();
    this.nodeDict.nodUI1.active = true;
    this.nodeDict.nodUI2.active = false;
    this._angle = 0;
    var page0 = this.pageList[GameData.pageIndex];
    var page1 = this.pageList[GameData.pageIndex + 1]; // let spf1 = this.capture.doCapture(page1);
    // this.scheduleOnce(() => {
    // 	page1.opacity = 0;
    // 	page1.x = POS.LeftPage.x;
    // })
    // let spf2 = spf1;

    cc.tween(page1).to(1, {
      opacity: 0
    }).start();
    var page2 = this.pageList[GameData.pageIndex + 2];

    if (page2) {
      page2.opacity = 0; // spf2 = this.capture.doCapture(page2, true);
      // page2.opacity = 0;
      // this.scheduleOnce(() => {

      page2.x = POS.LeftPage.x; // })

      cc.tween(page0) // .delay(1)
      .to(1, {
        opacity: 0
      }).start();
      cc.tween(page2) // .delay(1)
      .to(1, {
        opacity: 255
      }).call(function () {
        _this17.resetPages();
      }).start();
    }

    var page3 = this.pageList[GameData.pageIndex + 3];

    if (page3) {
      // this.scheduleOnce(() => {
      page3.opacity = 255; // })
    } // let node = cc.instantiate(this.pfbItemTurnPage);
    // node.parent = this.node;
    // node.opacity = 0;
    // cc.tween(node)
    // 	.to(0.1, { opacity: 255 })
    // 	.to(1, { x: POS.RightPage.x })
    // 	.start()
    // this.verletRender = node.getComponent(BezierRender);
    // this.verletRender.textureList[0] = spf1._texture;
    // this.verletRender.textureList[1] = spf2._texture;
    // this.verletRender.updateAngle(this._angle);
    // this.verletRender.init();
    // this._turnLeft = true;
    // this._turnRight = false;
    // this.scheduleOnce(() => {
    // 	this.verletRender.node.opacity = 255;
    // })


    GameData.pageIndex += 2;
    this.updateBtnStatus();
  },
  tipAni: function tipAni(node) {
    node.active = true;
    node.opacity = 0;
    cc.tween(node).to(0.5, {
      opacity: 255
    }).delay(0.5).to(0.5, {
      opacity: 0
    }).call(function () {
      node.active = false;
    }).start();
  },
  buttonListener: function buttonListener(button) {
    if (this.isTruning) {
      return;
    }

    if (button.node.name == 'btnLast') {
      this.onTurnLast();
    } else if (button.node.name == 'btnNext') {
      this.onTurnNext();
    } else if (button.node.name == 'btnTitle') {
      this.playTitleAudio();
    }
  },
  resetPages: function resetPages() {
    for (var i = 0; i < this.pageList.length; i++) {
      this.pageList[i].opacity = 0;
    }

    if (this.pageList[GameData.pageIndex]) {
      this.pageList[GameData.pageIndex].opacity = 255;
    }

    if (this.pageList[GameData.pageIndex + 1]) {
      this.pageList[GameData.pageIndex + 1].opacity = 255;
    }
  },
  update: function update(dt) {
    var _this18 = this;

    var anglePerDt = 180;

    if (this._turnLeft) {
      this._angle += dt * anglePerDt;

      if (this._angle > 180) {
        this._angle = 180;
        this._turnLeft = false;
        cc.tween(this.verletRender.node).call(function () {
          _this18.resetPages();
        }).to(0.5, {
          opacity: 0
        }).call(function () {
          if (_this18.verletRender) {
            _this18.verletRender.node.destroy();

            _this18.verletRender = null;
          }
        }).start();
      }

      this.verletRender.updateAngle(this._angle);
    }

    if (this._turnRight) {
      this._angle -= dt * anglePerDt;

      if (this._angle < 0) {
        this._angle = 0;
        this._turnRight = false;
        cc.tween(this.nodeDict.sprPage).call(function () {
          _this18.resetPages();
        }).to(0.5, {
          opacity: 0
        }).call(function () {
          if (_this18.verletRender) {
            _this18.verletRender.node.destroy();

            _this18.verletRender = null;
          }
        }).start();
      }

      this.verletRender.updateAngle(this._angle);
    }
  },
  playTitleAudio: function playTitleAudio() {
    var _this19 = this;

    GameData.audioCount++;
    var url = this.data.titleAudio;
    cc.audioEngine.stop(this.titleAudioId);
    cc.assetManager.loadRemote(url, null, function (err, clip) {
      if (err) {
        console.log(err);
        return;
      }

      _this19.titleAudioId = cc.audioEngine.play(clip, false, 1);
      cc.audioEngine.setFinishCallback(_this19.titleAudioId, function () {
        if (!cc.isValid(_this19)) {
          return;
        }

        GameData.audioCount--;
      });
    });
  },
  _timeoutIds: null,
  _intervalIds: null,
  // 生命周期
  onDestroy: function onDestroy() {
    this._timeoutIds.forEach(function (id) {
      clearTimeout(id);
    });

    this._intervalIds.forEach(function (id) {
      clearInterval(id);
    });
  }
});

cc._RF.pop();