Commit f14ee978 authored by 范雪寒's avatar 范雪寒

feat:

parent d1db06fd
...@@ -128,5 +128,8 @@ ...@@ -128,5 +128,8 @@
} }
} }
}, },
"defaultProject": "ng-template-generator" "defaultProject": "ng-template-generator",
"cli": {
"analytics": false
}
} }
\ No newline at end of file
This diff is collapsed.
{
"name": "publish",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"bl": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz",
"integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==",
"requires": {
"readable-stream": "^2.3.5",
"safe-buffer": "^5.1.1"
}
},
"buffer-alloc": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz",
"integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==",
"requires": {
"buffer-alloc-unsafe": "^1.1.0",
"buffer-fill": "^1.0.0"
}
},
"buffer-alloc-unsafe": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz",
"integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg=="
},
"buffer-crc32": {
"version": "0.2.13",
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
"integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI="
},
"buffer-fill": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
"integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw="
},
"compressing": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/compressing/-/compressing-1.5.1.tgz",
"integrity": "sha512-1AGBR4Vh0/rpPKSXHoV9cerLo0CUlAhZ/xsJqU3a9+2cbSaFjWT3fk2MIGkCnbpk//DGWrcWw03rhKFQrA9RQw==",
"requires": {
"flushwritable": "^1.0.0",
"get-ready": "^1.0.0",
"iconv-lite": "^0.5.0",
"mkdirp": "^0.5.1",
"pump": "^3.0.0",
"streamifier": "^0.1.1",
"tar-stream": "^1.5.2",
"yauzl": "^2.7.0",
"yazl": "^2.4.2"
}
},
"core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
},
"end-of-stream": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
"requires": {
"once": "^1.4.0"
}
},
"fd-slicer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
"integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",
"requires": {
"pend": "~1.2.0"
}
},
"flushwritable": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/flushwritable/-/flushwritable-1.0.0.tgz",
"integrity": "sha1-PjKNj95BKtR+c44751C00pAENJg="
},
"fs-constants": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
},
"get-ready": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/get-ready/-/get-ready-1.0.0.tgz",
"integrity": "sha1-+RgX8emt7P6hOlYq38jeiDqzR4I="
},
"iconv-lite": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.2.tgz",
"integrity": "sha512-kERHXvpSaB4aU3eANwidg79K8FlrN77m8G9V+0vOR3HYaRifrlwMEpT7ZBJqLSEIHnEgJTHcWK82wwLwwKwtag==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
},
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": {
"minimist": "^1.2.5"
}
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"requires": {
"wrappy": "1"
}
},
"pend": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA="
},
"process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
},
"pump": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
"requires": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
}
},
"readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
},
"dependencies": {
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
}
}
},
"safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"streamifier": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/streamifier/-/streamifier-0.1.1.tgz",
"integrity": "sha1-l+mNj6TRBdYqJpHR3AfoINuN/E8="
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
},
"dependencies": {
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
}
}
},
"tar-stream": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz",
"integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==",
"requires": {
"bl": "^1.0.0",
"buffer-alloc": "^1.2.0",
"end-of-stream": "^1.0.0",
"fs-constants": "^1.0.0",
"readable-stream": "^2.3.0",
"to-buffer": "^1.1.1",
"xtend": "^4.0.0"
}
},
"to-buffer": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz",
"integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg=="
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
},
"xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
},
"yauzl": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
"integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=",
"requires": {
"buffer-crc32": "~0.2.3",
"fd-slicer": "~1.1.0"
}
},
"yazl": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz",
"integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==",
"requires": {
"buffer-crc32": "~0.2.3"
}
}
}
}
This diff is collapsed.
...@@ -60,7 +60,7 @@ cc.Class({ ...@@ -60,7 +60,7 @@ cc.Class({
} }
getData((data) => { getData((data) => {
console.log('data:', data); console.log('data:' + JSON.stringify(data));
this.data = data || this.getDefaultData(); this.data = data || this.getDefaultData();
this.data = JSON.parse(JSON.stringify(this.data)); this.data = JSON.parse(JSON.stringify(this.data));
this.preloadItem(); this.preloadItem();
...@@ -96,14 +96,22 @@ cc.Class({ ...@@ -96,14 +96,22 @@ cc.Class({
addPreloadImage() { addPreloadImage() {
this._imageResList.push(...this.data.question_arr.map(question => {
this._imageResList.push({ url: this.data.pic_url }); return question.option_arr.map(option => {
this._imageResList.push({ url: this.data.pic_url_2 }); return { url: option.pic_url }
});
}).flat());
}, },
addPreloadAudio() { addPreloadAudio() {
this._audioResList.push(...this.data.question_arr.map(question => {
this._audioResList.push({ url: this.data.audio_url }); return question.option_arr.map(option => {
return { url: option.audio_url };
});
}).flat());
this._audioResList.push(...this.data.question_arr.map(question => {
return { url: question.question_audio_url };
}));
}, },
addPreloadAnima() { addPreloadAnima() {
...@@ -112,7 +120,12 @@ cc.Class({ ...@@ -112,7 +120,12 @@ cc.Class({
preload() { preload() {
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList); const preloadArr = [
...this._imageResList,
...this._audioResList,
...this._animaResList
];
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => { cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
this.loadEnd(); this.loadEnd();
...@@ -124,183 +137,119 @@ cc.Class({ ...@@ -124,183 +137,119 @@ cc.Class({
}); });
}, },
loadEnd() { loadEnd() {
this.initData(); this.initData();
this.initAudio();
this.initView(); this.initView();
// this.initListener(); this.initListener();
}, },
_cantouch: null,
initData() { initData() {
// 所有全局变量 默认都是null this.status = {
this._cantouch = true; currentQuestionIdx: 0
},
audioBtn: null,
initAudio() {
const audioNode = cc.find('Canvas/res/audio');
const getAudioByResName = (resName) => {
return audioNode.getChildByName(resName).getComponent(cc.AudioSource);
} }
this.audioBtn = getAudioByResName('btn');
}, },
initView() { initView() {
this.jumpToQuestion(this.status.currentQuestionIdx);
this.initBg();
this.initPic();
this.initBtn();
this.initIcon();
}, },
initBg() { jumpToQuestion(questionIdx) {
const bgNode = cc.find('Canvas/bg'); const box = cc.find('Canvas/bg/box');
bgNode.scale = this._mapScaleMax; box.removeAllChildren();
},
const canvasWidth = cc.find('Canvas').width;
pic1: null, const canvasHeight = cc.find('Canvas').height;
pic2: null, const optionNum = this.data.question_arr[questionIdx].option_arr.length;
initPic() { const maxOptionHeight = 500;
const canvas = cc.find('Canvas'); const maxOptionWidth = canvasWidth / optionNum;
const maxW = canvas.width * 0.7; this.data.question_arr[questionIdx].option_arr.forEach(async (option, idx) => {
const optionNode = await this.createOption(option);
this.getSprNodeByUrl(this.data.pic_url, (sprNode) => { optionNode.name = `option_${idx}`;
const picNode1 = sprNode; optionNode.x = (maxOptionWidth) * (idx + 0.5) - canvasWidth / 2 - box.x;
picNode1.scale = maxW / picNode1.width; optionNode.y = canvasHeight / 2 - box.y - 300;
picNode1.baseX = picNode1.x; optionNode.scale = Math.min(1, (maxOptionWidth - 10) / optionNode.width, maxOptionHeight / optionNode.height);
canvas.addChild(picNode1); optionNode.parent = box;
this.pic1 = picNode1;
const labelNode = new cc.Node();
labelNode.color = cc.Color.YELLOW;
const label = labelNode.addComponent(cc.Label);
label.string = this.data.text;
label.fontSize = 60;
label.lineHeight = 60;
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent('cc.Label').font;
picNode1.addChild(labelNode);
});
this.getSprNodeByUrl(this.data.pic_url_2, (sprNode) => {
const picNode2 = sprNode;
picNode2.scale = maxW / picNode2.width;
canvas.addChild(picNode2);
picNode2.x = canvas.width;
picNode2.baseX = picNode2.x;
this.pic2 = picNode2;
const labelNode = new cc.Node();
const label = labelNode.addComponent(cc.RichText);
const size = 60
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent(cc.Label).font;
label.string = `<outline color=#751e00 width=4><size=${size}><color=#ffffff>${this.data.text}</color></size></outline>`
label.lineHeight = size;
picNode2.addChild(labelNode);
}); });
}, },
initIcon() { createOption(optionData) {
const iconNode = this.getSprNode('icon'); return new Promise((resolve, reject) => {
iconNode.zIndex = 5; const optionNode = cc.instantiate(cc.find('option'));
iconNode.anchorX = 1; this.loadSpriteByUrl(optionNode, optionData.pic_url, () => {
iconNode.anchorY = 1; resolve(optionNode);
iconNode.parent = cc.find('Canvas'); });
iconNode.x = iconNode.parent.width / 2 - 10; optionNode.optionData = optionData;
iconNode.y = iconNode.parent.height / 2 - 10;
optionNode.on(cc.Node.EventType.TOUCH_START, (event) => {
iconNode.on(cc.Node.EventType.TOUCH_START, () => { const location = event.getLocation();
this.playAudioByUrl(this.data.audio_url); optionNode.startLocation = location;
}) optionNode.startPos = {
}, x: optionNode.x,
y: optionNode.y
curPage: null,
initBtn() {
this.curPage = 0;
const bottomPart = cc.find('Canvas/bottomPart');
bottomPart.zIndex = 5; // 提高层级
bottomPart.x = bottomPart.parent.width / 2;
bottomPart.y = -bottomPart.parent.height / 2;
const leftBtnNode = bottomPart.getChildByName('btn_left');
//节点中添加了button组件 则可以添加click事件监听
leftBtnNode.on('click', () => {
if (!this._cantouch) {
return;
} }
if (this.curPage == 0) { this.optionJump(optionNode);
});
optionNode.on(cc.Node.EventType.TOUCH_MOVE, (event) => {
const location = event.getLocation();
optionNode.x = optionNode.startPos.x + (location.x - optionNode.startLocation.x);
optionNode.y = optionNode.startPos.y + (location.y - optionNode.startLocation.y);
});
optionNode.on(cc.Node.EventType.TOUCH_END, (event) => {
const box = cc.find('Canvas/bg/box');
const rectOption = optionNode.getBoundingBox();
if (!cc.Intersection.rectRect(box, rectOption)) {
optionNode.x = optionNode.startPos.x;
optionNode.y = optionNode.startPos.y;
return; return;
} }
this.curPage = 0
this.leftMove();
// 游戏结束时需要调用这个方法通知系统作业完成
onHomeworkFinish();
cc.audioEngine.play(this.audioBtn.clip, false, 0.8) cc.tween(optionNode)
}) .to(0.2, { x: 0, y: 0 }, cc.easing.quadOut)
.start();
const rightBtnNode = bottomPart.getChildByName('btn_right');
//节点中添加了button组件 则可以添加click事件监听
rightBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 1) {
return;
}
this.curPage = 1 optionNode.optionData.selected = true;
this.rightMove(); });
cc.audioEngine.play(this.audioBtn.clip, false, 0.5) return optionNode;
}) });
// optionData.audio_url
// optionData.is_right
}, },
leftMove() { optionJump(node) {
this._cantouch = false; if (node.baseScale) {
const len = this.pic1.parent.width; return;
cc.tween(this.pic1) }
.to(1, { x: this.pic1.baseX }, { easing: 'cubicInOut' }) node.baseScale = node.scaleX;
.start();
cc.tween(this.pic2) cc.tween(node)
.to(1, { x: this.pic2.baseX }, { easing: 'cubicInOut' }) .to(0.1, { scaleX: node.baseScale * 1.1, scaleY: node.baseScale * 1.1 })
.to(0.1, { scaleX: node.baseScale * 1, scaleY: node.baseScale * 1 })
.call(() => { .call(() => {
this._cantouch = true; node.baseScale = null;
}) })
.start(); .start();
}, },
rightMove() { initListener() {
this._cantouch = false; const btnSubmit = cc.find('Canvas/bg/btnSubmit');
const len = this.pic1.parent.width; btnSubmit.on('click', () => {
cc.tween(this.pic1) const box = cc.find('Canvas/bg/box');
.to(1, { x: this.pic1.baseX - len }, { easing: 'cubicInOut' }) if (box.children.every(child => child.optionData.selected == child.optionData.is_right)) {
.start(); this.onAnswerRight();
} else {
cc.tween(this.pic2) this.onAnswerWrong();
.to(1, { x: this.pic2.baseX - len }, { easing: 'cubicInOut' }) }
.call(() => { });
this._cantouch = true;
})
.start();
}, },
// update (dt) {},
onAnswerRight() {
},
onAnswerWrong() {
},
...@@ -320,47 +269,29 @@ cc.Class({ ...@@ -320,47 +269,29 @@ cc.Class({
// ------------------------------------------------ // ------------------------------------------------
getSprNode(resName) { loadSpriteByUrl(node, url, cb) {
const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame;
const node = new cc.Node();
node.addComponent(cc.Sprite).spriteFrame = sf;
return node;
},
getSpriteFrimeByUrl(url, cb) {
cc.loader.load({ url }, (err, img) => { cc.loader.load({ url }, (err, img) => {
const spriteFrame = new cc.SpriteFrame(img) const spriteFrame = new cc.SpriteFrame(img)
const spr = node.getComponent(cc.Sprite);
spr.spriteFrame = spriteFrame;
if (cb) { if (cb) {
cb(spriteFrame); cb();
} }
}) });
}, },
getSprNodeByUrl(url, cb) { playAudioByUrl(audio_url, cb = null) {
const node = new cc.Node(); if (!audio_url) {
const spr = node.addComponent(cc.Sprite);
this.getSpriteFrimeByUrl(url, (sf) => {
spr.spriteFrame = sf;
if (cb) { if (cb) {
cb(node); cb();
} }
}) return;
}, }
cc.assetManager.loadRemote(audio_url.toLowerCase(), (err, audioClip) => {
playAudioByUrl(audio_url, cb = null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8); const audioId = cc.audioEngine.play(audioClip, false, 0.8);
if (cb) { if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => { cc.audioEngine.setFinishCallback(audioId, cb);
cb();
});
} }
}); });
}
}, },
// ------------------------------------------
}); });
export const defaultData = [{ export const defaultData = {
question_arr: [{
question_audio_url: '', question_audio_url: '',
option_arr: [{ // 选项(多选) option_arr: [{ //选项 (多选)
pic_url: '', // 图片路径 pic_url: 'http://staging-teach.cdn.ireadabc.com/994b3fce7a503cdb428fa0f735851d98.jpeg', // 图片路径
audio_url: '', // 音频路径 audio_url: '', //音频路径
is_right: true, // 是否正确 is_right: true, //是否正确
}, { }, {
pic_url: '', pic_url: 'http://staging-teach.cdn.ireadabc.com/213871779bc2404f84bfa94672dd0e74.jpg', // 图片路径
audio_url: '',
is_right: false,
}, {
pic_url: 'http://staging-teach.cdn.ireadabc.com/213871779bc2404f84bfa94672dd0e74.jpg', // 图片路径
audio_url: '',
is_right: false,
}, {
pic_url: 'http://staging-teach.cdn.ireadabc.com/994b3fce7a503cdb428fa0f735851d98.jpeg', // 图片路径
audio_url: '',
is_right: false,
}, {
pic_url: 'http://staging-teach.cdn.ireadabc.com/994b3fce7a503cdb428fa0f735851d98.jpeg', // 图片路径
audio_url: '', audio_url: '',
is_right: false, is_right: false,
}] }]
}, { }, {
question_audio_url: '', question_audio_url: '',
option_arr: [{ // 选项(多选) option_arr: [{ //选项 (多选)
pic_url: '', // 图片路径 pic_url: '', // 图片路径
audio_url: '', // 音频路径 audio_url: '', //音频路径
is_right: true, // 是否正确 is_right: true, //是否正确
}, { }, {
pic_url: '', pic_url: '',
audio_url: '', audio_url: '',
is_right: false, is_right: false,
}] }]
}]; }]
\ No newline at end of file }
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "6c8e488b-9cdf-4d20-89c5-4d432d8a2e23",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2176,
"height": 1074,
"platformSettings": {},
"subMetas": {
"bg_bg": {
"ver": "1.0.4",
"uuid": "95074812-ffd9-4326-9008-60a88279bd2e",
"rawTextureUuid": "6c8e488b-9cdf-4d20-89c5-4d432d8a2e23",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 2176,
"height": 1074,
"rawWidth": 2176,
"rawHeight": 1074,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "e5d8b6de-dae4-4605-9f8f-8584b745b7f2",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1244,
"height": 792,
"platformSettings": {},
"subMetas": {
"bg_box-behind": {
"ver": "1.0.4",
"uuid": "83ae63f9-5160-4995-af20-110757bb4d21",
"rawTextureUuid": "e5d8b6de-dae4-4605-9f8f-8584b745b7f2",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 1,
"offsetY": 189.5,
"trimX": 2,
"trimY": 0,
"width": 1242,
"height": 413,
"rawWidth": 1244,
"rawHeight": 792,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "18d07592-51a9-421e-8972-0f67b68d29e1", "uuid": "66f6b898-e326-4bab-89e3-78997d049e47",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 144, "width": 1244,
"height": 144, "height": 792,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"icon": { "bg_box-front": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a", "uuid": "2b44a5d3-fe98-49c2-9099-8400d48c17c9",
"rawTextureUuid": "18d07592-51a9-421e-8972-0f67b68d29e1", "rawTextureUuid": "66f6b898-e326-4bab-89e3-78997d049e47",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": 0, "offsetX": 0,
"offsetY": -0.5, "offsetY": -49,
"trimX": 3, "trimX": 0,
"trimY": 2, "trimY": 98,
"width": 138, "width": 1244,
"height": 141, "height": 694,
"rawWidth": 144, "rawWidth": 1244,
"rawHeight": 144, "rawHeight": 792,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
This diff is collapsed.
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "e1b4d971-9876-4832-803a-5a321964a78b", "uuid": "e5a3f41e-df6e-4314-9db7-0771939bb4d6",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 1280, "width": 2176,
"height": 720, "height": 798,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg": { "bg_deck": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "8288e3d4-4c75-4b27-8f01-f7014417f4dd", "uuid": "3d584bab-9dfe-4922-8dc7-821b4f063796",
"rawTextureUuid": "e1b4d971-9876-4832-803a-5a321964a78b", "rawTextureUuid": "e5a3f41e-df6e-4314-9db7-0771939bb4d6",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 1280, "width": 2176,
"height": 720, "height": 798,
"rawWidth": 1280, "rawWidth": 2176,
"rawHeight": 720, "rawHeight": 798,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "9a79969a-0506-48d4-bc98-3c05d109b027", "uuid": "e6d712f3-3bc6-4a7b-a140-9016e0628f67",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 61, "width": 209,
"height": 67, "height": 146,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_left": { "btn_next": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5", "uuid": "e666ed9c-0ebf-4802-8d58-7473ddde1634",
"rawTextureUuid": "9a79969a-0506-48d4-bc98-3c05d109b027", "rawTextureUuid": "e6d712f3-3bc6-4a7b-a140-9016e0628f67",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 61, "width": 209,
"height": 67, "height": 146,
"rawWidth": 61, "rawWidth": 209,
"rawHeight": 67, "rawHeight": 146,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "uuid": "552ce11c-0f7d-4146-8c78-23fc7cd917cb",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 366, "width": 171,
"height": 336, "height": 146,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"1orange": { "btn_return": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "43d1e79d-6de8-4dcb-b8ce-d767df7913aa", "uuid": "70f3d2ee-ca1d-49fd-84dd-3cdc8164fba0",
"rawTextureUuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "rawTextureUuid": "552ce11c-0f7d-4146-8c78-23fc7cd917cb",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": 0, "offsetX": 0,
"offsetY": -0.5, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 1, "trimY": 0,
"width": 366, "width": 171,
"height": 335, "height": 146,
"rawWidth": 366, "rawWidth": 171,
"rawHeight": 336, "rawHeight": 146,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "uuid": "52a666fa-b2b9-41a0-8254-1ff8ef313a43",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 61, "width": 244,
"height": 67, "height": 232,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_right": { "btn_submit": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59", "uuid": "b9d7ec09-fa5f-4f90-be2c-e8d035b0f74d",
"rawTextureUuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "rawTextureUuid": "52a666fa-b2b9-41a0-8254-1ff8ef313a43",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": -0.5, "offsetX": 0,
"offsetY": 0.5, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 60, "width": 244,
"height": 66, "height": 232,
"rawWidth": 61, "rawWidth": 244,
"rawHeight": 67, "rawHeight": 232,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
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