mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-17 03:53:48 +00:00
Updated dialogic
This commit is contained in:
parent
1d11462073
commit
cbb82512ee
483 changed files with 5743 additions and 2177 deletions
79
addons/dialogic/Modules/Style/DialogicStylesUtil.gd
Normal file
79
addons/dialogic/Modules/Style/DialogicStylesUtil.gd
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
@tool
|
||||
class_name DialogicStylesUtil
|
||||
extends Node
|
||||
|
||||
static var style_directory := {}
|
||||
|
||||
#region STYLES
|
||||
################################################################################
|
||||
|
||||
static func update_style_directory() -> void:
|
||||
style_directory = ProjectSettings.get_setting('dialogic/layout/style_directory', {})
|
||||
|
||||
|
||||
static func build_style_directory() -> void:
|
||||
style_directory.clear()
|
||||
|
||||
var default := get_default_style_path()
|
||||
if ResourceLoader.exists(default):
|
||||
style_directory[""] = default
|
||||
|
||||
var styles: Array = ProjectSettings.get_setting('dialogic/layout/style_list', [])
|
||||
for style_path in styles:
|
||||
if not ResourceLoader.exists(style_path):
|
||||
continue
|
||||
# TODO this is bad
|
||||
var resource: DialogicStyle = load(style_path)
|
||||
style_directory[resource.name] = style_path
|
||||
|
||||
if Engine.is_editor_hint():
|
||||
ProjectSettings.set_setting('dialogic/layout/style_directory', style_directory)
|
||||
ProjectSettings.save()
|
||||
|
||||
|
||||
static func get_default_style_path() -> String:
|
||||
return ProjectSettings.get_setting('dialogic/layout/default_style', '')
|
||||
|
||||
|
||||
static func get_default_layout_base() -> PackedScene:
|
||||
return load(DialogicUtil.get_module_path('DefaultLayoutParts').path_join("Base_Default/default_layout_base.tscn"))
|
||||
|
||||
|
||||
static func get_fallback_style_path() -> String:
|
||||
return DialogicUtil.get_module_path('DefaultLayoutParts').path_join("Style_VN_Default/default_vn_style.tres")
|
||||
|
||||
|
||||
static func get_fallback_style() -> DialogicStyle:
|
||||
return load(get_fallback_style_path())
|
||||
|
||||
|
||||
static func get_style_path(name_or_path:String) -> String:
|
||||
if name_or_path.begins_with("res://"):
|
||||
if not ResourceLoader.exists(name_or_path):
|
||||
name_or_path = ""
|
||||
|
||||
if name_or_path in style_directory:
|
||||
name_or_path = style_directory[name_or_path]
|
||||
|
||||
if not name_or_path:
|
||||
name_or_path = get_default_style_path()
|
||||
|
||||
if not name_or_path or not ResourceLoader.exists(name_or_path):
|
||||
return get_fallback_style_path()
|
||||
|
||||
return name_or_path
|
||||
|
||||
|
||||
static func start_style_preload(name_or_path:String) -> void:
|
||||
ResourceLoader.load_threaded_request(get_style_path(name_or_path))
|
||||
|
||||
|
||||
static func get_style(style_name:String) -> DialogicStyle:
|
||||
var path := get_style_path(style_name)
|
||||
if ResourceLoader.load_threaded_get_status(path) == ResourceLoader.THREAD_LOAD_LOADED:
|
||||
return ResourceLoader.load_threaded_get(path)
|
||||
|
||||
return load(path)
|
||||
|
||||
|
||||
#endregion
|
||||
1
addons/dialogic/Modules/Style/DialogicStylesUtil.gd.uid
Normal file
1
addons/dialogic/Modules/Style/DialogicStylesUtil.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://df671mnqushqc
|
||||
|
|
@ -12,7 +12,7 @@ func _get_title() -> String:
|
|||
|
||||
func _ready() -> void:
|
||||
%StyleName.resource_icon = get_theme_icon("PopupMenu", "EditorIcons")
|
||||
%StyleName.get_suggestions_func = get_style_suggestions
|
||||
%StyleName.suggestions_func = get_style_suggestions
|
||||
|
||||
|
||||
func _load_character(character:DialogicCharacter) -> void:
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://b4dbbs0oeuh77
|
||||
uid://dbc2xad3oixyw
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://fgplvp0f3giu"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b4dbbs0oeuh77" path="res://addons/dialogic/Modules/Style/character_settings_style.gd" id="2"]
|
||||
[ext_resource type="Script" uid="uid://dbc2xad3oixyw" path="res://addons/dialogic/Modules/Style/character_settings_style.gd" id="2"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpwhshre1n4t6" path="res://addons/dialogic/Editor/Events/Fields/field_options_dynamic.tscn" id="2_a46q0"]
|
||||
|
||||
[node name="Style" type="VBoxContainer"]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://di2liywvvbhgc
|
||||
uid://db0qg83hh428s
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://b74nhjvk3j215
|
||||
uid://cdiqm2ipo7k4w
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://bl040syhccq05
|
||||
uid://dlrhbqth4gipl
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ signal style_changed(info:Dictionary)
|
|||
#region STATE
|
||||
####################################################################################################
|
||||
|
||||
func _ready() -> void:
|
||||
DialogicStylesUtil.update_style_directory()
|
||||
|
||||
|
||||
func clear_game_state(_clear_flag := DialogicGameHandler.ClearFlags.FULL_CLEAR) -> void:
|
||||
pass
|
||||
|
||||
|
|
@ -33,7 +37,7 @@ func change_style(style_name := "", is_base_style := true) -> Node:
|
|||
## [br] If [param state_reload] is true, the current state will be loaded into a new layout scenes nodes.
|
||||
## That should not be done before calling start() or load() as it would be unnecessary or cause double-loading.
|
||||
func load_style(style_name := "", parent: Node = null, is_base_style := true, state_reload := false) -> Node:
|
||||
var style := DialogicUtil.get_style_by_name(style_name)
|
||||
var style := DialogicStylesUtil.get_style(style_name)
|
||||
|
||||
var signal_info := {'style':style_name}
|
||||
dialogic.current_state_info['style'] = style_name
|
||||
|
|
@ -51,7 +55,7 @@ func load_style(style_name := "", parent: Node = null, is_base_style := true, st
|
|||
return previous_layout
|
||||
|
||||
# If this has the same scene setup, just apply the new overrides
|
||||
elif previous_layout.get_meta('style') == style.get_inheritance_root():
|
||||
elif previous_layout.get_meta('style') == style.get_inheritance_root() or previous_layout.get_meta('style').get_inheritance_root() == style.get_inheritance_root():
|
||||
DialogicUtil.apply_scene_export_overrides(previous_layout, style.get_layer_inherited_info("").overrides)
|
||||
var index := 0
|
||||
for layer in previous_layout.get_layers():
|
||||
|
|
@ -92,7 +96,7 @@ func create_layout(style: DialogicStyle, parent: Node = null) -> DialogicLayoutB
|
|||
var base_scene: DialogicLayoutBase
|
||||
var base_layer_info := style.get_layer_inherited_info("")
|
||||
if base_layer_info.path.is_empty():
|
||||
base_scene = DialogicUtil.get_default_layout_base().instantiate()
|
||||
base_scene = DialogicStylesUtil.get_default_layout_base().instantiate()
|
||||
else:
|
||||
base_scene = load(base_layer_info.path).instantiate()
|
||||
|
||||
|
|
@ -172,4 +176,8 @@ func get_first_node_in_layout(group_name: String) -> Node:
|
|||
return node
|
||||
return null
|
||||
|
||||
|
||||
func preload_style(name_or_path:String = "") -> void:
|
||||
DialogicStylesUtil.start_style_preload(name_or_path)
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://d3wsgq8i1hlqn
|
||||
uid://ct3rrlxpj2kxj
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue