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

dev commit

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