Commit 8c6bda2d authored by Chen Jiping's avatar Chen Jiping

完善

parent dd10053f
...@@ -107,6 +107,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -107,6 +107,8 @@ export class PlayComponent implements OnInit, OnDestroy {
playingPic; playingPic;
playingPic_1;
//正在播放 //正在播放
playing; playing;
...@@ -347,9 +349,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -347,9 +349,6 @@ export class PlayComponent implements OnInit, OnDestroy {
* @param callback * @param callback
*/ */
playPracticeAudio(key, now = false, callback = null){ playPracticeAudio(key, now = false, callback = null){
this.playPic.alpha = 0;
this.playingPic.alpha = 1;
this.playAudio(key, now, callback); this.playAudio(key, now, callback);
...@@ -359,26 +358,66 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -359,26 +358,66 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
showPlayStauts(){ showPlayStauts(){
const show1 = () =>{
if(this.playing){ if(this.playing){
this.playPic.alpha = 0;
this.playingPic.alpha = 1;
this.playingPic_1.alpha = 0;
if(this.playPic.alpha == 0){ setTimeout(() => {
this.playingPic.alpha = 0; show2();
this.playPic.alpha = 1 }, 500);
} }
else{ else{
this.playingPic.alpha = 1; this.setPause();
}
};
const show2 = () =>{
if(this.playing){
this.playPic.alpha = 0; this.playPic.alpha = 0;
this.playingPic.alpha = 0;
this.playingPic_1.alpha = 1;
setTimeout(() => {
show3();
}, 500);
}
else{
this.setPause();
} }
};
const show3 = () =>{
if(this.playing){
this.playPic.alpha = 1;
this.playingPic.alpha = 0;
this.playingPic_1.alpha = 0;
setTimeout(() => { setTimeout(() => {
this.showPlayStauts(); show1();
}, 1000); }, 500);
} }
else{ else{
this.setPause();
}
};
show1();
}
setPause(){
this.playingPic.alpha = 0; this.playingPic.alpha = 0;
this.playPic.alpha = 1; this.playPic.alpha = 1;
this.playingPic_1.alpha = 0;
} }
}
playAudio(key, now = false, callback = null) { playAudio(key, now = false, callback = null) {
...@@ -408,6 +447,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -408,6 +447,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.playingPic.alpha = 0; this.playingPic.alpha = 0;
this.playingPic_1.alpha = 0;
this.pauseAudio(key, callback); this.pauseAudio(key, callback);
this.playing =false; this.playing =false;
...@@ -788,6 +829,17 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -788,6 +829,17 @@ export class PlayComponent implements OnInit, OnDestroy {
this.renderArr.push(playingPic); this.renderArr.push(playingPic);
this.playingPic = playingPic; this.playingPic = playingPic;
const playingPic_1 = new MySprite();
playingPic_1.init(this.images.get('playing_1'));
playingPic_1.x = btnPlay.x;
playingPic_1.y = btnPlay.y;
playingPic_1.alpha = 0;
playingPic_1.setScaleXY(this.mapScale);
this.renderArr.push(playingPic_1);
this.playingPic_1 = playingPic_1;
} }
initPic() { initPic() {
...@@ -1393,6 +1445,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1393,6 +1445,9 @@ export class PlayComponent implements OnInit, OnDestroy {
//如果未全部结束,则初始化下一个练习题 //如果未全部结束,则初始化下一个练习题
if(!end){ if(!end){
this.showPrompt();
setTimeout(() => { setTimeout(() => {
tweenChange(cover, {alpha: 0}, 6, ()=>{ tweenChange(cover, {alpha: 0}, 6, ()=>{
...@@ -1403,6 +1458,32 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1403,6 +1458,32 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
} }
/**
* 显示练习题结束提示
*/
showPrompt(){
//显示练习题剩余提示
const prompt = new MySprite();
prompt.init(this.images.get('prompt'));
prompt.setScaleXY(this.mapScale);
prompt.y = this.canvasHeight/2;
prompt.x = this.canvasWidth/2;
this.endPageArr.push(prompt);
let prompt_val = new Label();
prompt_val.text = (this.nextPracticeIndex - 1) + " | " + this.data.practices.length;
prompt_val.textAlign='middle';
prompt_val.fontSize = 50;
prompt_val.fontName = "ARIALBD";
prompt_val.fontColor = "#FFFFFF";
prompt_val.refreshSize();
prompt_val.x = -prompt_val.width/2;
prompt_val.y = 0;
prompt.addChild(prompt_val);
prompt.childDepandAlpha = true;
}
/** /**
* 添加结束花辨效果 * 添加结束花辨效果
*/ */
...@@ -1499,6 +1580,13 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1499,6 +1580,13 @@ export class PlayComponent implements OnInit, OnDestroy {
return; return;
} }
if (this.checkClickTarget(this.playingPic_1) && this.playing) {
this.pausePracticeAudio('practice_' + (this.nextPracticeIndex - 1));
return;
}
} }
mapMove(event) { mapMove(event) {
...@@ -1548,13 +1636,13 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1548,13 +1636,13 @@ export class PlayComponent implements OnInit, OnDestroy {
}; };
let out = -bullet_pic.height; let out = -bullet_pic.height;
tweenChange(bullet.pic, {y: out}, 1, ()=>{ let bulletTween = tweenChange(bullet.pic, {y: out}, 1, ()=>{
removeItemFromArr(this.bulletRenderArr, bullet); removeItemFromArr(this.bulletRenderArr, bullet);
},null,()=>{ },null,()=>{
this.checkHit(bullet); this.checkHit(bullet, bulletTween);
}); });
...@@ -1602,8 +1690,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1602,8 +1690,9 @@ export class PlayComponent implements OnInit, OnDestroy {
/** /**
* 检查是否碰撞 * 检查是否碰撞
* @param item * @param item
* @param bulletTween
*/ */
checkHit(item){ checkHit(item, bulletTween){
if(!item){ if(!item){
return; return;
...@@ -1636,11 +1725,19 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1636,11 +1725,19 @@ export class PlayComponent implements OnInit, OnDestroy {
break; break;
} }
bulletTween.pause();
//延迟隐藏子弹
setTimeout(() => {
item.pic.scaleY = 0; item.pic.scaleY = 0;
item.pic.scaleX = 0; item.pic.scaleX = 0;
item.pic.alpha=0; item.pic.alpha=0;
bulletTween.resume();
}, 100);
item.hit = true; item.hit = true;
//正确答案 //正确答案
......
...@@ -23,8 +23,11 @@ const res = [ ...@@ -23,8 +23,11 @@ const res = [
['play', "assets/play/play.png"], ['play', "assets/play/play.png"],
['playing', "assets/play/playing.png"], ['playing', "assets/play/playing.png"],
['playing_1', "assets/play/playing_1.png"],
['start', "assets/play/start.png"], ['start', "assets/play/start.png"],
['restart', "assets/play/restart.png"] ['restart', "assets/play/restart.png"],
['prompt', "assets/play/prompt.png"]
]; ];
......
src/assets/play/play.png

21.5 KB | W: | H:

src/assets/play/play.png

21.5 KB | W: | H:

src/assets/play/play.png
src/assets/play/play.png
src/assets/play/play.png
src/assets/play/play.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/playing.png

22.2 KB | W: | H:

src/assets/play/playing.png

21.9 KB | W: | H:

src/assets/play/playing.png
src/assets/play/playing.png
src/assets/play/playing.png
src/assets/play/playing.png
  • 2-up
  • Swipe
  • Onion skin
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