using System; using UnityEngine; namespace Jovian.EncounterSystem { /// /// Reference to a dialog line. Looks up inside when both /// are set; otherwise falls back to . This lets designers prototype /// one-off lines inline and promote common ones to the shared library later without changing /// the field's type. /// [Serializable] public struct DialogLineRef { /// Shared library to resolve against. Optional. public DialogLineLibrary library; /// Line id inside . Ignored if is null. public string id; /// Fallback text used when the library reference is missing or fails to resolve. /// Authored directly in the inspector for one-off lines. [TextArea(2, 6)] public string inlineText; /// Resolve to final text. Returns if no library reference /// resolves, or null if both paths yield nothing. public string Resolve() { if(library != null && !string.IsNullOrEmpty(id)) { var text = library.Resolve(id); if(!string.IsNullOrEmpty(text)) { return text; } } return inlineText; } } }