Commit 26536659 authored by 李维's avatar 李维

Bug fix

parent 1bf0a326
......@@ -42,7 +42,18 @@ export default class GameLogic {
this.addEventListener();
this.initBottomButtons();
this.initDragonContainers();
this.loadQuestion(true)
if(!this.loadQuestion(true)) {
const btnRestart = this.g_cartoon.getCartoonElement("btn_restart");
if(this.m_currentQuestion <= -1) {
btnRestart.node.opacity = 128;
btnRestart.disable = true;
console.log("Disable restart")
} else {
btnRestart.node.opacity = 255;
btnRestart.disable = false;
}
}
this.enableClick("Sysyem_init_done")
}
......@@ -71,7 +82,11 @@ export default class GameLogic {
}
addEventListener() {
const btnRestart = this.g_cartoon.getCartoonElement("btn_restart");
this.g_cartoon.subscribeTouchEvent("bgMain", ()=>{
if(btnRestart.disable) {
return
}
this.playCurrentQuestion()
})
}
......@@ -305,6 +320,7 @@ export default class GameLogic {
this.m_currentQuestion--;
}
this.checkButtonDisable();
if(this.m_currentQuestion >= this.g_formData.dataArray.length) {
this.m_currentQuestion = this.g_formData.dataArray.length-1
return false;
......@@ -330,7 +346,6 @@ export default class GameLogic {
this.playCurrentQuestion()
}
this.checkButtonDisable();
return true;
}
......@@ -370,6 +385,9 @@ export default class GameLogic {
})
this.g_cartoon.subscribeTouchEvent(btnRestart.key, ()=>{
if(btnRestart.disable) {
return
}
jelly(btnRestart.node)
this.g_cartoon.playAudio("sm_btn");
this.playCurrentQuestion()
......@@ -379,10 +397,23 @@ export default class GameLogic {
checkButtonDisable() {
const btnLeft = this.g_cartoon.getCartoonElement("btn_left");
const btnRight = this.g_cartoon.getCartoonElement("btn_right");
const btnRestart = this.g_cartoon.getCartoonElement("btn_restart");
console.log("Check button disabe " + this.m_currentQuestion)
if(this.m_currentQuestion <= -1) {
btnRestart.node.opacity = 128;
btnRestart.disable = true;
console.log("Disable restart")
} else {
btnRestart.node.opacity = 255;
btnRestart.disable = false;
}
if(this.m_currentQuestion <= 0) {
btnLeft.node.opacity = 128;
btnLeft.disable = true;
console.log("Disable left")
} else {
btnLeft.node.opacity = 255;
btnLeft.disable = false;
......@@ -391,6 +422,7 @@ export default class GameLogic {
if(this.m_currentQuestion >= this.g_formData.dataArray.length-1) {
btnRight.node.opacity = 128;
btnRight.disable = true;
console.log("Disable right")
} else {
btnRight.node.opacity = 255;
btnRight.disable = false;
......
This diff is collapsed.
export default {
"default": true,
"version":"1.0",
"key":"DataKey_Sbox_FT_08",
"bgMusic":"",
"titleText":"It's My Day",
"questionAudio_url":"",
"dataArray":[
{
"image_url":"card_demo",
"audio_url":""
},
{
"image_url":"card_demo",
"audio_url":""
},
{
"image_url":"card_demo",
"audio_url":""
},
{
"image_url":"card_demo",
"audio_url":""
},
{
"image_url":"card_demo",
"audio_url":""
},
{
"image_url":"card_demo",
"audio_url":""
},
{
"image_url":"card_demo",
"audio_url":""
},
{
"image_url":"card_demo",
"audio_url":""
},
{
"image_url":"card_demo",
"audio_url":""
},
{
"image_url":"card_demo",
"audio_url":""
},
]
"version": "1.0",
"key": "DataKey_Sbx_Pronunciation",
"dataArray": [],
"theme": "A",
"border_image_url": "",
"video_image_url": "",
"text_image_url": ""
}
\ No newline at end of file
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