Adding basic window for developper tools

This commit is contained in:
yannk 2022-04-16 10:35:18 +02:00
parent f451c4e3d4
commit 9f07705b62
8 changed files with 96 additions and 51 deletions

View file

@ -65,6 +65,9 @@ msgstr "Themes"
msgid "HUD/LANGUAGES" msgid "HUD/LANGUAGES"
msgstr "Languages" msgstr "Languages"
msgid "HUD/DEV"
msgstr "Developper"
msgid "HUD/ABOUT" msgid "HUD/ABOUT"
msgstr "About" msgstr "About"
@ -301,3 +304,9 @@ msgstr "Reverse vertical"
msgid "NO_MOUSE_BUTTON" msgid "NO_MOUSE_BUTTON"
msgstr "Nothing" msgstr "Nothing"
msgid "win_developper"
msgstr "Developper"
msgid "lab_dev_tools"
msgstr "Developper tools"

View file

@ -65,6 +65,9 @@ msgstr "Thèmes"
msgid "HUD/LANGUAGES" msgid "HUD/LANGUAGES"
msgstr "Langue" msgstr "Langue"
msgid "HUD/DEV"
msgstr "Développeur"
msgid "HUD/ABOUT" msgid "HUD/ABOUT"
msgstr "A propos" msgstr "A propos"
@ -75,7 +78,7 @@ msgid "POPUP_CONFIRM_QUIT/TITLE"
msgstr "Merci de confirmer" msgstr "Merci de confirmer"
msgid "POPUP_CONFIRM_QUIT/MESSAGE" msgid "POPUP_CONFIRM_QUIT/MESSAGE"
msgstr "Voulez-vous fermer le jeux ?" msgstr "Voulez-vous fermer le jeu ?"
msgid "OK" msgid "OK"
msgstr "Valider" msgstr "Valider"
@ -301,3 +304,9 @@ msgstr "Inversé verticale"
msgid "NO_MOUSE_BUTTON" msgid "NO_MOUSE_BUTTON"
msgstr "Rien n'est sélectionné" msgstr "Rien n'est sélectionné"
msgid "win_developper"
msgstr "Développeur"
msgid "lab_dev_tools"
msgstr "Outils de développement"

Binary file not shown.

View file

@ -56,6 +56,9 @@ msgstr ""
msgid "HUD/LANGUAGES" msgid "HUD/LANGUAGES"
msgstr "" msgstr ""
msgid "HUD/DEV"
msgstr ""
msgid "HUD/ABOUT" msgid "HUD/ABOUT"
msgstr "" msgstr ""
@ -293,5 +296,9 @@ msgstr ""
msgid "NO_MOUSE_BUTTON" msgid "NO_MOUSE_BUTTON"
msgstr "" msgstr ""
msgid "win_developper"
msgstr ""
msgid "lab_dev_tools"
msgstr ""

View file

@ -0,0 +1,35 @@
[gd_scene load_steps=2 format=3 uid="uid://cua4782cbjhla"]
[ext_resource type="Script" path="res://scenes/languages/languages.gd" id="1_irmml"]
[node name="Control" type="Control"]
script = ExtResource( "1_irmml" )
[node name="Window" type="Window" parent="."]
title = "win_developper"
visible = false
[node name="VBoxContainer" type="VBoxContainer" parent="Window"]
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
metadata/_edit_use_custom_anchors = false
[node name="Label" type="Label" parent="Window/VBoxContainer"]
offset_right = 40.0
offset_bottom = 23.0
text = "lab_dev_tools"
[node name="Quit" type="Button" parent="Window/VBoxContainer"]
offset_top = 35.0
offset_right = 43.0
offset_bottom = 66.0
size_flags_horizontal = 4
size_flags_vertical = 8
text = "Quit"
[connection signal="close_requested" from="Window" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="Window/VBoxContainer/Quit" to="." method="_on_quit_pressed"]

View file

@ -66,6 +66,9 @@ func _on_themes_pressed():
$MenuTheme/Window.popup_centered() $MenuTheme/Window.popup_centered()
$MenuTheme/Window.visible = true $MenuTheme/Window.visible = true
func _on_dev_pressed():
$MenuDev/Window.popup_centered()
$MenuDev/Window.visible = true
func _on_about_pressed(): func _on_about_pressed():
var aboutmessage:String var aboutmessage:String

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://cdyi1a858p7em"] [gd_scene load_steps=8 format=3 uid="uid://cdyi1a858p7em"]
[ext_resource type="Theme" uid="uid://bi1js53ni6ehd" path="res://UI/themes/zbasu/zbasu.theme" id="1_iq3fo"] [ext_resource type="Theme" uid="uid://bi1js53ni6ehd" path="res://UI/themes/zbasu/zbasu.theme" id="1_iq3fo"]
[ext_resource type="Script" path="res://scenes/hud/hud.gd" id="1_s6f6d"] [ext_resource type="Script" path="res://scenes/hud/hud.gd" id="1_s6f6d"]
@ -6,6 +6,7 @@
[ext_resource type="PackedScene" uid="uid://cl8xk8w3jmta0" path="res://scenes/controls/controls.tscn" id="3_08xl7"] [ext_resource type="PackedScene" uid="uid://cl8xk8w3jmta0" path="res://scenes/controls/controls.tscn" id="3_08xl7"]
[ext_resource type="PackedScene" uid="uid://cb0gfweooxdsl" path="res://scenes/themes/themes.tscn" id="4_1poje"] [ext_resource type="PackedScene" uid="uid://cb0gfweooxdsl" path="res://scenes/themes/themes.tscn" id="4_1poje"]
[ext_resource type="PackedScene" uid="uid://ebfrhgrluixd" path="res://scenes/music/music_manager.tscn" id="6_0ivsi"] [ext_resource type="PackedScene" uid="uid://ebfrhgrluixd" path="res://scenes/music/music_manager.tscn" id="6_0ivsi"]
[ext_resource type="PackedScene" uid="uid://cua4782cbjhla" path="res://scenes/developper/developper.tscn" id="7_45giw"]
[node name="Control" type="Control"] [node name="Control" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
@ -27,42 +28,50 @@ size_flags_vertical = 1
text = "Echap = Menu" text = "Echap = Menu"
[node name="Menu" type="HBoxContainer" parent="."] [node name="Menu" type="HBoxContainer" parent="."]
visible = false
anchor_right = 1.0 anchor_right = 1.0
offset_right = 40.0 offset_right = 40.0
offset_bottom = 40.0 offset_bottom = 40.0
alignment = 1 alignment = 1
[node name="Keys" type="Button" parent="Menu"] [node name="Keys" type="Button" parent="Menu"]
offset_left = 510.0 offset_left = 205.0
offset_right = 554.0 offset_right = 282.0
offset_bottom = 40.0 offset_bottom = 40.0
text = "HUD/KEYS" text = "HUD/KEYS"
[node name="Themes" type="Button" parent="Menu"] [node name="Themes" type="Button" parent="Menu"]
offset_right = 8.0 offset_left = 285.0
offset_bottom = 31.0 offset_right = 386.0
offset_bottom = 40.0
text = "HUD/THEMES" text = "HUD/THEMES"
[node name="Languages" type="Button" parent="Menu"] [node name="Languages" type="Button" parent="Menu"]
offset_left = 492.0 offset_left = 389.0
offset_right = 574.0 offset_right = 520.0
offset_bottom = 40.0 offset_bottom = 40.0
text = "HUD/LANGUAGES" text = "HUD/LANGUAGES"
[node name="Music" type="Button" parent="Menu"] [node name="Music" type="Button" parent="Menu"]
offset_right = 87.0 offset_left = 523.0
offset_bottom = 19.0 offset_right = 610.0
offset_bottom = 40.0
text = "HUD/MUSIC" text = "HUD/MUSIC"
[node name="Dev" type="Button" parent="Menu"]
offset_left = 613.0
offset_right = 684.0
offset_bottom = 40.0
text = "HUD/DEV"
[node name="About" type="Button" parent="Menu"] [node name="About" type="Button" parent="Menu"]
offset_right = 40.0 offset_left = 687.0
offset_bottom = 19.0 offset_right = 779.0
offset_bottom = 40.0
text = "HUD/ABOUT" text = "HUD/ABOUT"
[node name="Quit" type="Button" parent="Menu"] [node name="Quit" type="Button" parent="Menu"]
offset_left = 578.0 offset_left = 782.0
offset_right = 619.0 offset_right = 858.0
offset_bottom = 40.0 offset_bottom = 40.0
text = "HUD/QUIT" text = "HUD/QUIT"
@ -87,11 +96,19 @@ visible = false
visible = false visible = false
[node name="MusicManager" parent="." instance=ExtResource( "6_0ivsi" )] [node name="MusicManager" parent="." instance=ExtResource( "6_0ivsi" )]
visible = false
[node name="MenuDev" parent="." instance=ExtResource( "7_45giw" )]
offset_left = 174.0
offset_top = 4.0
offset_right = 174.0
offset_bottom = 4.0
[connection signal="pressed" from="Menu/Keys" to="." method="_on_keys_pressed"] [connection signal="pressed" from="Menu/Keys" to="." method="_on_keys_pressed"]
[connection signal="pressed" from="Menu/Themes" to="." method="_on_themes_pressed"] [connection signal="pressed" from="Menu/Themes" to="." method="_on_themes_pressed"]
[connection signal="pressed" from="Menu/Languages" to="." method="_on_languages_pressed"] [connection signal="pressed" from="Menu/Languages" to="." method="_on_languages_pressed"]
[connection signal="pressed" from="Menu/Music" to="." method="_on_music_pressed"] [connection signal="pressed" from="Menu/Music" to="." method="_on_music_pressed"]
[connection signal="pressed" from="Menu/Dev" to="." method="_on_dev_pressed"]
[connection signal="pressed" from="Menu/About" to="." method="_on_about_pressed"] [connection signal="pressed" from="Menu/About" to="." method="_on_about_pressed"]
[connection signal="pressed" from="Menu/Quit" to="." method="_on_quit_pressed"] [connection signal="pressed" from="Menu/Quit" to="." method="_on_quit_pressed"]
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] [connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]

View file

@ -2,42 +2,7 @@ extends Control
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
$Window/VBoxContainer/Select.clear() pass
var id = 0
var selected = -1
var near_selected = -1
var current_locale = TranslationServer.get_locale()
var root_language = current_locale.split('_')[0]
for key in TranslationServer.get_loaded_locales():
if key == TranslationServer.get_locale():
selected = id
else:
var tmp = key.split("_")
# print("tmp:" + tmp[0])
if tmp[0] == root_language:
if tmp.size() == 1:
near_selected = id
elif near_selected == -1:
near_selected = id
$Window/VBoxContainer/Select.add_item(TranslationServer.get_locale_name(key) + " [" + key + "]", id)
id += 1
if selected == -1 and near_selected != -1:
selected = near_selected
if selected == -1:
# Your language not exist, create it just for the form
var key = TranslationServer.get_locale()
$Window/VBoxContainer/Select.add_item(TranslationServer.get_locale_name(key) + " (" + key + " !)", id)
selected = id
$Window/VBoxContainer/Select.select(selected)
func _on_select_item_selected(_index):
var pos = 0
for key in TranslationServer.get_loaded_locales():
if pos == $Window/VBoxContainer/Select.get_selected():
TranslationServer.set_locale(key)
return
pos += 1
func _on_quit_pressed(): func _on_quit_pressed():