private static void ShowCreationContext(InAudioEventNode audioevent) { var menu = new GenericMenu(); List <EventActionExtension.ActionMeta> actionList = EventActionExtension.GetList(); foreach (EventActionExtension.ActionMeta currentType in actionList) { Type newType = AudioEventAction.ActionEnumToType(currentType.ActionType); var enumType = currentType.ActionType; menu.AddItem(new GUIContent(currentType.Name), false, f => AudioEventWorker.AddEventAction(audioevent, newType, enumType), currentType); } menu.ShowAsContext(); }
private static void ShowChangeContext(InAudioEventNode audioEvent, AudioEventAction action) { var menu = new GenericMenu(); List <EventActionExtension.ActionMeta> actionList = EventActionExtension.GetList(); foreach (EventActionExtension.ActionMeta currentType in actionList) { var enumType = currentType.ActionType; menu.AddItem( new GUIContent(currentType.Name), false, f => ChangeAction(audioEvent, action, enumType), currentType.ActionType ); } menu.ShowAsContext(); }
private static void DrawItem(Rect position, int i) { var item = lastEvent._actionList[i]; leftStyle.alignment = TextAnchor.MiddleLeft; if (item == audioEventAction) { DrawBackground(position); } Rect fullArea = position; Rect typePos = position; typePos.width = 110; if (item != null) { if (GUI.Button(typePos, EventActionExtension.GetList().Find(p => p.Value == (int)item._eventActionType).Name)) { ShowChangeContext(lastEvent, item); Event.current.UseEvent(); } } else { GUI.Label(position, "Missing data", leftStyle); } typePos.x += 130; if (item != null && item._eventActionType != EventActionTypes.StopAll && item._eventActionType != EventActionTypes.StopAllMusic) { Rect area = typePos; area.width = position.width - 200; GUI.Label(area, item.ObjectName); } HandleDragging(item, typePos); position.x = position.x + position.width - 75; position.width = 45; if (item != null && item._eventActionType != EventActionTypes.StopAll && item._eventActionType != EventActionTypes.StopAllMusic) { if (GUI.Button(position, "Find")) { SearchHelper.SearchForActionTarget(item); } } position.x += 50; position.width = 20; if (audioEventAction == item) { DrawBackground(position); } if (GUI.Button(position, "X")) { toRemove = item; } if (Event.current.ClickedWithin(fullArea)) { audioEventAction = item; Event.current.UseEvent(); } }