add main menu
This commit is contained in:
@@ -40,7 +40,8 @@ config = {
|
||||
BlockTime : 180000,
|
||||
last_block : true,
|
||||
trais : false,
|
||||
MaxIncrement : 120000
|
||||
MaxIncrement : 120000,
|
||||
first_time : true
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +50,15 @@ function load_Clock_scene(){
|
||||
hide_scene("Cube")
|
||||
inizalize_clock()
|
||||
show_scene("Clock")
|
||||
inizalize_clock()
|
||||
}
|
||||
|
||||
function load_menu_scene(){
|
||||
hide_scene("Clock")
|
||||
hide_scene("Cube")
|
||||
if (typeof sync_menu_with_config === "function"){
|
||||
sync_menu_with_config()
|
||||
}
|
||||
show_scene("Menu")
|
||||
}
|
||||
|
||||
function inizalize_clock(){
|
||||
@@ -62,6 +71,14 @@ function inizalize_clock(){
|
||||
Block.Time = config.BlockTime
|
||||
Block.Type = !config.last_block
|
||||
|
||||
if (config.first_time) {
|
||||
config.first_time = false
|
||||
show_start_clock_button()
|
||||
}else{
|
||||
start()
|
||||
}
|
||||
|
||||
|
||||
change_move_left_black(Black.moveLeft)
|
||||
change_move_left_white(White.moveLeft)
|
||||
change_time_black(Black.Time)
|
||||
@@ -130,6 +147,11 @@ function black_timer_release(){
|
||||
}
|
||||
|
||||
|
||||
function on_start_clock_button_press(){
|
||||
start()
|
||||
hide_start_clock_button()
|
||||
}
|
||||
|
||||
function white_timer_touch(){
|
||||
if (!Timer.White_Has_started){
|
||||
Timer.coldown_Start_White = Date.now()
|
||||
@@ -226,11 +248,13 @@ function update() {
|
||||
|
||||
if (Timer.Black_Has_Finish && Timer.White_Has_Finish){
|
||||
if (config.last_block){
|
||||
if (Timer.Black_time > config.MaxIncrement) Timer.Black_time = config.MaxIncrement
|
||||
config.StartTimeWhite += Timer.Black_time
|
||||
config.StartTimeBlack += Timer.Black_time
|
||||
}else{
|
||||
if (Timer.White_time > config.MaxIncrement) Timer.White_time = config.MaxIncrement
|
||||
config.StartTimeWhite -= Timer.White_time
|
||||
config.StartTimeBlack -= Timer.Black_time
|
||||
config.StartTimeBlack -= Timer.White_time
|
||||
}
|
||||
|
||||
load_Clock_scene()
|
||||
|
||||
Reference in New Issue
Block a user