Added dialogue manager plugin

This commit is contained in:
Matthew Barbour
2026-08-30 01:15:04 -05:00
parent e90ea3a0a4
commit f983ab64ce
186 changed files with 20125 additions and 0 deletions
@@ -0,0 +1,79 @@
using Godot;
namespace DialogueManagerRuntime
{
/// <summary>
/// Add a <see cref="DialogueStateContext"/> to a scene to expose a node (usually the base node) to dialogue.
/// </summary>
[Tool, Icon("uid://c22t5famre1yo")]
public partial class DialogueStateContext : Node
{
private string alias = "";
/// <summary>
/// The name used in dialogue to refer to the exposed target node.
/// </summary>
[Export]
public string Alias
{
get => alias;
set
{
alias = value;
UpdateConfigurationWarnings();
}
}
private Node target = null;
/// <summary>
/// The target whose values are exposed to dialogue.
/// </summary>
[Export]
public Node Target
{
get => target;
set
{
target = value;
UpdateConfigurationWarnings();
}
}
public override void _EnterTree()
{
if (!Engine.IsEditorHint())
{
DialogueManager.Instance.Call("register_state_context", Alias, Target);
}
}
public override void _ExitTree()
{
if (!Engine.IsEditorHint())
{
DialogueManager.Instance.Call("unregister_state_context", Alias);
}
}
public override string[] _GetConfigurationWarnings()
{
var warnings = new System.Collections.Generic.List<string>();
if (string.IsNullOrEmpty(Alias))
{
warnings.Add("Alias cannot be empty.");
}
if (Target == null)
{
warnings.Add("Target cannot be null.");
}
return warnings.ToArray();
}
}
}
@@ -0,0 +1 @@
uid://b4hjd43iw4vj8
@@ -0,0 +1,45 @@
@tool
@icon("uid://c22t5famre1yo")
## Add a [DialogueStateContext] to a scene to expose a node (usually the base node) to dialogue.
class_name DialogueStateContext extends Node
## The name used in dialogue to refer to the exposed target node.
@export var alias: String = "":
set(value):
alias = value
update_configuration_warnings()
get:
return alias
## The target who's values are exposed to dialogue.
@export var target: Node:
set(value):
target = value
update_configuration_warnings()
get:
return target
func _enter_tree() -> void:
if not Engine.is_editor_hint():
Engine.get_singleton("DialogueManager").register_state_context(alias, target)
func _exit_tree() -> void:
if not Engine.is_editor_hint():
Engine.get_singleton("DialogueManager").unregister_state_context(alias)
func _get_configuration_warnings() -> PackedStringArray:
var warnings: PackedStringArray = []
if alias.is_empty():
warnings.append(DMConstants.translate("Alias cannot be empty."))
if target == null:
warnings.append(DMConstants.translate("Target cannot be null."))
return warnings
@@ -0,0 +1 @@
uid://cd3222nx3y3k5
@@ -0,0 +1,44 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c22t5famre1yo"
path="res://.godot/imported/dialogue_state_context.svg-767b17bec3f66ee3adfc460e2805a08f.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}
[deps]
source_file="res://addons/dialogue_manager/nodes/context/dialogue_state_context.svg"
dest_files=["res://.godot/imported/dialogue_state_context.svg-767b17bec3f66ee3adfc460e2805a08f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=true
editor/convert_colors_with_editor_theme=true