// Learn cc.Class:
//  - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

// import { getSprNode } from "./util";
import { onHomeworkFinish, getSprNode, playAudioByUrl, getScaleRateBy2Node, localPosTolocalPos, randomSortByArr, loadDragonBones, playAudio, showTrebleFirework, delayCall, removeFromArr, showBtnAnima, asyncDelay, jellyShake, showLog, formatTime, getSpriteFrimeByUrl, RandomInt, exchangeNodePos, getSprNodeByUrl } from "../script/peppa_pig_finger_util";

cc.Class({
	extends: cc.Component,

	properties: {
		baseWidth: {
			default: 1920,
			type: cc.Integer
		},
		baseHeight: {
			default: 1080,
			type: cc.Integer
		}
	},

	onLoad() {
		cc.debug.setDisplayStats(false);
		this.initSceneData();
		this.initSize();
	},

	initSceneData() {
		this._imageResList = [];
		this._audioResList = [];
		this._animaResList = [];
	},



	_designSize: null,
	_frameSize: null,
	_mapScaleMin: null,
	_mapScaleMax: null,
	_cocosScale: null,
	canvas: null,
	initSize() {


		// 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小
		let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height
		let design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height
		let f = screen_size >= design_size

		cc.Canvas.instance.fitHeight = f
		cc.Canvas.instance.fitWidth = !f

		const frameSize = cc.view.getFrameSize();
		this._frameSize = frameSize;

		this._designSize = cc.view.getDesignResolutionSize();

		let sx = cc.winSize.width / frameSize.width;
		let 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');


		// cc.log('cc.Canvas: ', cc.Canvas);
	},

	isTeacher: null,
	serverAllUser: null,
	start() {

		// const nextBtn = cc.find('middleLayer/BtnRight');
		// if (nextBtn) {
		// 	nextBtn.active = false;
		// }

		let getData = this.getData.bind(this);
		if (window && window.courseware) {
			getData = window.courseware.getData;
		}
		getData((data, aspect) => {

			if (window['air']?.airClassInfo?.user?.classRole == 'tea') {
				this.isTeacher = true;
			}
			if (aspect) {
				console.log('aspect : ', aspect);
				this.serverAllUser = aspect.all_user;
				this.initPageData(aspect);
			}

			// this.initPageData({});


			this.data = data || this.getDefaultData();
			console.log('data:', this.data);
			console.log('dataStr:', JSON.stringify(this.data));

			this.preloadItem()
		})
	},

	// 用于存储公共数据 当翻页时清空 
	pageData: null,
	initPageData(aspect) {
		const pageDataStr = aspect?.page_aspect?.pagedata;
		if (!pageDataStr) {
			this.pageData = {};
		} else {
			this.pageData = JSON.parse(pageDataStr);
		}
		console.log('this.pageData: ', this.pageData);
	},

	setPageData(key, value, isSend = true) {



		if (this.pageData) {

			console.log('this.pageData: ', this.pageData);

			this.pageData[key] = value;
			if (isSend) {
				this.sendPageData();
			}
		}
	},

	getPageData(key) {
		if (this.pageData && this.pageData[key] != null) {
			return this.pageData[key];
		}
	},

	sendPageData() {

		const data = this.pageData;
		if (window && window.courseware) {
			let storePageAspect = window.courseware.storePageAspect;
			if (storePageAspect) {
				storePageAspect(data);
				console.log('storePageAspect : ', data);
			}
		}
	},

	_imageResList: null,
	_audioResList: null,
	_animaResList: null,
	preloadItem() {
		this.addPreloadImage();
		this.addPreloadAudio(() => {
			this.preload();
		});
	},

	getData(func) {
		if (window && window.courseware) {
			window.courseware.getData(func, 'ak_08');
			return;
		}

		const middleLayer = cc.find('middleLayer');
		if (middleLayer) {
			const middleLayerComponent = middleLayer.getComponent('middleLayer');
			middleLayerComponent.getData(func);
			return;
		}

		func(this.getDefaultData());
	},

	getDefaultData() {

		return {"quesArr":[{"itemType":"jump","book_id":"LWP_L2_B01_OnTheBoat_LotsofJobs_LOWRES","page_id":"1","video_url":"http://staging-teach.cdn.ireadabc.com/76f756dc2a8b2bd50e04dd0845087c00.mp4","enter_audio_url":"http://staging-teach.cdn.ireadabc.com/db7b607f406237f06d7436334fb9f56c.mp3","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/cf623fbe90d9a807d27bad9080f3cc83.mp3","readingItemArr":[]},{"itemType":"jump","page_id":"3","book_id":"LWP_L2_B01_OnTheBoat_LotsofJobs_LOWRES","video_url":"http://staging-teach.cdn.ireadabc.com/f582abb6299baad14b2bbdd5bd66e9dc.mp4","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/8773f353f61b0173f07f66cd0ad8a9ac.mp3","readingItemArr":[{"content":"air, air","audio_url":"http://staging-teach.cdn.ireadabc.com/43a776115fcfeb31dd17a43afc6e577e.mp3"},{"content":"b oa t, boat","audio_url":"http://staging-teach.cdn.ireadabc.com/dfa32dd1047406826f81e2def30fb437.mp3"},{"content":"d ar k, dark","audio_url":"http://staging-teach.cdn.ireadabc.com/52436e8b79d86a8a9c0d40a76c008c70.mp3"},{"content":"d ow n, down","audio_url":"http://staging-teach.cdn.ireadabc.com/1a3e167218409a7cee05b5cfc43244d5.mp3"},{"content":"h igh, high","audio_url":"http://staging-teach.cdn.ireadabc.com/35bc40fa1b3d5eaa7725fb759800f3d9.mp3"},{"content":"t u nn e l, tunnel","audio_url":"http://staging-teach.cdn.ireadabc.com/f64da1692cd55f707ee0d472934c9dc6.mp3"}]},{"itemType":"jump","book_id":"LWP_L2_B01_OnTheBoat_LotsofJobs_LOWRES","page_id":"5","video_url":"http://staging-teach.cdn.ireadabc.com/c7a3ba3ecb016ab03d0fbb4aa7ee607c.mp4","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/1a6fe6aace93ea01eea10406d77d8628.mp3"},{"itemType":"jump","book_id":"LWP_L2_B01_OnTheBoat_LotsofJobs_LOWRES","page_id":"7","video_url":"http://staging-teach.cdn.ireadabc.com/fffc8e043b563fb4756a61683467d485.mp4","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/0d350ca2666395a66f670faea642fae3.mp3","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/066a2e1d8a5a0cf99f56f2612cef0d16.jpg","rect":{"x":0,"y":19.09,"width":1218,"height":685.83}},"hotZoneItemArr":[{"id":"1695713609172","index":0,"audio_url":"http://staging-teach.cdn.ireadabc.com/69912e54c855e3f550228aa72888b8b1.mp3","itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":446},"gIdx":"0","posX":721,"posY":585,"rect":{"x":646,"y":406.91,"width":150,"height":150}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/771a5a7a6d5dd4eeffde89924efcf459.jpg","rect":{"x":271.12,"y":0,"width":675.77,"height":724}},"hotZoneItemArr2":[{"id":"1695713770339","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":446},"gIdx":"0","posX":355,"posY":617,"rect":{"x":50.55,"y":419.63,"width":162.33,"height":162.33}}]},{"itemType":"jump","book_id":"LWP_L2_B01_OnTheBoat_LotsofJobs_LOWRES","page_id":"9","video_url":"http://staging-teach.cdn.ireadabc.com/2d2a4eb11ecfd39052f8783299a49e53.mp4","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/c4fa2fb583963a4cf0bf4fb704d958e8.mp3"},{"itemType":"jump","book_id":"LWP_L2_B01_OnTheBoat_LotsofJobs_LOWRES","page_id":"11","video_url":"http://staging-teach.cdn.ireadabc.com/e450402045868fc7dbc25b3718e4e817.mp4","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/e1ad98a7fcf98201b2bcfc191c8743ae.mp3"}],"readingItemArr":[{},{}]}
		
		return {"quesArr":[{"itemType":"jump","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/7cb75d5ff1deb3b0cccdb39a696d5385.png","rect":{"x":32.11,"y":0,"width":1153.78,"height":649}},"hotZoneItemArr":[],"ques_start":"0","ques_end":"24.5","bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/125a044fadb8b0b40e48b477682b3dcd.png","rect":{"x":364.06,"y":0,"width":489.88,"height":700}},"hotZoneItemArr2":[],"book_id":"Pups_Help_Cali_the_Cat","page_id":"3","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/d7f4114268873eaa5ccebbb41f3705ea.mp3"},{"itemType":"jump","ques_start":"24.5","ques_end":"44","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/e87ef53b01e18ea336974c5ab4770dda.png","rect":{"x":32.11,"y":0,"width":1153.78,"height":649}},"hotZoneItemArr":[{"id":"1668649768305","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":799.3965042875387,"posY":487.36251778872474,"rect":{"x":701.68,"y":421.76,"width":131.21,"height":131.21}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/7ccfe5df97ad1c45596b207fc42cf400.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1668651114681","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":544.522895125554,"posY":529.4194977843428,"rect":{"x":69.05,"y":401,"width":222.95,"height":256.84}}],"book_id":"Pups_Help_Cali_the_Cat","page_id":"5","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/2e28d7fdf1a0d112896767b8785de822.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"7","ques_start":"44","ques_end":"72","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/4cc81a58920460373b3e0a0f3a2f66d6.png","rect":{"x":32.11,"y":0,"width":1153.78,"height":649}},"hotZoneItemArr":[{"id":"1669368180785","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":947.3590220762636,"posY":503.82650611202337,"rect":{"x":870.42,"y":459,"width":89.65,"height":89.65}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/1a18a087f4c83a0f594e4aad5b64837f.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1669368421886","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":686.2753346080307,"posY":519.31931166348,"rect":{"x":233.96,"y":424,"width":176.64,"height":190.64}}],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/c665c9fd8b823d8a127b04d6ed4bf013.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"9","ques_start":"72","ques_end":"91.5","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/7ede7d3b8951ef79fb0a9c70009f7aa5.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/d2ea7d981f362b9de609d57537621e44.png","rect":{"x":363.93,"y":0,"width":490.14,"height":700}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/b77c4e4ac86b993d04d464e340cdf0e1.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","ques_end":"109","ques_start":"91.5","page_id":"11","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/7415c49a6ba21bfd35044a1e7d582e64.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"13","ques_start":"109","ques_end":"126","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/f9be68105d4d641ba7a8e66a5e9e515a.mp3"}],"video_url":"http://staging-teach.cdn.ireadabc.com/f7886d2db9735df25191601a85eec2f9.mp4","videoType":"1920_1080","isDebug":false,"jumpTime":"","finish_audio_url":"http://staging-teach.cdn.ireadabc.com/820120ba0b69636def0dd5fd409012ce.mp3","begin_audio_url":"http://staging-teach.cdn.ireadabc.com/eb6778de015dd1ec609afbcbddf68853.mp3","readingItemArr":[{"time":"11.5","content":"It's Cali, the cat...","audio_url":"http://staging-teach.cdn.ireadabc.com/16b7128142525065576f0147bda522d6.mp3"},{"time":"14.5","content":"...and Katie","audio_url":"http://staging-teach.cdn.ireadabc.com/51fb8cdd5b73e51a44da09ededfba35c.mp3"},{"time":"24.5","content":"Oh no!","audio_url":"http://staging-teach.cdn.ireadabc.com/7d416ddf98f0cd9b0f1e8549f61fdffc.mp3"},{"time":"38.5","content":"It's Katie. Where's Cali?","audio_url":"http://staging-teach.cdn.ireadabc.com/7d31fe797454bd01701ddde693f07d81.mp3"},{"time":"44","content":"Help Ryder. Choose.","audio_url":"http://staging-teach.cdn.ireadabc.com/817df058fa61ba1939c292193e652f2b.mp3"},{"time":"58","content":"Yes! Everest can help.","audio_url":"http://staging-teach.cdn.ireadabc.com/7cecfd117c532fff9c152ebad12c8eda.mp3"},{"time":"68","content":"Help Skye. Find Cali.","audio_url":"http://staging-teach.cdn.ireadabc.com/88dc92d0765fd5292bff054cc7e4ba5d.mp3"},{"time":"83","content":"Two rabbits. One cat.","audio_url":"http://staging-teach.cdn.ireadabc.com/0c94a0445f5c70b73dbc44a69b3d0409.mp3"},{"time":"89","content":"It's Cali!","audio_url":"http://staging-teach.cdn.ireadabc.com/db87be455d3b4c207be093fc5f99874b.mp3"},{"time":"96","content":"Thank you, pups.","audio_url":"http://staging-teach.cdn.ireadabc.com/aa671a1a8f932d815b9440c01a831e07.mp3"},{"time":"106","content":"Hello, Ryder.","audio_url":"http://staging-teach.cdn.ireadabc.com/7135b09d3bc895f9c5eb5a1d2be447d9.mp3"},{"time":"109","content":"Hello, Jake.","audio_url":"http://staging-teach.cdn.ireadabc.com/9c4b684965e3b73e5e0d049cea8925fe.mp3"},{"time":"118.5","content":"Milk and cookies.","audio_url":"http://staging-teach.cdn.ireadabc.com/e2c4c740a9198d5badd7debfd72fbd9f.mp3"},{"time":"121.5","content":"Good pups!","audio_url":"http://staging-teach.cdn.ireadabc.com/e28d4ff006d24ac18a9d4d10a4217240.mp3"}]}
		
		// return  {"quesArr":[{"itemType":"jump","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/7cb75d5ff1deb3b0cccdb39a696d5385.png","rect":{"x":32.11,"y":0,"width":1153.78,"height":649}},"hotZoneItemArr":[],"ques_start":"0","ques_end":"24.5","bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/125a044fadb8b0b40e48b477682b3dcd.png","rect":{"x":364.06,"y":0,"width":489.88,"height":700}},"hotZoneItemArr2":[],"book_id":"Pups_Help_Cali_the_Cat","page_id":"3","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/d7f4114268873eaa5ccebbb41f3705ea.mp3"},{"itemType":"jump","ques_start":"24.5","ques_end":"44","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/e87ef53b01e18ea336974c5ab4770dda.png","rect":{"x":32.11,"y":0,"width":1153.78,"height":649}},"hotZoneItemArr":[{"id":"1668649768305","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":799.3965042875387,"posY":487.36251778872474,"rect":{"x":701.68,"y":421.76,"width":131.21,"height":131.21}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/7ccfe5df97ad1c45596b207fc42cf400.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1668651114681","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":544.522895125554,"posY":529.4194977843428,"rect":{"x":69.05,"y":401,"width":222.95,"height":256.84}}],"book_id":"Pups_Help_Cali_the_Cat","page_id":"5","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/2e28d7fdf1a0d112896767b8785de822.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"7","ques_start":"44","ques_end":"72","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/4cc81a58920460373b3e0a0f3a2f66d6.png","rect":{"x":32.11,"y":0,"width":1153.78,"height":649}},"hotZoneItemArr":[{"id":"1669368180785","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":947.3590220762636,"posY":503.82650611202337,"rect":{"x":870.42,"y":459,"width":89.65,"height":89.65}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/1a18a087f4c83a0f594e4aad5b64837f.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1669368421886","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":686.2753346080307,"posY":519.31931166348,"rect":{"x":233.96,"y":424,"width":176.64,"height":190.64}}],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/c665c9fd8b823d8a127b04d6ed4bf013.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"9","ques_start":"72","ques_end":"91.5","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/7ede7d3b8951ef79fb0a9c70009f7aa5.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/d2ea7d981f362b9de609d57537621e44.png","rect":{"x":363.93,"y":0,"width":490.14,"height":700}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/b77c4e4ac86b993d04d464e340cdf0e1.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","ques_end":"109","ques_start":"91.5","page_id":"11","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/7415c49a6ba21bfd35044a1e7d582e64.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"13","ques_start":"109","ques_end":"126","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/f9be68105d4d641ba7a8e66a5e9e515a.mp3"}],"video_url":"http://staging-teach.cdn.ireadabc.com/f7886d2db9735df25191601a85eec2f9.mp4","videoType":"1920_1080","isDebug":false,"jumpTime":"120","finish_audio_url":"http://staging-teach.cdn.ireadabc.com/820120ba0b69636def0dd5fd409012ce.mp3","begin_audio_url":"http://staging-teach.cdn.ireadabc.com/eb6778de015dd1ec609afbcbddf68853.mp3","readingItemArr":[{"time":"11.5","content":"It's Cali the cat","audio_url":"http://staging-teach.cdn.ireadabc.com/16b7128142525065576f0147bda522d6.mp3"},{"time":"14.5","content":"and Katie","audio_url":"http://staging-teach.cdn.ireadabc.com/51fb8cdd5b73e51a44da09ededfba35c.mp3"},{"time":"24.5","content":"Oh no","audio_url":"http://staging-teach.cdn.ireadabc.com/7d416ddf98f0cd9b0f1e8549f61fdffc.mp3"},{"time":"38.5","content":"It's Katie Where's Cali","audio_url":"http://staging-teach.cdn.ireadabc.com/7d31fe797454bd01701ddde693f07d81.mp3"},{"time":"44","content":"Help Ryder Choose","audio_url":"http://staging-teach.cdn.ireadabc.com/817df058fa61ba1939c292193e652f2b.mp3"},{"time":"58","content":"Yes Everest can help","audio_url":"http://staging-teach.cdn.ireadabc.com/7cecfd117c532fff9c152ebad12c8eda.mp3"},{"time":"68","content":"Help Skye Find Cali","audio_url":"http://staging-teach.cdn.ireadabc.com/88dc92d0765fd5292bff054cc7e4ba5d.mp3"},{"time":"83","content":"Two rabbits One cat","audio_url":"http://staging-teach.cdn.ireadabc.com/0c94a0445f5c70b73dbc44a69b3d0409.mp3"},{"time":"89","content":"It's Cali","audio_url":"http://staging-teach.cdn.ireadabc.com/db87be455d3b4c207be093fc5f99874b.mp3"},{"time":"96","content":"Thank you pups","audio_url":"http://staging-teach.cdn.ireadabc.com/aa671a1a8f932d815b9440c01a831e07.mp3"},{"time":"106","content":"Hello Ryder","audio_url":"http://staging-teach.cdn.ireadabc.com/7135b09d3bc895f9c5eb5a1d2be447d9.mp3"},{"time":"109","content":"Hello Jake","audio_url":"http://staging-teach.cdn.ireadabc.com/9c4b684965e3b73e5e0d049cea8925fe.mp3"},{"time":"118.5","content":"Milk and cookies","audio_url":"http://staging-teach.cdn.ireadabc.com/e2c4c740a9198d5badd7debfd72fbd9f.mp3"},{"time":"121.5","content":"Good pups","audio_url":"http://staging-teach.cdn.ireadabc.com/e28d4ff006d24ac18a9d4d10a4217240.mp3"}]}
		// return {"quesArr":[{"itemType":"jump","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/7cb75d5ff1deb3b0cccdb39a696d5385.png","rect":{"x":32.11,"y":0,"width":1153.78,"height":649}},"hotZoneItemArr":[],"ques_start":"0","ques_end":"24.5","bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/125a044fadb8b0b40e48b477682b3dcd.png","rect":{"x":364.06,"y":0,"width":489.88,"height":700}},"hotZoneItemArr2":[],"book_id":"Pups_Help_Cali_the_Cat","page_id":"3","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/d7f4114268873eaa5ccebbb41f3705ea.mp3"},{"itemType":"jump","ques_start":"24.5","ques_end":"44","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/e87ef53b01e18ea336974c5ab4770dda.png","rect":{"x":32.11,"y":0,"width":1153.78,"height":649}},"hotZoneItemArr":[{"id":"1668649768305","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":799.3965042875387,"posY":487.36251778872474,"rect":{"x":701.68,"y":421.76,"width":131.21,"height":131.21}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/7ccfe5df97ad1c45596b207fc42cf400.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1668651114681","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":544.522895125554,"posY":529.4194977843428,"rect":{"x":69.05,"y":401,"width":222.95,"height":256.84}}],"book_id":"Pups_Help_Cali_the_Cat","page_id":"5","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/2e28d7fdf1a0d112896767b8785de822.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"7","ques_start":"44","ques_end":"72","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/4cc81a58920460373b3e0a0f3a2f66d6.png","rect":{"x":32.11,"y":0,"width":1153.78,"height":649}},"hotZoneItemArr":[{"id":"1669368180785","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":947.3590220762636,"posY":503.82650611202337,"rect":{"x":870.42,"y":459,"width":89.65,"height":89.65}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/1a18a087f4c83a0f594e4aad5b64837f.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1669368421886","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":686.2753346080307,"posY":519.31931166348,"rect":{"x":233.96,"y":424,"width":176.64,"height":190.64}}],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/c665c9fd8b823d8a127b04d6ed4bf013.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"9","ques_start":"72","ques_end":"91.5","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/7ede7d3b8951ef79fb0a9c70009f7aa5.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/d2ea7d981f362b9de609d57537621e44.png","rect":{"x":363.93,"y":0,"width":490.14,"height":700}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/b77c4e4ac86b993d04d464e340cdf0e1.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","ques_end":"109","ques_start":"91.5","page_id":"11","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/7415c49a6ba21bfd35044a1e7d582e64.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"13","ques_start":"109","ques_end":"126","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/f9be68105d4d641ba7a8e66a5e9e515a.mp3"}],"video_url":"http://staging-teach.cdn.ireadabc.com/f7886d2db9735df25191601a85eec2f9.mp4","videoType":"1920_1080","isDebug":false,"jumpTime":"","finish_audio_url":"http://staging-teach.cdn.ireadabc.com/820120ba0b69636def0dd5fd409012ce.mp3","begin_audio_url":"http://staging-teach.cdn.ireadabc.com/eb6778de015dd1ec609afbcbddf68853.mp3","readingItemArr":[{"time":"11.5","content":"It's Cali the cat","audio_url":"http://staging-teach.cdn.ireadabc.com/16b7128142525065576f0147bda522d6.mp3"},{"time":"14.5","content":"and Katie","audio_url":"http://staging-teach.cdn.ireadabc.com/51fb8cdd5b73e51a44da09ededfba35c.mp3"},{"time":"24.5","content":"Oh no","audio_url":"http://staging-teach.cdn.ireadabc.com/7d416ddf98f0cd9b0f1e8549f61fdffc.mp3"},{"time":"38.5","content":"It's Katie Where's Cali","audio_url":"http://staging-teach.cdn.ireadabc.com/7d31fe797454bd01701ddde693f07d81.mp3"},{"time":"44","content":"Help Ryder Choose","audio_url":"http://staging-teach.cdn.ireadabc.com/817df058fa61ba1939c292193e652f2b.mp3"},{"time":"58","content":"Yes Everest can help","audio_url":"http://staging-teach.cdn.ireadabc.com/7cecfd117c532fff9c152ebad12c8eda.mp3"},{"time":"68","content":"Help Skye Find Cali","audio_url":"http://staging-teach.cdn.ireadabc.com/88dc92d0765fd5292bff054cc7e4ba5d.mp3"},{"time":"83","content":"Two rabbits One cat","audio_url":"http://staging-teach.cdn.ireadabc.com/0c94a0445f5c70b73dbc44a69b3d0409.mp3"},{"time":"89","content":"It's Cali","audio_url":"http://staging-teach.cdn.ireadabc.com/db87be455d3b4c207be093fc5f99874b.mp3"},{"time":"96","content":"Thank you pups","audio_url":"http://staging-teach.cdn.ireadabc.com/aa671a1a8f932d815b9440c01a831e07.mp3"},{"time":"106","content":"Hello Ryder","audio_url":"http://staging-teach.cdn.ireadabc.com/7135b09d3bc895f9c5eb5a1d2be447d9.mp3"},{"time":"109","content":"Hello Jake","audio_url":"http://staging-teach.cdn.ireadabc.com/9c4b684965e3b73e5e0d049cea8925fe.mp3"},{"time":"118.5","content":"Milk and cookies","audio_url":"http://staging-teach.cdn.ireadabc.com/e2c4c740a9198d5badd7debfd72fbd9f.mp3"},{"time":"121.5","content":"Good pups","audio_url":"http://staging-teach.cdn.ireadabc.com/e28d4ff006d24ac18a9d4d10a4217240.mp3"}]}
		// return {"quesArr":[{"itemType":"jump","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/3094305f089804701b81f89b040ad84a.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[],"ques_start":"0","ques_end":"25.5","bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/125a044fadb8b0b40e48b477682b3dcd.png","rect":{"x":364.06,"y":0,"width":489.88,"height":700}},"hotZoneItemArr2":[],"book_id":"Pups_Help_Cali_the_Cat","page_id":"3","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/d7f4114268873eaa5ccebbb41f3705ea.mp3"},{"itemType":"jump","ques_start":"25.5","ques_end":"47","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/bea27706389b400bec3e23915c48891e.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[{"id":"1668649768305","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":842.7254617266902,"posY":529.3208473788951,"rect":{"x":736.4,"y":415.56,"width":212.64,"height":212.64}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/7ccfe5df97ad1c45596b207fc42cf400.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1668651114681","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":544.522895125554,"posY":529.4194977843428,"rect":{"x":69.05,"y":401,"width":222.95,"height":256.84}}],"book_id":"Pups_Help_Cali_the_Cat","page_id":"5","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/2e28d7fdf1a0d112896767b8785de822.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"7","ques_start":"47","ques_end":"73.5","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/996c258cb7ff42b153b20e17746f601c.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[{"id":"1669368180785","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":872,"posY":362.5,"rect":{"x":903.09,"y":424.43,"width":100.87,"height":100.87}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/1a18a087f4c83a0f594e4aad5b64837f.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1669368421886","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":686.2753346080307,"posY":519.31931166348,"rect":{"x":233.96,"y":424,"width":176.64,"height":190.64}}],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/c665c9fd8b823d8a127b04d6ed4bf013.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"9","ques_start":"73.5","ques_end":"97.5","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/20e7e0599ddddea604b161ebf05b15b6.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/d2ea7d981f362b9de609d57537621e44.png","rect":{"x":363.93,"y":0,"width":490.14,"height":700}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/b77c4e4ac86b993d04d464e340cdf0e1.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","ques_end":"121","ques_start":"97.5","page_id":"11","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/7415c49a6ba21bfd35044a1e7d582e64.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"13","ques_start":"121","ques_end":"160","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/f9be68105d4d641ba7a8e66a5e9e515a.mp3"}],"video_url":"http://staging-teach.cdn.ireadabc.com/4a7cf7e9e5062972733f7fd0f2e8644c.mp4","videoType":"1920_1080","isDebug":false,"jumpTime":"","finish_audio_url":"http://staging-teach.cdn.ireadabc.com/820120ba0b69636def0dd5fd409012ce.mp3","begin_audio_url":"http://staging-teach.cdn.ireadabc.com/eb6778de015dd1ec609afbcbddf68853.mp3","readingItemArr":[{"time":"11.5","content":"It's Cali the cat","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"14.5","content":"and Katie","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"26","content":"Oh no","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"40","content":"It's Katie Where's Cali","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"45","content":"Help Ryder Choose","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"59","content":"Yes Everest can help","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"68","content":"Help Skye Find Cali","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"}]}
		// return {"quesArr":[{"itemType":"jump","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/3094305f089804701b81f89b040ad84a.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[],"ques_start":"0","ques_end":"25.5","bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/125a044fadb8b0b40e48b477682b3dcd.png","rect":{"x":364.06,"y":0,"width":489.88,"height":700}},"hotZoneItemArr2":[],"book_id":"Pups_Help_Cali_the_Cat","page_id":"3","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/d7f4114268873eaa5ccebbb41f3705ea.mp3"},{"itemType":"jump","ques_start":"25.5","ques_end":"47","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/bea27706389b400bec3e23915c48891e.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[{"id":"1668649768305","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":842.7254617266902,"posY":529.3208473788951,"rect":{"x":736.4,"y":415.56,"width":212.64,"height":212.64}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/7ccfe5df97ad1c45596b207fc42cf400.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1668651114681","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":544.522895125554,"posY":529.4194977843428,"rect":{"x":69.05,"y":401,"width":222.95,"height":256.84}}],"book_id":"Pups_Help_Cali_the_Cat","page_id":"5","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/2e28d7fdf1a0d112896767b8785de822.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"7","ques_start":"47","ques_end":"73.5","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/996c258cb7ff42b153b20e17746f601c.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[{"id":"1669368180785","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":872,"posY":362.5,"rect":{"x":903.09,"y":424.43,"width":100.87,"height":100.87}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/1a18a087f4c83a0f594e4aad5b64837f.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1669368421886","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":686.2753346080307,"posY":519.31931166348,"rect":{"x":233.96,"y":424,"width":176.64,"height":190.64}}],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/c665c9fd8b823d8a127b04d6ed4bf013.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"9","ques_start":"73.5","ques_end":"97.5","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/20e7e0599ddddea604b161ebf05b15b6.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/d2ea7d981f362b9de609d57537621e44.png","rect":{"x":363.93,"y":0,"width":490.14,"height":700}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/b77c4e4ac86b993d04d464e340cdf0e1.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","ques_end":"121","ques_start":"97.5","page_id":"11","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/7415c49a6ba21bfd35044a1e7d582e64.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"13","ques_start":"121","ques_end":"143.5","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/f9be68105d4d641ba7a8e66a5e9e515a.mp3"}],"video_url":"http://staging-teach.cdn.ireadabc.com/4a7cf7e9e5062972733f7fd0f2e8644c.mp4","videoType":"1920_1080","isDebug":false,"jumpTime":"140","finish_audio_url":"http://staging-teach.cdn.ireadabc.com/820120ba0b69636def0dd5fd409012ce.mp3","begin_audio_url":"http://staging-teach.cdn.ireadabc.com/eb6778de015dd1ec609afbcbddf68853.mp3","readingItemArr":[{"time":"11.5","content":"It's Cali the cat","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"14.5","content":"and Katie","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"26","content":"Oh no","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"40","content":"It's Katie Where's Cali","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"45","content":"Help Ryder Choose","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"59","content":"Yes Everest can help","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"68","content":"Help Skye Find Cali","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"}]}
		// return {"quesArr":[{"itemType":"jump","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/3094305f089804701b81f89b040ad84a.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[],"ques_start":"0","ques_end":"25.5","bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/125a044fadb8b0b40e48b477682b3dcd.png","rect":{"x":364.06,"y":0,"width":489.88,"height":700}},"hotZoneItemArr2":[],"book_id":"Pups_Help_Cali_the_Cat","page_id":"3","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/d7f4114268873eaa5ccebbb41f3705ea.mp3"},{"itemType":"jump","ques_start":"25.5","ques_end":"47","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/bea27706389b400bec3e23915c48891e.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[{"id":"1668649768305","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":842.7254617266902,"posY":529.3208473788951,"rect":{"x":736.4,"y":415.56,"width":212.64,"height":212.64}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/7ccfe5df97ad1c45596b207fc42cf400.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1668651114681","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":544.522895125554,"posY":529.4194977843428,"rect":{"x":69.05,"y":401,"width":222.95,"height":256.84}}],"book_id":"Pups_Help_Cali_the_Cat","page_id":"5","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/2e28d7fdf1a0d112896767b8785de822.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"7","ques_start":"47","ques_end":"73.5","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/996c258cb7ff42b153b20e17746f601c.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[{"id":"1669368180785","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":872,"posY":362.5,"rect":{"x":903.09,"y":424.43,"width":100.87,"height":100.87}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/1a18a087f4c83a0f594e4aad5b64837f.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1669368421886","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":686.2753346080307,"posY":519.31931166348,"rect":{"x":233.96,"y":424,"width":176.64,"height":190.64}}],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/c665c9fd8b823d8a127b04d6ed4bf013.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"9","ques_start":"73.5","ques_end":"97.5","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/20e7e0599ddddea604b161ebf05b15b6.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/d2ea7d981f362b9de609d57537621e44.png","rect":{"x":363.93,"y":0,"width":490.14,"height":700}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/b77c4e4ac86b993d04d464e340cdf0e1.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","ques_end":"121","ques_start":"97.5","page_id":"11","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/7415c49a6ba21bfd35044a1e7d582e64.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"13","ques_start":"121","ques_end":"143.5","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/f9be68105d4d641ba7a8e66a5e9e515a.mp3"}],"video_url":"http://staging-teach.cdn.ireadabc.com/4a7cf7e9e5062972733f7fd0f2e8644c.mp4","videoType":"1920_1080","isDebug":false,"jumpTime":"","finish_audio_url":"http://staging-teach.cdn.ireadabc.com/820120ba0b69636def0dd5fd409012ce.mp3","begin_audio_url":"http://staging-teach.cdn.ireadabc.com/eb6778de015dd1ec609afbcbddf68853.mp3","readingItemArr":[{"time":"11.5","content":"It's Cali the cat","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"14.5","content":"and Katie","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"26","content":"Oh no","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"40","content":"It's Katie Where's Cali","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"45","content":"Help Ryder Choose","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"59","content":"Yes Everest can help","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"},{"time":"68","content":"Help Skye Find Cali","audio_url":"http://staging-teach.cdn.ireadabc.com/80d72e1f8cfdb6ffc31949947fa3b339.mp3"}]}
		// return {"quesArr":[{"itemType":"jump","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/3094305f089804701b81f89b040ad84a.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[],"ques_start":"0","ques_end":"26.5","bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/125a044fadb8b0b40e48b477682b3dcd.png","rect":{"x":364.06,"y":0,"width":489.88,"height":700}},"hotZoneItemArr2":[],"book_id":"Pups_Help_Cali_the_Cat","page_id":"3","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/d7f4114268873eaa5ccebbb41f3705ea.mp3"},{"itemType":"jump","ques_start":"26.5","ques_end":"47","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/bea27706389b400bec3e23915c48891e.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[{"id":"1668649768305","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":842.7254617266902,"posY":529.3208473788951,"rect":{"x":736.4,"y":415.56,"width":212.64,"height":212.64}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/7ccfe5df97ad1c45596b207fc42cf400.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1668651114681","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":544.522895125554,"posY":529.4194977843428,"rect":{"x":69.05,"y":401,"width":222.95,"height":256.84}}],"book_id":"Pups_Help_Cali_the_Cat","page_id":"5","tip_audio_url":"http://staging-teach.cdn.ireadabc.com/2e28d7fdf1a0d112896767b8785de822.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"7","ques_start":"47","ques_end":"73.5","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/996c258cb7ff42b153b20e17746f601c.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[{"id":"1669368180785","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":872,"posY":362.5,"rect":{"x":903.09,"y":424.43,"width":100.87,"height":100.87}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/1a18a087f4c83a0f594e4aad5b64837f.png","rect":{"x":364,"y":0,"width":490,"height":700}},"hotZoneItemArr2":[{"id":"1669368421886","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":686.2753346080307,"posY":519.31931166348,"rect":{"x":233.96,"y":424,"width":176.64,"height":190.64}}],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/c665c9fd8b823d8a127b04d6ed4bf013.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"9","ques_start":"73.5","ques_end":"97.5","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/20e7e0599ddddea604b161ebf05b15b6.png","rect":{"x":0,"y":7.44,"width":1218,"height":685.13}},"hotZoneItemArr":[],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/d2ea7d981f362b9de609d57537621e44.png","rect":{"x":363.93,"y":0,"width":490.14,"height":700}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/b77c4e4ac86b993d04d464e340cdf0e1.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","ques_end":"121","ques_start":"97.5","page_id":"11","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/7415c49a6ba21bfd35044a1e7d582e64.mp3"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"13","ques_start":"121","ques_end":"143.5","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":45.5,"width":1218,"height":609}},"hotZoneItemArr2":[],"tip_audio_url":"http://staging-teach.cdn.ireadabc.com/f9be68105d4d641ba7a8e66a5e9e515a.mp3"}],"video_url":"http://staging-teach.cdn.ireadabc.com/4a7cf7e9e5062972733f7fd0f2e8644c.mp4","videoType":"1920_1080","isDebug":false,"jumpTime":"","finish_audio_url":"http://staging-teach.cdn.ireadabc.com/820120ba0b69636def0dd5fd409012ce.mp3","begin_audio_url":"http://staging-teach.cdn.ireadabc.com/eb6778de015dd1ec609afbcbddf68853.mp3"}
		// return  {"quesArr":[{"itemType":"jump","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/3094305f089804701b81f89b040ad84a.png","rect":{"x":57,"y":0,"width":1104,"height":621}},"hotZoneItemArr":[],"ques_start":"0","ques_end":"26.5","bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/125a044fadb8b0b40e48b477682b3dcd.png","rect":{"x":391.71,"y":0,"width":434.59,"height":621}},"hotZoneItemArr2":[],"book_id":"Pups_Help_Cali_the_Cat","page_id":"2"},{"itemType":"jump","ques_start":"26.5","ques_end":"47","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/bea27706389b400bec3e23915c48891e.png","rect":{"x":7.22,"y":0,"width":1203.56,"height":677}},"hotZoneItemArr":[{"id":"1666160708755","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/29b438b66c46206a683982c2dec2c1c6.json","name":"draw_circle_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/2e0851230cec969f8a805563c9cbb177.json","name":"draw_circle_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/9531e99ab1f656893c74ee5868632f6a.png","name":"draw_circle_tex.png"},"dragDot":{"x":609,"y":336.61875292666986},"gIdx":"0","posX":111.42914796569949,"posY":109.62104725415065,"rect":{"x":70.98,"y":76.39,"width":66.45,"height":66.45}},{"id":"1668649768305","index":1,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":845.8852399197226,"posY":516.6830797299763,"rect":{"x":729.55,"y":407.57,"width":218.23,"height":218.23}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/7ccfe5df97ad1c45596b207fc42cf400.png","rect":{"x":372.05,"y":0,"width":473.9,"height":677}},"hotZoneItemArr2":[{"id":"1668651114681","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":416.5},"gIdx":"1","posX":550.5115041086102,"posY":510.08799726610437,"rect":{"x":91.37,"y":423,"width":174.18,"height":174.18}}],"book_id":"Pups_Help_Cali_the_Cat","page_id":"5"},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"7","ques_start":"47","ques_end":"73.5","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/996c258cb7ff42b153b20e17746f601c.png","rect":{"x":0,"y":26.44,"width":1218,"height":685.13}},"hotZoneItemArr":[{"id":"1669368180785","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c7c7c91328167e6eeb1384cf977de26f.json","name":"right_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/69a853eac9a3d8a4c115034b4af05bba.json","name":"right_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ed0af8b45d24d6504b2653166cadcca8.png","name":"right_tex.png"},"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":872,"posY":362.5,"rect":{"x":903.09,"y":424.43,"width":100.87,"height":100.87}}],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/1a18a087f4c83a0f594e4aad5b64837f.png","rect":{"x":425.95,"y":0,"width":366.1,"height":523}},"hotZoneItemArr2":[{"id":"1669368421886","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":261.5},"gIdx":"1","posX":663,"posY":389.5,"rect":{"x":200.55,"y":353,"width":73,"height":73}}]},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"8","ques_start":"73.5","ques_end":"97.5","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/20e7e0599ddddea604b161ebf05b15b6.png","rect":{"x":0,"y":26.44,"width":1218,"height":685.13}},"hotZoneItemArr":[],"bgItem2":{"url":"http://staging-teach.cdn.ireadabc.com/d2ea7d981f362b9de609d57537621e44.png","rect":{"x":350.63,"y":0,"width":516.75,"height":738}},"hotZoneItemArr2":[{"id":"1669617969341","index":0,"itemType":"rect","fontScale":0.9515625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":0.9515625,"dragDot":{"x":609,"y":369},"gIdx":"0","posX":815,"posY":508,"rect":{"x":426.37,"y":470,"width":76,"height":76}}]},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","ques_end":"121","ques_start":"97.5","page_id":"10","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":64.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":64.5,"width":1218,"height":609}},"hotZoneItemArr2":[]},{"itemType":"jump","book_id":"Pups_Help_Cali_the_Cat","page_id":"12","ques_start":"121","ques_end":"143.5","bgItem":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":64.5,"width":1218,"height":609}},"hotZoneItemArr":[],"bgItem2":{"url":"http://teach.cdn.ireadabc.com/8ebb1858564340ea0936b83e3280ad7d.jpg","rect":{"x":0,"y":64.5,"width":1218,"height":609}},"hotZoneItemArr2":[]}],"video_url":"http://staging-teach.cdn.ireadabc.com/4a7cf7e9e5062972733f7fd0f2e8644c.mp4","videoType":"1920_1080","isDebug":false,"jumpTime":"","finish_audio_url":"http://staging-teach.cdn.ireadabc.com/820120ba0b69636def0dd5fd409012ce.mp3","begin_audio_url":"http://staging-teach.cdn.ireadabc.com/eb6778de015dd1ec609afbcbddf68853.mp3"}
	},

	preload() {
		const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
		console.log('preloadArr:  ', JSON.stringify( preloadArr) );
		cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
			// console.log(' preload data, ', data);

			// this.loadEnd();
			this.addServerListener();

			// if (window && window["air"]) {
			// 	console.log(' hideAirClassLoading ...., ');
			// 	window["air"].hideAirClassLoading();
			// }
		});
	},

	addPreloadImage() {

		const quesArr = this.data.quesArr;
		if (!quesArr || quesArr.length == 0) {
			return;
		}

		for (let i = 0; i < quesArr.length; i++) {
			const item = quesArr[i];

			if (item.bgItem) {
				this._imageResList.push({ url: item.bgItem.url });
			}


			if (!item.hotZoneItemArr) {
				continue;
			}
			item.hotZoneItemArr.forEach((value) => {
				this._imageResList.push({ url: value.pic_url | '' });
				this._imageResList.push({ url: value.pic2_url | '' });
			})

		}

	},

	addPreloadAudio(callback) {

		// const url1 = this.data.video_url;
		// if (!url1) {
		// 	callback();
		// 	return;
		// }


		const simulateAsyncTask = (quesData) => {

			return new Promise((resolve) => {

				const video_url = quesData.video_url;
				this.getVideoUrl(video_url, (url) => {

					console.log('url: ', url);
					quesData.video_url = url;
					this._audioResList.push({ url: url || '' });

					resolve(url);
				}) 
			});
		}

		// 创建多个异步任务
		const tasks = [];
		for (let i = 0; i < this.data.quesArr.length; i++) {
			const quesData = this.data.quesArr[i];
			tasks.push(simulateAsyncTask(quesData));
		}

		Promise.all(tasks)
			.then((results) => {
				console.log("所有任务都已完成");
				console.log("任务结果:", results);
				// 在所有任务完成后执行回调函数
				// 这里可以执行你的回调逻辑

				callback();
			})
			.catch((error) => {
				console.error("一个或多个任务出错:", error);
				callback();
			});


		// this.getVideoUrl((url) => {

		// 	console.log('url: ', url);
		// 	this.data.video_url = url;
		// 	this._audioResList.push({ url: url || '' });

		// 	callback();
		// }) 
	},

	addPreloadAnima() {
		// if (!this.data.hotZoneItemArr) {
		// 	return;
		// }
		// this.data.hotZoneItemArr.forEach((item) => {
		// 	if (item.skeJsonData) {
		// 		this._animaResList.push({ url: item.skeJsonData.url || '' });
		// 		this._animaResList.push({ url: item.texJsonData.url || '' });
		// 		this._animaResList.push({ url: item.texPngData.url || '' });
		// 	}
		// })
	},


	loadEnd(cb) {


		console.log(' in loadEnd ')
		if (this.isDestroy) {
			return;
		}

		// this.initData();

		// this.initView();

		// this.initListener();

		// cb();


		// return;




		this.initData();
		this.initMask();


	
		// this.getState(() => {
			
			this.initView();
			this.initListener();

			// cb();
		// })



	},


	isFirst : null,
	isLast : null,
	playTimes : null,
	jumpData : null,
	getState(cb) {



		this.isFirst = this.checkIsFirst(); // data.first; //this.checkIsFirst();
		this.isLast = this.checkIsLast(); // data.last // this.checkIsLast();
		this.playTimes = this.checkPlayTimes(); // data.playTime// this.checkPlayTimes();
		this.jumpData = this.getJumpData(); //data.saveData // this.getJumpData();
		cb()
		return;

			console.log(' in getState 1');

			callMiddleLayerFunction('PSQS_get_course_info', {}, (data) => {

					 console.log(' in getState 2');

					this.isFirst = this.checkIsFirst(); // data.first; //this.checkIsFirst();
					this.isLast = this.checkIsLast(); // data.last // this.checkIsLast();
					this.playTimes = this.checkPlayTimes(); // data.playTime// this.checkPlayTimes();
					this.jumpData = this.getJumpData(); //data.saveData // this.getJumpData();

					if (this.data.isDebug) {
							this.playTimes += 1;
					}

					cb && cb();
			})

	},


checkIsFirst() {
		return false;
},

checkIsLast() {
		return false;
},

checkPlayTimes() {
		return 1;
},

getJumpData() {
		return //{step: 1};
},

maskSpr: null,
initMask() {
		const mask = getSprNode('black');
		const sx = this.canvas.width / mask.width;
		const sy = this.canvas.height / mask.height;
		mask.scaleX = sx;
		mask.scaleY = sy;
		mask.opacity = 255;
		this.canvas.addChild(mask, 21);
		this.maskSpr = mask;
},




	initMusic() {
		cc.assetManager.loadRemote(this.data.bg_audio_url, (err, clip) => {
			cc.audioEngine.setMusicVolume(0.3);
			const audioID = cc.audioEngine.playMusic(clip, true);
		});
	},

	canTouch: null,

	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,

	audioObj: null,

	isFirstVideoPlayEnd: null,

	isLocal: null,
	initData() {


		this.isTempDebug = false;

		this.isLocal = true;
		this.quesIndex = 0;
		this.curEndTime = -1;

		this.dragEndRectArr = [];

		this.canTouch = true;

		if (this.data.jumpTime) {
			this.jumpTime = Number(this.data.jumpTime);
		}

		for (let i=0; i<this.data.quesArr.length; i++) {

			const quesData = this.data.quesArr[i];

			console.log('quesData: ', quesData);

			quesData.starRectArr = this.getGroupArrByGIdx(quesData.hotZoneItemArr2, '0');
			quesData.optionRectArr = this.getGroupArrByGIdx(quesData.hotZoneItemArr2, '1');

		}
	
	


		this.initAudioEffect();
	},

	getGroupArrByGIdx(arr, gIdx) {
		const groupArr = [];

		if (arr) {

			for (let i=0; i<arr.length; i++) {
				if (arr[i].gIdx == gIdx) {
					groupArr.push(arr[i]);
				}
			}
		}

		return groupArr;
	},

	resetQuesIndex() {

		this.quesIndex = -1;

		for (let i=0; i<this.data.quesArr.length; i++) {
			const checkTime = this.data.quesArr[i].ques_start;
			if (Number(this.jumpTime) >= Number(checkTime)) {
				this.quesIndex = i;
			} else {
				return;
			}
		}
	},



	audioGoodjob: null,
	audioTryagain: null,
	readyClip: null,
	goClip: null,
	goodjobClip: null,
	initAudioEffect() {

		const audioNode = cc.find('Canvas/res/audio');

		const getAudioByResName = (resName) => {
			return audioNode.getChildByName(resName).getComponent(cc.AudioSource).clip;
		}

		// this.audioGoodjob = getAudioByResName('goodjob');
		// this.audioTryagain = getAudioByResName('tryagain');
		
		this.begin_1_Clip = getAudioByResName('begin_1');
		this.begin_2_Clip = getAudioByResName('begin_2');
		this.finish_2_Clip = getAudioByResName('finish_2');
		this.rightClip = getAudioByResName('right');
		this.tipPageClip = getAudioByResName('tip_next_page');
		this.tipTouchClip = getAudioByResName('tip_touch_opt');
		this.readingTipClip = getAudioByResName('reading_tip');
		this.readingTip2Clip = getAudioByResName('reading_tip_2');

		this.dingClip = getAudioByResName('ding');



		this.readyClip = getAudioByResName('ready');
		this.goClip = getAudioByResName('go');
		this.goodjobClip = getAudioByResName('goodjob');



	},



	sendServerEvent(key, data) {


		const c = window.courseware;
		if (c) {
			c.sendEvent(key, data);
		}
	},


	addServerListener() {

		console.log(' in addServerListener');


		if (window && window["air"]) {
			// cc.find('Canvas').opacity = 0;
			// window.air.onCourseInScreen = (next) => {
			// 	//  cc.find('Canvas').opacity = 255;
			// 	this.loadEnd();
			// 	next();
			// }
			this.loadEnd();
			window.air.hideAirClassLoading();
		} else {
			this.loadEnd();
		}


		// const c = window.courseware;
		// if (!c) {
		// 	return;
		// }


		// if (!window.air) {
		// 	console.log(' window air err !!!!!!!!')
		// 	return;
		// }

		// console.log(' window air  ~~~ ')


		// window.air.onCourseInScreen = (next) => {
		// 	//各种逻辑
		// 	// this.showTemplateStartAnima();

		// 	console.log("aaaaa")
		// 	this.loadEnd(() => {
		// 		next();
		// 	});
		// }



	},


	
	checkStart(data) {

		console.log(' in checkStart')
		if (data.debugBgImg && data.hzLoadEnd) {

			delayCall(0.2 ,( ) =>{

				this.showStartAudio(data);
			})
		}
	},

	showStartAudio(data) {

		playAudio(this.begin_1_Clip, () => {
			this.testingPage(data);
		})

		// playAudioByUrl(this.data.begin_audio_url, () => {
		// 	this.testingPage(data);
		// })

	},

	testingFinger() {

		// this.isCheckPage = false;
		this.startTesting(this.curQues, false);
	},


	testingPage(data) {
		console.log('in testingPage ', this.curQues.tip_audio_url);

		// this.isCheckPage = true;

		this.nextBtn.active = true;
		this.startTesting(data, true);
		return;
	
		// this.showTipAnima();

		if (this.curQues.enter_audio_url) {

			playAudioByUrl(this.curQues.enter_audio_url, () => {
				// this.isCheckPage = true;
				// this.nextBtn.active = true;
	
				this.startTesting(data, true);
			})
			return;
		}
		
		

		playAudioByUrl(this.curQues.tip_audio_url, () => {
			// this.isCheckPage = true;
			// this.nextBtn.active = true;

			this.startTesting(data, true);
		})

	},

	startTesting(data, isCheckPage = false) {

		this.isGameEnd = false;
		this.isStopTesting = false;
		this.isCheckPage = isCheckPage;
		

		// this.getPhotoData((data) => { 
		// 	this.photoEnd(data);
		// }, isCheckPage);    
		// return;

		const cw = window.courseware;
		if (!cw || !cw.openOsmoHandwriting) {

			console.log('cw.openOsmoHandwriting not exist');
			return;
		}

		window["air"].osmoFingerReadCallback = (result) => {

			console.log('osmoFingerReadCallback ~~');
			console.log(result);

			const resultObj = JSON.parse(result);
			this.photoEnd(resultObj)

		};
		window["courseware"].openOsmoFingerRead({
			"page": isCheckPage,
			"book_name": data.book_id
		})
	},

	stopTesting() {

		this.isStopTesting = true;
		const cw = window.courseware;
		if (!cw || !cw.closeOsmoFingerRead) {

			console.log('cw.closeOsmoFingerRead not exist');
			return;
		}

		window["courseware"].closeOsmoFingerRead({
			"page": false,
			"book_name": this.curQues.book_id
		})
	},



	initView() {

		console.log( ' in initView')

		// this.data.isDebug = true;

		this.hideMask();
		
		this.initVideo();
		// this.initHand();

		this.initHotZone();

		this.initDebugLayer();

		// this.initTipAnima();
	
		// this.initReadingItemArr();
		this.initReadingPanel();
		this.initReadingListener();

		// this.initNextBtn();



			
		const nextBtn = cc.find('middleLayer/BtnRight');
		if (nextBtn) {
			nextBtn.active = false;
		}

		this.initNextBtn();



		// this.testingPage(this.curQues);

	},


	playStarAnim(bg) {
		const rightAnim = this.getAnim("right");
		bg.addChild(rightAnim, 20);
		
		rightAnim.x = bg.width / 2;
		rightAnim.y = bg.height / 2;

		// rightAnim.scale = 1;
		// rightAnim.y = 30;
		let display = rightAnim.getComponent(dragonBones.ArmatureDisplay)
		display.timeScale = 0.5;
		

		rightAnim.scale = 2;
		// this.rightAnim = display;
	},

	initNextBtn() {
		this.nextBtn = cc.find("Canvas/btn_next");
		this.nextBtn.active = false;

		this.nextBtn.on("touchstart", () => {

			console.log(' in click')

			this.stopTesting();
			this.nextBtn.active = false;

			this.photoEndCheckPageSuccess();

		})
	},

	initReadingPanel() {

		this.initReadingPanelBg();
		this.initReadingPanelRichText();
		this.initSoundAnim();
		this.initRecordAnim();
		this.initFinishBtn();
	
	},

	initReadingPanelBg() {
		const readingPanel = cc.find("Canvas/readingPanel")

		readingPanel.scale = this.canvas.width / readingPanel.width ;
		this.readingPanel = readingPanel

		this.readingPanelCenter = cc.find("panel", readingPanel);

		this.readingPanelBg = cc.find("panel/bg_2", readingPanel);

		readingPanel.active = false;
	},

	initReadingPanelRichText() {
		const richText = this.getRichText();
		richText.fontSize = 80;
		richText.lineHeight = richText.fontSize;
		richText.string = "<color=#c48814>aaallla aalla</color>"
		richText.node.y = 50;
		
		this.readingPanelBg.addChild(richText.node);

		const cloneNode = cc.instantiate(richText.node);
		cloneNode.parent = richText.node.parent;
		cloneNode.opacity = 0;

		const cloneLabel = cloneNode.getComponent(cc.RichText);
		richText.cloneLabel = cloneLabel;

		this.readingRichText = richText;
	},

	initSoundAnim() {
		const soundBtn = cc.find('panel/sound', this.readingPanel);
		soundBtn.on('touchstart', () => {
			console.log(' soundBtn click');
			if (this.curReadingAudioUrl) {

				this.readingSoundBtnClick();
			}
		})

		this.soundBtn = soundBtn;

		const soundBtn2 = cc.find('panel/soundAnim', this.readingPanel);
		this.soundAnim = soundBtn2.getComponent(cc.Animation);
	},

	readingSoundBtnClick() {
		if (!this.canTouch) {
			return;
		}
		this.canTouch = false;
		this.recordIconStop();
		this.soundIconStart();
		this.stopRecordToText();
		playAudioByUrl(this.curReadingAudioUrl, () => {

			this.startRecordToText();

			this.canTouch = true;
			this.recordIconStart();
			this.soundIconStop();

			this.finishBtn.active = true;

		});
		
		this.finishBtn.active = false;

	},

	initRecordAnim() {
		const recordAnim = this.getAnim("record");
		this.readingPanelBg.addChild(recordAnim);
		recordAnim.scale = 0.5;
		recordAnim.y = -80;
		let display = recordAnim.getComponent(dragonBones.ArmatureDisplay)
		display.timeScale = 0;
		this.recordAnim = display;
	},

	initFinishBtn() {

		const finishBtn = cc.find("panel/finish", this.readingPanel);
		finishBtn.on("touchstart", () => {
			this.finishBtnClick();
		})

		this.finishBtn = finishBtn;
		this.finishBtn.active = false;

		this.finishLight =  cc.find("panel/finish_light", this.readingPanel);
	},

	finishBtnClick() {

		

	

		this.finishBtn.active = false;
		
		if (!this.readingPanelCenter.baseScale) {
			this.readingPanelCenter.baseScale = this.readingPanelCenter.scale;
		}

		const baseScale = this.readingPanelCenter.baseScale;


		const showFunc = () => {
			cc.tween(this.readingPanelCenter)
				.to(0.3, {scale: baseScale}, {easing: "cubicIn"})
			.start();
		}
	
		const hideFunc = () => {
			cc.tween(this.readingPanelCenter)
			.to(0.3, {scale: 0}, {easing: "cubicOut"})
			.call(() => {

				this.stopRecordToText();
				this.readingItemArrIndex ++ ;
				this.showReadingItem();

				if (this.curReadingItem) {
					showFunc();
				} else {
					this.readingPanel.active = false;
				}
			})
			.start();
		}

	
		hideFunc();



		// // this.readingPanel.active = false;

		// this.stopRecordToText();

		// this.readingItemArrIndex ++ ;

		// this.showReadingItem();




		

		// this.initCurReadingItem();
		// this.initCurQuesReadingItem();

		// if (this.isGameEnd) {
		// 	return;
		// }

		// this.video.play();


	},


	recordIconStart() {
		this.isRecording = true;
		this.recordAnim.timeScale = 0.4;
	},

	recordIconStop() {
		this.isRecording = false;
		this.recordAnim.timeScale = 0;
	},

	soundIconStart() {
		this.soundBtn.active = false;
		this.soundAnim.node.active = true;
		this.soundAnim.play();
	},

	soundIconStop() {
		this.soundBtn.active = true;
		this.soundAnim.node.active = false;
		this.soundAnim.stop();
	},


	initReadingItemArr() {

		this.readingItemArr = this.data.readingItemArr;
		this.readingItemArrIndex = 0;
	},


	initTipAnima() {
		const tipAnimaNode = this.getAnim('tip');
		this.tipAnimaNode = cc.instantiate(tipAnimaNode);
		this.canvas.addChild(this.tipAnimaNode, 20);

		this.tipAnimaNode.active = false;

	},

	showTipAnima() {

		// this.tipAnimaNode.active = true;
		const dragondisplay = this.tipAnimaNode.getComponent(dragonBones.ArmatureDisplay);
		// const ms = dragondisplay.getMaterials()[0];
		// ms.setBlend(null,null, cc.macro.BlendFactor.ONE, cc.macro.BlendFactor.ONE_MINUS_SRC_ALPHA,null, cc.macro.BlendFactor.ONE, cc.macro.BlendFactor.ONE_MINUS_SRC_ALPHA)
		dragondisplay.playAnimation('normal', -1);
	},

	hideTipAnima() {
		this.tipAnimaNode.active = false;
	},


	debugLayer: null,
	initDebugLayer() {

		for (let i = 0; i < this.data.quesArr.length; i++) {
			
			const quesData = this.data.quesArr[i];

			console.log(' in initDebugLayer');
			const layer = new cc.Node();

			if (this.data.isDebug) {
				layer.parent = cc.find('Canvas');
			}


			layer.width = this.canvas.width / 2;
			layer.height = this.canvas.height / 2;

			layer.zIndex = 100;
			layer.anchorX = 0;
			layer.anchorY = 1;

			if (!quesData.bgItem2) {
				continue;
			}

			layer.data = quesData.bgItem2;

			cc.loader.load({url: quesData.bgItem2.url}, (err, img) => {

				
				quesData.debugBgImg = img;
				quesData.checkBg = img;
				layer.width = img.width;
				layer.height = img.height;

				layer.data = quesData.bgItem2;

				const sprNode = layer;
		
				var sf = new cc.SpriteFrame(img);

				const spr = sprNode.addComponent(cc.Sprite);
				spr.spriteFrame = sf		
				
				spr.srcBlendFactor = cc.macro.BlendFactor.ONE;
				spr.dstBlendFactor = cc.macro.BlendFactor.ONE_MINUS_SRC_ALPHA;
				const texture = sf.getTexture();
				texture.setPremultiplyAlpha(true);
				


				const sx = this.canvas.width / 2 / layer.width;
				const sy = (this.canvas.height) / 2 / layer.height;
				const s = Math.min(sx, sy);
				layer.scale = s;

				// this.addNewRect();
				// this.addCircleItem();
				// this.addSignItem();

				// this.initDebugRect();

				if (i == 0) {
					this.checkStart(quesData);
				} else {
					layer.active = false;
				}
		
				this.addStarItem(quesData);
				this.addOptionItem(quesData);

			});

			layer.x = -this.canvas.width / 2 + 10;
			layer.y = this.canvas.height / 2 - this.canvas.height / 3;
			layer.opacity = 150;


			quesData.debugLayer = layer;


			const drawLayer = new cc.Node();
			quesData.debugLayer.addChild(drawLayer, 2);

			quesData.debugDrawLayer = drawLayer;


			// if (i != 0) {
			// 	quesData.debugLayer.active = false;
			// }
		}
		

	},

	addStarItem(quesData) {
		if (!quesData.starRectArr) {
			return;
		}

		quesData.starRectCheckArr = [];
		const bg = quesData.debugLayer;
		for (let i=0; i<quesData.starRectArr.length; i++) {
			const oneData = quesData.starRectArr[i];
			console.log('bg: ', bg);
			const rect = this.setDebugRectDot(oneData, bg, quesData);
			quesData.starRectCheckArr.push(rect);
			console.log('oneData: ', oneData);
		}
	},

	addOptionItem(quesData) {
		if (!quesData.optionRectArr) {
			return;
		}

		console.log('quesData.optionRectArr: ', quesData.optionRectArr);
		
		quesData.optionRectCheckArr = [];
		const bg = quesData.debugLayer;
		for (let i=0; i<quesData.optionRectArr.length; i++) {
			const oneData = quesData.optionRectArr[i];
			console.log('bg: ', bg);
			const rect = this.setDebugRectDot(oneData, bg, quesData);
			quesData.optionRectCheckArr.push(rect);
			console.log('oneData~: ', oneData);
		}
	},


	setDebugRectDot(data, bg, quesData) {
		const bgData = bg.data;
		console.log('bgData: ', bgData);
		const rate = (bg.scale * bg.width) / bgData.rect.width;

		const rectNode = new cc.Node();
		rectNode.name = 'rect' + data.index;
		bg.addChild(rectNode);


		const ctx = rectNode.addComponent(cc.Graphics);
		// 红色矩形
		ctx.lineWidth = 4;
		ctx.strokeColor = cc.Color.BLACK;
		ctx.fillColor = cc.Color.WHITE.setA(100);

		const scale = rate / bg.scaleY;

		console.log('scale: ', scale);

		rectNode.width = data.rect.width * scale;
		rectNode.height = data.rect.height * scale;
		rectNode.x = data.rect.x * scale;
		rectNode.y =  - data.rect.y * scale - data.rect.height * scale;


		rectNode.anchorX = rectNode.anchorY = 0;


		rectNode.x /= bg.width;
		rectNode.y /= bg.height;
		rectNode.width /= bg.width;
		rectNode.height /= bg.height;


		const colorRect = this.getColorRect(rectNode, quesData, 'blue');
		colorRect.opacity = 180;
		colorRect.data = data;
		bg.addChild(colorRect, 20);

		return colorRect;
	},



	initHand() {
		this.hand = cc.find("Canvas/hand");
		this.hand.active = false;
	},


	initStartView() {

		this.showStartLight();
		if (this.playTimes > 0) {
				this.showStartTitleGo();
		} else {
				this.showStartTitleReady();
		}
},


lightBg: null,
lightLeft: null,
lightRight: null,
showStartLight() {

		const lightBg = getSprNode('black');
		lightBg.scaleX = this.canvas.width / lightBg.width;
		lightBg.scaleY = this.canvas.height / lightBg.height;
		lightBg.opacity = 180;
		this.canvas.addChild(lightBg, 10);
		

		const lightLeft = getSprNode('light');
		lightLeft.anchorY = 0.9;
		lightLeft.x = -this.canvas.width / 2;
		lightLeft.y = this.canvas.height / 2;
		lightLeft.scale = this._mapScaleMin;
		lightLeft.zIndex = 10;
		lightLeft.parent = this.canvas;
		lightLeft.rotation = 45;
		lightLeft.opacity = 0;
		cc.tween(lightLeft)
				.to(1, {rotation: -45}, {easing: "cubicOut"})
				.start();
		cc.tween(lightLeft)
				.to(0.5, {opacity: 255})
				.start();
		
		const lightRight = getSprNode('light');
		lightRight.anchorY = 0.9;
		lightRight.x = this.canvas.width / 2;
		lightRight.y = this.canvas.height / 2;
		lightRight.scale = this._mapScaleMin;
		lightRight.zIndex = 10;
		lightRight.parent = this.canvas;
		lightRight.rotation = -45;
		lightRight.opacity = 0;
		cc.tween(lightRight)
				.to(1, {rotation: 45}, {easing: "cubicOut"})
				.start();
		cc.tween(lightRight)
				.to(0.5, {opacity: 255})
				.start();


		this.lightBg = lightBg;
		this.lightLeft = lightLeft;
		this.lightRight = lightRight;
},



	title: null,
	showStartTitleReady() {
			const title = getSprNode('start_title');
			title.scale = this._mapScaleMin;
			title.y = this.canvas.height / 2 + title.height * title.scaleY;
			title.parent = this.canvas;
			title.zIndex = 11;

			cc.tween(title)
					.delay(0.3)
					.call(() => {
							playAudio(this.readyClip, (() => {
									this.startAudioEnd();
							}));
					})
					.to(1.5, {y: 0}, {easing: "elasticOut"})
					.start();

			this.title = title
	},


	async showStartTitleGo() {

			const title = new cc.Node();
			title.parent = this.canvas;
			title.zIndex = 11;
			title.scale = this._mapScaleMin;
			this.title = title


			playAudio(this.goClip, (() => {
					this.startAudioEnd();
			}));

			const popNum = (name, time = 1) => {
					const sprNode = getSprNode(name);
					title.addChild(sprNode);
					sprNode.scale = 0.2;
					sprNode.opacity = 0;

					cc.tween(sprNode)
							.to(time/10, {opacity: 255})
							.start();

					cc.tween(sprNode)
							.to(0.8 * time, {scale: this._mapScaleMin}, {easing: 'elasticOut'})
							.delay(0 * time)
							.to(0.2 * time, {opacity: 0})
							.start();
			}


			await asyncDelay(2.2);

			popNum('go_1', 0.7);
			await asyncDelay(0.7);
			popNum('go_2', 0.7);
			await asyncDelay(0.7);
			popNum('go_3', 0.7);
			await asyncDelay(0.7);
			popNum('go_0');
			await asyncDelay(1);

	},

	isDestroy: null,
	startAudioEnd() {
			if (this.isDestroy) {
					return;
			}
			this.hideStartView();
	},

	async hideStartView() {
		const hideSpr = (sprNode, cb=null) => {
				cc.tween(sprNode)
						.to(0.3, {opacity: 0})
						.call(() => {
								sprNode.active = false;
								cb && cb();
						})
						.start();
		}

		hideSpr(this.lightLeft);
		hideSpr(this.lightRight);
		hideSpr(this.title);

		await asyncDelay(0.2)
		hideSpr(this.lightBg, () => {
			if (this.isDestroy) {
					return;
			}

			this.startQuesVideo();

		});
	},




	serverStartTest(text) {

		console.log(' in serverStartTest: ', text);
		const cw = window?.courseware
		if (cw) {
			if (this.curQues.isKK && this.curQues.KKText) {
				cw.startTest(text, {"pronounce": this.curQues.KKText});
			} else {
				cw.startTest(text);
			}

		}
		this.addMask();
	},

	
	hideMask(cb = null) {
		const mask = this.maskSpr;
		mask.opacity = 255;

		cc.tween(mask)
				.to(0.2, {opacity: 0}, {easing: "sineOut"})
				.call(() => {
						// mask.active = false;
						cb && cb();
				})
				.start();
	},

	serverStopTest(item) {


		const cw = window?.courseware
		if (cw) {
			cw.stopTest(data => {
				console.log('stopTest data: ', data);

				if (data && typeof (data) == 'string') {
					console.log(JSON.parse(data));
					data = JSON.parse(data)
				}

				this.setRecordItemAudio(data, item);

			});
		}
	},


	setRecordItemAudio(data, item) {

	

		if (!data) {
			return;
		}

		const audioUrl = data.audioUrl;
		item.audioUrl = audioUrl;



		const overall = data.result?.overall;
		const integrity = data.result?.integrity;
		const score = integrity * 0.1 + overall * 0.9; //data.result?.overall;
		// item.score = score;
		console.log('overall is : ', overall);
		console.log('integrity is : ', integrity);
		console.log('score is : ', score);

		item.score = score;


		console.log(' score: ', score);
		this.hideMask();

		this.video.pause();

		this.wrongTimes++;

		if (this.wrongTimes >= 3) {
			this.startEndVideo();
		} else {
			if (score >= 60) {
				this.startRightVideo();
			} else {
				this.startWrongVideo();
			}
		}



	},



	initVideo() {


		// this.initQuesList();
		this.initCurQues();

		// this.getVideoUrl((url) => {
		this.initVideoRemote();
		// }) 
		// this.checkStart();

	},

	getVideoUrl(video_url, callback) {
		const url1 = video_url //this.data.video_url;
		const url2 = url1.replace(/.mp4$/g, "_l.mp4");
		// const url2 = url1;

		this.httpHeadCall(url2, (success) => {

			if (success) {
				console.log('return url2: ', url2);
				callback(url2);
			} else {
				console.log('return url1: ', url1);
				callback(url1);
			}
		})
	},



	gameEnd() {
		console.log(' in gameEnd');
		onHomeworkFinish({})

		return;
		// this.showRestart();

		
		if (!this.playTimes) {
			this.playTimes = 1;

			playAudio(this.begin_2_Clip, () => {
				this.initCurReadingItem();
				this.video.currentTime = 0;
				this.video.play();
			})

			return;
		}

		this.isGameEnd = true;


		// playAudioByUrl(this.data.finish_audio_url, () => {
		playAudio(this.finish_2_Clip, () => {
			const data = this.getHomeworkFinishData();
			console.log("homeworkData: ", JSON.stringify(data));
			onHomeworkFinish(data)

		})

	},

	getHomeworkFinishData() {

		return {};

		const arr = this.data.quesArr;
		const result = []
		for (let i=0; i<arr.length; i++) {
			const oneData = {};
			oneData.type = arr[i].itemType;

			if (oneData.type == 'sound') {
				oneData.word = arr[i].text;
				oneData.audio_url = arr[i].audioUrl;
				oneData.score = arr[i].score;
			} else {
				oneData.is_right = arr[i].isRight;
			}
		
			result.push(oneData);
		}

		return {result};
	},


	checkNextQues() {
		this.quesIndex++;
		this.initCurQues();
		if (!this.curQues) {
			this.gameEnd();
		} else {
			this.startQuesVideo();
		}
	},

	initNextQues() {

		if (this.curQues.hotZoneBg) {
			this.curQues.hotZoneBg.active = false;
		}
		if (this.curQues.debugLayer) {
			this.curQues.debugLayer.active = false;
		}

		this.quesIndex++;
		this.initCurQues();

		if (this.curQues?.debugLayer) {
			this.curQues.debugLayer.active = true;
		}

		// this.initVideoRemote();

		return;
		
		if (!this.curQues) {
			this.gameEnd();
		} else {
			this.curQues.debugLayer.active = true;
			this.testingPage(this.curQues);
		}
	},

	startQuesVideo(currentTime = null) {


		this.curQues.ques_start = 0;
		this.curQues.ques_end = this.video.getDuration() - 0.1;


		console.log(' in startQuesVideo')
		this.wrongTimes = 0;


		const video = this.video;
		video.node.name = 'ques_video';

		console.log("this.curQues: ", this.curQues);

		// if (currentTime) {
		// 	video.currentTime = currentTime;
		// } else {
		// 	video.currentTime = Number(this.curQues.ques_start);
		// }


		

			if (this.curQues) {
				this.curEndTime = Number(this.curQues.ques_end);
			}
		

		delayCall(0.1, () => {
			video.play();
		})

	},

	startWaitVideo() {
		console.log(' in startWaitVideo ')

		this.curQues.hotZoneBg.active = true;
		// this.hand.active = true;

		// this.hand.x = this.curQues.hotZoneBg.handX;
		// this.hand.y = this.curQues.hotZoneBg.handY;

		return;
		// const videoNode = this.curQues?.videoObj?.wait_video;
		// const video = videoNode.getComponent(cc.VideoPlayer);
		// video.node.name = 'wait_video';
		// video.play();

		// this.curVideo = video;
		// this.resetVideoPos(videoNode);


		const video = this.video;
		video.node.name = 'wait_video';
		video.currentTime = Number(this.curQues.wait_start);
		this.curEndTime = Number(this.curQues.wait_end);
		delayCall(0.01, () => {
			video.play();
		})



		if (this.curQues.itemType == 'sound') {
			this.serverStartTest(this.curQues.text);
			delayCall(3, () => {
				this.serverStopTest(this.curQues);
			})
		} else {
			this.curQues.hotZoneBg.active = true;
		}
	},
	continueWaitVideo() {
		console.log(' in continueWaitVideo ')


		this.video.currentTime = Number(this.curQues.wait_start);
		this.curEndTime = Number(this.curQues.wait_end);

		delayCall(0.01, () => {
			this.video.play();
		})
	},

	startRightVideo() {
		console.log(' in startRightVideo ')

		// const videoNode = this.curQues?.videoObj?.right_video;
		// const video = videoNode.getComponent(cc.VideoPlayer);
		// video.node.name = 'right_video';
		// video.play();

		// this.curVideo = video;
		// this.resetVideoPos(videoNode);


		const video = this.video;
		video.node.name = 'right_video';
		video.currentTime = Number(this.curQues.right_start);
		this.curEndTime = Number(this.curQues.right_end);

		delayCall(0.01, () => {
			video.play();
		})

	},

	startWrongVideo() {
		console.log(' in startWrongVideo ')

		// const videoNode = this.curQues?.videoObj?.wrong_video;
		// const video = videoNode.getComponent(cc.VideoPlayer);
		// video.node.name = 'wrong_video';
		// video.play();

		// this.curVideo = video;
		// this.resetVideoPos(videoNode);

		const video = this.video;
		video.node.name = 'wrong_video';

		if (this.wrongStartTime && this.wrongEndTime) {
			video.currentTime = this.wrongStartTime;
			this.curEndTime = this.wrongEndTime;
		}  else {
			video.currentTime = Number(this.curQues.wrong_start);
			this.curEndTime = Number(this.curQues.wrong_end);
		}

		delayCall(0.01, () => {
			video.play();
		})
	},

	startEndVideo() {
		console.log(' in startEndVideo ')

		// const videoNode = this.curQues?.videoObj?.end_video;
		// const video = videoNode.getComponent(cc.VideoPlayer);
		// video.node.name = 'end_video';
		// video.play();

		// this.curVideo = video;
		// this.resetVideoPos(videoNode);

		if (!this.curQues.end_start) {
			this.checkNextQues();
			return;
		}


		const video = this.video;
		video.node.name = 'end_video';
		video.currentTime = Number(this.curQues.end_start);
		this.curEndTime = Number(this.curQues.end_end);
		delayCall(0.01, () => {
			video.play();
		})
	},

	resetVideoPos(videoNode) {
		if (this.lastVideo) {
			// this.lastVideo.y = -this.canvas.height * 1.5;
			this.lastVideo.x = this.lastVideo.baseX;
			this.lastVideo.y = this.lastVideo.baseY;
		}

		videoNode.x = 0;
		videoNode.y = 0;
		this.lastVideo = videoNode;
	},

	initCurQues() {

		this.curQues = this.data.quesArr[this.quesIndex];
		console.log('this.data.quesArr: ', this.data.quesArr);
	},

	initCurReadingItem() {
		this.curReadingItem = this.readingItemArr[this.readingItemArrIndex];
		
		if (!this.curReadingItem) {
			this.gameEnd();
			return;
		}

		this.curEndTime = this.curReadingItem.time;

	},





	initVideoRemote() {

		if (this.video) {
			this.video.node.removeFromParent();
		}

		
		const url = this.curQues.video_url//this.data.video_url;

		console.log(' in initVideoRemote url: ', url)

		const videoSizeW = 1920;
		const videoSizeH = 1080;

		const videoRemoteNode = new cc.Node();
		videoRemoteNode.width = videoSizeW
		videoRemoteNode.height = videoSizeH
		videoRemoteNode.parent = this.canvas;
		// videoRemoteNode.y = -this.canvas.height * 1.5;


		videoRemoteNode.scale = this.canvas.height / videoSizeH;

		const video = videoRemoteNode.addComponent(cc.VideoPlayer);
		video.resourceType = cc.VideoPlayer.ResourceType.REMOTE;
		video.remoteURL = url;

		// video.isFullscreen = true;
		video.stayOnBottom = true;

		this.video = video;


		video.node.on('meta-loaded', (e) => {
			console.log('meta-loaded e:', e);
		})
		video.node.on('ready-to-play', async (e) => {

			console.log('e: ', e);
			if (this.isDestroy) {
				return;
			}

			video.play();
			checkIsPlaying();

		})

		const checkIsPlaying = () => {

			delayCall(0.05, () => {

				if (video.currentTime > 0) {
		
					video.node.isLoadEnd = true;
					video.pause();

					this.checkCanPlayVideo();
					// this.videoLoadEnd();

				} else {
					checkIsPlaying();
				}
			})

		}

		video.node.on('completed', () => {
			console.log(' in completed!!!!');


			this.curQuesVideoPlayEnd();

			// if (this.isLast && this.playTimes > 0) {
			// 		this.showGoodjob();
			// } else {
			// 	this.showMask(() => {
			// 		if (!this.isLocal) {
			// 			callMiddleLayerFunction('PSQS_play_animate_over', null, () => {})
			// 		}
			// 	})
			// }

		})

		return video.node;

	},

	curQuesVideoPlayEnd() {

		if (this.curQues.hotZoneBg) {
			this.curQues.hotZoneBg.active = true;
		}

		if (this.curQues.starAnimaArr && this.curQues.starAnimaArr.length > 0) {
			
			// 临时
			const animNode = this.curQues.starAnimaArr[0];
			console.log('animNode: ', animNode);
			playAudio(animNode.audioClip, () => {

				this.testingFinger();
				// this.curQues.starAnimaArr = null;
			})

			return;
		} 


		// if (this.curQues.readingItemArr && this.curQues.readingItemArr.length > 0) {

		// 	this.readingItemArr = this.curQues.readingItemArr;
		// 	this.readingItemArrIndex = 0;

		// 	playAudio(this.readingTip2Clip, () => {
		// 		this.showReadingItem();
		// 	})
			
		// 	// this.showReadingItem();
		// 	return;
		// }



		// if (this.curQues.enter_audio_url) {
		// 	this.curQues.enter_audio_url = null;
		// }

	

		if (this.curQues.tip_audio_url) {
			playAudioByUrl(this.curQues.tip_audio_url, () => {
				this.initNextQues();
				if (this.curQues) {
					this.testingPage(this.curQues);
				} else {
					this.gameEnd();
				}
			})
		} else {
			this.initNextQues();
			if (this.curQues) {
				this.testingPage(this.curQues);
			} else {
				this.gameEnd();
			}
		}

		// const end_tip_audio_url = this.curQues.tip_audio_url;
		// console.log("end_tip_audio_url: ", end_tip_audio_url);
		
		// if (end_tip_audio_url) {
		// 	playAudioByUrl(end_tip_audio_url, () => {
		// 		this.initNextQues();
		// 	})
		// }
	},




	checkCanPlayVideo() {

		const enter_audio_url = this.curQues.enter_audio_url;
		if (enter_audio_url) {
			playAudioByUrl(enter_audio_url, () => {

				// 临时
				if (this.quesIndex == 0) {
					this.testingPage(this.curQues);
					return;
				}

				this.startQuesVideo();
			})
		} else {
			this.startQuesVideo();
		}


		console.log(' in checkCanPlayVideo');
		// if (!this.curQues.canPlayVideo || !this.video || !this.video.node.isLoadEnd) {
		// 	return;
		// }


		// if (this.isVideoLoadEnd) {
		// 	this.startQuesVideo();

		// } else {
		// 	this.videoLoadEnd();
		// 	this.isVideoLoadEnd = true;
		// }
	},

	showGoodjob() {
		const goodjob = cc.find("Canvas/goodjob");
		goodjob.zIndex = 15;
		goodjob.active = true;
		goodjob.scale = this._mapScaleMin;

		const dragonDisplay = goodjob.getComponent(dragonBones.ArmatureDisplay);
		dragonDisplay.playAnimation('newAnimation', 1);

		playAudio(this.goodjobClip, async () => {
			
				await asyncDelay(3);
				console.log(' end .....');
				this.showMask(() => {

						if (!this.isLocal) {
							callMiddleLayerFunction('PSQS_play_animate_over', null, () => {})
						}
				})
	 
				
		});

	},

	getColorRect(rect, quesData, color=null) {

		if (!color) {
			color = 'red'
		}

		console.log('quesData: ', quesData);
		console.log('quesData.debugBgImg: ', quesData.debugBgImg);


		rect.x *= quesData.debugBgImg.width;
		rect.y *= quesData.debugBgImg.height;
		rect.width *= quesData.debugBgImg.width;
		rect.height *= quesData.debugBgImg.height;

		const node = getSprNode(color);
		node.anchorX = 0;
		node.anchorY = 0;
		node.x = rect.x;
		node.y = rect.y;
		node.scaleX = rect.width / node.width;
		node.scaleY = rect.height / node.height;

		node.ccRect = new cc.Rect(rect.x, rect.y, rect.width, rect.height);



		return node;
	},

	videoLoadEnd() {

		console.log(' in videoLoadEnd ');

		this.startQuesVideo();

		// if (this.jumpData) {
		// 	this.setJumpTime();
		// }
		
		// if (this.jumpTime) {
		// 	this.resetQuesIndex();
		// 	this.initCurQues();

		// } 


		
		// this.startQuesVideo(this.jumpTime);
	},

	setJumpTime() {

		let isFind = false;
		for (let i=0; i<this.data.quesArr.length; i++) {
			const id = i;
			if (id == this.jumpData.step) {
				const quesData = this.data.quesArr[i];
				this.jumpTime = Number( quesData.ques_start );

				isFind = true;
				break;
			}
		}

		if (!isFind) {
			const lastQuesData = this.data.quesArr[this.data.quesArr.length - 1];
			this.jumpTime = lastQuesData.ques_end;
		}

	},


	showReadingItem() {

		console.log(' showCurReadingText ... 2 ')
		
		this.initCurQuesReadingItem();

		if (!this.curReadingItem) {
			this.curQues.readingItemArr = null;
			this.curQuesVideoPlayEnd();
			return;
		}

		this.initReadingWordArr();
		this.initReadingSound();
		
		this.readingPanel.active = true;

		playAudio(this.readingTipClip, () => {


			// playAudioByUrl(this.curReadingAudioUrl, () => {

				this.recordIconStart();
				this.startRecordToText();

				this.readingSoundBtnClick();

			// })
		})
	
	},

	initCurQuesReadingItem() {
		this.curReadingItem = this.readingItemArr[this.readingItemArrIndex];
		
		if (!this.curReadingItem) {
			// this.gameEnd();
			return;
		}

		// this.curEndTime = this.curReadingItem.time;
	},



	showCurReadingText(richTextStr) {
		
		console.log('this.curReadingItem: ', this.curReadingItem);

		const richText = this.readingRichText;
	

		// if (!richTextStr) {
		// 	richText.string = ""
		// 	richTextStr = "<color=#c48814>" + this.curReadingItem.content + "</color> "
		// }

		const cloneLabel = richText.cloneLabel;
		cloneLabel.string = richTextStr

		delayCall(0.01, () => {
			if (cloneLabel.node.width > 1400) {
				cloneLabel.node.scale = 1400 / cloneLabel.node.width;
			} else {
				cloneLabel.node.scale = 1;
			}

			cloneLabel.node.parent = richText.node.parent;
			cloneLabel.node.y = richText.node.y - 100;

			console.log('cloneLabel.node.width: ', cloneLabel.node.width);

			richText.string = cloneLabel.string;
			richText.node.scale = cloneLabel.node.scale;


		})

	},


	initReadingSound() {
		this.curReadingAudioUrl = this.curReadingItem.audio_url;
	},

	initReadingWordArr() {

		this.readingEndWordArr = [];

		this.readingWordArr = this.curReadingItem.content.split(" ");

		const smallContent = this.curReadingItem.content.toLowerCase();
		const arr = smallContent.split(" ");
		this.readingWordSmallArr = arr;

		console.log(' initReadingWordArr: ', arr);
		this.showCurReadingLabelColor();

	},

	getRecordData() {

		// let count = 0;
		// const tempId = setInterval(() => {
		// 	const index = Math.floor( Math.random() * this.readingWordArr.length );
		// 	this.onRecord(this.readingWordArr[index]);

		// 	console.log(' tempId: ', tempId);
		// 	console.log(' count: ', count);

		// 	count ++ ;
		// 	if (count >= 5) {
		// 		clearInterval(tempId);
		// 	}
		// }, 2000);

	},


	onRecord(words) {

		console.log(' onRecord:  ', words);

		for (let i=0; i<words.length; i++) {

			const wordData = words[i];
			const word = wordData.word;
			const score = wordData.scores.pronunciation;
			const smallWord = word.toLowerCase();

			console.log('~word: ', word);
			console.log('~score: ', score);

			if (this.readingWordSmallArr.indexOf(smallWord) != -1 
				&& this.readingEndWordArr.indexOf(smallWord) == -1
				&& score >= 50) {
					this.readingEndWordArr.push(smallWord);
			}
	
		}


		this.showCurReadingLabelColor();
	},


	showCurReadingLabelColor() {

		const normalColor = '#c48814';
		const readEndColor = '#37bafe'
		let str = "";
		for (let i=0; i<this.readingWordArr.length; i++) {

			let wordColor = normalColor;
			const smallWord = this.readingWordSmallArr[i];

			for (let j=0; j<this.readingEndWordArr.length; j++) {
				if (smallWord.indexOf(this.readingEndWordArr[j]) != -1) {
					wordColor = readEndColor;
					break;
				}
			}

			// if (this.readingEndWordArr.indexOf(smallWord) != -1) {
			// 	wordColor = readEndColor;
			// }
			str += `"<color=${wordColor}>${this.readingWordArr[i]}</color>"`;
		}

		console.log(' showCurReadingText ... 1 ')
		this.showCurReadingText(str);

	},

	startRecordToText() {
		console.log(' in startRecordToText 1 ')
		const startRealtimeRecord = window?.courseware?.startRealtimeRecord;
		const curContent = this.curReadingItem.content;
		if (startRealtimeRecord && curContent) {
			console.log(' in startRecordToText 2 ')
			startRealtimeRecord( { "params": curContent });
			this.isRealtimeRecord = true;
		}
 	},

	stopRecordToText() {
		console.log(' in stopRecordToText 1 ')
		const stopRealtimeRecord = window?.courseware?.stopRealtimeRecord
		if (stopRealtimeRecord) {
			console.log(' in stopRecordToText 2 ')
			stopRealtimeRecord();
			this.isRealtimeRecord = false;
		}
	},

	initReadingListener() {

		const air = window?.air
		if (air) {

			console.log(' recordRealtimeCallBack 1');

			air.recordRealtimeCallBack = (data) => {

				console.log(' recordRealtimeCallBack 2 :', data);

				if (!this.isRecording) {
					return;
				}

				let dataObj = data;
				if (typeof (data) == 'string') {
					console.log('data is string ');
					dataObj = JSON.parse(data);
				}

				
				if (dataObj) {
					console.log(' recordRealtimeCallBack data : ', JSON.stringify(dataObj));
				}

				if (dataObj?.result?.words) {
					this.onRecord(dataObj?.result?.words)
				}
			}
		}
	},




	curVideoPlayEnd() {


		if (this.playTimes && this.playTimes == 1) {

			this.showReadingItem();
			// this.gameEnd();
			return;
		}

		this.startWaitVideo();

		if (this.curQues.optionAnimaArr && this.curQues.optionAnimaArr.length > 0) {
			
			playAudio(this.tipTouchClip, () => {
				this.testingFinger();
			})
		} else {
			this.playNextPageAudio();
		}
		

		return;

		if (this.playTimes == 0) {

			return;
		}



		switch (this.video.node.name) {
			case "ques_video":
				this.startWaitVideo();
				break;
			case "wait_video":
				this.continueWaitVideo();
				break;
			case "right_video":
				this.startEndVideo();
				// this.checkNextQues();
				break;
			case "wrong_video":
				if (this.curQues.itemType == 'sound') {
					this.startWaitVideo();
				} else {
					this.checkNextQues();
				}
				break;
			case "end_video":
				this.checkNextQues();
				break;
		}

	},

	playNextPageAudio() {

		// playAudio(this.tipPageClip, () => {

			this.initNextQues();
		// })
	},

	showMask(cb) {
		const mask = this.maskSpr;
		mask.opacity = 0;

		cc.tween(mask)
				.to(0.2, {opacity: 255}, {easing: "sineIn"})
				.call(() => {
						cb && cb();
				})
				.start();
	},






	showRestart() {

		// this.setCurTipAudioUrl(this.data.finish_audio_url);

		const circle = getSprNode('bg_circle');
		// circle.x = this.canvas.width / 4;
		this.canvas.addChild(circle, 5);

		cc.tween(circle)
			.set({ scale: 0.8, opacity: 255 })
			.to(2, { scale: 1.2, opacity: 0 })
			.union()
			.repeatForever()
			.start();


		const btn = getSprNode('btn_restart');
		this.canvas.addChild(btn, 6);
		btn.x = circle.x;

		circle.on('touchstart', () => {
			this.replay();
		})

	},

	replay() {

		const middleLayer = cc.find('middleLayer');
		if (middleLayer) {
			middleLayer.getComponent('middleLayer').reloadBundle();
		}
	},




	refreshVideoTimeLabel() {

		const currentTime = this.muteVideoPlayer.currentTime
		this.curTimeLabel.string = formatTime('mm:ss', new Date(currentTime * 1000));
	},

	refreshItemTimeLabel(item) {
		const currentTime = this.videoPlayer.currentTime
		this.curTimeLabel.string = formatTime('mm:ss', new Date(currentTime * 1000));
	},







	updateCheckStop() {

		return;

		if (!this.video || this.curEndTime == -1) {
			return;
		}



		if (this.video.currentTime >= this.curEndTime) {
			this.video.pause();
			this.video.currentTime = this.curEndTime;
			this.curEndTime = -1;


			this.curVideoPlayEnd();
			

		}
	},



	update() {

		if (this.isDestroy) {
			return;
		}


			this.updateCheckStop();



	},







	initListener() {

		const canvas = cc.find('Canvas');

		let downFlag = false;



		const touchStart = (e) => {
			this.canvasTouchStart(e);
			console.log('touch start');

			if (canvas.hasEventListener(cc.Node.EventType.MOUSE_DOWN)) {
				canvas.off(cc.Node.EventType.MOUSE_DOWN, mouseDown)
			}
		}


		const mouseDown = (e) => {
			if (!downFlag) {
				return;
			}
			this.canvasTouchStart(e);
			console.log('mouse down');

			if (canvas.hasEventListener(cc.Node.EventType.TOUCH_MOVE)) {
				canvas.off(cc.Node.EventType.TOUCH_MOVE, touchMove)
				this.removeHtmlCanvasListener('touchmove');
			}
		}


		const touchMove = (e) => {
			this.canvasTouchMove(e);
			// console.log('touch move');

			if (canvas.hasEventListener(cc.Node.EventType.MOUSE_MOVE)) {
				canvas.off(cc.Node.EventType.MOUSE_MOVE, mouseMove)
			}
		}

		const mouseMove = (e) => {
			if (!downFlag) {
				return;
			}
			this.canvasTouchMove(e);
			console.log('mouse move');

			if (canvas.hasEventListener(cc.Node.EventType.TOUCH_MOVE)) {
				canvas.off(cc.Node.EventType.TOUCH_MOVE, touchMove)
				this.removeHtmlCanvasListener('touchmove');
			}
		}

		const touchEnd = (e) => {

			downFlag = false;
			this.canvasTouchEnd(e);

			if (canvas.hasEventListener(cc.Node.EventType.MOUSE_UP)) {
				canvas.off(cc.Node.EventType.MOUSE_UP, mouseUp)
			}
			if (canvas.hasEventListener(cc.Node.EventType.MOUSE_LEAVE)) {
				canvas.off(cc.Node.EventType.MOUSE_LEAVE, mouseUp)
			}
			this.removeHtmlTouchEnd();
		}

		const mouseUp = (e) => {

			downFlag = false;

			this.canvasTouchEnd(e);

			if (canvas.hasEventListener(cc.Node.EventType.TOUCH_END)) {
				canvas.off(cc.Node.EventType.TOUCH_END, touchEnd)
			}
			if (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(e) {


		const pos = e.getLocation();
		// this.knife.x = pos.x - e.currentTarget.width / 2;
		// this.knife.y = pos.y - e.currentTarget.height / 2;


	},

	canvasTouchMove(e) {

		if (!this._curShowItem) {
			return;
		}
		const pos = e.getLocation();
		this._curShowItem.x = (pos.x - e.currentTarget.width / 2) / this._curShowItem.parent.scale;
		this._curShowItem.y = (pos.y - e.currentTarget.height / 2) / this._curShowItem.parent.scale;;

		// console.log('pos: ', pos.x);
	},

	canvasTouchEnd(e) {

		if (!this._curShowItem) {
			return;
		}
		this.checkOnDragEndRect();
		this._curShowItem = null;
	},

	checkOnDragEndRect() {

		console.log('emptyGroupArr: ',  this.emptyGroupArr);
		for (let i = 0; i < this.dragEndRectArr.length; i++) {

			const rect = this.dragEndRectArr[i];

			const worldPos = this._curShowItem.parent.convertToWorldSpaceAR(cc.v2(this._curShowItem.x, this._curShowItem.y));
			const worldRect = rect.getBoundingBoxToWorld();
			if (worldRect.contains(worldPos)) {
			
				console.log('rect in ')
				this._curShowItem.selectRect = rect;
				// this.checkIsDragEndSuccess(rect);

				return;
			}
			
		}

		this.itemBack();
	},

	checkIsDragEndSuccess(dragItem) {

		const rect = dragItem.selectRect;

		const worldPos = dragItem.parent.convertToWorldSpaceAR(cc.v2(dragItem.targetPx, dragItem.targetPy));
		const worldRect = rect.getBoundingBoxToWorld();

		console.log(' worldPos: ', worldPos);
		console.log(' worldRect: ', worldRect);

		if (worldRect.contains(worldPos)) {
			dragItem.x = dragItem.targetPx;
			dragItem.y = dragItem.targetPy;
			// dragItem.isDragEnd = true;

			// cc.audioEngine.playEffect(this.rightClip, false, 0.8);

			return true;

		} else {

			return false;
			// this.itemBack();
		}
	},

	itemBack() {

		cc.audioEngine.playEffect(this.wrongClip, false, 0.8);

		cc.tween(this._curShowItem)
			.to(0.5, {x: this._curShowItem.baseX, y: this._curShowItem.baseY}, {easing: "elasticOut"})
			.start();
	},




	removeHtmlCanvasListener(type) {
		// const canvasHtml = document.querySelector('canvas');
		// canvasHtml.addEventListener(type, (e) => {})
	},


	removeHtmlTouchEnd() {
		// const canvasHtml = document.querySelector('canvas');
		// canvasHtml.removeEventListener('touchend', this.htmlCanvasTouchendFunc, this);
	},



	photoEnd(data) {

		if (this.isStopTesting) {
			return;
		}

		console.log(' photoEnd data: ', data );
		console.log('this curQues: ',this.curQues);

		console.log('isCheckPage: ', this.isCheckPage);

		this.curQues?.debugDrawLayer?.removeAllChildren();


		if (this.isCheckPage) {
			this.photoEndCheckPage(data);
		} else {
			this.photoEndCheckFinger(data);
		}


		
	},

	photoEndCheckPage(data) {

		console.log('in photoEndCheckPage 1: ', data);

		if ( !this.isTempDebug && ( data.book_name != this.curQues.book_id || data.page_id != this.curQues.page_id) ) {
			return;
		}

		console.log('in photoEndCheckPage 2');

		playAudio(this.dingClip)

		this.stopTesting();

		this.photoEndCheckPageSuccess();

		// this.stopTesting();
		// this.nextBtn.active = false;
		
		// this.curQues.canPlayVideo = true;
		// this.checkCanPlayVideo();


		// this.hideTipAnima();


	},

	photoEndCheckPageSuccess() {

		if (this.quesIndex == 0) {
			// 封面特殊处理
			this.startQuesVideo();
			return;
		}


		// 开始检测加载下一页的视频 并且播放
		this.initVideoRemote();

	},

	photoEndCheckFinger(data) {
		console.log(' in photoEndCheckFinger ', data);

		const answerData = {};
		const {x, y} = data;

		const colorDot = this.getColorDot(x, -y, 0.05, 0.05);
		// const colorDot = this.getColorDot(0, 0, 0.05, 0.05);

		// this.canvas.addChild(colorDot);

		this.curQues.debugDrawLayer.addChild(colorDot, 1);


		// if (true) {
			// this.setOneAnswerDataOption(colorDot, answerData);
			// console.log('answerData:' , answerData);
			// this.showOptionAnswer(answerData);


		// } else {
			this.setOneAnswerDataStar(colorDot, answerData);
			console.log('answerData:' , answerData);
			console.log('answerData str:' , JSON.stringify(answerData));

			this.showStarAnswer(answerData);
		// }
		

	},

	setOneAnswerDataOption(colorDot, answerData) {
		const rect = colorDot.dotRect;
		const dotV2 = new cc.Vec2(rect.x + rect.width/2, rect.y + rect.height / 2);

		const checkArr = this.curQues.optionRectCheckArr;

		for (let i=0; i<checkArr.length; i++) {

			const checkRect = checkArr[i].ccRect;
			const key = checkArr[i].data.index;

			if (this.isTempDebug || checkRect.contains(dotV2)) {
				answerData[key] = {isFinish: true};
			}
		}
	},

	showOptionAnswer(answerData) {

		console.log(' in showOptionAnswer 1')
		if (Object.keys(answerData).length == 0) {
			return;
		}

		for (let i = 0; i < this.curQues.optionAnimaArr.length; i++) {

			const animaNode = this.curQues.optionAnimaArr[i];

			const key = (animaNode.data.index).toString();

			console.log('~animaNode: ', animaNode)
			console.log('~key: ', key)

			// if (animaNode.data.id != this.curstarQues.id) {
			// 	continue;
			// }

			console.log('answerData[key]: ', answerData[key]);


			if (!animaNode.hitCount) {
				animaNode.hitCount = 0;
			}

			if (answerData[key] && answerData[key].isFinish) {
				console.log('~showOptionRight')
				this.showOptionRight(animaNode);
				
			} else {
				animaNode.hitCount = 0;
			}
		}

	},

	showOptionRight(node) {
		console.log('in showOptionRight 1');

		if (node.isShowEnd) {
			return;
		}

		console.log('in showCircle 3');

		node.isShowEnd = true;
		// node.isRight = isRight;

		this.playRightAnim(node);
		this.stopTesting();
	},

	playRightAnim(animaNode, isAudio = true) {
		const animationNames = animaNode.animationNames;
		const dragonDisplay = animaNode.dragonDisplay;

		animaNode.active = true;
		animaNode.opacity = 255;
		// animaNode.opacity = 255;
		if (dragonDisplay && animationNames && animationNames.length > 0) {
			dragonDisplay.playAnimation(animationNames[0], 1);
		}

		if (isAudio) {
			playAudio(this.rightClip, () => {
				this.playNextPageAudio();
			
			})
		}
	
	},


	setOneAnswerDataStar(colorDot, answerData) {
		const rect = colorDot.dotRect;
		const dotV2 = new cc.Vec2(rect.x + rect.width/2, rect.y + rect.height / 2);

		const checkArr = this.curQues.starRectCheckArr;
		// console.log("checkArr: " ,checkArr);

		for (let i=0; i<checkArr.length; i++) {

			const checkRect = checkArr[i].ccRect;
			const key = checkArr[i].data.index + 1;

			console.log("checkRect: " ,checkRect);
			console.log("dotV2: " ,dotV2);


			if (checkRect.contains(dotV2)) {
				answerData[key] = {isFinish: true};
			}
		}

	},

	showStarAnswer(answerData) {

		console.log(' in showStarAnswer 1')
		if (Object.keys(answerData).length == 0) {
			return;
		}

		for (let i = 0; i < this.curQues.starAnimaArr.length; i++) {

			const animaNode = this.curQues.starAnimaArr[i];

			// const key = (animaNode.data.index + 1).toString();
			const key = (i + 1).toString();


			// console.log('~animaNode: ', animaNode)
			// console.log('~key: ', key)

			// if (animaNode.data.id != this.curstarQues.id) {
			// 	continue;
			// }


			if (!animaNode.hitCount) {
				animaNode.hitCount = 0;
			}

			if (answerData[key] && answerData[key].isFinish) {
				console.log('~showstar')
				this.showStar(animaNode);
				
			} else {
				animaNode.hitCount = 0;
			}
		}

	},

	showStar(animNode) {
		console.log('show Star');

		if (animNode.isShowEnd) {
			return;
		}
		animNode.isShowEnd = true;
		

		const rectNode = animNode.rectNode;

		this.playStarAnim(rectNode);
		playAudio(this.rightClip, () => {
			// this.playNextPageAudio();
			if(this.isDestroy) {
				return;
			}

			this.curQues.starAnimaArr = null;
			this.curQuesVideoPlayEnd();

		})

		this.stopTesting();

	},


	getColorDot(x, y, w=100, h=100, color='red') {
		const node = new cc.Node();

		if (!h) {
			h = w;
		}

		x *= this.curQues.debugBgImg.width;
		y *= this.curQues.debugBgImg.height;
		w *= this.curQues.debugBgImg.width;
		h *= this.curQues.debugBgImg.height;

		console.log("w: ~" + w);
		console.log("h: ~" + h);
		console.log("this.curQues.debugLayer: ~" , this.curQues.debugLayer);

		if (this.curQues.debugLayer.parent && this.curQues.debugLayer.active) {

			const rect = {
				x:- w/2,
				y: - h/ 2, 
				width:w, 
				height:h
			}

			const colorDot = getSprNode(color);

		
			colorDot.scaleX = rect.width / colorDot.width;
			colorDot.scaleY = rect.height / colorDot.height;
			node.addChild(colorDot);

		}

		node.x = x;
		node.y = y;

		const rect = new cc.Rect(node.x -w/2, node.y -h/2, w, h);
		node.dotRect = rect;
		node.ccRect = rect;
		return node;
	},




	getPhotoData(cb, isPage) {

		

		let photoData;
		if (isPage) {
			
			// photoData = {"page_id":"1","book_name":"LWP_L2_B01_OnTheBoat_LotsofJobs_LOWRES"}

			if (this.data1 != true) {
				photoData = {"page_id":"1","book_name":"LWP_L2_B01_OnTheBoat_LotsofJobs_LOWRES"}
				this.data1 = true;

			} else if (this.data2 != true) {
				photoData = {"page_id":"3","book_name":"LWP_L2_B01_OnTheBoat_LotsofJobs_LOWRES"}
				

				this.data2 = true;

			} else if (this.data3 != true) {
				photoData = {"page_id":"5","book_name":"LWP_L2_B01_OnTheBoat_LotsofJobs_LOWRES"}
				this.data3 = true;
			} else if (this.data4 != true) {
				photoData = {"page_id":"7","book_name":"LWP_L2_B01_OnTheBoat_LotsofJobs_LOWRES"}
				this.data4 = true;
			} else if (this.data5 != true) {
				photoData = {"page_id":"9","book_name":"LWP_L2_B01_OnTheBoat_LotsofJobs_LOWRES"}
				this.data5 = true;
			} else if (this.data6 != true) {
				photoData = {"page_id":"11","book_name":"LWP_L2_B01_OnTheBoat_LotsofJobs_LOWRES"}
				this.data6 = true;
			}
		} else {
			
			photoData = {"x":"0.21","y":"0.80"};
			// photoData = {"x":"0.26","y":"0.65"};

			
		}

		cb(photoData);
	},









	initHotZone() {
		this.initHotZoneBg();
	},


	hotZoneBg: null,
	initHotZoneBg() {

		for (let i = 0; i < this.data.quesArr.length; i++) {

			const data = this.data.quesArr[i];

			const hotZoneBg = new cc.Node();
			hotZoneBg.name = 'hotZoneBg';
			hotZoneBg.parent = cc.find('Canvas');
			hotZoneBg.data = data;

			data.hotZoneBg = hotZoneBg;
			hotZoneBg.active = false;

			if (!data.bgItem) {
				continue;
			}

			cc.loader.load({ url: data.bgItem.url }, (err, img) => {

				hotZoneBg.width = img.width;
				hotZoneBg.height = img.height;


				const sprNode = new cc.Node();
				sprNode.name = 'bgItemSpr'
				var sf = new cc.SpriteFrame(img);
				// const spr = hotZoneBg.addComponent(cc.Sprite);
				const spr = sprNode.addComponent(cc.Sprite);
				spr.spriteFrame = sf
				sprNode.width = hotZoneBg.width;
				sprNode.height = hotZoneBg.height;
				sprNode.parent = hotZoneBg;

				sprNode.opacity = 0;


				// const sx = this.canvas.width / hotZoneBg.width;
				const sy = this.canvas.height / hotZoneBg.height;
				// const s = Math.min(sx, sy);
				hotZoneBg.scale = sy;


				if (data.itemType != 'sound') {
					this.initHotZoneItem(hotZoneBg);
				}

				if (i==0) {
					data.hzLoadEnd = true;
					this.checkStart(data);
				}

			});
		}



		// this.hotZoneBg = new cc.Node();
		// this.hotZoneBg.name = 'hotZoneBg';
		// this.hotZoneBg.parent = cc.find('Canvas');
		// // this.hotZoneBg.zIndex = 4;

		// const titleH = 107 * this._mapScaleMin + 11 * 2

		// if (!this.data.bgItem) {
		// 	return;
		// }

		// cc.loader.load({ url: this.data.bgItem.url }, (err, img) => {

		// 	// this.addMask(this.hotZoneBg);

		// 	this.hotZoneBg.width = img.width;
		// 	this.hotZoneBg.height = img.height;



		// 	const sprNode = new cc.Node();
		// 	sprNode.name = 'bgItemSpr'
		// 	var sf = new cc.SpriteFrame(img);
		// 	// const spr = this.hotZoneBg.addComponent(cc.Sprite);
		// 	const spr = sprNode.addComponent(cc.Sprite);
		// 	spr.spriteFrame = sf
		// 	sprNode.width = this.hotZoneBg.width;
		// 	sprNode.height = this.hotZoneBg.height;
		// 	sprNode.parent = this.hotZoneBg;
		// 	window['bg'] = sprNode


		// 	const sx = this.canvas.width / this.hotZoneBg.width;
		// 	const sy = (this.canvas.height - titleH) / this.hotZoneBg.height;
		// 	const s = Math.min(sx, sy);
		// 	this.hotZoneBg.scale = s;

		// 	// this.hotZoneBg.y = -frameSize.height / 2 * this._cocosScale + this.hotZoneBg.height / 2 * this.hotZoneBg.scaleY + (subNum * mapS * this._cocosScale);
		// 	this.hotZoneBg.y = 0 - titleH / 2;
		// 	// console.log('this.hotZoneBg.y', this.hotZoneBg.y);




		// 	// this.data.bgItem.isShowDebugLine = true;
		// 	this.initHotZoneItem();



		// });

	},

	initHotZoneItem(bg) {
		const quesData = bg.data;
		quesData.hotZoneItemArr.forEach((item) => {
			// console.log('item.gIdx: ', item.gIdx);
			switch (item.gIdx) {
				case "0":
					this.setOneStar(item, bg);
					break;

				case "1" :
					this.setOneOption(item, bg);
					break;

				// case "2":
				// 	this.setOnePic(item, bg);
				// 	break;

				default:
					break;
			}

		});

	},



	setOneDragEndRect(data, bg) {

		console.log(" in setOneDragEndRect");

		const quesData = bg.data;
		const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width;

		const rectNode = new cc.Node();
		rectNode.name = 'rect' + data.index;
		bg.addChild(rectNode);


		const ctx = rectNode.addComponent(cc.Graphics);
		// 红色矩形
		ctx.lineWidth = 4;
		ctx.strokeColor = cc.Color.BLACK;
		ctx.fillColor = cc.Color.WHITE.setA(100);

		const scale = rate / bg.scaleY;
		// console.log('scale: ', scale);
		// console.log('scale2: ', scale / data.mapScale);


		rectNode.width = data.rect.width * scale;
		rectNode.height = data.rect.height * scale;
		rectNode.x = -bg.width / 2 + data.rect.x * scale;
		rectNode.y = bg.height / 2 - data.rect.height * scale - data.rect.y * scale;
		// rectNode.scale = 1 / data.mapScale;

		rectNode.anchorX = rectNode.anchorY = 0;


		if (quesData.bgItem.isShowDebugLine) {
			ctx.rect(0, 0, rectNode.width, rectNode.height);
		}
		ctx.stroke();
		ctx.fill();

		// console.log('```data: ', data)

		this.dragEndRectArr.push(rectNode);

		if (data.audio_url) {
			cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
				rectNode.audioClip = audioClip;
			});
		}


	},



	setOneDragPic(data, bg) {
		const quesData = bg.data;
		const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width;

		const picNode = new cc.Node();
		picNode.name= 'pic' + data.index;
		picNode.data = data;
		bg.addChild(picNode);

		cc.loader.load({url: data.pic_url}, (err, img) => {

			const spr = picNode.addComponent(cc.Sprite);
			spr.spriteFrame = new cc.SpriteFrame(img)

			const scale = rate / bg.scaleY;

			console.log('picNode.width: ', picNode.width);
			console.log('data.rect.width: ', data.rect.width);
			console.log('scale: ', scale);

			// picNode.width = data.rect.width * scale;
			// picNode.height = data.rect.height * scale;

			const picScale = data.rect.width * scale / picNode.width;
			picNode.scale = picScale;

			picNode.x = -bg.width / 2 + data.rect.x * scale;
			picNode.y = bg.height / 2 - data.rect.height * scale - data.rect.y * scale;

			picNode.x += picNode.width / 2 * picNode.scaleX;
			picNode.y += picNode.height / 2 * picNode.scaleX;
			// picNode.anchorX = picNode.anchorY = 0;

			// if (data.audio_url) {
			// 	this.addPicAudio(picNode);
			// }

			this.addDragPoint(picNode, data, bg)


			if (!quesData.dragPicArr) {
				quesData.dragPicArr = [];
			}
			quesData.dragPicArr.push(picNode);

		});

	},

	addDragPoint(picNode, data, bg) {

		const quesData = bg.data;
		picNode.baseX = picNode.x;
		picNode.baseY = picNode.y;

		const realRate = bg.width / quesData.bgItem.rect.width;
		picNode.targetPx = -bg.width / 2 + ( data.dragDot.x - quesData.bgItem.rect.x ) * realRate;
		picNode.targetPy = bg.height / 2 - (data.dragDot.y - quesData.bgItem.rect.y) * realRate;


		// if (data.audio_url) {
		// 	cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
		// 		picNode.audioClip = audioClip;
		// 	});
		// }


		picNode.on(cc.Node.EventType.TOUCH_START, () => {
			// if (picNode.isDragEnd) {
			// 	if (picNode.audioClip) {
			// 		cc.audioEngine.stopAllEffects();
			// 		cc.audioEngine.playEffect(picNode.audioClip, false, 0.8);
			// 	}
			// 	return;
			// }
			this._curShowItem = picNode;

		})
	},




	setOneAction(data) {



		const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width;
		const rectNode = new cc.Node();
		rectNode.name = 'rect' + data.index;
		this.hotZoneBg.addChild(rectNode);

		const ctx = rectNode.addComponent(cc.Graphics);
		// 红色矩形
		ctx.lineWidth = 4;
		ctx.strokeColor = cc.Color.BLACK;
		ctx.fillColor = cc.Color.WHITE.setA(100);

		const 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;
		const { x, y, width, height } = rectNode;
		rectNode.anchorX = rectNode.anchorY = 0;

		if (this.data.bgItem.isShowDebugLine) {
			ctx.rect(0, 0, rectNode.width, rectNode.height);
		}
		ctx.stroke();
		ctx.fill();



		console.log('setOneAction ~~ data: ', data)
		const actionData = data['actionData_' + data.gIdx];
		if (!actionData) {
			return;
		}
		if (actionData.type == 'text') {
			const label = this.setOneActionText(rectNode, actionData);
			label.node.scale = scale * data.fontScale;

			// label.overflow = cc.Label.Overflow.NONE;
			// label.node.setContentSize(new cc.Size(0, lineHeight));
			label["_forceUpdateRenderData"](true);


		} else if (actionData.type == 'pic') {

			const pic = this.setOneActionPic(rectNode, actionData);

		} else if (actionData.type == 'anima') {

			const anima = this.setOneActionAnima(rectNode, actionData);
		}
	},

	setOneActionText(rectNode, actionData) {


		// const labelNode = new cc.Node();
		// labelNode.parent = rectNode;
		const label = this.getLabel(); // labelNode.addComponent(cc.Label);
		const labelNode = label.node;
		labelNode.parent = rectNode;

		label.font = cc.find('Canvas/res/font/aharoni').getComponent(cc.Label).font;
		label.string = actionData.text;
		// label.string = `<size=${size}><color=#751e00>${this.curGroup.title }</color></size>`
		// label.lineHeight = size;
		// label.horizontalAlign = cc.macro.TextAlignment.LEFT
		// labelNode.anchorX = 0;
		// labelNode.anchorY = 1
		labelNode.color = cc.Color.BLACK;


		const opArr = actionData.changeOption
		// console.log('opArr', opArr);


		const tweenArr = [];

		for (let i = 0; i < opArr.length; i++) {

			const opData = opArr[i];
			console.log('opArr[0]', opArr[i])
			if (opData[0] == 'fontColor') {
				const color = new cc.Color();
				cc.Color.fromHEX(color, opData[1]);
				labelNode.color = color;

			} else if (opData[0] == 'opacity') {
				// console.log('opData: ', opData)
				labelNode.opacity = Number(opData[1] / 100 * 255) + 0.1;
				// console.log(labelNode.opacity);
				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] })

			}
		}


		if (actionData.audio_url) {
			cc.assetManager.loadRemote(actionData.audio_url, (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', () => {

			if (labelNode.audioClip) {
				cc.audioEngine.stopAllEffects();
				cc.audioEngine.playEffect(labelNode.audioClip, false, 0.8);
			}

			if (labelNode.isClicked) {
				// return;
			}
			labelNode.isClicked = true;

			// const j = JSON.stringify({'fontSize': 500});
			// console.log('j: ', JSON.parse('{"fontSize":500}'));

			for (let i = 0; i < tweenArr.length; i++) {
				const tweenData = tweenArr[i];

				// JSON.parse(tweenData.option)

				// console.log( JSON.parse(tweenData.option) );

				if (tweenData.optionName == 'opacity') {
					console.log('~~~ ', tweenData.item[tweenData.optionName]);
					// tweenData.item[tweenData.optionName] = tweenData.item[tweenData.optionName] + 1

					cc.tween(tweenData.item)
						.to(actionData.changeTime, JSON.parse(tweenData.option))
						.start();
				}


			}

			// cc.tween({})
			// 	.to(5, { scale: (Math.random() - 0.5) + 1})
			// 	.start();

		});

		// labelNode.opacity = 255;

		return label;
	},

	setOneActionPic(rectNode, actionData) {

		console.log('setOneActionPic actionData: ', actionData)
		const picNode = new cc.Node();
		rectNode.addChild(picNode);

		cc.loader.load({ url: actionData.pic_url }, (err, img) => {

			const 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;

			const opArr = actionData.changeOption
			const tweenArr = [];

			for (let i = 0; i < opArr.length; i++) {

				const opData = opArr[i];
				console.log('opData: ~~~ ', opData);

				if (opData[0] == 'opacity') {
					picNode.opacity = Number(opData[1] / 100 * 255) + 0.1;
					console.log(picNode.opacity);
					tweenArr.push({ item: picNode, option: `{"${opData[0]}" : ${opData[2] / 100 * 255}}`, optionName: opData[0] },)

				} else {
					// picNode[opData[0]] = Number(opData[1]);
					// tweenArr.push({item: picNode, option: `{"${opData[0]}" : ${opData[2]}}`, optionName: opData[0]})
				}


				if (actionData.audio_url) {
					cc.assetManager.loadRemote(actionData.audio_url, (err, audioClip) => {
						rectNode.audioClip = audioClip;
					});
				}


				rectNode.addComponent(cc.Button);
				rectNode.on('click', () => {

					if (rectNode.audioClip) {
						cc.audioEngine.stopAllEffects();
						cc.audioEngine.playEffect(rectNode.audioClip, false, 0.8);
					}

					if (rectNode.isClicked) {
						// return;
					}
					rectNode.isClicked = true;

					for (let i = 0; i < tweenArr.length; i++) {
						const tweenData = tweenArr[i];

						if (tweenData.optionName == 'opacity') {
							cc.tween(tweenData.item)
								.to(actionData.changeTime, JSON.parse(tweenData.option))
								.start();
						}
					}

				});
			}

		});
	},

	setOneActionAnima(rectNode, actionData) {


		const animaNode = new cc.Node();
		rectNode.addChild(animaNode);

		if (actionData.audio_url) {
			cc.assetManager.loadRemote(actionData.audio_url, (err, audioClip) => {
				rectNode.audioClip = audioClip;
			});
		}

		const data = actionData;

		const dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
		if (!data.texPngData) {
			return
		}



		const image = data.texPngData.url//"http://staging-teach.cdn.ireadabc.com/5a0c5af3e952acd0ac83a6e5c6f03ff1.png";
		const ske = data.skeJsonData.url//"http://staging-teach.cdn.ireadabc.com/bd825dcceea298d1146be8067ae3d17f.json";
		const atlas = data.texJsonData.url//"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json";
		cc.loader.load(image, (error, texture) => {

			cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => {

				cc.loader.load({ url: ske, type: 'txt' }, (error, dragonBonesJson) => {

					const atlas = new dragonBones.DragonBonesAtlasAsset();
					atlas.atlasJson = atlasJson;
					atlas.texture = texture;

					const asset = new dragonBones.DragonBonesAsset();
					asset.dragonBonesJson = dragonBonesJson;

					dragonDisplay.dragonAtlasAsset = atlas;
					dragonDisplay.dragonAsset = asset;


					let json = JSON.parse(asset.dragonBonesJson);
					let armatures = json["armature"];
					let armatureNames = [];
					for (let i = 0; i < armatures.length; i++) {
						armatureNames.push(armatures[i].name);
					}
					// console.log('armatureNames: ', armatureNames);

					let animationNames = [];

					if (armatureNames.length > 0) {
						let defaultArmatureName = armatureNames[0];
						dragonDisplay.armatureName = defaultArmatureName;
						// let animationNames = dragonDisplay.getAnimationNames(defaultArmatureName);
						let defaultArmature = armatures[0];
						let animations = defaultArmature.animation;
						for (let i = 0; i < animations.length; i++) {
							animationNames.push(animations[i].name);
						}

						// rectNode.addComponent(cc.Button);
						// rectNode.on('click', () => {
						// 	if (rectNode.isClicked) {
						// 		// return;
						// 	}
						// 	rectNode.isClicked = true;
						// 	console.log('clicked');

						// 	if (rectNode.audioClip) {
						// 		cc.audioEngine.stopAllEffects();
						// 		cc.director.emit('STOP_ALL_AUDIO')
						// 		cc.audioEngine.playEffect(rectNode.audioClip, false, 0.8);
						// 	}

						// 	if (animationNames.length > 0) {
						// 		dragonDisplay.playAnimation(animationNames[0], 1);
						// 	}
						// });
					}


					// animaNode.x = rectNode.x + rectNode.width / 2;
					// animaNode.y = rectNode.y + rectNode.height / 2;

					// const sx = rectNode.width / animaNode.width;
					// const sy = rectNode.height / animaNode.height;
					// const scale = Math.min(sx, sy);
					// animaNode.scale = scale;






					animaNode.y += rectNode.height / 2;
					animaNode.x += rectNode.width / 2;

					animaNode.scaleX = rectNode.width / animaNode.width;
					animaNode.scaleY = rectNode.height / animaNode.height;

					const opArr = actionData.changeOption
					const tweenArr = [];

					for (let i = 0; i < opArr.length; i++) {

						const opData = opArr[i];
						console.log('opData: ~~~ ', opData);

						if (opData[0] == 'opacity') {
							animaNode.opacity = Number(opData[1] / 100 * 255) + 0.1;
							console.log(animaNode.opacity);
							tweenArr.push({ item: animaNode, option: `{"${opData[0]}" : ${opData[2] / 100 * 255}}`, optionName: opData[2] == null ? '' : opData[0] },)

						} else {
							// animaNode[opData[0]] = Number(opData[1]);
							// tweenArr.push({item: animaNode, option: `{"${opData[0]}" : ${opData[2]}}`, optionName: opData[2] == null ? '' : opData[0]})
						}


						if (actionData.audio_url) {
							cc.assetManager.loadRemote(actionData.audio_url, (err, audioClip) => {
								rectNode.audioClip = audioClip;
							});
						}


						rectNode.addComponent(cc.Button);
						rectNode.on('click', () => {

							if (rectNode.audioClip) {
								cc.audioEngine.stopAllEffects();
								cc.audioEngine.playEffect(rectNode.audioClip, false, 0.8);
							}

							if (rectNode.isClicked) {
								// return;
							}
							rectNode.isClicked = true;

							for (let j = 0; j < tweenArr.length; j++) {
								const tweenData = tweenArr[j];

								console.log('tweenData: ', tweenData);

								if (tweenData.optionName) {

									cc.tween(tweenData.item)
										.to(actionData.changeTime, JSON.parse(tweenData.option))
										.start();

								}

							}

							if (animationNames.length > 0) {
								dragonDisplay.playAnimation(animationNames[0], 1);
							}

						});
					}


				});
			});
		});

	},




	setOneAnimaSmall(data, bg) {

		const quesData = bg.data;

		const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width;

		const rectNode = new cc.Node();
		rectNode.name = 'rect' + data.index;
		bg.addChild(rectNode);


		const ctx = rectNode.addComponent(cc.Graphics);
		// 红色矩形
		ctx.lineWidth = 4;
		ctx.strokeColor = cc.Color.BLACK;
		ctx.fillColor = cc.Color.WHITE.setA(100);

		const scale = rate / bg.scaleY;

		rectNode.width = data.rect.width * scale;
		rectNode.height = data.rect.height * scale;
		rectNode.x = -bg.width / 2 + data.rect.x * scale;
		rectNode.y = bg.height / 2 - data.rect.height * scale - data.rect.y * scale;

		rectNode.anchorX = rectNode.anchorY = 0;


		if (quesData.bgItem.isShowDebugLine || this.data.isDebug) {
			ctx.rect(0, 0, rectNode.width, rectNode.height);
		}
		ctx.stroke();
		ctx.fill();


		const animaNode = new cc.Node();
		animaNode.name = 'anima_' + data.index;
		bg.addChild(animaNode);

	
		if (data.audio_url) {
			cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
				animaNode.audioClip = audioClip;
			});
		}

		console.log("rectNode~: ", rectNode);

		animaNode.rectNode = rectNode;

		rectNode.addComponent(cc.Button);
		rectNode.on('click', () => {
			if (rectNode.isClicked) {
				// return;
			}
			rectNode.isClicked = true;
			console.log('clicked');


			// this.playStarAnim(rectNode);
			// playAudio(this.rightClip, () => {
			// 	// this.playNextPageAudio();
			// 	if(this.isDestroy) {
			// 		return;
			// 	}
			// 	this.curQuesVideoPlayEnd();

			// })

	
		});

		return animaNode;

	

		const dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
		if (!data.texPngData) {
			return
		}

		const image = data.texPngData.url//"http://staging-teach.cdn.ireadabc.com/5a0c5af3e952acd0ac83a6e5c6f03ff1.png";
		const ske = data.skeJsonData.url//"http://staging-teach.cdn.ireadabc.com/bd825dcceea298d1146be8067ae3d17f.json";
		const atlas = data.texJsonData.url//"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json";
		cc.loader.load(image, (error, texture) => {

			cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => {

				cc.loader.load({ url: ske, type: 'txt' }, (error, dragonBonesJson) => {

					const atlas = new dragonBones.DragonBonesAtlasAsset();
					atlas.atlasJson = atlasJson;
					atlas.texture = texture;

					const asset = new dragonBones.DragonBonesAsset();
					asset.dragonBonesJson = dragonBonesJson;

					dragonDisplay.dragonAtlasAsset = atlas;
					dragonDisplay.dragonAsset = asset;



					let json = JSON.parse(asset.dragonBonesJson);
					let armatures = json["armature"];
					// console.log('armatures: ', armatures);
					let armatureNames = [];
					for (let i = 0; i < armatures.length; i++) {
						armatureNames.push(armatures[i].name);
					}
					// console.log('armatureNames: ', armatureNames);
					if (armatureNames.length > 0) {
						let defaultArmatureName = armatureNames[0];
						dragonDisplay.armatureName = defaultArmatureName;
						// let animationNames = dragonDisplay.getAnimationNames(defaultArmatureName);
						let defaultArmature = armatures[0];
						let animations = defaultArmature.animation;
						let animationNames = [];
						for (let i = 0; i < animations.length; i++) {
							animationNames.push(animations[i].name);
						}

						animaNode.animationNames = animationNames;
						animaNode.dragonDisplay = dragonDisplay;


						rectNode.addComponent(cc.Button);
						rectNode.on('click', () => {
							if (rectNode.isClicked) {
								// return;
							}
							rectNode.isClicked = true;
							console.log('clicked');

							if (animaNode.audioClip) {
								cc.audioEngine.stopAllEffects();
								cc.director.emit('STOP_ALL_AUDIO')
								cc.audioEngine.playEffect(animaNode.audioClip, false, 0.8);
							}

							if (animationNames.length > 0) {
								dragonDisplay.playAnimation(animationNames[0], 1);
							}
						});
					}


					animaNode.x = rectNode.x + rectNode.width / 2;
					animaNode.y = rectNode.y + rectNode.height / 2;

					const sx = rectNode.width / animaNode.width;
					const sy = rectNode.height / animaNode.height;
					const scale = Math.min(sx, sy);
					// animaNode.scale = scale;

					animaNode.opacity = 0;

				});
			});
		});

		animaNode.data = data;
		return animaNode;

	},

	setSubmitRect(data, bg) {
		const quesData = bg.data;
		const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width;

		const rectNode = new cc.Node();
		rectNode.name = 'rect' + data.index;
		bg.addChild(rectNode);


		const ctx = rectNode.addComponent(cc.Graphics);
		// 红色矩形
		ctx.lineWidth = 4;
		ctx.strokeColor = cc.Color.BLACK;
		ctx.fillColor = cc.Color.WHITE.setA(100);

		const scale = rate / bg.scaleY;



		rectNode.width = data.rect.width * scale;
		rectNode.height = data.rect.height * scale;
		rectNode.x = -bg.width / 2 + data.rect.x * scale;
		rectNode.y = bg.height / 2 - data.rect.height * scale - data.rect.y * scale;
		// rectNode.scale = 1 / data.mapScale;

		rectNode.anchorX = rectNode.anchorY = 0;


		if (quesData.bgItem.isShowDebugLine) {
			ctx.rect(0, 0, rectNode.width, rectNode.height);
		}
		ctx.stroke();
		ctx.fill();

		console.log('```data: ', data)

		// if (data.audio_url) {
		// 	cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
		// 		rectNode.audioClip = audioClip;
		// 	});
		// }

		rectNode.addComponent(cc.Button);
		rectNode.on('click', () => {
			if (rectNode.isClicked) {
				// return;
			}
			rectNode.isClicked = true;
			if (this.curQues.itemType == "submit") {
				this.checkSubmitSelectQues();
			} else if (this.curQues.itemType == "drag"){
				this.checkSubmitDragQues();
			}
			// console.log('clicked');
			// this.video.pause();
			// if (data.selectType == 'right') {
			// 	this.startRightVideo();
			// } else {
			// 	this.startWrongVideo();
			// }

			bg.active = false;
			// if (rectNode.audioClip) {
			// 	cc.audioEngine.stopAllEffects();
			// 	cc.audioEngine.playEffect(rectNode.audioClip, false, 0.8);
			// }
		});
	},


	setOptPic(data, bg) {

		const quesData = bg.data;

		const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width;

		const picNode = new cc.Node();
		picNode.name = 'pic' + data.index;
		picNode.data = data;
		bg.addChild(picNode);
		picNode.data = data;

		if (!quesData.optPicArr) {
			quesData.optPicArr = [];
		}
		quesData.optPicArr.push(picNode);


		const scale = rate / bg.scaleY;
		picNode.width = data.rect.width * scale;
		picNode.height = data.rect.height * scale;
		picNode.x = -bg.width / 2 + data.rect.x * scale;
		picNode.y = bg.height / 2 - data.rect.height * scale - data.rect.y * scale;

		picNode.anchorX = picNode.anchorY = 0;


		getSprNodeByUrl(data.pic_url, (spr) => {

			const sprNode = spr.node;

			sprNode.scaleX = picNode.width / sprNode.width;
			sprNode.scaleY = picNode.height / sprNode.height;
			sprNode.anchorX = sprNode.anchorY = 0;
			sprNode.parent = picNode;

			picNode.spr1 = sprNode;
		})

		getSprNodeByUrl(data.pic2_url, (spr) => {

			const sprNode = spr.node;

			sprNode.scaleX = picNode.width / sprNode.width;
			sprNode.scaleY = picNode.height / sprNode.height;
			sprNode.anchorX = sprNode.anchorY = 0;
			sprNode.parent = picNode;
			sprNode.opacity = 0;

			picNode.spr2 = sprNode;
		})


		picNode.isSelect = false;
		picNode.on("touchstart", () => {

			this.hideAllOptSelect();
			picNode.isSelect = true;

			// picNode.isSelect = !picNode.isSelect;
			if (picNode.isSelect) {
				picNode.spr1.opacity = 0;
				picNode.spr2.opacity = 255;
			} else {
				picNode.spr1.opacity = 255;
				picNode.spr2.opacity = 0;
			}

		})

		if (data.audio_url) {
			this.addPicAudio(picNode);
		}


		// cc.loader.load({ url: data.pic_url }, (err, img) => {

		// 	const spr = picNode.addComponent(cc.Sprite);
		// 	spr.spriteFrame = new cc.SpriteFrame(img)

		// 	const scale = rate / bg.scaleY;

		// 	picNode.width = data.rect.width * scale;
		// 	picNode.height = data.rect.height * scale;
		// 	picNode.x = -bg.width / 2 + data.rect.x * scale;
		// 	picNode.y = bg.height / 2 - data.rect.height * scale - data.rect.y * scale;

		// 	picNode.anchorX = picNode.anchorY = 0;

		// 	// if (data.audio_url) {
		// 	// 	this.addPicAudio(picNode);
		// 	// }

		// });

	},

	hideAllOptSelect() {
		const optPicArr = this.curQues.optPicArr;
		optPicArr.forEach(it => {
			it.isSelect = false;
			it.spr1.opacity = 255;
			it.spr2.opacity = 0;
		})
	},

	setOnePic(data) {
		const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width;

		const picNode = new cc.Node();
		picNode.name = 'pic' + data.index;
		picNode.data = data;
		this.hotZoneBg.addChild(picNode);

		cc.loader.load({ url: data.pic_url }, (err, img) => {

			const spr = picNode.addComponent(cc.Sprite);
			spr.spriteFrame = new cc.SpriteFrame(img)

			const scale = rate / this.hotZoneBg.scaleY;

			picNode.width = data.rect.width * scale;
			picNode.height = data.rect.height * scale;
			picNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale;
			picNode.y = this.hotZoneBg.height / 2 - data.rect.height * scale - data.rect.y * scale;

			picNode.anchorX = picNode.anchorY = 0;

			if (data.audio_url) {
				this.addPicAudio(picNode);
			}

		});

	},

	setOneAudioRect(data, bg) {
		const quesData = bg.data;
		const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width;

		const rectNode = new cc.Node();
		rectNode.name = 'rect' + data.index;
		bg.addChild(rectNode);


		const ctx = rectNode.addComponent(cc.Graphics);
		// 红色矩形
		ctx.lineWidth = 4;
		ctx.strokeColor = cc.Color.BLACK;
		ctx.fillColor = cc.Color.WHITE.setA(100);

		const scale = rate / bg.scaleY;

		rectNode.width = data.rect.width * scale;
		rectNode.height = data.rect.height * scale;
		rectNode.x = -bg.width / 2 + data.rect.x * scale;
		rectNode.y = bg.height / 2 - data.rect.height * scale - data.rect.y * scale;
		// rectNode.scale = 1 / data.mapScale;

		rectNode.anchorX = rectNode.anchorY = 0;


		if (quesData.bgItem.isShowDebugLine) {
			ctx.rect(0, 0, rectNode.width, rectNode.height);
		}
		ctx.stroke();
		ctx.fill();

		console.log('```data: ', data)

		if (data.audio_url) {
			cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
				rectNode.audioClip = audioClip;
			});
		}

		rectNode.addComponent(cc.Button);
		rectNode.on('click', () => {
			if (rectNode.isClicked) {
				// return;
			}
			rectNode.isClicked = true;
			console.log('clicked');
			if (rectNode.audioClip) {
				// cc.audioEngine.stopAllEffects();
				cc.audioEngine.playEffect(rectNode.audioClip, false, 0.8);
			}
		});
	},


	setOneOption(data, bg) {

		const rectNode = this.setOneRect(data, bg);
		
		const quesData = bg.data;
		if (!quesData.optionAnimaArr) {
			quesData.optionAnimaArr = [];
		}



		const animaNode = this.setOneAnimaSmall(data, bg);
		quesData.optionAnimaArr.push(animaNode);

		console.log('setOneOption.. ', quesData.optionAnimaArr.length);

	},

	setOneStar(data, bg) {

		// const rectNode = this.setOneRect(data, bg);

		// const worldPos = rectNode.parent.convertToWorldSpaceAR(cc.v2(rectNode.x + rectNode.width / 2, rectNode.y + rectNode.height / 2))	
		// const pos = this.hand.parent.convertToNodeSpaceAR(worldPos);

		// bg.handX = pos.x;
		// bg.handY = pos.y;


		const quesData = bg.data;
		if (!quesData.starAnimaArr) {
			quesData.starAnimaArr = [];
		}

		const animaNode = this.setOneAnimaSmall(data, bg);
		quesData.starAnimaArr.push(animaNode)
	},

	setOneRect(data, bg) {
		const quesData = bg.data;
		const rate = (bg.scale * bg.width) / quesData.bgItem.rect.width;

		const rectNode = new cc.Node();
		rectNode.name = 'rect' + data.index;
		bg.addChild(rectNode);


		const ctx = rectNode.addComponent(cc.Graphics);
		// 红色矩形
		ctx.lineWidth = 4;
		ctx.strokeColor = cc.Color.BLACK;
		ctx.fillColor = cc.Color.WHITE.setA(100);

		const scale = rate / bg.scaleY;
		// console.log('scale: ', scale);
		// console.log('scale2: ', scale / data.mapScale);


		rectNode.width = data.rect.width * scale;
		rectNode.height = data.rect.height * scale;
		rectNode.x = -bg.width / 2 + data.rect.x * scale;
		rectNode.y = bg.height / 2 - data.rect.height * scale - data.rect.y * scale;
		// rectNode.scale = 1 / data.mapScale;

		rectNode.anchorX = rectNode.anchorY = 0;


		if (quesData.bgItem.isShowDebugLine || this.data.isDebug) {
			ctx.rect(0, 0, rectNode.width, rectNode.height);
		}
		ctx.stroke();
		ctx.fill();

		console.log('```data: ', data)

		// if (data.audio_url) {
		// 	cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
		// 		rectNode.audioClip = audioClip;
		// 	});
		// }

		rectNode.addComponent(cc.Button);
		rectNode.on('click', () => {
			// if (rectNode.isClicked) {
			// 	return;
			// }
			// rectNode.isClicked = true;
			// console.log('clicked');
			// this.video.pause();


			// if (data.selectType == 'right') {
			// 	this.curQues.isRight = true;
			// 	this.startRightVideo();
			// } else {
			// 	this.curQues.isRight = false;

			// 	if (data?.labelArr) {
			// 		this.wrongStartTime = Number(data.labelArr[0].value);
			// 		this.wrongEndTime = Number(data.labelArr[1].value);
			// 	} else {
			// 		this.wrongStartTime = null;
			// 		this.wrongEndTime = null;
			// 	}
			// 	this.startWrongVideo();
			// }

			const id = data.index;
			bg.active = false;
			this.hand.active = false;   

				this.showMask(() => {
					if (!this.isLocal) {
						callMiddleLayerFunction('PSQS_jump_to_question', {step: id}, null)
					}
				})

		});

		return rectNode;


	},

	addPicAudio(picNode) {
		const data = picNode.data;

		cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
			picNode.audioClip = audioClip;
		});

		picNode.addComponent(cc.Button);
		picNode.on('click', () => {
			if (picNode.audioClip) {
				cc.audioEngine.stopAllEffects();
				cc.audioEngine.playEffect(picNode.audioClip, false, 0.8);
			}
		});
	},

	getLabel() {
		const resLabel = cc.find("Canvas/res/label")
		const labelNode = cc.instantiate(resLabel)
		const label = labelNode.getComponent(cc.Label);

		return label;
	},

	getRichText() {
		const resLabel = cc.find("Canvas/res/richText");

		const labelNode = cc.instantiate(resLabel)
		const richText = labelNode.getComponent(cc.RichText);

		return richText;

	},

	getAnim(resName) {
		const anim = cc.find("Canvas/res/anim/" + resName);
		const newAnim = cc.instantiate(anim)
		return newAnim;
	},


	checkSubmitDragQues() {

		console.log('in checkSubmitDragQues');

		let isRight = true;
		const dragPicArr = this.curQues.dragPicArr;
		for (let i = 0; i < dragPicArr.length; i++) {

			const isDragRight = this.checkIsDragEndSuccess(dragPicArr[i]);
			if (!isDragRight) {

				console.log("dragItem: ", dragPicArr[i]);
				console.log("drag fail ");

				isRight = false;
				break;
			}

		}

		this.video.pause();
		this.curQues.isRight = isRight;
		if (isRight) {
			this.startRightVideo();
		} else {
			this.startWrongVideo();
		}
	},



	checkSubmitSelectQues() {

		let isRight = true;
		const optPicArr = this.curQues.optPicArr;
		for (let i = 0; i < optPicArr.length; i++) {
			const data = optPicArr[i].data;

			// console.log('optPicArr[i].isSelect: ', optPicArr[i].isSelect);
			// console.log('data.selectType: ', data.selectType);

			if (optPicArr[i].isSelect) {
				if (data.selectType != 'right') {
					isRight = false;
					break;
				}
			} else {
				if (data.selectType == 'right') {
					isRight = false;
					break;
				}
			}
		}


		console.log('clicked');
		this.video.pause();
		this.curQues.isRight = isRight;
		if (isRight) {
			this.startRightVideo();
		} else {
			this.startWrongVideo();
		}

	},


	httpHeadCall(requsetUrl, callback) {

		let xhr = new XMLHttpRequest();
		console.log("Status: Send Post Request to " + requsetUrl);
		try {
			xhr.onreadystatechange = () => {
				try {

					console.log('xhr.readyState: ', xhr.readyState);

					if (xhr.readyState == 4) {
						if ((xhr.status >= 200 && xhr.status < 400)) {
							callback(true);
						} else {
							callback(false);
						}
					}

				} catch (e) {
					console.log(e)
				}
			};

			xhr.open("HEAD", requsetUrl, true);
			// xhr.setRequestHeader('content-type', 'application/json');
			// xhr.setRequestHeader('token', this.token);

			// xhr.send(JSON.stringify(requestData));       
			xhr.send();


			xhr.timeout = 15000;
			xhr.onerror = (e) => {
				console.log("汪汪汪 posterror", e);
				callback(false);
			};

			xhr.ontimeout = (e) => {
				console.log("汪汪汪 ontimeout", e);
				callback(false);
			};

		} catch (e) {
			console.log("Send Get Request error: ", e)
		}
	},



	isDestroy: null,
	onDestroy() {

		if (this.isRealtimeRecord) {
			this.stopRealtimeRecord();
		}

		this.isDestroy = true;

		cc.Tween.stopAll();
		cc.game.canvas.style.backgroundColor = '#000000';
		// this.pauseVideo();

	}


});
