Ejemplo n.º 1
0
    /// <summary>
    /// Create and show a context menu for adding new Timeline Tracks.
    /// </summary>
    protected override void addTrackContext()
    {
        TrackGroup trackGroup = TrackGroup.Behaviour as TrackGroup;

        if (trackGroup != null)
        {
            // Get the possible tracks that this group can contain.
            List <Type> trackTypes = trackGroup.GetAllowedTrackTypes();

            GenericMenu createMenu = new GenericMenu();

            createMenu.AddItem(new GUIContent(string.Format("Add {0}", "Sub-Group")), false, addSubGroup, new TrackContextData("Sub-Group", trackGroup.GetType(), trackGroup));
            // Get the attributes of each track.
            foreach (Type t in trackTypes)
            {
                MemberInfo info  = t;
                string     label = string.Empty;
                foreach (TimelineTrackAttribute attribute in info.GetCustomAttributes(typeof(TimelineTrackAttribute), true))
                {
                    label = attribute.Label;
                    break;
                }

                createMenu.AddItem(new GUIContent(string.Format("Add {0}", label)), false, addTrack, new TrackContextData(label, t, trackGroup));
            }

            createMenu.ShowAsContext();
        }
    }
Ejemplo n.º 2
0
        public static void ShowAddTrackContextMenu(TrackGroup trackGroup)
        {
            List <Type> trackTypes = trackGroup.GetAllowedTrackTypes();

            GenericMenu createMenu = new GenericMenu();

            {
                var __list2      = trackTypes;
                var __listCount2 = __list2.Count;
                for (int __i2 = 0; __i2 < __listCount2; ++__i2)
                {
                    var t = (Type)__list2[__i2];
                    {
                        MemberInfo info  = t;
                        string     label = string.Empty;
                        {
                            var __array4       = info.GetCustomAttributes(typeof(TimelineTrackAttribute), true);
                            var __arrayLength4 = __array4.Length;
                            for (int __i4 = 0; __i4 < __arrayLength4; ++__i4)
                            {
                                var attribute = (TimelineTrackAttribute)__array4[__i4];
                                {
                                    label = attribute.Label;
                                    break;
                                }
                            }
                        }
                        createMenu.AddItem(new GUIContent(string.Format("Add {0}", label)), false, addTrack, new TrackContextData(label, t, trackGroup));
                    }
                }
            }
            createMenu.ShowAsContext();
        }
Ejemplo n.º 3
0
        public static void ShowAddTrackContextMenu(TrackGroup trackGroup)
        {
            List <Type> trackTypes = trackGroup.GetAllowedTrackTypes();

            GenericMenu createMenu = new GenericMenu();

            // Get the attributes of each track.
            foreach (Type t in trackTypes)
            {
                MemberInfo info  = t;
                string     label = string.Empty;
                foreach (TimelineTrackAttribute attribute in info.GetCustomAttributes(typeof(TimelineTrackAttribute), true))
                {
                    label = attribute.Label;
                    break;
                }

                createMenu.AddItem(new GUIContent(string.Format("Add {0}", label)), false, addTrack, new TrackContextData(label, t, trackGroup));
            }

            createMenu.ShowAsContext();
        }
Ejemplo n.º 4
0
    /// <summary>
    /// Create and show a context menu for adding new Timeline Tracks.
    /// </summary>
    protected override void addTrackContext()
    {
        TrackGroup trackGroup = TrackGroup.Behaviour as TrackGroup;

        if (trackGroup != null)
        {
            // Get the possible tracks that this group can contain.
            List <Type> trackTypes = trackGroup.GetAllowedTrackTypes();

            GenericMenu createMenu = new GenericMenu();
            {
                var __list1      = trackTypes;
                var __listCount1 = __list1.Count;
                for (int __i1 = 0; __i1 < __listCount1; ++__i1)
                {
                    var t = (Type)__list1[__i1];
                    {
                        MemberInfo info  = t;
                        string     label = string.Empty;
                        {
                            var __array2       = info.GetCustomAttributes(typeof(TimelineTrackAttribute), true);
                            var __arrayLength2 = __array2.Length;
                            for (int __i2 = 0; __i2 < __arrayLength2; ++__i2)
                            {
                                var attribute = (TimelineTrackAttribute)__array2[__i2];
                                {
                                    label = attribute.Label;
                                    break;
                                }
                            }
                        }
                        createMenu.AddItem(new GUIContent(string.Format("Add {0}", label)), false, addTrack, new TrackContextData(label, t, trackGroup));
                    }
                }
            }
            createMenu.ShowAsContext();
        }
    }