Пример #1
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;
 }
Пример #2
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;
 }