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;
using Godot.Collections;
namespace DialogueManagerRuntime
{
/// <summary>
/// A special marker node that helps locate the in-world representation of the speaking character.
/// Generally, you would position a <see cref="DialogueMarker2D"/> at the mouth of the character and use
/// its location as the origin of a speech balloon.
/// </summary>
[Icon("uid://cim0y62o6g36i")]
public partial class DialogueMarker2D : Marker2D
{
/// <summary>
/// The name of the character that owns this marker.
/// </summary>
[Export] public string CharacterName = "";
#region Static
/// <summary>
/// Get all <see cref="DialogueMarker2D"/> nodes.
/// </summary>
public static Array<DialogueMarker2D> All()
{
var markers = new Array<DialogueMarker2D>();
foreach (Node node in ((SceneTree)Engine.GetMainLoop()).GetNodesInGroup("2d_dialogue_markers"))
{
if (node is DialogueMarker2D marker)
{
markers.Add(marker);
}
}
return markers;
}
/// <summary>
/// Find a marker with a given character name.
/// </summary>
public static DialogueMarker2D FindForCharacter(string targetCharacterName)
{
foreach (DialogueMarker2D marker in All())
{
if (marker.CharacterName == targetCharacterName)
{
return marker;
}
}
return null;
}
#endregion
public override void _Ready()
{
AddToGroup("2d_dialogue_markers");
}
#region Helpers
/// <summary>
/// Get the marker's position relative to the viewport.
/// </summary>
public Vector2 GetPositionInViewport()
{
return GetGlobalTransformWithCanvas().Origin;
}
#endregion
}
}
@@ -0,0 +1 @@
uid://dnftkt8d8dj8i
@@ -0,0 +1,87 @@
using Godot;
using Godot.Collections;
namespace DialogueManagerRuntime
{
/// <summary>
/// A special marker node that helps locate the in-world representation of the speaking character.
/// Generally, you would position a <see cref="DialogueMarker3D"/> at the mouth of the character and use
/// its location as the origin of a speech balloon.
/// </summary>
[Icon("uid://bo1hdyjmnjdql")]
public partial class DialogueMarker3D : Marker3D
{
/// <summary>
/// The name of the character that owns this marker.
/// </summary>
[Export] public string CharacterName = "";
#region Static
/// <summary>
/// Get all <see cref="DialogueMarker3D"/> nodes.
/// </summary>
public static Array<DialogueMarker3D> All()
{
var markers = new Array<DialogueMarker3D>();
foreach (Node node in ((SceneTree)Engine.GetMainLoop()).GetNodesInGroup("3d_dialogue_markers"))
{
if (node is DialogueMarker3D marker)
{
markers.Add(marker);
}
}
return markers;
}
/// <summary>
/// Find a marker with a given character name.
/// </summary>
public static DialogueMarker3D FindForCharacter(string targetCharacterName)
{
foreach (DialogueMarker3D marker in All())
{
if (marker.CharacterName == targetCharacterName)
{
return marker;
}
}
return null;
}
#endregion
public override void _Ready()
{
AddToGroup("3d_dialogue_markers");
}
#region Helpers
/// <summary>
/// Get the marker's position relative to the viewport.
/// </summary>
public Vector2 GetPositionInViewport()
{
Camera3D camera = GetViewport().GetCamera3D();
if (IsInstanceValid(camera))
{
return camera.UnprojectPosition(GlobalPosition);
}
else
{
return Vector2.Zero;
}
}
#endregion
}
}
@@ -0,0 +1 @@
uid://b3hrgs61lvn5x
@@ -0,0 +1,46 @@
@icon("uid://cim0y62o6g36i")
## A special marker node that helps locate the in-world representation of the speaking character.
## Generally, you would position a [DialogueMaker2D] at the mouth of the character and use
## its location as the origin of a speech balloon.
class_name DialogueMarker2D extends Marker2D
## The name of the character that owns this marker.
@export var character_name: String = ""
#region Static
## Get all [DialogueMarker2D] nodes.
static func all() -> Array[DialogueMarker2D]:
var markers: Array[DialogueMarker2D] = []
for node: DialogueMarker2D in (Engine.get_main_loop() as SceneTree).get_nodes_in_group("2d_dialogue_markers"):
markers.append(node)
return markers
## Find a marker with a given character name.
static func find_for_character(target_character_name: String) -> DialogueMarker2D:
for marker: DialogueMarker2D in all():
if marker.character_name == target_character_name:
return marker
return null
#endregion
func _ready() -> void:
add_to_group("2d_dialogue_markers")
#region Helpers
## Get the marker's position relative to the viewport.
func get_position_in_viewport() -> Vector2:
return get_global_transform_with_canvas().origin
#endregion
@@ -0,0 +1 @@
uid://cxge1wx70prau
@@ -0,0 +1,44 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cim0y62o6g36i"
path="res://.godot/imported/dialogue_marker_2d.svg-1eedb01d2a05819be5ce0e675c93eeab.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}
[deps]
source_file="res://addons/dialogue_manager/nodes/marker/dialogue_marker_2d.svg"
dest_files=["res://.godot/imported/dialogue_marker_2d.svg-1eedb01d2a05819be5ce0e675c93eeab.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
@@ -0,0 +1,50 @@
@icon("uid://bo1hdyjmnjdql")
## A special marker node that helps locate the in-world representation of the speaking character.
## Generally, you would position a [DialogueMaker3D] at the mouth of the character and use
## its location as the origin of a speech balloon.
class_name DialogueMarker3D extends Marker3D
## The name of the character that owns this marker.
@export var character_name: String = ""
#region Static
## Get all [DialogueMarker3D] nodes.
static func all() -> Array[DialogueMarker3D]:
var markers: Array[DialogueMarker3D] = []
for node: DialogueMarker3D in (Engine.get_main_loop() as SceneTree).get_nodes_in_group("3d_dialogue_markers"):
markers.append(node)
return markers
## Find a marker with a given character name.
static func find_for_character(target_character_name: String) -> DialogueMarker3D:
for marker: DialogueMarker3D in all():
if marker.character_name == target_character_name:
return marker
return null
#endregion
func _ready() -> void:
add_to_group("3d_dialogue_markers")
#region Helpers
## Get the marker's position relative to the viewport.
func get_position_in_viewport() -> Vector2:
var camera: Camera3D = get_viewport().get_camera_3d()
if is_instance_valid(camera):
return camera.unproject_position(global_position)
else:
return Vector2.ZERO
#endregion
@@ -0,0 +1 @@
uid://bb636aic4yoo6
@@ -0,0 +1,44 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bo1hdyjmnjdql"
path="res://.godot/imported/dialogue_marker_3d.svg-f68ab9ede59096854a7c6ee123dd8e4e.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}
[deps]
source_file="res://addons/dialogue_manager/nodes/marker/dialogue_marker_3d.svg"
dest_files=["res://.godot/imported/dialogue_marker_3d.svg-f68ab9ede59096854a7c6ee123dd8e4e.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