Beispiel #1
0
    protected virtual void UpdateTracks(DirectorControlState state, Rect header, Rect content, Rect controlArea)
    {
        SortedDictionary <int, TimelineTrackWrapper> sortedDictionary = new SortedDictionary <int, TimelineTrackWrapper>();

        foreach (TimelineTrackWrapper current in timelineTrackMap.Keys)
        {
            timelineTrackMap[current].TargetTrack = current;
            sortedDictionary.Add(current.Ordinal, current);
        }
        float num = header.y + 17f;

        foreach (int current2 in sortedDictionary.Keys)
        {
            TimelineTrackWrapper timelineTrackWrapper = sortedDictionary[current2];
            TimelineTrackControl timelineTrackControl = timelineTrackMap[timelineTrackWrapper];
            timelineTrackControl.Ordinal = new []
            {
                trackGroup.Ordinal,
                current2
            };
            float height           = timelineTrackControl.Rect.height;
            Rect  rect             = new Rect(content.x, num, content.width, height);
            Rect  headerBackground = new Rect(header.x, num, header.width, height);
            Rect  rect2            = new Rect(header.x, num, header.width - sortingOptionsWidth - 4f, height);
            Rect  rect3            = new Rect(rect2.x + rect2.width, num, sortingOptionsWidth / 2f, 16f);
            Rect  arg_225_0        = new Rect(rect3.x + sortingOptionsWidth / 2f, num, sortingOptionsWidth / 2f, 16f);
            timelineTrackControl.UpdateTrackBodyBackground(rect);
            timelineTrackControl.UpdateHeaderBackground(headerBackground, current2);
            GUILayout.BeginArea(rect);
            timelineTrackControl.UpdateTrackContents(state, rect, controlArea);
            GUILayout.EndArea();
            timelineTrackControl.UpdateHeaderContents(state, rect2, headerBackground);
            GUI.enabled = (current2 > 0);
            if (GUI.Button(rect3, string.Empty, DirectorControl.DirectorControlStyles.UpArrowIcon))
            {
                TimelineTrackWrapper expr_1CE = timelineTrackWrapper;
                int ordinal = expr_1CE.Ordinal;
                expr_1CE.Ordinal = ordinal - 1;
                TimelineTrackWrapper expr_1F9 = timelineTrackMap[sortedDictionary[current2 - 1]].TargetTrack;
                ordinal          = expr_1F9.Ordinal;
                expr_1F9.Ordinal = ordinal + 1;
            }
            GUI.enabled = (current2 < sortedDictionary.Count - 1);
            if (GUI.Button(arg_225_0, string.Empty, DirectorControl.DirectorControlStyles.DownArrowIcon))
            {
                TimelineTrackWrapper expr_22E = timelineTrackWrapper;
                int ordinal = expr_22E.Ordinal;
                expr_22E.Ordinal = ordinal + 1;
                TimelineTrackWrapper expr_259 = timelineTrackMap[sortedDictionary[current2 + 1]].TargetTrack;
                ordinal          = expr_259.Ordinal;
                expr_259.Ordinal = ordinal - 1;
            }
            GUI.enabled = (true);
            num        += height;
        }
    }
Beispiel #2
0
 internal void DuplicateSelectedChildren()
 {
     foreach (TimelineTrackWrapper wrapper in this.timelineTrackMap.Keys)
     {
         TimelineTrackControl control = this.timelineTrackMap[wrapper];
         if (control.IsSelected)
         {
             control.Duplicate();
         }
     }
 }
Beispiel #3
0
 internal void DuplicateSelectedChildren()
 {
     foreach (TimelineTrackWrapper current in this.timelineTrackMap.Keys)
     {
         TimelineTrackControl timelineTrackControl = this.timelineTrackMap[current];
         if (timelineTrackControl.IsSelected)
         {
             timelineTrackControl.Duplicate();
         }
     }
 }
Beispiel #4
0
    internal List <SidebarControl> GetSidebarControlChildren(bool onlyVisible)
    {
        List <SidebarControl> list = new List <SidebarControl>();

        if (base.isExpanded)
        {
            foreach (TimelineTrackWrapper wrapper in this.timelineTrackMap.Keys)
            {
                TimelineTrackControl item = this.timelineTrackMap[wrapper];
                list.Add(item);
            }
        }
        return(list);
    }
Beispiel #5
0
    protected virtual void UpdateTracks(DirectorControlState state, Rect header, Rect content)
    {
        SortedDictionary <int, TimelineTrackWrapper> dictionary = new SortedDictionary <int, TimelineTrackWrapper>();

        foreach (TimelineTrackWrapper wrapper in this.timelineTrackMap.Keys)
        {
            this.timelineTrackMap[wrapper].TargetTrack = wrapper;
            dictionary.Add(wrapper.Ordinal, wrapper);
        }
        float num = header.y + 17f;

        foreach (int num2 in dictionary.Keys)
        {
            TimelineTrackWrapper wrapper2 = dictionary[num2];
            TimelineTrackControl control  = this.timelineTrackMap[wrapper2];
            control.Ordinal = new int[] { this.trackGroup.Ordinal, num2 };
            float num3         = control.Rect.height;
            Rect  position     = new Rect(content.x, num, content.width, num3);
            Rect  rect2        = new Rect(header.x, num, header.width, num3);
            Rect  rect3        = new Rect(header.x, num, (header.width - this.sortingOptionsWidth) - 4f, num3);
            float introduced17 = rect3.x;
            Rect  rect4        = new Rect(introduced17 + rect3.width, num, this.sortingOptionsWidth / 2f, 16f);
            control.UpdateTrackBodyBackground(position);
            control.UpdateHeaderBackground(rect2, num2);
            GUILayout.BeginArea(position);
            Rect rect5 = position;
            control.UpdateTrackContents(state, rect5);
            GUILayout.EndArea();
            control.UpdateHeaderContents(state, rect3, rect2);
            GUI.enabled = (num2 > 0);
            if (GUI.Button(rect4, string.Empty, DirectorControl.DirectorControlStyles.UpArrowIcon))
            {
                wrapper2.Ordinal--;
                TimelineTrackWrapper targetTrack = this.timelineTrackMap[dictionary[num2 - 1]].TargetTrack;
                targetTrack.Ordinal++;
            }
            GUI.enabled = (num2 < (dictionary.Count - 1));
            if (GUI.Button(new Rect(rect4.x + (this.sortingOptionsWidth / 2f), num, this.sortingOptionsWidth / 2f, 16f), string.Empty, DirectorControl.DirectorControlStyles.DownArrowIcon))
            {
                wrapper2.Ordinal++;
                TimelineTrackWrapper wrapper3 = this.timelineTrackMap[dictionary[num2 + 1]].TargetTrack;
                wrapper3.Ordinal--;
            }
            GUI.enabled = (true);
            num        += num3;
        }
    }
Beispiel #6
0
    public void OnDestroy(TrackGroupWrapper trackGroup, DirectorControlState state)
    {
        SortedDictionary <int, TimelineTrackWrapper> sortedDictionary = new SortedDictionary <int, TimelineTrackWrapper>();

        foreach (TimelineTrackWrapper current in timelineTrackMap.Keys)
        {
            timelineTrackMap[current].TargetTrack = current;
            sortedDictionary.Add(current.Ordinal, current);
        }
        foreach (int current2 in sortedDictionary.Keys)
        {
            TimelineTrackWrapper timelineTrackWrapper = sortedDictionary[current2];
            TimelineTrackControl timelineTrackControl = timelineTrackMap[timelineTrackWrapper];
            timelineTrackControl.Ordinal = new[]
            {
                trackGroup.Ordinal,
                current2
            };
        }
    }
Beispiel #7
0
 public TrackControlEventArgs(Behaviour behaviour, TimelineTrackControl control)
 {
     this.TrackBehaviour = behaviour;
     this.TrackControl   = control;
 }
Beispiel #8
0
    public void OnLoad(GUISkin skin)
    {
        this.customSkin = skin;
        string str    = "Cinema Suite/Cinema Director/";
        string str2   = ".png";
        float  min    = 0f;
        float  @float = 60f;

        if (EditorPrefs.HasKey("DirectorControl.areaX"))
        {
            min = EditorPrefs.GetFloat("DirectorControl.areaX");
        }
        if (EditorPrefs.HasKey("DirectorControl.areaWidth"))
        {
            @float = EditorPrefs.GetFloat("DirectorControl.areaWidth");
        }
        if (EditorPrefs.HasKey("DirectorControl.isSnappingEnabled"))
        {
            this.directorState.IsSnapEnabled = EditorPrefs.GetBool("DirectorControl.isSnappingEnabled");
        }
        base.SetShownHRangeInsideMargins(min, min + @float);
        if (EditorPrefs.HasKey("DirectorControl.SidebarWidth"))
        {
            this.track_header_area_width = EditorPrefs.GetFloat("DirectorControl.SidebarWidth");
        }
        if (this.playButton == null)
        {
            this.playButton = EditorGUIUtility.Load(str + "Director_PlayIcon" + str2) as Texture;
        }
        if (this.playButton == null)
        {
            Debug.Log("Play button icon missing from Resources folder.");
        }
        if (this.pauseButton == null)
        {
            this.pauseButton = EditorGUIUtility.Load(str + "Director_PauseIcon" + str2) as Texture;
        }
        if (this.pauseButton == null)
        {
            Debug.Log("Pause button missing from Resources folder.");
        }
        if (this.stopButton == null)
        {
            this.stopButton = EditorGUIUtility.Load(str + "Director_StopIcon" + str2) as Texture;
        }
        if (this.stopButton == null)
        {
            Debug.Log("Stop button icon missing from Resources folder.");
        }
        if (this.frameForwardButton == null)
        {
            this.frameForwardButton = EditorGUIUtility.Load(str + "Director_FrameForwardIcon" + str2) as Texture;
        }
        if (this.frameForwardButton == null)
        {
            Debug.Log("Director_FrameForwardIcon.png missing from Resources folder.");
        }
        if (this.frameBackwardButton == null)
        {
            this.frameBackwardButton = EditorGUIUtility.Load(str + "Director_FrameBackwardIcon" + str2) as Texture;
        }
        if (this.frameBackwardButton == null)
        {
            Debug.Log("Director_FrameBackwardIcon.png missing from Resources folder.");
        }
        if (this.scrubHead == null)
        {
            this.scrubHead = EditorGUIUtility.Load(str + "Director_Playhead" + str2) as Texture;
        }
        if (this.scrubHead == null)
        {
            Debug.Log("Director_Playhead missing from Resources folder.");
        }
        if (this.scrubDurationHead == null)
        {
            this.scrubDurationHead = EditorGUIUtility.Load(str + "Director_Duration_Playhead" + str2) as Texture;
        }
        if (this.scrubDurationHead == null)
        {
            Debug.Log("Director_Duration_Playhead missing from Resources folder.");
        }
        if (this.customSkin != null)
        {
            DirectorControlStyles.BoxSelect     = this.customSkin.FindStyle("BoxSelect");
            DirectorControlStyles.UpArrowIcon   = this.customSkin.FindStyle("UpArrowIcon");
            DirectorControlStyles.DownArrowIcon = this.customSkin.FindStyle("DownArrowIcon");
        }
        else
        {
            DirectorControlStyles.BoxSelect     = "box";
            DirectorControlStyles.UpArrowIcon   = "box";
            DirectorControlStyles.DownArrowIcon = "box";
        }
        TrackGroupControl.InitStyles(this.customSkin);
        TimelineTrackControl.InitStyles(this.customSkin);
    }
Beispiel #9
0
    public void OnLoad(GUISkin skin)
    {
        customSkin = skin;
        float num  = 0f;
        float num2 = 60f;

        if (EditorPrefs.HasKey("DirectorControl.areaX"))
        {
            num = EditorPrefs.GetFloat("DirectorControl.areaX");
        }
        if (EditorPrefs.HasKey("DirectorControl.areaWidth"))
        {
            num2 = EditorPrefs.GetFloat("DirectorControl.areaWidth");
        }
        if (EditorPrefs.HasKey("DirectorControl.isSnappingEnabled"))
        {
            directorState.IsSnapEnabled = EditorPrefs.GetBool("DirectorControl.isSnappingEnabled");
        }
        float expr_64 = num;

        SetShownHRangeInsideMargins(expr_64, expr_64 + num2);
        if (EditorPrefs.HasKey("DirectorControl.SidebarWidth"))
        {
            track_header_area_width = EditorPrefs.GetFloat("DirectorControl.SidebarWidth");
        }
        if (this.playButton == null)
        {
            this.playButton = (Resources.Load("Director_PlayIcon", typeof(Texture)) as Texture);
        }
        if (this.playButton == null)
        {
            Debug.Log("Play button icon missing from Resources folder.");
        }
        if (this.pauseButton == null)
        {
            this.pauseButton = (Resources.Load("Director_PauseIcon", typeof(Texture)) as Texture);
        }
        if (this.pauseButton == null)
        {
            Debug.Log("Pause button missing from Resources folder.");
        }
        if (this.stopButton == null)
        {
            this.stopButton = (Resources.Load("Director_StopIcon", typeof(Texture)) as Texture);
        }
        if (this.stopButton == null)
        {
            Debug.Log("Stop button icon missing from Resources folder.");
        }
        if (this.frameForwardButton == null)
        {
            this.frameForwardButton = (Resources.Load("Director_FrameForwardIcon", typeof(Texture)) as Texture);
        }
        if (this.frameForwardButton == null)
        {
            Debug.Log("Director_FrameForwardIcon.png missing from Resources folder.");
        }
        if (this.frameBackwardButton == null)
        {
            this.frameBackwardButton = (Resources.Load("Director_FrameBackwardIcon", typeof(Texture)) as Texture);
        }
        if (frameBackwardButton == null)
        {
            Debug.Log("Director_FrameBackwardIcon.png missing from Resources folder.");
        }
        if (scrubHead == null)
        {
            scrubHead = Resources.Load("Director_Playhead", typeof(Texture)) as Texture;
        }
        if (scrubHead == null)
        {
            Debug.Log("Director_Playhead missing from Resources folder.");
        }
        if (scrubDurationHead == null)
        {
            scrubDurationHead = (Resources.Load("Director_Duration_Playhead", typeof(Texture)) as Texture);
        }
        if (scrubDurationHead == null)
        {
            Debug.Log("Director_Duration_Playhead missing from Resources folder.");
        }
        DirectorControlStyles.BoxSelect     = customSkin.FindStyle("BoxSelect");
        DirectorControlStyles.UpArrowIcon   = customSkin.FindStyle("UpArrowIcon");
        DirectorControlStyles.DownArrowIcon = customSkin.FindStyle("DownArrowIcon");
        TrackGroupControl.InitStyles(customSkin);
        TimelineTrackControl.InitStyles(customSkin);
    }
Beispiel #10
0
 internal void BindTrackControls(TrackGroupWrapper trackGroup, List <SidebarControl> newSidebarControls, List <SidebarControl> removedSidebarControls, List <TrackItemControl> newTimelineControls, List <TrackItemControl> removedTimelineControls)
 {
     if (trackGroup.HasChanged)
     {
         bool flag = false;
         foreach (TimelineTrackWrapper wrapper in trackGroup.Tracks)
         {
             TimelineTrackControl control = null;
             if (!this.timelineTrackMap.TryGetValue(wrapper, out control))
             {
                 flag = true;
                 Type type = typeof(TimelineTrackControl);
                 int  num  = 0x7fffffff;
                 foreach (Type type2 in DirectorControlHelper.GetAllSubTypes(typeof(TimelineTrackControl)))
                 {
                     Type c = null;
                     foreach (CutsceneTrackAttribute attribute in type2.GetCustomAttributes(typeof(CutsceneTrackAttribute), true))
                     {
                         if (attribute != null)
                         {
                             c = attribute.TrackType;
                         }
                     }
                     if (c == wrapper.Behaviour.GetType())
                     {
                         type = type2;
                         num  = 0;
                         break;
                     }
                     if ((c != null) && wrapper.Behaviour.GetType().IsSubclassOf(c))
                     {
                         Type baseType = wrapper.Behaviour.GetType();
                         int  num4     = 0;
                         while ((baseType != null) && (baseType != c))
                         {
                             baseType = baseType.BaseType;
                             num4++;
                         }
                         if (num4 <= num)
                         {
                             num  = num4;
                             type = type2;
                         }
                     }
                 }
                 control = (TimelineTrackControl)Activator.CreateInstance(type);
                 control.Initialize();
                 control.TrackGroupControl = this;
                 control.TargetTrack       = wrapper;
                 control.SetExpandedFromEditorPrefs();
                 newSidebarControls.Add(control);
                 this.timelineTrackMap.Add(wrapper, control);
             }
         }
         List <TimelineTrackWrapper> list = new List <TimelineTrackWrapper>();
         foreach (TimelineTrackWrapper wrapper2 in this.timelineTrackMap.Keys)
         {
             bool flag2 = false;
             foreach (TimelineTrackWrapper wrapper3 in trackGroup.Tracks)
             {
                 if (wrapper2.Equals(wrapper3))
                 {
                     flag2 = true;
                     break;
                 }
             }
             if (!flag2)
             {
                 removedSidebarControls.Add(this.timelineTrackMap[wrapper2]);
                 list.Add(wrapper2);
             }
         }
         foreach (TimelineTrackWrapper wrapper4 in list)
         {
             flag = true;
             this.timelineTrackMap.Remove(wrapper4);
         }
         if (flag)
         {
             SortedDictionary <int, TimelineTrackWrapper> dictionary = new SortedDictionary <int, TimelineTrackWrapper>();
             List <TimelineTrackWrapper> list2 = new List <TimelineTrackWrapper>();
             foreach (TimelineTrackWrapper wrapper5 in this.timelineTrackMap.Keys)
             {
                 if ((wrapper5.Ordinal >= 0) && !dictionary.ContainsKey(wrapper5.Ordinal))
                 {
                     dictionary.Add(wrapper5.Ordinal, wrapper5);
                 }
                 else
                 {
                     list2.Add(wrapper5);
                 }
             }
             int num5 = 0;
             using (SortedDictionary <int, TimelineTrackWrapper> .ValueCollection.Enumerator enumerator4 = dictionary.Values.GetEnumerator())
             {
                 while (enumerator4.MoveNext())
                 {
                     enumerator4.Current.Ordinal = num5;
                     num5++;
                 }
             }
             using (List <TimelineTrackWrapper> .Enumerator enumerator3 = list2.GetEnumerator())
             {
                 while (enumerator3.MoveNext())
                 {
                     enumerator3.Current.Ordinal = num5;
                     num5++;
                 }
             }
         }
     }
     foreach (TimelineTrackWrapper wrapper6 in this.timelineTrackMap.Keys)
     {
         this.timelineTrackMap[wrapper6].BindTimelineItemControls(wrapper6, newTimelineControls, removedTimelineControls);
     }
     trackGroup.HasChanged = false;
 }
Beispiel #11
0
 internal void BindTrackControls(TrackGroupWrapper trackGroup, List <SidebarControl> newSidebarControls, List <SidebarControl> removedSidebarControls, List <TrackItemControl> newTimelineControls, List <TrackItemControl> removedTimelineControls)
 {
     if (trackGroup.HasChanged)
     {
         bool flag = false;
         foreach (TimelineTrackWrapper current in trackGroup.Tracks)
         {
             TimelineTrackControl timelineTrackControl = null;
             if (!timelineTrackMap.TryGetValue(current, out timelineTrackControl))
             {
                 flag = true;
                 Type[] arg_5F_0 = DirectorControlHelper.GetAllSubTypes(typeof(TimelineTrackControl));
                 Type   type     = typeof(TimelineTrackControl);
                 int    num      = 2147483647;
                 Type[] array    = arg_5F_0;
                 for (int i = 0; i < array.Length; i++)
                 {
                     Type     type2            = array[i];
                     Type     type3            = null;
                     object[] customAttributes = type2.GetCustomAttributes(typeof(CutsceneTrackAttribute), true);
                     for (int j = 0; j < customAttributes.Length; j++)
                     {
                         CutsceneTrackAttribute cutsceneTrackAttribute = (CutsceneTrackAttribute)customAttributes[j];
                         if (cutsceneTrackAttribute != null)
                         {
                             type3 = cutsceneTrackAttribute.TrackType;
                         }
                     }
                     if (type3 == current.Behaviour.GetType())
                     {
                         type = type2;
                         break;
                     }
                     if (type3 != null && current.Behaviour.GetType().IsSubclassOf(type3))
                     {
                         Type type4 = current.Behaviour.GetType();
                         int  num2  = 0;
                         while (type4 != null && type4 != type3)
                         {
                             type4 = type4.BaseType;
                             num2++;
                         }
                         if (num2 <= num)
                         {
                             num  = num2;
                             type = type2;
                         }
                     }
                 }
                 timelineTrackControl = (TimelineTrackControl)Activator.CreateInstance(type);
                 timelineTrackControl.Initialize();
                 timelineTrackControl.TrackGroupControl = this;
                 timelineTrackControl.TargetTrack       = current;
                 timelineTrackControl.SetExpandedFromEditorPrefs();
                 newSidebarControls.Add(timelineTrackControl);
                 timelineTrackMap.Add(current, timelineTrackControl);
             }
         }
         List <TimelineTrackWrapper> list = new List <TimelineTrackWrapper>();
         foreach (TimelineTrackWrapper current2 in this.timelineTrackMap.Keys)
         {
             bool flag2 = false;
             foreach (TimelineTrackWrapper current3 in trackGroup.Tracks)
             {
                 if (current2.Equals(current3))
                 {
                     flag2 = true;
                     break;
                 }
             }
             if (!flag2)
             {
                 removedSidebarControls.Add(timelineTrackMap[current2]);
                 list.Add(current2);
             }
         }
         foreach (TimelineTrackWrapper current4 in list)
         {
             flag = true;
             this.timelineTrackMap.Remove(current4);
         }
         if (flag)
         {
             SortedDictionary <int, TimelineTrackWrapper> sortedDictionary = new SortedDictionary <int, TimelineTrackWrapper>();
             List <TimelineTrackWrapper> list2 = new List <TimelineTrackWrapper>();
             foreach (TimelineTrackWrapper current5 in timelineTrackMap.Keys)
             {
                 if (current5.Ordinal >= 0 && !sortedDictionary.ContainsKey(current5.Ordinal))
                 {
                     sortedDictionary.Add(current5.Ordinal, current5);
                 }
                 else
                 {
                     list2.Add(current5);
                 }
             }
             int num3 = 0;
             using (SortedDictionary <int, TimelineTrackWrapper> .ValueCollection.Enumerator enumerator4 = sortedDictionary.Values.GetEnumerator())
             {
                 while (enumerator4.MoveNext())
                 {
                     enumerator4.Current.Ordinal = num3;
                     num3++;
                 }
             }
             using (List <TimelineTrackWrapper> .Enumerator enumerator3 = list2.GetEnumerator())
             {
                 while (enumerator3.MoveNext())
                 {
                     enumerator3.Current.Ordinal = num3;
                     num3++;
                 }
             }
         }
     }
     foreach (TimelineTrackWrapper current6 in timelineTrackMap.Keys)
     {
         timelineTrackMap[current6].BindTimelineItemControls(current6, newTimelineControls, removedTimelineControls);
     }
     trackGroup.HasChanged = false;
 }