velocidad del texto

This commit is contained in:
2024-11-14 23:41:58 +01:00
parent e269ff97a0
commit 9fd73fe5e3
10 changed files with 387 additions and 4 deletions

View File

@@ -414,11 +414,11 @@ func pause_game():
escoria.set_game_paused(true) escoria.set_game_paused(true)
func apply_custom_settings(custom_settings: Dictionary): func apply_custom_settings(custom_settings: Dictionary):
if custom_settings.has("a_custom_setting"): if custom_settings.has("speech_speed"):
escoria.logger.info( escoria.logger.info(
self, self,
"custom setting value loaded: %s." "custom setting value loaded: %s."
% str(custom_settings["a_custom_setting"]) % str(custom_settings["speech_speed"])
) )

View File

@@ -3,7 +3,7 @@
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/main_menu/main_menu.gd" type="Script" id=1] [ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/main_menu/main_menu.gd" type="Script" id=1]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/savegame_feature_button.gd" type="Script" id=2] [ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/savegame_feature_button.gd" type="Script" id=2]
[ext_resource path="res://gymkhana/logo-small.png" type="Texture" id=3] [ext_resource path="res://gymkhana/logo-small.png" type="Texture" id=3]
[ext_resource path="res://addons/escoria-core/ui_library/menus/options/options.tscn" type="PackedScene" id=4] [ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/options/options.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/escoria-core/ui_library/menus/load_save/load/load_game.tscn" type="PackedScene" id=5] [ext_resource path="res://addons/escoria-core/ui_library/menus/load_save/load/load_game.tscn" type="PackedScene" id=5]
[node name="main_menu" type="Control"] [node name="main_menu" type="Control"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,190 @@
# An options menu
extends Control
# The back button was pressed
signal back_button_pressed
# Custom setting key
const SPEECH_SPEED_SETTING: String = "speech_speed"
# The current settings
var backup_settings
# A list of languages already added to the language selection
var _loaded_languages: Array = []
# The settings changed
onready var settings_changed = false
# Initialize the flags
func _ready() -> void:
var _flags_container: HBoxContainer = \
$VBoxContainer/MarginContainer/options/flags
for child in _flags_container.get_children():
_flags_container.remove_child(child)
child.queue_free()
_loaded_languages = []
for lang in TranslationServer.get_loaded_locales():
if not lang in _loaded_languages:
_loaded_languages.append(lang)
var _lang = TextureRect.new()
_lang.texture = load(
"res://addons/escoria-core/ui_library" + \
"/menus/options/flags/%s.png" % lang
)
_flags_container.add_child(_lang)
_lang.connect("gui_input", self, "_on_language_input", [lang])
# Show the options
func show():
backup_settings = escoria.settings_manager.get_settings()
initialize_options(backup_settings)
visible = true
# Set the sliders to the values of the settings
#
# #### Parameters
# - p_settings: The settings to use
func initialize_options(p_settings):
var _options = $VBoxContainer/MarginContainer/options
_options.get_node("general_volume").value = p_settings["master_volume"]
_options.get_node("sound_volume").value = p_settings["sfx_volume"]
_options.get_node("music_volume").value = p_settings["music_volume"]
_options.get_node("speech_volume").value = p_settings["speech_volume"]
_options.get_node("speech_speed").value = p_settings["custom_settings"][SPEECH_SPEED_SETTING]
_options.get_node("fullscreen").set_pressed_no_signal(p_settings["fullscreen"])
# The language was changed
#
# #### Parameters
# - event: The input event from the flag
# - language: The language to set
func _on_language_input(event: InputEvent, language: String):
if event.is_pressed():
TranslationServer.set_locale(language)
ESCProjectSettingsManager.set_setting(
ESCProjectSettingsManager.TEXT_LANG,
language
)
settings_changed = true
# Sound volume was changed
#
# #### Parameters
# - value: The new volume level
func _on_sound_volume_changed(value):
if ESCProjectSettingsManager.get_setting(
ESCProjectSettingsManager.SFX_VOLUME
) != value:
ESCProjectSettingsManager.set_setting(
ESCProjectSettingsManager.SFX_VOLUME,
value
)
escoria.settings_manager.apply_settings()
settings_changed = true
# Music volume was changed
#
# #### Parameters
# - value: The new volume level
func _on_music_volume_changed(value):
if ESCProjectSettingsManager.get_setting(
ESCProjectSettingsManager.MUSIC_VOLUME
) != value:
ESCProjectSettingsManager.set_setting(
ESCProjectSettingsManager.MUSIC_VOLUME,
value
)
escoria.settings_manager.apply_settings()
settings_changed = true
# General volume was changed
#
# #### Parameters
# - value: The new volume level
func _on_general_volume_changed(value):
if ESCProjectSettingsManager.get_setting(
ESCProjectSettingsManager.MASTER_VOLUME
) != value:
ESCProjectSettingsManager.set_setting(
ESCProjectSettingsManager.MASTER_VOLUME,
value
)
escoria.settings_manager.apply_settings()
settings_changed = true
# Speech volume was changed
#
# #### Parameters
# - value: The new volume level
func _on_speech_volume_value_changed(value: float) -> void:
if ESCProjectSettingsManager.get_setting(
ESCProjectSettingsManager.SPEECH_VOLUME
) != value:
ESCProjectSettingsManager.set_setting(
ESCProjectSettingsManager.SPEECH_VOLUME,
value
)
escoria.settings_manager.apply_settings()
settings_changed = true
# Fullscreen was changed
#
# #### Parameters
# - button_pressed: Fullscreen (true) or windowed (false)
func _on_fullscreen_toggled(button_pressed: bool) -> void:
if ESCProjectSettingsManager.get_setting(
ESCProjectSettingsManager.FULLSCREEN
) != button_pressed:
ESCProjectSettingsManager.set_setting(
ESCProjectSettingsManager.FULLSCREEN,
button_pressed
)
escoria.settings_manager.apply_settings()
settings_changed = true
# Save the settings
func _on_apply_pressed():
escoria.settings_manager.custom_settings[SPEECH_SPEED_SETTING] = ESCProjectSettingsManager.get_setting(
RTMISimpleDialogSettings.READING_SPEED_IN_WPM
)
escoria.settings_manager.save_settings()
settings_changed = false
emit_signal("back_button_pressed")
# The back button was pressed
func _on_back_pressed():
escoria.settings_manager.save_settings_resource_to_project_settings(backup_settings)
escoria.settings_manager.apply_settings()
emit_signal("back_button_pressed")
func _on_speech_speed_value_changed(value):
if ProjectSettings.get_setting(
RTMISimpleDialogSettings.READING_SPEED_IN_WPM
) != value:
ProjectSettings.set_setting(
RTMISimpleDialogSettings.READING_SPEED_IN_WPM,
value
)
escoria.settings_manager.apply_settings()
settings_changed = true

View File

@@ -0,0 +1,192 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/options/flags/de.png" type="Texture" id=1]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/options/options.gd" type="Script" id=4]
[node name="options" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 4 )
[node name="Panel" type="Panel" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_editor_description_": ""
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
margin_left = 391.0
margin_top = 241.0
margin_right = 888.0
margin_bottom = 484.0
size_flags_horizontal = 6
custom_constants/margin_right = 20
custom_constants/margin_top = 20
custom_constants/margin_left = 20
custom_constants/margin_bottom = 20
[node name="options" type="GridContainer" parent="VBoxContainer/MarginContainer"]
margin_left = 20.0
margin_top = 20.0
margin_right = 477.0
margin_bottom = 223.0
size_flags_vertical = 6
custom_constants/hseparation = 40
columns = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="label" type="Label" parent="VBoxContainer/MarginContainer/options"]
margin_top = 30.0
margin_right = 137.0
margin_bottom = 44.0
text = "OPTIONS_LANGUAGE"
[node name="flags" type="HBoxContainer" parent="VBoxContainer/MarginContainer/options"]
margin_left = 177.0
margin_right = 457.0
margin_bottom = 75.0
size_flags_vertical = 3
custom_constants/separation = 30
alignment = 1
[node name="TextureRect2" type="TextureRect" parent="VBoxContainer/MarginContainer/options/flags"]
margin_right = 125.0
margin_bottom = 75.0
texture = ExtResource( 1 )
[node name="TextureRect3" type="TextureRect" parent="VBoxContainer/MarginContainer/options/flags"]
margin_left = 155.0
margin_right = 280.0
margin_bottom = 75.0
texture = ExtResource( 1 )
[node name="label2" type="Label" parent="VBoxContainer/MarginContainer/options"]
margin_top = 80.0
margin_right = 137.0
margin_bottom = 94.0
text = "GENERAL_VOLUME"
[node name="general_volume" type="HSlider" parent="VBoxContainer/MarginContainer/options"]
margin_left = 177.0
margin_top = 79.0
margin_right = 457.0
margin_bottom = 95.0
size_flags_horizontal = 3
max_value = 1.0
step = 0.001
[node name="label3" type="Label" parent="VBoxContainer/MarginContainer/options"]
margin_top = 100.0
margin_right = 137.0
margin_bottom = 114.0
text = "SOUND_VOLUME"
[node name="sound_volume" type="HSlider" parent="VBoxContainer/MarginContainer/options"]
margin_left = 177.0
margin_top = 99.0
margin_right = 457.0
margin_bottom = 115.0
size_flags_horizontal = 3
max_value = 1.0
step = 0.001
[node name="label4" type="Label" parent="VBoxContainer/MarginContainer/options"]
margin_top = 120.0
margin_right = 137.0
margin_bottom = 134.0
text = "MUSIC_VOLUME"
[node name="music_volume" type="HSlider" parent="VBoxContainer/MarginContainer/options"]
margin_left = 177.0
margin_top = 119.0
margin_right = 457.0
margin_bottom = 135.0
size_flags_horizontal = 3
max_value = 1.0
step = 0.001
[node name="label5" type="Label" parent="VBoxContainer/MarginContainer/options"]
margin_top = 140.0
margin_right = 137.0
margin_bottom = 154.0
text = "SPEECH_VOLUME"
[node name="speech_volume" type="HSlider" parent="VBoxContainer/MarginContainer/options"]
margin_left = 177.0
margin_top = 139.0
margin_right = 457.0
margin_bottom = 155.0
size_flags_horizontal = 3
max_value = 1.0
step = 0.001
[node name="label6" type="Label" parent="VBoxContainer/MarginContainer/options"]
margin_top = 164.0
margin_right = 137.0
margin_bottom = 178.0
text = "FULLSCREEN"
[node name="fullscreen" type="CheckBox" parent="VBoxContainer/MarginContainer/options"]
margin_left = 177.0
margin_top = 159.0
margin_right = 457.0
margin_bottom = 183.0
[node name="label7" type="Label" parent="VBoxContainer/MarginContainer/options"]
margin_top = 188.0
margin_right = 137.0
margin_bottom = 202.0
text = "SPEECH_SPEED"
[node name="speech_speed" type="HSlider" parent="VBoxContainer/MarginContainer/options"]
margin_left = 177.0
margin_top = 187.0
margin_right = 457.0
margin_bottom = 203.0
size_flags_horizontal = 3
min_value = 10.0
max_value = 400.0
step = 10.0
value = 200.0
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 488.0
margin_right = 1280.0
margin_bottom = 508.0
custom_constants/separation = 20
alignment = 1
[node name="back" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 549.0
margin_right = 660.0
margin_bottom = 20.0
text = "OPTIONS_BACK"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="apply" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 680.0
margin_right = 731.0
margin_bottom = 20.0
text = "APPLY"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="value_changed" from="VBoxContainer/MarginContainer/options/general_volume" to="." method="_on_general_volume_changed"]
[connection signal="value_changed" from="VBoxContainer/MarginContainer/options/sound_volume" to="." method="_on_sound_volume_changed"]
[connection signal="value_changed" from="VBoxContainer/MarginContainer/options/music_volume" to="." method="_on_music_volume_changed"]
[connection signal="value_changed" from="VBoxContainer/MarginContainer/options/speech_volume" to="." method="_on_speech_volume_value_changed"]
[connection signal="toggled" from="VBoxContainer/MarginContainer/options/fullscreen" to="." method="_on_fullscreen_toggled"]
[connection signal="value_changed" from="VBoxContainer/MarginContainer/options/speech_speed" to="." method="_on_speech_speed_value_changed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/back" to="." method="_on_back_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/apply" to="." method="_on_apply_pressed"]

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=7 format=2]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/pause_menu/pause_menu.gd" type="Script" id=1] [ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/pause_menu/pause_menu.gd" type="Script" id=1]
[ext_resource path="res://addons/escoria-core/ui_library/menus/options/options.tscn" type="PackedScene" id=2] [ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/options/options.tscn" type="PackedScene" id=2]
[ext_resource path="res://gymkhana/logo-small.png" type="Texture" id=3] [ext_resource path="res://gymkhana/logo-small.png" type="Texture" id=3]
[ext_resource path="res://addons/escoria-core/ui_library/menus/load_save/save/save_game.tscn" type="PackedScene" id=4] [ext_resource path="res://addons/escoria-core/ui_library/menus/load_save/save/save_game.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/escoria-core/ui_library/menus/load_save/load/load_game.tscn" type="PackedScene" id=5] [ext_resource path="res://addons/escoria-core/ui_library/menus/load_save/load/load_game.tscn" type="PackedScene" id=5]

View File

@@ -11,6 +11,7 @@ GENERAL_VOLUME,General,Général,Allgemein,General
MUSIC_VOLUME,Music,Musique,Musik,Música MUSIC_VOLUME,Music,Musique,Musik,Música
SOUND_VOLUME,Sound effects,Effets sonores,Soundeffekte,Efectos de sonido SOUND_VOLUME,Sound effects,Effets sonores,Soundeffekte,Efectos de sonido
SPEECH_VOLUME,Speech,Voix,Sprachausgabe,Voz SPEECH_VOLUME,Speech,Voix,Sprachausgabe,Voz
SPEECH_SPEED,Speech speed,Vitesse du texte,Textgeschwindigkeit,Velocidad del texto
FULLSCREEN,Fullscreen,Plein écran,Vollbild,Pantalla completa FULLSCREEN,Fullscreen,Plein écran,Vollbild,Pantalla completa
CANCEL,Cancel,Annuler,Abbrechen,Cancelar CANCEL,Cancel,Annuler,Abbrechen,Cancelar
OK,OK,Ok,Ok,Ok OK,OK,Ok,Ok,Ok
1 keys en fr de es
11 MUSIC_VOLUME Music Musique Musik Música
12 SOUND_VOLUME Sound effects Effets sonores Soundeffekte Efectos de sonido
13 SPEECH_VOLUME Speech Voix Sprachausgabe Voz
14 SPEECH_SPEED Speech speed Vitesse du texte Textgeschwindigkeit Velocidad del texto
15 FULLSCREEN Fullscreen Plein écran Vollbild Pantalla completa
16 CANCEL Cancel Annuler Abbrechen Cancelar
17 OK OK Ok Ok Ok