From c33feb62237cb9294b45f158d3ca1b6f8ba5c091 Mon Sep 17 00:00:00 2001 From: Lemoney Date: Sat, 22 Aug 2020 16:54:37 +0800 Subject: [PATCH] Disable quit button for HTML5 --- assets/scripts/ingame_menu.gd | 8 +++++--- assets/scripts/main_menu.gd | 5 ++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/assets/scripts/ingame_menu.gd b/assets/scripts/ingame_menu.gd index ee272db..6b14643 100644 --- a/assets/scripts/ingame_menu.gd +++ b/assets/scripts/ingame_menu.gd @@ -9,6 +9,11 @@ onready var button_resume = $VBoxContainer/ButtonResume var cannot_close = false +func _ready(): + if OS.get_name() == "HTML5": + $VBoxContainer/ButtonQuit.set_disabled(true) + + func _input(_event): if Input.is_action_just_pressed("ui_cancel") and not cannot_close: if visible: @@ -28,9 +33,6 @@ func _on_ButtonResume_pressed(): func _on_ButtonQuit_pressed(): get_tree().quit() - - if OS.has_feature('JavaScript'): - JavaScript.eval("window.close()") func _on_ButtonRestart_pressed(): diff --git a/assets/scripts/main_menu.gd b/assets/scripts/main_menu.gd index 7236502..20b2ac8 100644 --- a/assets/scripts/main_menu.gd +++ b/assets/scripts/main_menu.gd @@ -5,6 +5,8 @@ extends Control func _ready(): $VBoxContainer/ButtonStart.grab_focus() + if OS.get_name() == "HTML5": + $VBoxContainer/ButtonQuit.set_disabled(true) func _on_ButtonStart_pressed(): @@ -21,9 +23,6 @@ func _on_ButtonThird_pressed(): func _on_ButtonQuit_pressed(): get_tree().quit() - - if OS.has_feature('JavaScript'): - JavaScript.eval("window.close()") func _on_ButtonFullscreen_pressed():