An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.2 KiB

using UnityEditor;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus.Script
{
[CustomEditor (typeof(FungusCommand), true)]
public class FungusCommandEditor : Editor
{
public static FungusCommand selectedCommand;
void OnEnable()
{
FungusCommand t = target as FungusCommand;
if (t != null)
{
t.hideFlags = HideFlags.HideInInspector;
}
}
public override void OnInspectorGUI()
{
Rect rect = EditorGUILayout.BeginVertical();
DrawCommandInspectorGUI();
FungusCommand t = target as FungusCommand;
if (t != null)
{
if (t.errorMessage.Length > 0)
{
GUIStyle style = new GUIStyle(GUI.skin.label);
style.normal.textColor = new Color(1,0,0);
EditorGUILayout.LabelField(new GUIContent("Error: " + t.errorMessage), style);
}
if (t.IsExecuting())
{
EditorGUI.DrawRect(rect, new Color(0f, 1f, 0f, 0.25f));
}
else if (t == selectedCommand)
{
EditorGUI.DrawRect(rect, new Color(1f, 1f, 0f, 0.25f));
}
}
EditorGUILayout.EndVertical();
}
public virtual void DrawCommandInspectorGUI()
{
DrawDefaultInspector();
}
}
}