update windows control and locales

This commit is contained in:
AleaJactaEst 2022-02-24 23:08:03 +01:00
parent a928406d36
commit 63044b31a7
16 changed files with 248 additions and 106 deletions

View file

@ -43,3 +43,39 @@ msgstr "Select theme"
msgid "Themes"
msgstr "Theme"
msgid "EDIT_CONTROL/TITLE"
msgstr "Edit your control"
msgid "EDIT_CONTROL/SORT_BY_INPUT"
msgstr "Sort by input"
msgid "EDIT_CONTROL/RELOAD_SYSTEM_CONFIG"
msgstr "Reload system config"
msgid "EDIT_CONTROL/QUIT"
msgstr "Exit"
msgid "HUD/KEYS"
msgstr "Control"
msgid "HUD/THEMES"
msgstr "Themes"
msgid "HUD/LANGUAGES"
msgstr "Languages"
msgid "HUD/QUIT"
msgstr "Quit"
msgid "POPUP_CONFIRM_QUIT/TITLE"
msgstr "Please Confirm..."
msgid "POPUP_CONFIRM_QUIT/MESSAGE"
msgstr "Do you want quit?"
msgid "OK"
msgstr "OK"
msgid "Cancel"
msgstr "Cancel"

View file

@ -43,3 +43,39 @@ msgstr "Sélectionner le thème"
msgid "Themes"
msgstr "Thème"
msgid "EDIT_CONTROL/TITLE"
msgstr "Modifier les contrôles"
msgid "EDIT_CONTROL/SORT_BY_INPUT"
msgstr "Trié par rapport aux entrées"
msgid "EDIT_CONTROL/RELOAD_SYSTEM_CONFIG"
msgstr "Recharger la configuration système"
msgid "EDIT_CONTROL/QUIT"
msgstr "Sortir"
msgid "HUD/KEYS"
msgstr "Contrôles"
msgid "HUD/THEMES"
msgstr "Thèmes"
msgid "HUD/LANGUAGES"
msgstr "Langue"
msgid "HUD/QUIT"
msgstr "Quitter"
msgid "POPUP_CONFIRM_QUIT/TITLE"
msgstr "Merci de confirmer"
msgid "POPUP_CONFIRM_QUIT/MESSAGE"
msgstr "Voulez-vous fermer le jeux ?"
msgid "OK"
msgstr "Oui"
msgid "Cancel"
msgstr "Annuler"

View file

@ -1,4 +1,4 @@
*#!/bin/bash
#!/bin/bash
WORKDIR="$(dirname $(readlink -f $0))"
function generate_locale()

Binary file not shown.

View file

@ -34,3 +34,39 @@ msgstr ""
msgid "Themes"
msgstr ""
msgid "EDIT_CONTROL/TITLE"
msgstr ""
msgid "EDIT_CONTROL/SORT_BY_INPUT"
msgstr ""
msgid "EDIT_CONTROL/RELOAD_SYSTEM_CONFIG"
msgstr ""
msgid "EDIT_CONTROL/QUIT"
msgstr ""
msgid "HUD/KEYS"
msgstr ""
msgid "HUD/THEMES"
msgstr ""
msgid "HUD/LANGUAGES"
msgstr ""
msgid "HUD/QUIT"
msgstr ""
msgid "POPUP_CONFIRM_QUIT/TITLE"
msgstr ""
msgid "POPUP_CONFIRM_QUIT/MESSAGE"
msgstr ""
msgid "OK"
msgstr ""
msgid "Cancel"
msgstr ""

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -8,9 +8,11 @@ var action = null
func set_label( command ):
$Label.text = command
func set_action( _action ):
action = _action
func set_param(_action, _command, position):
set_label(_command)
set_action(_action)
@ -21,5 +23,7 @@ func set_param(_action, _command, position):
$Add_front.visible = false
$Add.visible = true
func _on_add_pressed():
emit_signal( "add_pressed", action, $Label.text )

View file

@ -7,9 +7,6 @@
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( "1_2cvgr" )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Add_front" type="TextureButton" parent="."]
offset_right = 23.0
@ -30,3 +27,6 @@ offset_right = 1024.0
offset_bottom = 600.0
texture_normal = ExtResource( "2_f4wes" )
stretch_mode = 3
[connection signal="pressed" from="Add_front" to="." method="_on_add_pressed"]
[connection signal="pressed" from="Add" to="." method="_on_add_pressed"]

View file

@ -9,9 +9,6 @@ anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( "1_dp231" )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Empty" type="Label" parent="."]
offset_right = 329.0
@ -30,9 +27,9 @@ size_flags_vertical = 5
offset_left = 666.0
offset_right = 690.0
offset_bottom = 600.0
hint_tooltip = "Delete"
size_flags_horizontal = 5
size_flags_vertical = 5
hint_tooltip = "Delete"
texture_normal = ExtResource( "2_r7srr" )
stretch_mode = 0
@ -42,3 +39,5 @@ offset_right = 1024.0
offset_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 5
[connection signal="pressed" from="Del" to="." method="_on_del_pressed"]

View file

@ -1,5 +1,6 @@
extends Control
signal reload_control
var control_system_conf = {}
@ -12,6 +13,10 @@ func _ready():
pass
func reload_system_config():
pass
func reload_control_system():
# Adding new Action
for key in control_system_conf:
@ -175,7 +180,26 @@ func get_string_input_joypad_button(event:InputEventJoypadButton):
func get_string_input_keyboard(event:InputEventKey):
return OS.get_keycode_string(event.keycode)
var option:String = ""
if event.is_ctrl_pressed():
option += "Control+"
if event.is_shift_pressed():
option += "Shift+"
if event.is_alt_pressed():
option += "Alt+"
if event.is_meta_pressed():
option += "MetaKey+"
# if event.is_command_pressed():
# option += "Command+"
if event.keycode == 0:
if event.physical_keycode > 0:
return option + OS.get_keycode_string(event.physical_keycode)
else:
print("Error Event unknown keycode:" , event.keycode, ", physical_keycode:", event.physical_keycode)
return option + OS.get_keycode_string(event.keycode)
func get_string_input(event):
@ -201,6 +225,7 @@ func load_current_control():
func configure_control():
print("update list control")
if $Window/VBox/Menu/SortByInput.is_pressed():
configure_control_sort_by_input()
else:
@ -208,7 +233,8 @@ func configure_control():
func configure_control_sort_by_input():
#$Window/VBox/Input/Control
for child in $Window/VBox/Input/Control.get_children():
child.queue_free()
var def = {}
for action in InputMap.get_actions():
for z in InputMap.action_get_events(action):
@ -226,9 +252,10 @@ func configure_control_sort_by_input():
$Window/VBox/Input/Control.add_child( separator )
lastevent = zhash
if z is InputEventKey:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate(1) #.instance()
item.set_param(action, get_string_input_keyboard(z), action, z)
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate() #.instance()
item.set_param(action, "Key: " + get_string_input_keyboard(z), action, z)
#item.connect( "del_pressed", self, "_on_input_box_del_pressed" )
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
#print(action,':', z, z.get_scancode_with_modifiers(),' - ', z.get_scancode(), ' - ', z.unicode , ' - ', OS.get_scancode_string(z.get_scancode_with_modifiers()))
$Window/VBox/Input/Control.add_child( item )
#$Window/VBox/Test.add_child( item )
@ -237,6 +264,7 @@ func configure_control_sort_by_input():
#item.set_label(action, "Mouse Button: " + str(z.get_button_index()))
item.set_param(action, "Mouse Button: " + get_string_input_mousse_button(z), action, z)
#item.connect( "del_pressed", self, "_on_input_box_del_pressed" )
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/VBox/Input/Control.add_child( item )
#print(action,':', z, z.get_button_mask(), ' - ', z.get_factor(), ' - ' , z.get_button_index() )
elif z is InputEventJoypadButton:
@ -245,6 +273,7 @@ func configure_control_sort_by_input():
#item.set_label(action, "Joypad Button: " + str(z.get_button_index()))
item.set_param(action, "Joypad Button: " + get_string_input_joypad_button(z), action, z)
#item.connect( "del_pressed", self, "_on_input_box_del_pressed" )
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/VBox/Input/Control.add_child( item )
for action in InputMap.get_actions():
var separator = HSeparator.new()
@ -252,12 +281,41 @@ func configure_control_sort_by_input():
var control_box = preload( "res://scenes/controls/control_function.tscn" ).instantiate()
#control_box.set_label(key)
control_box.set_param(action, action, true)
#control_box.connect( "add_pressed", self, "_on_control_box_add_pressed" )
control_box.connect( "add_pressed", _on_control_box_add_pressed.bind() )
$Window/VBox/Input/Control.add_child( control_box )
func configure_control_sort_by_categories():
print("configure_control_sort_by_categories")
for child in $Window/VBox/Input/Control.get_children():
child.queue_free()
for action in InputMap.get_actions():
var control_box = preload( "res://scenes/controls/control_function.tscn" ).instantiate()
#control_box.set_label(key)
control_box.set_param(action, action, false)
control_box.connect( "add_pressed", _on_control_box_add_pressed.bind() )
$Window/VBox/Input/Control.add_child( control_box )
var a = InputMap.action_get_events(action)
for z in a:
#print(action,':', z)
if z is InputEventKey:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate()
item.set_param(action, "Key: " + get_string_input_keyboard(z), "", z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/VBox/Input/Control.add_child( item )
elif z is InputEventMouseButton:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate()
#item.set_label(action, "Mouse Button: " + str(z.get_button_index()))
item.set_param(action, "Mouse Button: " + get_string_input_mousse_button(z), "", z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/VBox/Input/Control.add_child( item )
elif z is InputEventJoypadButton:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate()
item.set_param(action, "Joypad Button: " + get_string_input_joypad_button(z), "", z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/VBox/Input/Control.add_child( item )
var separator = HSeparator.new()
$Window/VBox/Input/Control.add_child( separator )
func load_control_system():
@ -270,3 +328,14 @@ func _on_quit_pressed():
func _on_sort_by_input_pressed():
configure_control()
func _on_input_box_del_pressed(command, control, inputevent):
print("Del:" + command + " " + control)
emit_signal("reload_control")
func _on_control_box_add_pressed(action, command):
print("Start Add:" + command)
# get_input(action, "Appuyer sur votre touche")

View file

@ -12,93 +12,63 @@ __meta__ = {
}
[node name="Window" type="Window" parent="."]
title = "Edit control"
size = Vector2i(400, 500)
title = "EDIT_CONTROL/TITLE"
position = Vector2i(25, 70)
size = Vector2i(800, 500)
visible = false
content_scale_mode = 1
content_scale_aspect = 4
[node name="VBox" type="VBoxContainer" parent="Window"]
offset_right = 40.0
offset_bottom = 40.0
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 6
size_flags_vertical = 6
__meta__ = {
"_edit_use_custom_anchors": false
}
[node name="Menu" type="HBoxContainer" parent="Window/VBox"]
offset_right = 301.0
offset_right = 1024.0
offset_bottom = 31.0
size_flags_horizontal = 3
[node name="SortByInput" type="CheckBox" parent="Window/VBox/Menu"]
offset_right = 127.0
offset_right = 510.0
offset_bottom = 31.0
size_flags_horizontal = 7
text = "Sort by input"
text = "EDIT_CONTROL/SORT_BY_INPUT"
[node name="Reload" type="Button" parent="Window/VBox/Menu"]
offset_left = 131.0
offset_right = 301.0
offset_left = 514.0
offset_right = 1024.0
offset_bottom = 31.0
size_flags_horizontal = 7
text = "Reload system config"
text = "EDIT_CONTROL/RELOAD_SYSTEM_CONFIG"
[node name="Input" type="ScrollContainer" parent="Window/VBox"]
offset_top = 35.0
offset_right = 301.0
offset_bottom = 35.0
offset_right = 1024.0
offset_bottom = 565.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Control" type="VBoxContainer" parent="Window/VBox/Input"]
offset_right = 301.0
offset_bottom = 56.0
offset_right = 1024.0
offset_bottom = 530.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Label" type="Label" parent="Window/VBox/Input/Control"]
offset_right = 293.0
offset_bottom = 26.0
size_flags_horizontal = 3
size_flags_vertical = 7
text = "Test"
[node name="Label2" type="Label" parent="Window/VBox/Input/Control"]
offset_top = 30.0
offset_right = 293.0
offset_bottom = 56.0
size_flags_horizontal = 3
size_flags_vertical = 7
text = "Test"
[node name="Test" type="VBoxContainer" parent="Window/VBox"]
offset_top = 39.0
offset_right = 301.0
offset_bottom = 95.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Label3" type="Label" parent="Window/VBox/Test"]
offset_right = 301.0
offset_bottom = 26.0
size_flags_horizontal = 3
size_flags_vertical = 7
text = "Test"
[node name="Label4" type="Label" parent="Window/VBox/Test"]
offset_top = 30.0
offset_right = 301.0
offset_bottom = 56.0
size_flags_horizontal = 3
size_flags_vertical = 7
text = "Test"
[node name="Quit" type="Button" parent="Window/VBox"]
offset_top = 99.0
offset_right = 301.0
offset_bottom = 130.0
offset_left = 491.0
offset_top = 569.0
offset_right = 533.0
offset_bottom = 600.0
size_flags_horizontal = 6
size_flags_vertical = 10
text = "Quit"
size_flags_vertical = 8
text = "EDIT_CONTROL/QUIT"
[connection signal="close_requested" from="Window" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="Window/VBox/Menu/SortByInput" to="." method="_on_sort_by_input_pressed"]

View file

@ -25,7 +25,6 @@ func _on_timer_timeout():
func _on_quit_pressed():
$ConfirmQuit.popup_centered()
$ConfirmQuit.visible = true
pass
func _on_confirmation_dialog_confirmed():
@ -38,9 +37,8 @@ func _on_languages_pressed():
func _on_keys_pressed():
#$MenuControl/Window.popup_centered()
#$MenuControl/Window.visible = true
pass
$MenuControl.configure_control()
$MenuControl/Window.visible = true
func _on_themes_pressed():

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=6 format=3 uid="uid://cdyi1a858p7em"]
[ext_resource type="Theme" uid="uid://bi1js53ni6ehd" path="res://UI/themes/khanat/khanat.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="PackedScene" uid="uid://dpvequp5fv27k" path="res://scenes/languages/languages.tscn" id="2_um8fw"]
[ext_resource type="PackedScene" uid="uid://cl8xk8w3jmta0" path="res://scenes/controls/controls.tscn" id="3_08xl7"]
@ -11,9 +11,6 @@ anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( "1_iq3fo" )
script = ExtResource( "1_s6f6d" )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Message" type="HBoxContainer" parent="."]
anchor_right = 1.0
@ -25,7 +22,7 @@ __meta__ = {
}
[node name="Label" type="Label" parent="Message"]
offset_left = 918.0
offset_left = 917.0
offset_right = 1024.0
offset_bottom = 27.0
size_flags_vertical = 1
@ -48,24 +45,24 @@ __meta__ = {
offset_left = 510.0
offset_right = 554.0
offset_bottom = 40.0
text = "Keys"
text = "HUD/KEYS"
[node name="Themes" type="Button" parent="Menu"]
offset_right = 8.0
offset_bottom = 31.0
text = "Themes"
text = "HUD/THEMES"
[node name="Languages" type="Button" parent="Menu"]
offset_left = 492.0
offset_right = 574.0
offset_bottom = 40.0
text = "Languages"
text = "HUD/LANGUAGES"
[node name="Quit" type="Button" parent="Menu"]
offset_left = 578.0
offset_right = 619.0
offset_bottom = 40.0
text = "Quit"
text = "HUD/QUIT"
[node name="Timer" type="Timer" parent="."]
wait_time = 10.0
@ -73,7 +70,8 @@ one_shot = true
autostart = true
[node name="ConfirmQuit" type="ConfirmationDialog" parent="."]
dialog_text = "Do you want quit?"
title = "POPUP_CONFIRM_QUIT/TITLE"
dialog_text = "POPUP_CONFIRM_QUIT/MESSAGE"
[node name="MenuOption" parent="." instance=ExtResource( "2_um8fw" )]
visible = false

View file

@ -52,7 +52,3 @@ func switch_to_ship(near_boat):
# $player.hide()
# $player_ship.show()
# $player_ship.set_process(true)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass