From 21aeaadf332d1a0d874f2c3850944fbdc6e64ff1 Mon Sep 17 00:00:00 2001 From: Hop311 Date: Fri, 7 Apr 2023 15:29:09 +0100 Subject: Logo on Mainmenu + icon imports + whitespace cleanup (#82) * Whitespace cleanup * Icon import files * Logo on main menu. --- game/src/MainMenu/MainMenu.tscn | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'game/src/MainMenu') diff --git a/game/src/MainMenu/MainMenu.tscn b/game/src/MainMenu/MainMenu.tscn index 5fb6ca9..a10fa27 100644 --- a/game/src/MainMenu/MainMenu.tscn +++ b/game/src/MainMenu/MainMenu.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=5 format=3 uid="uid://bp5n3mlu45ygw"] +[gd_scene load_steps=6 format=3 uid="uid://bp5n3mlu45ygw"] [ext_resource type="Theme" uid="uid://qoi3oec48jp0" path="res://theme/main_menu.tres" id="1_1yri4"] [ext_resource type="Script" path="res://src/MainMenu/MainMenu.gd" id="2_nm1fq"] +[ext_resource type="Texture2D" uid="uid://dxys0wg0f0ic5" path="res://theme/assets/OpenVicFINALREALTRANS.png" id="3_58ess"] [ext_resource type="PackedScene" uid="uid://b7oncobnacxmt" path="res://src/LocaleButton.tscn" id="3_amonp"] [ext_resource type="PackedScene" uid="uid://cen7wkmn6og66" path="res://src/MainMenu/ReleaseInfoBox.tscn" id="3_km0er"] @@ -29,14 +30,13 @@ theme_type_variation = &"BackgroundPanel" [node name="VBox" type="VBoxContainer" parent="Panel"] layout_mode = 2 -[node name="TitleLabel" type="Label" parent="Panel/VBox"] +[node name="TextureRect" type="TextureRect" parent="Panel/VBox"] layout_mode = 2 -size_flags_vertical = 6 -size_flags_stretch_ratio = 1.5 -theme_type_variation = &"TitleLabel" -text = "MAINMENU_TITLE" -horizontal_alignment = 1 -vertical_alignment = 1 +size_flags_vertical = 3 +size_flags_stretch_ratio = 1.75 +texture = ExtResource("3_58ess") +expand_mode = 1 +stretch_mode = 5 [node name="Margin" type="MarginContainer" parent="Panel/VBox"] layout_mode = 2 -- cgit v1.2.3-56-ga3b1 From 04b213d4e20ca4e7ea66b059329771f6fd36c650 Mon Sep 17 00:00:00 2001 From: ClarkeCode Date: Fri, 14 Apr 2023 23:41:57 -0400 Subject: Removing TestSingleton Extracted game advancement behaviour to separate class --- extension/src/Simulation.cpp | 64 ------------------------ extension/src/Simulation.hpp | 68 ------------------------- extension/src/TestSingleton.cpp | 36 -------------- extension/src/TestSingleton.hpp | 23 --------- extension/src/openvic2/GameAdvancementHook.cpp | 69 ++++++++++++++++++++++++++ extension/src/openvic2/GameAdvancementHook.hpp | 40 +++++++++++++++ extension/src/register_types.cpp | 20 -------- game/src/MainMenu/MainMenu.gd | 2 - 8 files changed, 109 insertions(+), 213 deletions(-) delete mode 100644 extension/src/Simulation.cpp delete mode 100644 extension/src/Simulation.hpp delete mode 100644 extension/src/TestSingleton.cpp delete mode 100644 extension/src/TestSingleton.hpp create mode 100644 extension/src/openvic2/GameAdvancementHook.cpp create mode 100644 extension/src/openvic2/GameAdvancementHook.hpp (limited to 'game/src/MainMenu') diff --git a/extension/src/Simulation.cpp b/extension/src/Simulation.cpp deleted file mode 100644 index 5ea99c5..0000000 --- a/extension/src/Simulation.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "Simulation.hpp" - -namespace OpenVic2 { - void Simulation::togglePauseState() { - this->isPaused = !isPaused; - } - - bool Simulation::getPauseState() { - return this->isPaused; - } - - void Simulation::increaseSimulationSpeed() { - switch (this->currentSpeed) { - case(Speed::Speed1): - this->currentSpeed = Speed::Speed2; - break; - case(Speed::Speed2): - this->currentSpeed = Speed::Speed3; - break; - case(Speed::Speed3): - this->currentSpeed = Speed::Speed4; - break; - case(Speed::Speed4): - this->currentSpeed = Speed::Speed5; - break; - } - } - - void Simulation::decreaseSimulationSpeed() { - switch (this->currentSpeed) { - case(Speed::Speed2): - this->currentSpeed = Speed::Speed1; - break; - case(Speed::Speed3): - this->currentSpeed = Speed::Speed2; - break; - case(Speed::Speed4): - this->currentSpeed = Speed::Speed3; - break; - case(Speed::Speed5): - this->currentSpeed = Speed::Speed4; - break; - } - } - - void Simulation::setSimulationSpeed(Speed speed) { - this->currentSpeed = speed; - } - - int Simulation::getSimulationSpeed() { - return static_cast(this->currentSpeed); - } - - void Simulation::conditionallyAdvanceSimulation() { - if (!(this->isPaused)) { - std::chrono::time_point previousTime = this->lastPolledTime; - std::chrono::time_point currentTime = std::chrono::high_resolution_clock::now(); - if (std::chrono::duration_cast(currentTime - previousTime).count() >= this->getSimulationSpeed()) { - this->lastPolledTime = currentTime; - this->inGameDate++; - } - } - } -} diff --git a/extension/src/Simulation.hpp b/extension/src/Simulation.hpp deleted file mode 100644 index 58ba7c7..0000000 --- a/extension/src/Simulation.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -#include -#include -#include -#include "openvic2/Date.hpp" - -namespace OpenVic2 { - class Simulation : public godot::Object { - GDCLASS(Simulation, godot::Object) - std::vector exampleProvinces; - - enum class Speed { Speed1 = 4000, Speed2 = 3000, Speed3 = 2000, Speed4 = 1000, Speed5 = 100, Speed6 = 1 }; - - std::chrono::time_point lastPolledTime; - bool isPaused; - Speed currentSpeed; - Date inGameDate; - - //BEGIN BOILERPLATE - inline static Simulation* _simulation = nullptr; - - protected: - static void _bind_methods() { - godot::ClassDB::bind_method(godot::D_METHOD("conductSimulationStep"), &Simulation::conductSimulationStep); - godot::ClassDB::bind_method(godot::D_METHOD("queryProvinceSize"), &Simulation::queryProvinceSize); - } - - public: - inline static Simulation* get_singleton() { return _simulation; } - - inline Simulation() : inGameDate(1836, 1, 1) { - ERR_FAIL_COND(_simulation != nullptr); - _simulation = this; - this->lastPolledTime = std::chrono::high_resolution_clock::now(); - this->isPaused = false; - this->currentSpeed = Speed::Speed1; - exampleProvinces.resize(10, 1); - } - inline ~Simulation() { - ERR_FAIL_COND(_simulation != this); - _simulation = nullptr; - } - //END BOILERPLATE - - void togglePauseState(); - bool getPauseState(); - void increaseSimulationSpeed(); - void decreaseSimulationSpeed(); - void setSimulationSpeed(Speed speed); - int getSimulationSpeed(); - - inline void conductSimulationStep() { - for (uint64_t x = 0; x < exampleProvinces.size(); x++) { - exampleProvinces[x] += (x + 1); - } - } - - inline uint64_t queryProvinceSize(uint64_t provinceID) { - if (provinceID >= exampleProvinces.size()) { - return 0; - } - return exampleProvinces[provinceID]; - } - - void conditionallyAdvanceSimulation(); - }; -} \ No newline at end of file diff --git a/extension/src/TestSingleton.cpp b/extension/src/TestSingleton.cpp deleted file mode 100644 index d9e2b03..0000000 --- a/extension/src/TestSingleton.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "TestSingleton.hpp" - -#include -#include - -using namespace godot; -using namespace OpenVic2; - -TestSingleton* TestSingleton::singleton = nullptr; - -void TestSingleton::_bind_methods() -{ - ClassDB::bind_method(D_METHOD("hello_singleton"), &TestSingleton::hello_singleton); -} - -TestSingleton* TestSingleton::get_singleton() -{ - return singleton; -} - -TestSingleton::TestSingleton() -{ - ERR_FAIL_COND(singleton != nullptr); - singleton = this; -} - -TestSingleton::~TestSingleton() -{ - ERR_FAIL_COND(singleton != this); - singleton = nullptr; -} - -void TestSingleton::hello_singleton() -{ - UtilityFunctions::print("Hello GDExtension Singleton!"); -} \ No newline at end of file diff --git a/extension/src/TestSingleton.hpp b/extension/src/TestSingleton.hpp deleted file mode 100644 index 1261573..0000000 --- a/extension/src/TestSingleton.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include - -namespace OpenVic2 { - class TestSingleton : public godot::Object - { - GDCLASS(TestSingleton, godot::Object) - - static TestSingleton* singleton; - - protected: - static void _bind_methods(); - - public: - static TestSingleton* get_singleton(); - - TestSingleton(); - ~TestSingleton(); - - void hello_singleton(); - }; -} \ No newline at end of file diff --git a/extension/src/openvic2/GameAdvancementHook.cpp b/extension/src/openvic2/GameAdvancementHook.cpp new file mode 100644 index 0000000..3db3224 --- /dev/null +++ b/extension/src/openvic2/GameAdvancementHook.cpp @@ -0,0 +1,69 @@ +#include "GameAdvancementHook.hpp" + +namespace OpenVic2 { + GameAdvancementHook::GameAdvancementHook(AdvancementFunction function, bool startPaused, GameSpeed startingSpeed) { + triggerFunction = function; + lastPolledTime = std::chrono::high_resolution_clock::now(); + isPaused = startPaused; + currentSpeed = startingSpeed; + } + + void GameAdvancementHook::increaseSimulationSpeed() { + switch (currentSpeed) { + case(GameSpeed::Speed1): + currentSpeed = GameSpeed::Speed2; + break; + case(GameSpeed::Speed2): + currentSpeed = GameSpeed::Speed3; + break; + case(GameSpeed::Speed3): + currentSpeed = GameSpeed::Speed4; + break; + case(GameSpeed::Speed4): + currentSpeed = GameSpeed::Speed5; + break; + } + } + + void GameAdvancementHook::decreaseSimulationSpeed() { + switch (currentSpeed) { + case(GameSpeed::Speed2): + currentSpeed = GameSpeed::Speed1; + break; + case(GameSpeed::Speed3): + currentSpeed = GameSpeed::Speed2; + break; + case(GameSpeed::Speed4): + currentSpeed = GameSpeed::Speed3; + break; + case(GameSpeed::Speed5): + currentSpeed = GameSpeed::Speed4; + break; + } + } + + GameAdvancementHook GameAdvancementHook::operator++(int) { + GameAdvancementHook oldCopy = *this; + increaseSimulationSpeed(); + return oldCopy; + }; + + GameAdvancementHook GameAdvancementHook::operator--(int) { + GameAdvancementHook oldCopy = *this; + decreaseSimulationSpeed(); + return oldCopy; + }; + + void GameAdvancementHook::conditionallyAdvanceGame() { + if (!isPaused) { + std::chrono::time_point previousTime = lastPolledTime; + std::chrono::time_point currentTime = std::chrono::high_resolution_clock::now(); + if (std::chrono::duration_cast(currentTime - previousTime).count() >= static_cast(currentSpeed)) { + lastPolledTime = currentTime; + if (triggerFunction) { + triggerFunction(); + } + } + } + } +} \ No newline at end of file diff --git a/extension/src/openvic2/GameAdvancementHook.hpp b/extension/src/openvic2/GameAdvancementHook.hpp new file mode 100644 index 0000000..72af4ac --- /dev/null +++ b/extension/src/openvic2/GameAdvancementHook.hpp @@ -0,0 +1,40 @@ +#pragma once + +#include +#include + +namespace OpenVic2 { + //Value of different game speeds are the minimum number of miliseconds before the simulation advances + enum class GameSpeed { + Speed1 = 4000, + Speed2 = 3000, + Speed3 = 2000, + Speed4 = 1000, + Speed5 = 100, + Speed6 = 1 + }; + + //Conditionally advances game with provided behaviour + //Class governs game speed and pause state + class GameAdvancementHook { + public: + using AdvancementFunction = std::function; + + private: + std::chrono::time_point lastPolledTime; + //A function pointer that advances the simulation, intended to be a capturing lambda or something similar. May need to be reworked later + AdvancementFunction triggerFunction; + + public: + bool isPaused; + GameSpeed currentSpeed; + + GameAdvancementHook(AdvancementFunction function = nullptr, bool startPaused = false, GameSpeed startingSpeed = GameSpeed::Speed1); + + void increaseSimulationSpeed(); + void decreaseSimulationSpeed(); + GameAdvancementHook operator++(int); + GameAdvancementHook operator--(int); + void conditionallyAdvanceGame(); + }; +} \ No newline at end of file diff --git a/extension/src/register_types.cpp b/extension/src/register_types.cpp index 9fd934e..10ed781 100644 --- a/extension/src/register_types.cpp +++ b/extension/src/register_types.cpp @@ -2,8 +2,6 @@ #include -#include "TestSingleton.hpp" -#include "Simulation.hpp" #include "Checksum.hpp" #include "LoadLocalisation.hpp" #include "MapSingleton.hpp" @@ -12,8 +10,6 @@ using namespace godot; using namespace OpenVic2; -static TestSingleton* _test_singleton; -static Simulation* _simulation; static Checksum* _checksum; static LoadLocalisation* _load_localisation; static MapSingleton* _map_singleton; @@ -23,14 +19,6 @@ void initialize_openvic2_types(ModuleInitializationLevel p_level) { return; } - ClassDB::register_class(); - _test_singleton = memnew(TestSingleton); - Engine::get_singleton()->register_singleton("TestSingleton", TestSingleton::get_singleton()); - - ClassDB::register_class(); - _simulation = memnew(Simulation); - Engine::get_singleton()->register_singleton("Simulation", Simulation::get_singleton()); - ClassDB::register_class(); _checksum = memnew(Checksum); Engine::get_singleton()->register_singleton("Checksum", Checksum::get_singleton()); @@ -51,12 +39,6 @@ void uninitialize_openvic2_types(ModuleInitializationLevel p_level) { return; } - Engine::get_singleton()->unregister_singleton("TestSingleton"); - memdelete(_test_singleton); - - Engine::get_singleton()->unregister_singleton("Simulation"); - memdelete(_simulation); - Engine::get_singleton()->unregister_singleton("Checksum"); memdelete(_checksum); @@ -68,9 +50,7 @@ void uninitialize_openvic2_types(ModuleInitializationLevel p_level) { } extern "C" { - // Initialization. - GDExtensionBool GDE_EXPORT openvic2_library_init(GDExtensionInterface const* p_interface, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization* r_initialization) { GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization); diff --git a/game/src/MainMenu/MainMenu.gd b/game/src/MainMenu/MainMenu.gd index 4420786..9d0edc6 100644 --- a/game/src/MainMenu/MainMenu.gd +++ b/game/src/MainMenu/MainMenu.gd @@ -10,8 +10,6 @@ var _new_game_button : BaseButton # REQUIREMENTS: # * SS-3 func _ready(): - print("From GDScript") - TestSingleton.hello_singleton() _on_new_game_button_visibility_changed() # REQUIREMENTS: -- cgit v1.2.3-56-ga3b1 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/localisation/en_GB/menus.csv | 2 + game/project.godot | 4 +- game/src/GameMenu.tscn | 1 - game/src/GameSession/GameSession.tscn | 24 +++---- game/src/GameSession/GameSessionMenu.gd | 48 +++++++++++++- game/src/GameSession/GameSessionMenu.tscn | 48 +++++++++----- game/src/GameSession/GameSpeedPanel.gd | 2 +- game/src/GameSession/GameSpeedPanel.tscn | 32 +++++----- game/src/GameSession/MapControlPanel.tscn | 51 ++++++++------- game/src/GameSession/MapView.gd | 8 +-- game/src/GameSession/ProvinceOverviewPanel.gd | 2 +- game/src/GameSession/ProvinceOverviewPanel.tscn | 59 ++++++++--------- game/src/MainMenu/MainMenu.tscn | 46 +++++++------- game/src/MusicConductor/MusicPlayer.tscn | 54 ++++++++-------- game/src/Utility/StyleBoxWithSound.gd | 1 + game/theme/game_session_menu.tres | 84 +++++++++++++++++++++++++ game/theme/main_menu.tres | 6 +- 17 files changed, 317 insertions(+), 155 deletions(-) create mode 100644 game/theme/game_session_menu.tres (limited to 'game/src/MainMenu') diff --git a/game/localisation/en_GB/menus.csv b/game/localisation/en_GB/menus.csv index c637a39..0009acd 100644 --- a/game/localisation/en_GB/menus.csv +++ b/game/localisation/en_GB/menus.csv @@ -63,6 +63,8 @@ GAMESESSIONMENU_QUIT_DIALOG_TEXT,Are you sure you want to quit and return to des DIALOG_OK,OK DIALOG_CANCEL,Cancel +DIALOG_SAVE_AND_RESIGN,Save and Resign +DIALOG_SAVE_AND_QUIT,Save and Quit ,, Province Overview Panel province_MISSING,No Province diff --git a/game/project.godot b/game/project.godot index fa2871f..ff4081e 100644 --- a/game/project.godot +++ b/game/project.godot @@ -70,13 +70,13 @@ map_west={ , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":65,"physical_keycode":0,"key_label":0,"unicode":97,"echo":false,"script":null) ] } -map_zoomin={ +map_zoom_in={ "deadzone": 0.5, "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":8,"position":Vector2(174, 17),"global_position":Vector2(180, 80),"factor":1.0,"button_index":4,"pressed":true,"double_click":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":81,"physical_keycode":0,"key_label":0,"unicode":113,"echo":false,"script":null) ] } -map_zoomout={ +map_zoom_out={ "deadzone": 0.5, "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(325, 24),"global_position":Vector2(331, 87),"factor":1.0,"button_index":5,"pressed":true,"double_click":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":69,"physical_keycode":0,"key_label":0,"unicode":101,"echo":false,"script":null) diff --git a/game/src/GameMenu.tscn b/game/src/GameMenu.tscn index aabb29c..c642351 100644 --- a/game/src/GameMenu.tscn +++ b/game/src/GameMenu.tscn @@ -43,7 +43,6 @@ anchor_left = 1.0 anchor_right = 1.0 offset_left = -184.0 offset_right = -34.0 -offset_bottom = 110.0 grow_horizontal = 0 [connection signal="credits_button_pressed" from="MainMenu" to="." method="_on_main_menu_credits_button_pressed"] diff --git a/game/src/GameSession/GameSession.tscn b/game/src/GameSession/GameSession.tscn index 8a8b18c..b993acf 100644 --- a/game/src/GameSession/GameSession.tscn +++ b/game/src/GameSession/GameSession.tscn @@ -21,15 +21,6 @@ mouse_filter = 2 script = ExtResource("1_eklvp") _game_session_menu = NodePath("GameSessionMenu") -[node name="MusicPlayer" parent="." instance=ExtResource("2_kt6aa")] -layout_mode = 1 -anchors_preset = 1 -anchor_left = 1.0 -anchor_right = 1.0 -offset_left = -150.0 -offset_bottom = 110.0 -grow_horizontal = 0 - [node name="MapView" parent="." instance=ExtResource("4_xkg5j")] [node name="GameSessionMenu" parent="." instance=ExtResource("3_bvmqh")] @@ -56,12 +47,23 @@ grow_vertical = 0 [node name="ProvinceOverviewPanel" parent="." instance=ExtResource("5_osjnn")] layout_mode = 1 +[node name="GameSpeedPanel" parent="." instance=ExtResource("7_myy4q")] +layout_mode = 0 +offset_right = 302.0 +offset_bottom = 31.0 + [node name="OptionsMenu" parent="." instance=ExtResource("6_p5mnx")] visible = false layout_mode = 1 -[node name="GameSpeedPanel" parent="." instance=ExtResource("7_myy4q")] -layout_mode = 0 +[node name="MusicPlayer" parent="." instance=ExtResource("2_kt6aa")] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -150.0 +offset_right = 0.0 +grow_horizontal = 0 [connection signal="map_view_camera_changed" from="MapView" to="MapControlPanel" method="_on_map_view_camera_changed"] [connection signal="province_selected" from="MapView" to="ProvinceOverviewPanel" method="_on_province_selected"] 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() diff --git a/game/src/GameSession/GameSessionMenu.tscn b/game/src/GameSession/GameSessionMenu.tscn index a753184..99f38df 100644 --- a/game/src/GameSession/GameSessionMenu.tscn +++ b/game/src/GameSession/GameSessionMenu.tscn @@ -1,71 +1,89 @@ -[gd_scene load_steps=3 format=3 uid="uid://dvdynl6eir40o"] +[gd_scene load_steps=4 format=3 uid="uid://dvdynl6eir40o"] +[ext_resource type="Theme" uid="uid://dndova5cw036e" path="res://theme/game_session_menu.tres" id="1_2onog"] [ext_resource type="Script" path="res://src/GameSession/GameSessionMenu.gd" id="1_usq6o"] [ext_resource type="PackedScene" uid="uid://o4u142w4qkln" path="res://src/GameMenu.tscn" id="2_xi6a4"] -[node name="GameSessionMenu" type="PanelContainer"] +[node name="GameSessionMenu" type="PanelContainer" node_paths=PackedStringArray("_main_menu_dialog", "_quit_dialog")] +process_mode = 3 editor_description = "UI-68" +theme = ExtResource("1_2onog") +theme_type_variation = &"SessionPanel" script = ExtResource("1_usq6o") _main_menu_scene = ExtResource("2_xi6a4") +_main_menu_dialog = NodePath("MainMenuDialog") +_quit_dialog = NodePath("QuitDialog") -[node name="MarginContainer" type="MarginContainer" parent="."] +[node name="ButtonListMargin" type="MarginContainer" parent="."] layout_mode = 2 theme_override_constants/margin_left = 10 theme_override_constants/margin_top = 10 theme_override_constants/margin_right = 10 theme_override_constants/margin_bottom = 10 -[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] +[node name="ButtonList" type="VBoxContainer" parent="ButtonListMargin"] layout_mode = 2 -[node name="SaveButton" type="Button" parent="MarginContainer/VBoxContainer"] +[node name="SaveButton" type="Button" parent="ButtonListMargin/ButtonList"] editor_description = "UI-69" layout_mode = 2 +theme_type_variation = &"SessionButton" text = "GAMESESSIONMENU_SAVE" -[node name="LoadButton" type="Button" parent="MarginContainer/VBoxContainer"] +[node name="LoadButton" type="Button" parent="ButtonListMargin/ButtonList"] editor_description = "UI-70" layout_mode = 2 +theme_type_variation = &"SessionButton" text = "GAMESESSIONMENU_LOAD" -[node name="OptionsButton" type="Button" parent="MarginContainer/VBoxContainer"] +[node name="OptionsButton" type="Button" parent="ButtonListMargin/ButtonList"] editor_description = "UI-10" layout_mode = 2 +theme_type_variation = &"SessionButton" text = "GAMESESSIONMENU_OPTIONS" -[node name="MainMenuButton" type="Button" parent="MarginContainer/VBoxContainer"] +[node name="MainMenuButton" type="Button" parent="ButtonListMargin/ButtonList"] editor_description = "UI-71" layout_mode = 2 +theme_type_variation = &"SessionButton" text = "GAMESESSIONMENU_MAINMENU" -[node name="QuitButton" type="Button" parent="MarginContainer/VBoxContainer"] +[node name="QuitButton" type="Button" parent="ButtonListMargin/ButtonList"] editor_description = "UI-72" layout_mode = 2 +theme_type_variation = &"SessionButton" text = "GAMESESSIONMENU_QUIT" -[node name="HSeparator" type="HSeparator" parent="MarginContainer/VBoxContainer"] +[node name="CloseSeparator" type="HSeparator" parent="ButtonListMargin/ButtonList"] layout_mode = 2 +theme_type_variation = &"SessionSeparator" -[node name="CloseButton" type="Button" parent="MarginContainer/VBoxContainer"] +[node name="CloseButton" type="Button" parent="ButtonListMargin/ButtonList"] editor_description = "SS-64, UI-80, UIFUN-79" layout_mode = 2 +theme_type_variation = &"SessionButton" text = "GAMESESSIONMENU_CLOSE" [node name="MainMenuDialog" type="ConfirmationDialog" parent="."] +disable_3d = true title = "GAMESESSIONMENU_MAINMENU_DIALOG_TITLE" +size = Vector2i(384, 100) ok_button_text = "DIALOG_OK" dialog_text = "GAMESESSIONMENU_MAINMENU_DIALOG_TEXT" cancel_button_text = "DIALOG_CANCEL" [node name="QuitDialog" type="ConfirmationDialog" parent="."] +disable_3d = true title = "GAMESESSIONMENU_QUIT_DIALOG_TITLE" ok_button_text = "DIALOG_OK" dialog_text = "GAMESESSIONMENU_QUIT_DIALOG_TEXT" cancel_button_text = "DIALOG_CANCEL" -[connection signal="pressed" from="MarginContainer/VBoxContainer/OptionsButton" to="." method="_on_options_button_pressed"] -[connection signal="pressed" from="MarginContainer/VBoxContainer/MainMenuButton" to="MainMenuDialog" method="popup_centered"] -[connection signal="pressed" from="MarginContainer/VBoxContainer/QuitButton" to="QuitDialog" method="popup_centered"] -[connection signal="pressed" from="MarginContainer/VBoxContainer/CloseButton" to="." method="hide"] +[connection signal="pressed" from="ButtonListMargin/ButtonList/OptionsButton" to="." method="_on_options_button_pressed"] +[connection signal="pressed" from="ButtonListMargin/ButtonList/MainMenuButton" to="MainMenuDialog" method="popup_centered"] +[connection signal="pressed" from="ButtonListMargin/ButtonList/QuitButton" to="QuitDialog" method="popup_centered"] +[connection signal="pressed" from="ButtonListMargin/ButtonList/CloseButton" to="." method="hide"] [connection signal="confirmed" from="MainMenuDialog" to="." method="_on_main_menu_confirmed"] +[connection signal="custom_action" from="MainMenuDialog" to="." method="_on_main_menu_dialog_custom_action"] [connection signal="confirmed" from="QuitDialog" to="." method="_on_quit_confirmed"] +[connection signal="custom_action" from="QuitDialog" to="." method="_on_quit_dialog_custom_action"] diff --git a/game/src/GameSession/GameSpeedPanel.gd b/game/src/GameSession/GameSpeedPanel.gd index c203032..8b7af29 100644 --- a/game/src/GameSession/GameSpeedPanel.gd +++ b/game/src/GameSession/GameSpeedPanel.gd @@ -13,7 +13,7 @@ func _ready(): _update_buttons() func _update_buttons(): - _play_pause_display_button.text = "⏸️" if GameSingleton.is_paused() else "▶" + _play_pause_display_button.text = "⏸ " if GameSingleton.is_paused() else "▶" _increase_speed_button.disabled = not GameSingleton.can_increase_speed() _decrease_speed_button.disabled = not GameSingleton.can_decrease_speed() diff --git a/game/src/GameSession/GameSpeedPanel.tscn b/game/src/GameSession/GameSpeedPanel.tscn index bfb869c..8a37565 100644 --- a/game/src/GameSession/GameSpeedPanel.tscn +++ b/game/src/GameSession/GameSpeedPanel.tscn @@ -4,35 +4,35 @@ [node name="GameSpeedPanel" type="PanelContainer" node_paths=PackedStringArray("_longform_date_button", "_play_pause_display_button", "_decrease_speed_button", "_increase_speed_button")] script = ExtResource("1_pfs8t") -_longform_date_button = NodePath("HBoxContainer/LongformDateButton") -_play_pause_display_button = NodePath("HBoxContainer/PlayPauseDisplayButton") -_decrease_speed_button = NodePath("HBoxContainer/DecreaseSpeedButton") -_increase_speed_button = NodePath("HBoxContainer/IncreaseSpeedButton") +_longform_date_button = NodePath("ButtonList/LongformDateButton") +_play_pause_display_button = NodePath("ButtonList/PlayPauseDisplayButton") +_decrease_speed_button = NodePath("ButtonList/DecreaseSpeedButton") +_increase_speed_button = NodePath("ButtonList/IncreaseSpeedButton") -[node name="HBoxContainer" type="HBoxContainer" parent="."] +[node name="ButtonList" type="HBoxContainer" parent="."] layout_mode = 2 -[node name="LongformDateButton" type="Button" parent="HBoxContainer"] +[node name="LongformDateButton" type="Button" parent="ButtonList"] custom_minimum_size = Vector2(200, 0) layout_mode = 2 text = "LONGFORM DATE" -[node name="PlayPauseDisplayButton" type="Button" parent="HBoxContainer"] +[node name="PlayPauseDisplayButton" type="Button" parent="ButtonList"] custom_minimum_size = Vector2(30, 0) layout_mode = 2 -text = "⏸" +text = "⏸ " -[node name="DecreaseSpeedButton" type="Button" parent="HBoxContainer"] +[node name="DecreaseSpeedButton" type="Button" parent="ButtonList"] custom_minimum_size = Vector2(30, 0) layout_mode = 2 -text = "➖" +text = "-" -[node name="IncreaseSpeedButton" type="Button" parent="HBoxContainer"] +[node name="IncreaseSpeedButton" type="Button" parent="ButtonList"] custom_minimum_size = Vector2(30, 0) layout_mode = 2 -text = "➕" +text = "+" -[connection signal="pressed" from="HBoxContainer/LongformDateButton" to="." method="_on_longform_date_label_pressed"] -[connection signal="pressed" from="HBoxContainer/PlayPauseDisplayButton" to="." method="_on_play_pause_display_button_pressed"] -[connection signal="pressed" from="HBoxContainer/DecreaseSpeedButton" to="." method="_on_decrease_speed_button_pressed"] -[connection signal="pressed" from="HBoxContainer/IncreaseSpeedButton" to="." method="_on_increase_speed_button_pressed"] +[connection signal="pressed" from="ButtonList/LongformDateButton" to="." method="_on_longform_date_label_pressed"] +[connection signal="pressed" from="ButtonList/PlayPauseDisplayButton" to="." method="_on_play_pause_display_button_pressed"] +[connection signal="pressed" from="ButtonList/DecreaseSpeedButton" to="." method="_on_decrease_speed_button_pressed"] +[connection signal="pressed" from="ButtonList/IncreaseSpeedButton" to="." method="_on_increase_speed_button_pressed"] diff --git a/game/src/GameSession/MapControlPanel.tscn b/game/src/GameSession/MapControlPanel.tscn index 27205e3..18b1c3f 100644 --- a/game/src/GameSession/MapControlPanel.tscn +++ b/game/src/GameSession/MapControlPanel.tscn @@ -15,89 +15,96 @@ events = [SubResource("InputEventAction_5nck3")] editor_description = "SS-103" mouse_filter = 1 script = ExtResource("1_ign64") -_mapmodes_grid = NodePath("MarginContainer/HBoxContainer/VBoxContainer/MapmodesGrid") +_mapmodes_grid = NodePath("MapPanelMargin/MapPanelList/MapDisplayList/MapmodesGrid") -[node name="MarginContainer" type="MarginContainer" parent="."] +[node name="MapPanelMargin" type="MarginContainer" parent="."] layout_mode = 2 theme_override_constants/margin_left = 5 theme_override_constants/margin_top = 5 theme_override_constants/margin_right = 5 theme_override_constants/margin_bottom = 5 -[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"] +[node name="MapPanelList" type="HBoxContainer" parent="MapPanelMargin"] layout_mode = 2 theme_override_constants/separation = 6 alignment = 1 -[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"] +[node name="MapDisplayList" type="VBoxContainer" parent="MapPanelMargin/MapPanelList"] layout_mode = 2 alignment = 1 -[node name="MapmodesGrid" type="GridContainer" parent="MarginContainer/HBoxContainer/VBoxContainer"] +[node name="MapmodesGrid" type="GridContainer" parent="MapPanelMargin/MapPanelList/MapDisplayList"] editor_description = "UI-750" layout_mode = 2 columns = 11 -[node name="Minimap" type="PanelContainer" parent="MarginContainer/HBoxContainer/VBoxContainer"] +[node name="Minimap" type="PanelContainer" parent="MapPanelMargin/MapPanelList/MapDisplayList"] editor_description = "UI-549" layout_mode = 2 mouse_filter = 1 -[node name="TextureRect" type="TextureRect" parent="MarginContainer/HBoxContainer/VBoxContainer/Minimap"] +[node name="MinimapTexture" type="TextureRect" parent="MapPanelMargin/MapPanelList/MapDisplayList/Minimap"] editor_description = "UI-751, FS-338" layout_mode = 2 texture = ExtResource("2_r613r") -[node name="ViewportQuad" type="Control" parent="MarginContainer/HBoxContainer/VBoxContainer/Minimap"] +[node name="ViewportQuad" type="Control" parent="MapPanelMargin/MapPanelList/MapDisplayList/Minimap"] layout_mode = 2 mouse_filter = 2 script = ExtResource("3_s4dml") -[node name="Frame" type="NinePatchRect" parent="MarginContainer/HBoxContainer/VBoxContainer/Minimap"] +[node name="Frame" type="NinePatchRect" parent="MapPanelMargin/MapPanelList/MapDisplayList/Minimap"] layout_mode = 2 texture = ExtResource("4_f1exl") - -[node name="AuxiliaryPanel" type="VBoxContainer" parent="MarginContainer/HBoxContainer"] +draw_center = false +patch_margin_left = 10 +patch_margin_top = 10 +patch_margin_right = 10 +patch_margin_bottom = 10 +axis_stretch_horizontal = 1 +axis_stretch_vertical = 1 + +[node name="AuxiliaryPanel" type="VBoxContainer" parent="MapPanelMargin/MapPanelList"] editor_description = "UI-761" layout_mode = 2 -[node name="GameSessionMenuButton" type="Button" parent="MarginContainer/HBoxContainer/AuxiliaryPanel"] +[node name="GameSessionMenuButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel"] editor_description = "UI-9" layout_mode = 2 mouse_filter = 1 shortcut = SubResource("Shortcut_fc1tk") text = "ESC" -[node name="LedgerButton" type="Button" parent="MarginContainer/HBoxContainer/AuxiliaryPanel"] +[node name="LedgerButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel"] editor_description = "UI-860" layout_mode = 2 mouse_filter = 1 text = "L" -[node name="FindButton" type="Button" parent="MarginContainer/HBoxContainer/AuxiliaryPanel"] +[node name="FindButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel"] editor_description = "UI-861" layout_mode = 2 mouse_filter = 1 text = "F" -[node name="ZoomButtonsContainer" type="HBoxContainer" parent="MarginContainer/HBoxContainer/AuxiliaryPanel"] +[node name="ZoomButtonsContainer" type="HBoxContainer" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel"] layout_mode = 2 alignment = 1 -[node name="ZoomInButton" type="Button" parent="MarginContainer/HBoxContainer/AuxiliaryPanel/ZoomButtonsContainer"] +[node name="ZoomInButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel/ZoomButtonsContainer"] editor_description = "UI-862" layout_mode = 2 mouse_filter = 1 text = "+" -[node name="ZoomOutButton" type="Button" parent="MarginContainer/HBoxContainer/AuxiliaryPanel/ZoomButtonsContainer"] +[node name="ZoomOutButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel/ZoomButtonsContainer"] editor_description = "UI-863" layout_mode = 2 mouse_filter = 1 text = "-" -[connection signal="map_view_camera_changed" from="." to="MarginContainer/HBoxContainer/VBoxContainer/Minimap/ViewportQuad" method="_on_map_view_camera_changed"] -[connection signal="minimap_clicked" from="MarginContainer/HBoxContainer/VBoxContainer/Minimap/ViewportQuad" to="." method="_on_minimap_clicked"] -[connection signal="pressed" from="MarginContainer/HBoxContainer/AuxiliaryPanel/GameSessionMenuButton" to="." method="_on_game_session_menu_button_pressed"] -[connection signal="pressed" from="MarginContainer/HBoxContainer/AuxiliaryPanel/ZoomButtonsContainer/ZoomInButton" to="." method="_on_zoom_in_button_pressed"] -[connection signal="pressed" from="MarginContainer/HBoxContainer/AuxiliaryPanel/ZoomButtonsContainer/ZoomOutButton" to="." method="_on_zoom_out_button_pressed"] +[connection signal="map_view_camera_changed" from="." to="MapPanelMargin/MapPanelList/MapDisplayList/Minimap/ViewportQuad" method="_on_map_view_camera_changed"] +[connection signal="minimap_clicked" from="MapPanelMargin/MapPanelList/MapDisplayList/Minimap/ViewportQuad" to="." method="_on_minimap_clicked"] +[connection signal="pressed" from="MapPanelMargin/MapPanelList/AuxiliaryPanel/GameSessionMenuButton" to="." method="_on_game_session_menu_button_pressed"] +[connection signal="pressed" from="MapPanelMargin/MapPanelList/AuxiliaryPanel/ZoomButtonsContainer/ZoomInButton" to="." method="_on_zoom_in_button_pressed"] +[connection signal="pressed" from="MapPanelMargin/MapPanelList/AuxiliaryPanel/ZoomButtonsContainer/ZoomOutButton" to="." method="_on_zoom_out_button_pressed"] diff --git a/game/src/GameSession/MapView.gd b/game/src/GameSession/MapView.gd index ac060e1..510d70a 100644 --- a/game/src/GameSession/MapView.gd +++ b/game/src/GameSession/MapView.gd @@ -7,8 +7,8 @@ const _action_north : StringName = &"map_north" const _action_east : StringName = &"map_east" const _action_south : StringName = &"map_south" const _action_west : StringName = &"map_west" -const _action_zoomin : StringName = &"map_zoomin" -const _action_zoomout : StringName = &"map_zoomout" +const _action_zoom_in : StringName = &"map_zoom_in" +const _action_zoom_out : StringName = &"map_zoom_out" const _action_drag : StringName = &"map_drag" const _action_click : StringName = &"map_click" @@ -165,9 +165,9 @@ func _unhandled_input(event : InputEvent): if not _drag_active: push_warning("Drag being deactivated while already not active!") _drag_active = false - elif event.is_action_pressed(_action_zoomin, true): + elif event.is_action_pressed(_action_zoom_in, true): zoom_in() - elif event.is_action_pressed(_action_zoomout, true): + elif event.is_action_pressed(_action_zoom_out, true): zoom_out() func _physics_process(delta : float): diff --git a/game/src/GameSession/ProvinceOverviewPanel.gd b/game/src/GameSession/ProvinceOverviewPanel.gd index 832f21c..cbab9d0 100644 --- a/game/src/GameSession/ProvinceOverviewPanel.gd +++ b/game/src/GameSession/ProvinceOverviewPanel.gd @@ -1,4 +1,4 @@ -extends Panel +extends PanelContainer @export var _province_name_label : Label @export var _region_name_label : Label diff --git a/game/src/GameSession/ProvinceOverviewPanel.tscn b/game/src/GameSession/ProvinceOverviewPanel.tscn index dacdc4b..7b28cc1 100644 --- a/game/src/GameSession/ProvinceOverviewPanel.tscn +++ b/game/src/GameSession/ProvinceOverviewPanel.tscn @@ -2,7 +2,7 @@ [ext_resource type="Script" path="res://src/GameSession/ProvinceOverviewPanel.gd" id="1_3n8k5"] -[node name="ProvinceOverviewPanel" type="Panel" node_paths=PackedStringArray("_province_name_label", "_region_name_label", "_buildings_container")] +[node name="ProvinceOverviewPanel" type="PanelContainer" node_paths=PackedStringArray("_province_name_label", "_region_name_label", "_buildings_container")] editor_description = "UI-56" anchors_preset = 2 anchor_top = 1.0 @@ -11,47 +11,48 @@ offset_top = -300.0 offset_right = 200.0 grow_vertical = 0 script = ExtResource("1_3n8k5") -_province_name_label = NodePath("VBoxContainer/ProvinceName") -_region_name_label = NodePath("VBoxContainer/RegionName") -_buildings_container = NodePath("VBoxContainer/BuildingsContainer") - -[node name="VBoxContainer" type="VBoxContainer" parent="."] -layout_mode = 1 -anchors_preset = -1 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_left = 10.0 -offset_top = 5.0 -offset_right = -10.0 -offset_bottom = -5.0 +_province_name_label = NodePath("PanelList/TopBarList/NameList/ProvinceName") +_region_name_label = NodePath("PanelList/TopBarList/NameList/RegionName") +_buildings_container = NodePath("PanelList/InteractList/BuildingsContainer") + +[node name="PanelList" type="VBoxContainer" parent="."] +layout_mode = 2 + +[node name="TopBarList" type="HBoxContainer" parent="PanelList"] +layout_mode = 2 + +[node name="NameList" type="VBoxContainer" parent="PanelList/TopBarList"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 0 -[node name="ProvinceName" type="Label" parent="VBoxContainer"] +[node name="ProvinceName" type="Label" parent="PanelList/TopBarList/NameList"] editor_description = "UI-57" layout_mode = 2 text = "province_MISSING" vertical_alignment = 1 -[node name="RegionName" type="Label" parent="VBoxContainer"] +[node name="RegionName" type="Label" parent="PanelList/TopBarList/NameList"] editor_description = "UI-58" layout_mode = 2 text = "region_MISSING" vertical_alignment = 1 -[node name="HSeparator" type="HSeparator" parent="VBoxContainer"] +[node name="CloseButton" type="Button" parent="PanelList/TopBarList"] +custom_minimum_size = Vector2(30, 30) +layout_mode = 2 +size_flags_vertical = 0 +text = "X" + +[node name="InteractList" type="VBoxContainer" parent="PanelList"] layout_mode = 2 +size_flags_vertical = 3 -[node name="BuildingsContainer" type="GridContainer" parent="VBoxContainer"] +[node name="HSeparator" type="HSeparator" parent="PanelList/InteractList"] layout_mode = 2 -columns = 3 -[node name="CloseButton" type="Button" parent="."] -custom_minimum_size = Vector2(30, 30) -layout_mode = 1 -anchors_preset = -1 -anchor_left = 0.85 -anchor_right = 1.0 -anchor_bottom = 0.103333 -grow_horizontal = 0 -text = "X" +[node name="BuildingsContainer" type="GridContainer" parent="PanelList/InteractList"] +layout_mode = 2 +columns = 3 -[connection signal="pressed" from="CloseButton" to="." method="_on_close_button_pressed"] +[connection signal="pressed" from="PanelList/TopBarList/CloseButton" to="." method="_on_close_button_pressed"] diff --git a/game/src/MainMenu/MainMenu.tscn b/game/src/MainMenu/MainMenu.tscn index a10fa27..0618fe8 100644 --- a/game/src/MainMenu/MainMenu.tscn +++ b/game/src/MainMenu/MainMenu.tscn @@ -16,9 +16,9 @@ grow_horizontal = 2 grow_vertical = 2 theme = ExtResource("1_1yri4") script = ExtResource("2_nm1fq") -_new_game_button = NodePath("Panel/VBox/Margin/ButtonList/NewGameButton") +_new_game_button = NodePath("MenuPanel/MenuList/ButtonListMargin/ButtonList/NewGameButton") -[node name="Panel" type="PanelContainer" parent="."] +[node name="MenuPanel" type="PanelContainer" parent="."] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -27,10 +27,10 @@ grow_horizontal = 2 grow_vertical = 2 theme_type_variation = &"BackgroundPanel" -[node name="VBox" type="VBoxContainer" parent="Panel"] +[node name="MenuList" type="VBoxContainer" parent="MenuPanel"] layout_mode = 2 -[node name="TextureRect" type="TextureRect" parent="Panel/VBox"] +[node name="TitleIcon" type="TextureRect" parent="MenuPanel/MenuList"] layout_mode = 2 size_flags_vertical = 3 size_flags_stretch_ratio = 1.75 @@ -38,19 +38,19 @@ texture = ExtResource("3_58ess") expand_mode = 1 stretch_mode = 5 -[node name="Margin" type="MarginContainer" parent="Panel/VBox"] +[node name="ButtonListMargin" type="MarginContainer" parent="MenuPanel/MenuList"] layout_mode = 2 theme_override_constants/margin_left = 15 theme_override_constants/margin_right = 12 -[node name="ButtonList" type="HBoxContainer" parent="Panel/VBox/Margin"] +[node name="ButtonList" type="HBoxContainer" parent="MenuPanel/MenuList/ButtonListMargin"] custom_minimum_size = Vector2(500, 0) layout_mode = 2 theme_type_variation = &"HBox_MainMenu_ButtonList" theme_override_constants/separation = 18 alignment = 1 -[node name="NewGameButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] +[node name="NewGameButton" type="Button" parent="MenuPanel/MenuList/ButtonListMargin/ButtonList"] editor_description = "UI-26" layout_mode = 2 size_flags_horizontal = 3 @@ -63,7 +63,7 @@ theme_type_variation = &"TitleButton" text = "MAINMENU_NEW_GAME" clip_text = true -[node name="ContinueButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] +[node name="ContinueButton" type="Button" parent="MenuPanel/MenuList/ButtonListMargin/ButtonList"] layout_mode = 2 size_flags_horizontal = 3 focus_neighbor_left = NodePath("../NewGameButton") @@ -75,7 +75,7 @@ disabled = true text = "MAINMENU_CONTINUE" clip_text = true -[node name="MultiplayerButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] +[node name="MultiplayerButton" type="Button" parent="MenuPanel/MenuList/ButtonListMargin/ButtonList"] editor_description = "UI-27" layout_mode = 2 size_flags_horizontal = 3 @@ -87,7 +87,7 @@ theme_type_variation = &"TitleButton" text = "MAINMENU_MULTIPLAYER" clip_text = true -[node name="OptionsButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] +[node name="OptionsButton" type="Button" parent="MenuPanel/MenuList/ButtonListMargin/ButtonList"] editor_description = "UI-5" layout_mode = 2 size_flags_horizontal = 3 @@ -99,7 +99,7 @@ theme_type_variation = &"TitleButton" text = "MAINMENU_OPTIONS" clip_text = true -[node name="CreditsButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] +[node name="CreditsButton" type="Button" parent="MenuPanel/MenuList/ButtonListMargin/ButtonList"] editor_description = "UI-32" layout_mode = 2 size_flags_horizontal = 3 @@ -111,7 +111,7 @@ theme_type_variation = &"TitleButton" text = "MAINMENU_CREDITS" clip_text = true -[node name="ExitButton" type="Button" parent="Panel/VBox/Margin/ButtonList"] +[node name="ExitButton" type="Button" parent="MenuPanel/MenuList/ButtonListMargin/ButtonList"] editor_description = "UI-3" layout_mode = 2 size_flags_horizontal = 3 @@ -123,28 +123,28 @@ theme_type_variation = &"TitleButton" text = "MAINMENU_EXIT" clip_text = true -[node name="BottomSpace" type="Control" parent="Panel/VBox"] +[node name="BottomSpace" type="Control" parent="MenuPanel/MenuList"] layout_mode = 2 size_flags_vertical = 3 size_flags_stretch_ratio = 0.35 -[node name="BottomMargin" type="MarginContainer" parent="Panel/VBox"] +[node name="BottomMargin" type="MarginContainer" parent="MenuPanel/MenuList"] layout_mode = 2 theme_type_variation = &"BottomMargin" -[node name="ReleaseInfoBox" parent="Panel/VBox/BottomMargin" instance=ExtResource("3_km0er")] +[node name="ReleaseInfoBox" parent="MenuPanel/MenuList/BottomMargin" instance=ExtResource("3_km0er")] layout_mode = 2 -[node name="LocaleButton" parent="Panel/VBox/BottomMargin" instance=ExtResource("3_amonp")] +[node name="LocaleButton" parent="MenuPanel/MenuList/BottomMargin" instance=ExtResource("3_amonp")] layout_mode = 2 size_flags_horizontal = 8 alignment = 0 text_overrun_behavior = 4 -[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/NewGameButton" to="." method="_on_new_game_button_pressed"] -[connection signal="visibility_changed" from="Panel/VBox/Margin/ButtonList/NewGameButton" to="." method="_on_new_game_button_visibility_changed"] -[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/ContinueButton" to="." method="_on_continue_button_pressed"] -[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/MultiplayerButton" to="." method="_on_multi_player_button_pressed"] -[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/OptionsButton" to="." method="_on_options_button_pressed"] -[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/CreditsButton" to="." method="_on_credits_button_pressed"] -[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/ExitButton" to="." method="_on_exit_button_pressed"] +[connection signal="pressed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/NewGameButton" to="." method="_on_new_game_button_pressed"] +[connection signal="visibility_changed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/NewGameButton" to="." method="_on_new_game_button_visibility_changed"] +[connection signal="pressed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/ContinueButton" to="." method="_on_continue_button_pressed"] +[connection signal="pressed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/MultiplayerButton" to="." method="_on_multi_player_button_pressed"] +[connection signal="pressed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/OptionsButton" to="." method="_on_options_button_pressed"] +[connection signal="pressed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/CreditsButton" to="." method="_on_credits_button_pressed"] +[connection signal="pressed" from="MenuPanel/MenuList/ButtonListMargin/ButtonList/ExitButton" to="." method="_on_exit_button_pressed"] diff --git a/game/src/MusicConductor/MusicPlayer.tscn b/game/src/MusicConductor/MusicPlayer.tscn index 91b6fd3..80ad641 100644 --- a/game/src/MusicConductor/MusicPlayer.tscn +++ b/game/src/MusicConductor/MusicPlayer.tscn @@ -4,58 +4,60 @@ [node name="MusicPlayer" type="BoxContainer" node_paths=PackedStringArray("_song_selector_button", "_progress_slider", "_previous_song_button", "_play_pause_button", "_next_song_button", "_visbility_button")] editor_description = "UI-104" +offset_right = 150.0 +offset_bottom = 110.0 mouse_filter = 2 +vertical = true script = ExtResource("1_gcm4m") -_song_selector_button = NodePath("Control/SongSelectorButton") -_progress_slider = NodePath("Control/ProgressSlider") -_previous_song_button = NodePath("Control/HBoxContainer/PreviousSongButton") -_play_pause_button = NodePath("Control/HBoxContainer/PlayPauseButton") -_next_song_button = NodePath("Control/HBoxContainer/NextSongButton") -_visbility_button = NodePath("Control/MusicUIVisibilityButton") - -[node name="Control" type="VBoxContainer" parent="."] -custom_minimum_size = Vector2(150, 0) -layout_mode = 2 -mouse_filter = 2 - -[node name="SongSelectorButton" type="OptionButton" parent="Control"] +_song_selector_button = NodePath("SongSelectorButton") +_progress_slider = NodePath("ProgressSlider") +_previous_song_button = NodePath("ButtonList/PreviousSongButton") +_play_pause_button = NodePath("ButtonList/PlayPauseButton") +_next_song_button = NodePath("ButtonList/NextSongButton") +_visbility_button = NodePath("MusicUIVisibilityButton") + +[node name="SongSelectorButton" type="OptionButton" parent="."] editor_description = "UI-107" +custom_minimum_size = Vector2(150, 0) layout_mode = 2 alignment = 1 text_overrun_behavior = 3 fit_to_longest_item = false -[node name="ProgressSlider" type="HSlider" parent="Control"] +[node name="ProgressSlider" type="HSlider" parent="."] +custom_minimum_size = Vector2(150, 0) layout_mode = 2 +size_flags_vertical = 1 -[node name="HBoxContainer" type="HBoxContainer" parent="Control"] +[node name="ButtonList" type="HBoxContainer" parent="."] layout_mode = 2 size_flags_horizontal = 4 mouse_filter = 2 -[node name="PreviousSongButton" type="Button" parent="Control/HBoxContainer"] +[node name="PreviousSongButton" type="Button" parent="ButtonList"] layout_mode = 2 text = "<" -[node name="PlayPauseButton" type="Button" parent="Control/HBoxContainer"] +[node name="PlayPauseButton" type="Button" parent="ButtonList"] custom_minimum_size = Vector2(30, 0) layout_mode = 2 text = "▶" -[node name="NextSongButton" type="Button" parent="Control/HBoxContainer"] +[node name="NextSongButton" type="Button" parent="ButtonList"] layout_mode = 2 text = ">" -[node name="MusicUIVisibilityButton" type="Button" parent="Control"] +[node name="MusicUIVisibilityButton" type="Button" parent="."] editor_description = "UI-106" layout_mode = 2 size_flags_horizontal = 4 +toggle_mode = true text = "⬆" -[connection signal="item_selected" from="Control/SongSelectorButton" to="." method="_on_option_button_item_selected"] -[connection signal="drag_ended" from="Control/ProgressSlider" to="." method="_on_progress_slider_drag_ended"] -[connection signal="drag_started" from="Control/ProgressSlider" to="." method="_on_progress_slider_drag_started"] -[connection signal="pressed" from="Control/HBoxContainer/PreviousSongButton" to="." method="_on_previous_song_button_pressed"] -[connection signal="pressed" from="Control/HBoxContainer/PlayPauseButton" to="." method="_on_play_pause_button_pressed"] -[connection signal="pressed" from="Control/HBoxContainer/NextSongButton" to="." method="_on_next_song_button_pressed"] -[connection signal="pressed" from="Control/MusicUIVisibilityButton" to="." method="_on_music_ui_visibility_button_pressed"] +[connection signal="item_selected" from="SongSelectorButton" to="." method="_on_option_button_item_selected"] +[connection signal="drag_ended" from="ProgressSlider" to="." method="_on_progress_slider_drag_ended"] +[connection signal="drag_started" from="ProgressSlider" to="." method="_on_progress_slider_drag_started"] +[connection signal="pressed" from="ButtonList/PreviousSongButton" to="." method="_on_previous_song_button_pressed"] +[connection signal="pressed" from="ButtonList/PlayPauseButton" to="." method="_on_play_pause_button_pressed"] +[connection signal="pressed" from="ButtonList/NextSongButton" to="." method="_on_next_song_button_pressed"] +[connection signal="pressed" from="MusicUIVisibilityButton" to="." method="_on_music_ui_visibility_button_pressed"] diff --git a/game/src/Utility/StyleBoxWithSound.gd b/game/src/Utility/StyleBoxWithSound.gd index 8de1af1..8c29b34 100644 --- a/game/src/Utility/StyleBoxWithSound.gd +++ b/game/src/Utility/StyleBoxWithSound.gd @@ -1,3 +1,4 @@ +## WARNING: This will not work with togglable UI elements, a special implementation is needed for them. @tool extends StyleBox class_name StyleBoxWithSound diff --git a/game/theme/game_session_menu.tres b/game/theme/game_session_menu.tres new file mode 100644 index 0000000..42775c3 --- /dev/null +++ b/game/theme/game_session_menu.tres @@ -0,0 +1,84 @@ +[gd_resource type="Theme" load_steps=11 format=3 uid="uid://dndova5cw036e"] + +[ext_resource type="StyleBox" uid="uid://blwilunhmyvpq" path="res://theme/assets/main_menu_button_normal.tres" id="1_7med2"] +[ext_resource type="Script" path="res://src/Utility/StyleBoxWithSound.gd" id="2_oj3dv"] +[ext_resource type="AudioStream" uid="uid://bsldcs3l8s7ug" path="res://addons/kenney_ui_audio/click3.wav" id="3_j823n"] +[ext_resource type="Texture2D" uid="uid://c0p34i3d3b0pw" path="res://theme/assets/main_menu_button.png" id="4_lno5s"] + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_jvvyi"] +content_margin_left = 20.0 +content_margin_top = 10.0 +content_margin_right = 20.0 +content_margin_bottom = 14.0 +texture = ExtResource("4_lno5s") +modulate_color = Color(0.817521, 0.817521, 0.817521, 0.784314) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6ab1x"] +draw_center = false +border_width_left = 10 +border_width_top = 15 +border_width_right = 10 +border_width_bottom = 15 +border_color = Color(0, 0, 0, 0.584314) +border_blend = true +corner_radius_top_left = 5 +corner_radius_top_right = 5 +corner_radius_bottom_right = 5 +corner_radius_bottom_left = 5 +corner_detail = 20 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_jslj0"] +content_margin_left = 20.0 +content_margin_top = 10.0 +content_margin_right = 20.0 +content_margin_bottom = 14.0 +texture = ExtResource("4_lno5s") +modulate_color = Color(0.588235, 0.588235, 0.588235, 1) + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_l2rw3"] +content_margin_left = 20.0 +content_margin_top = 10.0 +content_margin_right = 20.0 +content_margin_bottom = 14.0 +texture = ExtResource("4_lno5s") +modulate_color = Color(0.85098, 0.85098, 0.85098, 1) + +[sub_resource type="StyleBox" id="StyleBox_ptkcj"] +resource_local_to_scene = false +resource_name = "" +content_margin_left = -1.0 +content_margin_top = -1.0 +content_margin_right = -1.0 +content_margin_bottom = -1.0 +script = ExtResource("2_oj3dv") +style_box = SubResource("StyleBoxTexture_l2rw3") +sound = ExtResource("3_j823n") + +[sub_resource type="StyleBoxLine" id="StyleBoxLine_kaw4i"] +color = Color(0.454902, 0.45098, 0.435294, 1) +thickness = 2 + +[resource] +SessionButton/base_type = &"Button" +SessionButton/colors/font_color = Color(0.87451, 0.87451, 0.87451, 1) +SessionButton/colors/font_disabled_color = Color(0.87451, 0.87451, 0.87451, 0.501961) +SessionButton/colors/font_focus_color = Color(0.94902, 0.94902, 0.94902, 1) +SessionButton/colors/font_hover_color = Color(0.94902, 0.94902, 0.94902, 1) +SessionButton/colors/font_hover_pressed_color = Color(1, 1, 1, 1) +SessionButton/colors/font_outline_color = Color(1, 1, 1, 1) +SessionButton/colors/font_pressed_color = Color(1, 1, 1, 1) +SessionButton/colors/icon_disabled_color = Color(1, 1, 1, 0.4) +SessionButton/colors/icon_focus_color = Color(0.94902, 0.94902, 0.94902, 1) +SessionButton/colors/icon_hover_color = Color(0.94902, 0.94902, 0.94902, 1) +SessionButton/colors/icon_hover_pressed_color = Color(1, 1, 1, 1) +SessionButton/colors/icon_normal_color = Color(1, 1, 1, 1) +SessionButton/colors/icon_pressed_color = Color(1, 1, 1, 1) +SessionButton/styles/disabled = SubResource("StyleBoxTexture_jvvyi") +SessionButton/styles/focus = SubResource("StyleBoxFlat_6ab1x") +SessionButton/styles/hover = SubResource("StyleBoxTexture_jslj0") +SessionButton/styles/normal = ExtResource("1_7med2") +SessionButton/styles/pressed = SubResource("StyleBox_ptkcj") +SessionPanel/base_type = &"Panel" +SessionPanel/styles/panel = null +SessionSeparator/base_type = &"HSeparator" +SessionSeparator/styles/separator = SubResource("StyleBoxLine_kaw4i") diff --git a/game/theme/main_menu.tres b/game/theme/main_menu.tres index 6a3f73d..0518cd8 100644 --- a/game/theme/main_menu.tres +++ b/game/theme/main_menu.tres @@ -171,9 +171,9 @@ CommitLabel/styles/normal = SubResource("StyleBoxEmpty_kmfi1") CommitLabel/styles/pressed = SubResource("StyleBoxEmpty_1qcrh") TitleButton/base_type = &"Button" TitleButton/colors/font_color = Color(0.87451, 0.87451, 0.87451, 1) -TitleButton/colors/font_disabled_color = Color(0.875, 0.875, 0.875, 0.5) -TitleButton/colors/font_focus_color = Color(0.95, 0.95, 0.95, 1) -TitleButton/colors/font_hover_color = Color(0.95, 0.95, 0.95, 1) +TitleButton/colors/font_disabled_color = Color(0.87451, 0.87451, 0.87451, 0.501961) +TitleButton/colors/font_focus_color = Color(0.94902, 0.94902, 0.94902, 1) +TitleButton/colors/font_hover_color = Color(0.94902, 0.94902, 0.94902, 1) TitleButton/colors/font_hover_pressed_color = Color(1, 1, 1, 1) TitleButton/colors/font_outline_color = Color(1, 1, 1, 1) TitleButton/colors/font_pressed_color = Color(1, 1, 1, 1) -- cgit v1.2.3-56-ga3b1