115 lines
3.7 KiB
C#
115 lines
3.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEditor;
|
|
|
|
namespace Enviro
|
|
{
|
|
[CustomEditor(typeof(EnviroDefaultModule))]
|
|
public class EnviroDefaultModuleEditor : EnviroModuleEditor
|
|
{
|
|
private EnviroDefaultModule myTarget;
|
|
|
|
//Properties
|
|
private SerializedProperty frontColorGradient0;
|
|
|
|
|
|
//On Enable
|
|
public override void OnEnable()
|
|
{
|
|
base.OnEnable();
|
|
|
|
if(!target)
|
|
return;
|
|
|
|
myTarget = (EnviroDefaultModule)target;
|
|
serializedObj = new SerializedObject(myTarget);
|
|
preset = serializedObj.FindProperty("preset");
|
|
}
|
|
|
|
public override void OnInspectorGUI()
|
|
{
|
|
if(!target)
|
|
return;
|
|
|
|
base.OnInspectorGUI();
|
|
|
|
GUI.backgroundColor = new Color(0.7f,0.7f,0.7f,1f);
|
|
GUILayout.BeginVertical("",boxStyleModified);
|
|
GUI.backgroundColor = Color.white;
|
|
EditorGUILayout.BeginHorizontal();
|
|
myTarget.showModuleInspector = GUILayout.Toggle(myTarget.showModuleInspector, "Default Module", headerFoldout);
|
|
|
|
GUILayout.FlexibleSpace();
|
|
if(GUILayout.Button("x", EditorStyles.miniButtonRight,GUILayout.Width(18), GUILayout.Height(18)))
|
|
{
|
|
EnviroManager.instance.RemoveModule(EnviroManager.ModuleType.Time); //Add Remove
|
|
DestroyImmediate(this);
|
|
return;
|
|
}
|
|
|
|
EditorGUILayout.EndHorizontal();
|
|
|
|
if(myTarget.showModuleInspector)
|
|
{
|
|
EditorGUILayout.LabelField("This module will control your.");
|
|
serializedObj.UpdateIfRequiredOrScript ();
|
|
EditorGUI.BeginChangeCheck();
|
|
|
|
// Set Values
|
|
GUI.backgroundColor = categoryModuleColor;
|
|
GUILayout.BeginVertical("",boxStyleModified);
|
|
GUI.backgroundColor = Color.white;
|
|
myTarget.showDefaultControls = GUILayout.Toggle(myTarget.showDefaultControls, "Default Controls", headerFoldout);
|
|
if(myTarget.showDefaultControls)
|
|
{
|
|
GUILayout.Space(10);
|
|
}
|
|
GUILayout.EndVertical();
|
|
|
|
|
|
// Save Load
|
|
GUI.backgroundColor = categoryModuleColor;
|
|
GUILayout.BeginVertical("",boxStyleModified);
|
|
GUI.backgroundColor = Color.white;
|
|
myTarget.showSaveLoad = GUILayout.Toggle(myTarget.showSaveLoad, "Save/Load", headerFoldout);
|
|
|
|
if(myTarget.showSaveLoad)
|
|
{
|
|
EditorGUILayout.PropertyField(preset);
|
|
|
|
GUILayout.BeginHorizontal("",wrapStyle);
|
|
|
|
if(myTarget.preset != null)
|
|
{
|
|
if(GUILayout.Button("Load"))
|
|
{
|
|
myTarget.LoadModuleValues();
|
|
}
|
|
if(GUILayout.Button("Save"))
|
|
{
|
|
myTarget.SaveModuleValues(myTarget.preset);
|
|
}
|
|
}
|
|
if(GUILayout.Button("Save As New"))
|
|
{
|
|
myTarget.SaveModuleValues();
|
|
}
|
|
|
|
GUILayout.EndHorizontal();
|
|
|
|
|
|
}
|
|
GUILayout.EndVertical();
|
|
/// Save Load End
|
|
|
|
ApplyChanges ();
|
|
}
|
|
GUILayout.EndVertical();
|
|
|
|
if(myTarget.showModuleInspector)
|
|
GUILayout.Space(20);
|
|
}
|
|
}
|
|
}
|