diff options
author | ClarkeCode <33846391+ClarkeCode@users.noreply.github.com> | 2023-04-18 21:05:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-18 21:05:41 +0200 |
commit | ae06fbce51f91b15aeed8ede7973f4ec24d05ff0 (patch) | |
tree | 9a49865bb6e6bc56c26a291de9c48d483225ac17 /game/src | |
parent | ea077c8a7c78477bd247c7fbd21de13bcf2285e9 (diff) | |
parent | 0ead900c96f1f40028d53b0e4b9c2d93312a6621 (diff) |
Merge pull request #91 from OpenVic2Project/minor-map-ui
Minor map UI
Diffstat (limited to 'game/src')
-rw-r--r-- | game/src/GameSession/GameSession.tscn | 16 | ||||
-rw-r--r-- | game/src/GameSession/GameSpeedPanel.gd | 33 | ||||
-rw-r--r-- | game/src/GameSession/GameSpeedPanel.tscn | 38 | ||||
-rw-r--r-- | game/src/LobbyMenu/LobbyMenu.gd | 5 | ||||
-rw-r--r-- | game/src/LobbyMenu/LobbyMenu.tscn | 1 | ||||
-rw-r--r-- | game/src/MusicConductor/MusicPlayer.gd | 2 |
6 files changed, 94 insertions, 1 deletions
diff --git a/game/src/GameSession/GameSession.tscn b/game/src/GameSession/GameSession.tscn index d23cb6c..8a8b18c 100644 --- a/game/src/GameSession/GameSession.tscn +++ b/game/src/GameSession/GameSession.tscn @@ -1,11 +1,13 @@ -[gd_scene load_steps=7 format=3 uid="uid://bgnupcshe1m7r"] +[gd_scene load_steps=9 format=3 uid="uid://bgnupcshe1m7r"] [ext_resource type="Script" path="res://src/GameSession/GameSession.gd" id="1_eklvp"] +[ext_resource type="PackedScene" uid="uid://cvl76duuym1wq" path="res://src/MusicConductor/MusicPlayer.tscn" id="2_kt6aa"] [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"] [ext_resource type="PackedScene" uid="uid://dkehmdnuxih2r" path="res://src/GameSession/MapView.tscn" id="4_xkg5j"] [ext_resource type="PackedScene" uid="uid://byq323jbel48u" path="res://src/GameSession/ProvinceOverviewPanel.tscn" id="5_osjnn"] [ext_resource type="PackedScene" uid="uid://cnbfxjy1m6wja" path="res://src/OptionMenu/OptionsMenu.tscn" id="6_p5mnx"] +[ext_resource type="PackedScene" uid="uid://dd8k3p7r3huwc" path="res://src/GameSession/GameSpeedPanel.tscn" id="7_myy4q"] [node name="GameSession" type="Control" node_paths=PackedStringArray("_game_session_menu")] editor_description = "SS-102, UI-546" @@ -19,6 +21,15 @@ 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")] @@ -49,6 +60,9 @@ layout_mode = 1 visible = false layout_mode = 1 +[node name="GameSpeedPanel" parent="." instance=ExtResource("7_myy4q")] +layout_mode = 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"] [connection signal="options_button_pressed" from="GameSessionMenu" to="OptionsMenu" method="show"] diff --git a/game/src/GameSession/GameSpeedPanel.gd b/game/src/GameSession/GameSpeedPanel.gd new file mode 100644 index 0000000..8dc35d7 --- /dev/null +++ b/game/src/GameSession/GameSpeedPanel.gd @@ -0,0 +1,33 @@ +extends PanelContainer + +#UI-74 UI-75 UI-76 UI-77 + +@export var _longform_date_button : Button +@export var _play_pause_display_button : Button +@export var _decrease_speed_button : Button +@export var _increase_speed_button : Button + +var is_game_paused : bool = true + +# Called when the node enters the scene tree for the first time. +func _ready(): + _update_playpause_button() + +func _update_playpause_button(): + _play_pause_display_button.text = "⏸️" if is_game_paused else "▶" + print("Game is paused" if is_game_paused else "Game is advancing") + + +func _on_decrease_speed_button_pressed(): + print("Decrease speed") + +func _on_increase_speed_button_pressed(): + print("Increase speed") + +func _on_play_pause_display_button_pressed(): + is_game_paused = !is_game_paused + _update_playpause_button() + +func _on_longform_date_label_pressed(): + is_game_paused = !is_game_paused + _update_playpause_button() diff --git a/game/src/GameSession/GameSpeedPanel.tscn b/game/src/GameSession/GameSpeedPanel.tscn new file mode 100644 index 0000000..bfb869c --- /dev/null +++ b/game/src/GameSession/GameSpeedPanel.tscn @@ -0,0 +1,38 @@ +[gd_scene load_steps=2 format=3 uid="uid://dd8k3p7r3huwc"] + +[ext_resource type="Script" path="res://src/GameSession/GameSpeedPanel.gd" id="1_pfs8t"] + +[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") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 2 + +[node name="LongformDateButton" type="Button" parent="HBoxContainer"] +custom_minimum_size = Vector2(200, 0) +layout_mode = 2 +text = "LONGFORM DATE" + +[node name="PlayPauseDisplayButton" type="Button" parent="HBoxContainer"] +custom_minimum_size = Vector2(30, 0) +layout_mode = 2 +text = "⏸" + +[node name="DecreaseSpeedButton" type="Button" parent="HBoxContainer"] +custom_minimum_size = Vector2(30, 0) +layout_mode = 2 +text = "➖" + +[node name="IncreaseSpeedButton" type="Button" parent="HBoxContainer"] +custom_minimum_size = Vector2(30, 0) +layout_mode = 2 +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"] diff --git a/game/src/LobbyMenu/LobbyMenu.gd b/game/src/LobbyMenu/LobbyMenu.gd index 802dac3..4fc06c9 100644 --- a/game/src/LobbyMenu/LobbyMenu.gd +++ b/game/src/LobbyMenu/LobbyMenu.gd @@ -34,3 +34,8 @@ func _on_game_select_list_item_selected(index): func _on_save_game_selected(_index): start_button.disabled = false + +# If the date is double-clicked, start the game! +func _on_game_select_list_item_activated(index): + _on_game_select_list_item_selected(index) + _on_start_button_button_down() diff --git a/game/src/LobbyMenu/LobbyMenu.tscn b/game/src/LobbyMenu/LobbyMenu.tscn index 528e7ae..174fb72 100644 --- a/game/src/LobbyMenu/LobbyMenu.tscn +++ b/game/src/LobbyMenu/LobbyMenu.tscn @@ -78,6 +78,7 @@ custom_minimum_size = Vector2(0, 33) layout_mode = 2 [connection signal="save_game_selected" from="." to="." method="_on_save_game_selected"] +[connection signal="item_activated" from="GameSelectPanel/VBoxContainer/GameSelectList" to="." method="_on_game_select_list_item_activated"] [connection signal="item_selected" from="GameSelectPanel/VBoxContainer/GameSelectList" to="." method="_on_game_select_list_item_selected"] [connection signal="button_down" from="GameSelectPanel/VBoxContainer/BackButton" to="." method="_on_back_button_button_down"] [connection signal="button_down" from="GameStartPanel/VBoxContainer/StartButton" to="." method="_on_start_button_button_down"] diff --git a/game/src/MusicConductor/MusicPlayer.gd b/game/src/MusicConductor/MusicPlayer.gd index baf8a43..b775b84 100644 --- a/game/src/MusicConductor/MusicPlayer.gd +++ b/game/src/MusicConductor/MusicPlayer.gd @@ -44,6 +44,8 @@ func _on_previous_song_button_pressed(): func _on_option_button_item_selected(index): # UIFUN-92 MusicConductor.start_song_by_index(index) + _update_song_name_visual() + _update_play_pause_button() func _on_progress_slider_drag_started(): |