aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game/src/GameSession/GameSession.gd16
-rw-r--r--game/src/GameSession/GameSession.tscn40
-rw-r--r--game/src/GameSession/GameSessionMenu.gd19
-rw-r--r--game/src/GameSession/GameSessionMenu.tscn28
-rw-r--r--game/src/GameSession/MapControlPanel.gd8
-rw-r--r--game/src/GameSession/MapControlPanel.tscn32
-rw-r--r--game/src/LobbyMenu/LobbyMenu.gd2
-rw-r--r--game/src/OptionMenu/GeneralTab.gd5
-rw-r--r--game/src/OptionMenu/VideoTab.gd5
-rw-r--r--game/src/OptionMenu/VolumeGrid.gd8
-rw-r--r--game/src/SampleGame.gd49
-rw-r--r--game/src/SampleGame.tscn71
12 files changed, 158 insertions, 125 deletions
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/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/OptionMenu/GeneralTab.gd b/game/src/OptionMenu/GeneralTab.gd
index 8aed783..3d98678 100644
--- a/game/src/OptionMenu/GeneralTab.gd
+++ b/game/src/OptionMenu/GeneralTab.gd
@@ -1,8 +1,9 @@
extends HBoxContainer
-@export var initial_focus: Button
+@export var initial_focus: Control
func _notification(what : int) -> void:
match(what):
NOTIFICATION_VISIBILITY_CHANGED:
- if visible: initial_focus.grab_focus()
+ if visible and is_inside_tree():
+ initial_focus.grab_focus()
diff --git a/game/src/OptionMenu/VideoTab.gd b/game/src/OptionMenu/VideoTab.gd
index 8aed783..3d98678 100644
--- a/game/src/OptionMenu/VideoTab.gd
+++ b/game/src/OptionMenu/VideoTab.gd
@@ -1,8 +1,9 @@
extends HBoxContainer
-@export var initial_focus: Button
+@export var initial_focus: Control
func _notification(what : int) -> void:
match(what):
NOTIFICATION_VISIBILITY_CHANGED:
- if visible: initial_focus.grab_focus()
+ if visible and is_inside_tree():
+ initial_focus.grab_focus()
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"]