aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game/GameSession
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-08-23 01:03:02 +0200
committer hop311 <hop3114@gmail.com>2024-08-23 01:03:02 +0200
commit95a6b95a5df63fa1bcb1d4680b3fdd7091a9c38e (patch)
tree7a487c2283eac8159ea0e25f93abdefa6b3ca0d1 /game/src/Game/GameSession
parent7c85ab11e840c281a2499dcc6dd3219c33e7d37f (diff)
Rework GUITextLabel to use custom text handling instead of RichTextLabel
Diffstat (limited to 'game/src/Game/GameSession')
-rw-r--r--game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd10
-rw-r--r--game/src/Game/GameSession/Topbar.gd7
2 files changed, 8 insertions, 9 deletions
diff --git a/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd b/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
index 3c2fb3b..90df650 100644
--- a/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
+++ b/game/src/Game/GameSession/NationManagementScreen/BudgetMenu.gd
@@ -87,15 +87,15 @@ func _ready() -> void:
# income
var _lower_class_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/tax_0_slider")
if _lower_class_slider and _lower_class_label:
- _lower_class_slider.value_changed.connect(func(value : int) -> void: _lower_class_label.text = "%s¤" % GUINode.float_to_string_dp(value, 3))
+ _lower_class_slider.value_changed.connect(func(value : int) -> void: _lower_class_label.text = "%s¤" % GUINode.float_to_string_dp(value, 3 if abs(value) < 1000 else 1))
_lower_class_slider.emit_value_changed()
var _middle_class_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/tax_1_slider")
if _middle_class_slider and _middle_class_label:
- _middle_class_slider.value_changed.connect(func(value : int) -> void: _middle_class_label.text = "%s¤" % GUINode.float_to_string_dp(value, 3))
+ _middle_class_slider.value_changed.connect(func(value : int) -> void: _middle_class_label.text = "%s¤" % GUINode.float_to_string_dp(value, 3 if abs(value) < 1000 else 1))
_middle_class_slider.emit_value_changed()
var _upper_class_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/tax_2_slider")
if _upper_class_slider and _upper_class_label:
- _upper_class_slider.value_changed.connect(func(value : int) -> void: _upper_class_label.text = "%s¤" % GUINode.float_to_string_dp(value, 3))
+ _upper_class_slider.value_changed.connect(func(value : int) -> void: _upper_class_label.text = "%s¤" % GUINode.float_to_string_dp(value, 3 if abs(value) < 1000 else 1))
_upper_class_slider.emit_value_changed()
# costs
@@ -123,7 +123,7 @@ func _ready() -> void:
if _administration_exp_label:
_exp_1_slider.value_changed.connect(func(value : int) -> void: _administration_exp_label.text = "%s¤" % GUINode.float_to_string_dp_dynamic(value))
if _admin_efficiency_label:
- _exp_1_slider.value_changed.connect(func(value : int) -> void: _admin_efficiency_label.text = "%s%%" % value)
+ _exp_1_slider.value_changed.connect(func(value : int) -> void: _admin_efficiency_label.text = "%s%%" % GUINode.float_to_string_dp(value, 1))
_exp_1_slider.emit_value_changed()
var _exp_2_slider : GUIScrollbar = get_gui_scrollbar_from_nodepath(^"./country_budget/exp_2_slider")
if _exp_2_slider and _social_exp_label:
@@ -140,7 +140,7 @@ func _ready() -> void:
if _tariff_val_label:
_tariff_slider.value_changed.connect(func(value : int) -> void: _tariff_val_label.text = "%s¤" % GUINode.float_to_string_dp_dynamic(value))
if _tariffs_percent_label:
- _tariff_slider.value_changed.connect(func(value : int) -> void: _tariffs_percent_label.text = "%s%%" % value)
+ _tariff_slider.value_changed.connect(func(value : int) -> void: _tariffs_percent_label.text = "%s%%" % GUINode.float_to_string_dp(value, 1))
_tariff_slider.emit_value_changed()
# debt buttons
diff --git a/game/src/Game/GameSession/Topbar.gd b/game/src/Game/GameSession/Topbar.gd
index 5f5640f..a173ccd 100644
--- a/game/src/Game/GameSession/Topbar.gd
+++ b/game/src/Game/GameSession/Topbar.gd
@@ -269,8 +269,7 @@ func _update_info() -> void:
_country_name_label.set_text(player_country)
if _country_rank_label:
- # TODO - fix label alignment
- _country_rank_label.set_text(" %d" % 1)
+ _country_rank_label.set_text(str(1))
if _country_prestige_label:
_country_prestige_label.set_text(str(11))
@@ -294,7 +293,7 @@ func _update_info() -> void:
var available_colonial_power : int = 123
var total_colonial_power : int = 456
_country_colonial_power_label.set_text(
- ("%s/%s" if available_colonial_power > 0 else "§R%s§!/%s") % [available_colonial_power, total_colonial_power]
+ "§%s%s§!/%s" % ["W" if available_colonial_power > 0 else "R", available_colonial_power, total_colonial_power]
)
## Time control
@@ -334,7 +333,7 @@ func _update_info() -> void:
_technology_current_research_label.set_text("TB_TECH_NO_CURRENT")
if _technology_literacy_label:
- _technology_literacy_label.set_text("§Y%s%%" % GUINode.float_to_string_dp(80.0, 1))
+ _technology_literacy_label.set_text("§Y%s§W%%" % GUINode.float_to_string_dp(80.0, 1))
if _technology_research_points_label:
_technology_research_points_label.set_text("§Y%s" % GUINode.float_to_string_dp(10.0, 2))