using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(QSO_Base))]
public class QSO_Editor : Editor
{
SerializedProperty qname;
SerializedProperty qdesc;
SerializedProperty qtype;
SerializedProperty qgoal;
GUIContent qname_desc = new GUIContent("Nome da quest");
GUIContent qdesc_desc = new GUIContent("Descrição da quest");
GUIContent qgoal_desc_item = new GUIContent("Item a ser coletado");
GUIContent qgoal_desc_mons = new GUIContent("Monstro a ser derrotado");
GUIContent qgoal_desc2 = new GUIContent("Quantidade");
string[] qtype_options = { "Selecionar", "1 - Coleta", "2 - Movimentação", "3 - Derrotar" };
int[] qtype_selection = { 0, 1, 2, 3 };
int qtype_selected = 0;
void OnEnable()
{
qname = serializedObject.FindProperty("questName");
qdesc = serializedObject.FindProperty("questDesc");
qtype = serializedObject.FindProperty("questType");
qgoal = serializedObject.FindProperty("goals");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(qname, qname_desc);
EditorGUILayout.LabelField("");
EditorGUILayout.PropertyField(qdesc, qdesc_desc);
EditorGUILayout.LabelField("");
qtype_selected = EditorGUILayout.IntPopup("Tipo de quest", qtype_selected, qtype_options, qtype_selection);
qtype.intValue = qtype_selected;
EditorGUILayout.LabelField("");
switch (qtype_selected)
{
case 1: //Coleta
EditorGUILayout.PropertyField(qgoal, qgoal_desc_item);
break;
case 2: //Movimentação
break;
case 3: //Derrotar
break;
default:
break;
}
serializedObject.ApplyModifiedProperties();
}
}