aboutsummaryrefslogtreecommitdiff
path: root/game/src/GameSession/MapControlPanel.gd
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-04-08 19:37:30 +0200
committer Hop311 <hop3114@gmail.com>2023-04-08 19:37:30 +0200
commit12d2e458b0c8f0b57b0e42f3dd9fe992e3ebc5b8 (patch)
treec0b0f8494a4b1dec763ee1fa4b53a48e19258ea6 /game/src/GameSession/MapControlPanel.gd
parentd8a747ad3cc643a2320d798646d7c0f74c1babb1 (diff)
Map modes + moved province index image to SIM side
Diffstat (limited to 'game/src/GameSession/MapControlPanel.gd')
-rw-r--r--game/src/GameSession/MapControlPanel.gd26
1 files changed, 25 insertions, 1 deletions
diff --git a/game/src/GameSession/MapControlPanel.gd b/game/src/GameSession/MapControlPanel.gd
index ad56536..cfd102c 100644
--- a/game/src/GameSession/MapControlPanel.gd
+++ b/game/src/GameSession/MapControlPanel.gd
@@ -1,8 +1,32 @@
extends PanelContainer
signal game_session_menu_button_pressed
+signal mapmode_changed
+
+@export var _mapmodes_grid : GridContainer
+var _mapmode_button_group : ButtonGroup
+
+func _add_mapmode_button(identifier : String) -> void:
+ var button := Button.new()
+ button.text = identifier
+ button.tooltip_text = identifier
+ button.toggle_mode = true
+ button.button_group = _mapmode_button_group
+ _mapmodes_grid.add_child(button)
+ if _mapmode_button_group.get_pressed_button() == null:
+ button.button_pressed = true
+
+func _ready():
+ _mapmode_button_group = ButtonGroup.new()
+ _mapmode_button_group.pressed.connect(_mapmode_pressed)
+ for index in MapSingleton.get_mapmode_count():
+ _add_mapmode_button(MapSingleton.get_mapmode_identifier(index))
# REQUIREMENTS:
# * UIFUN-10
-func _on_game_session_menu_button_pressed():
+func _on_game_session_menu_button_pressed() -> void:
game_session_menu_button_pressed.emit()
+
+func _mapmode_pressed(button : BaseButton) -> void:
+ MapSingleton.set_mapmode(button.tooltip_text)
+ mapmode_changed.emit()