Commit 3f27e6d2 authored by 李维's avatar 李维

dev commit

parent ff2fcffb
...@@ -108,7 +108,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -108,7 +108,7 @@ export class PlayComponent implements OnInit, OnDestroy {
m_showPetalFlag; m_showPetalFlag;
m_elementPetalArr; m_elementPetalArr;
m_showElementPetalFlag; m_showElementPetalFlag;
m_PetalImage = "petal_" // 飘落动画 m_PetalImage = "_scrap-pic-" // 飘落动画
m_renderArr // 渲染队列 m_renderArr // 渲染队列
m_renderObject = []; m_renderObject = [];
m_defaultZindex = 0; m_defaultZindex = 0;
...@@ -130,6 +130,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -130,6 +130,8 @@ export class PlayComponent implements OnInit, OnDestroy {
m_currentPickupCardID = null; m_currentPickupCardID = null;
m_allSelectedHotZone = []; m_allSelectedHotZone = [];
m_moveAsstantIntervalId = null m_moveAsstantIntervalId = null
m_endGame = false;
m_restartGame = false;
// ------------------------------------ // ------------------------------------
...@@ -169,8 +171,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -169,8 +171,10 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
restartGame() { restartGame() {
this.initSystem();
this.cleanGameVar() this.cleanGameVar()
this.initGame() this.initGame()
this.m_restartGame = true;
} }
...@@ -196,6 +200,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -196,6 +200,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initSelectedCardArea() this.initSelectedCardArea()
this.initStartButton() this.initStartButton()
this.initBackgroundMusic() this.initBackgroundMusic()
this.initRestartButton()
} }
cleanGameVar(){ cleanGameVar(){
...@@ -214,11 +219,22 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -214,11 +219,22 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_pickupCard = false; this.m_pickupCard = false;
this.m_currentPickupCardID = null; this.m_currentPickupCardID = null;
this.m_allSelectedHotZone = [] this.m_allSelectedHotZone = []
this.m_endGame = false;
this.m_restartGame = false;
this.disableMoveAsstant() this.disableMoveAsstant()
} }
endGame(){ endGame(){
this.g_cartoon.stopAllAudio()
this.g_cartoon.playAudio("sm-choice-complete", false, ()=>{
setTimeout(() => {
this.stopEndPatal()
this.g_cartoon.getCartoonElement("restart-button").show();
}, (500));
})
this.showEndPatal()
this.cardRunControl(false)
this.m_endGame = true;
} }
// 播放背景音乐 // 播放背景音乐
...@@ -228,7 +244,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -228,7 +244,9 @@ export class PlayComponent implements OnInit, OnDestroy {
play() play()
}) })
} }
play() if(!this.m_restartGame){
play()
}
} }
// 背景 // 背景
...@@ -391,6 +409,13 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -391,6 +409,13 @@ export class PlayComponent implements OnInit, OnDestroy {
hilightBackground.ref.visible = true; hilightBackground.ref.visible = true;
} }
this.subscribeMapDownEvent(`card-content-${index}`, ()=>{ this.subscribeMapDownEvent(`card-content-${index}`, ()=>{
if(this.m_endGame){
if(cardContent.parentID.indexOf("hot") != -1){
this.g_cartoon.playAudio(data.audio_url);
}
this.g_enableMapDown = true;
return
}
if( cardContent.parentID.indexOf("hot") != -1 ){ if( cardContent.parentID.indexOf("hot") != -1 ){
this.g_cartoon.playAudio(data.audio_url) this.g_cartoon.playAudio(data.audio_url)
cardContent.clickTime = new Date().getTime() cardContent.clickTime = new Date().getTime()
...@@ -524,7 +549,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -524,7 +549,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// 跑道启停控制 // 跑道启停控制
cardRunControl(status){ cardRunControl(status){
if(!this.m_enableRunway){ if(!this.m_enableRunway || this.m_endGame ){
return; return;
} }
let step = Math.floor(this.g_mapScale*10000)/20000; let step = Math.floor(this.g_mapScale*10000)/20000;
...@@ -770,13 +795,26 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -770,13 +795,26 @@ export class PlayComponent implements OnInit, OnDestroy {
element.click = ()=>{ element.click = ()=>{
tweenChange(element.ref, {scaleX:element.ref.initScaleX*0.9, scaleY:element.ref.initScaleY*0.9}, 0.2, ()=>{ tweenChange(element.ref, {scaleX:element.ref.initScaleX*0.9, scaleY:element.ref.initScaleY*0.9}, 0.2, ()=>{
tweenChange(element.ref, {scaleX:element.ref.initScaleX, scaleY:element.ref.initScaleY}, 0.2) tweenChange(element.ref, {scaleX:element.ref.initScaleX, scaleY:element.ref.initScaleY}, 0.2, ()=>{
this.endGame()
})
}) })
element.getAllCards() let allIDs = element.getAllCards()
let cardWidth = 180*this.g_mapScale
let allWidth = allIDs.length * cardWidth
let base_x = (this.g_canvasWidth - allWidth + cardWidth)/2
if(allIDs.length>0){
allIDs.forEach((id,index) => {
tweenChange( this.g_cartoon.getCartoonElement(id).ref, {x:base_x+index*cardWidth}, 0.2)
});
}
element.ref.scaleX = 0;
element.ref.scaleY = 0;
element.ref.x = 100000;
this.g_enableMapDown = true;
} }
element.showHideCheck = ()=>{ element.showHideCheck = ()=>{
console.log("showHideCheck",element.getAllCards())
if( element.getAllCards().length>0 && !element.showStatus ){ if( element.getAllCards().length>0 && !element.showStatus ){
tweenChange(element.ref, {scaleX:element.ref.initScaleX, scaleY: element.ref.initScaleY}, 0.1, ()=>{ tweenChange(element.ref, {scaleX:element.ref.initScaleX, scaleY: element.ref.initScaleY}, 0.1, ()=>{
jelly(element.ref, 0.5) jelly(element.ref, 0.5)
...@@ -789,13 +827,49 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -789,13 +827,49 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
this.subscribeMapDownEvent("start-button", ()=>{ this.subscribeMapDownEvent("start-button", ()=>{
console.log("Ok - Clikc")
element.click() element.click()
this.g_enableMapDown = true;
}) })
this.render(element.ref) this.render(element.ref)
} }
initRestartButton(){
let element = this.g_cartoon.createCartoonElementImageFunc("restart-button", "btn-go", (w,h)=>{
return {
sx: 128*this.g_mapScale/w,
sy: 128*this.g_mapScale/h
}
}, (w,h)=>{
return {
x: this.g_canvasWidth - 36*this.g_mapScale - (h/2)*this.g_mapScale,
y: 554*this.g_mapScale + (h/2)*this.g_mapScale
}
})
element.ref.scaleX = 0;
element.ref.scaleY = 0;
element.show = ()=>{
console.log("Show")
element.ref.scaleX = element.ref.initScaleX;
element.ref.scaleY = element.ref.initScaleY;
}
element.hide = ()=>{
element.ref.scaleX = 0;
element.ref.scaleY = 0;
}
this.subscribeMapDownEvent("restart-button", ()=>{
console.log("Res - click")
element.hide()
this.restartGame()
})
this.render(element.ref)
}
enableMoveAsstant(element){ enableMoveAsstant(element){
if(this.m_moveAsstantIntervalId){ if(this.m_moveAsstantIntervalId){
clearInterval(this.m_moveAsstantIntervalId) clearInterval(this.m_moveAsstantIntervalId)
......
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