diff options
35 files changed, 573 insertions, 219 deletions
diff --git a/docs/simulation/goods.md b/docs/simulation/goods.md index a46686d..15b4864 100644 --- a/docs/simulation/goods.md +++ b/docs/simulation/goods.md @@ -36,7 +36,7 @@ classDiagram |--|--|--|--|--|--|--|--| |ammunition|Military|17.50|208 202 127|False|True|False|False| |small_arms|Military|37.00|189 118 22|False|True|False|False| -|artillary|Military|60.00|145 130 86|False|True|False|False| +|artillery|Military|60.00|145 130 86|False|True|False|False| |canned_food|Military|16.00|255 39 12|True|True|False|False| |tanks|Military|98.00|55 41 9|False|True|False|False| |aeroplanes|Military|110.00|221 213 182|False|True|False|False| @@ -89,7 +89,7 @@ classDiagram |--|--|--|--|--|--|--|--| |ammunition|Military|17.50|208 202 127|False|True|False|False| |small_arms|Military|37.00|189 118 22|False|True|False|False| -|artillary|Military|60.00|145 130 86|False|True|False|False| +|artillery|Military|60.00|145 130 86|False|True|False|False| |canned_food|Military|16.00|255 39 12|True|True|False|False| |tanks|Military|98.00|55 41 9|False|True|False|False| |aeroplanes|Military|110.00|221 213 182|False|True|False|False| diff --git a/game/project.godot b/game/project.godot index 7975c0a..323bf41 100644 --- a/game/project.godot +++ b/game/project.godot @@ -11,8 +11,10 @@ config_version=5 [application] config/name="OpenVic2" -run/main_scene="res://src/GameMenu.tscn" +run/main_scene="res://src/GameStart.tscn" config/features=PackedStringArray("4.0", "Forward Plus") +boot_splash/bg_color=Color(0.380392, 0.145098, 0.14902, 1) +boot_splash/image="res://splash_assets/splash_image.png" config/icon="res://icon.svg" config/project_settings_override.template="user://settings.cfg" diff --git a/game/splash_assets/splash_end.png b/game/splash_assets/splash_end.png Binary files differnew file mode 100644 index 0000000..ac7b1da --- /dev/null +++ b/game/splash_assets/splash_end.png diff --git a/game/splash_assets/splash_end.png.import b/game/splash_assets/splash_end.png.import new file mode 100644 index 0000000..64a7f9a --- /dev/null +++ b/game/splash_assets/splash_end.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://deef5hufq0j61" +path="res://.godot/imported/splash_end.png-967b7882642610d3be0d67e2695b1564.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://splash_assets/splash_end.png" +dest_files=["res://.godot/imported/splash_end.png-967b7882642610d3be0d67e2695b1564.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/game/splash_assets/splash_image.png b/game/splash_assets/splash_image.png Binary files differnew file mode 100644 index 0000000..5f7cff9 --- /dev/null +++ b/game/splash_assets/splash_image.png diff --git a/game/splash_assets/splash_image.png.import b/game/splash_assets/splash_image.png.import new file mode 100644 index 0000000..ce7e72c --- /dev/null +++ b/game/splash_assets/splash_image.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cgdnixsyh7bja" +path="res://.godot/imported/splash_image.png-e2810276ec1ba470c15ca32f0eb76f88.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://splash_assets/splash_image.png" +dest_files=["res://.godot/imported/splash_image.png-e2810276ec1ba470c15ca32f0eb76f88.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/game/splash_assets/splash_startup.ogv b/game/splash_assets/splash_startup.ogv Binary files differnew file mode 100644 index 0000000..950d9a6 --- /dev/null +++ b/game/splash_assets/splash_startup.ogv diff --git a/game/src/Credits/Credits.gd b/game/src/CreditsMenu/CreditsMenu.gd index a69732c..be992ef 100644 --- a/game/src/Credits/Credits.gd +++ b/game/src/CreditsMenu/CreditsMenu.gd @@ -17,8 +17,6 @@ signal back_button_pressed @export_file("*.csv") var core_credits_path : String -# TODO: implement for theme instead -# waiting for https://github.com/OpenVic2Project/OpenVic2/pull/48 @export_group("Label Variants", "label_variants_") @export var label_variants_project : StringName diff --git a/game/src/Credits/Credits.tscn b/game/src/CreditsMenu/CreditsMenu.tscn index fce29fa..8a81823 100644 --- a/game/src/Credits/Credits.tscn +++ b/game/src/CreditsMenu/CreditsMenu.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=2 format=3 uid="uid://c8knthxkwj1uj"] -[ext_resource type="Script" path="res://src/Credits/Credits.gd" id="1_csd7i"] +[ext_resource type="Script" path="res://src/CreditsMenu/CreditsMenu.gd" id="1_csd7i"] -[node name="Credits" type="Control" node_paths=PackedStringArray("credits_list")] +[node name="CreditsMenu" type="Control" node_paths=PackedStringArray("credits_list")] editor_description = "UI-34" layout_mode = 3 anchors_preset = 15 diff --git a/game/src/GameMenu.gd b/game/src/GameMenu.gd index 3a4c88f..4b589f9 100644 --- a/game/src/GameMenu.gd +++ b/game/src/GameMenu.gd @@ -1,41 +1,47 @@ extends Control +@export var _main_menu : Control +@export var _options_menu : Control +@export var _lobby_menu : Control +@export var _credits_menu : Control + # REQUIREMENTS # * SS-10 func _ready(): Events.Options.load_settings_from_file() func _on_main_menu_new_game_button_pressed(): - $OptionsMenu.toggle_locale_button_visibility(false) - $LobbyMenu.show() - $MainMenu.hide() + _lobby_menu.show() + _main_menu.hide() # REQUIREMENTS # * SS-6 # * UIFUN-5 func _on_main_menu_options_button_pressed(): - $OptionsMenu.toggle_locale_button_visibility(false) - $OptionsMenu.show() - $MainMenu.hide() + _options_menu.show() + _main_menu.hide() func _on_options_menu_back_button_pressed(): - $MainMenu.show() - $OptionsMenu.hide() - $OptionsMenu.toggle_locale_button_visibility(true) + _main_menu.show() + _options_menu.hide() func _on_lobby_menu_back_button_pressed(): - $MainMenu.show() - $LobbyMenu.hide() - $OptionsMenu.toggle_locale_button_visibility(true) + _main_menu.show() + _lobby_menu.hide() func _on_credits_back_button_pressed(): - $Credits.hide() - $MainMenu.show() + _credits_menu.hide() + _main_menu.show() func _on_main_menu_credits_button_pressed(): - $Credits.show() - $MainMenu.hide() + _credits_menu.show() + _main_menu.hide() + + + +func _on_splash_container_splash_end(): + show() diff --git a/game/src/GameMenu.tscn b/game/src/GameMenu.tscn index f3c55dd..ab892df 100644 --- a/game/src/GameMenu.tscn +++ b/game/src/GameMenu.tscn @@ -1,15 +1,14 @@ -[gd_scene load_steps=9 format=3 uid="uid://o4u142w4qkln"] +[gd_scene load_steps=8 format=3 uid="uid://o4u142w4qkln"] [ext_resource type="Script" path="res://src/GameMenu.gd" id="1_cafwe"] [ext_resource type="Theme" uid="uid://cr4lh0vraucx7" path="res://default_theme.tres" id="1_q3b4c"] [ext_resource type="PackedScene" uid="uid://dvoin538iby54" path="res://src/MainMenu/MainMenu.tscn" id="2_2jbkh"] [ext_resource type="PackedScene" uid="uid://cnbfxjy1m6wja" path="res://src/OptionMenu/OptionsMenu.tscn" id="3_111lv"] -[ext_resource type="PackedScene" uid="uid://b7oncobnacxmt" path="res://src/LocaleButton.tscn" id="4_jno35"] -[ext_resource type="PackedScene" uid="uid://c8knthxkwj1uj" path="res://src/Credits/Credits.tscn" id="4_n0hoo"] +[ext_resource type="PackedScene" uid="uid://c8knthxkwj1uj" path="res://src/CreditsMenu/CreditsMenu.tscn" id="4_n0hoo"] [ext_resource type="PackedScene" uid="uid://crhkgngfnxf4y" path="res://src/LobbyMenu/LobbyMenu.tscn" id="4_nofk1"] [ext_resource type="PackedScene" uid="uid://cvl76duuym1wq" path="res://src/MusicConductor/MusicPlayer.tscn" id="6_lts1m"] -[node name="GameMenu" type="Control"] +[node name="GameMenu" type="Control" node_paths=PackedStringArray("_main_menu", "_options_menu", "_lobby_menu", "_credits_menu")] layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 @@ -18,6 +17,10 @@ grow_horizontal = 2 grow_vertical = 2 theme = ExtResource("1_q3b4c") script = ExtResource("1_cafwe") +_main_menu = NodePath("MainMenu") +_options_menu = NodePath("OptionsMenu") +_lobby_menu = NodePath("LobbyMenu") +_credits_menu = NodePath("CreditsMenu") [node name="MainMenu" parent="." instance=ExtResource("2_2jbkh")] layout_mode = 1 @@ -31,26 +34,10 @@ layout_mode = 1 visible = false layout_mode = 1 -[node name="Credits" parent="." instance=ExtResource("4_n0hoo")] +[node name="CreditsMenu" parent="." instance=ExtResource("4_n0hoo")] visible = false layout_mode = 1 -[node name="HBox" type="HBoxContainer" parent="."] -layout_mode = 1 -anchors_preset = 3 -anchor_left = 1.0 -anchor_top = 1.0 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_left = -150.0 -offset_top = -20.0 -grow_horizontal = 0 -grow_vertical = 0 -alignment = 2 - -[node name="LocaleButton" parent="HBox" instance=ExtResource("4_jno35")] -layout_mode = 2 - [node name="MusicPlayer" parent="." instance=ExtResource("6_lts1m")] layout_mode = 1 anchors_preset = 1 @@ -66,4 +53,4 @@ grow_horizontal = 0 [connection signal="options_button_pressed" from="MainMenu" to="." method="_on_main_menu_options_button_pressed"] [connection signal="back_button_pressed" from="OptionsMenu" to="." method="_on_options_menu_back_button_pressed"] [connection signal="back_button_pressed" from="LobbyMenu" to="." method="_on_lobby_menu_back_button_pressed"] -[connection signal="back_button_pressed" from="Credits" to="." method="_on_credits_back_button_pressed"] +[connection signal="back_button_pressed" from="CreditsMenu" to="." method="_on_credits_back_button_pressed"] diff --git a/game/src/GameSession/GameSession.gd b/game/src/GameSession/GameSession.gd new file mode 100644 index 0000000..0d69bf2 --- /dev/null +++ b/game/src/GameSession/GameSession.gd @@ -0,0 +1,16 @@ +extends Control + +@export var _game_session_menu : Control + +func _ready(): + print("GameSession ready") + +# REQUIREMENTS: +# * SS-42 +func _on_game_session_menu_button_pressed(): + _game_session_menu.visible = !_game_session_menu.visible + +# REQUIREMENTS: +# * SS-64 +func _on_game_session_menu_close_button_pressed(): + _game_session_menu.hide() diff --git a/game/src/GameSession/GameSession.tscn b/game/src/GameSession/GameSession.tscn new file mode 100644 index 0000000..f984daf --- /dev/null +++ b/game/src/GameSession/GameSession.tscn @@ -0,0 +1,40 @@ +[gd_scene load_steps=4 format=3 uid="uid://bgnupcshe1m7r"] + +[ext_resource type="Script" path="res://src/GameSession/GameSession.gd" id="1_eklvp"] +[ext_resource type="PackedScene" uid="uid://g524p8lr574w" path="res://src/GameSession/MapControlPanel.tscn" id="3_afh6d"] +[ext_resource type="PackedScene" uid="uid://dvdynl6eir40o" path="res://src/GameSession/GameSessionMenu.tscn" id="3_bvmqh"] + +[node name="GameSession" type="Control" node_paths=PackedStringArray("_game_session_menu")] +editor_description = "SS-102" +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_eklvp") +_game_session_menu = NodePath("GameSessionMenu") + +[node name="GameSessionMenu" parent="." instance=ExtResource("3_bvmqh")] +visible = false +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="MapControlPanel" parent="." instance=ExtResource("3_afh6d")] +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 0 +grow_vertical = 0 + +[connection signal="close_button_pressed" from="GameSessionMenu" to="." method="_on_game_session_menu_close_button_pressed"] +[connection signal="game_session_menu_button_pressed" from="MapControlPanel" to="." method="_on_game_session_menu_button_pressed"] diff --git a/game/src/GameSession/GameSessionMenu.gd b/game/src/GameSession/GameSessionMenu.gd new file mode 100644 index 0000000..3722b52 --- /dev/null +++ b/game/src/GameSession/GameSessionMenu.gd @@ -0,0 +1,19 @@ +extends PanelContainer + +signal close_button_pressed + +@export var _main_menu_scene : PackedScene + +func _ready(): + print("GameSessionMenu ready") + +# REQUIREMENTS: +# * SS-47 +# * UIFUN-69 +func _on_to_main_menu_pressed(): + get_tree().change_scene_to_packed(_main_menu_scene) + +# REQUIREMENTS: +# * UIFUN-69 +func _on_close_button_pressed(): + close_button_pressed.emit() diff --git a/game/src/GameSession/GameSessionMenu.tscn b/game/src/GameSession/GameSessionMenu.tscn new file mode 100644 index 0000000..d6a7ca9 --- /dev/null +++ b/game/src/GameSession/GameSessionMenu.tscn @@ -0,0 +1,28 @@ +[gd_scene load_steps=3 format=3 uid="uid://dvdynl6eir40o"] + +[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"] +editor_description = "UI-68" +script = ExtResource("1_usq6o") +_main_menu_scene = ExtResource("2_xi6a4") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 2 + +[node name="MainMenuButton" type="Button" parent="VBoxContainer"] +editor_description = "UI-71" +layout_mode = 2 +text = "Resign" + +[node name="HSeparator" type="HSeparator" parent="VBoxContainer"] +layout_mode = 2 + +[node name="CloseButton" type="Button" parent="VBoxContainer"] +editor_description = "UI-80" +layout_mode = 2 +text = "Close" + +[connection signal="pressed" from="VBoxContainer/MainMenuButton" to="." method="_on_to_main_menu_pressed"] +[connection signal="pressed" from="VBoxContainer/CloseButton" to="." method="_on_close_button_pressed"] diff --git a/game/src/GameSession/MapControlPanel.gd b/game/src/GameSession/MapControlPanel.gd new file mode 100644 index 0000000..ad56536 --- /dev/null +++ b/game/src/GameSession/MapControlPanel.gd @@ -0,0 +1,8 @@ +extends PanelContainer + +signal game_session_menu_button_pressed + +# REQUIREMENTS: +# * UIFUN-10 +func _on_game_session_menu_button_pressed(): + game_session_menu_button_pressed.emit() diff --git a/game/src/GameSession/MapControlPanel.tscn b/game/src/GameSession/MapControlPanel.tscn new file mode 100644 index 0000000..71d43e7 --- /dev/null +++ b/game/src/GameSession/MapControlPanel.tscn @@ -0,0 +1,32 @@ +[gd_scene load_steps=2 format=3 uid="uid://g524p8lr574w"] + +[ext_resource type="Script" path="res://src/GameSession/MapControlPanel.gd" id="1_ign64"] + +[node name="PanelContainer" type="PanelContainer"] +editor_description = "SS-103" +script = ExtResource("1_ign64") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"] +layout_mode = 2 + +[node name="MapmodesPlaceholder" type="Label" parent="HBoxContainer/VBoxContainer"] +layout_mode = 2 +text = "MAPMODES" + +[node name="MinimapPlaceholder" type="Label" parent="HBoxContainer/VBoxContainer"] +layout_mode = 2 +text = "MINIMAP" + +[node name="AuxiliaryPanel" type="VBoxContainer" parent="HBoxContainer"] +editor_description = "UI-761" +layout_mode = 2 + +[node name="GameSessionMenuButton" type="Button" parent="HBoxContainer/AuxiliaryPanel"] +editor_description = "UI-9" +layout_mode = 2 +text = "ESC" + +[connection signal="pressed" from="HBoxContainer/AuxiliaryPanel/GameSessionMenuButton" to="." method="_on_game_session_menu_button_pressed"] diff --git a/game/src/GameStart.tscn b/game/src/GameStart.tscn new file mode 100644 index 0000000..2046bb5 --- /dev/null +++ b/game/src/GameStart.tscn @@ -0,0 +1,52 @@ +[gd_scene load_steps=6 format=3 uid="uid://1udsn4mggep2"] + +[ext_resource type="PackedScene" uid="uid://o4u142w4qkln" path="res://src/GameMenu.tscn" id="1_wlojq"] +[ext_resource type="Script" path="res://src/SplashContainer.gd" id="2_xmcgv"] +[ext_resource type="Texture2D" uid="uid://deef5hufq0j61" path="res://splash_assets/splash_end.png" id="3_qfv12"] +[ext_resource type="Texture2D" uid="uid://cgdnixsyh7bja" path="res://splash_assets/splash_image.png" id="4_5b6yq"] +[ext_resource type="VideoStream" path="res://splash_assets/splash_startup.ogv" id="5_8euyy"] + +[node name="GameStartup" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="GameMenu" parent="." instance=ExtResource("1_wlojq")] +visible = false +layout_mode = 1 + +[node name="SplashContainer" type="AspectRatioContainer" parent="." node_paths=PackedStringArray("_splash_finish", "_splash_image", "_splash_video")] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +ratio = 1.7778 +stretch_mode = 3 +script = ExtResource("2_xmcgv") +_splash_finish = NodePath("SplashFinish") +_splash_image = NodePath("SplashImage") +_splash_video = NodePath("SplashVideo") + +[node name="SplashFinish" type="TextureRect" parent="SplashContainer"] +layout_mode = 2 +texture = ExtResource("3_qfv12") +expand_mode = 1 + +[node name="SplashImage" type="TextureRect" parent="SplashContainer"] +layout_mode = 2 +texture = ExtResource("4_5b6yq") +expand_mode = 1 + +[node name="SplashVideo" type="VideoStreamPlayer" parent="SplashContainer"] +layout_mode = 2 +stream = ExtResource("5_8euyy") +autoplay = true +expand = true + +[connection signal="splash_end" from="SplashContainer" to="GameMenu" method="_on_splash_container_splash_end"] +[connection signal="finished" from="SplashContainer/SplashVideo" to="SplashContainer" method="_on_splash_startup_finished"] diff --git a/game/src/LobbyMenu/LobbyMenu.gd b/game/src/LobbyMenu/LobbyMenu.gd index 873e2a2..802dac3 100644 --- a/game/src/LobbyMenu/LobbyMenu.gd +++ b/game/src/LobbyMenu/LobbyMenu.gd @@ -22,7 +22,7 @@ func _on_back_button_button_down(): # * SS-21 func _on_start_button_button_down(): print("Starting new game.") - get_tree().change_scene_to_file("res://src/SampleGame.tscn") + get_tree().change_scene_to_file("res://src/GameSession/GameSession.tscn") # REQUIREMENTS: diff --git a/game/src/LocaleButton.gd b/game/src/LocaleButton.gd index a8220de..c3c6925 100644 --- a/game/src/LocaleButton.gd +++ b/game/src/LocaleButton.gd @@ -23,6 +23,11 @@ func _ready(): Events.Options.load_settings.connect(load_setting) Events.Options.save_settings.connect(save_setting) + +func _notification(what): + match what: + NOTIFICATION_TRANSLATION_CHANGED: + _select_locale_by_string(TranslationServer.get_locale()) func _valid_index(index : int) -> bool: return 0 <= index and index < _locales_list.size() @@ -32,12 +37,18 @@ func load_setting(file : ConfigFile) -> void: var load_value = file.get_value(section_name, setting_name, TranslationServer.get_locale()) match typeof(load_value): TYPE_STRING, TYPE_STRING_NAME: - var locale_index := _locales_list.find(load_value as String) - if locale_index != -1: - selected = locale_index + if _select_locale_by_string(load_value as String): + item_selected.emit(selected) return push_error("Setting value '%s' invalid for setting [%s] %s" % [load_value, section_name, setting_name]) reset_setting() + +func _select_locale_by_string(locale : String) -> bool: + var locale_index := _locales_list.find(locale) + if locale_index != -1: + selected = locale_index + return true + return false # REQUIREMENTS: # * UIFUN-74 diff --git a/game/src/MainMenu/MainMenu.gd b/game/src/MainMenu/MainMenu.gd index 7e790c0..662cd90 100644 --- a/game/src/MainMenu/MainMenu.gd +++ b/game/src/MainMenu/MainMenu.gd @@ -16,12 +16,10 @@ var _checksum_label : Label func _ready(): print("From GDScript") TestSingleton.hello_singleton() - # UIFUN-97 - var checksum := Checksum.get_checksum_text() - _checksum_label.tooltip_text = "Checksum " + checksum - _checksum_label.text = "(" + checksum.substr(0, 4) + ")" - _new_game_button.grab_focus() - + # UI-111 + _checksum_label.tooltip_text = "Checksum " + Checksum.get_checksum_text() + _checksum_label.text = "(" + Checksum.get_checksum_text().substr(0, 4) + ")" + _on_new_game_button_visibility_changed() # REQUIREMENTS: # * SS-14 @@ -55,3 +53,7 @@ func _on_credits_button_pressed(): func _on_exit_button_pressed(): print("See you later!") get_tree().quit() + +func _on_new_game_button_visibility_changed(): + if visible: + _new_game_button.grab_focus.call_deferred() diff --git a/game/src/MainMenu/MainMenu.tscn b/game/src/MainMenu/MainMenu.tscn index af2d975..4fc95d8 100644 --- a/game/src/MainMenu/MainMenu.tscn +++ b/game/src/MainMenu/MainMenu.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=3 uid="uid://dvoin538iby54"] +[gd_scene load_steps=4 format=3 uid="uid://dvoin538iby54"] [ext_resource type="Theme" uid="uid://cr4lh0vraucx7" path="res://default_theme.tres" id="1_dfm41"] [ext_resource type="Script" path="res://src/MainMenu/MainMenu.gd" id="2_nm1fq"] +[ext_resource type="PackedScene" uid="uid://b7oncobnacxmt" path="res://src/LocaleButton.tscn" id="3_amonp"] [node name="MainMenu" type="Control" node_paths=PackedStringArray("_new_game_button", "_checksum_label")] editor_description = "UI-13" @@ -152,7 +153,14 @@ mouse_filter = 1 theme_type_variation = &"Label_Checksum" text = "(0000)" +[node name="LocaleButton" parent="Panel/VBox/Margin2" 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"] diff --git a/game/src/OptionMenu/AutosaveIntervalSelector.gd b/game/src/OptionMenu/AutosaveIntervalSelector.gd new file mode 100644 index 0000000..2c55862 --- /dev/null +++ b/game/src/OptionMenu/AutosaveIntervalSelector.gd @@ -0,0 +1,2 @@ +extends SettingOptionButton + diff --git a/game/src/OptionMenu/GeneralTab.gd b/game/src/OptionMenu/GeneralTab.gd new file mode 100644 index 0000000..3d98678 --- /dev/null +++ b/game/src/OptionMenu/GeneralTab.gd @@ -0,0 +1,9 @@ +extends HBoxContainer + +@export var initial_focus: Control + +func _notification(what : int) -> void: + match(what): + NOTIFICATION_VISIBILITY_CHANGED: + if visible and is_inside_tree(): + initial_focus.grab_focus() diff --git a/game/src/OptionMenu/GeneralTab.tscn b/game/src/OptionMenu/GeneralTab.tscn new file mode 100644 index 0000000..b38f548 --- /dev/null +++ b/game/src/OptionMenu/GeneralTab.tscn @@ -0,0 +1,82 @@ +[gd_scene load_steps=5 format=3 uid="uid://duwjal7sd7p6w"] + +[ext_resource type="Script" path="res://src/OptionMenu/GeneralTab.gd" id="1_gbutn"] +[ext_resource type="PackedScene" uid="uid://b7oncobnacxmt" path="res://src/LocaleButton.tscn" id="2_5cfd7"] +[ext_resource type="Script" path="res://src/OptionMenu/SettingNodes/SettingOptionButton.gd" id="2_msx2u"] +[ext_resource type="Script" path="res://src/OptionMenu/AutosaveIntervalSelector.gd" id="2_t06tb"] + +[node name="GeneralTab" type="HBoxContainer" node_paths=PackedStringArray("initial_focus")] +editor_description = "UI-48" +alignment = 1 +script = ExtResource("1_gbutn") +initial_focus = NodePath("VBoxContainer/GridContainer/SavegameFormatSelector") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 2 + +[node name="Control" type="Control" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +size_flags_stretch_ratio = 0.1 + +[node name="GridContainer" type="GridContainer" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +columns = 2 + +[node name="SavegameFormatLabel" type="Label" parent="VBoxContainer/GridContainer"] +layout_mode = 2 +text = "Savegame Format" + +[node name="SavegameFormatSelector" type="OptionButton" parent="VBoxContainer/GridContainer"] +editor_description = "UI-50" +layout_mode = 2 +focus_neighbor_bottom = NodePath("../AutosaveIntervalSelector") +item_count = 2 +selected = 0 +popup/item_0/text = "Binary" +popup/item_0/id = 0 +popup/item_1/text = "Text" +popup/item_1/id = 1 +script = ExtResource("2_msx2u") +section_name = "General" +setting_name = "Savegame Format" +default_selected = 0 + +[node name="AutosaveIntervalLabel" type="Label" parent="VBoxContainer/GridContainer"] +layout_mode = 2 +text = "Autosave Interval" +horizontal_alignment = 1 + +[node name="AutosaveIntervalSelector" type="OptionButton" parent="VBoxContainer/GridContainer"] +editor_description = "UI-15" +layout_mode = 2 +focus_neighbor_top = NodePath("../SavegameFormatSelector") +focus_neighbor_bottom = NodePath("../LocaleButton") +item_count = 5 +selected = 0 +popup/item_0/text = "Monthly" +popup/item_0/id = 0 +popup/item_1/text = "Bi-Monthly" +popup/item_1/id = 1 +popup/item_2/text = "Bi-Yearly" +popup/item_2/id = 2 +popup/item_3/text = "Yearly" +popup/item_3/id = 3 +popup/item_4/text = "Never" +popup/item_4/id = 4 +script = ExtResource("2_t06tb") +section_name = "General" +setting_name = "Autosave Interval" +default_selected = 0 + +[node name="LocaleLabel" type="Label" parent="VBoxContainer/GridContainer"] +layout_mode = 2 +text = "Language" + +[node name="LocaleButton" parent="VBoxContainer/GridContainer" instance=ExtResource("2_5cfd7")] +editor_description = "UI-79" +layout_mode = 2 +focus_neighbor_top = NodePath("../AutosaveIntervalSelector") +alignment = 0 +text_overrun_behavior = 4 diff --git a/game/src/OptionMenu/OptionsMenu.gd b/game/src/OptionMenu/OptionsMenu.gd index e7ad7f6..d5f128c 100644 --- a/game/src/OptionMenu/OptionsMenu.gd +++ b/game/src/OptionMenu/OptionsMenu.gd @@ -31,7 +31,6 @@ func _ready(): back_button.text = "X" back_button.pressed.connect(_on_back_button_pressed) button_list.add_child(back_button) - get_viewport().get_window().close_requested.connect(_on_window_close_requested) _save_overrides.call_deferred() Events.Options.save_settings.connect(func(_f): self._save_overrides.call_deferred()) @@ -41,10 +40,10 @@ func _notification(what): NOTIFICATION_CRASH: _on_window_close_requested() -# Could pass the LocaleButton between the MainMenu and OptionsMenu -# but that seems a bit excessive -func toggle_locale_button_visibility(locale_visible : bool): - $LocaleVBox/LocaleHBox/LocaleButton.visible = locale_visible +func _input(event): + if self.is_visible_in_tree(): + if event.is_action_pressed("ui_cancel"): + _on_back_button_pressed() func _on_back_button_pressed(): Events.Options.save_settings_to_file() diff --git a/game/src/OptionMenu/OptionsMenu.tscn b/game/src/OptionMenu/OptionsMenu.tscn index 10d92b5..1ff2022 100644 --- a/game/src/OptionMenu/OptionsMenu.tscn +++ b/game/src/OptionMenu/OptionsMenu.tscn @@ -1,45 +1,43 @@ -[gd_scene load_steps=7 format=3 uid="uid://cnbfxjy1m6wja"] +[gd_scene load_steps=8 format=3 uid="uid://cnbfxjy1m6wja"] [ext_resource type="Script" path="res://src/OptionMenu/OptionsMenu.gd" id="1_tlein"] -[ext_resource type="PackedScene" uid="uid://b7oncobnacxmt" path="res://src/LocaleButton.tscn" id="2_d7wvq"] +[ext_resource type="Theme" uid="uid://cr4lh0vraucx7" path="res://default_theme.tres" id="2_8cfng"] [ext_resource type="PackedScene" uid="uid://bq3awxxjn1tuw" path="res://src/OptionMenu/VideoTab.tscn" id="2_ji8xr"] [ext_resource type="PackedScene" uid="uid://cbtgwpx2wxi33" path="res://src/OptionMenu/SoundTab.tscn" id="3_4w35t"] +[ext_resource type="PackedScene" uid="uid://duwjal7sd7p6w" path="res://src/OptionMenu/GeneralTab.tscn" id="3_6gvf6"] [ext_resource type="PackedScene" uid="uid://bq7ibhm0txl5p" path="res://addons/keychain/ShortcutEdit.tscn" id="4_vdhjp"] [ext_resource type="PackedScene" uid="uid://dp2grvybtecqu" path="res://src/OptionMenu/OtherTab.tscn" id="5_ahefp"] -[node name="OptionsMenu" type="Control"] +[node name="OptionsMenu" type="PanelContainer"] editor_description = "UI-25" -layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -mouse_filter = 2 +theme = ExtResource("2_8cfng") +theme_type_variation = &"Panel_MainMenu" script = ExtResource("1_tlein") [node name="Margin" type="MarginContainer" parent="."] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 2 -theme_override_constants/margin_left = 250 -theme_override_constants/margin_top = 100 -theme_override_constants/margin_right = 250 -theme_override_constants/margin_bottom = 200 +layout_mode = 2 +theme_override_constants/margin_left = 180 +theme_override_constants/margin_top = 150 +theme_override_constants/margin_right = 180 +theme_override_constants/margin_bottom = 150 [node name="Tab" type="TabContainer" parent="Margin"] editor_description = "UI-45" layout_mode = 2 -size_flags_vertical = 3 tab_alignment = 1 use_hidden_tabs_for_min_size = true +[node name="General" parent="Margin/Tab" instance=ExtResource("3_6gvf6")] +layout_mode = 2 + [node name="Video" parent="Margin/Tab" instance=ExtResource("2_ji8xr")] editor_description = "UI-46, UIFUN-43" +visible = false layout_mode = 2 [node name="Sound" parent="Margin/Tab" instance=ExtResource("3_4w35t")] @@ -51,25 +49,7 @@ layout_mode = 2 editor_description = "SS-27, UI-49, UIFUN-46" visible = false layout_mode = 2 +alignment = 1 [node name="Other" parent="Margin/Tab" instance=ExtResource("5_ahefp")] layout_mode = 2 - -[node name="LocaleVBox" type="VBoxContainer" parent="."] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 2 -alignment = 2 - -[node name="LocaleHBox" type="HBoxContainer" parent="LocaleVBox"] -layout_mode = 2 -mouse_filter = 2 -alignment = 2 - -[node name="LocaleButton" parent="LocaleVBox/LocaleHBox" instance=ExtResource("2_d7wvq")] -editor_description = "UI-79" -layout_mode = 2 diff --git a/game/src/OptionMenu/QualityPresetSelector.gd b/game/src/OptionMenu/QualityPresetSelector.gd new file mode 100644 index 0000000..57ba4ab --- /dev/null +++ b/game/src/OptionMenu/QualityPresetSelector.gd @@ -0,0 +1,4 @@ +extends SettingOptionButton + +func _setup_button(): + pass diff --git a/game/src/OptionMenu/RefreshRateSelector.gd b/game/src/OptionMenu/RefreshRateSelector.gd new file mode 100644 index 0000000..31b115b --- /dev/null +++ b/game/src/OptionMenu/RefreshRateSelector.gd @@ -0,0 +1,5 @@ +extends SettingOptionButton + + +func _setup_button(): + pass diff --git a/game/src/OptionMenu/VideoTab.gd b/game/src/OptionMenu/VideoTab.gd new file mode 100644 index 0000000..3d98678 --- /dev/null +++ b/game/src/OptionMenu/VideoTab.gd @@ -0,0 +1,9 @@ +extends HBoxContainer + +@export var initial_focus: Control + +func _notification(what : int) -> void: + match(what): + NOTIFICATION_VISIBILITY_CHANGED: + if visible and is_inside_tree(): + initial_focus.grab_focus() diff --git a/game/src/OptionMenu/VideoTab.tscn b/game/src/OptionMenu/VideoTab.tscn index 245d15d..c060b19 100644 --- a/game/src/OptionMenu/VideoTab.tscn +++ b/game/src/OptionMenu/VideoTab.tscn @@ -1,12 +1,18 @@ -[gd_scene load_steps=4 format=3 uid="uid://bq3awxxjn1tuw"] +[gd_scene load_steps=7 format=3 uid="uid://bq3awxxjn1tuw"] [ext_resource type="Script" path="res://src/OptionMenu/ResolutionSelector.gd" id="1_i8nro"] +[ext_resource type="Script" path="res://src/OptionMenu/VideoTab.gd" id="1_jvv62"] [ext_resource type="Script" path="res://src/OptionMenu/ScreenModeSelector.gd" id="2_wa7vw"] [ext_resource type="Script" path="res://src/OptionMenu/MonitorDisplaySelector.gd" id="3_y6lyb"] +[ext_resource type="Script" path="res://src/OptionMenu/RefreshRateSelector.gd" id="4_381mg"] +[ext_resource type="Script" path="res://src/OptionMenu/QualityPresetSelector.gd" id="5_srg4v"] -[node name="Video" type="HBoxContainer"] +[node name="Video" type="HBoxContainer" node_paths=PackedStringArray("initial_focus")] +editor_description = "UI-46" tooltip_text = "This is my cool and very nice tooltip" alignment = 1 +script = ExtResource("1_jvv62") +initial_focus = NodePath("VBoxContainer/GridContainer/ResolutionSelector") [node name="VBoxContainer" type="VBoxContainer" parent="."] layout_mode = 2 @@ -28,6 +34,7 @@ text = "Resolution" [node name="ResolutionSelector" type="OptionButton" parent="VBoxContainer/GridContainer"] editor_description = "UI-19" layout_mode = 2 +focus_neighbor_bottom = NodePath("../ScreenModeSelector") item_count = 1 selected = 0 popup/item_0/text = "MISSING" @@ -43,6 +50,8 @@ text = "Screen Mode" [node name="ScreenModeSelector" type="OptionButton" parent="VBoxContainer/GridContainer"] layout_mode = 2 +focus_neighbor_top = NodePath("../ResolutionSelector") +focus_neighbor_bottom = NodePath("../MonitorDisplaySelector") item_count = 3 selected = 0 popup/item_0/text = "Fullscreen" @@ -61,6 +70,8 @@ text = "Monitor Selection" [node name="MonitorDisplaySelector" type="OptionButton" parent="VBoxContainer/GridContainer"] layout_mode = 2 +focus_neighbor_top = NodePath("../ScreenModeSelector") +focus_neighbor_bottom = NodePath("../RefreshRateSelector") item_count = 1 selected = 0 popup/item_0/text = "MISSING" @@ -69,6 +80,64 @@ script = ExtResource("3_y6lyb") section_name = "Video" setting_name = "Current Screen" +[node name="RefreshRateLabel" type="Label" parent="VBoxContainer/GridContainer"] +layout_mode = 2 +text = "Refresh Rate" + +[node name="RefreshRateSelector" type="OptionButton" parent="VBoxContainer/GridContainer"] +editor_description = "UI-18" +layout_mode = 2 +tooltip_text = "Only change from VSYNC if you are having issues with screen tearing." +focus_neighbor_top = NodePath("../MonitorDisplaySelector") +focus_neighbor_bottom = NodePath("../QualityPresetSelector") +item_count = 8 +selected = 0 +popup/item_0/text = "VSYNC" +popup/item_0/id = 0 +popup/item_1/text = "30hz" +popup/item_1/id = 1 +popup/item_2/text = "60hz" +popup/item_2/id = 2 +popup/item_3/text = "90hz" +popup/item_3/id = 3 +popup/item_4/text = "120hz" +popup/item_4/id = 4 +popup/item_5/text = "144hz" +popup/item_5/id = 5 +popup/item_6/text = "365hz" +popup/item_6/id = 6 +popup/item_7/text = "Unlimited" +popup/item_7/id = 7 +script = ExtResource("4_381mg") +section_name = "Video" +setting_name = "Refresh Rate" +default_selected = 0 + +[node name="QualityPresetLabel" type="Label" parent="VBoxContainer/GridContainer"] +layout_mode = 2 +text = "Quality Preset" + +[node name="QualityPresetSelector" type="OptionButton" parent="VBoxContainer/GridContainer"] +editor_description = "UI-21" +layout_mode = 2 +focus_neighbor_top = NodePath("../RefreshRateSelector") +item_count = 5 +selected = 1 +popup/item_0/text = "Low" +popup/item_0/id = 0 +popup/item_1/text = "Medium" +popup/item_1/id = 1 +popup/item_2/text = "High" +popup/item_2/id = 2 +popup/item_3/text = "Ultra" +popup/item_3/id = 3 +popup/item_4/text = "Custom" +popup/item_4/id = 4 +script = ExtResource("5_srg4v") +section_name = "Video" +setting_name = "Quality Preset" +default_selected = 1 + [connection signal="item_selected" from="VBoxContainer/GridContainer/ResolutionSelector" to="VBoxContainer/GridContainer/ResolutionSelector" method="_on_item_selected"] [connection signal="item_selected" from="VBoxContainer/GridContainer/ScreenModeSelector" to="VBoxContainer/GridContainer/ScreenModeSelector" method="_on_item_selected"] [connection signal="item_selected" from="VBoxContainer/GridContainer/MonitorDisplaySelector" to="VBoxContainer/GridContainer/MonitorDisplaySelector" method="_on_item_selected"] diff --git a/game/src/OptionMenu/VolumeGrid.gd b/game/src/OptionMenu/VolumeGrid.gd index 297de6f..5b1d13f 100644 --- a/game/src/OptionMenu/VolumeGrid.gd +++ b/game/src/OptionMenu/VolumeGrid.gd @@ -4,6 +4,8 @@ const RATIO_FOR_LINEAR : float = 100 var _slider_dictionary : Dictionary +var initial_focus : Control + func get_db_as_volume_value(db : float) -> float: # db_to_linear produces a float between 0 and 1 from a db value return db_to_linear(db) * RATIO_FOR_LINEAR @@ -29,6 +31,7 @@ func add_volume_row(bus_name : StringName, bus_index : int) -> HSlider: add_child(volume_slider) _slider_dictionary[volume_label.text] = volume_slider + if not initial_focus: initial_focus = volume_slider return volume_slider # REQUIREMENTS @@ -37,6 +40,11 @@ func _ready(): for bus_index in AudioServer.bus_count: add_volume_row(AudioServer.get_bus_name(bus_index), bus_index) +func _notification(what : int) -> void: + match(what): + NOTIFICATION_VISIBILITY_CHANGED: + if visible and is_inside_tree() and initial_focus: initial_focus.grab_focus() + # REQUIREMENTS # * UIFUN-30 func _on_slider_value_changed(value : float, bus_index : int) -> void: diff --git a/game/src/SampleGame.gd b/game/src/SampleGame.gd deleted file mode 100644 index 589fed2..0000000 --- a/game/src/SampleGame.gd +++ /dev/null @@ -1,49 +0,0 @@ -extends Control - -var selectedId = 0 - -@export -var _province_num_display : Label - -@export -var _province_size_display : Label - -@export -var _main_menu_scene : PackedScene - -# Called when the node enters the scene tree for the first time. -func _ready(): - updateVisibleInfo() - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass - - -func updateVisibleInfo(): - _province_num_display.text = str(selectedId) - _province_size_display.text = str(Simulation.queryProvinceSize(selectedId)) - - -func _on_pass_time_button_pressed(): - Simulation.conductSimulationStep() - updateVisibleInfo() - - -func _on_next_prov_button_pressed(): - selectedId = (selectedId + 1) % 10 - updateVisibleInfo() - - -func _on_prev_prov_button_pressed(): - if selectedId == 0: - selectedId = 9 - else: - selectedId -= 1 - updateVisibleInfo() - - -func _on_to_main_menu_pressed(): - get_tree().change_scene_to_packed(_main_menu_scene) diff --git a/game/src/SampleGame.tscn b/game/src/SampleGame.tscn deleted file mode 100644 index 92603b9..0000000 --- a/game/src/SampleGame.tscn +++ /dev/null @@ -1,71 +0,0 @@ -[gd_scene load_steps=3 format=3 uid="uid://bgnupcshe1m7r"] - -[ext_resource type="Script" path="res://src/SampleGame.gd" id="1_eklvp"] -[ext_resource type="PackedScene" uid="uid://b4pg2y2ivib8f" path="res://src/GameMenu.tscn" id="2_r7wq5"] - -[node name="SampleGame" type="Control" node_paths=PackedStringArray("_province_num_display", "_province_size_display")] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -script = ExtResource("1_eklvp") -_province_num_display = NodePath("CenterContainer/VBoxContainer2/GridContainer/ProvinceNumDisplay") -_province_size_display = NodePath("CenterContainer/VBoxContainer2/GridContainer/ProvinceSizeDisplay") -_main_menu_scene = ExtResource("2_r7wq5") - -[node name="CenterContainer" type="CenterContainer" parent="."] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="VBoxContainer2" type="VBoxContainer" parent="CenterContainer"] -layout_mode = 2 - -[node name="GridContainer" type="GridContainer" parent="CenterContainer/VBoxContainer2"] -layout_mode = 2 -columns = 2 - -[node name="ProvenceLabel" type="Label" parent="CenterContainer/VBoxContainer2/GridContainer"] -layout_mode = 2 -text = "Viewing Province #:" -horizontal_alignment = 2 - -[node name="ProvinceNumDisplay" type="Label" parent="CenterContainer/VBoxContainer2/GridContainer"] -layout_mode = 2 - -[node name="ProvinceSizeLabel" type="Label" parent="CenterContainer/VBoxContainer2/GridContainer"] -layout_mode = 2 -text = "Province Size:" -horizontal_alignment = 2 - -[node name="ProvinceSizeDisplay" type="Label" parent="CenterContainer/VBoxContainer2/GridContainer"] -layout_mode = 2 - -[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/VBoxContainer2"] -layout_mode = 2 - -[node name="PassTimeButton" type="Button" parent="CenterContainer/VBoxContainer2/VBoxContainer"] -layout_mode = 2 -text = "Pass Time" - -[node name="NextProvButton" type="Button" parent="CenterContainer/VBoxContainer2/VBoxContainer"] -layout_mode = 2 -text = "View Next Province" - -[node name="PrevProvButton" type="Button" parent="CenterContainer/VBoxContainer2/VBoxContainer"] -layout_mode = 2 -text = "View Previous Province" - -[node name="ToMainMenu" type="Button" parent="CenterContainer/VBoxContainer2/VBoxContainer"] -layout_mode = 2 -text = "Exit to Main Menu" - -[connection signal="pressed" from="CenterContainer/VBoxContainer2/VBoxContainer/PassTimeButton" to="." method="_on_pass_time_button_pressed"] -[connection signal="pressed" from="CenterContainer/VBoxContainer2/VBoxContainer/NextProvButton" to="." method="_on_next_prov_button_pressed"] -[connection signal="pressed" from="CenterContainer/VBoxContainer2/VBoxContainer/PrevProvButton" to="." method="_on_prev_prov_button_pressed"] -[connection signal="pressed" from="CenterContainer/VBoxContainer2/VBoxContainer/ToMainMenu" to="." method="_on_to_main_menu_pressed"] diff --git a/game/src/SplashContainer.gd b/game/src/SplashContainer.gd new file mode 100644 index 0000000..524d314 --- /dev/null +++ b/game/src/SplashContainer.gd @@ -0,0 +1,30 @@ +extends Control + +signal splash_end + +@export var _splash_finish : TextureRect +@export var _splash_image : TextureRect +@export var _splash_video : VideoStreamPlayer + +func _process(_delta): + var stream_texture := _splash_video.get_video_texture() + if stream_texture != null and not stream_texture.get_image().is_invisible(): + _splash_image.hide() + _splash_finish.show() + set_process(false) + +func _input(event): + if (event is InputEventKey\ + or event is InputEventMouse\ + or event is InputEventScreenTouch\ + or event is InputEventJoypadButton) and event.is_pressed(): + _splash_finish.hide() + _on_splash_startup_finished() + accept_event() + +func _on_splash_startup_finished(): + set_process_input(false) + splash_end.emit() + var tween := create_tween() + tween.tween_property(self, "modulate:a", 0, 0.5) + tween.tween_callback(self.queue_free) |