using System.Collections; using System.Collections.Generic; using System.ComponentModel; using EventParts; using Godot; using Godot.Bridge; using Godot.NativeInterop; [ScriptPath("res://Scripts/Events/EventParts/DialoguePart.cs")] public class DialoguePart : Node, EventPart { public new class MethodName : Node.MethodName { } public new class PropertyName : Node.PropertyName { public static readonly StringName parallel = "parallel"; public static readonly StringName pointer = "pointer"; } public new class SignalName : Node.SignalName { } [Export(PropertyHint.None, "")] private string pointer; [Export(PropertyHint.None, "")] public bool parallel { get; set; } public Coroutine routine { get; set; } EventController EventPart.parent { get; set; } public IEnumerator Routine() { TextSystem.GetText(pointer); while (TextSystem.instance.Visible) { yield return null; } } [EditorBrowsable(EditorBrowsableState.Never)] protected override bool SetGodotClassPropertyValue(in godot_string_name name, in godot_variant value) { if (name == PropertyName.parallel) { parallel = VariantUtils.ConvertTo(in value); return true; } if (name == PropertyName.pointer) { pointer = VariantUtils.ConvertTo(in value); return true; } return base.SetGodotClassPropertyValue(in name, in value); } [EditorBrowsable(EditorBrowsableState.Never)] protected override bool GetGodotClassPropertyValue(in godot_string_name name, out godot_variant value) { if (name == PropertyName.parallel) { value = VariantUtils.CreateFrom(parallel); return true; } if (name == PropertyName.pointer) { value = VariantUtils.CreateFrom(in pointer); return true; } return base.GetGodotClassPropertyValue(in name, out value); } [EditorBrowsable(EditorBrowsableState.Never)] internal static List GetGodotPropertyList() { return new List { new PropertyInfo(Variant.Type.Bool, PropertyName.parallel, PropertyHint.None, "", PropertyUsageFlags.Default | PropertyUsageFlags.ScriptVariable, exported: true), new PropertyInfo(Variant.Type.String, PropertyName.pointer, PropertyHint.None, "", PropertyUsageFlags.Default | PropertyUsageFlags.ScriptVariable, exported: true) }; } [EditorBrowsable(EditorBrowsableState.Never)] protected override void SaveGodotObjectData(GodotSerializationInfo info) { base.SaveGodotObjectData(info); info.AddProperty(PropertyName.parallel, Variant.From(parallel)); info.AddProperty(PropertyName.pointer, Variant.From(in pointer)); } [EditorBrowsable(EditorBrowsableState.Never)] protected override void RestoreGodotObjectData(GodotSerializationInfo info) { base.RestoreGodotObjectData(info); if (info.TryGetProperty(PropertyName.parallel, out var value)) { parallel = value.As(); } if (info.TryGetProperty(PropertyName.pointer, out var value2)) { pointer = value2.As(); } } }