feat(godot4): project automatic upgrade from godot 3 to 4

This commit is contained in:
2025-01-19 01:05:35 +01:00
parent c6e768f18e
commit f34f96e87f
98 changed files with 844 additions and 1784 deletions

View File

@@ -3,8 +3,8 @@
extends ESCDialogOptionsChooser
export(Color, RGB) var color_normal = Color(1.0,1.0,1.0,1.0)
export(Color, RGB) var color_hover = Color(165.0,42.0,42.0, 1.0)
@export var color_normal = Color(1.0,1.0,1.0,1.0) # (Color, RGB)
@export var color_hover = Color(165.0,42.0,42.0, 1.0) # (Color, RGB)
var _no_more_options: bool = false
@@ -13,9 +13,9 @@ var _no_more_options: bool = false
# Hide the chooser at the start just to be safe
func _ready() -> void:
hide_chooser()
pause_mode = PAUSE_MODE_STOP
escoria.connect("paused", self, "_on_paused")
escoria.connect("resumed", self, "_on_resumed")
process_mode = PROCESS_MODE_PAUSABLE
escoria.connect("paused", Callable(self, "_on_paused"))
escoria.connect("resumed", Callable(self, "_on_resumed"))
# Process the timeout display
@@ -39,8 +39,8 @@ func show_chooser():
var _option_node = Button.new()
_option_node.text = (option as ESCDialogOption).option
_option_node.flat = true
_option_node.add_color_override("font_color", color_normal)
_option_node.add_color_override("font_color_hover", color_hover)
_option_node.add_theme_color_override("font_color", color_normal)
_option_node.add_theme_color_override("font_color_hover", color_hover)
_vbox.add_child(_option_node)
_option_node.connect("pressed", self, "_on_answer_selected", [
option
@@ -57,7 +57,7 @@ func show_chooser():
if self.dialog.avatar != "-":
$AvatarContainer.add_child(
ResourceLoader.load(self.dialog.avatar).instance()
ResourceLoader.load(self.dialog.avatar).instantiate()
)
$MarginContainer.show()

View File

@@ -4,44 +4,44 @@
[ext_resource path="res://addons/escoria-ui-return-monkey-island-dialog-simple/theme.tres" type="Theme" id=2]
[sub_resource type="Gradient" id=1]
colors = PoolColorArray( 1, 0, 0, 1, 1, 0, 0, 1 )
colors = PackedColorArray( 1, 0, 0, 1, 1, 0, 0, 1 )
[sub_resource type="GradientTexture" id=2]
[sub_resource type="GradientTexture2D" id=2]
gradient = SubResource( 1 )
[node name="text_dialog_choice" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = 560.0
margin_right = 7.0
offset_top = 560.0
offset_right = 7.0
theme = ExtResource( 2 )
script = ExtResource( 1 )
[node name="MarginContainer" type="MarginContainer" parent="."]
margin_left = 20.0
margin_top = 10.0
margin_right = 1280.0
margin_bottom = 185.0
offset_left = 20.0
offset_top = 10.0
offset_right = 1280.0
offset_bottom = 185.0
mouse_filter = 2
custom_constants/margin_top = 20
custom_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_left = 20
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer"]
margin_left = 20.0
margin_top = 20.0
margin_right = 1260.0
margin_bottom = 175.0
offset_left = 20.0
offset_top = 20.0
offset_right = 1260.0
offset_bottom = 175.0
scroll_horizontal_enabled = false
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/ScrollContainer"]
margin_right = 1240.0
margin_bottom = 155.0
offset_right = 1240.0
offset_bottom = 155.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 10
theme_override_constants/separation = 10
__meta__ = {
"_edit_use_anchors_": false
}
@@ -49,9 +49,9 @@ __meta__ = {
[node name="Timer" type="Timer" parent="."]
one_shot = true
[node name="TimerProgress" type="TextureProgress" parent="."]
[node name="TimerProgress" type="TextureProgressBar" parent="."]
anchor_right = 1.0
rect_min_size = Vector2( 0, 20 )
custom_minimum_size = Vector2( 0, 20 )
texture_progress = SubResource( 2 )
nine_patch_stretch = true

View File

@@ -44,7 +44,7 @@ func run(_command_params: Array) -> int:
"",
text
)
yield(escoria.dialog_player, "say_finished")
await escoria.dialog_player.say_finished
escoria.current_state = escoria.GAME_STATE.DEFAULT
return ESCExecution.RC_OK

View File

@@ -54,7 +54,7 @@ func configure() -> ESCCommandArgumentDescriptor:
# Validate whether the given arguments match the command descriptor
func validate(arguments: Array):
if not .validate(arguments):
if not super.validate(arguments):
return false
if arguments[0].to_upper() != CURRENT_PLAYER_KEYWORD \
@@ -105,7 +105,7 @@ func run(command_params: Array) -> int:
"",
text
)
yield(escoria.dialog_player, "say_finished")
await escoria.dialog_player.say_finished
escoria.current_state = escoria.GAME_STATE.DEFAULT
var current_count_global_key = "%s_count" % [param_list_id]

View File

@@ -52,7 +52,7 @@ func configure() -> ESCCommandArgumentDescriptor:
# Validate whether the given arguments match the command descriptor
func validate(arguments: Array):
if not .validate(arguments):
if not super.validate(arguments):
return false
if arguments[0].to_upper() != CURRENT_PLAYER_KEYWORD \
@@ -109,7 +109,7 @@ func run(command_params: Array) -> int:
"",
text
)
yield(escoria.dialog_player, "say_finished")
await escoria.dialog_player.say_finished
escoria.current_state = escoria.GAME_STATE.DEFAULT
current_index += 1

View File

@@ -1,13 +1,13 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/dialog_tip.tres" type="DynamicFont" id=1]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/dialog_tip.tres" type="FontFile" id=1]
[ext_resource path="res://addons/escoria-ui-return-monkey-island-dialog-simple/dialog_tip.gd" type="Script" id=2]
[node name="Label" type="Label"]
margin_left = 1057.0
margin_top = 533.0
margin_right = 1259.0
margin_bottom = 551.0
custom_fonts/font = ExtResource( 1 )
offset_left = 1057.0
offset_top = 533.0
offset_right = 1259.0
offset_bottom = 551.0
theme_override_fonts/font = ExtResource( 1 )
text = "Haz click para acelerar el texto"
script = ExtResource( 2 )

View File

@@ -16,18 +16,18 @@ the node that inherits from this state machine interface
If you don't the game will crash (on purpose, so you won't
forget to initialize the state machine)
"""
export(NodePath) var START_STATE
@export var START_STATE: NodePath
var states_map = {}
var states_stack = [] # can also be used as a pushdown automaton
var current_state = null
var current_state_name = ""
var _active = false setget set_active
var _active = false: set = set_active
func initialize(start_state):
for child in get_children():
child.connect("finished", self, "_change_state")
child.connect("finished", Callable(self, "_change_state"))
set_active(true)
states_stack.push_front(start_state)

View File

@@ -1,5 +1,5 @@
@tool
# A simple dialog manager for Escoria
tool
extends EditorPlugin
@@ -10,23 +10,23 @@ const READING_SPEED_IN_WPM_DEFAULT_VALUE = 200
const TEXT_TIME_PER_LETTER_MS_DEFAULT_VALUE = 100
const TEXT_TIME_PER_LETTER_MS_FAST_DEFAULT_VALUE = 25
var left_click_actions: PoolStringArray = [
var left_click_actions: PackedStringArray = [
RTMISimpleDialogSettings.LEFT_CLICK_ACTION_SPEED_UP,
RTMISimpleDialogSettings.LEFT_CLICK_ACTION_INSTANT_FINISH,
RTMISimpleDialogSettings.LEFT_CLICK_ACTION_NOTHING
]
var stop_talking_animation_on_options: PoolStringArray = [
var stop_talking_animation_on_options: PackedStringArray = [
RTMISimpleDialogSettings.STOP_TALKING_ANIMATION_ON_END_OF_TEXT,
RTMISimpleDialogSettings.STOP_TALKING_ANIMATION_ON_END_OF_AUDIO
]
# Override function to return the plugin name.
func get_plugin_name():
func _get_plugin_name():
return "escoria-rtmi-dialog-simple"
# Unregister ourselves
func disable_plugin():
func _disable_plugin():
print("Disabling plugin Escoria Dialog Simple")
ESCProjectSettingsManager.remove_setting(
ESCProjectSettingsManager.DEFAULT_DIALOG_TYPE
@@ -89,7 +89,7 @@ func enable_plugin():
RTMISimpleDialogSettings.TEXT_TIME_PER_LETTER_MS,
TEXT_TIME_PER_LETTER_MS_DEFAULT_VALUE,
{
"type": TYPE_REAL
"type": TYPE_FLOAT
}
)
@@ -97,7 +97,7 @@ func enable_plugin():
RTMISimpleDialogSettings.TEXT_TIME_PER_LETTER_MS_FAST,
TEXT_TIME_PER_LETTER_MS_FAST_DEFAULT_VALUE,
{
"type": TYPE_REAL
"type": TYPE_FLOAT
}
)
@@ -117,7 +117,7 @@ func enable_plugin():
}
)
var left_click_actions_string: String = left_click_actions.join(",")
var left_click_actions_string: String = ",".join(left_click_actions)
ESCProjectSettingsManager.register_setting(
RTMISimpleDialogSettings.LEFT_CLICK_ACTION,
@@ -129,7 +129,7 @@ func enable_plugin():
}
)
var stop_talking_animation_on_options_string: String = stop_talking_animation_on_options.join(",")
var stop_talking_animation_on_options_string: String = ",".join(stop_talking_animation_on_options)
ESCProjectSettingsManager.register_setting(
RTMISimpleDialogSettings.STOP_TALKING_ANIMATION_ON,
@@ -143,6 +143,6 @@ func enable_plugin():
else:
get_editor_interface().set_plugin_enabled(
get_plugin_name(),
_get_plugin_name(),
false
)

View File

@@ -26,7 +26,7 @@ var _should_preserve_dialog_box: bool = false
func _ready() -> void:
add_child(state_machine)
escoria.connect("paused", self, "_on_paused")
escoria.connect("paused", Callable(self, "_on_paused"))
@@ -122,17 +122,17 @@ func _init_type_player(type: String) -> void:
if type == "floating":
_type_player = preload(\
"res://addons/escoria-ui-return-monkey-island-dialog-simple/types/floating.tscn"\
).instance()
).instantiate()
else:
_type_player = preload(\
"res://addons/escoria-ui-return-monkey-island-dialog-simple/types/avatar.tscn"\
).instance()
).instantiate()
_dialog_tip = preload(\
"res://addons/escoria-ui-return-monkey-island-dialog-simple/dialog_tip.tscn"\
).instance()
).instantiate()
_type_player.connect("say_finished", self, "_on_say_finished")
_type_player.connect("say_visible", self, "_on_say_visible")
_type_player.connect("say_finished", Callable(self, "_on_say_finished"))
_type_player.connect("say_visible", Callable(self, "_on_say_visible"))
func _initialize_say_states(global_id: String, text: String, type: String) -> void:
state_machine.states_map["say"].initialize(self, global_id, text, type)
@@ -177,12 +177,12 @@ func do_choose(dialog_player: Node, dialog: ESCDialog, type: String = "simple"):
if type == "simple" or type == "":
chooser = preload(\
"res://addons/escoria-ui-return-monkey-island-dialog-simple/chooser/simple.tscn"\
).instance()
).instantiate()
dialog_player.add_child(chooser)
chooser.set_dialog(dialog)
chooser.show_chooser()
var option = yield(chooser, "option_chosen")
var option = await chooser.option_chosen
dialog_player.remove_child(chooser)
# MODIFIED FOR RETURN TO MONKEY UI
if option is ESCDialogOption:

View File

@@ -23,7 +23,7 @@ func initialize(dialog_player, dialog_chooser_ui: ESCDialogManager, dialog: ESCD
func enter():
escoria.logger.trace(self, "Dialog State Machine: Entered 'choices'.")
if _dialog.options.empty():
if _dialog.options.is_empty():
escoria.logger.error(
self,
"Received dialog options array was empty."
@@ -36,7 +36,7 @@ func update(_delta):
if _ready_to_choose:
_ready_to_choose = false
_dialog_chooser_ui.do_choose(_dialog_player, _dialog, _type)
var option = yield(_dialog_chooser_ui, "option_chosen")
var option = await _dialog_chooser_ui.option_chosen
escoria.logger.trace(self, "Dialog State Machine: 'choices' -> 'idle'")

View File

@@ -13,8 +13,8 @@ func enter():
escoria.logger.trace(self, "Dialog State Machine: Entered 'interrupt'.")
if _dialog_manager != null:
if not _dialog_manager.is_connected("say_finished", self, "_on_say_finished"):
_dialog_manager.connect("say_finished", self, "_on_say_finished")
if not _dialog_manager.is_connected("say_finished", Callable(self, "_on_say_finished")):
_dialog_manager.connect("say_finished", Callable(self, "_on_say_finished"))
_dialog_manager.interrupt()

View File

@@ -53,26 +53,26 @@ func handle_input(_event):
func _handle_left_click_action(left_click_action: String) -> void:
match left_click_action:
RTMISimpleDialogSettings.LEFT_CLICK_ACTION_SPEED_UP:
if _dialog_manager.is_connected("say_visible", self, "_on_say_visible"):
_dialog_manager.disconnect("say_visible", self, "_on_say_visible")
if _dialog_manager.is_connected("say_visible", Callable(self, "_on_say_visible")):
_dialog_manager.disconnect("say_visible", Callable(self, "_on_say_visible"))
escoria.logger.trace(self, "Dialog State Machine: 'say' -> 'say_fast'")
emit_signal("finished", "say_fast")
RTMISimpleDialogSettings.LEFT_CLICK_ACTION_INSTANT_FINISH:
if _dialog_manager.is_connected("say_visible", self, "_on_say_visible"):
_dialog_manager.disconnect("say_visible", self, "_on_say_visible")
if _dialog_manager.is_connected("say_visible", Callable(self, "_on_say_visible")):
_dialog_manager.disconnect("say_visible", Callable(self, "_on_say_visible"))
escoria.logger.trace(self, "Dialog State Machine: 'say' -> 'say_finish'")
emit_signal("finished", "say_finish")
get_tree().set_input_as_handled()
get_viewport().set_input_as_handled()
func enter():
escoria.logger.trace(self, "Dialog State Machine: Entered 'say'.")
if not _dialog_manager.is_connected("say_visible", self, "_on_say_visible"):
_dialog_manager.connect("say_visible", self, "_on_say_visible")
if not _dialog_manager.is_connected("say_visible", Callable(self, "_on_say_visible")):
_dialog_manager.connect("say_visible", Callable(self, "_on_say_visible"))
var matches = _keytext_regex.search(_text)
@@ -104,12 +104,12 @@ func enter():
if not (
escoria.object_manager.get_object(escoria.object_manager.SPEECH).node\
as ESCSpeechPlayer
).stream.is_connected("finished", self, "_on_audio_finished"):
).stream.is_connected("finished", Callable(self, "_on_audio_finished")):
(
escoria.object_manager.get_object(escoria.object_manager.SPEECH).node\
as ESCSpeechPlayer
).stream.connect("finished", self, "_on_audio_finished")
).stream.connect("finished", Callable(self, "_on_audio_finished"))
var translated_text: String = tr(matches.get_string("key"))
@@ -118,7 +118,7 @@ func enter():
if translated_text == matches.get_string("key"):
escoria.logger.warn(
self,
"Unable to find translation key '%s'. Using untranslated text." % matches.get_string("key")
"Unable to find position key '%s'. Using untranslated text." % matches.get_string("key")
)
_text = matches.get_string("text")
else:
@@ -148,9 +148,9 @@ func _get_voice_file(key: String, start: String = "") -> String:
start = ESCProjectSettingsManager.get_setting(
ESCProjectSettingsManager.SPEECH_FOLDER
)
var _dir = Directory.new()
var _dir = DirAccess.new()
if _dir.open(start) == OK:
_dir.list_dir_begin(true, true)
_dir.list_dir_begin() # TODOConverter3To4 fill missing arguments https://github.com/godotengine/godot/pull/40547
var file_name = _dir.get_next()
while file_name != "":
if _dir.current_is_dir():

View File

@@ -16,8 +16,8 @@ func enter():
escoria.inputs_manager.INPUT_NONE and \
_dialog_manager != null:
if not _dialog_manager.is_connected("say_visible", self, "_on_say_visible"):
_dialog_manager.connect("say_visible", self, "_on_say_visible")
if not _dialog_manager.is_connected("say_visible", Callable(self, "_on_say_visible")):
_dialog_manager.connect("say_visible", Callable(self, "_on_say_visible"))
_dialog_manager.speedup()
else:

View File

@@ -16,8 +16,8 @@ func enter():
escoria.inputs_manager.INPUT_NONE and \
_dialog_manager != null:
if not _dialog_manager.is_connected("say_visible", self, "_on_say_visible"):
_dialog_manager.connect("say_visible", self, "_on_say_visible")
if not _dialog_manager.is_connected("say_visible", Callable(self, "_on_say_visible")):
_dialog_manager.connect("say_visible", Callable(self, "_on_say_visible"))
_dialog_manager.finish()
else:

View File

@@ -12,8 +12,8 @@ func initialize(dialog_manager: ESCDialogManager) -> void:
func enter():
escoria.logger.trace(self, "Dialog State Machine: Entered 'visible'.")
if not _dialog_manager.is_connected("say_finished", self, "_on_say_finished"):
_dialog_manager.connect("say_finished", self, "_on_say_finished")
if not _dialog_manager.is_connected("say_finished", Callable(self, "_on_say_finished")):
_dialog_manager.connect("say_finished", Callable(self, "_on_say_finished"))
func handle_input(_event):
@@ -21,11 +21,11 @@ func handle_input(_event):
if escoria.inputs_manager.input_mode != \
escoria.inputs_manager.INPUT_NONE:
if _dialog_manager.is_connected("say_finished", self, "_on_say_finished"):
_dialog_manager.disconnect("say_finished", self, "_on_say_finished")
if _dialog_manager.is_connected("say_finished", Callable(self, "_on_say_finished")):
_dialog_manager.disconnect("say_finished", Callable(self, "_on_say_finished"))
emit_signal("finished", "interrupt")
get_tree().set_input_as_handled()
get_viewport().set_input_as_handled()
# Handles the end of a say function after it has emitted say_finished.

View File

@@ -1,6 +1,6 @@
[gd_resource type="Theme" load_steps=3 format=2]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.tres" type="DynamicFont" id=1]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.tres" type="FontFile" id=1]
[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 5.0

View File

@@ -30,17 +30,17 @@ var _current_line: String
# The node holding the avatar
onready var avatar_node = $Panel/MarginContainer/HSplitContainer/VBoxContainer\
@onready var avatar_node = $Panel/MarginContainer/HSplitContainer/VBoxContainer\
/avatar
# The node showing the text
onready var text_node = $Panel/MarginContainer/HSplitContainer/text
@onready var text_node = $Panel/MarginContainer/HSplitContainer/text
# The tween node for text animations
onready var tween = $Panel/MarginContainer/HSplitContainer/text/Tween
@onready var tween = $Panel/MarginContainer/HSplitContainer/text/Tween
# Whether the dialog manager is paused
onready var is_paused: bool = true
@onready var is_paused: bool = true
@@ -103,8 +103,8 @@ func _ready():
"_on_dialog_line_typed"
)
escoria.connect("paused", self, "_on_paused")
escoria.connect("resumed", self, "_on_resumed")
escoria.connect("paused", Callable(self, "_on_paused"))
escoria.connect("resumed", Callable(self, "_on_resumed"))
# Switch the current character
@@ -112,7 +112,7 @@ func _ready():
# #### Parameters
# - name: The name of the current character
func set_current_character(name: String):
if ProjectSettings.get_setting("escoria/dialog_simple/avatars_path").empty():
if ProjectSettings.get_setting("escoria/dialog_simple/avatars_path").is_empty():
escoria.logger.warn(self, "Unable to load avatar '%s': Avatar path not specified" % name)
return
@@ -143,7 +143,7 @@ func say(character: String, line: String):
popup_centered()
set_current_character(character)
text_node.bbcode_text = tr(line)
text_node.text = tr(line)
text_node.percent_visible = 0.0
var time_show_full_text = _text_time_per_character / 1000 * len(line)
@@ -192,7 +192,7 @@ func _on_dialog_line_typed(object, key):
var time_to_disappear: float = _calculate_time_to_disappear()
$Timer.start(time_to_disappear)
$Timer.connect("timeout", self, "_on_dialog_finished")
$Timer.connect("timeout", Callable(self, "_on_dialog_finished"))
emit_signal("say_visible")

View File

@@ -5,8 +5,8 @@
[node name="dialog_box" type="Popup"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = -782.0
margin_bottom = -734.0
offset_right = -782.0
offset_bottom = -734.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
@@ -24,42 +24,42 @@ __meta__ = {
[node name="MarginContainer" type="MarginContainer" parent="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_constants/margin_right = 20
custom_constants/margin_top = 20
custom_constants/margin_left = 20
custom_constants/margin_bottom = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_left = 20
theme_override_constants/margin_bottom = 20
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HSplitContainer" type="HSplitContainer" parent="Panel/MarginContainer"]
margin_left = 20.0
margin_top = 20.0
margin_right = 478.0
margin_bottom = 146.0
custom_constants/separation = 35
offset_left = 20.0
offset_top = 20.0
offset_right = 478.0
offset_bottom = 146.0
theme_override_constants/separation = 35
dragger_visibility = 1
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer/HSplitContainer"]
margin_right = 88.0
margin_bottom = 126.0
offset_right = 88.0
offset_bottom = 126.0
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.3
[node name="avatar" type="TextureRect" parent="Panel/MarginContainer/HSplitContainer/VBoxContainer"]
margin_right = 88.0
margin_bottom = 108.0
offset_right = 88.0
offset_bottom = 108.0
size_flags_horizontal = 3
size_flags_vertical = 3
expand = true
[node name="text" type="RichTextLabel" parent="Panel/MarginContainer/HSplitContainer"]
margin_left = 123.0
margin_right = 458.0
margin_bottom = 126.0
offset_left = 123.0
offset_right = 458.0
offset_bottom = 126.0
size_flags_horizontal = 3
bbcode_enabled = true
bbcode_text = "Here be some text"
text = "Here be some text"
text = "Here be some text"
__meta__ = {
"_edit_use_anchors_": false

View File

@@ -34,13 +34,13 @@ var _current_line: String
# Tween node for text animation
onready var tween: Tween = $Tween
@onready var tween: Tween = $Tween
# The node showing the text
onready var text_node: RichTextLabel = self
@onready var text_node: RichTextLabel = self
# Whether the dialog manager is paused
onready var is_paused: bool = true
@onready var is_paused: bool = true
# Enable bbcode and catch the signal when a tween completed
@@ -96,12 +96,12 @@ func _ready():
_word_regex.compile("\\S+")
bbcode_enabled = true
$Tween.connect("tween_completed", self, "_on_dialog_line_typed")
$Tween.connect("tween_completed", Callable(self, "_on_dialog_line_typed"))
connect("tree_exiting", self, "_on_tree_exiting")
connect("tree_exiting", Callable(self, "_on_tree_exiting"))
escoria.connect("paused", self, "_on_paused")
escoria.connect("resumed", self, "_on_resumed")
escoria.connect("paused", Callable(self, "_on_paused"))
escoria.connect("resumed", Callable(self, "_on_resumed"))
_current_line = ""
@@ -110,18 +110,18 @@ func _process(delta):
if _current_character.is_inside_tree() and \
_current_character.has_node("dialog_position"):
# Position the RichTextLabel on the character's dialog position, if any.
rect_position = _current_character.get_node("dialog_position") \
.get_global_transform_with_canvas().origin
rect_position.x -= rect_size.x / 2
position = _current_character.get_node("dialog_position") \
super.get_global_transform_with_canvas().origin
position.x -= size.x / 2
if rect_position.x < 0:
rect_position.x = 0
if position.x < 0:
position.x = 0
var screen_margin = rect_position.x + rect_size.x - \
ProjectSettings.get("display/window/size/width")
var screen_margin = position.x + size.x - \
ProjectSettings.get("display/window/size/viewport_width")
if screen_margin > 0:
rect_position.x -= screen_margin
position.x -= screen_margin
# Make a character say something
@@ -143,27 +143,27 @@ func say(character: String, line: String) :
var text_color = _current_character.dialog_color
var text_color_html = text_color.to_html(false)
text_node.bbcode_text = "[center][color=#" + text_color_html + "]" \
.format([text_color_html]) + tr(line) + "[/color][center]"
text_node.text = "[center][color=#" + text_color_html + "]" \
super.format([text_color_html]) + tr(line) + "[/color][center]"
if _current_character.is_inside_tree() and \
_current_character.has_node("dialog_position"):
rect_position = _current_character.get_node(
position = _current_character.get_node(
"dialog_position"
).get_global_transform_with_canvas().origin
rect_position.x -= rect_size.x / 2
position.x -= size.x / 2
else:
rect_position.x = 0
rect_size.x = ProjectSettings.get_setting("display/window/size/width")
position.x = 0
size.x = ProjectSettings.get_setting("display/window/size/viewport_width")
if rect_position.x < 0:
rect_position.x = 0
if position.x < 0:
position.x = 0
var screen_margin = rect_position.x + rect_size.x - \
ProjectSettings.get("display/window/size/width")
var screen_margin = position.x + size.x - \
ProjectSettings.get("display/window/size/viewport_width")
if screen_margin > 0:
rect_position.x -= screen_margin
position.x -= screen_margin
_current_character.start_talking()
@@ -211,7 +211,7 @@ func _on_dialog_line_typed(object, key):
var time_to_disappear: float = _calculate_time_to_disappear()
$Timer.start(time_to_disappear)
$Timer.connect("timeout", self, "_on_dialog_finished")
$Timer.connect("timeout", Callable(self, "_on_dialog_finished"))
emit_signal("say_visible")

View File

@@ -4,11 +4,11 @@
[ext_resource path="res://addons/escoria-ui-return-monkey-island-dialog-simple/theme.tres" type="Theme" id=2]
[node name="dialog_label" type="RichTextLabel"]
margin_right = 672.0
margin_bottom = 97.0
offset_right = 672.0
offset_bottom = 97.0
theme = ExtResource( 2 )
bbcode_enabled = true
bbcode_text = "[center]Here be some text.[/center]"
text = "[center]Here be some text.[/center]"
text = "Here be some text."
fit_content_height = true
script = ExtResource( 1 )

View File

@@ -1,10 +1,10 @@
extends TextureButton
export(Texture) var musicEnabledTexture: Texture
export(Texture) var musicEnabledHoverTexture: Texture
@export var musicEnabledTexture: Texture2D
@export var musicEnabledHoverTexture: Texture2D
export(Texture) var musicDisabledTexture: Texture
export(Texture) var musicDisabledHoverTexture: Texture
@export var musicDisabledTexture: Texture2D
@export var musicDisabledHoverTexture: Texture2D
# Called when the node enters the scene tree for the first time.
func _ready():

View File

@@ -29,7 +29,7 @@ func validate(arguments: Array):
# )
# return false
return .validate(arguments)
return super.validate(arguments)
# Run the command

View File

@@ -16,14 +16,14 @@ func configure() -> ESCCommandArgumentDescriptor:
# Validate wether the given arguments match the command descriptor
func validate(arguments: Array):
return .validate(arguments)
return super.validate(arguments)
# Run the command
func run(command_params: Array) -> int:
AudioServer.set_bus_volume_db(
AudioServer.get_bus_index(escoria.BUS_MUSIC),
linear2db(
linear_to_db(
ESCProjectSettingsManager.get_setting(
ESCProjectSettingsManager.MUSIC_VOLUME
)

View File

@@ -23,7 +23,7 @@ func configure() -> ESCCommandArgumentDescriptor:
# Validate whether the given arguments match the command descriptor
func validate(arguments: Array):
if not .validate(arguments):
if not super.validate(arguments):
return false
var subFolder = arguments[1]

View File

@@ -20,7 +20,7 @@ func configure() -> ESCCommandArgumentDescriptor:
# Validate whether the given arguments match the command descriptor
func validate(arguments: Array):
if not .validate(arguments):
if not super.validate(arguments):
return false
if not ResourceLoader.exists(arguments[0]):
@@ -37,6 +37,6 @@ func validate(arguments: Array):
func run(command_params: Array) -> int:
escoria.game_scene.play_video(command_params[0])
#We wait for the video to emit "finished" signal with yield
yield(escoria.game_scene.get_video_player(),"finished")
await escoria.game_scene.get_video_player().finished
escoria.game_scene.open_inventory()
return ESCExecution.RC_OK

View File

@@ -24,7 +24,7 @@ func configure() -> ESCCommandArgumentDescriptor:
# Validate whether the given arguments match the command descriptor
func validate(arguments: Array):
if not .validate(arguments):
if not super.validate(arguments):
return false
if not escoria.object_manager.has(arguments[0]):

View File

@@ -248,7 +248,7 @@ func perform_inputevent_on_object(
)
if context is GDScriptFunctionState:
context = yield(context, "completed")
context = await context.completed
# In case of an interrupted walk, we don't want to proceed.
if context == null:

View File

@@ -60,18 +60,18 @@ func get_item(global_id: String) -> ESCItem:
func updateSprite(item: ESCItem) -> void:
var child_node = item.get_node("Sprite") as Sprite
if not child_node is Sprite:
var child_node = item.get_node("Sprite2D") as Sprite2D
if not child_node is Sprite2D:
escoria.logger.error(
self,
"No Sprite node found"
"No Sprite2D node found"
)
var texture_path = getCountTexturePath(item)
var texture = load(texture_path)
# Update texture in scene
var sprite = child_node as Sprite
var sprite = child_node as Sprite2D
sprite.texture = texture
# Update texture in scene

View File

@@ -1,15 +1,15 @@
tool
@tool
extends ESCItem
class_name ESCItemWithTooltip, "res://addons/escoria-core/design/esc_item.svg"
# Action 3 tooltip texts if item is target. Dictionary with tool's global id as key.
export(Dictionary) var action3_target_texts = {}
@export var action3_target_texts: Dictionary = {}
# Action 4 tooltip texts if item is target. Dictionary with tool's global id as key
export(Dictionary) var action4_target_texts = {}
@export var action4_target_texts: Dictionary = {}
# If action used by player is in this list, this is a valid target (second item in combination)
export(Array) var target_when_selected_action_is_in = []
@export var target_when_selected_action_is_in: Array = []
# ESCItemComponents children of this node
var components: Dictionary = {}
@@ -44,6 +44,6 @@ func autoload_components():
func set_custom_data(data: Dictionary) -> void:
.set_custom_data(data)
super.set_custom_data(data)
if custom_data.has("count"):
ESCItemCountManager.new().updateSprite(self)

View File

@@ -1,14 +1,14 @@
tool
@tool
extends ESCItemWithTooltip
class_name ESCPlayerWithTooltip, "res://addons/escoria-core/design/esc_player.svg"
# Whether the player can be selected like an item
export(bool) var selectable = false
@export var selectable: bool = false
# A player is always movable
func _init():
._init()
super._init()
is_movable = true
_force_registration = true
@@ -17,7 +17,7 @@ func _init():
# Ready function
func _ready():
if selectable:
._ready()
super._ready()
else:
tooltip_name = ""

View File

@@ -1,5 +1,5 @@
@tool
# A tooltip displaying <verb> <item1> [<item2>]
tool
extends Node2D
class_name ESCRichTooltip
@@ -18,27 +18,27 @@ const ONE_LINE_HEIGHT = 16
# Color of the label
export(Color) var color setget set_color
@export var color: Color: set = set_color
# Vector2 defining the offset from the cursor
export(Vector2) var offset_from_cursor_action1 = Vector2(0,3)
@export var offset_from_cursor_action1: Vector2 = Vector2(0,3)
export(Vector2) var offset_from_cursor_action2 = Vector2(0,-2)
@export var offset_from_cursor_action2: Vector2 = Vector2(0,-2)
export(Vector2) var offset_from_cursor_action3 = Vector2(0,3)
@export var offset_from_cursor_action3: Vector2 = Vector2(0,3)
export(Vector2) var offset_from_cursor_action4 = Vector2(0,-2)
@export var offset_from_cursor_action4: Vector2 = Vector2(0,-2)
# Activates debug mode. If enabled, shows the label with a white background.
export(bool) var debug_mode = false setget set_debug_mode
@export var debug_mode: bool = false: set = set_debug_mode
# Infinitive verb
var current_action: String
# Target item/hotspot
var current_target: String setget set_target
var current_target: String: set = set_target
var current_target_object: Object = null setget set_target_object
var current_target_object: Object = null: set = set_target_object
# Preposition: on, with...
var current_prep: String = "with"
@@ -46,7 +46,7 @@ var current_prep: String = "with"
# Target 2 item/hotspot
var current_target2: String
var current_size: Vector2 = Vector2(0,0) setget _set_current_size
var current_size: Vector2 = Vector2(0,0): set = _set_current_size
# True if tooltip is waiting for a click on second target (use x with y)
var waiting_for_target2 = false
@@ -64,10 +64,10 @@ signal tooltip_size_updated
# Connect relevant functions
func _ready():
if escoria.main.connect("room_ready", self, "_on_room_ready") != 0:
if escoria.main.connect("room_ready", Callable(self, "_on_room_ready")) != 0:
escoria.logger.error(self, "Error connecting room_ready with _on_room_ready")
if escoria.action_manager.connect("action_changed", self, "_on_action_selected") != 0:
if escoria.action_manager.connect("action_changed", Callable(self, "_on_action_selected")) != 0:
escoria.logger.error(self, "Error connecting action_changed with _on_action_selected")

View File

@@ -1,8 +1,8 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/esc_rich_tooltip.gd" type="Script" id=1]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/cursors/rounded_mouse_right.png" type="Texture" id=2]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/cursors/rounded_mouse_left.png" type="Texture" id=3]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/cursors/rounded_mouse_right.png" type="Texture2D" id=2]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/cursors/rounded_mouse_left.png" type="Texture2D" id=3]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=4]
[node name="tooltipManager" type="Node2D"]
@@ -12,14 +12,14 @@ script = ExtResource( 1 )
visible = false
[node name="label" type="Label" parent="tooltip1"]
margin_left = 9.0
margin_top = -6.0
margin_right = 119.0
margin_bottom = 8.0
offset_left = 9.0
offset_top = -6.0
offset_right = 119.0
offset_bottom = 8.0
theme = ExtResource( 4 )
text = "Text place holder"
[node name="icon" type="Sprite" parent="tooltip1"]
[node name="icon" type="Sprite2D" parent="tooltip1"]
position = Vector2( 1, 8 )
scale = Vector2( 0.583333, 0.583333 )
texture = ExtResource( 3 )
@@ -28,14 +28,14 @@ texture = ExtResource( 3 )
visible = false
[node name="label" type="Label" parent="tooltip2"]
margin_left = 9.0
margin_top = 35.0
margin_right = 144.0
margin_bottom = 64.0
offset_left = 9.0
offset_top = 35.0
offset_right = 144.0
offset_bottom = 64.0
theme = ExtResource( 4 )
text = "Text place holder"
[node name="icon" type="Sprite" parent="tooltip2"]
[node name="icon" type="Sprite2D" parent="tooltip2"]
position = Vector2( 1, 49.5 )
scale = Vector2( 0.583333, 0.583333 )
texture = ExtResource( 2 )

View File

@@ -1,6 +1,6 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[gd_resource type="FontFile" load_steps=2 format=2]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.ttf" type="FontFile" id=1]
[resource]
size = 21

View File

@@ -1,6 +1,6 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[gd_resource type="FontFile" load_steps=2 format=2]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.ttf" type="FontFile" id=1]
[resource]
font_data = ExtResource( 1 )

View File

@@ -93,17 +93,17 @@ func _ready():
# We need a slightly modified version of Action Manager to combine items with different actions.
escoria.action_manager = ESCActionManagerMonkey.new()
if $tooltip_layer/tooltip.connect("tooltip_size_updated", self, "update_tooltip_following_mouse_position", [tooltip_node]) != 0:
if $tooltip_layer/tooltip.connect("tooltip_size_updated", Callable(self, "update_tooltip_following_mouse_position").bind(tooltip_node)) != 0:
escoria.logger.error(self, "Error connecting tooltip_size_updated with update_tooltip_following_mouse_position")
# We get current day and month
var time = OS.get_datetime()
var time = Time.get_datetime_dict_from_system()
var day = time["day"]
var month = time["month"]
if( day == 8 and month ==2 ):
escoria.globals_manager.set_global('zorionak_eneko', true)
# Show inventory when video player finishes playing a video (inventory is hidden when a video starts)
get_video_player().connect("finished", self, "show_ui")
get_video_player().connect("finished", Callable(self, "show_ui"))
@@ -117,7 +117,7 @@ func _enter_tree():
preload(
"res://addons/escoria-core/ui_library/tools/room_select" +\
"/room_select.tscn"
).instance()
).instantiate()
)
var room_selector = room_selector_parent.get_node_or_null("room_select")
if(room_selector != null):
@@ -131,13 +131,13 @@ func _enter_tree():
if _is_gamepad_connected:
_on_gamepad_connected()
if Input.connect("joy_connection_changed", self, "_on_joy_connection_changed") != 0:
if Input.connect("joy_connection_changed", Callable(self, "_on_joy_connection_changed")) != 0:
escoria.logger.error(self, "Error connecting joy_connection_changed")
func _exit_tree():
escoria.inputs_manager.register_custom_input_handler(null)
Input.disconnect("joy_connection_changed", self, "_on_joy_connection_changed")
Input.disconnect("joy_connection_changed", Callable(self, "_on_joy_connection_changed"))
if _is_gamepad_connected:
_on_gamepad_disconnected()
@@ -511,13 +511,13 @@ func _on_MusicButton_pressed():
if musicEnabled:
AudioServer.set_bus_volume_db(
AudioServer.get_bus_index(escoria.BUS_MUSIC),
linear2db(0)
linear_to_db(0)
)
musicEnabled = false
else:
AudioServer.set_bus_volume_db(
AudioServer.get_bus_index(escoria.BUS_MUSIC),
linear2db(
linear_to_db(
ESCProjectSettingsManager.get_setting(
ESCProjectSettingsManager.MUSIC_VOLUME
)

View File

@@ -5,17 +5,17 @@
[ext_resource path="res://addons/escoria-core/game/scenes/camera_player/camera.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/esc_rich_tooltip.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/game.gd" type="Script" id=5]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note.svg" type="Texture" id=6]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note.svg" type="Texture2D" id=6]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/main_menu/main_menu.tscn" type="PackedScene" id=7]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/pause_menu/pause_menu.tscn" type="PackedScene" id=8]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=9]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/cog-64-hover.svg" type="Texture" id=10]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/cog-64.svg" type="Texture" id=11]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/cog-64-hover.svg" type="Texture2D" id=10]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/cog-64.svg" type="Texture2D" id=11]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/video_player/video_player.tscn" type="PackedScene" id=12]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-hover.svg" type="Texture" id=13]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-hover.svg" type="Texture2D" id=13]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/MusicButton.gd" type="Script" id=14]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-hover-disabled.svg" type="Texture" id=15]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-disabled.svg" type="Texture" id=16]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-hover-disabled.svg" type="Texture2D" id=15]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-disabled.svg" type="Texture2D" id=16]
[node name="game" type="Node2D"]
script = ExtResource( 5 )
@@ -51,30 +51,30 @@ script = ExtResource( 2 )
anchor_top = 0.9
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -26.0
offset_top = -26.0
size_flags_horizontal = 3
size_flags_vertical = 3
theme = ExtResource( 9 )
[node name="menu_button" type="Control" parent="CanvasLayer/ui"]
margin_left = 1245.0
margin_top = -643.0
margin_right = 1245.0
margin_bottom = -643.0
offset_left = 1245.0
offset_top = -643.0
offset_right = 1245.0
offset_bottom = -643.0
grow_horizontal = 2
grow_vertical = 2
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/ui/menu_button"]
margin_left = -135.0
margin_top = 6.0
margin_right = 21.0
margin_bottom = 76.0
offset_left = -135.0
offset_top = 6.0
offset_right = 21.0
offset_bottom = 76.0
alignment = 1
[node name="MusicButton" type="TextureButton" parent="CanvasLayer/ui/menu_button/HBoxContainer"]
margin_left = 44.0
margin_right = 44.0
margin_bottom = 70.0
offset_left = 44.0
offset_right = 44.0
offset_bottom = 70.0
script = ExtResource( 14 )
musicEnabledTexture = ExtResource( 6 )
musicEnabledHoverTexture = ExtResource( 13 )
@@ -82,31 +82,31 @@ musicDisabledTexture = ExtResource( 16 )
musicDisabledHoverTexture = ExtResource( 15 )
[node name="MenuButton" type="TextureButton" parent="CanvasLayer/ui/menu_button/HBoxContainer"]
margin_left = 48.0
margin_right = 112.0
margin_bottom = 70.0
offset_left = 48.0
offset_right = 112.0
offset_bottom = 70.0
texture_normal = ExtResource( 11 )
texture_hover = ExtResource( 10 )
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/ui"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = 18.0
offset_top = 18.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Spacer" type="Control" parent="CanvasLayer/ui/HBoxContainer"]
margin_right = 1186.0
margin_bottom = 90.0
offset_right = 1186.0
offset_bottom = 90.0
size_flags_horizontal = 3
[node name="inventory_ui" parent="CanvasLayer/ui/HBoxContainer" instance=ExtResource( 1 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 1190.0
margin_right = 1280.0
margin_bottom = 90.0
rect_scale = Vector2( 1, 1 )
offset_left = 1190.0
offset_right = 1280.0
offset_bottom = 90.0
scale = Vector2( 1, 1 )
[node name="pause_menu" parent="CanvasLayer" instance=ExtResource( 8 )]
visible = false

View File

@@ -6,7 +6,7 @@ var inventory_visible: bool = false
func _ready() -> void:
$FloatingInventory/panel.rect_position.x = ProjectSettings.get_setting("display/window/size/width") - $FloatingInventory/panel.rect_size.x
$FloatingInventory/panel.position.x = ProjectSettings.get_setting("display/window/size/viewport_width") - $FloatingInventory/panel.size.x
func show_inventory():

View File

@@ -6,10 +6,10 @@
[node name="inventory_ui" type="Control"]
anchor_right = 0.5
anchor_bottom = 0.5
margin_right = 768.0
margin_bottom = 540.0
rect_min_size = Vector2( 90, 90 )
rect_scale = Vector2( 0.4, 0.4 )
offset_right = 768.0
offset_bottom = 540.0
custom_minimum_size = Vector2( 90, 90 )
scale = Vector2( 0.4, 0.4 )
size_flags_horizontal = 0
size_flags_vertical = 3
script = ExtResource( 1 )
@@ -22,16 +22,16 @@ inventory_ui_container = NodePath("FloatingInventory/panel/MarginContainer/Scrol
[node name="inventory_bg" type="Polygon2D" parent="FloatingInventory"]
color = Color( 0.156863, 0.0627451, 0, 1 )
polygon = PoolVector2Array( -3, 578, 1280, 578, 1280, 752, -3, 757 )
polygon = PackedVector2Array( -3, 578, 1280, 578, 1280, 752, -3, 757 )
[node name="panel" type="TextureRect" parent="FloatingInventory"]
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -1276.0
margin_top = -160.0
rect_min_size = Vector2( 0, 160 )
offset_left = -1276.0
offset_top = -160.0
custom_minimum_size = Vector2( 0, 160 )
size_flags_horizontal = 3
size_flags_vertical = 3
expand = true
@@ -39,30 +39,30 @@ expand = true
[node name="MarginContainer" type="MarginContainer" parent="FloatingInventory/panel"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -4.0
margin_top = 2.0
margin_right = -16.0
offset_left = -4.0
offset_top = 2.0
offset_right = -16.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/margin_right = 20
custom_constants/margin_top = 20
custom_constants/margin_left = 20
custom_constants/margin_bottom = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_left = 20
theme_override_constants/margin_bottom = 20
[node name="ScrollContainer" type="ScrollContainer" parent="FloatingInventory/panel/MarginContainer"]
margin_left = 20.0
margin_top = 79.0
margin_right = 1244.0
margin_bottom = 79.0
offset_left = 20.0
offset_top = 79.0
offset_right = 1244.0
offset_bottom = 79.0
size_flags_horizontal = 3
size_flags_vertical = 6
scroll_vertical_enabled = false
[node name="container" type="HBoxContainer" parent="FloatingInventory/panel/MarginContainer/ScrollContainer"]
margin_right = 1224.0
offset_right = 1224.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 20
theme_override_constants/separation = 20
script = ExtResource( 3 )
[node name="InventoryTween" type="Tween" parent="FloatingInventory"]

View File

@@ -1,9 +1,9 @@
tool
@tool
extends Polygon2D
class_name ItemOutline, "res://addons/escoria-core/design/esc_item.svg"
export(Color) var OutLine = Color(0,0,0) setget set_outline_color
export(float) var Width = 2.0 setget set_outline_width
@export var OutLine: Color = Color(0,0,0): set = set_outline_color
@export var Width: float = 2.0: set = set_outline_width
func _draw():
var poly = get_polygon()

View File

@@ -2,7 +2,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/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="Texture2D" id=3]
[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]
@@ -33,36 +33,36 @@ __meta__ = {
anchor_left = 0.5
anchor_right = 0.5
anchor_bottom = 1.0
margin_left = -308.0
margin_right = 308.0
custom_constants/separation = 100
offset_left = -308.0
offset_right = 308.0
theme_override_constants/separation = 100
alignment = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextureRect" type="TextureRect" parent="main/main"]
margin_top = 55.0
margin_right = 616.0
margin_bottom = 355.0
offset_top = 55.0
offset_right = 616.0
offset_bottom = 355.0
texture = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="buttons" type="VBoxContainer" parent="main/main"]
margin_top = 455.0
margin_right = 616.0
margin_bottom = 695.0
custom_constants/separation = 10
offset_top = 455.0
offset_right = 616.0
offset_bottom = 695.0
theme_override_constants/separation = 10
__meta__ = {
"_edit_use_anchors_": false
}
[node name="new_game" type="Button" parent="main/main/buttons"]
margin_right = 616.0
margin_bottom = 150.0
rect_min_size = Vector2( 0, 150 )
offset_right = 616.0
offset_bottom = 150.0
custom_minimum_size = Vector2( 0, 150 )
size_flags_vertical = 3
text = "NEW_GAME"
__meta__ = {
@@ -70,9 +70,9 @@ __meta__ = {
}
[node name="load_game" type="Button" parent="main/main/buttons"]
margin_top = 160.0
margin_right = 616.0
margin_bottom = 180.0
offset_top = 160.0
offset_right = 616.0
offset_bottom = 180.0
text = "LOAD_GAME"
script = ExtResource( 2 )
__meta__ = {
@@ -80,15 +80,15 @@ __meta__ = {
}
[node name="options" type="Button" parent="main/main/buttons"]
margin_top = 190.0
margin_right = 616.0
margin_bottom = 210.0
offset_top = 190.0
offset_right = 616.0
offset_bottom = 210.0
text = "OPTIONS"
[node name="quit" type="Button" parent="main/main/buttons"]
margin_top = 220.0
margin_right = 616.0
margin_bottom = 240.0
offset_top = 220.0
offset_right = 616.0
offset_bottom = 240.0
text = "QUIT"
__meta__ = {
"_edit_use_anchors_": false

View File

@@ -19,7 +19,7 @@ var _loaded_languages: Array = []
# The settings changed
onready var settings_changed = false
@onready var changed = false
# Initialize the flags
@@ -41,7 +41,7 @@ func _ready() -> void:
"/menus/options/flags/%s.png" % lang
)
_flags_container.add_child(_lang)
_lang.connect("gui_input", self, "_on_language_input", [lang])
_lang.connect("gui_input", Callable(self, "_on_language_input").bind(lang))
# Show the options
@@ -78,7 +78,7 @@ func _on_language_input(event: InputEvent, language: String):
ESCProjectSettingsManager.TEXT_LANG,
language
)
settings_changed = true
changed = true
# Sound volume was changed
@@ -94,7 +94,7 @@ func _on_sound_volume_changed(value):
value
)
escoria.settings_manager.apply_settings()
settings_changed = true
changed = true
# Music volume was changed
@@ -110,7 +110,7 @@ func _on_music_volume_changed(value):
value
)
escoria.settings_manager.apply_settings()
settings_changed = true
changed = true
# General volume was changed
@@ -126,7 +126,7 @@ func _on_general_volume_changed(value):
value
)
escoria.settings_manager.apply_settings()
settings_changed = true
changed = true
# Speech volume was changed
@@ -142,7 +142,7 @@ func _on_speech_volume_value_changed(value: float) -> void:
value
)
escoria.settings_manager.apply_settings()
settings_changed = true
changed = true
# Fullscreen was changed
@@ -158,7 +158,7 @@ func _on_fullscreen_toggled(button_pressed: bool) -> void:
button_pressed
)
escoria.settings_manager.apply_settings()
settings_changed = true
changed = true
# Save the settings
@@ -167,7 +167,7 @@ func _on_apply_pressed():
RTMISimpleDialogSettings.READING_SPEED_IN_WPM
)
escoria.settings_manager.save_settings()
settings_changed = false
changed = false
emit_signal("back_button_pressed")
@@ -187,4 +187,4 @@ func _on_speech_speed_value_changed(value):
value
)
escoria.settings_manager.apply_settings()
settings_changed = true
changed = true

View File

@@ -1,6 +1,6 @@
[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/flags/de.png" type="Texture2D" 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"]
@@ -21,136 +21,136 @@ 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
offset_left = 391.0
offset_top = 241.0
offset_right = 888.0
offset_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
theme_override_constants/margin_right = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_left = 20
theme_override_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
offset_left = 20.0
offset_top = 20.0
offset_right = 477.0
offset_bottom = 223.0
size_flags_vertical = 6
custom_constants/hseparation = 40
theme_override_constants/h_separation = 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
offset_top = 30.0
offset_right = 137.0
offset_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
offset_left = 177.0
offset_right = 457.0
offset_bottom = 75.0
size_flags_vertical = 3
custom_constants/separation = 30
theme_override_constants/separation = 30
alignment = 1
[node name="TextureRect2" type="TextureRect" parent="VBoxContainer/MarginContainer/options/flags"]
margin_right = 125.0
margin_bottom = 75.0
offset_right = 125.0
offset_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
offset_left = 155.0
offset_right = 280.0
offset_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
offset_top = 80.0
offset_right = 137.0
offset_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
offset_left = 177.0
offset_top = 79.0
offset_right = 457.0
offset_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
offset_top = 100.0
offset_right = 137.0
offset_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
offset_left = 177.0
offset_top = 99.0
offset_right = 457.0
offset_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
offset_top = 120.0
offset_right = 137.0
offset_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
offset_left = 177.0
offset_top = 119.0
offset_right = 457.0
offset_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
offset_top = 140.0
offset_right = 137.0
offset_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
offset_left = 177.0
offset_top = 139.0
offset_right = 457.0
offset_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
offset_top = 164.0
offset_right = 137.0
offset_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
offset_left = 177.0
offset_top = 159.0
offset_right = 457.0
offset_bottom = 183.0
[node name="label7" type="Label" parent="VBoxContainer/MarginContainer/options"]
margin_top = 188.0
margin_right = 137.0
margin_bottom = 202.0
offset_top = 188.0
offset_right = 137.0
offset_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
offset_left = 177.0
offset_top = 187.0
offset_right = 457.0
offset_bottom = 203.0
size_flags_horizontal = 3
min_value = 10.0
max_value = 400.0
@@ -158,25 +158,25 @@ 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
offset_top = 488.0
offset_right = 1280.0
offset_bottom = 508.0
theme_override_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
offset_left = 549.0
offset_right = 660.0
offset_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
offset_left = 680.0
offset_right = 731.0
offset_bottom = 20.0
text = "APPLY"
__meta__ = {
"_edit_use_anchors_": false

View File

@@ -9,7 +9,7 @@ func _input(event: InputEvent) -> void:
# Make the pause menu process in pause mode and hide it just to be sure
func _ready():
self.pause_mode = Node.PAUSE_MODE_PROCESS
self.process_mode = Node.PROCESS_MODE_ALWAYS
escoria.game_scene.hide_ui()
hide()

View File

@@ -2,7 +2,7 @@
[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/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="Texture2D" 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/load/load_game.tscn" type="PackedScene" id=5]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/menus/savegame_feature_button.gd" type="Script" id=6]
@@ -32,33 +32,33 @@ visible = false
anchor_left = 0.5
anchor_right = 0.5
anchor_bottom = 1.0
margin_left = -308.0
margin_right = 308.0
custom_constants/separation = 100
offset_left = -308.0
offset_right = 308.0
theme_override_constants/separation = 100
alignment = 1
[node name="TextureRect" type="TextureRect" parent="VBoxContainer"]
margin_top = 25.0
margin_right = 616.0
margin_bottom = 325.0
offset_top = 25.0
offset_right = 616.0
offset_bottom = 325.0
texture = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="menuitems" type="VBoxContainer" parent="VBoxContainer"]
margin_top = 425.0
margin_right = 616.0
margin_bottom = 725.0
custom_constants/separation = 10
offset_top = 425.0
offset_right = 616.0
offset_bottom = 725.0
theme_override_constants/separation = 10
__meta__ = {
"_edit_use_anchors_": false
}
[node name="continue" type="Button" parent="VBoxContainer/menuitems"]
margin_right = 616.0
margin_bottom = 150.0
rect_min_size = Vector2( 0, 150 )
offset_right = 616.0
offset_bottom = 150.0
custom_minimum_size = Vector2( 0, 150 )
size_flags_vertical = 3
text = "CONTINUE_GAME"
__meta__ = {
@@ -66,9 +66,9 @@ __meta__ = {
}
[node name="new_game" type="Button" parent="VBoxContainer/menuitems"]
margin_top = 160.0
margin_right = 616.0
margin_bottom = 180.0
offset_top = 160.0
offset_right = 616.0
offset_bottom = 180.0
size_flags_vertical = 3
text = "NEW_GAME"
__meta__ = {
@@ -76,9 +76,9 @@ __meta__ = {
}
[node name="save_game" type="Button" parent="VBoxContainer/menuitems"]
margin_top = 190.0
margin_right = 616.0
margin_bottom = 210.0
offset_top = 190.0
offset_right = 616.0
offset_bottom = 210.0
size_flags_vertical = 3
text = "SAVE_GAME"
script = ExtResource( 6 )
@@ -87,9 +87,9 @@ __meta__ = {
}
[node name="load_game" type="Button" parent="VBoxContainer/menuitems"]
margin_top = 220.0
margin_right = 616.0
margin_bottom = 240.0
offset_top = 220.0
offset_right = 616.0
offset_bottom = 240.0
size_flags_vertical = 3
text = "LOAD_GAME"
script = ExtResource( 6 )
@@ -98,15 +98,15 @@ __meta__ = {
}
[node name="options" type="Button" parent="VBoxContainer/menuitems"]
margin_top = 250.0
margin_right = 616.0
margin_bottom = 270.0
offset_top = 250.0
offset_right = 616.0
offset_bottom = 270.0
text = "OPTIONS"
[node name="quit" type="Button" parent="VBoxContainer/menuitems"]
margin_top = 280.0
margin_right = 616.0
margin_bottom = 300.0
offset_top = 280.0
offset_right = 616.0
offset_bottom = 300.0
size_flags_vertical = 3
text = "QUIT"
__meta__ = {

View File

@@ -5,7 +5,7 @@ class_name ESCInventoryItem
var global_id: String = ""
# The texture for the item
var texture: Texture = null
var texture: Texture2D = null
func _init(p_item: ESCItem) -> void:

View File

@@ -100,7 +100,7 @@ func set_current_room(room: ESCRoom) -> void:
func register_object(object: ESCObject, room: ESCRoom = null, force: bool = false, \
auto_unregister: bool = true) -> void:
if object.global_id.empty():
if object.global_id.is_empty():
object.global_id = str(object.node.get_path()).split("/root/", false)[0]
object.node.global_id = object.global_id
escoria.logger.warn(
@@ -121,10 +121,10 @@ func register_object(object: ESCObject, room: ESCRoom = null, force: bool = fals
# If a room was passed in, then we're going to register the object with it;
# otherwise, we register the object with the "current room".
if room == null or room.global_id.empty():
if room == null or room.global_id.is_empty():
# We duplicate the key so as to not hold a reference when current_room_key
# changes.
if current_room_key.room_global_id.empty():
if current_room_key.room_global_id.is_empty():
escoria.logger.error(
self,
"The current room has no Global ID.\n" +
@@ -194,7 +194,7 @@ func register_object(object: ESCObject, room: ESCRoom = null, force: bool = fals
if "is_interactive" in object.node and object.node.is_interactive:
object.interactive = true
if "esc_script" in object.node and not object.node.esc_script.empty():
if "esc_script" in object.node and not object.node.esc_script.is_empty():
var script = escoria.esc_compiler.load_esc_file(
object.node.esc_script
)
@@ -240,7 +240,7 @@ func register_terrain(object: ESCObject, room: ESCRoom = null) -> void:
# If a room was passed in, then we're going to register the object with it;
# otherwise, we register the object with the "current room".
if not is_instance_valid(room) or room.global_id.empty():
if not is_instance_valid(room) or room.global_id.is_empty():
# We duplicate the key so as to not hold a reference when current_room_key
# changes.
room_key.room_global_id = current_room_key.room_global_id
@@ -259,7 +259,7 @@ func register_terrain(object: ESCObject, room: ESCRoom = null) -> void:
room_key.room_instance_id = room.get_instance_id()
var terrains: Dictionary = _get_room_terrain_navpolys(room_key)
if object.node is NavigationPolygonInstance:
if object.node is NavigationRegion2D:
terrains[object.global_id] = object
if terrains[object.global_id].node.enabled:
terrains[object.global_id].state = "enabled"
@@ -436,14 +436,14 @@ func save_game(p_savegame: ESCSaveGame) -> void:
p_savegame.objects = {}
for room_obj in room_objects:
if room_obj.room_global_id.empty():
if room_obj.room_global_id.is_empty():
continue
var room_objects_dict = {}
for obj_id in room_obj.objects:
var obj: ESCObject = room_obj.objects[obj_id]
var obj_json_to_save: Dictionary = obj.get_save_data()
if not obj_json_to_save.empty():
if not obj_json_to_save.is_empty():
room_objects_dict[obj_id] = obj_json_to_save
p_savegame.objects[room_obj.room_global_id] = room_objects_dict

View File

@@ -1,15 +1,15 @@
@tool
# Plugin script to initialize Escoria simple mouse UI
tool
extends EditorPlugin
# Override function to return the plugin name.
func get_plugin_name():
func _get_plugin_name():
return "escoria-ui-return-monkey-island"
# Deregister UI
func disable_plugin():
func _disable_plugin():
print("Disabling plugin Escoria UI Return to Monkey Island.")
EscoriaPlugin.deregister_ui("res://addons/escoria-ui-return-monkey-island/game.tscn")
ESCProjectSettingsManager.remove_setting(
@@ -39,6 +39,6 @@ func enable_plugin():
)
else:
get_editor_interface().set_plugin_enabled(
get_plugin_name(),
_get_plugin_name(),
false
)

View File

@@ -1,6 +1,6 @@
[gd_resource type="Theme" load_steps=5 format=2]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.tres" type="DynamicFont" id=1]
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.tres" type="FontFile" id=1]
[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 4.0

View File

@@ -1,11 +1,11 @@
tool
@tool
extends Node
signal finished
func play(video_file: String):
$VideoPlayer.set_stream(load(video_file))
$VideoPlayer.play()
$VideoStreamPlayer.set_stream(load(video_file))
$VideoStreamPlayer.play()
func _on_VideoPlayer_finished():
self.visible = false
@@ -13,15 +13,15 @@ func _on_VideoPlayer_finished():
func skip():
$VideoPlayer.stop()
$VideoStreamPlayer.stop()
self.visible = false
emit_signal("finished")
func get_player():
return $VideoPlayer
return $VideoStreamPlayer
func is_playing() -> bool:
var play = $VideoPlayer.is_playing()
var play = $VideoStreamPlayer.is_playing()
return play
func _on_Skip_pressed():
skip()

View File

@@ -8,36 +8,36 @@
[sub_resource type="InputEventAction" id=2]
action = "ui_cancel"
[sub_resource type="ShortCut" id=3]
[sub_resource type="Shortcut" id=3]
shortcut = SubResource( 2 )
[node name="video_player" type="Control"]
margin_right = 1285.0
margin_bottom = 753.0
offset_right = 1285.0
offset_bottom = 753.0
script = ExtResource( 1 )
[node name="ColorRect" type="ColorRect" parent="."]
margin_left = -11.0
margin_top = -3.0
margin_right = 1285.0
margin_bottom = 766.0
offset_left = -11.0
offset_top = -3.0
offset_right = 1285.0
offset_bottom = 766.0
color = Color( 0, 0, 0, 1 )
[node name="VideoPlayer" type="VideoPlayer" parent="."]
margin_right = 1279.0
margin_bottom = 771.0
[node name="VideoStreamPlayer" type="VideoStreamPlayer" parent="."]
offset_right = 1279.0
offset_bottom = 771.0
stream = SubResource( 1 )
expand = false
[node name="Skip" type="Button" parent="."]
margin_left = 1163.0
margin_top = 680.0
margin_right = 1250.0
margin_bottom = 712.0
offset_left = 1163.0
offset_top = 680.0
offset_right = 1250.0
offset_bottom = 712.0
theme = ExtResource( 2 )
shortcut_in_tooltip = false
shortcut = SubResource( 3 )
text = "Saltar video"
[connection signal="finished" from="VideoPlayer" to="." method="_on_VideoPlayer_finished"]
[connection signal="finished" from="VideoStreamPlayer" to="." method="_on_VideoPlayer_finished"]
[connection signal="pressed" from="Skip" to="." method="_on_Skip_pressed"]