private static bool DrawContent(AudioEvent audioevent, Rect area) { Rect selectedBackground = drawArea; selectedBackground.y += 2; DrawBackground(selectedBackground); GUI.skin.label.alignment = TextAnchor.MiddleCenter; bool repaint = false; EditorGUILayout.BeginVertical(); for (int i = 0; i < audioevent.ActionList.Count; ++i) { var currentAction = audioevent.ActionList[i]; Rect lastArea = EditorGUILayout.BeginHorizontal(GUILayout.Height(20)); if (i == 0) { Rect actionArea = lastArea; actionArea.width = 100; actionArea.height = 20; actionArea.y -= 20; EditorGUI.LabelField(actionArea, "Action", EditorStyles.boldLabel); } if (currentAction != null) { if (GUILayout.Button( Enum.GetName(typeof(EventActionTypes), (int)currentAction.EventActionType) .AddSpacesToSentence(), GUILayout.Width(110))) { ShowChangeContext(audioevent, currentAction); Event.current.Use(); } } else { EditorGUILayout.LabelField("Missing"); GUI.enabled = false; } EditorGUILayout.BeginVertical(GUILayout.Height(20)); GUILayout.Label("", GUILayout.Height(0)); //Aligns it to the center by creating a small vertical offset, by setting the height to zero if (currentAction != null && currentAction.EventActionType != EventActionTypes.StopAll) { EditorGUILayout.LabelField(currentAction.ObjectName); } EditorGUILayout.EndHorizontal(); Rect dragArea = GUILayoutUtility.GetLastRect(); if (i == 0) { Rect actionArea = dragArea; actionArea.width = 100; actionArea.height = 20; actionArea.y -= 20; EditorGUI.LabelField(actionArea, "Data", EditorStyles.boldLabel); } if (currentAction is EventAudioAction) { AudioNode dragged = OnDragging.DraggingObject <AudioNode>(dragArea, node => node.IsPlayable); if (dragged != null) { (currentAction as EventAudioAction).Node = dragged; } } else if (currentAction is EventBankAction) { AudioBankLink dragged = OnDragging.DraggingObject <AudioBankLink>(dragArea, bank => bank.Type == AudioBankTypes.Link); if (dragged != null) { (currentAction as EventBankAction).BankLink = dragged; } } else if (currentAction is EventBusAction) { AudioBus dragged = OnDragging.DraggingObject <AudioBus>(dragArea, bus => true); if (dragged != null) { (currentAction as EventBusAction).Bus = dragged; } } EditorGUILayout.Separator(); EditorGUILayout.Separator(); Rect rightArea = EditorGUILayout.BeginHorizontal(GUILayout.Width(area.width - 100)); rightArea.x -= 150; rightArea.y += 3; rightArea.width = 80; //rightARea.height -= 6; if (GUI.Button(rightArea, "Find")) { SearchHelper.SearchFor(currentAction); } rightArea.x += 90; rightArea.width = 30; if (GUI.Button(rightArea, "X")) { if (audioevent.ActionList[i] != null) { AudioEventWorker.DeleteActionAtIndex(audioevent, i); } else { audioevent.ActionList.SwapRemoveAt(i); --i; } } if (Event.current.ClickedWithin(lastArea)) { drawArea = lastArea; audioEventAction = currentAction; Event.current.Use(); } //if (audioEventAction == null || ( Event.current.type == EventType.MouseDown && lastArea.Contains(Event.current.mousePosition))) //{ // drawArea = lastArea; // audioEventAction = currentAction; //} GUILayout.Label(""); //EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal(); GUI.enabled = true; } EditorGUILayout.EndVertical(); return(repaint); }