Skip to content

Commit 395d1fe

Browse files
committed
Allow for viewing information about a country by selecting it. Add basic locale support.
1 parent 46a889f commit 395d1fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+233
-7
lines changed

entities/countries/country.gd

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
extends Area2D
22
class_name Country
33

4+
enum Keys { USA }
5+
6+
@export var country_key: Keys
7+
var country_name: String
8+
9+
func _ready() -> void:
10+
var countries_view_model = ViewModelRegistry.retrieve(ViewModelRegistry.Keys.COUNTRIES) as CountriesViewModel
11+
if countries_view_model:
12+
var country_view_model = CountryViewModel.new()
13+
country_view_model.country = self
14+
countries_view_model.register_country_vm(country_key, country_view_model)
15+
416
func select() -> void:
5-
# todo: do something useful
6-
pass
17+
var countries_vm = ViewModelRegistry.retrieve(ViewModelRegistry.Keys.COUNTRIES) as CountriesViewModel
18+
if countries_vm:
19+
countries_vm.select_country(country_key)

entities/countries/usa.gd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extends Country
2+
3+
func _ready() -> void:
4+
super()
5+
country_name = tr("COUNTRY_USA_NAME")
6+

entities/countries/usa.tscn

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
[gd_scene load_steps=2 format=3 uid="uid://bsbcdmesjv6qv"]
1+
[gd_scene load_steps=3 format=3 uid="uid://bsbcdmesjv6qv"]
22

33
[ext_resource type="PackedScene" uid="uid://bww8id20reu27" path="res://entities/countries/country.tscn" id="1_jec4m"]
4+
[ext_resource type="Script" path="res://entities/countries/usa.gd" id="2_r8ovv"]
45

56
[node name="USA" instance=ExtResource("1_jec4m")]
7+
script = ExtResource("2_r8ovv")
68

79
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="." index="1"]
810
polygon = PackedVector2Array(-1177, -418, -1177, -414.7, -1180.7, -409, -1189.6, -409, -1190.6, -412, -1193.9, -412, -1204.8, -400, -1212.4, -400, -1213.4, -397, -1216, -397, -1216, -390.8, -1228.7, -376, -1242.4, -376, -1243.4, -373, -1245.3, -373, -1246.4, -370.5, -1244.1, -368.3, -1246, -365.7, -1246, -360.2, -1241.8, -356, -1237.1, -356, -1233.1, -350, -1228, -350, -1228, -344.6, -1225, -343.6, -1225, -341, -1209.8, -341, -1207, -338.2, -1207, -335.2, -1198, -334.2, -1209.4, -334, -1210.4, -331, -1222.7, -331, -1226.7, -340, -1229.8, -340, -1239.7, -331, -1248.1, -331, -1252.1, -325, -1254.2, -325, -1255.3, -322.8, -1251, -317, -1243, -317, -1246, -315.4, -1246, -311.7, -1237, -307.8, -1237, -305, -1214.8, -305, -1213.1, -308.4, -1210, -309.1, -1210, -299.6, -1207, -298.6, -1207, -295, -1207.6, -295, -1208.6, -298, -1215.2, -298, -1219.7, -289, -1222.6, -289, -1223.6, -292, -1230.1, -292, -1234.1, -286, -1236.5, -286, -1237.3, -283.2, -1234, -281, -1234, -279.8, -1239.8, -274, -1243, -274, -1243, -263.9, -1237, -259.9, -1237, -255, -1228, -248.1, -1228, -245, -1214.6, -245, -1213.6, -248, -1213, -248, -1213, -233.6, -1210, -232.6, -1210, -230.5, -1207.2, -229.7, -1204.9, -233, -1197.8, -233, -1195, -230.2, -1195, -226, -1186, -229.6, -1177, -229.2, -1192.8, -211, -1196.7, -211, -1203.7, -205, -1211.8, -205, -1221.7, -196, -1230, -196, -1234.8, -190, -1239.4, -190, -1240.4, -187, -1245.1, -187, -1249.1, -181, -1256.8, -181, -1264, -173.8, -1264, -170.6, -1261, -169.6, -1261, -167, -1253.6, -167, -1252.6, -170, -1244.9, -170, -1240.9, -176, -1232.8, -176, -1228.3, -185, -1221, -185, -1217.2, -189.9, -1214.7, -188, -1212.3, -188, -1205.3, -194, -1204.1, -194, -1200.1, -188, -1196.6, -188, -1195.6, -191, -1193.7, -191, -1192.6, -193.5, -1195.5, -196.3, -1195.2, -197, -1188.1, -197, -1180.2, -206, -1176.2, -206, -1151.2, -230, -1148.7, -230, -1147.6, -232.5, -1150, -234.8, -1148, -237.3, -1148, -240.4, -1151, -241.5, -1151, -242.2, -1142.2, -251, -1141, -251, -1141.8, -241, -1143.5, -241, -1144.3, -238.2, -1141, -236, -1141, -233.5, -1138.2, -232.7, -1135.9, -236, -1131.1, -236, -1120.2, -248, -1112.6, -248, -1111.6, -251, -1108.5, -251, -1110.5, -260, -1104.8, -260, -1099, -254.2, -1099, -251, -1090.4, -251, -1089.4, -248, -1068.8, -248, -1066, -245.2, -1066, -242, -1056.8, -242, -1054, -239.2, -1054, -236, -1047.8, -236, -1042, -230.2, -1042, -227, -1032.1, -227, -1036, -225.3, -1036, -222.2, -1024, -209.2, -1024, -204.2, -1019.8, -200, -1015, -200, -1015, -194.9, -1009, -190.9, -1009, -187.4, -998.5, -190.1, -995.7, -188, -989.9, -188, -985.9, -194, -983, -194, -983, -203.8, -990.2, -211, -995, -211, -1004, -222.7, -1004, -225.2, -1006.2, -226.3, -1007, -225.8, -1007, -230.8, -1022, -246.9, -1022, -250, -1029.4, -250, -1030.4, -247, -1033, -247, -1033, -240.8, -1035.8, -238, -1037.2, -238, -1040, -240.8, -1040, -246, -1049, -253, -1049, -255.8, -1061, -256.9, -1061, -388, -1067.2, -388, -1073, -393.8, -1073, -397, -1086.4, -397, -1087.4, -394, -1093.6, -394, -1094.6, -397, -1115.2, -397, -1118, -399.8, -1118, -403, -1131.4, -403, -1132.4, -400, -1139.2, -400, -1145, -405.8, -1145, -408.8, -1157, -409.9, -1157, -412, -1163, -412, -1163, -414.4, -1166, -415.5, -1166, -418)

locale/countries.pot

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# LANGUAGE translation for project-evergreen for the following files:
2+
# res://entities/countries/usa.gd
3+
#
4+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5+
#
6+
#, fuzzy
7+
msgid ""
8+
msgstr ""
9+
"Project-Id-Version: project-evergreen\n"
10+
"MIME-Version: 1.0\n"
11+
"Content-Type: text/plain; charset=UTF-8\n"
12+
"Content-Transfer-Encoding: 8-bit\n"
13+
14+
#: entities/countries/usa.gd
15+
msgid "COUNTRY_USA_NAME"
16+
msgstr ""

locale/en.mo

342 Bytes
Binary file not shown.

locale/en.po

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# LANGUAGE translation for project-evergreen for the following files:
2+
# res://entities/countries/usa.gd
3+
#
4+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5+
#
6+
#, fuzzy
7+
msgid ""
8+
msgstr ""
9+
"Project-Id-Version: project-evergreen\n"
10+
"POT-Creation-Date: \n"
11+
"PO-Revision-Date: \n"
12+
"Last-Translator: \n"
13+
"Language-Team: \n"
14+
"Language: en\n"
15+
"MIME-Version: 1.0\n"
16+
"Content-Type: text/plain; charset=UTF-8\n"
17+
"Content-Transfer-Encoding: 8bit\n"
18+
"X-Generator: Poedit 3.5\n"
19+
20+
#: entities/countries/usa.gd
21+
msgid "COUNTRY_USA_NAME"
22+
msgstr "United States of America"

locale/zh_TW.mo

327 Bytes
Binary file not shown.

locale/zh_TW.po

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# LANGUAGE translation for project-evergreen for the following files:
2+
# res://entities/countries/usa.gd
3+
#
4+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5+
#
6+
#, fuzzy
7+
msgid ""
8+
msgstr ""
9+
"Project-Id-Version: project-evergreen\n"
10+
"POT-Creation-Date: \n"
11+
"PO-Revision-Date: \n"
12+
"Last-Translator: \n"
13+
"Language-Team: \n"
14+
"Language: zh_TW\n"
15+
"MIME-Version: 1.0\n"
16+
"Content-Type: text/plain; charset=UTF-8\n"
17+
"Content-Transfer-Encoding: 8bit\n"
18+
"X-Generator: Poedit 3.5\n"
19+
20+
#: entities/countries/usa.gd
21+
msgid "COUNTRY_USA_NAME"
22+
msgstr "美國"

project.godot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,8 @@ select={
6262
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
6363
]
6464
}
65+
66+
[internationalization]
67+
68+
locale/translations=PackedStringArray("res://locale/en.mo", "res://locale/zh_TW.mo")
69+
locale/translations_pot_files=PackedStringArray("res://entities/countries/usa.gd")

scenes/main/main.tscn

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
[gd_scene load_steps=7 format=3 uid="uid://d3nj6rt0cm53e"]
1+
[gd_scene load_steps=8 format=3 uid="uid://d3nj6rt0cm53e"]
22

33
[ext_resource type="PackedScene" uid="uid://xlfbl7fowoic" path="res://scenes/worldmap/world_map.tscn" id="1_cjno1"]
4+
[ext_resource type="PackedScene" uid="uid://qjjw8mvvjabt" path="res://ui/viewmodels/vm_countries.tscn" id="1_grghp"]
45
[ext_resource type="PackedScene" uid="uid://bnqxch8qylr8l" path="res://ui/widgets/hud.tscn" id="2_jggq6"]
56
[ext_resource type="PackedScene" uid="uid://2hgdqurtbrxg" path="res://scenes/common/player_controller.tscn" id="3_jr0xa"]
67
[ext_resource type="PackedScene" uid="uid://dap6c80qsg2ip" path="res://entities/music_player_component.tscn" id="3_l6axm"]
@@ -9,6 +10,10 @@
910

1011
[node name="World" type="Node2D"]
1112

13+
[node name="GlobalViewModels" type="Node" parent="."]
14+
15+
[node name="CountriesViewModel" parent="GlobalViewModels" instance=ExtResource("1_grghp")]
16+
1217
[node name="Components" type="Node" parent="."]
1318

1419
[node name="CameraComponent" parent="Components" instance=ExtResource("4_xha1d")]

0 commit comments

Comments
 (0)