public void OnGui(AISAI ai) { GUILayout.BeginVertical(); CommonActionParameters(); if (parent) { showParameters = EditorGUILayout.Foldout(showParameters, "Action Parameters:"); if (showParameters) { ++EditorGUI.indentLevel; GuiParameters(); --EditorGUI.indentLevel; } showScorers = EditorGUILayout.Foldout(showScorers, "Scorers"); if (showScorers) { ++EditorGUI.indentLevel; ScorerParameters(); --EditorGUI.indentLevel; } } GUILayout.EndVertical(); }
void OnEnable() { ai = Selection.activeObject as AISAI; if (ai) { InitializeAI(); initialized = true; ult = ai; } }
void OnGUI() { horDiv = Screen.width / 5; height = Screen.height - topOffset; GUILayout.BeginVertical(); ai = (AISAI)EditorGUILayout.ObjectField("AI:", ai, typeof(AISAI), false); if (ai == null) { ai = Selection.activeObject as AISAI; GUILayout.BeginHorizontal(); newName = EditorGUILayout.TextField("Novo AI Nome: ", newName); if (GUILayout.Button("Criar AI")) { ai = CreateInstance <AISAI>(); ai.name = newName; InitializeAI(); initialized = true; Save(); } GUILayout.EndHorizontal(); } else { GUILayout.BeginHorizontal(); Variables(); Actions(); ActionEditor(); GUILayout.EndHorizontal(); if (!initialized) { InitializeAI(); initialized = true; ult = ai; } else if (ult != ai) { initialized = false; } } GUILayout.EndVertical(); }
private static AISVariable Select(string label, AISAI ai, AISVariable var, System.Type t, List <AISVariable> options) { if (options != null && options.Count != 0) { if (!ai.variables.Contains(var)) { var = ai.variables[0]; } return(options[EditorGUILayout.Popup(label + "(" + t + ")", options.IndexOf(var), options.Select(x => x.name).ToArray())]); } else { GUILayout.Label("There no Variable " + "(" + t + ")" + " and/or compatible types!"); return(null); } }
public static AISVariable VarPopUp(string label, AISAI ai, AISVariable var, System.Type t, System.Type type) { return(Select(label, ai, var, t, ai.variables.Where(x => x.GetType() == t && System.Type.GetType(x.type).Equals(type)).ToList())); }