Commit 645e48be authored by yu's avatar yu

1

parent 60385c60
...@@ -295,8 +295,8 @@ cc.Class({ ...@@ -295,8 +295,8 @@ cc.Class({
//更换书的样子 //更换书的样子
pg.view.visible(btn_next, true);//显示的内容用true pg.view.visible(btn_next, true);//显示的内容用true
pg.view.visible(btn_return, true); pg.view.visible(btn_return, true);
let bg_book_img = this._stageData.img;//从数组中调取img数据 // let bg_book_img = this._stageData.img;//从数组中调取img数据
pg.view.setNetImg(bg_book, bg_book_img);//与界面的节点绑定 // pg.view.setNetImg(bg_book, bg_book_img);//与界面的节点绑定
//拓展加载动画的内容 //拓展加载动画的内容
this.animationName = ""; this.animationName = "";
this._tryagainCount = 0; this._tryagainCount = 0;
...@@ -575,20 +575,20 @@ cc.Class({ ...@@ -575,20 +575,20 @@ cc.Class({
// resolve(''); // resolve('');
// } // }
// }) // })
pg.audio.playAudioByUrlCall(this._stageData.sound).then((id) => { // pg.audio.playAudioByUrlCall(this._stageData.sound).then((id) => {
audioFinished = true; audioFinished = true;
let time = cc.audioEngine.getDuration(id); // let time = cc.audioEngine.getDuration(id);
this.showCardAction(time + 1).then(() => { this.showCardAction(1).then(() => {
this.showSliderAction(1).then(() => { this.showSliderAction(1).then(() => {
pg.audio.playAudioByUrlCall(this._stageData.sound, () => { pg.audio.playAudioByUrlCall(this._stageData.sound, () => {
if (aniFinished && audioFinished) { if (aniFinished && audioFinished) {
this._playing = false; this._playing = false;
resolve(''); resolve('');
} }
}) })
});
}); });
}) });
// })
} else { } else {
this._timeoutIds.push(setTimeout(() => { this._timeoutIds.push(setTimeout(() => {
// pg.view.visible(icon_ex, true); // pg.view.visible(icon_ex, true);
...@@ -603,20 +603,20 @@ cc.Class({ ...@@ -603,20 +603,20 @@ cc.Class({
// resolve(''); // resolve('');
// } // }
// }) // })
pg.audio.playAudioByUrlCall(this._stageData.sound).then((id) => { // pg.audio.playAudioByUrlCall(this._stageData.sound).then((id) => {
audioFinished = true; audioFinished = true;
let time = cc.audioEngine.getDuration(id); // let time = cc.audioEngine.getDuration(id);
this.showCardAction(time + 1).then(() => { this.showCardAction(1).then(() => {
this.showSliderAction(1).then(() => { this.showSliderAction(1).then(() => {
pg.audio.playAudioByUrlCall(this._stageData.sound, () => { pg.audio.playAudioByUrlCall(this._stageData.sound, () => {
if (aniFinished && audioFinished) { if (aniFinished && audioFinished) {
this._playing = false; this._playing = false;
resolve(''); resolve('');
} }
});
}); });
}); });
}) });
// })
}, 1000)); }, 1000));
} }
}); });
...@@ -777,14 +777,17 @@ cc.Class({ ...@@ -777,14 +777,17 @@ cc.Class({
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
let card = layout_card.children[i]; let card = layout_card.children[i];
if (card.name == "add") continue; if (card.name == "add") continue;
await this.cardAction(card, t); await this.cardAction(card);
} }
return resolve("") return resolve("")
}); });
}, },
cardAction(card, time) { cardAction(card) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
cc.tween(card).to(time / 2, { scale: 1.1 }).to(time / 2, { scale: 1 }).call(() => { return resolve("") }).start(); pg.audio.playAudioByUrlCall(card.data.audio).then((id) => {
let time = cc.audioEngine.getDuration(id);
cc.tween(card).to(time / 2, { scale: 1.1 }).to(time / 2, { scale: 1 }).call(() => { return resolve("") }).start();
})
}); });
}, },
showSliderAction(time) { showSliderAction(time) {
...@@ -1065,7 +1068,7 @@ cc.Class({ ...@@ -1065,7 +1068,7 @@ cc.Class({
}, },
hideRestartBtn() { hideRestartBtn() {
console.log('hideRestartBtn'); console.log('hideRestartBtn op51');
const btn = cc.find('Canvas/btn_replay'); const btn = cc.find('Canvas/btn_replay');
if (!btn.canClick) { if (!btn.canClick) {
return; return;
......
...@@ -61,7 +61,7 @@ pg.view = { ...@@ -61,7 +61,7 @@ pg.view = {
}) })
}) })
}, },
setNetImg(item, res) { setNetImg(item, res, { w, h }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!item) return log.w("图片更换失败,传入了错误的item"); if (!item) return log.w("图片更换失败,传入了错误的item");
let node = item.node ? item.node : item; let node = item.node ? item.node : item;
...@@ -71,8 +71,8 @@ pg.view = { ...@@ -71,8 +71,8 @@ pg.view = {
} }
if (!node) return log.w("图片更换失败,传入了错误的item"); if (!node) return log.w("图片更换失败,传入了错误的item");
if (node.net_url == res) return; if (node.net_url == res) return;
let w = node.width; // let w = node.width;
let h = node.height; // let h = node.height;
// node.active = false;// // node.active = false;//
pg.load.loadNetImg(res).then((texture) => { pg.load.loadNetImg(res).then((texture) => {
if (!cc.isValid(node)) return log.i("节点已销毁"); if (!cc.isValid(node)) return log.i("节点已销毁");
...@@ -82,18 +82,30 @@ pg.view = { ...@@ -82,18 +82,30 @@ pg.view = {
let spriteFrame = new cc.SpriteFrame(texture); let spriteFrame = new cc.SpriteFrame(texture);
component.spriteFrame = spriteFrame; component.spriteFrame = spriteFrame;
node.net_url = res; node.net_url = res;
let a = w / nw;//100 2000 0.05
let b = h / nh;//100 1000 0.1 // node.active = true;
if (a < b) { if (!cc.isValid(node)) return pg.logger.i("节点已销毁");
node.width = a * nw; if (!node) return pg.logger.w("节点已销毁");
node.height = a * nh; if (w && h) {
let scaleX = w / nw;
let scaleY = h / nh;
let scale = scaleX <= scaleY ? scaleX : scaleY;
node.width = w;//nw * scale;
node.height = h;//nh * scale;
} else { } else {
node.width = b * nw; let a = w / nw;//100 2000 0.05
node.height = b * nh; let b = h / nh;//100 1000 0.1
if (a < b) {
node.width = a * nw;
node.height = a * nh;
} else {
node.width = b * nw;
node.height = b * nh;
}
node.scaleX = node.parent.scaleX;
node.scaleY = node.parent.scaleY;
} }
node.scaleX = node.parent.scaleX; node.active = true;
node.scaleY = node.parent.scaleY;
// node.active = true;
resolve({ w: nw, h: nh }); resolve({ w: nw, h: nh });
}) })
}) })
......
...@@ -2,126 +2,46 @@ export const defaultData = { ...@@ -2,126 +2,46 @@ export const defaultData = {
"contentObj": { "contentObj": {
"picArr": { "picArr": {
"cat": { "cat": {
"start": "http://staging-teach.cdn.ireadabc.com/c3db5ac421ef039cf540edfa5116c831.mp3", "start": "http://staging-teach.cdn.ireadabc.com/0913981cdeb2c6bc785de1054e80a500.mp3",
"record": "http://staging-teach.cdn.ireadabc.com/2db9fa7c28a11fdbcecfa6a5b5e62319.mp3", "record": "",
"wait": "http://staging-teach.cdn.ireadabc.com/aaeb274c49f400c26b05583d481aca09.mp3", "wait": "http://staging-teach.cdn.ireadabc.com/fb1c9a86851f619d2199f8bf8c36476c.mp3",
"finish": "http://staging-teach.cdn.ireadabc.com/f1ce89b2162d82214369265e47d3dda3.mp3" "finish": "http://staging-teach.cdn.ireadabc.com/227c25a67e1398026bd6185bf9a6e87c.mp3"
}, },
"tryagain": { "tryagain": {
"one": "http://staging-teach.cdn.ireadabc.com/bdc09d9eb89b73e67357b502ae2158dd.mp3", "one": "",
"two": "http://staging-teach.cdn.ireadabc.com/aaeb274c49f400c26b05583d481aca09.mp3", "two": "",
"three": "http://staging-teach.cdn.ireadabc.com/301ec5c708d22928ccf2162215f429fe.mp3" "three": ""
}, },
"list": [ "list": [
{ {
"title": "",
"titleRed": [],
"titleObj": [ "titleObj": [
{ {
"card": "a", "card": "p",
"color": 0 "color": "0",
"audio": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610.mp3"
}, },
{ {
"card": "pp", "card": "en",
"color": 1 "color": "1",
}, "audio": "http://staging-teach.cdn.ireadabc.com/a855504f6ab7af375d881a9e16e61213.mp3"
{
"card": "le",
"color": 1
}
],
"bgImg": "http://staging-teach.cdn.ireadabc.com/97e19da9309e4e5aafca5ea2e9db8f46.png",
"wordAudio": "http://staging-teach.cdn.ireadabc.com/ab3538f7d4d57ac1abd740bd32f06b2d.mp3",
"imgAni": {
"ske": {
"url": "http://staging-teach.cdn.ireadabc.com/c81816bbb714b22c57267ac5150ee1fe.json",
"name": "apple_ske.json"
},
"tex": {
"url": "http://staging-teach.cdn.ireadabc.com/6088eec0273bc0488d5f66dfb63c1003.json",
"name": "apple_tex.json"
},
"png": {
"url": "http://staging-teach.cdn.ireadabc.com/a51151d68bd74d430e2e586d86c6ddd3.png",
"name": "apple_tex.png"
}
}
},
{
"titleObj": [
{
"card": "a",
"color": 0
},
{
"card": "n",
"color": 0
},
{
"card": "t",
"color": 1
}
],
"bgImg": "http://staging-teach.cdn.ireadabc.com/0600790c4336c3839d90756aca5da45e.png",
"wordAudio": "http://staging-teach.cdn.ireadabc.com/ab3538f7d4d57ac1abd740bd32f06b2d.mp3",
"imgAni": {
"ske": {
"url": "http://staging-teach.cdn.ireadabc.com/dd4ede22a761f1f8ec261c93a5306f5c.json",
"name": "ant_ske.json"
},
"tex": {
"url": "http://staging-teach.cdn.ireadabc.com/56078bcdcc7116843a56ecc4c23d3665.json",
"name": "ant_tex.json"
},
"png": {
"url": "http://staging-teach.cdn.ireadabc.com/1a0c95cab05487b003a8dec9dd151ba4.png",
"name": "ant_tex.png"
}
}
},
{
"titleObj": [
{
"card": "a",
"color": 0
},
{
"card": "l",
"color": 0
},
{
"card": "l",
"color": 1
},
{
"card": "a",
"color": 1
},
{
"card": "i",
"color": 1
},
{
"card": "g",
"color": 1
},
{
"card": "n",
"color": 1
} }
], ],
"bgImg": "http://staging-teach.cdn.ireadabc.com/97e19da9309e4e5aafca5ea2e9db8f46.png", "bgImg": "http://staging-teach.cdn.ireadabc.com/d5d3f7f4cf27a026fbb31c2ed52b5774.png",
"wordAudio": "http://staging-teach.cdn.ireadabc.com/ab3538f7d4d57ac1abd740bd32f06b2d.mp3", "wordAudio": "http://staging-teach.cdn.ireadabc.com/fb1c9a86851f619d2199f8bf8c36476c.mp3",
"imgAni": { "imgAni": {
"ske": { "ske": {
"url": "http://staging-teach.cdn.ireadabc.com/cf0fd816076652f64cc992c084248a80.json", "url": "http://staging-teach.cdn.ireadabc.com/dc4febca2390ed2082cf29780f320aac.json",
"name": "alligator_ske.json" "name": "弹弓动画1_ske.json"
}, },
"tex": { "tex": {
"url": "http://staging-teach.cdn.ireadabc.com/5ece588b347d8fbe05eba19a40c985f0.json", "url": "http://staging-teach.cdn.ireadabc.com/41bdc84e6dac849ed13e18f04675c8da.json",
"name": "alligator_tex.json" "name": "弹弓动画1_tex.json"
}, },
"png": { "png": {
"url": "http://staging-teach.cdn.ireadabc.com/a84eff5545eca41f3e997ea8a53ac66f.png", "url": "http://staging-teach.cdn.ireadabc.com/ba0023012458217fdc001a00734e5ee5.png",
"name": "alligator_tex.png" "name": "弹弓动画1_tex.png"
} }
} }
} }
......
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