예제 #1
0
 /// <summary>
 /// Returns all allowed Timeline Item types.
 /// </summary>
 /// <returns>A list of allowed cutscene item types.</returns>
 public List <Type> GetAllowedCutsceneItems()
 {
     if (allowedItemTypes == null)
     {
         allowedItemTypes = DirectorRuntimeHelper.GetAllowedItemTypes(this);
     }
     return(allowedItemTypes);
 }
예제 #2
0
 /// <summary>
 /// Provides a list of Types this Track Group is allowed to contain. Loaded by looking at Attributes.
 /// </summary>
 /// <returns>The list of track types.</returns>
 public List <Type> GetAllowedTrackTypes()
 {
     if (allowedTrackTypes == null)
     {
         allowedTrackTypes = DirectorRuntimeHelper.GetAllowedTrackTypes(this);
     }
     return(allowedTrackTypes);
 }
예제 #3
0
        protected void OnDestroy()
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                Stop();
                if (root != null)
                {
                    Destroy(root);
                }
                return;
            }
#endif

            DirectorRuntimeHelper.DestroyRoot();
        }
        /// <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);
        }
예제 #5
0
        /// <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);
        }
예제 #6
0
        /// <summary>
        /// Returns a list of Track types that are associated with the given Track Group.
        /// </summary>
        /// <param name="trackGroup">The track group to be inspected</param>
        /// <returns>A list of track types that meet the genre criteria of the given track group.</returns>
        public static List <Type> GetAllowedTrackTypes(TrackGroup trackGroup)
        {
            // Get all the allowed Genres for this track group
            TimelineTrackGenre[] genres = new TimelineTrackGenre[0];

            foreach (TrackGroupAttribute attribute in ReflectionHelper.GetCustomAttributes <TrackGroupAttribute>(trackGroup.GetType(), true))
            {
                if (attribute != null)
                {
                    genres = attribute.AllowedTrackGenres;
                    break;
                }
            }

            List <Type> allowedTrackTypes = new List <Type>();

            foreach (Type type in DirectorRuntimeHelper.GetAllSubTypes(typeof(TimelineTrack)))
            {
                foreach (TimelineTrackAttribute attribute in ReflectionHelper.GetCustomAttributes <TimelineTrackAttribute>(type, true))
                {
                    if (attribute != null)
                    {
                        foreach (TimelineTrackGenre genre in attribute.TrackGenres)
                        {
                            foreach (TimelineTrackGenre genre2 in genres)
                            {
                                if (genre == genre2)
                                {
                                    allowedTrackTypes.Add(type);
                                    break;
                                }
                            }
                        }
                        break;
                    }
                }
            }

            return(allowedTrackTypes);
        }
예제 #7
0
        public static List <Type> GetAllowedTrackTypes(TrackGroup trackGroup)
        {
#if PROFILE_FILE
            Profiler.BeginSample("DirectorRuntimeHelper.GetAllowedTrackTypes");
#endif // PROFILE_FILE
            // Get all the allowed Genres for this track group
            var         t = trackGroup.GetType();
            List <Type> allowedTrackTypes = null;
            if (_allowedTrackTypes.TryGetValue(t, out allowedTrackTypes))
            {
#if PROFILE_FILE
                Profiler.EndSample();
#endif // PROFILE_FILE
                return(allowedTrackTypes);
            }

            TimelineTrackGenre[] genres = new TimelineTrackGenre[0];
            var list   = ReflectionHelper.GetCustomAttributes <TrackGroupAttribute>(t, true);
            var length = list.Length;
            for (var i = 0; i < length; i++)
            {
                var attribute = list[i];

                if (attribute != null)
                {
                    genres = attribute.AllowedTrackGenres;
                    break;
                }
            }

            allowedTrackTypes = new List <Type>();
            var typeList = DirectorRuntimeHelper.GetAllSubTypes(typeof(TimelineTrack));
            length = typeList.Length;
            var lengthGenres = genres.Length;
            for (var i = 0; i < length; i++)
            {
                var type    = typeList[i];
                var list2   = ReflectionHelper.GetCustomAttributes <TimelineTrackAttribute>(type, true);
                var length2 = list2.Length;
                for (var j = 0; j < length2; j++)
                {
                    var attribute = list2[j];
                    if (attribute != null)
                    {
                        var list3   = attribute.TrackGenres;
                        var length3 = list3.Length;
                        for (var k = 0; k < length3; k++)
                        {
                            for (var x = 0; x < lengthGenres; x++)
                            {
                                if (list3[k] == genres[x])
                                {
                                    allowedTrackTypes.Add(type);
                                    break;
                                }
                            }
                        }

                        break;
                    }
                }
            }

            _allowedTrackTypes[t] = allowedTrackTypes;
#if PROFILE_FILE
            Profiler.EndSample();
#endif // PROFILE_FILE

            return(allowedTrackTypes);
        }
예제 #8
0
        /// <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);
        }
예제 #9
0
        /// <summary>
        /// Returns a list of Track types that are associated with the given Track Group.
        /// </summary>
        /// <param name="trackGroup">The track group to be inspected</param>
        /// <returns>A list of track types that meet the genre criteria of the given track group.</returns>
        public static List <Type> GetAllowedTrackTypes(TrackGroup trackGroup)
        {
            // Get all the allowed Genres for this track group
            TimelineTrackGenre[] genres = new TimelineTrackGenre[0];
            MemberInfo           info   = trackGroup.GetType();
            {
                var __array1       = info.GetCustomAttributes(typeof(TrackGroupAttribute), true);
                var __arrayLength1 = __array1.Length;
                for (int __i1 = 0; __i1 < __arrayLength1; ++__i1)
                {
                    var attribute = (TrackGroupAttribute)__array1[__i1];
                    {
                        if (attribute != null)
                        {
                            genres = attribute.AllowedTrackGenres;
                            break;
                        }
                    }
                }
            }
            List <Type> allowedTrackTypes = new List <Type>();

            {
                var __array2       = DirectorRuntimeHelper.GetAllSubTypes(typeof(TimelineTrack));
                var __arrayLength2 = __array2.Length;
                for (int __i2 = 0; __i2 < __arrayLength2; ++__i2)
                {
                    var type = (Type)__array2[__i2];
                    {
                        {
                            var __array9       = type.GetCustomAttributes(typeof(TimelineTrackAttribute), true);
                            var __arrayLength9 = __array9.Length;
                            for (int __i9 = 0; __i9 < __arrayLength9; ++__i9)
                            {
                                var attribute = (TimelineTrackAttribute)__array9[__i9];
                                {
                                    if (attribute != null)
                                    {
                                        {
                                            // foreach(var genre in attribute.TrackGenres)
                                            var __enumerator15 = (attribute.TrackGenres).GetEnumerator();
                                            while (__enumerator15.MoveNext())
                                            {
                                                var genre = (TimelineTrackGenre)__enumerator15.Current;
                                                {
                                                    {
                                                        var __array18       = genres;
                                                        var __arrayLength18 = __array18.Length;
                                                        for (int __i18 = 0; __i18 < __arrayLength18; ++__i18)
                                                        {
                                                            var genre2 = (TimelineTrackGenre)__array18[__i18];
                                                            {
                                                                if (genre == genre2)
                                                                {
                                                                    allowedTrackTypes.Add(type);
                                                                    break;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(allowedTrackTypes);
        }