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); }
public void DrawDirectoryTreeElement(bool mouseUp, Vector2 mousePos, bool isShown = true, bool isBase = true) { this.isShown = isShown; if (isShown) { if (!isBase) { GUIUtils.BeginIndent(); } EditorGUILayout.BeginHorizontal(); bool hasChildren = directoryChildIDs.Count > 0; GUI.enabled = hasChildren; showChildren = GUIUtils.SmallToggleButton(new GUIContent("", "Show Children"), showChildren, out _); GUI.enabled = true; Rect rect = BuildGUIRectAndCalculateMousePos(mousePos); bool dropReceived, beingDragged; baseSystem.dragDropHandler.ElementDragDropValues(this, mousePos, mouseUp, out beingDragged, out receiverHovered, out dropReceived); bool drawSelected = receiverHovered || elementID == baseSystem.currentShownDirectoryID; bool guiEnabled = !dropReceived; bool drawBackground = false; DrawButtonBase(rect, drawSelected, drawBackground, guiEnabled, Colors.liteGray, FontStyle.Normal); EditorGUILayout.EndHorizontal(); if (hasChildren) { foreach (var child in directoryChildIDs) { baseSystem.GetDirectoryTreeElement(child).DrawDirectoryTreeElement(mouseUp, mousePos, showChildren && isShown, false); } } if (!isBase) { GUIUtils.EndIndent(); } } }
public void OnGUI() { multiSetParameterIndex = -1; if (CloseIfError()) { Close(); return; } GUIUtils.StartBox(1); if (!selectionSystem.hasSelection) { GUIUtils.Label(noAOsGUI); } else { bool drawingSingle = selectionSystem.singleSelected; SelectionElement firstSelected = selectionSystem.firstSelected; EditorProp assetObjectProp = drawingSingle ? AOStateMachineEditor.GetAOatPoolID(currentState, firstSelected.refIndex) : multiEditAssetObjectProp; if (assetObjectProp == null) { GUIUtils.Label(noAOsGUI); } else { // GUIUtils.Label(drawingSingle ? new GUIContent("<b>" + firstSelected.path + "</b>") : selectEditGUI); GUIUtils.Label(drawingSingle ? new GUIContent("<b>" + firstSelected.gui.text + "</b>") : selectEditGUI); GUILayout.FlexibleSpace(); GUIUtils.BeginIndent(); DrawAOParameters(drawingSingle, assetObjectProp); GUIUtils.EndIndent(); GUILayout.FlexibleSpace(); bool setMessages = DrawMessaging(AOStateMachineEditor.messageBlocksField, sendMessagesGUI, assetObjectProp, drawingSingle); bool setConditions = DrawMessaging(AOStateMachineEditor.conditionsBlockField, conditionsGUI, assetObjectProp, drawingSingle); if (!drawingSingle) { if (multiSetParameterIndex != -1) { CopyParameters( selectionSystem.GetReferenceIndiciesInSelectionOrAllShown(false).Generate(i => AOStateMachineEditor.GetAOatPoolID(currentState, i)), multiEditAssetObjectProp, multiSetParameterIndex ); } if (setMessages || setConditions) { CopyTextBlock( selectionSystem.GetReferenceIndiciesInSelectionOrAllShown(false).Generate(i => AOStateMachineEditor.GetAOatPoolID(currentState, i)), multiEditAssetObjectProp, setMessages ? AOStateMachineEditor.messageBlocksField : AOStateMachineEditor.conditionsBlockField ); } } } } GUILayout.FlexibleSpace(); if (GUIUtils.Button(closeGUI, GUIStyles.button, Colors.blue, Colors.black)) { Close(); } GUIUtils.EndBox(1); stateMachineEditor.so.SaveObject(); }