adding music manager

This commit is contained in:
AleaJactaEst 2022-04-15 09:53:44 +02:00
parent 01811fd19f
commit 0811638fd1
26 changed files with 975 additions and 190 deletions

View file

@ -215,9 +215,18 @@ msgstr "Del"
msgid "BUTTON_RIGHT"
msgstr "Button Right"
msgid "BUTTON_MIDDLE"
msgstr "Button Middle"
msgid "BUTTON_LEFT"
msgstr "Button Left"
msgid "BUTTON_XBUTTON1"
msgstr "Button X1"
msgid "BUTTON_XBUTTON2"
msgstr "Button X2"
msgid "BUTTON_WHEEL_UP"
msgstr "Button wheel up"
@ -225,13 +234,59 @@ msgid "BUTTON_WHEEL_DOWN"
msgstr "Button wheel down"
msgid "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW"
msgstr "Camera move and player follow"
msgstr "Rotate camera and player follow"
msgid "INPUT_VIEW_CAMERA_MOVE_ONLY"
msgstr "Camera move only"
msgstr "Rotate camera only"
msgid "INPUT_VIEW_CAMERA_PLAYER_WALK"
msgstr "Rotate camera and player move"
msgid "INPUT_ACTION_JUMP"
msgstr "Jump"
msgid "POPUP_ABOUT_MESSAGE/TITLE"
msgstr "About"
msgid "HUD/MUSIC"
msgstr "Sound"
msgid "MUSIC_MANAGER/TITLE"
msgstr "Sound Manager"
msgid "Music"
msgstr "Music"
msgid "Mixer"
msgstr "Mixer"
msgid "MUSIC_MANAGER/PLAY"
msgstr "Play"
msgid "MUSIC_MANAGER/RANDOM"
msgstr "Random"
msgid "MUSIC_MANAGER/REINIT"
msgstr "Reinit"
msgid "MUSIC_MANAGER/MUTE"
msgstr "Mute"
msgid "MUSIC_MANAGER/GLOBAL_VOLUME"
msgstr "Global volume"
msgid "MUSIC_MANAGER/MUSIC_VOLUME"
msgstr "Music volume"
msgid "MUSIC_MANAGER/EFFECT_VOLUME"
msgstr "Effect volume"
msgid "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
msgstr "Reverse horizontal"
msgid "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
msgstr "Reverse vertical"
msgid "NO_MOUSE_BUTTON"
msgstr "Nothing"

View file

@ -215,9 +215,18 @@ msgstr "Supprimer"
msgid "BUTTON_RIGHT"
msgstr "Bouton droit de la souris"
msgid "BUTTON_MIDDLE"
msgstr "Bouton mileu de la souris"
msgid "BUTTON_LEFT"
msgstr "Bouton gauche de la souris"
msgid "BUTTON_XBUTTON1"
msgstr "Bouton X1 de la souris"
msgid "BUTTON_XBUTTON2"
msgstr "Bouton X2 de la souris"
msgid "BUTTON_WHEEL_UP"
msgstr "Molette souris vers avant"
@ -225,13 +234,59 @@ msgid "BUTTON_WHEEL_DOWN"
msgstr "Molette souris vers arrière"
msgid "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW"
msgstr "Déplacer la caméra et le joueur suit"
msgstr "Rotation de la caméra et le joueur suit"
msgid "INPUT_VIEW_CAMERA_MOVE_ONLY"
msgstr "Déplacer la caméra seulement"
msgstr "Rotation de la caméra seulement"
msgid "INPUT_VIEW_CAMERA_PLAYER_WALK"
msgstr "Rotation de la caméra et déplacer le joueur dans la direction"
msgid "INPUT_ACTION_JUMP"
msgstr "Sauter"
msgid "POPUP_ABOUT_MESSAGE/TITLE"
msgstr "A propos"
msgid "HUD/MUSIC"
msgstr "Son"
msgid "MUSIC_MANAGER/TITLE"
msgstr "Configuration Musique/Son"
msgid "Music"
msgstr "Musique"
msgid "Mixer"
msgstr "Volume"
msgid "MUSIC_MANAGER/PLAY"
msgstr "Jouer"
msgid "MUSIC_MANAGER/RANDOM"
msgstr "Mélanger"
msgid "MUSIC_MANAGER/REINIT"
msgstr "Réinitialiser"
msgid "MUSIC_MANAGER/MUTE"
msgstr "Silence"
msgid "MUSIC_MANAGER/GLOBAL_VOLUME"
msgstr "Niveau sonore global"
msgid "MUSIC_MANAGER/MUSIC_VOLUME"
msgstr "Niveau sonore de la musique"
msgid "MUSIC_MANAGER/EFFECT_VOLUME"
msgstr "Niveau sonore des effets"
msgid "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
msgstr "Inversé horizontale"
msgid "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
msgstr "Inversé verticale"
msgid "NO_MOUSE_BUTTON"
msgstr "Rien n'est sélectionné"

Binary file not shown.

View file

@ -206,9 +206,18 @@ msgstr ""
msgid "BUTTON_RIGHT"
msgstr ""
msgid "BUTTON_MIDDLE"
msgstr ""
msgid "BUTTON_LEFT"
msgstr ""
msgid "BUTTON_XBUTTON1"
msgstr ""
msgid "BUTTON_XBUTTON2"
msgstr ""
msgid "BUTTON_WHEEL_UP"
msgstr ""
@ -221,8 +230,57 @@ msgstr ""
msgid "INPUT_VIEW_CAMERA_MOVE_ONLY"
msgstr ""
msgid "INPUT_VIEW_CAMERA_PLAYER_WALK"
msgstr ""
msgid "INPUT_ACTION_JUMP"
msgstr ""
msgid "POPUP_ABOUT_MESSAGE/TITLE"
msgstr ""
msgid "HUD/MUSIC"
msgstr ""
msgid "MUSIC_MANAGER/TITLE"
msgstr ""
msgid "Music"
msgstr ""
msgid "Mixer"
msgstr ""
msgid "MUSIC_MANAGER/PLAY"
msgstr ""
msgid "MUSIC_MANAGER/RANDOM"
msgstr ""
msgid "MUSIC_MANAGER/REINIT"
msgstr ""
msgid "MUSIC_MANAGER/MUTE"
msgstr ""
msgid "MUSIC_MANAGER/GLOBAL_VOLUME"
msgstr ""
msgid "MUSIC_MANAGER/MUSIC_VOLUME"
msgstr ""
msgid "MUSIC_MANAGER/EFFECT_VOLUME"
msgstr ""
msgid "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
msgstr ""
msgid "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
msgstr ""
msgid "NO_MOUSE_BUTTON"
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

@ -25,9 +25,6 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
__meta__ = {
"_edit_use_custom_anchors": false
}
[node name="Label" type="Label" parent="panel2/Node3D/SubViewport/VBoxContainer" index="0"]
offset_right = 1024.0
@ -39,9 +36,6 @@ theme_override_colors/font_shadow_color = Color(0.933333, 0, 0, 1)
text = "Ceci est un texte"
horizontal_alignment = 1
vertical_alignment = 1
__meta__ = {
"_edit_use_custom_anchors": false
}
[node name="Button" type="Button" parent="panel2/Node3D/SubViewport/VBoxContainer" index="1"]
offset_top = 30.0

View file

@ -240,11 +240,29 @@ INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW={
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":2,"position":Vector2(217, 135),"global_position":Vector2(217, 135),"factor":1.0,"button_index":2,"pressed":true,"double_click":false,"script":null)
]
}
INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_PLUS={
"deadzone": 0.5,
"events": []
}
INPUT_VIEW_CAMERA_MOVE_ONLY={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null)
]
}
INPUT_VIEW_CAMERA_MOVE_ONLY_PLUS={
"deadzone": 0.5,
"events": []
}
INPUT_VIEW_CAMERA_PLAYER_WALK={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null)
]
}
INPUT_VIEW_CAMERA_PLAYER_WALK_PLUS={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":2,"position":Vector2(217, 135),"global_position":Vector2(217, 135),"factor":1.0,"button_index":2,"pressed":true,"double_click":false,"script":null)
]
}
[internationalization]

View file

@ -11,7 +11,9 @@ func _init():
func _ready():
$SelectType.connect("refresh_select_type_control", refresh.bind() )
$SelectType.connect("cancel_define_input", show_windows.bind() )
$DefineInput.connect("refresh_control_define_input", define_mouse_camera_move.bind() )
$DefineInput.connect("cancel_define_input", show_windows.bind())
func refresh():
configure_control()
@ -131,35 +133,71 @@ func load_current_control():
return conf
func update_mouse_button_move_camera():
# Update SelectButton - INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW
var MouseCameraMove:String = ""
var comment:String = "None"
#var text1:String = ""
$Window/Tab/MOUSE/CameraPlayer/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW"))
$Window/Tab/MOUSE/CameraOnly/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_MOVE_ONLY"))
$Window/Tab/MOUSE/CameraPlayerWalk/SelectButton.set_text(Common.get_input_plus("INPUT_VIEW_CAMERA_PLAYER_WALK"))
# if InputMap.has_action("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW"):
# for z in InputMap.action_get_events("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW"):
# if z is InputEventMouseButton:
# comment = tr(Common.get_string_input(z))
# Common.msg_debug(comment)
# #$Window/Tab/MOUSE/HBox/SelectButton.set_text(text1)
# break
# if InputMap.has_action("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_PLUS"):
# for z in InputMap.action_get_events("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW_PLUS"):
# if z is InputEventMouseButton:
# comment = comment + " & " + tr(Common.get_string_input(z))
# Common.msg_debug(comment)
# break
# $Window/Tab/MOUSE/HBox/SelectButton.set_text(comment)
# for action in InputMap.get_actions():
# var text:String = action
# if text.find("INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW") == 0:
# for z in InputMap.action_get_events(action):
# if z is InputEventMouseButton:
# var text2:String = Common.get_string_input(z)
# Common.msg_debug(text2)
# $Window/Tab/MOUSE/HBox/SelectButton.set_text(text2)
# return
func configure_control():
if $Window/VBox/Menu/ShowMethod.get_selected() == 0:
$Window/VBox/Input.visible = false
$Window/VBox/Tree.visible = true
if $Window/Tab/CONTROL/Menu/ShowMethod.get_selected() == 0:
$Window/Tab/CONTROL/Input.visible = false
$Window/Tab/CONTROL/Tree.visible = true
configure_control_by_group()
elif $Window/VBox/Menu/ShowMethod.get_selected() == 1:
$Window/VBox/Tree.visible = false
$Window/VBox/Input.visible = true
elif $Window/Tab/CONTROL/Menu/ShowMethod.get_selected() == 1:
$Window/Tab/CONTROL/Tree.visible = false
$Window/Tab/CONTROL/Input.visible = true
configure_control_sort_by_categories()
else:
$Window/VBox/Tree.visible = false
$Window/VBox/Input.visible = true
$Window/Tab/CONTROL/Tree.visible = false
$Window/Tab/CONTROL/Input.visible = true
configure_control_sort_by_input()
update_mouse_button_move_camera()
func configure_control_by_group():
$Window/VBox/Tree.clear()
var root = $Window/VBox/Tree.create_item()
$Window/VBox/Tree.hide_root = true
var child_action = $Window/VBox/Tree.create_item(root)
$Window/Tab/CONTROL/Tree.clear()
var root = $Window/Tab/CONTROL/Tree.create_item()
$Window/Tab/CONTROL/Tree.hide_root = true
var child_action = $Window/Tab/CONTROL/Tree.create_item(root)
child_action.set_text(0, tr("CONTROL_INPUT_ACTION"))
var child_view = $Window/VBox/Tree.create_item(root)
var child_view = $Window/Tab/CONTROL/Tree.create_item(root)
child_view.set_text(0, tr("CONTROL_INPUT_VIEW"))
var child_other = $Window/VBox/Tree.create_item(root)
var child_other = $Window/Tab/CONTROL/Tree.create_item(root)
child_other.set_text(0, tr("CONTROL_INPUT_OTHER"))
for action in InputMap.get_actions():
var text:String = action
if text.find("INPUT_ACTION") == 0:
var subchild:TreeItem = $Window/VBox/Tree.create_item(child_action)
if text.ends_with("_PLUS"):
pass
elif text.find("INPUT_ACTION") == 0:
var subchild:TreeItem = $Window/Tab/CONTROL/Tree.create_item(child_action)
subchild.set_text(0, tr(text))
var buttontxt : Texture2D = preload("res://scenes/controls/add.png")
subchild.add_button(0, buttontxt, 0, false, "CONTROL_ADD_INPUT")
@ -167,8 +205,8 @@ func configure_control_by_group():
subchild.set_meta("group", action)
var a = InputMap.action_get_events(action)
for z in a:
var text2:String = Common.get_string_input(z)
var subchild2:TreeItem = $Window/VBox/Tree.create_item(subchild)
var text2:String = tr(Common.get_string_input(z)) + Common.get_input_plus_event(action ,z)
var subchild2:TreeItem = $Window/Tab/CONTROL/Tree.create_item(subchild)
subchild2.set_text(0, tr(text2))
var button2txt : Texture2D = preload("res://scenes/controls/trash.png")
subchild2.add_button(0, button2txt, 0, false, "CONTROL_DEL_INPUT")
@ -176,7 +214,7 @@ func configure_control_by_group():
subchild2.set_meta("group", action)
subchild2.set_meta("control", z)
elif text.find("INPUT_VIEW") == 0:
var subchild:TreeItem = $Window/VBox/Tree.create_item(child_view)
var subchild:TreeItem = $Window/Tab/CONTROL/Tree.create_item(child_view)
subchild.set_text(0, tr(text))
var buttontxt : Texture2D = preload("res://scenes/controls/add.png")
subchild.add_button(0, buttontxt, 0, false, "CONTROL_ADD_INPUT")
@ -184,8 +222,8 @@ func configure_control_by_group():
subchild.set_meta("group", action)
var a = InputMap.action_get_events(action)
for z in a:
var text2:String = Common.get_string_input(z)
var subchild2:TreeItem = $Window/VBox/Tree.create_item(subchild)
var text2:String = tr(Common.get_string_input(z)) + Common.get_input_plus_event(action ,z)
var subchild2:TreeItem = $Window/Tab/CONTROL/Tree.create_item(subchild)
subchild2.set_text(0, tr(text2))
var button2txt : Texture2D = preload("res://scenes/controls/trash.png")
subchild2.add_button(0, button2txt, 0, false, "CONTROL_DEL_INPUT")
@ -193,7 +231,7 @@ func configure_control_by_group():
subchild2.set_meta("group", action)
subchild2.set_meta("control", z)
else:
var subchild:TreeItem = $Window/VBox/Tree.create_item(child_other)
var subchild:TreeItem = $Window/Tab/CONTROL/Tree.create_item(child_other)
subchild.set_text(0, tr(text))
var buttontxt : Texture2D = preload("res://scenes/controls/add.png")
subchild.add_button(0, buttontxt, 0, false, "CONTROL_ADD_INPUT")
@ -201,8 +239,8 @@ func configure_control_by_group():
subchild.set_meta("group", action)
var a = InputMap.action_get_events(action)
for z in a:
var text2:String = Common.get_string_input(z)
var subchild2:TreeItem = $Window/VBox/Tree.create_item(subchild)
var text2:String = tr(Common.get_string_input(z)) + Common.get_input_plus_event(action ,z)
var subchild2:TreeItem = $Window/Tab/CONTROL/Tree.create_item(subchild)
subchild2.set_text(0, tr(text2))
var button2txt : Texture2D = preload("res://scenes/controls/trash.png")
subchild2.add_button(0, button2txt, 0, false, "CONTROL_DEL_INPUT")
@ -216,7 +254,7 @@ func __button_pressed():
func configure_control_sort_by_input():
for child in $Window/VBox/Input/Control.get_children():
for child in $Window/Tab/CONTROL/Input/Control.get_children():
child.queue_free()
var def = {}
for action in InputMap.get_actions():
@ -232,59 +270,59 @@ func configure_control_sort_by_input():
var zhash = get_dict_inputevent(z).hash()
if zhash != lastevent:
var separator = HSeparator.new()
$Window/VBox/Input/Control.add_child( separator )
$Window/Tab/CONTROL/Input/Control.add_child( separator )
lastevent = zhash
if z is InputEventKey:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate() #.instance()
item.set_param(action, "Key: " + Common.get_string_input_keyboard(z), action, z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/VBox/Input/Control.add_child( item )
$Window/Tab/CONTROL/Input/Control.add_child( item )
elif z is InputEventMouseButton:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate()
item.set_param(action, "Mouse Button: " + Common.get_string_input_mousse_button(z), action, z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/VBox/Input/Control.add_child( item )
$Window/Tab/CONTROL/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: " + Common.get_string_input_joypad_button(z), action, z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/VBox/Input/Control.add_child( item )
$Window/Tab/CONTROL/Input/Control.add_child( item )
for action in InputMap.get_actions():
var separator = HSeparator.new()
$Window/VBox/Input/Control.add_child( separator )
$Window/Tab/CONTROL/Input/Control.add_child( separator )
var control_box = preload( "res://scenes/controls/control_function.tscn" ).instantiate()
control_box.set_param(action, action, true)
control_box.connect( "add_pressed", _on_control_box_add_pressed.bind() )
$Window/VBox/Input/Control.add_child( control_box )
$Window/Tab/CONTROL/Input/Control.add_child( control_box )
func configure_control_sort_by_categories():
for child in $Window/VBox/Input/Control.get_children():
for child in $Window/Tab/CONTROL/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_param(action, action, false)
control_box.connect( "add_pressed", _on_control_box_add_pressed.bind() )
$Window/VBox/Input/Control.add_child( control_box )
$Window/Tab/CONTROL/Input/Control.add_child( control_box )
var a = InputMap.action_get_events(action)
for z in a:
if z is InputEventKey:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate()
item.set_param(action, "Key: " + Common.get_string_input_keyboard(z), "", z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/VBox/Input/Control.add_child( item )
$Window/Tab/CONTROL/Input/Control.add_child( item )
elif z is InputEventMouseButton:
var item = preload( "res://scenes/controls/control_input.tscn" ).instantiate()
item.set_param(action, "Mouse Button: " + Common.get_string_input_mousse_button(z), "", z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/VBox/Input/Control.add_child( item )
$Window/Tab/CONTROL/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: " + Common.get_string_input_joypad_button(z), "", z)
item.connect( "del_pressed", _on_input_box_del_pressed.bind() )
$Window/VBox/Input/Control.add_child( item )
$Window/Tab/CONTROL/Input/Control.add_child( item )
var separator = HSeparator.new()
$Window/VBox/Input/Control.add_child( separator )
$Window/Tab/CONTROL/Input/Control.add_child( separator )
func load_control_system():
@ -305,12 +343,12 @@ func _on_input_box_del_pressed(command, control, inputevent):
func _on_control_box_add_pressed(action, command):
$Window.hide()
$SelectType.set_param(action, "signal_refresh" )
$SelectType/Window.popup_centered()
$SelectType/Window.visible = true
func _on_option_button_item_selected(index):
configure_control()
@ -319,6 +357,7 @@ func _on_tree_button_pressed(item:TreeItem, column, id):
if item.has_meta("action") and item.has_meta("group"):
var action = item.get_meta("group")
if item.get_meta("action") == 0:
$Window.hide()
$SelectType.set_param(action, "signal_refresh" )
$SelectType/Window.popup_centered()
$SelectType/Window.visible = true
@ -326,3 +365,33 @@ func _on_tree_button_pressed(item:TreeItem, column, id):
var control = item.get_meta("control")
InputMap.action_erase_event(action, control)
configure_control()
func show_windows():
$Window.visible = true
func define_mouse_camera_move():
configure_control()
show_windows()
func _on_select_button_pressed():
$Window.visible = false
$DefineInput.set_param(2, "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW")
$DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true
func _on_camear_only_button_pressed():
$Window.visible = false
$DefineInput.set_param(2, "INPUT_VIEW_CAMERA_MOVE_ONLY")
$DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true
func _on_camera_player_walk_button_pressed():
$Window.visible = false
$DefineInput.set_param(2, "INPUT_VIEW_CAMERA_PLAYER_WALK")
$DefineInput/Window.popup_centered()
$DefineInput/Window.visible = true

View file

@ -1,16 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://cl8xk8w3jmta0"]
[gd_scene load_steps=4 format=3 uid="uid://cl8xk8w3jmta0"]
[ext_resource type="Script" path="res://scenes/controls/controls.gd" id="1_2c8s6"]
[ext_resource type="PackedScene" uid="uid://bhidap7eniou8" path="res://scenes/controls/select_type_control.tscn" id="2_ps0mu"]
[ext_resource type="PackedScene" uid="uid://cvmel2sx7qfvy" path="res://scenes/controls/option_define_input.tscn" id="3_dxrwd"]
[node name="Control" type="Control"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( "1_2c8s6" )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Window" type="Window" parent="."]
title = "EDIT_CONTROL/TITLE"
@ -20,26 +18,32 @@ visible = false
content_scale_mode = 1
content_scale_aspect = 4
[node name="VBox" type="VBoxContainer" parent="Window"]
[node name="Tab" type="TabContainer" 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="CONTROL" type="VBoxContainer" parent="Window/Tab"]
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = 31.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"]
[node name="Menu" type="HBoxContainer" parent="Window/Tab/CONTROL"]
offset_right = 1024.0
offset_bottom = 31.0
size_flags_horizontal = 3
[node name="ShowMethod" type="OptionButton" parent="Window/VBox/Menu"]
[node name="ShowMethod" type="OptionButton" parent="Window/Tab/CONTROL/Menu"]
offset_right = 43.0
offset_bottom = 31.0
text = "CONTROL_VIEW_BY_GROUP"
item_count = 3
selected = 0
popup/item_0/text = "CONTROL_VIEW_BY_GROUP"
@ -49,53 +53,162 @@ popup/item_1/id = 1
popup/item_2/text = "CONTROL_VIEW_BY_INPUT_SORTED"
popup/item_2/id = 2
[node name="SortByInput" type="CheckBox" parent="Window/VBox/Menu"]
[node name="SortByInput" type="CheckBox" parent="Window/Tab/CONTROL/Menu"]
visible = false
offset_right = 510.0
offset_bottom = 31.0
size_flags_horizontal = 7
text = "EDIT_CONTROL/SORT_BY_INPUT"
[node name="Reload" type="Button" parent="Window/VBox/Menu"]
[node name="Reload" type="Button" parent="Window/Tab/CONTROL/Menu"]
offset_left = 514.0
offset_right = 1024.0
offset_bottom = 31.0
size_flags_horizontal = 7
text = "EDIT_CONTROL/RELOAD_SYSTEM_CONFIG"
[node name="Input" type="ScrollContainer" parent="Window/VBox"]
[node name="Input" type="ScrollContainer" parent="Window/Tab/CONTROL"]
offset_top = 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"]
[node name="Control" type="VBoxContainer" parent="Window/Tab/CONTROL/Input"]
offset_right = 1024.0
offset_bottom = 530.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Tree" type="Tree" parent="Window/VBox"]
[node name="Tree" type="Tree" parent="Window/Tab/CONTROL"]
visible = false
offset_right = 40.0
offset_bottom = 40.0
size_flags_vertical = 3
[node name="Quit" type="Button" parent="Window/VBox"]
offset_left = 491.0
offset_top = 569.0
offset_right = 533.0
offset_bottom = 600.0
size_flags_horizontal = 6
[node name="Quit" type="Button" parent="Window/Tab/CONTROL"]
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -85.5
offset_top = -31.0
offset_right = 85.5
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 4
size_flags_vertical = 8
text = "EDIT_CONTROL/QUIT"
metadata/_edit_use_custom_anchors = false
[node name="JOYPAD" type="VBoxContainer" parent="Window/Tab"]
visible = false
offset_right = 40.0
offset_bottom = 40.0
[node name="MOUSE" type="VBoxContainer" parent="Window/Tab"]
visible = false
offset_right = 40.0
offset_bottom = 40.0
[node name="CameraPlayer" type="HBoxContainer" parent="Window/Tab/MOUSE"]
offset_right = 1344.0
offset_bottom = 31.0
[node name="Label" type="Label" parent="Window/Tab/MOUSE/CameraPlayer"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW"
[node name="SelectButton" type="Button" parent="Window/Tab/MOUSE/CameraPlayer"]
offset_right = 8.0
offset_bottom = 31.0
text = "NOBUTTON"
[node name="ReverseHorizontal" type="CheckBox" parent="Window/Tab/MOUSE/CameraPlayer"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
[node name="ReverseVertical" type="CheckBox" parent="Window/Tab/MOUSE/CameraPlayer"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
[node name="CameraOnly" type="HBoxContainer" parent="Window/Tab/MOUSE"]
offset_right = 1257.0
offset_bottom = 31.0
[node name="Label" type="Label" parent="Window/Tab/MOUSE/CameraOnly"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_VIEW_CAMERA_MOVE_ONLY"
[node name="SelectButton" type="Button" parent="Window/Tab/MOUSE/CameraOnly"]
offset_right = 8.0
offset_bottom = 31.0
text = "NOBUTTON"
[node name="ReverseHorizontal" type="CheckBox" parent="Window/Tab/MOUSE/CameraOnly"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
[node name="ReverseVertical" type="CheckBox" parent="Window/Tab/MOUSE/CameraOnly"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
[node name="CameraPlayerWalk" type="HBoxContainer" parent="Window/Tab/MOUSE"]
offset_right = 1270.0
offset_bottom = 31.0
[node name="Label" type="Label" parent="Window/Tab/MOUSE/CameraPlayerWalk"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_VIEW_CAMERA_PLAYER_WALK"
[node name="SelectButton" type="Button" parent="Window/Tab/MOUSE/CameraPlayerWalk"]
offset_right = 8.0
offset_bottom = 31.0
text = "NOBUTTON"
[node name="ReverseHorizontal" type="CheckBox" parent="Window/Tab/MOUSE/CameraPlayerWalk"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_HORIZONTAL"
[node name="ReverseVertical" type="CheckBox" parent="Window/Tab/MOUSE/CameraPlayerWalk"]
offset_right = 24.0
offset_bottom = 31.0
text = "EDIT_CONTROL/MOVE_CAMERA_REVERSE_VERTICAL"
[node name="Tree" type="Tree" parent="Window/Tab/MOUSE"]
offset_bottom = 40.0
size_flags_vertical = 3
column_titles_visible = true
select_mode = 2
[node name="Label" type="Label" parent="Window/Tab/MOUSE/Tree"]
offset_right = 40.0
offset_bottom = 23.0
text = "INPUT_VIEW_CAMERA_MOVE_PLAYER_FOLLOW"
[node name="Button" type="Button" parent="Window/Tab/MOUSE/Tree/Label"]
offset_right = 8.0
offset_bottom = 31.0
text = "Example"
[node name="SelectType" parent="." instance=ExtResource( "2_ps0mu" )]
[node name="DefineInput" parent="." instance=ExtResource( "3_dxrwd" )]
[connection signal="close_requested" from="Window" to="." method="_on_quit_pressed"]
[connection signal="item_selected" from="Window/VBox/Menu/ShowMethod" to="." method="_on_option_button_item_selected"]
[connection signal="pressed" from="Window/VBox/Menu/SortByInput" to="." method="_on_sort_by_input_pressed"]
[connection signal="pressed" from="Window/VBox/Menu/Reload" to="." method="reload_control_system"]
[connection signal="button_pressed" from="Window/VBox/Tree" to="." method="_on_tree_button_pressed"]
[connection signal="pressed" from="Window/VBox/Quit" to="." method="_on_quit_pressed"]
[connection signal="item_selected" from="Window/Tab/CONTROL/Menu/ShowMethod" to="." method="_on_option_button_item_selected"]
[connection signal="pressed" from="Window/Tab/CONTROL/Menu/SortByInput" to="." method="_on_sort_by_input_pressed"]
[connection signal="pressed" from="Window/Tab/CONTROL/Menu/Reload" to="." method="reload_control_system"]
[connection signal="button_pressed" from="Window/Tab/CONTROL/Tree" to="." method="_on_tree_button_pressed"]
[connection signal="pressed" from="Window/Tab/CONTROL/Quit" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="Window/Tab/MOUSE/CameraPlayer/SelectButton" to="." method="_on_select_button_pressed"]
[connection signal="pressed" from="Window/Tab/MOUSE/CameraOnly/SelectButton" to="." method="_on_camear_only_button_pressed"]
[connection signal="pressed" from="Window/Tab/MOUSE/CameraPlayerWalk/SelectButton" to="." method="_on_camera_player_walk_button_pressed"]

View file

@ -1,11 +1,14 @@
extends Control
signal refresh_control_define_input
signal cancel_define_input
var type_event:int
var action = null
var last_event = null
var last_last_event = null
var focus_ok:bool = false
var detect_two_event: bool = false
func _ready():
type_event = 0
@ -15,6 +18,14 @@ func set_disabled(state:bool):
$Window/v/h/Ok.disabled = state
func get_action():
return action
func get_type_event():
return type_event
func set_param(typeevent:int, _action):
var comment = ""
if typeevent == 1:
@ -26,6 +37,9 @@ func set_param(typeevent:int, _action):
type_event = typeevent
action = _action
last_event = null
last_last_event = null
focus_ok = false
detect_two_event = false
$Window/v/result.set_text("")
$Window/v/label.set_text(comment)
set_disabled(true)
@ -33,25 +47,65 @@ func set_param(typeevent:int, _action):
func _on_cancel_pressed():
$Window.hide()
emit_signal("cancel_define_input")
func _on_ok_pressed():
$Window.hide()
InputMap.action_add_event(action, last_event)
if last_last_event != null:
Common.set_input_plus(action, last_event, last_last_event, self.type_event == 2)
else:
Common.set_input(action, last_event, self.type_event == 2)
# if self.type_event == 2:
# for curaction in InputMap.get_actions():
# var text:String = curaction
# if text == action:
# for z in InputMap.action_get_events(curaction):
# if z is InputEventMouseButton:
# InputMap.action_erase_event(text, z)
# InputMap.action_add_event(action, last_event)
emit_signal("refresh_control_define_input")
func _on_window_window_input(event):
if event.is_pressed() == false:
return
if focus_ok:
return
if (event is InputEventKey) && (self.type_event == 1):
#last_last_event = last_event
last_event = event
$Window/v/result.set_text( Common.get_string_input(event) )
elif event is InputEventMouseButton and self.type_event == 2:
last_last_event = last_event
last_event = event
$Window/v/result.set_text( Common.get_string_input(event) )
if last_last_event:
if last_last_event.get_button_index() == last_event.get_button_index():
detect_two_event = false
last_last_event = null
elif Input.is_mouse_button_pressed( last_last_event.get_button_index() ):
detect_two_event = true
else:
detect_two_event = false
last_last_event = null
else:
detect_two_event = false
last_last_event = null
if detect_two_event == false:
$Window/v/result.set_text( Common.get_string_input(event) )
else:
$Window/v/result.set_text( tr(Common.get_string_input(event)) + " + " + tr(Common.get_string_input(last_last_event)))
elif event is InputEventJoypadButton and self.type_event == 3:
#last_last_event = last_event
last_event = event
$Window/v/result.set_text( Common.get_string_input(event) )
if last_event != null:
set_disabled(false)
func _on_ok_mouse_entered():
focus_ok = true
func _on_ok_mouse_exited():
focus_ok = false

View file

@ -10,6 +10,7 @@ script = ExtResource( "1_pgm2r" )
[node name="Window" type="Window" parent="."]
title = "OPTION_DEFINE_INPUT/TITLE"
position = Vector2i(30, 70)
size = Vector2i(300, 100)
visible = false
[node name="v" type="VBoxContainer" parent="Window"]
@ -17,9 +18,8 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
__meta__ = {
"_edit_use_custom_anchors": false
}
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="label" type="Label" parent="Window/v"]
offset_right = 1024.0
@ -30,12 +30,12 @@ text = "OPTION_DEFINE_INPUT/MESSAGE_KEY"
offset_top = 30.0
offset_right = 1024.0
offset_bottom = 53.0
size_flags_vertical = 6
[node name="h" type="HBoxContainer" parent="Window/v"]
offset_top = 57.0
offset_right = 1024.0
offset_bottom = 88.0
size_flags_vertical = 3
[node name="Cancel" type="Button" parent="Window/v/h"]
offset_right = 255.0
@ -52,4 +52,6 @@ text = "OPTION_DEFINE_INPUT/OK"
[connection signal="window_input" from="Window" to="." method="_on_window_window_input"]
[connection signal="pressed" from="Window/v/h/Cancel" to="." method="_on_cancel_pressed"]
[connection signal="mouse_entered" from="Window/v/h/Ok" to="." method="_on_ok_mouse_entered"]
[connection signal="mouse_exited" from="Window/v/h/Ok" to="." method="_on_ok_mouse_exited"]
[connection signal="pressed" from="Window/v/h/Ok" to="." method="_on_ok_pressed"]

View file

@ -2,12 +2,14 @@ extends Control
signal refresh_select_type_control
signal cancel_define_input
var action = null
var signalrefresh = null
func _ready():
$DefineInput.connect("refresh_control_define_input", refresh.bind() )
$DefineInput.connect("cancel_define_input", _on_quit_pressed.bind() )
func refresh():
@ -21,6 +23,7 @@ func set_param(_action, _signalrefresh):
func _on_quit_pressed():
$Window.visible = false
emit_signal("cancel_define_input")
func get_input(typevent) -> void:

View file

@ -19,9 +19,6 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
__meta__ = {
"_edit_use_custom_anchors": false
}
[node name="Key" type="Button" parent="Window/VBoxContainer"]
offset_right = 1024.0

View file

@ -2,19 +2,29 @@ extends Control
var git_branch:String
var git_commit:String
var tag_release:String
func _ready():
# .connect("mute_pressed", self, "_on_signal_mute_pressed")
$MenuTheme.connect("update_theme", update_theme.bind())
var file = File.new()
file.open("res://.git/HEAD", File.READ)
var content = file.get_as_text().strip_escapes()
file.close()
git_branch = content.split(' ')[1]
file.open("res://.git/" + git_branch, File.READ)
git_commit = file.get_as_text().strip_escapes()
file.close()
Common.msg_debug("Commit: " + git_commit)
if file.file_exists("res://commit.txt"):
file.open("res://commit.txt", File.READ)
tag_release = file.get_as_text().strip_escapes()
file.close()
Common.msg_debug("Tag: " + tag_release)
elif file.file_exists("res://.git/HEAD"):
file.open("res://.git/HEAD", File.READ)
var content = file.get_as_text().strip_escapes()
file.close()
git_branch = content.split(' ')[1]
file.open("res://.git/" + git_branch, File.READ)
git_commit = file.get_as_text().strip_escapes()
file.close()
Common.msg_debug("Commit: " + git_commit)
else:
git_branch = "Unknown"
git_commit = "Unknown"
func update_theme():
@ -43,8 +53,8 @@ func _on_confirmation_dialog_confirmed():
func _on_languages_pressed():
$MenuOption/Window.popup_centered()
$MenuOption/Window.visible = true
$MenuLanguage/Window.popup_centered()
$MenuLanguage/Window.visible = true
func _on_keys_pressed():
@ -58,7 +68,15 @@ func _on_themes_pressed():
func _on_about_pressed():
var aboutmessage = "Khaganat client test\nBranch: " + git_branch + "\nCommit: " + git_commit
var aboutmessage:String
if tag_release.is_empty():
aboutmessage = "Khaganat client test\nBranch: " + git_branch + "\nCommit: " + git_commit
else:
aboutmessage = "Khaganat client test\nVersion: " + tag_release
$AboutMessage.set_text(aboutmessage)
$AboutMessage.popup_centered()
$AboutMessage.visible = true
func _on_music_pressed():
$MusicManager.show_config()

View file

@ -1,10 +1,11 @@
[gd_scene load_steps=6 format=3 uid="uid://cdyi1a858p7em"]
[gd_scene load_steps=7 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="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"]
[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"]
[node name="Control" type="Control"]
anchor_right = 1.0
@ -17,9 +18,6 @@ anchor_right = 1.0
size_flags_horizontal = 0
size_flags_vertical = 0
alignment = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="Message"]
offset_left = 917.0
@ -27,9 +25,6 @@ offset_right = 1024.0
offset_bottom = 27.0
size_flags_vertical = 1
text = "Echap = Menu"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Menu" type="HBoxContainer" parent="."]
visible = false
@ -37,9 +32,6 @@ anchor_right = 1.0
offset_right = 40.0
offset_bottom = 40.0
alignment = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Keys" type="Button" parent="Menu"]
offset_left = 510.0
@ -58,6 +50,11 @@ offset_right = 574.0
offset_bottom = 40.0
text = "HUD/LANGUAGES"
[node name="Music" type="Button" parent="Menu"]
offset_right = 87.0
offset_bottom = 19.0
text = "HUD/MUSIC"
[node name="About" type="Button" parent="Menu"]
offset_right = 40.0
offset_bottom = 19.0
@ -81,7 +78,7 @@ dialog_text = "POPUP_CONFIRM_QUIT/MESSAGE"
[node name="AboutMessage" type="AcceptDialog" parent="."]
title = "POPUP_ABOUT_MESSAGE/TITLE"
[node name="MenuOption" parent="." instance=ExtResource( "2_um8fw" )]
[node name="MenuLanguage" parent="." instance=ExtResource( "2_um8fw" )]
visible = false
[node name="MenuControl" parent="." instance=ExtResource( "3_08xl7" )]
@ -89,9 +86,12 @@ visible = false
[node name="MenuTheme" parent="." instance=ExtResource( "4_1poje" )]
visible = false
[node name="MusicManager" parent="." instance=ExtResource( "6_0ivsi" )]
[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/Languages" to="." method="_on_languages_pressed"]
[connection signal="pressed" from="Menu/Music" to="." method="_on_music_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="timeout" from="Timer" to="." method="_on_timer_timeout"]

View file

@ -4,9 +4,6 @@
[node name="Control" type="Control"]
script = ExtResource( "1_qc7c5" )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Window" type="Window" parent="."]
title = "Language"

View file

@ -3,17 +3,23 @@ extends Node3D
var oldobject:Node3D = null
@onready var player_ptr = $player
func _init():
var file = File.new()
file.open("res://.git/HEAD", File.READ)
var content = file.get_as_text().strip_escapes()
file.close()
var head:String = content.split(' ')[1]
file.open("res://.git/" + head, File.READ)
content = file.get_as_text().strip_escapes()
file.close()
Common.msg_debug("Commit: " + content)
#func _init():
# var content = "N/A"
# var file = File.new()
# if file.file_exists("res://.git/HEAD"):
# file.open("res://.git/HEAD", File.READ)
# content = file.get_as_text().strip_escapes()
# file.close()
# var head:String = content.split(' ')[1]
#
# file.open("res://.git/" + head, File.READ)
# content = file.get_as_text().strip_escapes()
# file.close()
# elif file.file_exists("res://commit.txt"):
# file.open("res://commit.txt", File.READ)
# content = file.get_as_text().strip_escapes()
# file.close()
# Common.msg_debug("Commit: " + content)
# Called when the node enters the scene tree for the first time.

View file

@ -1,10 +1,9 @@
[gd_scene load_steps=6 format=3 uid="uid://cem7wppuuoabv"]
[gd_scene load_steps=5 format=3 uid="uid://cem7wppuuoabv"]
[ext_resource type="PackedScene" uid="uid://dwxrvijqyym70" path="res://player/player.tscn" id="1_btdsd"]
[ext_resource type="Script" path="res://scenes/main/main.gd" id="1_ld2xt"]
[ext_resource type="PackedScene" uid="uid://b8p2h0rmwy7qn" path="res://maps/basic_setup.tscn" id="2_jj4oa"]
[ext_resource type="PackedScene" uid="uid://cdyi1a858p7em" path="res://scenes/hud/hud.tscn" id="3_5vcj4"]
[ext_resource type="PackedScene" uid="uid://ebfrhgrluixd" path="res://scenes/music/music_manager.tscn" id="5_nlfpg"]
[node name="main_scene" type="Node3D"]
script = ExtResource( "1_ld2xt" )
@ -15,6 +14,3 @@ transform = Transform3D(0.677723, 0, -0.735317, 0, 1, 0, 0.735317, 0, 0.677723,
[node name="terrain_basic_setup" parent="." instance=ExtResource( "2_jj4oa" )]
[node name="Control" parent="." instance=ExtResource( "3_5vcj4" )]
[node name="MusicManager" parent="." instance=ExtResource( "5_nlfpg" )]
visible = false

View file

@ -0,0 +1,18 @@
extends HBoxContainer
signal selected_music(pos)
var filename:String = ""
var pos:int = 0
func set_music(_filename, musicname, _pos, selected:bool):
filename = _filename
pos = _pos
$Music.set_text(musicname)
$Selected.set_pressed(selected)
func _on_music_pressed():
emit_signal( "selected_music", pos )

View file

@ -0,0 +1,22 @@
[gd_scene load_steps=2 format=3 uid="uid://co13dert7ixio"]
[ext_resource type="Script" path="res://scenes/music/music_field.gd" id="1_u1fvf"]
[node name="Control" type="HBoxContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( "1_u1fvf" )
[node name="Selected" type="CheckBox" parent="."]
offset_right = 24.0
offset_bottom = 600.0
focus_mode = 0
disabled = true
[node name="Music" type="Button" parent="."]
offset_left = 28.0
offset_right = 1024.0
offset_bottom = 600.0
size_flags_horizontal = 3
[connection signal="pressed" from="Music" to="." method="_on_music_pressed"]

View file

@ -1,25 +1,29 @@
extends Control
@onready var music_player:AudioStreamPlayer = $music
@onready var music_player:AudioStreamPlayer = $Music
var official_music:Dictionary = {}
var current_area:String = "extra"
var current_music:String = ""
var default_domain:String = "default"
var current_domain:String = ""
var current_music:int = 0
var music_play:bool = false
var select_rand:bool = true
var list_music:Array = []
func _ready():
var directory:Directory = Directory.new()
var files = []
get_tree().paused = false
Common.msg_debug("Load MusicManager")
Common.msg_info("Load MusicManager")
if not directory.dir_exists( "res://music/" ):
Common.msg_debug("No Music")
Common.msg_info("No Music")
return
directory.open( "res://music/" )
for dir in directory.get_directories():
var dir2:Directory = Directory.new()
var fullpath: String = "res://music/" + dir
dir2.open( fullpath )
Common.msg_debug("Dir: " + str(dir))
# Common.msg_debug("Dir: " + str(dir))
for file in dir2.get_files():
if file == "":
break
@ -28,17 +32,60 @@ func _ready():
official_music[dir] = []
official_music[dir].append(fullpath + "/" + file)
files.append(file)
Common.msg_debug("File: " + str(file))
Common.msg_debug("List: " + str(official_music))
# music_player.connect("finished", self._on_stream_finished.bind())
# music_player.connect("finished", _on_stream_finished.bind())
#music_player.finished.connect(_on_stream_finished.bind())
music_player.finished.connect(self._on_stream_finished.bind())
#music_player.loop = false
if official_music.has(current_area):
var first = official_music[current_area][0]
Common.msg_debug("Play music: " + first)
play_music(first)
_on_random_pressed()
select_domain( default_domain )
current_music = official_music[current_domain].size()
# Get Volume
# Common.msg_debug("volume :" + str($Music.get_volume_db()))
# var t = linear2db(0.0)
# var u = db2linear($Music.get_volume_db())
# Common.msg_debug("volume :" + str(u))
$Window/VBox/Tab/Mixer/MusicLevel/music.set_value( int(db2linear($Music.get_volume_db()) * 100.0))
var bus_name = $Music.get_bus()
Common.msg_debug("bus_name: " + str(bus_name))
var bus_id = AudioServer.get_bus_index(bus_name)
Common.msg_debug("bus_id: " + str(bus_id))
var glb_volume = AudioServer.get_bus_volume_db(bus_id)
Common.msg_debug("GLB Volume: " + str(glb_volume))
# AudioServer.get_bus_volume_db(AudioServer.get_bus_index($Music.get_bus()))
$Window/VBox/Tab/Mixer/GlobalLevel/global.set_value( int(db2linear(AudioServer.get_bus_volume_db(AudioServer.get_bus_index($Music.get_bus()))) * 100.0))
func select_domain(new_domain:String):
var found:bool = false
for key in official_music.keys():
if new_domain == key:
found = true
if found == false:
return
current_domain = new_domain
reinitialize_jukebox()
func reinitialize_jukebox():
list_music.clear()
if select_rand:
var temp:Array
for i in range(0, official_music[current_domain].size()):
temp.append(i)
for i in range(0, official_music[current_domain].size()):
var pos = randi() % temp.size()
list_music.append(temp[pos])
temp.remove_at(pos)
else:
for i in range(0, official_music[current_domain].size()):
list_music.append(i)
func next_music():
var pos:float
current_music += 1
if current_music >= list_music.size():
reinitialize_jukebox()
play_music(0)
return
play_music(current_music)
func load_external_music(filepath):
@ -76,40 +123,106 @@ func load_music(filepath: String):
func _on_stream_finished():
Common.msg_debug("_on_stream_finished")
music_player.stop()
music_play = false
func play_music(filename: String):
if current_music == filename:
func show_list_music():
for child in $Window/VBox/Tab/Music/ScrollContainer/ListMusic.get_children():
child.queue_free()
for pos in range(0, list_music.size()):
var filename:String = official_music[current_domain][list_music[pos]]
var music_box = preload( "res://scenes/music/music_field.tscn" ).instantiate()
music_box.set_music( filename, filename.get_file().get_basename() , pos, pos == current_music)
music_box.connect("selected_music", force_music.bind())
$Window/VBox/Tab/Music/ScrollContainer/ListMusic.add_child( music_box )
func force_music(pos:int):
Common.msg_debug("Force: " + str(pos))
play_music(pos)
func play_music(pos: int):
if pos >= list_music.size():
return
#music_player.stream = load_music( filename )
var filename:String = official_music[current_domain][list_music[pos]]
music_play = true
music_player.set_stream(load_music( filename ))
music_player.play()
music_player.get_stream().set_loop(false)
Common.msg_debug("Signal:" + str(music_player.get_signal_list()))
Common.msg_debug("Signal:" + str(music_player.get_stream().get_signal_list()))
Common.msg_debug("Signal connecte:" + str(music_player.finished.get_connections()))
# music_player.connect("finished", _on_stream_finished.bind())
current_music = filename
# music_play = true
# for child in $window_box/scroll_box/musics_box.get_children():
# child.set_play()
# if Config.mute:
# child.set_disabled()
# elif child.get_music() == filename or not Config.playermusic :
# child.set_play()
# else:
# child.set_unplay()
var timer = music_player.get_stream().get_length()
$EndMusic.start(timer)
music_player.connect("finished", _on_stream_finished.bind())
current_music = pos
show_list_music()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
# if ! music_player.get_stream().is_playing():
# Common.msg_debug("Not playing")
# else:
# Common.msg_debug("Playing")
pass
if ! music_play and $Window/VBox/Tab/Music/HBox/Play.is_pressed():
next_music()
func _on_music_finished():
Common.msg_debug("_on_music_finished")
music_player.stop()
music_play = false
func _on_end_music_timeout():
# Timer end - sometimes, signal finished is not sent
Common.msg_debug("_on_end_music_timeout")
music_play = false
func show_config():
#$Window.popup_centered()
$Window.visible = true
func _on_button_pressed():
$Window.hide()
func _on_play_pressed():
var current_time = $EndMusic.get_time_left()
Common.msg_debug("_on_play_pressed : " + str(current_time))
if $Window/VBox/Tab/Music/HBox/Play.is_pressed():
$Music.set_stream_paused(false)
$EndMusic.set_paused(false)
else:
$Music.set_stream_paused(true)
$EndMusic.set_paused(true)
func _on_random_pressed():
if $Window/VBox/Tab/Music/HBox/Random.is_pressed():
select_rand = true
else:
select_rand = false
func _on_reinit_pressed():
reinitialize_jukebox()
play_music(0)
func _on_mute_toggled(button_pressed):
Common.msg_debug("Mute:" + str(button_pressed))
AudioServer.set_bus_mute(AudioServer.get_bus_index($Music.get_bus()), button_pressed)
func _on_effect_value_changed(value):
pass # Replace with function body.
func _on_music_value_changed(value):
$Music.set_volume_db(linear2db(value/100.0))
func _on_global_value_changed(value):
AudioServer.set_bus_volume_db(AudioServer.get_bus_index($Music.get_bus()), linear2db(value/100.0))
func _on_window_close_requested():
$Window.hide()

View file

@ -3,10 +3,160 @@
[ext_resource type="Script" path="res://scenes/music/music_manager.gd" id="1_dltpv"]
[node name="MusicManager" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( "1_dltpv" )
[node name="music" type="AudioStreamPlayer" parent="."]
[node name="Music" type="AudioStreamPlayer" parent="."]
[connection signal="finished" from="music" to="." method="_on_music_finished"]
[node name="EndMusic" type="Timer" parent="."]
[node name="Window" type="Window" parent="."]
title = "MUSIC_MANAGER/TITLE"
position = Vector2i(100, 100)
size = Vector2i(800, 450)
visible = false
[node name="VBox" type="VBoxContainer" parent="Window"]
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Tab" type="TabContainer" parent="Window/VBox"]
offset_right = 1024.0
offset_bottom = 565.0
grow_horizontal = 2
grow_vertical = 2
size_flags_vertical = 3
tab_alignment = 1
[node name="Music" type="VBoxContainer" parent="Window/VBox/Tab"]
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = 31.0
grow_horizontal = 2
grow_vertical = 2
[node name="HBox" type="HBoxContainer" parent="Window/VBox/Tab/Music"]
offset_left = 160.0
offset_right = 864.0
offset_bottom = 31.0
size_flags_horizontal = 4
size_flags_vertical = 0
[node name="Play" type="CheckButton" parent="Window/VBox/Tab/Music/HBox"]
offset_right = 230.0
offset_bottom = 31.0
button_pressed = true
text = "MUSIC_MANAGER/PLAY"
[node name="Random" type="CheckButton" parent="Window/VBox/Tab/Music/HBox"]
offset_left = 234.0
offset_right = 498.0
offset_bottom = 31.0
button_pressed = true
text = "MUSIC_MANAGER/RANDOM"
[node name="Reinit" type="Button" parent="Window/VBox/Tab/Music/HBox"]
offset_left = 502.0
offset_right = 704.0
offset_bottom = 31.0
text = "MUSIC_MANAGER/REINIT"
[node name="ScrollContainer" type="ScrollContainer" parent="Window/VBox/Tab/Music"]
offset_top = 35.0
offset_right = 1024.0
offset_bottom = 534.0
size_flags_vertical = 3
[node name="ListMusic" type="VBoxContainer" parent="Window/VBox/Tab/Music/ScrollContainer"]
offset_right = 1024.0
offset_bottom = 499.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Mixer" type="VBoxContainer" parent="Window/VBox/Tab"]
visible = false
offset_right = 40.0
offset_bottom = 40.0
[node name="GlobalLevel" type="HBoxContainer" parent="Window/VBox/Tab/Mixer"]
offset_right = 40.0
offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/VBox/Tab/Mixer/GlobalLevel"]
offset_right = 40.0
offset_bottom = 23.0
size_flags_horizontal = 3
text = "MUSIC_MANAGER/GLOBAL_VOLUME"
[node name="global" type="HSlider" parent="Window/VBox/Tab/Mixer/GlobalLevel"]
offset_right = 8.0
offset_bottom = 16.0
size_flags_horizontal = 3
[node name="MusicLevel" type="HBoxContainer" parent="Window/VBox/Tab/Mixer"]
offset_right = 40.0
offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/VBox/Tab/Mixer/MusicLevel"]
offset_right = 40.0
offset_bottom = 23.0
size_flags_horizontal = 3
text = "MUSIC_MANAGER/MUSIC_VOLUME"
[node name="music" type="HSlider" parent="Window/VBox/Tab/Mixer/MusicLevel"]
offset_right = 8.0
offset_bottom = 16.0
size_flags_horizontal = 3
[node name="EffectLevel" type="HBoxContainer" parent="Window/VBox/Tab/Mixer"]
offset_right = 40.0
offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/VBox/Tab/Mixer/EffectLevel"]
offset_right = 40.0
offset_bottom = 23.0
size_flags_horizontal = 3
text = "MUSIC_MANAGER/EFFECT_VOLUME"
[node name="effect" type="HSlider" parent="Window/VBox/Tab/Mixer/EffectLevel"]
offset_right = 8.0
offset_bottom = 16.0
size_flags_horizontal = 3
[node name="HBoxContainer" type="HBoxContainer" parent="Window/VBox"]
offset_right = 40.0
offset_bottom = 40.0
size_flags_vertical = 8
[node name="Label" type="Label" parent="Window/VBox/HBoxContainer"]
offset_right = 40.0
offset_bottom = 23.0
size_flags_horizontal = 3
[node name="Button" type="Button" parent="Window/VBox/HBoxContainer"]
offset_left = 496.0
offset_top = 569.0
offset_right = 527.0
offset_bottom = 600.0
size_flags_horizontal = 6
size_flags_vertical = 8
text = "OK"
[node name="Mute" type="CheckButton" parent="Window/VBox/HBoxContainer"]
offset_right = 236.0
offset_bottom = 31.0
size_flags_horizontal = 10
text = "MUSIC_MANAGER/MUTE"
[connection signal="finished" from="Music" to="." method="_on_music_finished"]
[connection signal="timeout" from="EndMusic" to="." method="_on_end_music_timeout"]
[connection signal="close_requested" from="Window" to="." method="_on_window_close_requested"]
[connection signal="pressed" from="Window/VBox/Tab/Music/HBox/Play" to="." method="_on_play_pressed"]
[connection signal="pressed" from="Window/VBox/Tab/Music/HBox/Random" to="." method="_on_random_pressed"]
[connection signal="pressed" from="Window/VBox/Tab/Music/HBox/Reinit" to="." method="_on_reinit_pressed"]
[connection signal="value_changed" from="Window/VBox/Tab/Mixer/GlobalLevel/global" to="." method="_on_global_value_changed"]
[connection signal="value_changed" from="Window/VBox/Tab/Mixer/MusicLevel/music" to="." method="_on_music_value_changed"]
[connection signal="value_changed" from="Window/VBox/Tab/Mixer/EffectLevel/effect" to="." method="_on_effect_value_changed"]
[connection signal="pressed" from="Window/VBox/HBoxContainer/Button" to="." method="_on_button_pressed"]
[connection signal="toggled" from="Window/VBox/HBoxContainer/Mute" to="." method="_on_mute_toggled"]

View file

@ -3,6 +3,11 @@ extends Node
var debug:bool = true
func _ready():
randomize()
func get_time_text() -> String:
var time = Time.get_datetime_dict_from_system()
return "%s/%02d/%02d %02d:%02d:%02d" % [
@ -124,3 +129,43 @@ func get_string_input(event) -> String:
return get_string_input_joypad_button(event)
else:
return str(event)
func get_input_plus_event(action:String, event_ref):
if InputMap.has_action(action + "_PLUS"):
for z in InputMap.action_get_events(action + "_PLUS"):
if typeof(event_ref) == typeof(z):
return " & " + tr(Common.get_string_input(z))
return ""
func get_input_plus(action:String):
var comment:String = "None"
if InputMap.has_action(action):
for z in InputMap.action_get_events(action):
return tr(Common.get_string_input(z)) + get_input_plus_event(action, z)
# Common.msg_debug(comment)
# #$Window/Tab/MOUSE/HBox/SelectButton.set_text(text1)
# break
# if InputMap.has_action(action + "_PLUS"):
# for z in InputMap.action_get_events(action + "_PLUS"):
# if z is InputEventMouseButton:
# comment = comment + " & " + tr(Common.get_string_input(z))
# Common.msg_debug(comment)
# break
return comment
func set_input(action:String, event, eraselast:bool):
if eraselast:
for curaction in InputMap.get_actions():
var text:String = curaction
if text == action:
for z in InputMap.action_get_events(curaction):
if typeof(event) == typeof(z):
InputMap.action_erase_event(text, z)
InputMap.action_add_event(action, event)
func set_input_plus(action:String, event, eventplus, eraselast:bool):
set_input(action, event, eraselast)
set_input(action + "_PLUS", eventplus, eraselast)

View file

@ -7,7 +7,7 @@ declare FORCE=0
declare IMPORT=0
declare ERASEIMPORT=0
declare WORKDIR="$(dirname $(readlink -f $0))"
declare GODOT_SRC="https://downloads.tuxfamily.org/godotengine/4.0/alpha5/Godot_v4.0-alpha5_linux.64.zip"
declare GODOT_SRC="https://downloads.tuxfamily.org/godotengine/4.0/alpha6/Godot_v4.0-alpha6_linux.64.zip"
declare OUTZIP="$WORKDIR/$(basename $GODOT_SRC)"
declare OPTION=""
declare NEWPRG=0
@ -139,7 +139,9 @@ fi
if [[ ($IMPORT -ne 0) || (! -d $WORKDIR/.godot) ]]
then
echo "Launch import (please wait)"
$WORKDIR/$EXE --editor --quit
echo "Import finished"
fi
if [ $EDITOR -ne 0 ]