Adds default crash popup, if game.gd doesn't reimplement it (#449)
This commit is contained in:
@@ -310,5 +310,25 @@ func hide_main_menu():
|
|||||||
|
|
||||||
|
|
||||||
# Shows the crash popup when a crash occurs
|
# Shows the crash popup when a crash occurs
|
||||||
func show_crash_popup() -> void:
|
#
|
||||||
pass
|
# #### Parameters
|
||||||
|
#
|
||||||
|
# - files: Array of strings containing the paths to the files generated on crash
|
||||||
|
func show_crash_popup(files: Array = []) -> void:
|
||||||
|
connect("crash_popup_confirmed", escoria, "quit",
|
||||||
|
[], CONNECT_ONESHOT)
|
||||||
|
var crash_popup = AcceptDialog.new()
|
||||||
|
crash_popup.popup_exclusive = true
|
||||||
|
crash_popup.pause_mode = Node.PAUSE_MODE_PROCESS
|
||||||
|
add_child(crash_popup)
|
||||||
|
var files_to_send: String = ""
|
||||||
|
for file in files:
|
||||||
|
files_to_send += "- %s\n" % file
|
||||||
|
crash_popup.dialog_text = tr(ProjectSettings.get_setting(
|
||||||
|
"escoria/debug/crash_message")
|
||||||
|
) % files_to_send
|
||||||
|
crash_popup.popup_centered()
|
||||||
|
escoria.set_game_paused(true)
|
||||||
|
yield(crash_popup, "confirmed")
|
||||||
|
emit_signal("crash_popup_confirmed")
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ func warning(string: String, args = []):
|
|||||||
) % files
|
) % files
|
||||||
|
|
||||||
_log(message, true)
|
_log(message, true)
|
||||||
|
escoria.set_game_paused(true)
|
||||||
escoria.main.current_scene.game.show_crash_popup(
|
escoria.main.current_scene.game.show_crash_popup(
|
||||||
[log_file.get_path_absolute()]
|
[log_file.get_path_absolute()]
|
||||||
)
|
)
|
||||||
@@ -153,7 +153,7 @@ func error(string: String, args = [], do_savegame: bool = true):
|
|||||||
) % files
|
) % files
|
||||||
|
|
||||||
_log(message, true)
|
_log(message, true)
|
||||||
|
escoria.set_game_paused(true)
|
||||||
escoria.main.current_scene.game.show_crash_popup(files_to_send)
|
escoria.main.current_scene.game.show_crash_popup(files_to_send)
|
||||||
assert(false)
|
assert(false)
|
||||||
|
|
||||||
|
|||||||
@@ -161,4 +161,3 @@ func check_game_scene_methods():
|
|||||||
assert(current_scene.game.has_method("show_ui"))
|
assert(current_scene.game.has_method("show_ui"))
|
||||||
assert(current_scene.game.has_method("_on_event_done"))
|
assert(current_scene.game.has_method("_on_event_done"))
|
||||||
|
|
||||||
assert(current_scene.game.has_method("show_crash_popup"))
|
|
||||||
|
|||||||
@@ -233,22 +233,3 @@ func _on_MenuButton_pressed() -> void:
|
|||||||
|
|
||||||
func _on_action_finished() -> void:
|
func _on_action_finished() -> void:
|
||||||
verbs_menu.unselect_actions()
|
verbs_menu.unselect_actions()
|
||||||
|
|
||||||
|
|
||||||
func show_crash_popup(files = []) -> void:
|
|
||||||
connect("crash_popup_confirmed", escoria, "quit",
|
|
||||||
[], CONNECT_ONESHOT)
|
|
||||||
var crash_popup = AcceptDialog.new()
|
|
||||||
crash_popup.popup_exclusive = true
|
|
||||||
crash_popup.pause_mode = Node.PAUSE_MODE_PROCESS
|
|
||||||
add_child(crash_popup)
|
|
||||||
var files_to_send: String = ""
|
|
||||||
for file in files:
|
|
||||||
files_to_send += "- %s\n" % file
|
|
||||||
crash_popup.dialog_text = tr(ProjectSettings.get_setting(
|
|
||||||
"escoria/debug/crash_message")
|
|
||||||
) % files_to_send
|
|
||||||
crash_popup.popup_centered()
|
|
||||||
escoria.set_game_paused(true)
|
|
||||||
yield(crash_popup, "confirmed")
|
|
||||||
emit_signal("crash_popup_confirmed")
|
|
||||||
|
|||||||
@@ -209,22 +209,3 @@ func _on_action_finished():
|
|||||||
|
|
||||||
func _on_MenuButton_pressed() -> void:
|
func _on_MenuButton_pressed() -> void:
|
||||||
pause_game()
|
pause_game()
|
||||||
|
|
||||||
|
|
||||||
func show_crash_popup(files = []) -> void:
|
|
||||||
connect("crash_popup_confirmed", escoria, "quit",
|
|
||||||
[], CONNECT_ONESHOT)
|
|
||||||
var crash_popup = AcceptDialog.new()
|
|
||||||
crash_popup.popup_exclusive = true
|
|
||||||
crash_popup.pause_mode = Node.PAUSE_MODE_PROCESS
|
|
||||||
add_child(crash_popup)
|
|
||||||
var files_to_send: String = ""
|
|
||||||
for file in files:
|
|
||||||
files_to_send += "- %s\n" % file
|
|
||||||
crash_popup.dialog_text = tr(ProjectSettings.get_setting(
|
|
||||||
"escoria/debug/crash_message")
|
|
||||||
) % files_to_send
|
|
||||||
crash_popup.popup_centered()
|
|
||||||
escoria.set_game_paused(true)
|
|
||||||
yield(crash_popup, "confirmed")
|
|
||||||
emit_signal("crash_popup_confirmed")
|
|
||||||
|
|||||||
Reference in New Issue
Block a user