Plugable dev tools, simple registry
This commit is contained in:
@@ -10,6 +10,8 @@ var cursor_manager: RTMICursorManager = RTMICursorManager.new()
|
|||||||
|
|
||||||
var csv_parser: RTMICsvParser = RTMICsvParser.new()
|
var csv_parser: RTMICsvParser = RTMICsvParser.new()
|
||||||
|
|
||||||
|
var dev_tools_registry: ESCSimpleRegistry = ESCSimpleRegistry.new()
|
||||||
|
|
||||||
func get_item(global_id: String) -> ESCItem:
|
func get_item(global_id: String) -> ESCItem:
|
||||||
var object = escoria.object_manager.get_object(global_id)
|
var object = escoria.object_manager.get_object(global_id)
|
||||||
if !object:
|
if !object:
|
||||||
|
|||||||
@@ -91,6 +91,13 @@ func _init():
|
|||||||
gymkhana.global_observer = RTMIGlobalObserver.new()
|
gymkhana.global_observer = RTMIGlobalObserver.new()
|
||||||
escoria.di = RTMIDependencyInjector.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():
|
func _ready():
|
||||||
tooltip_node = rtmi_tooltip_node
|
tooltip_node = rtmi_tooltip_node
|
||||||
# We need a slightly modified version of Action Manager to combine items with different actions.
|
# 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():
|
func close_inventory():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
func hide_tooltips():
|
||||||
|
$game_layer/tooltip_layer.hide()
|
||||||
|
|
||||||
|
func show_tooltips():
|
||||||
|
$game_layer/tooltip_layer.show()
|
||||||
|
|
||||||
|
|
||||||
func hide_ui():
|
func hide_ui():
|
||||||
$game_layer/ui_layer.hide()
|
$game_layer/ui_layer.hide()
|
||||||
$game_layer/dialog_layer.hide()
|
$game_layer/dialog_layer.hide()
|
||||||
|
|||||||
@@ -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://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="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="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://ce2rx8nm1s6gh" 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://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://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="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="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="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="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://dghklsdy5nmcg" 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://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="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://c6hw4fs6aoydo" 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://d2sehci16hioi" 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://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="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"]
|
[ext_resource type="Shader" uid="uid://iehp1eakxyak" path="res://addons/escoria-ui-return-monkey-island/shaders/vignette.gdshader" id="20_parhr"]
|
||||||
|
|
||||||
|
|||||||
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)
|
||||||
@@ -7,7 +7,6 @@ extends EditorPlugin
|
|||||||
func _get_plugin_name():
|
func _get_plugin_name():
|
||||||
return "escoria-ui-return-monkey-island"
|
return "escoria-ui-return-monkey-island"
|
||||||
|
|
||||||
|
|
||||||
# Deregister UI
|
# Deregister UI
|
||||||
func _disable_plugin():
|
func _disable_plugin():
|
||||||
print("Disabling plugin Escoria UI Return to Monkey Island.")
|
print("Disabling plugin Escoria UI Return to Monkey Island.")
|
||||||
@@ -16,11 +15,13 @@ func _disable_plugin():
|
|||||||
RTMIUiSettings.SOUND_LIBRARY_FOLDER
|
RTMIUiSettings.SOUND_LIBRARY_FOLDER
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Register UI with Escoria
|
# Register UI with Escoria
|
||||||
func enable_plugin():
|
func _enable_plugin():
|
||||||
print("Enabling plugin Escoria Dialog Simple")
|
print("Enabling plugin Escoria Dialog Simple")
|
||||||
|
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"):
|
if EscoriaPlugin.register_ui(self, "res://addons/escoria-ui-return-monkey-island/game.tscn"):
|
||||||
ESCProjectSettingsManager.register_setting(
|
ESCProjectSettingsManager.register_setting(
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
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])
|
||||||
|
|
||||||
|
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
|
||||||
@@ -1,21 +1,32 @@
|
|||||||
extends PanelContainer
|
extends PanelContainer
|
||||||
|
|
||||||
var tools: Dictionary
|
var devtools: Dictionary
|
||||||
@export var toolButtonContainer: Container
|
@export var toolButtonContainer: Container
|
||||||
|
|
||||||
@export var hover_stack_displayer: Node
|
@export var hover_stack_displayer: Node
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
if toolButtonContainer.get_child_count() == 0:
|
devtools = gymkhana.dev_tools_registry.get_registry()
|
||||||
|
|
||||||
|
if devtools.size() == 0:
|
||||||
return
|
return
|
||||||
for child: Control in toolButtonContainer.get_children():
|
|
||||||
if child is DevToolToggleButton:
|
for devtool_id in devtools:
|
||||||
tools[child.tool_id] = child.tool_node
|
devtools[devtool_id].visible = false
|
||||||
child.connect("toggle", func(tool_id): toggle_tool(tool_id))
|
%ToolContainer.add_child(devtools[devtool_id])
|
||||||
escoria.inputs_manager.hover_stack.connect("hover_stack_changed", Callable(hover_stack_displayer, "update"))
|
|
||||||
|
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):
|
func toggle_tool(toolId: String):
|
||||||
tools[toolId].visible = !tools[toolId].visible
|
devtools[toolId].visible = !devtools[toolId].visible
|
||||||
#for tool in tools:
|
|
||||||
# if tool != toolId:
|
func create_button(devtool_id: String) -> Button:
|
||||||
# tools[tool].visible = false
|
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="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"]
|
[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)
|
custom_minimum_size = Vector2(1280, 0)
|
||||||
offset_right = 40.0
|
offset_right = 40.0
|
||||||
offset_bottom = 40.0
|
offset_bottom = 40.0
|
||||||
@@ -18,69 +13,23 @@ size_flags_vertical = 3
|
|||||||
theme_override_styles/panel = SubResource("StyleBoxEmpty_v60c2")
|
theme_override_styles/panel = SubResource("StyleBoxEmpty_v60c2")
|
||||||
script = ExtResource("1_081at")
|
script = ExtResource("1_081at")
|
||||||
toolButtonContainer = NodePath("MarginContainer/VBoxContainer/Toolbar")
|
toolButtonContainer = NodePath("MarginContainer/VBoxContainer/Toolbar")
|
||||||
hover_stack_displayer = NodePath("MarginContainer/VBoxContainer/VBoxContainer/hover_stack_layer")
|
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||||
layout_mode = 2
|
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"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Toolbar" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
[node name="Toolbar" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(0, 20)
|
||||||
layout_mode = 2
|
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"]
|
[node name="ToolContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
[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
|
|
||||||
|
|||||||
@@ -1,47 +1,26 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
@export var labelContainer: VBoxContainer
|
func get_registry_id():
|
||||||
|
return "global_inspector"
|
||||||
var ui_global_variable = preload("res://addons/escoria-ui-return-monkey-island/tools/dev/ui/ui_global_variable.tscn")
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
escoria.globals_manager.global_changed.connect(_on_escoria_global_changed)
|
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:
|
func _on_escoria_global_changed(global: String, old_value, new_value) -> void:
|
||||||
clear()
|
clear()
|
||||||
var global_variables = escoria.globals_manager._globals
|
var global_variables = escoria.globals_manager._globals
|
||||||
global_variables.sort()
|
global_variables.sort()
|
||||||
for variable_name in global_variables:
|
for variable_name in global_variables:
|
||||||
var label = createLabel(variable_name,escoria.globals_manager._globals[variable_name] )
|
#labelContainer\
|
||||||
labelContainer.add_child(label)
|
# .add_child(UiEscoriaVariableBuilder\
|
||||||
#_sort()
|
# .create(variable_name, escoria.globals_manager._globals[variable_name]))
|
||||||
|
%Container.add_child(
|
||||||
# Sort the hover stack by items' z-index
|
UiEscoriaVariableBuilder.create(
|
||||||
#func _sort():
|
variable_name, "%s" % escoria.globals_manager._globals[variable_name]
|
||||||
# labelContainer.custo
|
)
|
||||||
# if labelContainer != null:
|
)
|
||||||
# labelContainer.queue_sort().sort_custom(Callable(VariableSorter, "sort_ascending_alphabetical"))
|
|
||||||
|
|
||||||
func clear():
|
func clear():
|
||||||
for child in labelContainer.get_children():
|
for child in %Container.get_children():
|
||||||
labelContainer.remove_child(child)
|
%Container.remove_child(child)
|
||||||
child.queue_free()
|
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"]
|
[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
|
layout_mode = 3
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
script = ExtResource("1_uoyvf")
|
script = ExtResource("1_uoyvf")
|
||||||
labelContainer = NodePath("PanelContainer/MarginContainer/ScrollContainer/VBoxContainer")
|
|
||||||
|
|
||||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_right = 4.0
|
offset_right = 4.0
|
||||||
offset_bottom = 4.0
|
offset_bottom = 404.0
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
|
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
|
||||||
custom_minimum_size = Vector2(500, 500)
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/margin_left = 2
|
theme_override_constants/margin_left = 2
|
||||||
theme_override_constants/margin_top = 2
|
theme_override_constants/margin_top = 2
|
||||||
@@ -22,8 +22,10 @@ theme_override_constants/margin_right = 2
|
|||||||
theme_override_constants/margin_bottom = 2
|
theme_override_constants/margin_bottom = 2
|
||||||
|
|
||||||
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/MarginContainer"]
|
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/MarginContainer"]
|
||||||
|
custom_minimum_size = Vector2(0, 400)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
horizontal_scroll_mode = 0
|
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
|
layout_mode = 2
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
@export var labelContainer: Container
|
func get_registry_id():
|
||||||
|
return "globals_watcher"
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
escoria.globals_manager.global_changed.connect(_on_escoria_global_changed)
|
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)
|
label.set_text(text)
|
||||||
|
|
||||||
labelContainer.add_child(label)
|
%Container.add_child(label)
|
||||||
var count = labelContainer.get_child_count()
|
var count = %Container.get_child_count()
|
||||||
|
|
||||||
func clear():
|
func clear():
|
||||||
for child in labelContainer.get_children():
|
for child in %Container.get_children():
|
||||||
labelContainer.remove_child(child)
|
%Container.remove_child(child)
|
||||||
child.queue_free()
|
child.queue_free()
|
||||||
|
|
||||||
func _on_clear_button_pressed() -> void:
|
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"]
|
[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
|
layout_mode = 3
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
script = ExtResource("1_42y5j")
|
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="."]
|
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
@@ -25,26 +15,31 @@ offset_right = 40.0
|
|||||||
offset_bottom = 40.0
|
offset_bottom = 40.0
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
|
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
|
||||||
custom_minimum_size = Vector2(400, 400)
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
|
[node name="Container" type="ScrollContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
custom_minimum_size = Vector2(0, 400)
|
custom_minimum_size = Vector2(0, 400)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
horizontal_scroll_mode = 0
|
horizontal_scroll_mode = 0
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer"]
|
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Container"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/margin_left = 5
|
theme_override_constants/margin_left = 5
|
||||||
theme_override_constants/margin_top = 5
|
theme_override_constants/margin_top = 5
|
||||||
theme_override_constants/margin_right = 5
|
theme_override_constants/margin_right = 5
|
||||||
theme_override_constants/margin_bottom = 5
|
theme_override_constants/margin_bottom = 5
|
||||||
|
|
||||||
[node name="VariableContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/MarginContainer"]
|
[node name="VariableContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Container/MarginContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
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
|
extends Control
|
||||||
class_name UIGlobalVariable
|
class_name UIEscoriaVariable
|
||||||
|
|
||||||
var var_name: String
|
var var_name: String
|
||||||
var var_value
|
var var_value
|
||||||
|
|
||||||
var copied: bool = false
|
var copied: bool = false
|
||||||
signal just_copied
|
|
||||||
|
|
||||||
func set_value(name: String, value):
|
func set_variable(name: String, value):
|
||||||
var_name = name
|
var_name = name
|
||||||
var_value = value
|
var_value = value
|
||||||
$Name.set_text(var_name)
|
$Name.set_text(var_name)
|
||||||
$Name.tooltip_text = var_name
|
$Name.tooltip_text = var_name
|
||||||
$Value.text = "%s" % value
|
$Value.text = "%s" % value
|
||||||
$Value.tooltip_text = "%s" % value
|
$Value.tooltip_text = "%s" % value
|
||||||
copied = false
|
format_value()
|
||||||
set_value_color()
|
|
||||||
|
|
||||||
func set_value_color():
|
func format_value():
|
||||||
if var_value is bool:
|
if var_value is bool:
|
||||||
var boolean_color = Color.GREEN if var_value else Color.RED
|
var boolean_color = Color.GREEN if var_value else Color.RED
|
||||||
$Value.add_theme_color_override("font_color", boolean_color)
|
$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:
|
func _on_name_gui_input(event: InputEvent) -> void:
|
||||||
if event is InputEventMouseButton && event.double_click:
|
if event is InputEventMouseButton && event.double_click:
|
||||||
just_copied.emit(var_name)
|
copied = true
|
||||||
DisplayServer.clipboard_set(var_name)
|
DisplayServer.clipboard_set(var_name)
|
||||||
escoria.logger.info(self, "%s copied." % var_name)
|
escoria.logger.info(self, "%s copied." % var_name)
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if copied:
|
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"]
|
[node name="Variable" type="HBoxContainer"]
|
||||||
offset_right = 419.0
|
offset_right = 454.0
|
||||||
offset_bottom = 23.0
|
offset_bottom = 23.0
|
||||||
script = ExtResource("1_fdv5b")
|
script = ExtResource("1_fdv5b")
|
||||||
|
|
||||||
@@ -25,6 +25,6 @@ size_flags_horizontal = 8
|
|||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
text = "VERY_LONG_TEXT_VARIABLE_NAME"
|
text = "VERY_LONG_TEXT_VARIABLE_NAME"
|
||||||
clip_text = true
|
clip_text = true
|
||||||
text_overrun_behavior = 1
|
text_overrun_behavior = 3
|
||||||
|
|
||||||
[connection signal="gui_input" from="Name" to="." method="_on_name_gui_input"]
|
[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
|
||||||
@@ -13,7 +13,7 @@ config_version=5
|
|||||||
config/name="Las gymkhanikas de Uli"
|
config/name="Las gymkhanikas de Uli"
|
||||||
config/description="¡Una emocionante y trepidante aventura!"
|
config/description="¡Una emocionante y trepidante aventura!"
|
||||||
run/main_scene="res://addons/escoria-core/game/main_scene.tscn"
|
run/main_scene="res://addons/escoria-core/game/main_scene.tscn"
|
||||||
config/features=PackedStringArray("4.5")
|
config/features=PackedStringArray("4.4")
|
||||||
boot_splash/bg_color=Color(0, 0, 0, 1)
|
boot_splash/bg_color=Color(0, 0, 0, 1)
|
||||||
boot_splash/fullsize=false
|
boot_splash/fullsize=false
|
||||||
boot_splash/use_filter=false
|
boot_splash/use_filter=false
|
||||||
@@ -46,7 +46,7 @@ search_in_file_extensions=PackedStringArray("gd", "shader", "esc")
|
|||||||
|
|
||||||
[editor_plugins]
|
[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]
|
[escoria]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user