Commit 81c0ad51 authored by 李维's avatar 李维

dev commit

parent 2c339eb6
...@@ -150,6 +150,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -150,6 +150,7 @@ export class PlayComponent implements OnInit, OnDestroy {
m_autoFocusID = null; m_autoFocusID = null;
m_enableCamera = false; m_enableCamera = false;
m_nextCardLock = false; m_nextCardLock = false;
m_enableAutoFocus = false;
// ------------------------------------ // ------------------------------------
...@@ -199,8 +200,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -199,8 +200,8 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
restartGame() { restartGame() {
this.initSystem();
this.cleanSystemVar() this.cleanSystemVar()
this.initSystem();
this.cleanGameVar() this.cleanGameVar()
this.initGame() this.initGame()
} }
...@@ -225,6 +226,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -225,6 +226,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initCards(); this.initCards();
this.initShowCard(); this.initShowCard();
this.initStartButton() this.initStartButton()
this.autoFocus()
} }
cleanGameVar(){ cleanGameVar(){
...@@ -252,11 +254,20 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -252,11 +254,20 @@ export class PlayComponent implements OnInit, OnDestroy {
startGame(){ startGame(){
this.m_enableCamera = true; this.m_enableCamera = true;
this.autoRollRun(); this.autoRollRun();
this.m_enableAutoFocus = true;
this.g_cartoon.playAudio("sm-run", false ,null, true, (audio)=>{ this.g_cartoon.playAudio("sm-run", false ,null, true, (audio)=>{
audio.volume = 0.3 audio.volume = 0.3
}) })
} }
autoFocus(){
this.m_setIntervalIDs.push(setInterval(()=>{
if(this.m_enableAutoFocus){
this.nextFocus()
}
}, 300))
}
initBackground(){ initBackground(){
let element = this.g_cartoon.createCartoonElementImage("background-main", "main-bg", this.g_canvasWidth, this.g_canvasHeight, this.g_canvasWidth/2, this.g_canvasHeight/2); let element = this.g_cartoon.createCartoonElementImage("background-main", "main-bg", this.g_canvasWidth, this.g_canvasHeight, this.g_canvasWidth/2, this.g_canvasHeight/2);
this.render(element.ref) this.render(element.ref)
...@@ -357,6 +368,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -357,6 +368,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_enableRunway = false; this.m_enableRunway = false;
this.g_cartoon.stopAudio("sm-run") this.g_cartoon.stopAudio("sm-run")
clearTimeout(this.m_autoFocusID) clearTimeout(this.m_autoFocusID)
this.m_enableAutoFocus = false;
this.g_cartoon.playAudio("sm-camera") this.g_cartoon.playAudio("sm-camera")
this.g_cartoon.getCartoonElement(`card-show`).show(()=>{ this.g_cartoon.getCartoonElement(`card-show`).show(()=>{
this.g_enableMapDown = true this.g_enableMapDown = true
...@@ -471,11 +483,11 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -471,11 +483,11 @@ export class PlayComponent implements OnInit, OnDestroy {
element.content.ref.x -= distance; element.content.ref.x -= distance;
} }
if(cardContentHighlight.ref.visible){ // if(cardContentHighlight.ref.visible){
if(!this.m_nextCardLock && element.ref.x<=0){ // if(!this.m_nextCardLock && element.ref.x<=0){
this.nextFocus() // this.nextFocus()
} // }
} // }
} }
element.readyGoOut = (x)=>{ element.readyGoOut = (x)=>{
...@@ -518,6 +530,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -518,6 +530,8 @@ export class PlayComponent implements OnInit, OnDestroy {
}) })
this.m_runStatus = true; this.m_runStatus = true;
}, 40) }, 40)
this.m_setIntervalIDs.push(this.m_runIntervalId)
} }
// 卡片回收与准备控制 // 卡片回收与准备控制
...@@ -558,6 +572,15 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -558,6 +572,15 @@ export class PlayComponent implements OnInit, OnDestroy {
next = current + 1 next = current + 1
} }
if(this.g_cartoon.getCartoonElement(this.m_allCardIds[next]).waiting){
for(let index=0; index<this.m_allCardIds.length; index++){
if(!this.g_cartoon.getCartoonElement(this.m_allCardIds[index]).waiting){
next = index;
break
}
}
}
if(current != -1){ if(current != -1){
this.g_cartoon.getCartoonElement(this.m_allCardIds[current]).hideHighlight() this.g_cartoon.getCartoonElement(this.m_allCardIds[current]).hideHighlight()
} }
...@@ -700,7 +723,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -700,7 +723,8 @@ export class PlayComponent implements OnInit, OnDestroy {
element.hide(()=>{ element.hide(()=>{
this.g_cartoon.getCartoonElement("Camera").hightlight(false) this.g_cartoon.getCartoonElement("Camera").hightlight(false)
this.m_enableRunway = true; this.m_enableRunway = true;
this.g_enableMapDown = true this.g_enableMapDown = true;
this.m_enableAutoFocus = true;
}) })
}) })
......
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