diff options
Diffstat (limited to 'game/src/GameSession/ProvinceOverviewPanel.gd')
-rw-r--r-- | game/src/GameSession/ProvinceOverviewPanel.gd | 27 |
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 = "" |