Commit 645e48be authored by yu's avatar yu

1

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