using UnityEditor;
using UnityEngine;
using System.Collections;

[CustomEditor(typeof(Theatre))]
public class TheatreInspector : Editor {
	
	Theatre Target;
	
	void OnEnable ()
	{
		Target = target as Theatre;
	}
	
	public override void OnInspectorGUI ()
	{
		DrawDefaultInspector();
		
		serializedObject.Update();
		
		if (GUILayout.Button("Update Curtains"))
			Target.UpdateCurtainsAndTabs();
		
		if (Application.isPlaying)
		{
			EditorGUILayout.BeginHorizontal();
			if (GUILayout.Button("Open Curtains"))
				Target.OpenCurtains();
			if (GUILayout.Button("Close Curtains"))
				Target.CloseCurtains();
			EditorGUILayout.EndHorizontal();
			
			EditorGUILayout.BeginHorizontal();
			if (GUILayout.Button("Open Tabs"))
				Target.OpenTabs();
			if (GUILayout.Button("Close Tabs"))
				Target.CloseTabs();
			EditorGUILayout.EndHorizontal();
		}
		
		serializedObject.ApplyModifiedProperties();
	}
}
