feat(subtitles): subtitles can be displayed on videos from .srt files
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -12,3 +12,7 @@ bin
|
||||
addons/escoria-core/default_bus_layout.tres
|
||||
|
||||
.idea/
|
||||
|
||||
# Optional Addons per environment.
|
||||
addons/godot-plugin-refresher/
|
||||
addons/script-ide/
|
||||
|
||||
@@ -36,7 +36,7 @@ func _ready() -> void:
|
||||
# - type: required type
|
||||
# *Returns* Whether the type is supported or not
|
||||
func has_type(type: String) -> bool:
|
||||
return true if type in ["floating"] else false
|
||||
return true if type == "floating" else false
|
||||
|
||||
# Check whether a specific chooser type is supported by the
|
||||
# dialog plugin
|
||||
@@ -142,11 +142,13 @@ func _on_say_finished():
|
||||
|
||||
_is_saying = false
|
||||
|
||||
say_finished.emit()
|
||||
_dialog_player.say_finished.emit()
|
||||
escoria.game_scene.show_tooltips()
|
||||
|
||||
|
||||
|
||||
func _on_say_visible():
|
||||
say_visible.emit()
|
||||
escoria.game_scene.hide_tooltips()
|
||||
|
||||
|
||||
# Present an option chooser to the player and sends the signal
|
||||
@@ -159,12 +161,15 @@ func _on_say_visible():
|
||||
func choose(dialog_player: Node, dialog: ESCDialog, type: String):
|
||||
_dialog_player = dialog_player
|
||||
|
||||
escoria.game_scene.close_inventory()
|
||||
state_machine.states_map["choices"].initialize(dialog_player, self, dialog, type)
|
||||
state_machine._change_state("choices")
|
||||
|
||||
|
||||
|
||||
func do_choose(dialog_player: Node, dialog: ESCDialog, type: String = "simple"):
|
||||
escoria.game_scene.hide_tooltips()
|
||||
|
||||
|
||||
var chooser
|
||||
|
||||
if type == "simple" or type == "":
|
||||
@@ -178,11 +183,14 @@ func do_choose(dialog_player: Node, dialog: ESCDialog, type: String = "simple"):
|
||||
|
||||
var option = await chooser.option_chosen
|
||||
dialog_player.remove_child(chooser)
|
||||
|
||||
# MODIFIED FOR RETURN TO MONKEY UI
|
||||
if option is ESCDialogOption:
|
||||
escoria.globals_manager.set_global("ESC_DIALOG_CHOSEN_OPTION", option.option)
|
||||
# END MODIFIED FOR RETURN TO MONKEY UI
|
||||
option_chosen.emit(option)
|
||||
escoria.game_scene.hide_tooltips()
|
||||
|
||||
|
||||
# Trigger running the dialogue faster
|
||||
func speedup():
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
[gd_resource type="Theme" load_steps=5 format=3 uid="uid://dlo07cyfhpilq"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://dfs4e42nd215" path="res://addons/escoria-ui-return-monkey-island/fonts/determination.ttf" id="1_yc5i3"]
|
||||
[gd_resource type="Theme" load_steps=4 format=3 uid="uid://dlo07cyfhpilq"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="1"]
|
||||
content_margin_left = 4.0
|
||||
@@ -36,9 +34,9 @@ Label/colors/font_color = Color(1, 1, 1, 1)
|
||||
Label/colors/font_color_shadow = Color(0, 0, 0, 0)
|
||||
Label/colors/font_outline_modulate = Color(1, 0, 0, 1)
|
||||
Label/colors/label_box_bg = Color(0, 0, 0, 0.745098)
|
||||
Label/fonts/font = ExtResource("1_yc5i3")
|
||||
Label/fonts/font = null
|
||||
Label/styles/normal = SubResource("1")
|
||||
RichTextLabel/font_sizes/font_size = 20
|
||||
RichTextLabel/fonts/normal_font = ExtResource("1_yc5i3")
|
||||
RichTextLabel/fonts/normal_font = null
|
||||
RichTextLabel/styles/focus = SubResource("2")
|
||||
RichTextLabel/styles/normal = SubResource("3")
|
||||
|
||||
@@ -121,6 +121,7 @@ func say(character: String, line: String) :
|
||||
_current_line = line
|
||||
|
||||
show()
|
||||
say_visible.emit()
|
||||
|
||||
_is_speeding_up = false
|
||||
|
||||
@@ -215,8 +216,6 @@ func _on_dialog_line_typed(object, key):
|
||||
$Timer.start(time_to_disappear)
|
||||
$Timer.timeout.connect(_on_dialog_finished)
|
||||
|
||||
say_visible.emit()
|
||||
|
||||
|
||||
func _calculate_time_to_disappear() -> float:
|
||||
return (_get_number_of_words() / _reading_speed_in_wpm as float) * 60
|
||||
|
||||
@@ -10,6 +10,8 @@ var cursor_manager: RTMICursorManager = RTMICursorManager.new()
|
||||
|
||||
var csv_parser: RTMICsvParser = RTMICsvParser.new()
|
||||
|
||||
var dev_tools_registry: ESCSimpleRegistry = ESCSimpleRegistry.new()
|
||||
|
||||
func get_item(global_id: String) -> ESCItem:
|
||||
var object = escoria.object_manager.get_object(global_id)
|
||||
if !object:
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
[gd_resource type="FontFile" load_steps=2 format=3 uid="uid://cne31d6e0513y"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://dbuthr0652qv7" path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.ttf" id="1"]
|
||||
|
||||
[resource]
|
||||
fallbacks = Array[Font]([ExtResource("1")])
|
||||
cache/0/16/0/ascent = 0.0
|
||||
cache/0/16/0/descent = 0.0
|
||||
cache/0/16/0/underline_position = 0.0
|
||||
cache/0/16/0/underline_thickness = 0.0
|
||||
cache/0/16/0/scale = 1.0
|
||||
Binary file not shown.
Binary file not shown.
@@ -91,6 +91,13 @@ func _init():
|
||||
gymkhana.global_observer = RTMIGlobalObserver.new()
|
||||
escoria.di = RTMIDependencyInjector.new()
|
||||
|
||||
gymkhana.dev_tools_registry.register(preload("res://addons/escoria-ui-return-monkey-island/tools/dev/room_objects.tscn").instantiate())
|
||||
gymkhana.dev_tools_registry.register(preload("res://addons/escoria-ui-return-monkey-island/tools/dev/global_inspector.tscn").instantiate())
|
||||
gymkhana.dev_tools_registry.register(preload("res://addons/escoria-ui-return-monkey-island/tools/dev/globals_watcher.tscn").instantiate())
|
||||
gymkhana.dev_tools_registry.register(preload("res://addons/escoria-core/ui_library/tools/hover_stack/hover_stack.tscn").instantiate())
|
||||
gymkhana.dev_tools_registry.register(preload("res://addons/escoria-core/game/scenes/esc_prompt/esc_prompt_popup.tscn").instantiate())
|
||||
|
||||
|
||||
func _ready():
|
||||
tooltip_node = rtmi_tooltip_node
|
||||
# We need a slightly modified version of Action Manager to combine items with different actions.
|
||||
@@ -363,6 +370,13 @@ func open_inventory():
|
||||
func close_inventory():
|
||||
pass
|
||||
|
||||
func hide_tooltips():
|
||||
$game_layer/tooltip_layer.hide()
|
||||
|
||||
func show_tooltips():
|
||||
$game_layer/tooltip_layer.show()
|
||||
|
||||
|
||||
func hide_ui():
|
||||
$game_layer/ui_layer.hide()
|
||||
$game_layer/dialog_layer.hide()
|
||||
@@ -430,11 +444,11 @@ func apply_custom_settings(custom_settings: Dictionary):
|
||||
if custom_settings.has(RTMISimpleDialogSettings.CLEAR_TEXT_BY_CLICK_ONLY_KEY):
|
||||
escoria.logger.info(
|
||||
self,
|
||||
"custom setting value loaded: %s."
|
||||
"Custom setting value loaded CLEAR_TEXT_BY_CLICK_ONLY: %s."
|
||||
% str(custom_settings[RTMISimpleDialogSettings.CLEAR_TEXT_BY_CLICK_ONLY_KEY])
|
||||
)
|
||||
escoria.settings_manager.set(RTMISimpleDialogSettings.CLEAR_TEXT_BY_CLICK_ONLY, custom_settings["clear_text_by_click_only"] )
|
||||
#ESCProjectSettingsManager.set_setting(RTMISimpleDialogSettings.CLEAR_TEXT_BY_CLICK_ONLY,custom_settings[RTMISimpleDialogSettings.CLEAR_TEXT_BY_CLICK_ONLY_KEY])
|
||||
escoria.settings_manager.set(RTMISimpleDialogSettings.CLEAR_TEXT_BY_CLICK_ONLY, custom_settings[RTMISimpleDialogSettings.CLEAR_TEXT_BY_CLICK_ONLY_KEY] )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,20 +5,20 @@
|
||||
[ext_resource type="PackedScene" uid="uid://dmw5gicuenj53" path="res://addons/escoria-core/game/scenes/camera_player/camera.tscn" id="3"]
|
||||
[ext_resource type="PackedScene" uid="uid://d2kogebvoxy51" path="res://addons/escoria-ui-return-monkey-island/rtmi_rich_tooltip.tscn" id="4"]
|
||||
[ext_resource type="Script" uid="uid://lkc4isk3g0rj" path="res://addons/escoria-ui-return-monkey-island/game.gd" id="5"]
|
||||
[ext_resource type="Texture2D" uid="uid://c0rchilnmxyd" path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note.svg" id="6"]
|
||||
[ext_resource type="Texture2D" uid="uid://bp62pak4ca30x" path="res://addons/escoria-ui-return-monkey-island/icons/translation.svg" id="6_yfacq"]
|
||||
[ext_resource type="Texture2D" uid="uid://ce2rx8nm1s6gh" path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note.svg" id="6"]
|
||||
[ext_resource type="Texture2D" uid="uid://d0ta8viehhtdj" path="res://addons/escoria-ui-return-monkey-island/icons/translation.svg" id="6_yfacq"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3wdxi18u52c5" path="res://addons/escoria-ui-return-monkey-island/menus/main_menu/main_menu.tscn" id="7"]
|
||||
[ext_resource type="PackedScene" uid="uid://yc6r8t73rwrc" path="res://addons/escoria-ui-return-monkey-island/tools/dev/dev_tools.tscn" id="7_qk4ex"]
|
||||
[ext_resource type="Texture2D" uid="uid://blg7x18xi73va" path="res://addons/escoria-ui-return-monkey-island/icons/translation_hover.svg" id="7_we0hb"]
|
||||
[ext_resource type="Texture2D" uid="uid://dmtpxqpjt2hvh" path="res://addons/escoria-ui-return-monkey-island/icons/translation_hover.svg" id="7_we0hb"]
|
||||
[ext_resource type="PackedScene" uid="uid://dl7w8oqk1rmhw" path="res://addons/escoria-ui-return-monkey-island/menus/pause_menu/pause_menu.tscn" id="8"]
|
||||
[ext_resource type="Theme" uid="uid://bf2eet52fueam" path="res://addons/escoria-ui-return-monkey-island/theme/ui.tres" id="9"]
|
||||
[ext_resource type="PackedScene" uid="uid://ctg3fukoficqk" path="res://addons/escoria-ui-return-monkey-island/video_player/video_player.tscn" id="12"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwkquq28fkf8n" path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-hover.svg" id="13"]
|
||||
[ext_resource type="Texture2D" uid="uid://bmdk320m4epl1" path="res://addons/escoria-ui-return-monkey-island/icons/menu.svg" id="13_we0hb"]
|
||||
[ext_resource type="Texture2D" uid="uid://dghklsdy5nmcg" path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-hover.svg" id="13"]
|
||||
[ext_resource type="Texture2D" uid="uid://b35fk7ltvp1hc" path="res://addons/escoria-ui-return-monkey-island/icons/menu.svg" id="13_we0hb"]
|
||||
[ext_resource type="Script" uid="uid://chas0xyx88njl" path="res://addons/escoria-ui-return-monkey-island/MusicButton.gd" id="14"]
|
||||
[ext_resource type="Texture2D" uid="uid://dirueeaui7wlc" path="res://addons/escoria-ui-return-monkey-island/icons/menu_hover.svg" id="14_parhr"]
|
||||
[ext_resource type="Texture2D" uid="uid://p214fv1y4fr4" path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-hover-disabled.svg" id="15"]
|
||||
[ext_resource type="Texture2D" uid="uid://bcurldbc1pvn2" path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-disabled.svg" id="16"]
|
||||
[ext_resource type="Texture2D" uid="uid://c6hw4fs6aoydo" path="res://addons/escoria-ui-return-monkey-island/icons/menu_hover.svg" id="14_parhr"]
|
||||
[ext_resource type="Texture2D" uid="uid://d2sehci16hioi" path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-hover-disabled.svg" id="15"]
|
||||
[ext_resource type="Texture2D" uid="uid://e2xk0aimdte" path="res://addons/escoria-ui-return-monkey-island/icons/music-double-note-disabled.svg" id="16"]
|
||||
[ext_resource type="PackedScene" uid="uid://c0066wpl3qky4" path="res://addons/escoria-ui-return-monkey-island/menus/language_selector/language_selector.tscn" id="19_we0hb"]
|
||||
[ext_resource type="Shader" uid="uid://iehp1eakxyak" path="res://addons/escoria-ui-return-monkey-island/shaders/vignette.gdshader" id="20_parhr"]
|
||||
|
||||
|
||||
@@ -1,36 +1,13 @@
|
||||
extends ESCInventory
|
||||
|
||||
|
||||
# Whether the inventory is visible currently
|
||||
var inventory_visible: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
#$FloatingInventory/panel.position.x = ProjectSettings.get_setting("display/window/size/viewport_width") - $FloatingInventory/panel.size.x
|
||||
|
||||
|
||||
func show_inventory():
|
||||
#$FloatingInventory/panel.show()
|
||||
self.show()
|
||||
inventory_visible = true
|
||||
|
||||
|
||||
func hide_inventory():
|
||||
#$FloatingInventory/panel.hide()
|
||||
self.hide()
|
||||
inventory_visible = false
|
||||
|
||||
|
||||
func show_ui():
|
||||
#$FloatingInventory/inventory_bg.show()
|
||||
#$FloatingInventory/panel/MarginContainer/ScrollContainer/container.show()
|
||||
self.show()
|
||||
inventory_visible = true
|
||||
|
||||
|
||||
func hide_ui():
|
||||
self.hide()
|
||||
#$FloatingInventory/inventory_bg.hide()
|
||||
#$FloatingInventory/panel/MarginContainer/ScrollContainer/container.hide()
|
||||
inventory_visible = false
|
||||
|
||||
func show_inventory():
|
||||
show_ui()
|
||||
|
||||
func hide_inventory():
|
||||
hide_ui()
|
||||
@@ -1,13 +1,12 @@
|
||||
extends Node
|
||||
class_name ESCItemComponent
|
||||
@abstract class_name ESCItemComponent extends Node
|
||||
|
||||
var _custom_data: Dictionary
|
||||
|
||||
func get_global_id():
|
||||
@abstract
|
||||
func get_component_type() -> String
|
||||
|
||||
func register(custom_data: Dictionary) -> void:
|
||||
pass
|
||||
|
||||
func get_global_id() -> String:
|
||||
return self.get_parent().global_id
|
||||
|
||||
func get_component_type():
|
||||
pass
|
||||
|
||||
func register(custom_data: Dictionary):
|
||||
pass
|
||||
|
||||
257
addons/escoria-ui-return-monkey-island/logger/rtmi_logger.gd
Normal file
257
addons/escoria-ui-return-monkey-island/logger/rtmi_logger.gd
Normal file
@@ -0,0 +1,257 @@
|
||||
class RTMILogger:
|
||||
# Perform emergency savegame
|
||||
signal perform_emergency_savegame
|
||||
|
||||
# Sends the error or warning message in the signal
|
||||
signal error_message_signal(message)
|
||||
|
||||
# Log file format
|
||||
const LOG_FILE_FORMAT: String = "log_%s_%s.log"
|
||||
|
||||
# Configured log level
|
||||
var _log_level: int
|
||||
|
||||
# If true, assert() functions will not be called, thus the program won't exit or error.
|
||||
# Resets to false after an assert() call was ignored once.
|
||||
var dont_assert: bool = false
|
||||
|
||||
|
||||
# Constructor
|
||||
func _init():
|
||||
_log_level = ESCLogLevel.determine_escoria_log_level()
|
||||
|
||||
|
||||
func formatted_message(context: String, msg: String, letter: String) -> String:
|
||||
return "ESC ({0}) {1} {2}: {3}".format([_formatted_date(), letter, context, msg])
|
||||
|
||||
# Trace log
|
||||
func trace(owner: Object, msg: String, group: String = ""):
|
||||
var context: String = owner.get_script().resource_path.get_file()
|
||||
trace_message(context, msg)
|
||||
|
||||
# Direct message trace log (requiring a string for the context)
|
||||
func trace_message(context: String, msg: String, group: String = ""):
|
||||
print(formatted_message(context, msg, "T"))
|
||||
|
||||
|
||||
# Debug log
|
||||
func debug(owner: Object, msg: String, group: String = ""):
|
||||
var context: String = owner.get_script().resource_path.get_file()
|
||||
Log.debug(context, msg)
|
||||
|
||||
# Static debug log (requiring a string for the context)
|
||||
func debug_message(context: String, msg: String, group: String = ""):
|
||||
Log.debug(formatted_message(context, msg, "D"))
|
||||
|
||||
|
||||
func info(owner: Object, msg: String, group: String = ""):
|
||||
var context: String = owner.get_script().resource_path.get_file()
|
||||
Log.info(context, msg)
|
||||
|
||||
# Static info log (requiring a string for the context)
|
||||
func info_message(context: String, msg: String, group: String = ""):
|
||||
Log.info(formatted_message(context, msg, "I"))
|
||||
|
||||
|
||||
# Warning log
|
||||
func warn(owner: Object, msg: String, group: String = ""):
|
||||
var context: String = owner.get_script().resource_path.get_file()
|
||||
Log.warn(context, msg)
|
||||
|
||||
# Static warning log (requiring a string for the context)
|
||||
func warn_message(context: String, msg: String, group: String = ""):
|
||||
Log.warn(formatted_message(context, msg, "W"))
|
||||
push_warning(formatted_message(context, msg, "W"))
|
||||
if ESCProjectSettingsManager.get_setting(
|
||||
ESCProjectSettingsManager.TERMINATE_ON_WARNINGS
|
||||
):
|
||||
if not dont_assert:
|
||||
assert(false)
|
||||
escoria.get_tree().quit()
|
||||
dont_assert = false
|
||||
error_message_signal.emit(msg)
|
||||
|
||||
|
||||
# Error log
|
||||
func error(owner: Object, msg: String, group: String = ""):
|
||||
var context = owner.get_script().resource_path.get_file()
|
||||
error_message(context, msg)
|
||||
|
||||
# Static error log (requiring a string for the context)
|
||||
func error_message(context: String, msg: String, group: String = ""):
|
||||
printerr(formatted_message(context, msg, "E"))
|
||||
push_error(formatted_message(context, msg, "E"))
|
||||
if ESCProjectSettingsManager.get_setting(
|
||||
ESCProjectSettingsManager.TERMINATE_ON_ERRORS
|
||||
):
|
||||
if not dont_assert:
|
||||
assert(false)
|
||||
escoria.get_tree().quit()
|
||||
dont_assert = false
|
||||
error_message_signal.emit(msg)
|
||||
|
||||
func get_log_level() -> int:
|
||||
return _log_level
|
||||
|
||||
|
||||
func _formatted_date():
|
||||
var info = Time.get_datetime_dict_from_system()
|
||||
info["year"] = "%04d" % info["year"]
|
||||
info["month"] = "%02d" % info["month"]
|
||||
info["day"] = "%02d" % info["day"]
|
||||
info["hour"] = "%02d" % info["hour"]
|
||||
info["minute"] = "%02d" % info["minute"]
|
||||
info["second"] = "%02d" % info["second"]
|
||||
return "{year}-{month}-{day}T{hour}:{minute}:{second}".format(info)
|
||||
|
||||
|
||||
# A logger that logs to the terminal and to a log file.
|
||||
class RTMILoggerFile extends RTMILogger:
|
||||
# Log file handler
|
||||
var log_file: FileAccess
|
||||
|
||||
# Constructor
|
||||
func _init():
|
||||
super()
|
||||
# This is left alone as this constructor is called from escoria.gd's own
|
||||
# constructor
|
||||
var log_file_path = ProjectSettings.get_setting(
|
||||
ESCProjectSettingsManager.LOG_FILE_PATH
|
||||
)
|
||||
var date = Time.get_datetime_dict_from_system()
|
||||
log_file_path = log_file_path.path_join(LOG_FILE_FORMAT % [
|
||||
str(date["year"]) + str(date["month"]) + str(date["day"]),
|
||||
str(date["hour"]) + str(date["minute"]) + str(date["second"])
|
||||
])
|
||||
log_file = FileAccess.open(
|
||||
log_file_path,
|
||||
FileAccess.WRITE
|
||||
)
|
||||
|
||||
# Trace log
|
||||
func trace(owner: Object, msg: String, group: String = ""):
|
||||
if _log_level >= ESCLogLevel.LOG_TRACE:
|
||||
_log_to_file(owner, msg, "T")
|
||||
super.trace(owner, msg)
|
||||
|
||||
# Static trace log
|
||||
func trace_message(context: String, msg: String, group: String = ""):
|
||||
if _log_level >= ESCLogLevel.LOG_TRACE:
|
||||
_log_to_file_message(context, msg, "T")
|
||||
super.trace_message(context, msg)
|
||||
|
||||
# Debug log
|
||||
func debug(owner: Object, msg: String, group: String = ""):
|
||||
if _log_level >= ESCLogLevel.LOG_DEBUG:
|
||||
_log_to_file(owner, msg, "D")
|
||||
super.debug(owner, msg)
|
||||
|
||||
# Static debug log
|
||||
func debug_message(context: String, msg: String, group: String = ""):
|
||||
if _log_level >= ESCLogLevel.LOG_DEBUG:
|
||||
_log_to_file_message(context, msg, "D")
|
||||
super.debug_message(context, msg)
|
||||
|
||||
# Info log
|
||||
func info(owner: Object, msg: String, group: String = ""):
|
||||
if _log_level >= ESCLogLevel.LOG_INFO:
|
||||
_log_to_file(owner, msg, "I")
|
||||
super.info(owner, msg)
|
||||
|
||||
# Static info log
|
||||
func info_message(context: String, msg: String, group: String = ""):
|
||||
if _log_level >= ESCLogLevel.LOG_INFO:
|
||||
_log_to_file_message(context, msg, "I")
|
||||
super.info_message(context, msg)
|
||||
|
||||
# Warning log
|
||||
func warn(owner: Object, msg: String, group: String = ""):
|
||||
if _log_level >= ESCLogLevel.LOG_WARNING:
|
||||
_log_to_file(owner, msg, "W")
|
||||
if ESCProjectSettingsManager.get_setting(
|
||||
ESCProjectSettingsManager.TERMINATE_ON_WARNINGS
|
||||
):
|
||||
_log_stack_trace_to_file()
|
||||
print_stack()
|
||||
close_logs()
|
||||
super.warn(owner, msg)
|
||||
|
||||
# Static warning log
|
||||
func warn_message(context: String, msg: String, group: String = ""):
|
||||
if _log_level >= ESCLogLevel.LOG_WARNING:
|
||||
_log_to_file_message(context, msg, "W")
|
||||
if ESCProjectSettingsManager.get_setting(
|
||||
ESCProjectSettingsManager.TERMINATE_ON_WARNINGS
|
||||
):
|
||||
_log_stack_trace_to_file()
|
||||
print_stack()
|
||||
close_logs()
|
||||
super.warn_message(context, msg)
|
||||
|
||||
# Error log
|
||||
func error(owner: Object, msg: String, group: String = ""):
|
||||
if _log_level >= ESCLogLevel.LOG_ERROR:
|
||||
_log_to_file(owner, msg, "E")
|
||||
if ESCProjectSettingsManager.get_setting(
|
||||
ESCProjectSettingsManager.TERMINATE_ON_ERRORS
|
||||
):
|
||||
_log_stack_trace_to_file()
|
||||
print_stack()
|
||||
close_logs()
|
||||
super.error(owner, msg)
|
||||
|
||||
# Static eror log
|
||||
func error_message(context: String, msg: String, group: String = ""):
|
||||
if _log_level >= ESCLogLevel.LOG_ERROR:
|
||||
_log_to_file_message(context, msg, "E")
|
||||
if ESCProjectSettingsManager.get_setting(
|
||||
ESCProjectSettingsManager.TERMINATE_ON_ERRORS
|
||||
):
|
||||
_log_stack_trace_to_file()
|
||||
print_stack()
|
||||
close_logs()
|
||||
super.error_message(context, msg)
|
||||
|
||||
# Close the log file cleanly
|
||||
func close_logs():
|
||||
print("Closing logs peacefully.")
|
||||
_log_line_to_file("Closing logs peacefully.")
|
||||
log_file.close()
|
||||
|
||||
|
||||
func _log_to_file(owner: Object, msg: String, letter: String):
|
||||
var context: String
|
||||
if owner != null:
|
||||
context = owner.get_script().resource_path.get_file()
|
||||
_log_to_file_message(context, msg, letter)
|
||||
|
||||
func _log_to_file_message(context: String, msg: String, letter: String):
|
||||
if log_file.is_open():
|
||||
log_file.store_string(formatted_message(context, msg, letter) + "\n")
|
||||
|
||||
func _log_line_to_file(msg: String):
|
||||
if log_file.is_open():
|
||||
log_file.store_string(msg + "\n")
|
||||
|
||||
func _log_stack_trace_to_file():
|
||||
var frame_number = 0
|
||||
for stack in get_stack().slice(2, get_stack().size()):
|
||||
_log_line_to_file(
|
||||
"Frame %s - %s:%s in function '%s'" % [
|
||||
str(frame_number),
|
||||
stack["source"],
|
||||
stack["line"],
|
||||
stack["function"],
|
||||
]
|
||||
)
|
||||
frame_number += 1
|
||||
|
||||
|
||||
# A simple logger that logs to terminal using debug() function
|
||||
class RTMILoggerVerbose extends RTMILogger:
|
||||
func _init():
|
||||
pass
|
||||
|
||||
func debug(owner: Object, msg: String, group: String = ""):
|
||||
var context = owner.get_script().resource_path.get_file()
|
||||
print(context, ": ", msg)
|
||||
@@ -0,0 +1 @@
|
||||
uid://c1odgqe5rf066
|
||||
@@ -37,4 +37,8 @@ func _on_language_input(event: InputEvent, language: String):
|
||||
ESCProjectSettingsManager.TEXT_LANG,
|
||||
language
|
||||
)
|
||||
|
||||
# Enable video subtitles for all languages except for Spanish.
|
||||
escoria.settings_manager.custom_settings[RTMIUiSettings.VIDEO_SUBTITLES_KEY] = language != "es"
|
||||
|
||||
self.hide()
|
||||
|
||||
@@ -41,6 +41,9 @@ func initialize_options(p_settings):
|
||||
|
||||
_options.get_node("fullscreen").set_pressed_no_signal(p_settings["fullscreen"])
|
||||
|
||||
var video_subtitles = p_settings["custom_settings"].get(RTMIUiSettings.VIDEO_SUBTITLES_KEY) if p_settings["custom_settings"].has(RTMIUiSettings.VIDEO_SUBTITLES_KEY) else false
|
||||
_options.get_node("video_subtitles").set_pressed_no_signal(video_subtitles)
|
||||
|
||||
var click_to_continue = p_settings["custom_settings"].get(RTMISimpleDialogSettings.CLEAR_TEXT_BY_CLICK_ONLY_KEY) if p_settings["custom_settings"].has(RTMISimpleDialogSettings.CLEAR_TEXT_BY_CLICK_ONLY_KEY) else false
|
||||
_options.get_node("click_to_continue").set_pressed_no_signal(click_to_continue)
|
||||
|
||||
@@ -140,6 +143,18 @@ func _on_fullscreen_toggled(toggle_pressed: bool) -> void:
|
||||
changed = true
|
||||
|
||||
|
||||
# Subtitles was changed
|
||||
#
|
||||
# #### Parameters
|
||||
# - button_pressed: videos with subtitles (true) or without subtitles (false)
|
||||
func _on_video_subtitles_toggled(button_pressed: bool) -> void:
|
||||
var custom_settings = escoria.settings_manager.custom_settings
|
||||
if custom_settings[RTMIUiSettings.VIDEO_SUBTITLES_KEY] != button_pressed:
|
||||
custom_settings[RTMIUiSettings.VIDEO_SUBTITLES_KEY] = button_pressed
|
||||
escoria.settings_manager.apply_settings()
|
||||
changed = true
|
||||
|
||||
|
||||
# Save the settings
|
||||
func _on_apply_pressed():
|
||||
escoria.settings_manager.custom_settings[RTMISimpleDialogSettings.CLEAR_TEXT_BY_CLICK_ONLY_KEY] = ESCProjectSettingsManager.get_setting(
|
||||
|
||||
@@ -96,6 +96,13 @@ text = "FULLSCREEN"
|
||||
[node name="fullscreen" type="CheckButton" parent="VBoxContainer/MarginContainer/options"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="label7" type="Label" parent="VBoxContainer/MarginContainer/options"]
|
||||
layout_mode = 2
|
||||
text = "VIDEO_SUBTITLES"
|
||||
|
||||
[node name="video_subtitles" type="CheckButton" parent="VBoxContainer/MarginContainer/options"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/MarginContainer/options"]
|
||||
layout_mode = 2
|
||||
text = "CLICK_TO_CONTINUE"
|
||||
@@ -123,6 +130,7 @@ text = "APPLY"
|
||||
[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="toggled" from="VBoxContainer/MarginContainer/options/video_subtitles" to="." method="_on_video_subtitles_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/MarginContainer/options/click_to_continue" to="." method="_on_click_to_continue_toggled"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/back" to="." method="_on_back_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/apply" to="." method="_on_apply_pressed"]
|
||||
|
||||
@@ -10,8 +10,7 @@ func _ready():
|
||||
|
||||
# Continue the game
|
||||
func _on_continue_pressed():
|
||||
escoria.main.current_scene.game.unpause_game()
|
||||
|
||||
_unpause()
|
||||
|
||||
# Show the save slots
|
||||
func _on_save_game_pressed():
|
||||
@@ -70,6 +69,12 @@ func reset():
|
||||
|
||||
|
||||
func _on_new_game_pressed():
|
||||
#yield(escoria.new_game(), "completed")
|
||||
escoria.new_game()
|
||||
_unpause()
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_cancel") and escoria.current_state == escoria.GAME_STATE.PAUSED:
|
||||
call_deferred("_unpause")
|
||||
|
||||
func _unpause():
|
||||
escoria.main.current_scene.game.unpause_game()
|
||||
|
||||
@@ -7,7 +7,6 @@ extends EditorPlugin
|
||||
func _get_plugin_name():
|
||||
return "escoria-ui-return-monkey-island"
|
||||
|
||||
|
||||
# Deregister UI
|
||||
func _disable_plugin():
|
||||
print("Disabling plugin Escoria UI Return to Monkey Island.")
|
||||
@@ -15,12 +14,17 @@ func _disable_plugin():
|
||||
ESCProjectSettingsManager.remove_setting(
|
||||
RTMIUiSettings.SOUND_LIBRARY_FOLDER
|
||||
)
|
||||
|
||||
|
||||
ESCProjectSettingsManager.remove_setting(
|
||||
RTMIUiSettings.SAVEGAME_ENABLED
|
||||
)
|
||||
|
||||
# Register UI with Escoria
|
||||
func enable_plugin():
|
||||
print("Enabling plugin Escoria Dialog Simple")
|
||||
func _enable_plugin():
|
||||
print("Enabling plugin Escoria UI Return to Monkey Island.")
|
||||
add_autoload_singleton(
|
||||
"gymkhana",
|
||||
"res://addons/escoria-ui-return-monkey-island/GymkhanaAutoload.gd"
|
||||
)
|
||||
|
||||
if EscoriaPlugin.register_ui(self, "res://addons/escoria-ui-return-monkey-island/game.tscn"):
|
||||
ESCProjectSettingsManager.register_setting(
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
class_name ESCSimpleRegistry
|
||||
|
||||
var _registry: Dictionary = {}
|
||||
|
||||
const REGISTRY_ID_METHOD: String = "get_registry_id"
|
||||
|
||||
func register(record) -> void:
|
||||
if !record.has_method(REGISTRY_ID_METHOD):
|
||||
escoria.logger.error(self, "%s() function not found." % [REGISTRY_ID_METHOD])
|
||||
return
|
||||
|
||||
var record_id: String = record.get_registry_id()
|
||||
if _registry.has(record_id):
|
||||
escoria.logger.error(self, "Can't register id twice: %s" % [record_id])
|
||||
|
||||
_registry[record_id] = record
|
||||
|
||||
func get_registry() -> Dictionary:
|
||||
return _registry.duplicate(true);
|
||||
|
||||
func get_record(record_id):
|
||||
if _registry.has(record_id):
|
||||
return _registry[record_id].duplicate()
|
||||
return null
|
||||
|
||||
func get_all_records() -> Array:
|
||||
var all_records: Array = []
|
||||
|
||||
for record_id in _registry:
|
||||
all_records.append(_registry[record_id].duplicate())
|
||||
|
||||
return all_records
|
||||
@@ -0,0 +1 @@
|
||||
uid://c1xcrkf2vbipl
|
||||
@@ -3,8 +3,8 @@ class_name RTMIUiSettings
|
||||
|
||||
const SETTINGS_ROOT = "escoria/rtmi_ui"
|
||||
|
||||
|
||||
const SOUND_LIBRARY_FOLDER = "%s/sound_library_folder" % SETTINGS_ROOT
|
||||
const DEBUG_ENABLED = "%s/debug_enabled" % SETTINGS_ROOT
|
||||
const SAVEGAME_ENABLED = "%s/savegame_enabled" % SETTINGS_ROOT
|
||||
|
||||
const VIDEO_SUBTITLES_KEY = "video_subtitles"
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
[gd_resource type="Theme" load_steps=12 format=3 uid="uid://djtwqnfbbt5t8"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://dfs4e42nd215" path="res://addons/escoria-ui-return-monkey-island/fonts/determination.ttf" id="1_p03cv"]
|
||||
[gd_resource type="Theme" load_steps=11 format=3 uid="uid://djtwqnfbbt5t8"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="1"]
|
||||
bg_color = Color(0.14902, 0.14902, 0.14902, 0.784314)
|
||||
@@ -36,7 +34,6 @@ bg_color = Color(0.219501, 0.219501, 0.219501, 1)
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_p03cv"]
|
||||
|
||||
[resource]
|
||||
Button/fonts/font = ExtResource("1_p03cv")
|
||||
Button/styles/disabled = null
|
||||
Button/styles/focus = SubResource("1")
|
||||
Button/styles/hover = SubResource("2")
|
||||
@@ -47,7 +44,6 @@ CheckButton/styles/hover = SubResource("StyleBoxEmpty_gwd03")
|
||||
CheckButton/styles/hover_pressed = SubResource("StyleBoxEmpty_6jmhn")
|
||||
CheckButton/styles/normal = SubResource("StyleBoxEmpty_ktabe")
|
||||
CheckButton/styles/pressed = SubResource("StyleBoxEmpty_4rhik")
|
||||
Label/fonts/font = ExtResource("1_p03cv")
|
||||
MarginContainer/constants/margin_bottom = 5
|
||||
MarginContainer/constants/margin_left = 5
|
||||
MarginContainer/constants/margin_right = 5
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
[gd_resource type="Theme" load_steps=7 format=3 uid="uid://bf2eet52fueam"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://dfs4e42nd215" path="res://addons/escoria-ui-return-monkey-island/fonts/determination.ttf" id="1_6h504"]
|
||||
[gd_resource type="Theme" load_steps=6 format=3 uid="uid://bf2eet52fueam"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6h504"]
|
||||
|
||||
@@ -35,20 +33,16 @@ expand_margin_right = 5.0
|
||||
expand_margin_bottom = 5.0
|
||||
|
||||
[resource]
|
||||
Button/fonts/font = ExtResource("1_6h504")
|
||||
Button/styles/hover = SubResource("StyleBoxFlat_6h504")
|
||||
Label/colors/font_color = Color(1, 1, 1, 1)
|
||||
Label/colors/font_color_shadow = Color(0, 0, 0, 0)
|
||||
Label/colors/font_outline_modulate = Color(1, 0, 0, 1)
|
||||
Label/colors/label_box_bg = Color(0, 0, 0, 0.745098)
|
||||
Label/fonts/font = ExtResource("1_6h504")
|
||||
Label/styles/normal = SubResource("1")
|
||||
MarginContainer/constants/margin_bottom = 5
|
||||
MarginContainer/constants/margin_left = 5
|
||||
MarginContainer/constants/margin_right = 5
|
||||
MarginContainer/constants/margin_top = 5
|
||||
PanelContainer/styles/panel = SubResource("StyleBoxEmpty_6h504")
|
||||
RichTextLabel/fonts/mono_font = ExtResource("1_6h504")
|
||||
RichTextLabel/fonts/normal_font = ExtResource("1_6h504")
|
||||
RichTextLabel/styles/focus = SubResource("2")
|
||||
RichTextLabel/styles/normal = SubResource("3")
|
||||
|
||||
@@ -1,21 +1,32 @@
|
||||
extends PanelContainer
|
||||
|
||||
var tools: Dictionary
|
||||
var devtools: Dictionary
|
||||
@export var toolButtonContainer: Container
|
||||
|
||||
@export var hover_stack_displayer: Node
|
||||
|
||||
func _ready() -> void:
|
||||
if toolButtonContainer.get_child_count() == 0:
|
||||
devtools = gymkhana.dev_tools_registry.get_registry()
|
||||
|
||||
if devtools.size() == 0:
|
||||
return
|
||||
for child: Control in toolButtonContainer.get_children():
|
||||
if child is DevToolToggleButton:
|
||||
tools[child.tool_id] = child.tool_node
|
||||
child.connect("toggle", func(tool_id): toggle_tool(tool_id))
|
||||
escoria.inputs_manager.hover_stack.connect("hover_stack_changed", Callable(hover_stack_displayer, "update"))
|
||||
|
||||
for devtool_id in devtools:
|
||||
devtools[devtool_id].visible = false
|
||||
%ToolContainer.add_child(devtools[devtool_id])
|
||||
|
||||
var devToolButton = create_button(devtool_id)
|
||||
|
||||
%Toolbar.add_child(devToolButton)
|
||||
|
||||
#escoria.inputs_manager.hover_stack.connect("hover_stack_changed", Callable(hover_stack_displayer, "update"))
|
||||
|
||||
func toggle_tool(toolId: String):
|
||||
tools[toolId].visible = !tools[toolId].visible
|
||||
#for tool in tools:
|
||||
# if tool != toolId:
|
||||
# tools[tool].visible = false
|
||||
devtools[toolId].visible = !devtools[toolId].visible
|
||||
|
||||
func create_button(devtool_id: String) -> Button:
|
||||
var dev_tool_button = Button.new()
|
||||
dev_tool_button.toggle_mode = true
|
||||
dev_tool_button.text = devtool_id
|
||||
dev_tool_button.connect("toggled", func(toggled): toggle_tool(devtool_id))
|
||||
return dev_tool_button
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://yc6r8t73rwrc"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://yc6r8t73rwrc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://co3lr1fo4jcio" path="res://addons/escoria-ui-return-monkey-island/tools/dev/dev_tools.gd" id="1_081at"]
|
||||
[ext_resource type="PackedScene" uid="uid://ciyttd4u8lpfa" path="res://addons/escoria-ui-return-monkey-island/tools/dev/globals_watcher.tscn" id="1_wjhmu"]
|
||||
[ext_resource type="Script" uid="uid://dmtnqjdnfeu2u" path="res://addons/escoria-ui-return-monkey-island/tools/dev/ui/tool_toggle_button.gd" id="2_op8os"]
|
||||
[ext_resource type="PackedScene" uid="uid://dq6oyy5g2m03m" path="res://addons/escoria-ui-return-monkey-island/tools/dev/global_inspector.tscn" id="3_rmud2"]
|
||||
[ext_resource type="PackedScene" uid="uid://b0q36us3uuimq" path="res://addons/escoria-core/game/scenes/esc_prompt/esc_prompt_popup.tscn" id="4_gnply"]
|
||||
[ext_resource type="PackedScene" uid="uid://ceu6y33rrbdr" path="res://addons/escoria-core/ui_library/tools/hover_stack/hover_stack.tscn" id="6_v60c2"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_v60c2"]
|
||||
|
||||
[node name="DevTools" type="PanelContainer" node_paths=PackedStringArray("toolButtonContainer", "hover_stack_displayer")]
|
||||
[node name="DevTools" type="PanelContainer" node_paths=PackedStringArray("toolButtonContainer")]
|
||||
custom_minimum_size = Vector2(1280, 0)
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
@@ -18,69 +13,23 @@ size_flags_vertical = 3
|
||||
theme_override_styles/panel = SubResource("StyleBoxEmpty_v60c2")
|
||||
script = ExtResource("1_081at")
|
||||
toolButtonContainer = NodePath("MarginContainer/VBoxContainer/Toolbar")
|
||||
hover_stack_displayer = NodePath("MarginContainer/VBoxContainer/VBoxContainer/hover_stack_layer")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Toolbar" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 20)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Globals list" type="Button" parent="MarginContainer/VBoxContainer/Toolbar" node_paths=PackedStringArray("tool_node")]
|
||||
layout_mode = 2
|
||||
text = "Globals list"
|
||||
script = ExtResource("2_op8os")
|
||||
tool_id = "globals_list"
|
||||
tool_node = NodePath("../../VBoxContainer/GlobalList")
|
||||
metadata/_custom_type_script = "uid://dmtnqjdnfeu2u"
|
||||
|
||||
[node name="Global watcher" type="Button" parent="MarginContainer/VBoxContainer/Toolbar" node_paths=PackedStringArray("tool_node")]
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
text = "Watcher"
|
||||
script = ExtResource("2_op8os")
|
||||
tool_id = "watcher"
|
||||
tool_node = NodePath("../../VBoxContainer/GlobalWatcher")
|
||||
metadata/_custom_type_script = "uid://dmtnqjdnfeu2u"
|
||||
|
||||
[node name="Prompt" type="Button" parent="MarginContainer/VBoxContainer/Toolbar" node_paths=PackedStringArray("tool_node")]
|
||||
layout_mode = 2
|
||||
text = "Prompt"
|
||||
script = ExtResource("2_op8os")
|
||||
tool_id = "prompt"
|
||||
tool_node = NodePath("../../VBoxContainer/esc_prompt_popup")
|
||||
metadata/_custom_type_script = "uid://dmtnqjdnfeu2u"
|
||||
|
||||
[node name="Hover" type="Button" parent="MarginContainer/VBoxContainer/Toolbar" node_paths=PackedStringArray("tool_node")]
|
||||
layout_mode = 2
|
||||
text = "Hover"
|
||||
script = ExtResource("2_op8os")
|
||||
tool_id = "hover_stack"
|
||||
tool_node = NodePath("../../VBoxContainer/hover_stack_layer")
|
||||
metadata/_custom_type_script = "uid://dmtnqjdnfeu2u"
|
||||
|
||||
[node name="ToolContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="GlobalList" parent="MarginContainer/VBoxContainer/VBoxContainer" instance=ExtResource("3_rmud2")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
|
||||
[node name="GlobalWatcher" parent="MarginContainer/VBoxContainer/VBoxContainer" instance=ExtResource("1_wjhmu")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
|
||||
[node name="esc_prompt_popup" parent="MarginContainer/VBoxContainer/VBoxContainer" instance=ExtResource("4_gnply")]
|
||||
initial_position = 2
|
||||
|
||||
[node name="hover_stack_layer" parent="MarginContainer/VBoxContainer/VBoxContainer" instance=ExtResource("6_v60c2")]
|
||||
visible = false
|
||||
size_flags_vertical = 3
|
||||
|
||||
@@ -1,47 +1,26 @@
|
||||
extends Control
|
||||
|
||||
@export var labelContainer: VBoxContainer
|
||||
|
||||
var ui_global_variable = preload("res://addons/escoria-ui-return-monkey-island/tools/dev/ui/ui_global_variable.tscn")
|
||||
func get_registry_id():
|
||||
return "global_inspector"
|
||||
|
||||
func _ready() -> void:
|
||||
escoria.globals_manager.global_changed.connect(_on_escoria_global_changed)
|
||||
|
||||
|
||||
# React to changes to inventory globals
|
||||
func _on_escoria_global_changed(global: String, old_value, new_value) -> void:
|
||||
clear()
|
||||
var global_variables = escoria.globals_manager._globals
|
||||
global_variables.sort()
|
||||
for variable_name in global_variables:
|
||||
var label = createLabel(variable_name,escoria.globals_manager._globals[variable_name] )
|
||||
labelContainer.add_child(label)
|
||||
#_sort()
|
||||
|
||||
# Sort the hover stack by items' z-index
|
||||
#func _sort():
|
||||
# labelContainer.custo
|
||||
# if labelContainer != null:
|
||||
# labelContainer.queue_sort().sort_custom(Callable(VariableSorter, "sort_ascending_alphabetical"))
|
||||
#labelContainer\
|
||||
# .add_child(UiEscoriaVariableBuilder\
|
||||
# .create(variable_name, escoria.globals_manager._globals[variable_name]))
|
||||
%Container.add_child(
|
||||
UiEscoriaVariableBuilder.create(
|
||||
variable_name, "%s" % escoria.globals_manager._globals[variable_name]
|
||||
)
|
||||
)
|
||||
|
||||
func clear():
|
||||
for child in labelContainer.get_children():
|
||||
labelContainer.remove_child(child)
|
||||
for child in %Container.get_children():
|
||||
%Container.remove_child(child)
|
||||
child.queue_free()
|
||||
|
||||
func setCopied(name):
|
||||
for child in labelContainer.get_children():
|
||||
if child.var_name == name:
|
||||
child.copied = true
|
||||
else:
|
||||
child.copied = false
|
||||
|
||||
|
||||
func createLabel(name: String, value):
|
||||
var uiLabel:UIGlobalVariable = ui_global_variable.instantiate()
|
||||
uiLabel.set_value(name, value)
|
||||
uiLabel.connect("just_copied",_on_just_copied)
|
||||
return uiLabel
|
||||
|
||||
func _on_just_copied(name):
|
||||
setCopied(name)
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://bxon8pf4raeid" path="res://addons/escoria-ui-return-monkey-island/tools/dev/global_inspector.gd" id="1_uoyvf"]
|
||||
|
||||
[node name="GlobalInspector" type="Control" node_paths=PackedStringArray("labelContainer")]
|
||||
[node name="GlobalInspector" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_uoyvf")
|
||||
labelContainer = NodePath("PanelContainer/MarginContainer/ScrollContainer/VBoxContainer")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 4.0
|
||||
offset_bottom = 4.0
|
||||
offset_bottom = 404.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
|
||||
custom_minimum_size = Vector2(500, 500)
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 2
|
||||
theme_override_constants/margin_top = 2
|
||||
@@ -22,8 +22,10 @@ theme_override_constants/margin_right = 2
|
||||
theme_override_constants/margin_bottom = 2
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/MarginContainer"]
|
||||
custom_minimum_size = Vector2(0, 400)
|
||||
layout_mode = 2
|
||||
horizontal_scroll_mode = 0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer/ScrollContainer"]
|
||||
[node name="Container" type="VBoxContainer" parent="PanelContainer/MarginContainer/ScrollContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
extends Control
|
||||
|
||||
@export var labelContainer: Container
|
||||
func get_registry_id():
|
||||
return "globals_watcher"
|
||||
|
||||
func _ready() -> void:
|
||||
escoria.globals_manager.global_changed.connect(_on_escoria_global_changed)
|
||||
@@ -13,12 +14,12 @@ func _on_escoria_global_changed(global: String, old_value, new_value) -> void:
|
||||
|
||||
label.set_text(text)
|
||||
|
||||
labelContainer.add_child(label)
|
||||
var count = labelContainer.get_child_count()
|
||||
%Container.add_child(label)
|
||||
var count = %Container.get_child_count()
|
||||
|
||||
func clear():
|
||||
for child in labelContainer.get_children():
|
||||
labelContainer.remove_child(child)
|
||||
for child in %Container.get_children():
|
||||
%Container.remove_child(child)
|
||||
child.queue_free()
|
||||
|
||||
func _on_clear_button_pressed() -> void:
|
||||
|
||||
@@ -2,22 +2,12 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://bpcta3oc84rhu" path="res://addons/escoria-ui-return-monkey-island/tools/dev/globals_watcher.gd" id="1_42y5j"]
|
||||
|
||||
[node name="GlobalsWatcher" type="Control" node_paths=PackedStringArray("labelContainer")]
|
||||
[node name="GlobalsWatcher" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_42y5j")
|
||||
labelContainer = NodePath("PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VariableContainer")
|
||||
|
||||
[node name="ClearButton" type="Button" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -40.0
|
||||
offset_right = 53.0
|
||||
grow_vertical = 0
|
||||
text = "Clear
|
||||
"
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
layout_mode = 0
|
||||
@@ -25,7 +15,6 @@ offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
|
||||
custom_minimum_size = Vector2(400, 400)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
|
||||
@@ -43,8 +32,14 @@ theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="VariableContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/MarginContainer"]
|
||||
[node name="Container" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/MarginContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[connection signal="pressed" from="ClearButton" to="." method="_on_clear_button_pressed"]
|
||||
[node name="ClearButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Clear
|
||||
"
|
||||
|
||||
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/ClearButton" to="." method="_on_clear_button_pressed"]
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
extends Control
|
||||
|
||||
|
||||
func get_registry_id():
|
||||
return "room_objects"
|
||||
|
||||
func _ready() -> void:
|
||||
escoria.main.room_ready.connect(_on_room_ready)
|
||||
|
||||
func _on_room_ready() -> void:
|
||||
clear()
|
||||
#var current_room = escoria.globals_manager.get_global(ESCRoomManager.GLOBAL_CURRENT_SCENE)
|
||||
var current_room = escoria.object_manager.current_room_key
|
||||
if current_room.room_global_id != "":
|
||||
var room_label = Label.new()
|
||||
room_label.text = current_room.room_global_id
|
||||
%ObjectContainer.add_child(room_label)
|
||||
var room_objects = escoria.object_manager._get_room_objects_objects(current_room)
|
||||
for object_id in room_objects:
|
||||
var object = room_objects[object_id]
|
||||
%ObjectContainer.add_child(
|
||||
UiEscoriaVariableBuilder.prepare().name(object.global_id)\
|
||||
.valueFunc( func set_value():
|
||||
return "Active" if object.active else "Off"
|
||||
)
|
||||
.build()
|
||||
)
|
||||
|
||||
func clear():
|
||||
for child in %ObjectContainer.get_children():
|
||||
%ObjectContainer.remove_child(child)
|
||||
child.queue_free()
|
||||
@@ -0,0 +1 @@
|
||||
uid://dlkrkp2w2nhv0
|
||||
@@ -0,0 +1,25 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bl33soqb4k8ga"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dlkrkp2w2nhv0" path="res://addons/escoria-ui-return-monkey-island/tools/dev/room_objects.gd" id="1_ob0i5"]
|
||||
|
||||
[node name="RoomObjects" type="PanelContainer"]
|
||||
offset_right = 400.0
|
||||
offset_bottom = 420.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_ob0i5")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer"]
|
||||
custom_minimum_size = Vector2(0, 400)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ObjectContainer" type="VBoxContainer" parent="MarginContainer/ScrollContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
@@ -1,13 +0,0 @@
|
||||
extends Button
|
||||
class_name DevToolToggleButton
|
||||
|
||||
@export var tool_id: String
|
||||
@export var tool_node: Node
|
||||
|
||||
signal toggle
|
||||
|
||||
|
||||
|
||||
func _ready():
|
||||
self.connect("pressed", func(): toggle.emit(tool_id))
|
||||
self.toggle_mode = true
|
||||
@@ -1 +0,0 @@
|
||||
uid://dmtnqjdnfeu2u
|
||||
@@ -1,23 +1,21 @@
|
||||
extends Control
|
||||
class_name UIGlobalVariable
|
||||
class_name UIEscoriaVariable
|
||||
|
||||
var var_name: String
|
||||
var var_value
|
||||
|
||||
var copied: bool = false
|
||||
signal just_copied
|
||||
|
||||
func set_value(name: String, value):
|
||||
func set_variable(name: String, value):
|
||||
var_name = name
|
||||
var_value = value
|
||||
$Name.set_text(var_name)
|
||||
$Name.tooltip_text = var_name
|
||||
$Value.text = "%s" % value
|
||||
$Value.tooltip_text = "%s" % value
|
||||
copied = false
|
||||
set_value_color()
|
||||
format_value()
|
||||
|
||||
func set_value_color():
|
||||
func format_value():
|
||||
if var_value is bool:
|
||||
var boolean_color = Color.GREEN if var_value else Color.RED
|
||||
$Value.add_theme_color_override("font_color", boolean_color)
|
||||
@@ -28,10 +26,9 @@ func set_value_color():
|
||||
|
||||
func _on_name_gui_input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseButton && event.double_click:
|
||||
just_copied.emit(var_name)
|
||||
copied = true
|
||||
DisplayServer.clipboard_set(var_name)
|
||||
escoria.logger.info(self, "%s copied." % var_name)
|
||||
pass # Replace with function body.
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if copied:
|
||||
@@ -1,9 +1,9 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://mt5e6xw32u1b"]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://kp203obry7ij"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bqvsgtqhafuci" path="res://addons/escoria-ui-return-monkey-island/tools/dev/ui/ui_global_variable.gd" id="1_fdv5b"]
|
||||
[ext_resource type="Script" path="res://addons/escoria-ui-return-monkey-island/tools/dev/ui/ui_escoria_variable.gd" id="1_fdv5b"]
|
||||
|
||||
[node name="Variable" type="HBoxContainer"]
|
||||
offset_right = 419.0
|
||||
offset_right = 454.0
|
||||
offset_bottom = 23.0
|
||||
script = ExtResource("1_fdv5b")
|
||||
|
||||
@@ -25,6 +25,6 @@ size_flags_horizontal = 8
|
||||
mouse_filter = 1
|
||||
text = "VERY_LONG_TEXT_VARIABLE_NAME"
|
||||
clip_text = true
|
||||
text_overrun_behavior = 1
|
||||
text_overrun_behavior = 3
|
||||
|
||||
[connection signal="gui_input" from="Name" to="." method="_on_name_gui_input"]
|
||||
@@ -0,0 +1,39 @@
|
||||
class_name UiEscoriaVariableBuilder
|
||||
|
||||
const _scene = preload("res://addons/escoria-ui-return-monkey-island/tools/dev/ui/ui_escoria_variable.tscn")
|
||||
|
||||
var _var_name: String
|
||||
var _var_value: String
|
||||
|
||||
func _init(key: String = "", value: String = ""):
|
||||
_var_name = key
|
||||
_var_value = value
|
||||
|
||||
func name(name: String) -> UiEscoriaVariableBuilder:
|
||||
_var_name = name
|
||||
return self
|
||||
|
||||
|
||||
func value(value) -> UiEscoriaVariableBuilder:
|
||||
_var_value = value
|
||||
return self
|
||||
|
||||
func nameFunc(callable: Callable) -> UiEscoriaVariableBuilder:
|
||||
_var_name = callable.call()
|
||||
return self
|
||||
|
||||
func valueFunc(callable: Callable) -> UiEscoriaVariableBuilder:
|
||||
_var_value = callable.call()
|
||||
return self
|
||||
|
||||
func build() -> UIEscoriaVariable:
|
||||
var ui_variable = _scene.instantiate()
|
||||
ui_variable.set_variable(_var_name, _var_value)
|
||||
return ui_variable
|
||||
|
||||
static func prepare():
|
||||
return UiEscoriaVariableBuilder.new()
|
||||
|
||||
static func create(name: String, value: String):
|
||||
return UiEscoriaVariableBuilder.new(name, value).build()
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
uid://dnfqmfbcq53mx
|
||||
@@ -4,8 +4,12 @@ extends Node
|
||||
signal finished
|
||||
|
||||
func play(video_path: String):
|
||||
$VideoStreamPlayer.set_stream(load(video_path))
|
||||
# Load subtitles if option enabled
|
||||
if escoria.settings_manager.custom_settings[RTMIUiSettings.VIDEO_SUBTITLES_KEY]:
|
||||
$VideoStreamPlayer/SubtitlesLabel.parse_subtitles_file(_get_srt_path(video_path))
|
||||
|
||||
# Play video
|
||||
$VideoStreamPlayer.set_stream(load(video_path))
|
||||
$VideoStreamPlayer.play()
|
||||
|
||||
func _on_VideoPlayer_finished():
|
||||
|
||||
@@ -21,3 +21,4 @@ CONFIRM_OVERWRITE,Overwrite the savegame?,Écraser la sauvegarde ?,Soll das Spie
|
||||
YES,Yes,Oui,Ja,Sí
|
||||
NO,No,Non,Nein,No
|
||||
CLICK_TO_CONTINUE,Click to continue dialog,,,Click para avanzar dialogos
|
||||
VIDEO_SUBTITLES,Show subtitles,,,Mostrar subtítulos
|
||||
|
||||
|
@@ -46,7 +46,7 @@ search_in_file_extensions=PackedStringArray("gd", "shader", "esc")
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
enabled=PackedStringArray("res://addons/escoria-core/plugin.cfg", "res://addons/escoria-ui-return-monkey-island/plugin.cfg", "res://addons/escoria-ui-return-monkey-island-dialog-simple/plugin.cfg")
|
||||
enabled=PackedStringArray("res://addons/escoria-core/plugin.cfg", "res://addons/escoria-ui-return-monkey-island-dialog-simple/plugin.cfg", "res://addons/escoria-ui-return-monkey-island/plugin.cfg", "res://addons/godot-plugin-refresher/plugin.cfg", "res://addons/script-ide/plugin.cfg")
|
||||
|
||||
[escoria]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user