From 2c2ee99cf2d304ec28eed8560860267e95ee9017 Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Fri, 21 Apr 2023 20:53:42 -0400 Subject: Refurbish UI elements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move GameSession MusicPlayer to below OptionsMenu Ensures the MusicPlayer appears above the OptionsMenu Add Save and Quit/Resign to GameSessionMenu resign/quit popup To allow the player to save and resign/quit more quicker Remove GameSessionMenu hide on OptionsMenu open Renamed many UI elements to better reflect their purpose Add SessionButton theme_type_variation to GameSession buttons Add SessionButton style similar to TitleButton Disable 3D for dialog windows Change _play_pause_display_button pause text to "⏸ " Change IncreaseSpeedButton text to + Change DecreaseSpeedButton text to - Change Minimap NinePatch frame to function like a nine patch Rename actions map_zoomin and map_zoomout to map_zoom_in and map_zoom_out Change ProvinceOverviewPanel to a PanelContainer Reorganize ProvinceOverviewPanel to better use container functionality Optimize MusicPlayer Enables one line support for MusicPlayer Add warning to StyleBoxWithSound to avoid UI elements with toggle functionality --- game/src/GameSession/GameSessionMenu.gd | 48 ++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'game/src/GameSession/GameSessionMenu.gd') diff --git a/game/src/GameSession/GameSessionMenu.gd b/game/src/GameSession/GameSessionMenu.gd index 7d785ca..70a1630 100644 --- a/game/src/GameSession/GameSessionMenu.gd +++ b/game/src/GameSession/GameSessionMenu.gd @@ -2,8 +2,45 @@ extends PanelContainer @export var _main_menu_scene : PackedScene +@export var _main_menu_dialog : AcceptDialog +@export var _quit_dialog : AcceptDialog + +var _main_menu_save_button : Button +var _main_menu_save_separator : Control +var _quit_save_button : Button +var _quit_save_separator : Control + signal options_button_pressed +func _ready() -> void: + _main_menu_save_button = _main_menu_dialog.add_button("DIALOG_SAVE_AND_RESIGN", true, &"save_and_main_menu") + _quit_save_button = _quit_dialog.add_button("DIALOG_SAVE_AND_QUIT", true, &"save_and_quit") + + # Neccessary to center the save buttons and preserve the reference to the separator elements + var dialog_hbox : HBoxContainer = _main_menu_dialog.get_child(2, true) + var index := _main_menu_save_button.get_index(true) + dialog_hbox.move_child(_main_menu_save_button, _main_menu_dialog.get_ok_button().get_index(true)) + dialog_hbox.move_child(_main_menu_dialog.get_ok_button(), index) + _main_menu_save_separator = dialog_hbox.get_child(_main_menu_save_button.get_index(true) - 1) + + dialog_hbox = _quit_dialog.get_child(2, true) + index = _quit_save_button.get_index(true) + dialog_hbox.move_child(_quit_save_button, _quit_dialog.get_ok_button().get_index(true)) + dialog_hbox.move_child(_quit_dialog.get_ok_button(), index) + _quit_save_separator = dialog_hbox.get_child(_quit_save_button.get_index(true) - 1) + +func hide_save_dialog_button() -> void: + _main_menu_save_button.hide() + _main_menu_save_separator.hide() + _quit_save_button.hide() + _quit_save_separator.hide() + +func show_save_dialog_button() -> void: + _main_menu_save_button.show() + _main_menu_save_separator.show() + _quit_save_button.show() + _quit_save_separator.show() + # REQUIREMENTS: # * SS-47 # * UIFUN-69 @@ -21,5 +58,14 @@ func _on_quit_confirmed() -> void: # * SS-7, SS-46 # * UIFUN-11 func _on_options_button_pressed() -> void: - hide() options_button_pressed.emit() + +func _on_main_menu_dialog_custom_action(action) -> void: + match action: + &"save_and_main_menu": + _on_main_menu_confirmed() + +func _on_quit_dialog_custom_action(action : StringName) -> void: + match action: + &"save_and_quit": + _on_quit_confirmed() -- cgit v1.2.3-56-ga3b1