/**
 * 数据管理器
 */
export function initDataMgr_NGT_02() {
  g.data_mgr = {
    data: null, //表所有数据

    nowNum: null, //剩余个数

    ansId: null, //问题ID
    startId: null, //星星id

    nowAnsId: null, //当前星星的问题

    gameState: 2, //游戏状态1可操作 2不可操作

    nodPlayer: null, //当前播放节点
    //获得默认数据
    getDefaultData() {
      //http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3
      const dataJson = {
        starArr: [
          {
            queArr: [
              {
                bgItem: {
                  url: "http://staging-teach.cdn.ireadabc.com/bb4244d166b6d077617ff089f7fd46c4.png",
                  rect: {
                    x: 259.9654545454546,
                    y: 0,
                    width: 377.0690909090909,
                    height: 373,
                  },
                },
                hotZoneItemArr: [
                  {
                    audio_url:
                      "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3",
                    index: 0,
                    itemType: "rect",
                    fontSize: 50,
                    fontName: "BRLNSR_1",
                    fontColor: "#8f3758",
                    fontScale: 0.70078125,
                    imgScale: 1,
                    mapScale: 0.70078125,
                    rect: { x: -1.97, y: 112, width: 95.01, height: 95.01 },
                  },
                  {
                    audio_url:
                      "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3",
                    index: 1,
                    itemType: "rect",
                    fontSize: 50,
                    fontName: "BRLNSR_1",
                    fontColor: "#8f3758",
                    fontScale: 0.70078125,
                    imgScale: 1,
                    mapScale: 0.70078125,
                    rect: { x: 311.03, y: 118, width: 77.01, height: 77.01 },
                  },
                ],
                title: "3434",
                title_audio_url:
                  "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3",
              },
              {
                bgItem: {
                  url: "http://staging-teach.cdn.ireadabc.com/685ead5fe409d20412a38aae23c75ad0.png",
                  rect: {
                    x: 116.9444444444444,
                    y: -2.842170943040401e-14,
                    width: 663.1111111111112,
                    height: 373.00000000000006,
                  },
                },
                hotZoneItemArr: [
                  {
                    audio_url:
                      "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3",
                    index: 0,
                    itemType: "rect",
                    fontSize: 50,
                    fontName: "BRLNSR_1",
                    fontColor: "#8f3758",
                    fontScale: 0.70078125,
                    imgScale: 1,
                    mapScale: 0.70078125,
                    rect: { x: 72.06, y: 52, width: 133, height: 49 },
                  },
                  {
                    audio_url:
                      "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3",
                    index: 1,
                    itemType: "rect",
                    fontSize: 50,
                    fontName: "BRLNSR_1",
                    fontColor: "#8f3758",
                    fontScale: 0.70078125,
                    imgScale: 1,
                    mapScale: 0.70078125,
                    rect: { x: 475.06, y: 30, width: 159, height: 67 },
                  },
                ],
                title: "666",
                title_audio_url:
                  "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3",
              },
            ],
          },
          {
            queArr: [
              {
                bgItem: {
                  url: "http://staging-teach.cdn.ireadabc.com/6326a8bc4896aaa1834bd35f2dac9fee.png",
                  rect: {
                    x: 273.3030303030303,
                    y: 0,
                    width: 350.3939393939394,
                    height: 373,
                  },
                },
                hotZoneItemArr: [
                  {
                    audio_url:
                      "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3",
                    index: 0,
                    itemType: "rect",
                    fontSize: 50,
                    fontName: "BRLNSR_1",
                    fontColor: "#8f3758",
                    fontScale: 0.70078125,
                    imgScale: 1,
                    mapScale: 0.70078125,
                    rect: { x: -5.3, y: 214, width: 65, height: 65 },
                  },
                  {
                    audio_url:
                      "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3",
                    index: 1,
                    itemType: "rect",
                    fontSize: 50,
                    fontName: "BRLNSR_1",
                    fontColor: "#8f3758",
                    fontScale: 0.70078125,
                    imgScale: 1,
                    mapScale: 0.70078125,
                    rect: { x: 294.7, y: 148, width: 71, height: 71 },
                  },
                ],
                title: "455",
                title_audio_url:
                  "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3",
              },
              {
                bgItem: {
                  url: "http://staging-teach.cdn.ireadabc.com/942fb8d28620d46d6c77d18909e86806.png",
                  rect: {
                    x: 116.9444444444444,
                    y: -2.842170943040401e-14,
                    width: 663.1111111111112,
                    height: 373.00000000000006,
                  },
                },
                hotZoneItemArr: [
                  {
                    audio_url:
                      "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3",
                    index: 0,
                    itemType: "rect",
                    fontSize: 50,
                    fontName: "BRLNSR_1",
                    fontColor: "#8f3758",
                    fontScale: 0.70078125,
                    imgScale: 1,
                    mapScale: 0.70078125,
                    rect: { x: 247.06, y: 217, width: 97, height: 97 },
                  },
                  {
                    audio_url:
                      "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3",
                    index: 1,
                    itemType: "rect",
                    fontSize: 50,
                    fontName: "BRLNSR_1",
                    fontColor: "#8f3758",
                    fontScale: 0.70078125,
                    imgScale: 1,
                    mapScale: 0.70078125,
                    rect: { x: 515.06, y: 108, width: 57, height: 57 },
                  },
                ],
                title: "7777",
                title_audio_url:
                  "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3",
              },
            ],
          },
        ],
      };
      const data = dataJson;
      // const data = JSON.parse(dataJson);
      // const data = [];
      return data;
    },

    //获得标题
    getTitle() {
      return this.data.title;
    },

    //获得表单信息
    getSheepfoldArr() {
      return this.data.sheepfoldArr;
    },

    //获得表单信息
    getSheepfold(num) {
      return this.data.sheepfoldArr[num];
    },

    //获得所有选项
    getSheepArr() {
      return this.data.sheepArr;
    },

    //获得单项信息
    getSheep(num) {
      return this.data.sheepArr[num];
    },

    //获取当前整页数据
    getPageInfo: function () {
      return this.data.contentObj.pageArr[this.pageId].pageInfo;
    },

    //获得整条数据
    getResultInfo: function (id) {
      var pageInfo = this.data.contentObj.pageArr[this.pageId].pageInfo;
      return pageInfo[id];
    },

    //处理数据
    proGameData: function () {
      this.preload();
      console.log("数据处理完毕:");
    },

    preload() {
      cc.assetManager.loadAny(null, null, null, (err, data) => {
        //结束回调
        this.loadEnd();
        if (window && window["air"]) {
          window["air"].hideAirClassLoading();
        }

        cc.debug.setDisplayStats(false);
      });
    },
    loadEnd() {
      //更新游戏界面信息
      g.game.inst.UpdataUi();

      g.game.inst.isLoadEnd = true;
    },
  };
}
