/// <summary> /// Returns a list of Cutscene Item types that are associated with the given Track. /// </summary> /// <param name="timelineTrack">The track to look up.</param> /// <returns>A list of valid cutscene item types.</returns> public static List <Type> GetAllowedItemTypes(TimelineTrack timelineTrack) { // Get all the allowed Genres for this track group CutsceneItemGenre[] genres = new CutsceneItemGenre[0]; TimelineTrackAttribute[] tta = ReflectionHelper.GetCustomAttributes <TimelineTrackAttribute>(timelineTrack.GetType(), true); for (int i = 0; i < tta.Length; i++) { if (tta[i] != null) { genres = tta[i].AllowedItemGenres; break; } } Type[] subTypes = DirectorRuntimeHelper.GetAllSubTypes(typeof(TimelineItem)); List <Type> allowedTrackTypes = new List <Type>(); for (int i = 0; i < subTypes.Length; i++) { CutsceneItemAttribute[] customAttributes = ReflectionHelper.GetCustomAttributes <CutsceneItemAttribute>(subTypes[i], true); for (int j = 0; j < customAttributes.Length; j++) { if (customAttributes[j] != null) { for (int k = 0; k < customAttributes[j].Genres.Length; k++) { CutsceneItemGenre genre = customAttributes[j].Genres[k]; for (int l = 0; l < genres.Length; l++) { if (genre == genres[l]) { allowedTrackTypes.Add(subTypes[i]); break; } } } break; } } } return(allowedTrackTypes); }
/// <summary> /// Returns a list of Cutscene Item types that are associated with the given Track. /// </summary> /// <param name="timelineTrack">The track to look up.</param> /// <returns>A list of valid cutscene item types.</returns> public static List <Type> GetAllowedItemTypes(TimelineTrack timelineTrack) { // Get all the allowed Genres for this track CutsceneItemGenre[] genres = new CutsceneItemGenre[0]; MemberInfo info = timelineTrack.GetType(); foreach (TimelineTrackAttribute attribute in info.GetCustomAttributes(typeof(TimelineTrackAttribute), true)) { if (attribute != null) { genres = attribute.AllowedItemGenres; break; } } List <Type> allowedItemTypes = new List <Type>(); foreach (Type type in DirectorRuntimeHelper.GetAllSubTypes(typeof(TimelineItem))) { foreach (CutsceneItemAttribute attribute in type.GetCustomAttributes(typeof(CutsceneItemAttribute), true)) { if (attribute != null) { foreach (CutsceneItemGenre genre in attribute.Genres) { foreach (CutsceneItemGenre genre2 in genres) { if (genre == genre2) { allowedItemTypes.Add(type); break; } } } break; } } } return(allowedItemTypes); }
/// <summary> /// Returns a list of Cutscene Item types that are associated with the given Track. /// </summary> /// <param name="timelineTrack">The track to look up.</param> /// <returns>A list of valid cutscene item types.</returns> public static List<Type> GetAllowedItemTypes(TimelineTrack timelineTrack) { // Get all the allowed Genres for this track CutsceneItemGenre[] genres = new CutsceneItemGenre[0]; MemberInfo info = timelineTrack.GetType(); foreach (TimelineTrackAttribute attribute in info.GetCustomAttributes(typeof(TimelineTrackAttribute), true)) { if (attribute != null) { genres = attribute.AllowedItemGenres; break; } } List<Type> allowedItemTypes = new List<Type>(); foreach (Type type in DirectorRuntimeHelper.GetAllSubTypes(typeof(TimelineItem))) { foreach (CutsceneItemAttribute attribute in type.GetCustomAttributes(typeof(CutsceneItemAttribute), true)) { if (attribute != null) { foreach (CutsceneItemGenre genre in attribute.Genres) { foreach (CutsceneItemGenre genre2 in genres) { if (genre == genre2) { allowedItemTypes.Add(type); break; } } } break; } } } return allowedItemTypes; }
/// <summary> /// Returns a list of Cutscene Item types that are associated with the given Track. /// </summary> /// <param name="timelineTrack">The track to look up.</param> /// <returns>A list of valid cutscene item types.</returns> public static List <Type> GetAllowedItemTypes(TimelineTrack timelineTrack) { var timelineTrackType = timelineTrack.GetType(); List <Type> allowedItemTypes; if (_DicAllowedItemTypes.TryGetValue(timelineTrackType, out allowedItemTypes)) { return(allowedItemTypes); } #if BakeReflection // Get all the allowed Genres for this track group CutsceneItemGenre[] genres = new CutsceneItemGenre[0]; TimelineTrackAttribute[] tta = ReflectionHelper.GetCustomAttributes <TimelineTrackAttribute>(timelineTrackType, true); for (int i = 0; i < tta.Length; i++) { if (tta[i] != null) { genres = tta[i].AllowedItemGenres; break; } } Type[] subTypes = GetAllSubTypes(typeof(TimelineItem)); allowedItemTypes = new List <Type>(); for (int i = 0; i < subTypes.Length; i++) { CutsceneItemAttribute[] customAttributes; var subType = subTypes[i]; List <CutsceneItemAttribute> cache = null; if (_CacheCIAttribute.TryGetValue(subType, out cache)) { customAttributes = cache.ToArray(); } else { customAttributes = ReflectionHelper.GetCustomAttributes <CutsceneItemAttribute>(subType, true); _CacheCIAttribute.Add(subType, new List <CutsceneItemAttribute>(customAttributes)); } for (int j = 0; j < customAttributes.Length; j++) { if (customAttributes[j] != null) { for (int k = 0; k < customAttributes[j].Genres.Length; k++) { CutsceneItemGenre genre = customAttributes[j].Genres[k]; for (int l = 0; l < genres.Length; l++) { if (genre == genres[l]) { allowedItemTypes.Add(subType); break; } } } break; } } } _DicAllowedItemTypes.Add(timelineTrackType, allowedItemTypes); #endif return(allowedItemTypes); }
/// <summary> /// Returns a list of Cutscene Item types that are associated with the given Track. /// </summary> /// <param name="timelineTrack">The track to look up.</param> /// <returns>A list of valid cutscene item types.</returns> public static List <Type> GetAllowedItemTypes(TimelineTrack timelineTrack) { #if PROFILE_FILE Profiler.BeginSample("DirectorRuntimeHelper.GetAllowedItemTypes"); #endif // PROFILE_FILE // Get all the allowed Genres for this track var t = timelineTrack.GetType(); List <Type> allowedItemTypes = null; if (_allowedItemTypes.TryGetValue(t, out allowedItemTypes)) { #if PROFILE_FILE Profiler.EndSample(); #endif // PROFILE_FILE return(allowedItemTypes); } CutsceneItemGenre[] genres = new CutsceneItemGenre[0]; var list = ReflectionHelper.GetCustomAttributes <TimelineTrackAttribute>(t, true); var length = list.Length; for (var i = 0; i < length; i++) { var attribute = list[i]; if (attribute != null) { genres = attribute.AllowedItemGenres; break; } } allowedItemTypes = new List <Type>(); var typeList = DirectorRuntimeHelper.GetAllSubTypes(typeof(TimelineItem)); length = typeList.Length; var lengthGenres = genres.Length; for (var i = 0; i < length; i++) { var type = typeList[i]; var list2 = ReflectionHelper.GetCustomAttributes <CutsceneItemAttribute>(type, true); var length2 = list2.Length; for (var j = 0; j < length2; j++) { var attribute = list2[j]; if (attribute != null) { var list3 = attribute.Genres; var length3 = list3.Length; for (var k = 0; k < length3; k++) { for (var x = 0; x < lengthGenres; x++) { if (list3[k] == genres[x]) { allowedItemTypes.Add(type); break; } } } break; } } } #if PROFILE_FILE Profiler.EndSample(); #endif // PROFILE_FILE _allowedItemTypes[t] = allowedItemTypes; return(allowedItemTypes); }
/// <summary> /// Returns a list of Cutscene Item types that are associated with the given Track. /// </summary> /// <param name="timelineTrack">The track to look up.</param> /// <returns>A list of valid cutscene item types.</returns> public static List <Type> GetAllowedItemTypes(TimelineTrack timelineTrack) { // Get all the allowed Genres for this track CutsceneItemGenre[] genres = new CutsceneItemGenre[0]; MemberInfo info = timelineTrack.GetType(); { var __array3 = info.GetCustomAttributes(typeof(TimelineTrackAttribute), true); var __arrayLength3 = __array3.Length; for (int __i3 = 0; __i3 < __arrayLength3; ++__i3) { var attribute = (TimelineTrackAttribute)__array3[__i3]; { if (attribute != null) { genres = attribute.AllowedItemGenres; break; } } } } List <Type> allowedItemTypes = new List <Type>(); { var __array4 = DirectorRuntimeHelper.GetAllSubTypes(typeof(TimelineItem)); var __arrayLength4 = __array4.Length; for (int __i4 = 0; __i4 < __arrayLength4; ++__i4) { var type = (Type)__array4[__i4]; { { var __array12 = type.GetCustomAttributes(typeof(CutsceneItemAttribute), true); var __arrayLength12 = __array12.Length; for (int __i12 = 0; __i12 < __arrayLength12; ++__i12) { var attribute = (CutsceneItemAttribute)__array12[__i12]; { if (attribute != null) { { // foreach(var genre in attribute.Genres) var __enumerator17 = (attribute.Genres).GetEnumerator(); while (__enumerator17.MoveNext()) { var genre = (CutsceneItemGenre)__enumerator17.Current; { { var __array19 = genres; var __arrayLength19 = __array19.Length; for (int __i19 = 0; __i19 < __arrayLength19; ++__i19) { var genre2 = (CutsceneItemGenre)__array19[__i19]; { if (genre == genre2) { allowedItemTypes.Add(type); break; } } } } } } } break; } } } } } } } return(allowedItemTypes); }