From fd1202ada5cece7e3298cce7c778bef7271321b3 Mon Sep 17 00:00:00 2001 From: Gone2Daly <71726742+Gone2Daly@users.noreply.github.com> Date: Mon, 4 Sep 2023 20:16:22 +0200 Subject: Labels and localisation --- game/localisation/en_GB/top_panel.csv | 13 +++++++ game/localisation/en_GB/top_panel.csv.import | 3 ++ .../GameSession/MainManagamentPanel/BudgetPanel.gd | 5 ++- .../MainManagamentPanel/CountryPanel.gd | 7 ++++ .../MainManagamentPanel/DiplomacyPanel.gd | 7 ++++ .../MainManagamentPanel/MainManagamentPanel.tscn | 45 +++++++++++++++++++++- .../MainManagamentPanel/MilitaryPanel.gd | 7 ++++ .../MainManagamentPanel/PoliticsPanel.gd | 7 ++++ .../MainManagamentPanel/PopulationPanel.gd | 7 ++++ .../GameSession/MainManagamentPanel/PopupPanel.gd | 4 +- .../MainManagamentPanel/PopupPanel.tscn | 20 +++++++++- .../MainManagamentPanel/ProductionPanel.gd | 7 ++++ .../MainManagamentPanel/TechnologyPanel.gd | 7 ++++ .../GameSession/MainManagamentPanel/TradePanel.gd | 7 ++++ 14 files changed, 139 insertions(+), 7 deletions(-) create mode 100644 game/localisation/en_GB/top_panel.csv create mode 100644 game/localisation/en_GB/top_panel.csv.import create mode 100644 game/src/Game/GameSession/MainManagamentPanel/CountryPanel.gd create mode 100644 game/src/Game/GameSession/MainManagamentPanel/DiplomacyPanel.gd create mode 100644 game/src/Game/GameSession/MainManagamentPanel/MilitaryPanel.gd create mode 100644 game/src/Game/GameSession/MainManagamentPanel/PoliticsPanel.gd create mode 100644 game/src/Game/GameSession/MainManagamentPanel/PopulationPanel.gd create mode 100644 game/src/Game/GameSession/MainManagamentPanel/ProductionPanel.gd create mode 100644 game/src/Game/GameSession/MainManagamentPanel/TechnologyPanel.gd create mode 100644 game/src/Game/GameSession/MainManagamentPanel/TradePanel.gd (limited to 'game') diff --git a/game/localisation/en_GB/top_panel.csv b/game/localisation/en_GB/top_panel.csv new file mode 100644 index 0000000..e8f1d55 --- /dev/null +++ b/game/localisation/en_GB/top_panel.csv @@ -0,0 +1,13 @@ + +;; Top Panel +PRODUCTION_TOP_PANEL;Production +BUDGET_TOP_PANEL;Budget +TECHNOLOGY_TOP_PANEL;Technology +POLITICS_TOP_PANEL;Politics +POPULATION_TOP_PANEL;Population +TRADE_TOP_PANEL;Trade +DIPLOMACY_TOP_PANEL;Diplomacy +MILITARY_TOP_PANEL;Military +COUNTRY_TOP_PANEL;Country +EXAMPLE_POPUP;Example of working localisation +EXAMPLE_POPUP_BUDGET;Example of BUDGET Popup localisation \ No newline at end of file diff --git a/game/localisation/en_GB/top_panel.csv.import b/game/localisation/en_GB/top_panel.csv.import new file mode 100644 index 0000000..8dd0c09 --- /dev/null +++ b/game/localisation/en_GB/top_panel.csv.import @@ -0,0 +1,3 @@ +[remap] + +importer="keep" diff --git a/game/src/Game/GameSession/MainManagamentPanel/BudgetPanel.gd b/game/src/Game/GameSession/MainManagamentPanel/BudgetPanel.gd index ba72a01..6a3a3ea 100644 --- a/game/src/Game/GameSession/MainManagamentPanel/BudgetPanel.gd +++ b/game/src/Game/GameSession/MainManagamentPanel/BudgetPanel.gd @@ -1,6 +1,7 @@ extends Button -var Pan = load("res://src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn") +var PopPanel = load("res://src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn") func _on_pressed(): - var spawn = Pan.instantiate() + var spawn = PopPanel.instantiate() + spawn.PanelName = "EXAMPLE_POPUP_BUDGET" $"../../..".add_child(spawn) # Spawning window on MainManagamentPanel diff --git a/game/src/Game/GameSession/MainManagamentPanel/CountryPanel.gd b/game/src/Game/GameSession/MainManagamentPanel/CountryPanel.gd new file mode 100644 index 0000000..c4e3eb6 --- /dev/null +++ b/game/src/Game/GameSession/MainManagamentPanel/CountryPanel.gd @@ -0,0 +1,7 @@ +extends Button +var PopPanel = load("res://src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn") + +func _on_pressed(): + var spawn = PopPanel.instantiate() + spawn.PanelName = "EXAMPLE_POPUP" + $"../../..".add_child(spawn) # Spawning window on MainManagamentPanel diff --git a/game/src/Game/GameSession/MainManagamentPanel/DiplomacyPanel.gd b/game/src/Game/GameSession/MainManagamentPanel/DiplomacyPanel.gd new file mode 100644 index 0000000..c4e3eb6 --- /dev/null +++ b/game/src/Game/GameSession/MainManagamentPanel/DiplomacyPanel.gd @@ -0,0 +1,7 @@ +extends Button +var PopPanel = load("res://src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn") + +func _on_pressed(): + var spawn = PopPanel.instantiate() + spawn.PanelName = "EXAMPLE_POPUP" + $"../../..".add_child(spawn) # Spawning window on MainManagamentPanel diff --git a/game/src/Game/GameSession/MainManagamentPanel/MainManagamentPanel.tscn b/game/src/Game/GameSession/MainManagamentPanel/MainManagamentPanel.tscn index abe720e..0eb9730 100644 --- a/game/src/Game/GameSession/MainManagamentPanel/MainManagamentPanel.tscn +++ b/game/src/Game/GameSession/MainManagamentPanel/MainManagamentPanel.tscn @@ -1,6 +1,14 @@ -[gd_scene load_steps=2 format=3 uid="uid://cyr5e31ucu44d"] +[gd_scene load_steps=10 format=3 uid="uid://cyr5e31ucu44d"] [ext_resource type="Script" path="res://src/Game/GameSession/MainManagamentPanel/BudgetPanel.gd" id="1_5jsre"] +[ext_resource type="Script" path="res://src/Game/GameSession/MainManagamentPanel/ProductionPanel.gd" id="1_7nvhi"] +[ext_resource type="Script" path="res://src/Game/GameSession/MainManagamentPanel/TechnologyPanel.gd" id="3_i0cql"] +[ext_resource type="Script" path="res://src/Game/GameSession/MainManagamentPanel/PoliticsPanel.gd" id="4_b1w56"] +[ext_resource type="Script" path="res://src/Game/GameSession/MainManagamentPanel/PopulationPanel.gd" id="5_e3kg5"] +[ext_resource type="Script" path="res://src/Game/GameSession/MainManagamentPanel/TradePanel.gd" id="6_lrvon"] +[ext_resource type="Script" path="res://src/Game/GameSession/MainManagamentPanel/DiplomacyPanel.gd" id="7_4ixxg"] +[ext_resource type="Script" path="res://src/Game/GameSession/MainManagamentPanel/MilitaryPanel.gd" id="8_oxtyy"] +[ext_resource type="Script" path="res://src/Game/GameSession/MainManagamentPanel/CountryPanel.gd" id="9_c6qjc"] [node name="MainManagamentPanel" type="Control"] layout_mode = 3 @@ -18,44 +26,77 @@ offset_bottom = 100.0 [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] layout_mode = 2 -size_flags_vertical = 3 [node name="ProductionPanel" type="Button" parent="VBoxContainer/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 +text = "PRODUCTION_TOP_PANEL" +clip_text = true +script = ExtResource("1_7nvhi") [node name="BudgetPanel" type="Button" parent="VBoxContainer/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 +text = "BUDGET_TOP_PANEL" +clip_text = true script = ExtResource("1_5jsre") [node name="TechnologyPanel" type="Button" parent="VBoxContainer/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 +text = "TECHNOLOGY_TOP_PANEL" +clip_text = true +script = ExtResource("3_i0cql") [node name="PoliticsPanel" type="Button" parent="VBoxContainer/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 +text = "POLITICS_TOP_PANEL" +clip_text = true +script = ExtResource("4_b1w56") [node name="PopulationPanel" type="Button" parent="VBoxContainer/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 +text = "POPULATION_TOP_PANEL" +clip_text = true +script = ExtResource("5_e3kg5") [node name="TradePanel" type="Button" parent="VBoxContainer/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 +text = "TRADE_TOP_PANEL" +clip_text = true +script = ExtResource("6_lrvon") [node name="DiplomacyPanel" type="Button" parent="VBoxContainer/HBoxContainer"] +clip_contents = true layout_mode = 2 size_flags_horizontal = 3 +text = "DIPLOMACY_TOP_PANEL" +clip_text = true +script = ExtResource("7_4ixxg") [node name="MilitaryPanel" type="Button" parent="VBoxContainer/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 +text = "MILITARY_TOP_PANEL" +clip_text = true +script = ExtResource("8_oxtyy") [node name="CountryPanel" type="Button" parent="VBoxContainer"] custom_minimum_size = Vector2(100, 60) layout_mode = 2 size_flags_horizontal = 0 +text = "COUNTRY_TOP_PANEL" +script = ExtResource("9_c6qjc") +[connection signal="pressed" from="VBoxContainer/HBoxContainer/ProductionPanel" to="VBoxContainer/HBoxContainer/ProductionPanel" method="_on_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer/BudgetPanel" to="VBoxContainer/HBoxContainer/BudgetPanel" method="_on_pressed"] +[connection signal="pressed" from="VBoxContainer/HBoxContainer/TechnologyPanel" to="VBoxContainer/HBoxContainer/TechnologyPanel" method="_on_pressed"] +[connection signal="pressed" from="VBoxContainer/HBoxContainer/PoliticsPanel" to="VBoxContainer/HBoxContainer/PoliticsPanel" method="_on_pressed"] +[connection signal="pressed" from="VBoxContainer/HBoxContainer/PopulationPanel" to="VBoxContainer/HBoxContainer/PopulationPanel" method="_on_pressed"] +[connection signal="pressed" from="VBoxContainer/HBoxContainer/TradePanel" to="VBoxContainer/HBoxContainer/TradePanel" method="_on_pressed"] +[connection signal="pressed" from="VBoxContainer/HBoxContainer/DiplomacyPanel" to="VBoxContainer/HBoxContainer/DiplomacyPanel" method="_on_pressed"] +[connection signal="pressed" from="VBoxContainer/HBoxContainer/MilitaryPanel" to="VBoxContainer/HBoxContainer/MilitaryPanel" method="_on_pressed"] +[connection signal="pressed" from="VBoxContainer/CountryPanel" to="VBoxContainer/CountryPanel" method="_on_pressed"] diff --git a/game/src/Game/GameSession/MainManagamentPanel/MilitaryPanel.gd b/game/src/Game/GameSession/MainManagamentPanel/MilitaryPanel.gd new file mode 100644 index 0000000..c4e3eb6 --- /dev/null +++ b/game/src/Game/GameSession/MainManagamentPanel/MilitaryPanel.gd @@ -0,0 +1,7 @@ +extends Button +var PopPanel = load("res://src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn") + +func _on_pressed(): + var spawn = PopPanel.instantiate() + spawn.PanelName = "EXAMPLE_POPUP" + $"../../..".add_child(spawn) # Spawning window on MainManagamentPanel diff --git a/game/src/Game/GameSession/MainManagamentPanel/PoliticsPanel.gd b/game/src/Game/GameSession/MainManagamentPanel/PoliticsPanel.gd new file mode 100644 index 0000000..c4e3eb6 --- /dev/null +++ b/game/src/Game/GameSession/MainManagamentPanel/PoliticsPanel.gd @@ -0,0 +1,7 @@ +extends Button +var PopPanel = load("res://src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn") + +func _on_pressed(): + var spawn = PopPanel.instantiate() + spawn.PanelName = "EXAMPLE_POPUP" + $"../../..".add_child(spawn) # Spawning window on MainManagamentPanel diff --git a/game/src/Game/GameSession/MainManagamentPanel/PopulationPanel.gd b/game/src/Game/GameSession/MainManagamentPanel/PopulationPanel.gd new file mode 100644 index 0000000..c4e3eb6 --- /dev/null +++ b/game/src/Game/GameSession/MainManagamentPanel/PopulationPanel.gd @@ -0,0 +1,7 @@ +extends Button +var PopPanel = load("res://src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn") + +func _on_pressed(): + var spawn = PopPanel.instantiate() + spawn.PanelName = "EXAMPLE_POPUP" + $"../../..".add_child(spawn) # Spawning window on MainManagamentPanel diff --git a/game/src/Game/GameSession/MainManagamentPanel/PopupPanel.gd b/game/src/Game/GameSession/MainManagamentPanel/PopupPanel.gd index 72e54ae..d51cd50 100644 --- a/game/src/Game/GameSession/MainManagamentPanel/PopupPanel.gd +++ b/game/src/Game/GameSession/MainManagamentPanel/PopupPanel.gd @@ -1,9 +1,9 @@ extends Control +var PanelName: String = "TEST" var _mouse_over_viewport : bool = true -var _mouse_entered : bool = true const _action_click : StringName = &"map_click" - + func _on_close_button_pressed(): self.queue_free() diff --git a/game/src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn b/game/src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn index 52cec21..9682847 100644 --- a/game/src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn +++ b/game/src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn @@ -6,9 +6,15 @@ [sub_resource type="GDScript" id="GDScript_c3oah"] script/source = "extends Panel + func _ready(): + var PanelLabel: Label = $Label + self.set_size($\"../CloseButton/Sprite2D/Control\".get_size()*$\"../CloseButton/Sprite2D\".get_scale()) # Making it equal to sprite size self.size.x = get_parent().size.x # Making it to be on whole top side + + PanelLabel.set_size(self.get_size() - $\"../CloseButton/Sprite2D/Control\".get_size()*$\"../CloseButton/Sprite2D\".get_scale()) # Not letting it clip over X button + PanelLabel.text = String(get_parent().PanelName) " [sub_resource type="GDScript" id="GDScript_vtk7h"] @@ -50,6 +56,19 @@ offset_right = 40.0 offset_bottom = 40.0 script = SubResource("GDScript_c3oah") +[node name="Label" type="Label" parent="TopPanel"] +layout_mode = 1 +anchors_preset = 4 +anchor_top = 0.5 +anchor_bottom = 0.5 +offset_top = -11.5 +offset_right = 40.0 +offset_bottom = 11.5 +grow_vertical = 2 +horizontal_alignment = 1 +vertical_alignment = 1 +autowrap_mode = 3 + [node name="CloseButton" type="Button" parent="."] layout_mode = 1 offset_right = 9.0 @@ -77,4 +96,3 @@ mouse_filter = 2 [connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"] [connection signal="gui_input" from="TopPanel" to="." method="_on_top_panel_gui_input"] [connection signal="pressed" from="CloseButton" to="." method="_on_close_button_pressed"] -[connection signal="pressed" from="CloseButton" to="." method="_on_button_pressed"] diff --git a/game/src/Game/GameSession/MainManagamentPanel/ProductionPanel.gd b/game/src/Game/GameSession/MainManagamentPanel/ProductionPanel.gd new file mode 100644 index 0000000..c4e3eb6 --- /dev/null +++ b/game/src/Game/GameSession/MainManagamentPanel/ProductionPanel.gd @@ -0,0 +1,7 @@ +extends Button +var PopPanel = load("res://src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn") + +func _on_pressed(): + var spawn = PopPanel.instantiate() + spawn.PanelName = "EXAMPLE_POPUP" + $"../../..".add_child(spawn) # Spawning window on MainManagamentPanel diff --git a/game/src/Game/GameSession/MainManagamentPanel/TechnologyPanel.gd b/game/src/Game/GameSession/MainManagamentPanel/TechnologyPanel.gd new file mode 100644 index 0000000..c4e3eb6 --- /dev/null +++ b/game/src/Game/GameSession/MainManagamentPanel/TechnologyPanel.gd @@ -0,0 +1,7 @@ +extends Button +var PopPanel = load("res://src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn") + +func _on_pressed(): + var spawn = PopPanel.instantiate() + spawn.PanelName = "EXAMPLE_POPUP" + $"../../..".add_child(spawn) # Spawning window on MainManagamentPanel diff --git a/game/src/Game/GameSession/MainManagamentPanel/TradePanel.gd b/game/src/Game/GameSession/MainManagamentPanel/TradePanel.gd new file mode 100644 index 0000000..c4e3eb6 --- /dev/null +++ b/game/src/Game/GameSession/MainManagamentPanel/TradePanel.gd @@ -0,0 +1,7 @@ +extends Button +var PopPanel = load("res://src/Game/GameSession/MainManagamentPanel/PopupPanel.tscn") + +func _on_pressed(): + var spawn = PopPanel.instantiate() + spawn.PanelName = "EXAMPLE_POPUP" + $"../../..".add_child(spawn) # Spawning window on MainManagamentPanel -- cgit v1.2.3-56-ga3b1