aboutsummaryrefslogtreecommitdiff
path: root/game/src/GameSession/ProvinceOverviewPanel.gd
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-04-18 19:55:10 +0200
committer GitHub <noreply@github.com>2023-04-18 19:55:10 +0200
commitea077c8a7c78477bd247c7fbd21de13bcf2285e9 (patch)
tree0cc2be6ef3ab1f2af5c2806f60abe988ca6aa7b5 /game/src/GameSession/ProvinceOverviewPanel.gd
parent258a088018d36e987b3ffe4a9b418a6c21ad9217 (diff)
parent1fdd198f943a41468b03b2cdc62c24147f707239 (diff)
Merge pull request #88 from OpenVic2Project/map-drawing
Further Map Stuff
Diffstat (limited to 'game/src/GameSession/ProvinceOverviewPanel.gd')
-rw-r--r--game/src/GameSession/ProvinceOverviewPanel.gd27
1 files changed, 19 insertions, 8 deletions
diff --git a/game/src/GameSession/ProvinceOverviewPanel.gd b/game/src/GameSession/ProvinceOverviewPanel.gd
index 434f6b1..4615df9 100644
--- a/game/src/GameSession/ProvinceOverviewPanel.gd
+++ b/game/src/GameSession/ProvinceOverviewPanel.gd
@@ -1,22 +1,33 @@
extends Panel
@export var _province_name_label : Label
+@export var _region_name_label : Label
-@export var province_identifier: String = "":
- get: return province_identifier
+var _province_identifier: String = "":
+ get: return _province_identifier
set(v):
- province_identifier = v
+ _province_identifier = v
update_info()
+const _name_suffix : String = "_NAME"
+
func _ready():
update_info()
func update_info() -> void:
- _province_name_label.text = province_identifier + "_NAME"
- visible = not province_identifier.is_empty()
+ if _province_identifier:
+ _province_name_label.text = _province_identifier + _name_suffix
+ var region_identifier := MapSingleton.get_region_identifier_from_province_identifier(_province_identifier)
+ if region_identifier:
+ _region_name_label.text = region_identifier + _name_suffix
+ else:
+ _region_name_label.text = "NO REGION"
+ show()
+ else:
+ hide()
func _on_province_selected(identifier : String) -> void:
- province_identifier = identifier
+ _province_identifier = identifier
-func _on_button_pressed() -> void:
- province_identifier = ""
+func _on_close_button_pressed() -> void:
+ _province_identifier = ""