added sound library settings & command (#12)
## Changes - Added file base simple sound library - Added base UI settings and sound library settings - Added `play_lib_snd` command ## Notes - The command accepts a namespace so we can leave common sound in the root folder and chapter specific sounds in its own folder ## How to test - Run the game - All the door sounds should play as normal. Reviewed-on: #12 Co-authored-by: oier <oierbravo@gmail.com> Co-committed-by: oier <oierbravo@gmail.com>
This commit was merged in pull request #12.
This commit is contained in:
@@ -0,0 +1,57 @@
|
|||||||
|
# `play_lib_snd`
|
||||||
|
#
|
||||||
|
# Plays a sound from the library.
|
||||||
|
#
|
||||||
|
# **Parameters**
|
||||||
|
#
|
||||||
|
# - *file_name*: File name withot extension
|
||||||
|
# - *namespace*: Subfolder
|
||||||
|
#
|
||||||
|
# @ESC
|
||||||
|
extends ESCBaseCommand
|
||||||
|
class_name PlayLibSound
|
||||||
|
|
||||||
|
|
||||||
|
# Return the descriptor of the arguments of this command
|
||||||
|
func configure() -> ESCCommandArgumentDescriptor:
|
||||||
|
return ESCCommandArgumentDescriptor.new(
|
||||||
|
1,
|
||||||
|
[TYPE_STRING,TYPE_STRING],
|
||||||
|
[null,""]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Validate whether the given arguments match the command descriptor
|
||||||
|
func validate(arguments: Array):
|
||||||
|
if not .validate(arguments):
|
||||||
|
return false
|
||||||
|
|
||||||
|
var subFolder = arguments[1]
|
||||||
|
if(arguments[1] != ""):
|
||||||
|
subFolder += "/"
|
||||||
|
var resourceFile = "res://gymkhana/sounds/" + subFolder + arguments[0] + ".ogg"
|
||||||
|
if not ResourceLoader.exists(resourceFile):
|
||||||
|
escoria.logger.error(
|
||||||
|
self,
|
||||||
|
"[%s]: invalid parameter. File %s not found."
|
||||||
|
% [get_command_name(), resourceFile]
|
||||||
|
)
|
||||||
|
return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
|
||||||
|
|
||||||
|
# Run the command
|
||||||
|
func run(command_params: Array) -> int:
|
||||||
|
var resourceFile = "res://gymkhana/sounds/" + command_params[0] + ".ogg"
|
||||||
|
escoria.object_manager.get_object("_sound").node.set_state(
|
||||||
|
resourceFile
|
||||||
|
)
|
||||||
|
return ESCExecution.RC_OK
|
||||||
|
|
||||||
|
|
||||||
|
# Function called when the command is interrupted.
|
||||||
|
func interrupt():
|
||||||
|
# Do nothing
|
||||||
|
pass
|
||||||
|
|
||||||
@@ -12,12 +12,25 @@ func get_plugin_name():
|
|||||||
func disable_plugin():
|
func disable_plugin():
|
||||||
print("Disabling plugin Escoria UI Return to Monkey Island.")
|
print("Disabling plugin Escoria UI Return to Monkey Island.")
|
||||||
EscoriaPlugin.deregister_ui("res://gymkhana/addons/escoria-ui-return-monkey-island/game.tscn")
|
EscoriaPlugin.deregister_ui("res://gymkhana/addons/escoria-ui-return-monkey-island/game.tscn")
|
||||||
|
ESCProjectSettingsManager.remove_setting(
|
||||||
|
RTMIUiSettings.SOUND_LIBRARY_FOLDER
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Register UI with Escoria
|
# Register UI with Escoria
|
||||||
func enable_plugin():
|
func enable_plugin():
|
||||||
print("Enabling plugin Escoria UI Return to Monkey Island.")
|
print("Enabling plugin Escoria Dialog Simple")
|
||||||
if not EscoriaPlugin.register_ui(self, "res://gymkhana/addons/escoria-ui-return-monkey-island/game.tscn"):
|
|
||||||
|
if EscoriaPlugin.register_ui(self, "res://gymkhana/addons/escoria-ui-return-monkey-island/game.tscn"):
|
||||||
|
ESCProjectSettingsManager.register_setting(
|
||||||
|
RTMIUiSettings.SOUND_LIBRARY_FOLDER,
|
||||||
|
"res://game/sounds",
|
||||||
|
{
|
||||||
|
"type": TYPE_STRING
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
get_editor_interface().set_plugin_enabled(
|
get_editor_interface().set_plugin_enabled(
|
||||||
get_plugin_name(),
|
get_plugin_name(),
|
||||||
false
|
false
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
extends Resource
|
||||||
|
class_name RTMIUiSettings
|
||||||
|
|
||||||
|
const SETTINGS_ROOT = "escoria/rtmi_ui"
|
||||||
|
|
||||||
|
|
||||||
|
const SOUND_LIBRARY_FOLDER = "%s/sound_library_folder" % SETTINGS_ROOT
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
:action1
|
:action1
|
||||||
play_snd res://gymkhana/sounds/cocina_delante_open.ogg
|
play_lib_snd puerta_cocina_delante
|
||||||
change_scene "res://gymkhana/rooms/turno_cocina/cocina_delante/cocina_delante.tscn"
|
change_scene "res://gymkhana/rooms/turno_cocina/cocina_delante/cocina_delante.tscn"
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
:action1
|
:action1
|
||||||
play_snd res://gymkhana/sounds/cocina_detras_open.ogg
|
play_lib_snd puerta_cocina_detras
|
||||||
change_scene "res://gymkhana/rooms/turno_cocina/cocina_detras/cocina_detras.tscn"
|
change_scene "res://gymkhana/rooms/turno_cocina/cocina_detras/cocina_detras.tscn"
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
:action1
|
:action1
|
||||||
accept_input SKIP
|
play_lib_snd puerta_cocina_delante
|
||||||
play_video res://gymkhana/videos/test_video.ogv
|
change_scene "res://gymkhana/rooms/turno_cocina/cocina/cocina.tscn"
|
||||||
accept_input ALL
|
|
||||||
play_snd res://gymkhana/sounds/cocina_delante_open.ogg
|
|
||||||
change_scene "res://gymkhana/rooms/turno_cocina/cocina/cocina.tscn"
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
:action1
|
:action1
|
||||||
play_snd res://gymkhana/sounds/despensa_open.ogg
|
play_lib_snd puerta_despensa
|
||||||
change_scene "res://gymkhana/rooms/turno_cocina/despensa/despensa.tscn"
|
change_scene "res://gymkhana/rooms/turno_cocina/despensa/despensa.tscn"
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
:action1
|
:action1
|
||||||
play_snd res://gymkhana/sounds/cocina_detras_open.ogg
|
play__lib_snd puerta_cocina_detras
|
||||||
change_scene "res://gymkhana/rooms/turno_cocina/cocina/cocina.tscn"
|
change_scene "res://gymkhana/rooms/turno_cocina/cocina/cocina.tscn"
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
:action1
|
:action1
|
||||||
play_snd res://gymkhana/sounds/despensa_open.ogg
|
play_lib_snd puerta_despensa
|
||||||
change_scene "res://gymkhana/rooms/turno_cocina/cocina_delante/cocina_delante.tscn"
|
change_scene "res://gymkhana/rooms/turno_cocina/cocina_delante/cocina_delante.tscn"
|
||||||
|
|||||||
@@ -500,6 +500,11 @@ _global_script_classes=[ {
|
|||||||
"path": "res://gymkhana/addons/escoria-ui-return-monkey-island/item_outline.gd"
|
"path": "res://gymkhana/addons/escoria-ui-return-monkey-island/item_outline.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "ESCBaseCommand",
|
"base": "ESCBaseCommand",
|
||||||
|
"class": "PlayLibSound",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://gymkhana/addons/escoria-ui-return-monkey-island/esc/commands/play_lib_snd.gd"
|
||||||
|
}, {
|
||||||
|
"base": "ESCBaseCommand",
|
||||||
"class": "PlaySndCommand",
|
"class": "PlaySndCommand",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://addons/escoria-core/game/core-scripts/esc/commands/play_snd.gd"
|
"path": "res://addons/escoria-core/game/core-scripts/esc/commands/play_snd.gd"
|
||||||
@@ -534,6 +539,11 @@ _global_script_classes=[ {
|
|||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://gymkhana/addons/escoria-ui-return-monkey-island-dialog-simple/rtmi_dialog_simple_settings.gd"
|
"path": "res://gymkhana/addons/escoria-ui-return-monkey-island-dialog-simple/rtmi_dialog_simple_settings.gd"
|
||||||
}, {
|
}, {
|
||||||
|
"base": "Resource",
|
||||||
|
"class": "RTMIUiSettings",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://gymkhana/addons/escoria-ui-return-monkey-island/rtmi_ui_settings.gd"
|
||||||
|
}, {
|
||||||
"base": "ESCBaseCommand",
|
"base": "ESCBaseCommand",
|
||||||
"class": "RandGlobalCommand",
|
"class": "RandGlobalCommand",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
@@ -798,6 +808,7 @@ _global_script_class_icons={
|
|||||||
"InventoryAddCommand": "",
|
"InventoryAddCommand": "",
|
||||||
"InventoryRemoveCommand": "",
|
"InventoryRemoveCommand": "",
|
||||||
"ItemOutline": "res://addons/escoria-core/design/esc_item.svg",
|
"ItemOutline": "res://addons/escoria-core/design/esc_item.svg",
|
||||||
|
"PlayLibSound": "",
|
||||||
"PlaySndCommand": "",
|
"PlaySndCommand": "",
|
||||||
"PlayVideoCommand": "",
|
"PlayVideoCommand": "",
|
||||||
"PrintCommand": "",
|
"PrintCommand": "",
|
||||||
@@ -805,6 +816,7 @@ _global_script_class_icons={
|
|||||||
"QueueResourceCommand": "",
|
"QueueResourceCommand": "",
|
||||||
"RTMISimpleDialogPlugin": "",
|
"RTMISimpleDialogPlugin": "",
|
||||||
"RTMISimpleDialogSettings": "",
|
"RTMISimpleDialogSettings": "",
|
||||||
|
"RTMIUiSettings": "",
|
||||||
"RandGlobalCommand": "",
|
"RandGlobalCommand": "",
|
||||||
"RepeatCommand": "",
|
"RepeatCommand": "",
|
||||||
"SayCommand": "",
|
"SayCommand": "",
|
||||||
@@ -926,6 +938,7 @@ rtmi_dialog_simple/left_click_action="Speed up"
|
|||||||
rtmi_dialog_simple/stop_talking_animation_on="End of audio"
|
rtmi_dialog_simple/stop_talking_animation_on="End of audio"
|
||||||
debug/enable_hover_stack_viewer=true
|
debug/enable_hover_stack_viewer=true
|
||||||
ui/dialogs_chooser="res://addons/escoria-core/game/scenes/dialogs/esc_dialog_options_chooser.gd"
|
ui/dialogs_chooser="res://addons/escoria-core/game/scenes/dialogs/esc_dialog_options_chooser.gd"
|
||||||
|
rtmi_ui/sound_library_folder="res://gymkhana/sounds/"
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user