Dialogue in Dialogue UI#
Game Creator / Dialogue / Dialogue in Dialogue UI
Can Read
Cannot Write
Description#
The Dialogue component referenced by a DialogueUI component
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
using VisualScript.Runtime;
namespace GameCreator.Runtime.Dialogue.UI
{
[Get]
[Title("Dialogue in Dialogue UI")]
[Category("Game Creator/Dialogue/Dialogue in Dialogue UI")]
[Description("The Dialogue component referenced by a DialogueUI component")]
[Image(typeof(IconDialogue), ColorTheme.Type.TextLight, typeof(BadgeDot))]
[Keywords("Script", "Narration", "Text", "Conversation", "Story", "Lines", "Dialogue")]
[Keywords("UI")]
[Serializable]
public class TypeGameObjectDialogueFromDialogueUI : TypeGameObject
{
[SerializeField] private GetGameObject m_DialogueUI = new GetGameObject(
new TypeGameObjectDialogueUI()
);
public override GameObject Get(Args args)
{
DialogueUI dialogueUI = this.m_DialogueUI.Get<DialogueUI>(args);
if (dialogueUI == null) return null;
Dialogue dialogue = dialogueUI.Dialogue;
return dialogue != null ? dialogue.gameObject : null;
}
public override U Get<U>(Args args)
{
if (typeof(U) == typeof(Dialogue))
{
DialogueUI dialogueUI = this.m_DialogueUI.Get<DialogueUI>(args);
return dialogueUI != null
? dialogueUI.Dialogue as U
: null;
}
return base.Get<U>(args);
}
public override string ToString()
{
return $"{this.m_DialogueUI} Dialogue";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnEditorChange;
}
}