diff --git a/addons/escoria-core/game/core-scripts/esc/esc_runner_level.gd b/addons/escoria-core/game/core-scripts/esc/esc_runner_level.gd index 7f54d23f..e423d371 100644 --- a/addons/escoria-core/game/core-scripts/esc/esc_runner_level.gd +++ b/addons/escoria-core/game/core-scripts/esc/esc_runner_level.gd @@ -465,9 +465,18 @@ func say(command_params : Array) -> esctypes: # Manage specific dialog scene if command_params.size() > 2: dialog_scene_name = command_params[2] - + + # Manage translation/voice lines keys in the form of : + # line_key:"Default line text" + # If a line_key exists, we'll set it a label as it will automatically be + # translated + var dialog_key_line = command_params[1].split(":", true, 1) + if dialog_key_line.size() > 1: + dialog_key_line[1] = dialog_key_line[1].trim_prefix("\"") + dict = { - "line": command_params[1], + "key": dialog_key_line[0], + "line": dialog_key_line[1] if dialog_key_line.size() > 1 else dialog_key_line[0], "ui": dialog_scene_name #"ui": "dialog_label" #"ui": "dialog_box_inset" diff --git a/addons/escoria-core/game/scenes/dialogs/dialog_player.gd b/addons/escoria-core/game/scenes/dialogs/dialog_player.gd index 6c64f9bd..7e7ba12c 100644 --- a/addons/escoria-core/game/scenes/dialogs/dialog_player.gd +++ b/addons/escoria-core/game/scenes/dialogs/dialog_player.gd @@ -40,7 +40,8 @@ func preload_resources(path : String): add_resource(basename, dialog_scene) file_name = dialog_folder.get_next() else: - escoria.logger.report_errors("dialog_player.gd:preload_resources()", ["An error occurred when trying to access the path: {_}.".format(path)]) + escoria.logger.report_errors("dialog_player.gd:preload_resources()", + ["An error occurred when trying to access the path: {_}.".format(path)]) func say(character : String, params : Dictionary): diff --git a/addons/escoria-core/template_scenes/dialog_scenes/dialog_label.gd b/addons/escoria-core/template_scenes/dialog_scenes/dialog_label.gd index df28aec0..afcb69de 100644 --- a/addons/escoria-core/template_scenes/dialog_scenes/dialog_label.gd +++ b/addons/escoria-core/template_scenes/dialog_scenes/dialog_label.gd @@ -43,7 +43,12 @@ func say(character : String, params : Dictionary) : var text_color = current_character.dialog_color var text_color_html = text_color.to_html(false) - text_node.bbcode_text = "[center][color=#" + text_color_html + "]".format([text_color_html]) + params["line"] + "[/color][center]" + if params["key"] != params["line"]: + text_node.bbcode_text = "[center][color=#" + text_color_html + "]" \ + .format([text_color_html]) + tr(params["key"]) + "[/color][center]" + else: + text_node.bbcode_text = "[center][color=#" + text_color_html + "]" \ + .format([text_color_html]) + params["line"] + "[/color][center]" text_node.percent_visible = 0.0 var time_show_full_text = text_speed_per_character * len(params["line"]) diff --git a/game/characters/mark/mark.tscn b/game/characters/mark/mark.tscn index a996a2ec..ea385604 100644 --- a/game/characters/mark/mark.tscn +++ b/game/characters/mark/mark.tscn @@ -10,190 +10,190 @@ [sub_resource type="AtlasTexture" id=1] atlas = ExtResource( 4 ) -region = Rect2( 72, 0, 24, 70 ) +region = Rect2( 336, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=2] -atlas = ExtResource( 5 ) -region = Rect2( 0, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 360, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=3] -atlas = ExtResource( 5 ) -region = Rect2( 24, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 384, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=4] -atlas = ExtResource( 5 ) -region = Rect2( 48, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 120, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=5] -atlas = ExtResource( 7 ) +atlas = ExtResource( 5 ) region = Rect2( 0, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=6] -atlas = ExtResource( 7 ) +atlas = ExtResource( 5 ) region = Rect2( 24, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=7] -atlas = ExtResource( 7 ) +atlas = ExtResource( 5 ) region = Rect2( 48, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=8] atlas = ExtResource( 7 ) -region = Rect2( 72, 0, 24, 70 ) +region = Rect2( 0, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=9] atlas = ExtResource( 7 ) -region = Rect2( 96, 0, 24, 70 ) +region = Rect2( 24, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=10] -atlas = ExtResource( 4 ) -region = Rect2( 0, 0, 24, 70 ) +atlas = ExtResource( 7 ) +region = Rect2( 48, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=11] -atlas = ExtResource( 4 ) -region = Rect2( 144, 0, 24, 70 ) +atlas = ExtResource( 7 ) +region = Rect2( 72, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=12] -atlas = ExtResource( 4 ) -region = Rect2( 168, 0, 24, 70 ) +atlas = ExtResource( 7 ) +region = Rect2( 96, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=13] atlas = ExtResource( 4 ) -region = Rect2( 192, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=14] -atlas = ExtResource( 6 ) region = Rect2( 0, 0, 24, 70 ) +[sub_resource type="AtlasTexture" id=14] +atlas = ExtResource( 4 ) +region = Rect2( 144, 0, 24, 70 ) + [sub_resource type="AtlasTexture" id=15] -atlas = ExtResource( 6 ) -region = Rect2( 24, 0, 24, 70 ) +atlas = ExtResource( 4 ) +region = Rect2( 168, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=16] atlas = ExtResource( 4 ) -region = Rect2( 48, 0, 24, 70 ) +region = Rect2( 192, 0, 24, 70 ) [sub_resource type="AtlasTexture" id=17] +atlas = ExtResource( 6 ) +region = Rect2( 0, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=18] +atlas = ExtResource( 6 ) +region = Rect2( 24, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=19] +atlas = ExtResource( 4 ) +region = Rect2( 48, 0, 24, 70 ) + +[sub_resource type="AtlasTexture" id=20] atlas = ExtResource( 4 ) region = Rect2( 96, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=18] +[sub_resource type="AtlasTexture" id=21] atlas = ExtResource( 2 ) region = Rect2( 0, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=19] +[sub_resource type="AtlasTexture" id=22] atlas = ExtResource( 2 ) region = Rect2( 24, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=20] +[sub_resource type="AtlasTexture" id=23] atlas = ExtResource( 2 ) region = Rect2( 48, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=21] +[sub_resource type="AtlasTexture" id=24] atlas = ExtResource( 4 ) region = Rect2( 216, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=22] +[sub_resource type="AtlasTexture" id=25] atlas = ExtResource( 4 ) region = Rect2( 240, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=23] +[sub_resource type="AtlasTexture" id=26] atlas = ExtResource( 4 ) region = Rect2( 264, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=24] +[sub_resource type="AtlasTexture" id=27] atlas = ExtResource( 4 ) region = Rect2( 288, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=25] +[sub_resource type="AtlasTexture" id=28] atlas = ExtResource( 4 ) region = Rect2( 312, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=26] +[sub_resource type="AtlasTexture" id=29] atlas = ExtResource( 4 ) region = Rect2( 24, 0, 24, 70 ) -[sub_resource type="AtlasTexture" id=27] -atlas = ExtResource( 4 ) -region = Rect2( 336, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=28] -atlas = ExtResource( 4 ) -region = Rect2( 360, 0, 24, 70 ) - -[sub_resource type="AtlasTexture" id=29] -atlas = ExtResource( 4 ) -region = Rect2( 384, 0, 24, 70 ) - [sub_resource type="AtlasTexture" id=30] atlas = ExtResource( 4 ) -region = Rect2( 120, 0, 24, 70 ) +region = Rect2( 72, 0, 24, 70 ) [sub_resource type="SpriteFrames" id=31] animations = [ { -"frames": [ SubResource( 1 ) ], -"loop": true, -"name": "idle_up", -"speed": 5.0 -}, { -"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ], -"loop": true, -"name": "speak_down_right", -"speed": 6.0 -}, { -"frames": [ SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ) ], -"loop": true, -"name": "speak_right", -"speed": 5.0 -}, { -"frames": [ SubResource( 10 ) ], -"loop": true, -"name": "idle_down", -"speed": 5.0 -}, { -"frames": [ SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 12 ) ], -"loop": true, -"name": "walk_down", -"speed": 6.0 -}, { -"frames": [ SubResource( 14 ), SubResource( 15 ), SubResource( 14 ), SubResource( 15 ), SubResource( 15 ) ], -"loop": true, -"name": "speak_up", -"speed": 3.0 -}, { -"frames": [ SubResource( 16 ) ], -"loop": true, -"name": "idle_right", -"speed": 5.0 -}, { -"frames": [ SubResource( 17 ) ], -"loop": true, -"name": "idle_left", -"speed": 5.0 -}, { -"frames": [ SubResource( 18 ), SubResource( 19 ), SubResource( 20 ), SubResource( 19 ), SubResource( 20 ) ], -"loop": true, -"name": "speak_down", -"speed": 6.0 -}, { -"frames": [ SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ), SubResource( 25 ) ], -"loop": true, -"name": "walk_right", -"speed": 6.0 -}, { -"frames": [ SubResource( 26 ) ], -"loop": true, -"name": "idle_down_right", -"speed": 5.0 -}, { -"frames": [ SubResource( 27 ), SubResource( 28 ), SubResource( 29 ), SubResource( 28 ) ], +"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 2 ) ], "loop": true, "name": "walk_up", "speed": 6.0 }, { -"frames": [ SubResource( 30 ) ], +"frames": [ SubResource( 4 ) ], "loop": true, "name": "idle_down_left", "speed": 5.0 +}, { +"frames": [ SubResource( 5 ), SubResource( 6 ), SubResource( 7 ) ], +"loop": true, +"name": "speak_down_right", +"speed": 6.0 +}, { +"frames": [ SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ], +"loop": true, +"name": "speak_right", +"speed": 5.0 +}, { +"frames": [ SubResource( 13 ) ], +"loop": true, +"name": "idle_down", +"speed": 5.0 +}, { +"frames": [ SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 15 ) ], +"loop": true, +"name": "walk_down", +"speed": 6.0 +}, { +"frames": [ SubResource( 17 ), SubResource( 18 ), SubResource( 17 ), SubResource( 18 ), SubResource( 18 ) ], +"loop": true, +"name": "speak_up", +"speed": 3.0 +}, { +"frames": [ SubResource( 19 ) ], +"loop": true, +"name": "idle_right", +"speed": 5.0 +}, { +"frames": [ SubResource( 20 ) ], +"loop": true, +"name": "idle_left", +"speed": 5.0 +}, { +"frames": [ SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 22 ), SubResource( 23 ) ], +"loop": true, +"name": "speak_down", +"speed": 6.0 +}, { +"frames": [ SubResource( 24 ), SubResource( 25 ), SubResource( 26 ), SubResource( 27 ), SubResource( 28 ) ], +"loop": true, +"name": "walk_right", +"speed": 6.0 +}, { +"frames": [ SubResource( 29 ) ], +"loop": true, +"name": "idle_down_right", +"speed": 5.0 +}, { +"frames": [ SubResource( 30 ) ], +"loop": true, +"name": "idle_up", +"speed": 5.0 } ] [sub_resource type="CapsuleShape2D" id=32] diff --git a/game/rooms/room1/esc/wall_item.esc b/game/rooms/room1/esc/wall_item.esc index 8b409aba..4b84c863 100755 --- a/game/rooms/room1/esc/wall_item.esc +++ b/game/rooms/room1/esc/wall_item.esc @@ -1,13 +1,13 @@ :look > [! dialog_advance] - say player "I don't know what that stuff is." + say player ROOM1_look_wall_item_1:"I don't know what that stuff is." set_global dialog_advance 1 stop > [eq dialog_advance 1] - say player "I REALLY don't know what that stuff is." + say player ROOM1_look_wall_item_2:"I REALLY don't know what that stuff is." set_global dialog_advance 2 stop > [eq dialog_advance 2] - say player "No, SERIOUSLY, I have no idea what that is!" - say player "Please stop asking me that!" + say player ROOM1_look_wall_item_3:"No, SERIOUSLY, I have no idea what that is!" + say player ROOM1_look_wall_item_4:"Please stop asking me that!" stop diff --git a/game/rooms/room1/esc/wall_item_popupdialog.esc b/game/rooms/room1/esc/wall_item_popupdialog.esc index 52674d0e..36bcbde0 100755 --- a/game/rooms/room1/esc/wall_item_popupdialog.esc +++ b/game/rooms/room1/esc/wall_item_popupdialog.esc @@ -1,13 +1,13 @@ :look > [! dialog_popup_advance] - say player "I don't know what that stuff is." dialog_box_inset + say player ROOM1_look_wall_item_1"I don't know what that stuff is." dialog_box_inset set_global dialog_popup_advance 1 stop > [eq dialog_popup_advance 1] - say player "I REALLY don't know what that stuff is." dialog_box_inset + say player ROOM1_look_wall_item_2:"I REALLY don't know what that stuff is." dialog_box_inset set_global dialog_popup_advance 2 stop > [eq dialog_popup_advance 2] - say player "No, SERIOUSLY, I have no idea what that is!" dialog_box_inset - say player "Please stop asking me that!" dialog_box_inset + say player ROOM1_look_wall_item_3:"No, SERIOUSLY, I have no idea what that is!" dialog_box_inset + say player ROOM1_look_wall_item_4:"Please stop asking me that!" dialog_box_inset stop diff --git a/game/translations/game.csv b/game/translations/game.csv new file mode 100644 index 00000000..3e76593a --- /dev/null +++ b/game/translations/game.csv @@ -0,0 +1,5 @@ +keys,en,fr +ROOM1_look_wall_item_1,"I don't know what that stuff is.","Je ne sais pas ce que c'est." +ROOM1_look_wall_item_2,"I REALLY don't know what that stuff is.","Je ne sais VRAIMENT pas ce que c'est." +ROOM1_look_wall_item_3,"No, SERIOUSLY, I have no idea what that is!","Non, SÉRIEUSEMENT, je n'ai aucune idée de ce que c'est !" +ROOM1_look_wall_item_4,"Please stop asking me that!","Arrêtez de me demander !" diff --git a/game/translations/game.en.translation b/game/translations/game.en.translation new file mode 100644 index 00000000..9c947db6 Binary files /dev/null and b/game/translations/game.en.translation differ diff --git a/game/translations/game.fr.translation b/game/translations/game.fr.translation new file mode 100644 index 00000000..aceaf3f4 Binary files /dev/null and b/game/translations/game.fr.translation differ diff --git a/game/translations/main_menu.csv b/game/translations/main_menu.csv new file mode 100644 index 00000000..de05ab5b --- /dev/null +++ b/game/translations/main_menu.csv @@ -0,0 +1,7 @@ +keys,en,fr +NEW_GAME,New game,Nouvelle partie +LOAD_GAME,Load game,Charger +OPTIONS,Options,Options +QUIT,Quit,Quitter +OPTIONS_BACK,Back,Retour +OPTIONS_LANGUAGE,Language,Langue diff --git a/game/translations/main_menu.en.translation b/game/translations/main_menu.en.translation new file mode 100644 index 00000000..c1485e99 Binary files /dev/null and b/game/translations/main_menu.en.translation differ diff --git a/game/translations/main_menu.fr.translation b/game/translations/main_menu.fr.translation new file mode 100644 index 00000000..658f077f Binary files /dev/null and b/game/translations/main_menu.fr.translation differ diff --git a/game/ui/commons/main_menu/flags/en_EN.png b/game/ui/commons/main_menu/flags/en_EN.png new file mode 100644 index 00000000..bf01becd Binary files /dev/null and b/game/ui/commons/main_menu/flags/en_EN.png differ diff --git a/game/ui/commons/main_menu/flags/en_EN_small.png b/game/ui/commons/main_menu/flags/en_EN_small.png new file mode 100644 index 00000000..05892848 Binary files /dev/null and b/game/ui/commons/main_menu/flags/en_EN_small.png differ diff --git a/game/ui/commons/main_menu/flags/fr_FR.png b/game/ui/commons/main_menu/flags/fr_FR.png new file mode 100644 index 00000000..928f3f1d Binary files /dev/null and b/game/ui/commons/main_menu/flags/fr_FR.png differ diff --git a/game/ui/commons/main_menu/flags/fr_FR_small.png b/game/ui/commons/main_menu/flags/fr_FR_small.png new file mode 100644 index 00000000..fcaf2cc1 Binary files /dev/null and b/game/ui/commons/main_menu/flags/fr_FR_small.png differ diff --git a/game/ui/commons/main_menu/main.tscn b/game/ui/commons/main_menu/main.tscn new file mode 100644 index 00000000..ba51b5e3 --- /dev/null +++ b/game/ui/commons/main_menu/main.tscn @@ -0,0 +1,54 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1] + +[node name="main" type="VBoxContainer"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -179.0 +margin_top = -35.746 +margin_right = 179.0 +margin_bottom = 227.254 +custom_constants/separation = 10 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="new_game" type="Button" parent="."] +margin_right = 358.0 +margin_bottom = 152.0 +size_flags_vertical = 3 +custom_fonts/font = ExtResource( 1 ) +text = "NEW_GAME" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="load_game" type="Button" parent="."] +margin_top = 162.0 +margin_right = 358.0 +margin_bottom = 189.0 +custom_fonts/font = ExtResource( 1 ) +text = "LOAD_GAME" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="options" type="Button" parent="."] +margin_top = 199.0 +margin_right = 358.0 +margin_bottom = 226.0 +custom_fonts/font = ExtResource( 1 ) +text = "OPTIONS" + +[node name="quit" type="Button" parent="."] +margin_top = 236.0 +margin_right = 358.0 +margin_bottom = 263.0 +custom_fonts/font = ExtResource( 1 ) +text = "QUIT" +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/game/ui/commons/main_menu/main_menu.gd b/game/ui/commons/main_menu/main_menu.gd index 354ac3cc..d4d9db82 100644 --- a/game/ui/commons/main_menu/main_menu.gd +++ b/game/ui/commons/main_menu/main_menu.gd @@ -5,6 +5,18 @@ func _ready(): escoria.esc_level_runner.set_sound_state(["bg_music", "res://game/sfx/Game-Menu_Looping.mp3", true]) + +func _on_continue_pressed(): + pass + + + + + +func switch_language(lang : String): + TranslationServer.set_locale(lang) + + func _on_new_game_pressed(): escoria.new_game() @@ -12,9 +24,19 @@ func _on_load_game_pressed(): # Show Loading screen pass +func _on_options_pressed(): + $Panel/main.hide() + $Panel/options.show() + func _on_quit_pressed(): get_tree().quit() +########################################################################### +########################################################################### +# OPTIONS -func _on_continue_pressed(): - pass # Replace with function body. + +func _on_back_pressed(): + $Panel/options.hide() + $Panel/main.show() + diff --git a/game/ui/commons/main_menu/main_menu.tscn b/game/ui/commons/main_menu/main_menu.tscn index 01e226ae..d1b61398 100644 --- a/game/ui/commons/main_menu/main_menu.tscn +++ b/game/ui/commons/main_menu/main_menu.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://game/ui/commons/main_menu/main_menu.gd" type="Script" id=1] -[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=2] +[ext_resource path="res://game/ui/commons/main_menu/main.tscn" type="PackedScene" id=2] [ext_resource path="res://addons/escoria-core/logo/escoria-logo-small.png" type="Texture" id=3] +[ext_resource path="res://game/ui/commons/main_menu/options.tscn" type="PackedScene" id=4] [node name="main_menu" type="Control"] anchor_right = 1.0 @@ -32,50 +33,16 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="VBoxContainer" type="VBoxContainer" parent="Panel"] -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -179.0 -margin_top = -35.746 -margin_right = 179.0 -margin_bottom = 227.254 -custom_constants/separation = 10 -__meta__ = { -"_edit_use_anchors_": false -} +[node name="main" parent="Panel" instance=ExtResource( 2 )] -[node name="new_game" type="Button" parent="Panel/VBoxContainer"] -margin_right = 358.0 -margin_bottom = 189.0 -size_flags_vertical = 3 -custom_fonts/font = ExtResource( 2 ) -text = "New game" -__meta__ = { -"_edit_use_anchors_": false -} +[node name="options" parent="Panel" instance=ExtResource( 4 )] +visible = false -[node name="load_game" type="Button" parent="Panel/VBoxContainer"] -margin_top = 199.0 -margin_right = 358.0 -margin_bottom = 226.0 -custom_fonts/font = ExtResource( 2 ) -text = "Load game" -__meta__ = { -"_edit_use_anchors_": false -} +[connection signal="pressed" from="Panel/main/new_game" to="." method="_on_new_game_pressed"] +[connection signal="pressed" from="Panel/main/load_game" to="." method="_on_load_game_pressed"] +[connection signal="pressed" from="Panel/main/options" to="." method="_on_options_pressed"] +[connection signal="pressed" from="Panel/main/quit" to="." method="_on_quit_pressed"] +[connection signal="pressed" from="Panel/options/back" to="." method="_on_back_pressed"] -[node name="quit" type="Button" parent="Panel/VBoxContainer"] -margin_top = 236.0 -margin_right = 358.0 -margin_bottom = 263.0 -custom_fonts/font = ExtResource( 2 ) -text = "Quit" -__meta__ = { -"_edit_use_anchors_": false -} - -[connection signal="pressed" from="Panel/VBoxContainer/new_game" to="." method="_on_new_game_pressed"] -[connection signal="pressed" from="Panel/VBoxContainer/load_game" to="." method="_on_load_game_pressed"] -[connection signal="pressed" from="Panel/VBoxContainer/quit" to="." method="_on_quit_pressed"] +[editable path="Panel/main"] +[editable path="Panel/options"] diff --git a/game/ui/commons/main_menu/options.gd b/game/ui/commons/main_menu/options.gd new file mode 100644 index 00000000..b5fe5c25 --- /dev/null +++ b/game/ui/commons/main_menu/options.gd @@ -0,0 +1,11 @@ +extends Control + +func _ready(): + var locale = TranslationServer.get_locale() + +func greyout_other_languages(except_lang : String) -> void: + pass + +func _on_language_input(event : InputEvent, language : String): + if event.is_pressed(): + TranslationServer.set_locale(language) diff --git a/game/ui/commons/main_menu/options.tscn b/game/ui/commons/main_menu/options.tscn new file mode 100644 index 00000000..b6cd2221 --- /dev/null +++ b/game/ui/commons/main_menu/options.tscn @@ -0,0 +1,75 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1] +[ext_resource path="res://game/ui/commons/main_menu/flags/en_EN_small.png" type="Texture" id=2] +[ext_resource path="res://game/ui/commons/main_menu/flags/fr_FR_small.png" type="Texture" id=3] +[ext_resource path="res://game/ui/commons/main_menu/options.gd" type="Script" id=4] + +[node name="options" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 4 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="back" type="Button" parent="."] +margin_left = 130.0 +margin_top = 329.0 +margin_right = 304.0 +margin_bottom = 383.0 +custom_fonts/font = ExtResource( 1 ) +text = "OPTIONS_BACK" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="options_grid" type="GridContainer" parent="."] +anchor_left = 0.217 +anchor_top = 0.427 +anchor_right = 0.803 +anchor_bottom = 0.574 +margin_left = 0.23999 +margin_top = -0.300018 +margin_right = 17.1599 +margin_bottom = 0.400024 +custom_constants/hseparation = 167 +columns = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="options_language" type="Label" parent="options_grid"] +margin_top = 56.0 +margin_right = 220.0 +margin_bottom = 77.0 +custom_fonts/font = ExtResource( 1 ) +text = "OPTIONS_LANGUAGE" + +[node name="flags" type="HBoxContainer" parent="options_grid"] +margin_left = 387.0 +margin_right = 767.0 +margin_bottom = 133.0 +size_flags_vertical = 3 +custom_constants/separation = 30 +alignment = 1 + +[node name="fr_FR" type="TextureRect" parent="options_grid/flags"] +margin_right = 150.0 +margin_bottom = 133.0 +texture = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="en_EN" type="TextureRect" parent="options_grid/flags"] +margin_left = 180.0 +margin_right = 380.0 +margin_bottom = 133.0 +texture = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[connection signal="gui_input" from="options_grid/flags/fr_FR" to="." method="_on_language_input" binds= [ "fr_FR" ]] +[connection signal="gui_input" from="options_grid/flags/en_EN" to="." method="_on_language_input" binds= [ "en_EN" ]] diff --git a/project.godot b/project.godot index b5e9b264..117be014 100644 --- a/project.godot +++ b/project.godot @@ -157,6 +157,10 @@ switch_action_verb={ ] } +[locale] + +translations=PoolStringArray( "res://game/translations/game.csv", "res://game/translations/main_menu.csv", "res://game/translations/game.en.translation", "res://game/translations/game.fr.translation", "res://game/translations/main_menu.en.translation", "res://game/translations/main_menu.fr.translation" ) + [rendering] environment/default_environment="res://default_env.tres"