diff options
author | George L. Albany <Megacake1234@gmail.com> | 2023-06-04 02:17:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-04 02:17:28 +0200 |
commit | 3236f51d700674aee6ee6572109ffb3d5fa5fed2 (patch) | |
tree | b898150a8a45e7c0d814459e7f12f39429acefeb /game/src/Game/Menu/OptionMenu/ResolutionRevertDialog.gd | |
parent | 73e29d02e48739aba5ca5db1b9575c67e795400f (diff) | |
parent | b98166b28c47cccff731d30959b8250fb27ff408 (diff) |
Merge pull request #130 from Spartan322/organize/godot-project
Diffstat (limited to 'game/src/Game/Menu/OptionMenu/ResolutionRevertDialog.gd')
-rw-r--r-- | game/src/Game/Menu/OptionMenu/ResolutionRevertDialog.gd | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/game/src/Game/Menu/OptionMenu/ResolutionRevertDialog.gd b/game/src/Game/Menu/OptionMenu/ResolutionRevertDialog.gd new file mode 100644 index 0000000..4d2b8f2 --- /dev/null +++ b/game/src/Game/Menu/OptionMenu/ResolutionRevertDialog.gd @@ -0,0 +1,35 @@ +extends ConfirmationDialog +class_name ResolutionRevertDialog + +signal dialog_accepted(button : SettingRevertButton) +signal dialog_reverted(button : SettingRevertButton) + +@export_group("Nodes") +@export var timer : Timer + +var _revert_node : SettingRevertButton = null + +func show_dialog(button : SettingRevertButton, time : float = 0) -> void: + timer.start(time) + popup_centered(Vector2(1,1)) + _revert_node = button + +func _notification(what): + if what == NOTIFICATION_VISIBILITY_CHANGED: + set_process(visible) + if not visible: _revert_node = null + +func _process(_delta) -> void: + dialog_text = tr("OPTIONS_VIDEO_RESOLUTION_DIALOG_TEXT").format({ "time": int(timer.time_left) }) + +func _on_canceled_or_close_requested() -> void: + timer.stop() + dialog_reverted.emit(_revert_node) + +func _on_confirmed() -> void: + timer.stop() + dialog_accepted.emit(_revert_node) + +func _on_resolution_revert_timer_timeout() -> void: + dialog_reverted.emit(_revert_node) + hide() |