Commit ba9261eb authored by 李维's avatar 李维

调整一些逻辑

合并按钮在一个位置
多次点击音频停止上一次播放
调整正确错误图标大小和位置
分数可以配置不显示
页面销毁前播放音频
parent 785ff202
import { import {
playAudioByUrl, playAudioByUrl,
loadImageByUrl, loadImageByUrl,
asyncLoadRemote,
getSprNode, getSprNode,
} from "../script/util_DG_FAF"; } from "../script/util_DG_FAF";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent_DG_FAF"; import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent_DG_FAF";
...@@ -197,9 +198,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -197,9 +198,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 配置提交按钮 // 配置提交按钮
this.setSubmitBtn(this.data.hotZoneItemArr[this.data.submitHotZoneIndex]); this.setSubmitBtn(this.data.hotZoneItemArr[this.data.submitHotZoneIndex]);
this.setSubmitDisableBtn(this.data.hotZoneItemArr[this.data.submitHotZoneIndex]); this.setSubmitDisableBtn(this.data.hotZoneItemArr[this.data.submitHotZoneIndex]);
// 配置重新开始按钮 // 配置重新开始按钮
this.setReplayBtn(this.data.hotZoneItemArr[this.data.replayHotZoneIndex]); this.setReplayBtn(this.data.hotZoneItemArr[this.data.submitHotZoneIndex]);
// 检查是否可以提交 // 检查是否可以提交
this.checkCanSubmit(); this.checkCanSubmit();
...@@ -227,6 +227,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -227,6 +227,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 计算每个分数显示区的数据 // 计算每个分数显示区的数据
this.subScorePanels = []; this.subScorePanels = [];
this.data.scoreConfigArr.forEach(scoreConfig => { this.data.scoreConfigArr.forEach(scoreConfig => {
if(isNaN(Number(scoreConfig.linkHotZoneIndex))) {
return
}
const config = this.setScorePanel(this.data.hotZoneItemArr[scoreConfig.linkHotZoneIndex], 15); const config = this.setScorePanel(this.data.hotZoneItemArr[scoreConfig.linkHotZoneIndex], 15);
config.score = 0; config.score = 0;
config.totalScore = 0; config.totalScore = 0;
...@@ -301,7 +304,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -301,7 +304,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.btnSubmitDisable = sprNode; this.btnSubmitDisable = sprNode;
this.btnSubmitDisable.active = true; this.btnSubmitDisable.active = true;
this.btnSubmitDisable.on("click", ()=>{ this.btnSubmitDisable.on("click", ()=>{
}) })
} }
...@@ -557,15 +560,22 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -557,15 +560,22 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
// 设置音频热区 // 设置音频热区
// 全局只能有一个音频播放 - 保存音乐id 用于停止
currentAudioPlay = null;
setOneAudioBtn(contentData, hotZoneItemData) { setOneAudioBtn(contentData, hotZoneItemData) {
const {sprNode} = this.newSprNodeByResName(hotZoneItemData, "icon_play_audio"); const {sprNode} = this.newSprNodeByResName(hotZoneItemData, "icon_play_audio");
sprNode.on("click", () => { sprNode.on("click", () => {
if(this.submitted) { if(this.submitted) {
return; return;
} }
playAudioByUrl(contentData.audio_url, () => { let audioClip = asyncLoadRemote(contentData.audio_url);
// 需要判断音频是否存在
}) if(audioClip) {
this.currentAudioPlay = cc.audioEngine.play(audioClip, false, 0.8);
cc.audioEngine.setFinishCallback(this.currentAudioPlay, () => {
this.currentAudioPlay = null;
});
}
}) })
}; };
...@@ -641,8 +651,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -641,8 +651,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
sprNode.height = picNode.height; sprNode.height = picNode.height;
} }
// 在素材节点上添加按钮
sprNode.addComponent(cc.Button); sprNode.addComponent(cc.Button);
picNode.addComponent(cc.Button);
return {sprNode, picNode}; return {sprNode, picNode};
} }
...@@ -680,18 +690,19 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -680,18 +690,19 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
// 颜色色块 // 颜色色块
newMaskRectNode(data) { newMaskRectNode(data, maskColor = "#FFFF0066") {
const highlightColor = "#FFFF0066";
const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width; const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width;
const rectNode = new cc.Node(); const rectNode = new cc.Node();
rectNode.name = '_mask_color_'; rectNode.name = '_mask_color_';
// 调整颜色图层 - 置于最下层
rectNode.zIndex = -1;
this.hotZoneBg.addChild(rectNode); this.hotZoneBg.addChild(rectNode);
// 红色矩形 // 红色矩形
const ctx = rectNode.addComponent(cc.Graphics); const ctx = rectNode.addComponent(cc.Graphics);
ctx.lineWidth = 4; ctx.lineWidth = 4;
const color = new cc.Color(); const color = new cc.Color();
cc.Color.fromHEX(color, highlightColor); cc.Color.fromHEX(color, maskColor);
ctx.fillColor = color; ctx.fillColor = color;
// 设置位置 大小 基准坐标 // 设置位置 大小 基准坐标
...@@ -727,9 +738,13 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -727,9 +738,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
results.forEach(result => { results.forEach(result => {
const errIcon = getSprNode("icon_answer_wrong"); const errIcon = getSprNode("icon_answer_wrong");
const rightIcon = getSprNode("icon_answer_right"); const rightIcon = getSprNode("icon_answer_right");
// 图标太大 缩小一半
errIcon.scale = rightIcon.scale = 0.5;
// 显示在热区的右下角
errIcon.x = rightIcon.x = result.rect.width;
if(result.score >= 0) { if(result.score >= 0) {
// 回答正确 // 回答正确
result.rect.addChild(rightIcon) result.rect.addChild(rightIcon);
// 找到对应的组 计算该组得分 // 找到对应的组 计算该组得分
scoreCconfigArr.forEach(item=>{ scoreCconfigArr.forEach(item=>{
if(item.linkHotZoneIndexArr.indexOf(result.configIndex) != -1) { if(item.linkHotZoneIndexArr.indexOf(result.configIndex) != -1) {
...@@ -742,14 +757,20 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -742,14 +757,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
}); });
} }
}) })
console.log("答案校验完毕", scoreCconfigArr)
console.log(scoreCconfigArr);
let totalScore = 0; let totalScore = 0;
scoreCconfigArr.forEach((score, index) => { scoreCconfigArr.forEach((score, index) => {
// 累加各个分数区域
totalScore += score.score; totalScore += score.score;
this.subScorePanels[index].setScore(score.score); // 如果配置了分数显示区域 - 显示分数
if(this.subScorePanels[index]) {
this.subScorePanels[index].setScore(score.score);
}
}) })
this.totalScorePanel.setScore(totalScore); // 如果配置了分数显示区域 - 显示分数
if(this.totalScorePanel) {
this.totalScorePanel.setScore(totalScore);
}
// 标记已经提交 禁止页面事件 // 标记已经提交 禁止页面事件
this.submitted = true; this.submitted = true;
...@@ -778,6 +799,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -778,6 +799,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.subScorePanels = []; this.subScorePanels = [];
this.totalScorePanel = null; this.totalScorePanel = null;
// 停止当前正在播放的音乐
if(this.currentAudioPlay) {
cc.audioEngine.stop(this.currentAudioPlay);
}
this.currentAudioPlay = null;
this.hotZoneBg.children.forEach(child=>{ this.hotZoneBg.children.forEach(child=>{
child.destroy(); child.destroy();
}) })
...@@ -811,5 +838,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -811,5 +838,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
}) })
} }
onDestroy() {
cc.audioEngine.stop(this.currentAudioPlay);
}
// update (dt) {}, // update (dt) {},
} }
...@@ -135,4 +135,4 @@ ...@@ -135,4 +135,4 @@
// "typeArr": [] // "typeArr": []
// } // }
export const defaultData = {"hotZoneConfigArr":[{"linkHotZoneIndex":0,"contentList":[{"index":0,"text":"item-1"}],"hotZoneType":"2","audio_url":"http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3","score":"1"},{"linkHotZoneIndex":1,"contentList":[{"index":0,"text":"1","isCorrect":true},{"text":"2","image_url":"","hotZoneIndex":null,"score":0},{"text":"3","image_url":"","hotZoneIndex":null,"score":0}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":2,"contentList":[{"index":0,"text":"item-1","selectHotZoneIndex":2,"isCorrect":true},{"text":"","image_url":"","hotZoneIndex":null,"score":0,"selectHotZoneIndex":3}],"hotZoneType":"3","score":"2"},{"linkHotZoneIndex":4,"contentList":[{"index":0,"text":"item-1"}],"hotZoneType":"5","inputText":"Hello World"},{"linkHotZoneIndex":9,"contentList":[{"index":0,"text":"1"},{"text":"2","image_url":"","hotZoneIndex":null,"score":0},{"text":"3","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":10,"contentList":[{"index":0,"text":"1"},{"text":"2","image_url":"","hotZoneIndex":null,"score":0},{"text":"3","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":1,"contentList":[{"index":0,"text":"item-1","selectHotZoneIndex":11,"isCorrect":true,"isCheck":true,"score":"4"},{"text":"","image_url":"","hotZoneIndex":null,"score":"3","selectHotZoneIndex":12,"isCorrect":true,"isCheck":true},{"text":"","image_url":"","hotZoneIndex":null,"score":"2","selectHotZoneIndex":13,"isCorrect":true,"isCheck":false}],"hotZoneType":"4"}],"scoreConfigArr":[{"linkHotZoneIndex":7,"linkHotZoneIndexArr":[4,5,1]},{"linkHotZoneIndex":8,"linkHotZoneIndexArr":[2]},{"linkHotZoneIndex":14,"linkHotZoneIndexArr":[6]}],"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/5c84b987ea2291c8d6013fffd39dda32.png","rect":{"x":129.32340862422996,"y":0,"width":892.3531827515401,"height":1256}},"hotZoneItemArr":[{"index":0,"itemType":"rect","itemName":"1-音频","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":331.14,"y":162.94,"width":33.94,"height":33.94}},{"index":1,"itemType":"rect","itemName":"1-1选项","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":170.83,"y":336.06,"width":30.18,"height":30.18}},{"index":2,"itemType":"rect","itemName":"2-1Alex","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":124.06,"y":432.25,"width":46.77,"height":27.92}},{"index":3,"itemType":"rect","itemName":"2-1Anna","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":176.87,"y":432.99,"width":58.83,"height":26.4}},{"index":4,"itemType":"rect","itemName":"3-1输入文本","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":372.26,"y":791.31,"width":150.86,"height":29.42}},{"index":5,"itemType":"rect","itemName":"提交按钮","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":504.04,"y":1139.17,"width":113.14,"height":33.94}},{"index":6,"itemType":"rect","itemName":"重做按钮","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":261.79,"y":1141.25,"width":99.57,"height":30.92}},{"index":7,"itemType":"rect","itemName":"1得分","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":784.89,"y":163.69,"width":55.81,"height":30.92}},{"index":8,"itemType":"rect","itemName":"2得分","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":784.89,"y":392.27,"width":57.33,"height":29.42}},{"index":9,"itemType":"rect","itemName":"1-2选项","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":300.05,"y":336.53,"width":28.14,"height":28.14}},{"index":10,"itemType":"rect","itemName":"1-3选项","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":425.19,"y":334.97,"width":32.78,"height":32.78}},{"index":11,"itemType":"rect","itemName":"1-4","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":552.6,"y":334.98,"width":31.48,"height":31.48}},{"index":12,"itemType":"rect","itemName":"1-5","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":680,"y":334.23,"width":32.97,"height":32.97}},{"index":13,"itemType":"rect","itemName":"1-6","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":807.39,"y":334.98,"width":31.48,"height":31.48}},{"index":14,"itemType":"rect","itemName":"得分","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":790.15,"y":730.67,"width":40.47,"height":40.47}},{"index":15,"itemType":"rect","itemName":"总分","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.89921875,"imgScale":1,"mapScale":0.89921875,"rect":{"x":731.68,"y":1129,"width":111,"height":54}}],"submitHotZoneIndex":5,"replayHotZoneIndex":6,"isDebug":false,"header_image_url":"http://staging-teach.cdn.ireadabc.com/a4427e34c15b3360ff0554071d676455.png","footer_image_url":"http://staging-teach.cdn.ireadabc.com/bac2bf6c1a9acb0abdeddde3289442e6.png","totalScoreHotZoneIndex":15} export const defaultData = {"header_image_url":"http://staging-teach.cdn.ireadabc.com/a4427e34c15b3360ff0554071d676455.png","footer_image_url":"http://staging-teach.cdn.ireadabc.com/bac2bf6c1a9acb0abdeddde3289442e6.png","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/2eb612acb0f6e1e45ceb5b1f2df19c16.png","rect":{"x":83.34504132231405,"y":0,"width":1184.309917355372,"height":1466}},"hotZoneItemArr":[{"index":0,"itemType":"rect","itemName":"1-音频","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":441.65,"y":72.5,"width":49,"height":49}},{"index":1,"itemType":"rect","itemName":"1-选项1","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":230.15,"y":309,"width":38,"height":38}},{"index":2,"itemType":"rect","itemName":"1-选项2","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":400.15,"y":309,"width":38,"height":38}},{"index":3,"itemType":"rect","itemName":"1-选项3","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":569.15,"y":307,"width":40,"height":40}},{"index":4,"itemType":"rect","itemName":"1-选项4","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":736.65,"y":307.5,"width":43,"height":43}},{"index":5,"itemType":"rect","itemName":"1-选项5","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":906.65,"y":306.5,"width":41,"height":41}},{"index":6,"itemType":"rect","itemName":"1-选项6","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":1078.15,"y":308,"width":38,"height":38}},{"index":7,"itemType":"rect","itemName":"2-音频","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":640.15,"y":382,"width":38,"height":38}},{"index":8,"itemType":"rect","itemName":"2-1-Alex","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":166.65,"y":434,"width":61,"height":40}},{"index":9,"itemType":"rect","itemName":"2-1-Anna","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":236.65,"y":436,"width":81,"height":36}},{"index":10,"itemType":"rect","itemName":"2-2-Hello","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":131.65,"y":486,"width":73,"height":40}},{"index":11,"itemType":"rect","itemName":"2-2-Hi","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":212.65,"y":485.5,"width":39,"height":39}},{"index":12,"itemType":"rect","itemName":"2-3-Please","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":233.65,"y":535,"width":87,"height":40}},{"index":13,"itemType":"rect","itemName":"2-3-Thank you","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":335.65,"y":537,"width":119,"height":42}},{"index":14,"itemType":"rect","itemName":"2-4-teacher","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":284.65,"y":594,"width":101,"height":32}},{"index":15,"itemType":"rect","itemName":"2-4-brother","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":397.65,"y":591,"width":97,"height":40}},{"index":16,"itemType":"rect","itemName":"2-5-He","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":131.15,"y":638,"width":44,"height":44}},{"index":17,"itemType":"rect","itemName":"2-5-She","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":190.15,"y":639,"width":46,"height":46}},{"index":18,"itemType":"rect","itemName":"2-6-store","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":308.65,"y":692,"width":71,"height":42}},{"index":19,"itemType":"rect","itemName":"class","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":393.65,"y":692,"width":65,"height":46}},{"index":20,"itemType":"rect","itemName":"3-how are you?","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":555.65,"y":1048,"width":231,"height":50}},{"index":21,"itemType":"rect","itemName":"3-fine, thank you.","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":495.65,"y":918,"width":213,"height":40}},{"index":22,"itemType":"rect","itemName":"分数1","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":1041.65,"y":81,"width":83,"height":34}},{"index":23,"itemType":"rect","itemName":"分数2","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":1047.65,"y":380,"width":75,"height":46}},{"index":24,"itemType":"rect","itemName":"分数3","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":1043.65,"y":845,"width":81,"height":36}},{"index":25,"itemType":"rect","itemName":"总分","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":970.65,"y":1369,"width":153,"height":58}},{"index":26,"itemType":"rect","itemName":"提交按钮","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":448.15,"y":1362,"width":200,"height":76}},{"index":27,"itemType":"rect","itemName":"重新开始按钮","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":1.05546875,"imgScale":1,"mapScale":1.05546875,"rect":{"x":713.15,"y":1365,"width":200,"height":70}}],"hotZoneConfigArr":[{"linkHotZoneIndex":1,"contentList":[{"text":"1","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"2","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"3","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"4","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"5","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"6","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true,"isCheck":false}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":2,"contentList":[{"text":"1","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"2","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"3","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"4","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"5","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true,"isCheck":false},{"text":"6","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":3,"contentList":[{"text":"1","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"2","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"3","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true,"isCheck":false},{"text":"4","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"5","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"6","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":4,"contentList":[{"text":"1","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"2","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true,"isCheck":false},{"text":"3","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"4","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"5","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"6","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":5,"contentList":[{"text":"1","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"2","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"3","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"4","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true,"isCheck":false},{"text":"5","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"6","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":6,"contentList":[{"text":"1","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true,"isCheck":false},{"text":"2","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"3","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"4","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"5","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false},{"text":"6","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false}],"hotZoneType":"0","score":"1"},{"linkHotZoneIndex":0,"contentList":[],"hotZoneType":"2","audio_url":"http://staging-teach.cdn.ireadabc.com/908ae03284c2e6113191d03cf27c9bc0.mp3"},{"linkHotZoneIndex":7,"contentList":[],"hotZoneType":"2","audio_url":"http://staging-teach.cdn.ireadabc.com/1c7c36844a070048875016e09538f7a0.mp3"},{"linkHotZoneIndex":-1,"contentList":[{"text":"","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true,"isCheck":false,"selectHotZoneIndex":8},{"text":"","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false,"selectHotZoneIndex":9}],"hotZoneType":"3","score":"1"},{"linkHotZoneIndex":-1,"contentList":[{"text":"","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true,"isCheck":false,"selectHotZoneIndex":10},{"text":"","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false,"selectHotZoneIndex":11}],"hotZoneType":"3","score":"1"},{"linkHotZoneIndex":-1,"contentList":[{"text":"","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false,"selectHotZoneIndex":12},{"text":"","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true,"isCheck":false,"selectHotZoneIndex":13}],"hotZoneType":"3","score":"1"},{"linkHotZoneIndex":-1,"contentList":[{"text":"","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true,"isCheck":false,"selectHotZoneIndex":14},{"text":"","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false,"selectHotZoneIndex":15}],"hotZoneType":"3","score":"1"},{"linkHotZoneIndex":-1,"contentList":[{"text":"","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false,"selectHotZoneIndex":16},{"text":"","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true,"isCheck":false,"selectHotZoneIndex":17}],"hotZoneType":"3","score":"1"},{"linkHotZoneIndex":-1,"contentList":[{"text":"","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":false,"isCheck":false,"selectHotZoneIndex":18},{"text":"","image_url":"","hotZoneIndex":null,"score":0,"isCorrect":true,"isCheck":false,"selectHotZoneIndex":19}],"hotZoneType":"3","score":"1"},{"linkHotZoneIndex":20,"contentList":[],"hotZoneType":"5","inputText":"how are you?","score":"1"},{"linkHotZoneIndex":21,"contentList":[],"hotZoneType":"5","inputText":"fine, thank you.","score":"1"}],"totalScoreHotZoneIndex":25,"submitHotZoneIndex":26,"replayHotZoneIndex":27,"scoreConfigArr":[{"linkHotZoneIndex":22,"linkHotZoneIndexArr":[0,1,2,3,4,5]},{"linkHotZoneIndex":23,"linkHotZoneIndexArr":[8,9,10,11,12,13]},{"linkHotZoneIndex":24,"linkHotZoneIndexArr":[14,15]}]}
\ No newline at end of file \ No newline at end of file
...@@ -113,6 +113,18 @@ export function playAudioByUrl(audio_url, cb=null) { ...@@ -113,6 +113,18 @@ export function playAudioByUrl(audio_url, cb=null) {
} }
} }
export function asyncLoadRemote(asstes_url) {
return new Promise((resovle, reject) => {
cc.assetManager.loadRemote(asstes_url, (err, content) => {
if(err) {
resovle(err)
} else {
resovle(content)
}
});
})
}
export function loadImageByUrl(image_url, cb=null) { export function loadImageByUrl(image_url, cb=null) {
if (image_url) { if (image_url) {
cc.assetManager.loadRemote(image_url, (err, texture) => { cc.assetManager.loadRemote(image_url, (err, texture) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment