Commit 22ac4079 authored by Chen Jiping's avatar Chen Jiping

feat:调整逻辑

parent 69d6c00c
...@@ -262,7 +262,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -262,7 +262,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
else if (this.playTimes >= this.MAX_PLAY_TIMES) { else if (this.playTimes >= this.MAX_PLAY_TIMES) {
//显示下一行 //显示下一行
this.wordArea2.show(()=>{ this.wordArea2.show(()=>{
this.play2(0); this.wordArea2.click(()=>{
this.showEnd();
});
}); });
...@@ -276,25 +278,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -276,25 +278,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}) })
} }
play2(index = 0) {
let wordArea = this.wordArea2;
let word = wordArea.wordArr[index];
word.show();
word.click(()=> {
if(index === this.wordArea2.wordArr.length - 1){
this.showEnd();
}
else{
word.hide();
this.play2(index + 1);
}
});
}
/** /**
* 显示结束画 * 显示结束画
......
...@@ -125,10 +125,9 @@ export class Word extends Item { ...@@ -125,10 +125,9 @@ export class Word extends Item {
//播放音频 //播放音频
if (this._audioClip) { if (this._audioClip) {
this._cat.playAni('begin', 0);
playAudio(this._audioClip, () => { playAudio(this._audioClip, () => {
this._cat.playAni('normal', 0);
}); });
} }
...@@ -337,10 +336,10 @@ export class Word2 extends Item { ...@@ -337,10 +336,10 @@ export class Word2 extends Item {
//播放音频 //播放音频
if (this._audioClip) { if (this._audioClip) {
this._cat.playAni('begin', 0);
playAudio(this._audioClip, () => { playAudio(this._audioClip, () => {
this._cat.playAni('normal', 0);
}); });
} }
...@@ -449,9 +448,30 @@ export class WordArea2 extends WordGroup { ...@@ -449,9 +448,30 @@ export class WordArea2 extends WordGroup {
} }
click(cb = null) { click(cb = null) {
let word = this.wordArr[2];
word.click(cb); for(let i = 0; i < this.wordArr.length; ++ i){
this.wordArr[i].hide();
}
const play2 = (index = 0)=>{
let word = this.wordArr[index];
word.show();
word.click(()=> {
if(index === this.wordArr.length - 1){
cb && cb();
}
else{
word.hide();
play2(index + 1);
}
});
};
play2();
} }
} }
......
...@@ -12,12 +12,14 @@ import { delayCall, getSprNodeByUrl, playAudio } from "./util"; ...@@ -12,12 +12,14 @@ import { delayCall, getSprNodeByUrl, playAudio } from "./util";
private _audioUrl: string; private _audioUrl: string;
//晃动最大次数 //晃动最大次数
readonly MAX_TIMES = 2; readonly MAX_TIMES = 1;
private _audioClip: cc.AudioClip; private _audioClip: cc.AudioClip;
private _cat : Cat; private _cat : Cat;
private _initScale = 1;
set picUrl(picUrl: string) { set picUrl(picUrl: string) {
this._picUrl = picUrl; this._picUrl = picUrl;
} }
...@@ -80,6 +82,8 @@ import { delayCall, getSprNodeByUrl, playAudio } from "./util"; ...@@ -80,6 +82,8 @@ import { delayCall, getSprNodeByUrl, playAudio } from "./util";
picNode.x = 0; picNode.x = 0;
picNode.y = 0; picNode.y = 0;
pic.addChild(picNode); pic.addChild(picNode);
this._initScale = scale;
}); });
} }
...@@ -98,39 +102,36 @@ import { delayCall, getSprNodeByUrl, playAudio } from "./util"; ...@@ -98,39 +102,36 @@ import { delayCall, getSprNodeByUrl, playAudio } from "./util";
//动画时长 //动画时长
let tweenDuration = 0.4; let tweenDuration = 0.4;
let rotation = this._node.angle;
let times = 1; let times = 1;
const rota = () => { const enlarge = () => {
cc.tween(this._node) cc.tween(this._node)
.to(tweenDuration / 4, { angle: rotation - 15 }) .to(tweenDuration / 2, { scale: this._initScale * 1.5 })
.to(tweenDuration / 4, { angle: rotation }) .to(tweenDuration / 2, { scale: this._initScale })
.to(tweenDuration / 4, { angle: rotation + 15 })
.to(tweenDuration / 4, { angle: rotation })
.call(() => { .call(() => {
times += 1;
if (times > this.MAX_TIMES) { if (times > this.MAX_TIMES) {
this._canTouch = true; this._canTouch = true;
return; return;
} }
times += 1; enlarge();
rota();
}) })
.start(); .start();
} }
//晃动图片 //放大图片
rota(); enlarge();
//播放音频 //播放音频
if (this._audioClip) { if (this._audioClip) {
this._cat.playAni('begin', 0); //this._cat.playAni('begin', 0);
playAudio(this._audioClip, () => { playAudio(this._audioClip, () => {
this._cat.playAni('normal', 0); //this._cat.playAni('normal', 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