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.
51 lines
1.0 KiB
51 lines
1.0 KiB
10 years ago
|
using UnityEditor;
|
||
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
10 years ago
|
namespace Fungus.Script
|
||
10 years ago
|
{
|
||
|
|
||
10 years ago
|
[CustomEditor (typeof(FungusCommand), true)]
|
||
|
public class FungusCommandEditor : Editor
|
||
10 years ago
|
{
|
||
|
|
||
10 years ago
|
public static FungusCommand selectedCommand;
|
||
10 years ago
|
|
||
10 years ago
|
public override void OnInspectorGUI()
|
||
10 years ago
|
{
|
||
10 years ago
|
Rect rect = EditorGUILayout.BeginVertical();
|
||
10 years ago
|
|
||
10 years ago
|
DrawCommandInspectorGUI();
|
||
|
|
||
|
FungusCommand t = target as FungusCommand;
|
||
|
if (t != null)
|
||
10 years ago
|
{
|
||
10 years ago
|
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));
|
||
|
}
|
||
10 years ago
|
}
|
||
10 years ago
|
|
||
|
EditorGUILayout.EndVertical();
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
public virtual void DrawCommandInspectorGUI()
|
||
|
{
|
||
|
DrawDefaultInspector();
|
||
|
}
|
||
10 years ago
|
}
|
||
|
|
||
|
}
|