using System;
using UnityEngine;
using UnityEditor;
namespace Framework.Dialogue {
///
/// Assists the user in editing ground definitions for the navigation system
///
[CustomEditor(typeof(DialogueCanvas), true)]
public class DialogueCanvasEditor : Editor {
/// Called when Unity wants to layout or draw the inspector
public override void OnInspectorGUI() {
base.OnInspectorGUI();
if(Application.isPlaying) {
if(GUILayout.Button("Show Test Dialogue")) {
ShowTestDialogue();
}
if(GUILayout.Button("Hide Dialogue")) {
HideTestDialogue();
}
}
}
/// Displays some dialogue for testing
public void ShowTestDialogue() {
var dialogueCanvas = target as IDialogueCanvas;
if(dialogueCanvas != null) {
dialogueCanvas.ShowSpeechAndChoices(
"A wild dialogue canvas appears",
new string[] {
"I am impressed!",
"I can't find my canvas.",
"(Shove the canvas out of the way)"
}
);
}
}
/// Hides the currently active dialogue
public void HideTestDialogue() {
var dialogueCanvas = target as IDialogueCanvas;
if(dialogueCanvas != null) {
dialogueCanvas.Hide();
}
}
}
} // namespace Framework.Dialogue