Commit 26536659 authored by 李维's avatar 李维

Bug fix

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