private static void ShowCreationContext(AudioEvent audioevent) { var menu = new GenericMenu(); foreach (EventActionTypes currentType in EnumUtil.GetValues <EventActionTypes>()) { Type newType = AudioEventWorker.ActionEnumToType(currentType); var enumType = currentType; menu.AddItem(new GUIContent(currentType.FormatedName()), false, f => AudioEventWorker.AddEventAction(audioevent, newType, enumType), currentType); } menu.ShowAsContext(); }
private static void ChangeAction(AudioEvent audioEvent, AudioEventAction action, EventActionTypes newEnumType) { for (int i = 0; i < audioEvent.ActionList.Count; ++i) { if (audioEvent.ActionList[i] == action) { Type oldType = AudioEventWorker.ActionEnumToType(action.EventActionType); Type newType = AudioEventWorker.ActionEnumToType(newEnumType); if (oldType != newType) { AudioEventWorker.ReplaceActionDestructiveAt(audioEvent, newEnumType, i); } else { action.EventActionType = newEnumType; } break; } } }