Commit 1555d306 authored by limingzhe's avatar limingzhe

fix: 增加四线三格 音频

parent ed2dd9ec
...@@ -273,9 +273,9 @@ cc.Class({ ...@@ -273,9 +273,9 @@ cc.Class({
wordLayer.removeAllChildren(); wordLayer.removeAllChildren();
const normalLayer = new cc.Node(); const normalLayer = new cc.Node();
wordLayer.addChild(normalLayer); wordLayer.addChild(normalLayer , 2);
const strokeLayer = new cc.Node(); const strokeLayer = new cc.Node();
wordLayer.addChild(strokeLayer); wordLayer.addChild(strokeLayer , 2);
strokeLayer.opacity = 0; strokeLayer.opacity = 0;
this.wordLayer.normalLayer = normalLayer; this.wordLayer.normalLayer = normalLayer;
...@@ -287,10 +287,29 @@ cc.Class({ ...@@ -287,10 +287,29 @@ cc.Class({
const aNode = getSprNode("letter/a"); const aNode = getSprNode("letter/a");
wordLayer.height = aNode.height; wordLayer.height = aNode.height;
const letterOffsetData = {
"b" : 60,
"d" : 60,
"f" : 30,
"g" : -105,
"h" : 65,
"i" : 45,
"j" : -65,
"k" : 65,
"l" : 65,
"p" : -105,
"q" : -105,
"t" : 50,
"y" : -105,
}
let curX = 0; let curX = 0;
const disX = 70; const disX = 70;
const letterList = this.letterList; const letterList = this.letterList;
for (let i = 0; i < letterList.length; i++) { for (let i = 0; i < letterList.length; i++) {
const letter = letterList[i]; const letter = letterList[i];
const resName = 'letter/' + letter; const resName = 'letter/' + letter;
const letterNode = getSprNode(resName) const letterNode = getSprNode(resName)
...@@ -305,6 +324,16 @@ cc.Class({ ...@@ -305,6 +324,16 @@ cc.Class({
strokeArr.push(letterSNode); strokeArr.push(letterSNode);
const offsetY = 0;
const key = letter.toLowerCase();
if (letterOffsetData[key]) {
offsetY = letterOffsetData[key];
}
letterNode.y = offsetY;
letterSNode.y = offsetY;
curX = letterNode.x + letterNode.width / 2; curX = letterNode.x + letterNode.width / 2;
// if (i == 0) { // if (i == 0) {
...@@ -321,6 +350,14 @@ cc.Class({ ...@@ -321,6 +350,14 @@ cc.Class({
wordLayer.x = - wordLayer.width / 2 * wordLayer.scale; wordLayer.x = - wordLayer.width / 2 * wordLayer.scale;
wordLayer.y = 240 * this._mapScaleMin; wordLayer.y = 240 * this._mapScaleMin;
const wordBg = getSprNode("word_bg");
wordBg.x = wordLayer.width / 2;
wordLayer.addChild(wordBg);
wordBg.scaleY = wordLayer.height / wordBg.height;
wordBg.scaleX = wordLayer.width / wordBg.width;
wordBg.opacity = 0;
wordLayer.wordBg = wordBg;
wordLayer.opacity = 0; wordLayer.opacity = 0;
cc.tween(wordLayer) cc.tween(wordLayer)
...@@ -390,17 +427,23 @@ cc.Class({ ...@@ -390,17 +427,23 @@ cc.Class({
.to(time, { x: -this.wordLayer.width / 2 * targetS, y: topY, scale: targetS }, { easing: "cubicInOut" }) .to(time, { x: -this.wordLayer.width / 2 * targetS, y: topY, scale: targetS }, { easing: "cubicInOut" })
.start(); .start();
const { normalLayer, strokeLayer } = this.wordLayer; const { normalLayer, strokeLayer, wordBg } = this.wordLayer;
cc.tween(normalLayer) cc.tween(normalLayer)
.to(time, { opacity: 0 }, { easing: "cubicIn" }) .to(time, { opacity: 0 }, { easing: "cubicIn" })
.call(() => { .call(() => {
normalLayer.active = false; normalLayer.active = false;
cc.tween(wordBg)
.to(time / 2, { opacity: 255 }, { easing: "cubicOut" })
.start();
}) })
.start(); .start();
cc.tween(strokeLayer) cc.tween(strokeLayer)
.to(time, { opacity: 255 }, { easing: "cubicOut" }) .to(time, { opacity: 255 }, { easing: "cubicOut" })
.start(); .start();
}, },
async hidePic() { async hidePic() {
...@@ -1385,9 +1428,9 @@ cc.Class({ ...@@ -1385,9 +1428,9 @@ cc.Class({
// } // }
// }, 260); // }, 260);
// this.showGold(() => {
this.changeNewLetter(); this.changeNewLetter();
// });
}, },
changeNewLetter() { changeNewLetter() {
...@@ -1497,28 +1540,26 @@ cc.Class({ ...@@ -1497,28 +1540,26 @@ cc.Class({
return; return;
} }
this.playWordAudio(() => {
setTimeout(() => {
if (this.isDestroy) { if (this.isDestroy) {
return; return;
} }
if (this.letter_end_Clip) { this.showGold(() => {
playAudio(this.letter_end_Clip); if (this.isDestroy) {
} return;
}
this.hideWordLayer();
});
})
}, 260);
this.showGold(() => {
if (this.isDestroy) {
return;
}
this.hideWordLayer();
});
// this.hideWordLayer();
}) })
}) })
.start(); .start();
cc.tween(this.wordLayer.wordBg)
.to(time / 2, {opacity: 0}, {easing: "cubicOut"})
.start();
}, },
hideWordLayer() { hideWordLayer() {
...@@ -1556,7 +1597,7 @@ cc.Class({ ...@@ -1556,7 +1597,7 @@ cc.Class({
await asyncDelay(1.3); await asyncDelay(1.3);
this.wordToCenter(); this.wordToCenter();
// this.showGold();
// setTimeout(() => { // setTimeout(() => {
// if (this.isDestroy) { // if (this.isDestroy) {
...@@ -1756,7 +1797,31 @@ cc.Class({ ...@@ -1756,7 +1797,31 @@ cc.Class({
return result; return result;
}, },
playWordAudio(callback) {
const audio_url = this.curQues.audio_url;
playAudioByUrl(audio_url, () => {
callback && callback();
})
},
async showGold(cb) { async showGold(cb) {
setTimeout(() => {
if (this.isDestroy) {
return;
}
if (this.letter_end_Clip) {
playAudio(this.letter_end_Clip);
}
}, 260);
console.log(' in showGold') console.log(' in showGold')
const goldAnim = cc.instantiate(cc.find('Canvas/res/anim/gold_anim')); const goldAnim = cc.instantiate(cc.find('Canvas/res/anim/gold_anim'));
goldAnim.active = true; goldAnim.active = true;
......
{
"ver": "2.3.5",
"uuid": "136f4d55-0224-4648-8feb-38d49e2fc873",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 381,
"height": 126,
"platformSettings": {},
"subMetas": {
"word_bg": {
"ver": "1.0.4",
"uuid": "32b3a46d-fb03-45b9-803d-a07e925e4136",
"rawTextureUuid": "136f4d55-0224-4648-8feb-38d49e2fc873",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 381,
"height": 126,
"rawWidth": 381,
"rawHeight": 126,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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