void DrawMainElementsList(Vector2 mousePos, bool mouseUp, out bool searchChanged) { EditorGUILayout.BeginVertical(); DrawTopToolbar(mousePos, mouseUp, out searchChanged); GUIUtils.Space(); int l = mainElements.Length; if (l == 0) { GUIUtils.HelpBox("No Elements!", MessageType.Info); } else { for (int i = 0; i < l; i++) { mainElements[i].Draw(mousePos, mouseUp, dragDropHandler, selectionHandler.trackedRange); } } EditorGUILayout.EndVertical(); }
void DrawHelpBox(EditorProp variable, Func <string, bool> validCheck, Func <string> errorMsg) { if (validCheck(variable.stringValue)) { return; } GUIUtils.HelpBox(errorMsg(), MessageType.Error); GUIUtils.Space(); }
public static void DrawPacksErrors(string errors) { if (errors.IsEmpty()) { return; } GUIUtils.StartBox(); GUIUtils.HelpBox(errors, MessageType.Error); GUIUtils.EndBox(); }
bool DrawPackParameters(EditorProp parameters) { bool anyChange = false; GUIUtils.StartBox(); GUIUtils.Label(new GUIContent("<b>Asset Object Default Parameters:</b>")); GUIUtils.StartBox(Colors.darkGray); string dupName; if (parameters.ContainsDuplicateNames(out dupName)) { GUIUtils.HelpBox(string.Format("\nMultiple parameters named:\n\t<i>'{0}'</i>\n", dupName), MessageType.Error); } GUIUtils.StartBox(1); int deleteParamIndex = -1; for (int i = 0; i < parameters.arraySize; i++) { UnityEngine.GUI.enabled = i != 0; EditorGUILayout.BeginHorizontal(); if (GUIUtils.SmallDeleteButton()) { deleteParamIndex = i; } if (DrawPackParameter(parameters[i])) { anyChange = true; } EditorGUILayout.EndHorizontal(); UnityEngine.GUI.enabled = true; } if (deleteParamIndex >= 0) { parameters.DeleteAt(deleteParamIndex, "manual parameter delete"); anyChange = true; } GUIUtils.BeginIndent(); if (GUIUtils.Button(new GUIContent("Add Parameter"), GUIStyles.miniButton, Colors.green, Colors.black, true)) { parameters.AddNew("New Parameter"); anyChange = true; } GUIUtils.EndIndent(); GUIUtils.EndBox(1); GUIUtils.EndBox(); GUIUtils.EndBox(); return(anyChange); }