aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game/GameSession
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-06-24 00:55:45 +0200
committer GitHub <noreply@github.com>2023-06-24 00:55:45 +0200
commit432000a3ab73980fc6421b3587de4b97af30d3ad (patch)
tree4b80d98261252f25011e34b22a8d49767525559f /game/src/Game/GameSession
parent40cf0fa95e325f3bf875e42c11254da23192f506 (diff)
parent206cafc8bba310e4d4f35f4898ef3ac289abe81a (diff)
Merge pull request #131 from OpenVicProject/ui-cleanup
Localisation and UI focus cleanup
Diffstat (limited to 'game/src/Game/GameSession')
-rw-r--r--game/src/Game/GameSession/GameSpeedPanel.tscn4
-rw-r--r--game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd1
-rw-r--r--game/src/Game/GameSession/MapControlPanel/MapControlPanel.tscn5
-rw-r--r--game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd18
-rw-r--r--game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn1
5 files changed, 24 insertions, 5 deletions
diff --git a/game/src/Game/GameSession/GameSpeedPanel.tscn b/game/src/Game/GameSession/GameSpeedPanel.tscn
index fab988e..2ce5042 100644
--- a/game/src/Game/GameSession/GameSpeedPanel.tscn
+++ b/game/src/Game/GameSession/GameSpeedPanel.tscn
@@ -15,21 +15,25 @@ layout_mode = 2
[node name="LongformDateButton" type="Button" parent="ButtonList"]
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
+focus_mode = 0
text = "LONGFORM DATE"
[node name="PlayPauseDisplayButton" type="Button" parent="ButtonList"]
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
+focus_mode = 0
text = "⏸ "
[node name="DecreaseSpeedButton" type="Button" parent="ButtonList"]
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
+focus_mode = 0
text = "-"
[node name="IncreaseSpeedButton" type="Button" parent="ButtonList"]
custom_minimum_size = Vector2(30, 0)
layout_mode = 2
+focus_mode = 0
text = "+"
[connection signal="pressed" from="ButtonList/LongformDateButton" to="." method="_on_longform_date_label_pressed"]
diff --git a/game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd b/game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd
index 0cef057..01e6623 100644
--- a/game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd
+++ b/game/src/Game/GameSession/MapControlPanel/MapControlPanel.gd
@@ -19,6 +19,7 @@ func _add_mapmode_button(identifier : String) -> void:
button.toggle_mode = true
button.button_group = _mapmode_button_group
button.mouse_filter = MOUSE_FILTER_PASS
+ button.focus_mode = FOCUS_NONE
_mapmodes_grid.add_child(button)
if _mapmode_button_group.get_pressed_button() == null:
button.button_pressed = true
diff --git a/game/src/Game/GameSession/MapControlPanel/MapControlPanel.tscn b/game/src/Game/GameSession/MapControlPanel/MapControlPanel.tscn
index a00f110..2bb62f1 100644
--- a/game/src/Game/GameSession/MapControlPanel/MapControlPanel.tscn
+++ b/game/src/Game/GameSession/MapControlPanel/MapControlPanel.tscn
@@ -68,6 +68,7 @@ layout_mode = 2
[node name="GameSessionMenuButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel"]
editor_description = "UI-9"
layout_mode = 2
+focus_mode = 0
mouse_filter = 1
shortcut = SubResource("Shortcut_fc1tk")
text = "ESC"
@@ -75,12 +76,14 @@ text = "ESC"
[node name="LedgerButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel"]
editor_description = "UI-860"
layout_mode = 2
+focus_mode = 0
mouse_filter = 1
text = "L"
[node name="FindButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel"]
editor_description = "UI-861"
layout_mode = 2
+focus_mode = 0
mouse_filter = 1
text = "F"
@@ -91,12 +94,14 @@ alignment = 1
[node name="ZoomInButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel/ZoomButtonsContainer"]
editor_description = "UI-862"
layout_mode = 2
+focus_mode = 0
mouse_filter = 1
text = "+"
[node name="ZoomOutButton" type="Button" parent="MapPanelMargin/MapPanelList/AuxiliaryPanel/ZoomButtonsContainer"]
editor_description = "UI-863"
layout_mode = 2
+focus_mode = 0
mouse_filter = 1
text = "-"
diff --git a/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd b/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd
index 67060bf..bad093d 100644
--- a/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd
+++ b/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.gd
@@ -13,13 +13,18 @@ var _selected_index : int:
get: return _selected_index
set(v):
_selected_index = v
- update_info()
+ _update_info()
var _province_info : Dictionary
func _ready():
GameSingleton.province_selected.connect(_on_province_selected)
- GameSingleton.state_updated.connect(update_info)
- update_info()
+ GameSingleton.state_updated.connect(_update_info)
+ _update_info()
+
+func _notification(what : int):
+ match what:
+ NOTIFICATION_TRANSLATION_CHANGED:
+ _update_info()
enum { CANNOT_EXPAND, CAN_EXPAND, PREPARING, EXPANDING }
@@ -53,6 +58,7 @@ func _add_building_row() -> void:
row.button.text = "EXPAND_PROVINCE_BUILDING"
row.button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
row.button.mouse_filter = Control.MOUSE_FILTER_PASS
+ row.button.focus_mode = FOCUS_NONE
row.button.pressed.connect(func(): _expand_building(row.name.text))
_buildings_container.add_child(row.button)
@@ -91,7 +97,7 @@ func _set_building_row(index : int, building : Dictionary) -> void:
row.button.disabled = expansion_state != CAN_EXPAND
row.button.visible = not show_progress_bar
-func update_info() -> void:
+func _update_info() -> void:
_province_info = GameSingleton.get_province_info_from_index(_selected_index)
if _province_info:
_province_name_label.text = _province_info.get(GameSingleton.get_province_info_province_key(),
@@ -100,7 +106,9 @@ func update_info() -> void:
GameSingleton.get_province_info_region_key() + _missing_suffix)
_life_rating_bar.value = _province_info.get(GameSingleton.get_province_info_life_rating_key(), 0)
- _life_rating_bar.tooltip_text = tr("LIFE_RATING_TOOLTIP").format({ "life_rating": _life_rating_bar.value })
+ _life_rating_bar.tooltip_text = tr("LIFE_RATING_TOOLTIP").format({
+ "life_rating": Events.Localisation.tr_number(_life_rating_bar.value)
+ })
_rgo_name_label.text = _province_info.get(GameSingleton.get_province_info_rgo_key(),
GameSingleton.get_province_info_rgo_key() + _missing_suffix)
diff --git a/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn b/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn
index f8c1e65..896f8e9 100644
--- a/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn
+++ b/game/src/Game/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn
@@ -51,6 +51,7 @@ mouse_filter = 1
custom_minimum_size = Vector2(30, 30)
layout_mode = 2
size_flags_vertical = 0
+focus_mode = 0
mouse_filter = 1
text = "X"