// Decompiled with JetBrains decompiler
// Type: UnityEditor.Timeline.TimelineWindow
// Assembly: UnityEditor.Timeline, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 41FDA4D9-ECBE-4515-81B0-7D37CAD3F950
// Assembly location: E:\2WorkSoft\Unity2018.2\2018.2.3f1\mainfile\Unity\Editor\Data\UnityExtensions\Unity\Timeline\Editor\UnityEditor.Timeline.dll
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.IMGUI.Controls;
using UnityEditor.ProjectWindowCallback;
using UnityEngine;
using UnityEngine.Animations;
using UnityEngine.Events;
using UnityEngine.Playables;
using UnityEngine.SceneManagement;
using UnityEngine.Timeline;
namespace UnityEditor.Timeline
{
[EditorWindowTitle(title = "Timeline", useTypeNameAsIconName = true)]
internal class TimelineWindow : EditorWindow, IHasCustomMenu
{
private static readonly GUIContent[] k_EditModes = new GUIContent[3];
[SerializeField]
private TimelineWindow.TimelineWindowPreferences m_Preferences;
[SerializeField]
private EditorGUIUtility.EditorLockTracker m_LockTracker;
private readonly PreviewResizer m_PreviewResizer;
private bool m_LastFrameHadSequence;
private int m_CurrentSceneHashCode;
[NonSerialized]
private bool m_HasBeenInitialized;
[SerializeField]
private SequenceHierarchy m_SequenceHierarchy;
private const float k_SelectorWidth = 32f;
private const float k_CogButtonWidth = 32f;
private const float k_CogButtonPadding = 16f;
private TimeAreaItem m_TimelineDuration;
[SerializeField]
private float m_HierarchySplitterPerc;
[SerializeField]
private SequencerModeType m_CurrentMode;
private static TimelineMode s_ActiveMode;
private static TimelineMode s_InactiveMode;
private static TimelineMode s_EditAssetMode;
private Vector2 m_HierachySplitterMinMax;
private int m_SplitterCaptured;
private Rect m_SplitterLineRect;
private const float k_ScrollBarHeight = 10f;
private const float k_MinTimeCodeWidth = 28f;
private const float k_RefTimeWidth = 50f;
private static readonly GUIContent[] k_TimeReferenceGUIContents;
private readonly Control m_PreTreeViewControl;
private readonly Control m_PostTreeViewControl;
private readonly RectangleSelect m_RectangleSelect;
private readonly RectangleZoom m_RectangleZoom;
private TimelineWindow.PlayableLookup m_PlayableLookup;
private TimeAreaItem m_PlayRangeEnd;
private TimeAreaItem m_PlayRangeStart;
[SerializeField]
private SequencePath m_SequencePath;
[NonSerialized]
private TimelineWindow.TimelineTimeArea m_TimeArea;
private static readonly float k_MaxTimeAreaScaling;
private float m_LastFrameRate;
private bool m_TimeAreaDirty;
private TimeAreaItem m_PlayHead;
private const float k_TracksYPosition = 42f;
private const float k_CreateButtonWidth = 70f;
public TimelineWindow.TimelineWindowPreferences preferences
{
get
{
return this.m_Preferences;
}
}
public static TimelineWindow instance { get; private set; }
public Rect clientArea { get; set; }
public bool isDragging { get; set; }
public static DirectorStyles styles
{
get
{
return DirectorStyles.Instance;
}
}
public List<TimelineTrackBaseGUI> allTracks
{
get
{
return this.treeView == null ? new List<TimelineTrackBaseGUI>() : this.treeView.allTrackGuis;
}
}
public WindowState state { get; private set; }
public bool locked
{
get
{
if (Object.op_Equality((Object) this.state.editSequence.asset, (Object) null))
return false;
return this.m_LockTracker.get_isLocked();
}
set
{
this.m_LockTracker.set_isLocked(value);
}
}
public bool hierarchyChangedThisFrame { get; private set; }
private float breadCrumbAreaWidth
{
get
{
Rect timeAreaRect = this.state.timeAreaRect;
return (float) ((double) ((Rect) @timeAreaRect).get_width() - 32.0 - 32.0 - 16.0);
}
}
private TimelineMode currentMode
{
get
{
switch (this.m_CurrentMode)
{
case SequencerModeType.Active:
return TimelineWindow.s_ActiveMode ?? (TimelineWindow.s_ActiveMode = (TimelineMode) new TimelineActiveMode());
case SequencerModeType.EditAsset:
return TimelineWindow.s_EditAssetMode ?? (TimelineWindow.s_EditAssetMode = (TimelineMode) new TimelineAssetEditionMode());
default:
return TimelineWindow.s_InactiveMode ?? (TimelineWindow.s_InactiveMode = (TimelineMode) new TimelineInactiveMode());
}
}
}
public Rect sequenceHeaderBounds
{
get
{
double num1 = 0.0;
Rect timeAreaRect = this.state.timeAreaRect;
double num2 = (double) ((Rect) @timeAreaRect).get_yMax();
double num3 = (double) this.state.sequencerHeaderWidth;
Rect position = this.get_position();
double num4 = (double) ((Rect) @position).get_yMax() - 10.0;
return Rect.MinMaxRect((float) num1, (float) num2, (float) num3, (float) num4);
}
}
public Rect clipArea
{
get
{
Rect treeviewBounds = this.treeviewBounds;
Rect& local1 = @treeviewBounds;
double num1 = (double) ((Rect) local1).get_xMin() + (double) this.state.sequencerHeaderWidth;
((Rect) local1).set_xMin((float) num1);
Rect& local2 = @treeviewBounds;
double num2 = (double) ((Rect) local2).get_xMax() - (double) this.verticalScrollbarWidth;
((Rect) local2).set_xMax((float) num2);
return treeviewBounds;
}
}
public float verticalScrollbarWidth
{
get
{
if (this.treeView != null && this.treeView.showingVerticalScrollBar)
return GUI.get_skin().get_verticalScrollbar().get_fixedWidth() + (float) GUI.get_skin().get_verticalScrollbar().get_margin().get_left();
return 0.0f;
}
}
public TimeArea timeArea
{
get
{
return (TimeArea) this.m_TimeArea;
}
}
public Rect tracksBounds
{
get
{
Rect timeAreaRect = this.state.timeAreaRect;
double num1 = (double) ((Rect) @timeAreaRect).get_xMin();
double num2 = (double) ((Rect) @timeAreaRect).get_yMax();
double num3 = (double) ((Rect) @timeAreaRect).get_xMax();
double num4 = (double) ((Rect) @timeAreaRect).get_yMax();
Rect position = this.get_position();
double num5 = (double) ((Rect) @position).get_height();
double num6 = num4 + num5;
return Rect.MinMaxRect((float) num1, (float) num2, (float) num3, (float) num6);
}
}
public Rect treeviewBounds
{
get
{
double num1 = 0.0;
double num2 = 42.0;
Rect position = this.get_position();
double num3 = (double) ((Rect) @position).get_width();
Rect clientArea = this.clientArea;
double num4 = (double) ((Rect) @clientArea).get_height() - 42.0 - 15.0;
return new Rect((float) num1, (float) num2, (float) num3, (float) num4);
}
}
public TimelineTreeViewGUI treeView { get; private set; }
static TimelineWindow()
{
GUIContent[] guiContentArray = new GUIContent[2];
int index1 = 0;
GUIContent guiContent1 = EditorGUIUtility.TrTextContent("Local", "Display time based on the current timeline.", (Texture) null);
guiContentArray[index1] = guiContent1;
int index2 = 1;
GUIContent guiContent2 = EditorGUIUtility.TrTextContent("Global", "Display time based on the master timeline.", (Texture) null);
guiContentArray[index2] = guiContent2;
TimelineWindow.k_TimeReferenceGUIContents = guiContentArray;
TimelineWindow.k_MaxTimeAreaScaling = 90000f;
}
public TimelineWindow()
{
base.\u002Ector();
this.InitializeManipulators();
// ISSUE: method pointer
((UnityEvent<bool>) this.m_LockTracker.lockStateChanged).AddPersistentListener(new UnityAction<bool>((object) this, __methodptr(OnLockStateChanged)), (UnityEventCallState) 1);
}
private void OnLockStateChanged(bool locked)
{
if (locked)
return;
this.RefreshSelection(true);
}
private void OnEnable()
{
if (this.m_SequencePath == null)
this.m_SequencePath = new SequencePath();
if (Object.op_Equality((Object) this.m_SequenceHierarchy, (Object) null))
this.m_SequenceHierarchy = SequenceHierarchy.CreateInstance();
this.set_titleContent(this.GetLocalizedTitleContent());
this.m_PreviewResizer.Init("TimelineWindow");
if (Object.op_Equality((Object) TimelineWindow.instance, (Object) null))
TimelineWindow.instance = this;
AnimationClipCurveCache.Instance.OnEnable();
TrackAsset.add_OnPlayableCreate(new Action<TimelineClip, GameObject, Playable>(this.m_PlayableLookup.UpdatePlayableLookup));
if (this.currentMode == null)
this.EnableInactiveMode();
if (this.state != null)
return;
this.state = new WindowState(this, this.m_SequenceHierarchy);
this.Initialize();
this.RefreshSelection(true);
}
private void OnDisable()
{
if (Object.op_Equality((Object) TimelineWindow.instance, (Object) this))
TimelineWindow.instance = (TimelineWindow) null;
if (this.state != null)
this.state.Reset();
if (Object.op_Equality((Object) TimelineWindow.instance, (Object) null))
SelectionManager.RemoveTimelineSelection();
AnimationClipCurveCache.Instance.OnDisable();
TrackAsset.remove_OnPlayableCreate(new Action<TimelineClip, GameObject, Playable>(this.m_PlayableLookup.UpdatePlayableLookup));
TimelineWindowViewPrefs.SaveAll();
TimelineWindowViewPrefs.UnloadAllViewModels();
}
private void OnDestroy()
{
if (this.state != null)
this.state.OnDestroy();
this.m_HasBeenInitialized = false;
this.RemoveEditorCallbacks();
Object.DestroyImmediate((Object) this.m_SequenceHierarchy);
}
private void OnLostFocus()
{
this.isDragging = false;
if (this.state != null)
this.state.captured.Clear();
this.Repaint();
}
private void OnFocus()
{
if (this.state == null)
return;
this.RefreshSelection(false);
}
private void OnHierarchyChange()
{
this.hierarchyChangedThisFrame = true;
this.Repaint();
}
private void OnGUI()
{
EditMode.HandleModeClutch();
this.DetectActiveSceneChanges();
this.DetectStateChanges();
this.state.ProcessStartFramePendingUpdates();
Rect position1;
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rect& local1 = @position1;
double num1 = 0.0;
double num2 = 0.0;
Rect position2 = this.get_position();
// ISSUE: explicit reference operation
double num3 = (double) ((Rect) @position2).get_width();
Rect position3 = this.get_position();
// ISSUE: explicit reference operation
double num4 = (double) ((Rect) @position3).get_height();
((Rect) local1).\u002Ector((float) num1, (float) num2, (float) num3, (float) num4);
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rect& local2 = @position1;
double num5 = (double) ((Rect) local2).get_xMin() + (double) this.state.sequencerHeaderWidth;
((Rect) local2).set_xMin((float) num5);
using (new GUIViewportScope(position1))
this.state.InvokeWindowOnGuiStarted(Event.get_current());
if (Event.get_current().get_type() == 3 && this.state != null && (double) this.state.mouseDragLag > 0.0)
{
this.state.mouseDragLag -= Time.get_deltaTime();
}
else
{
if (TimelineWindow.PerformUndo())
return;
if (EditorApplication.get_isPlaying())
{
if (this.state != null && this.state.recording)
this.state.recording = false;
this.Repaint();
}
this.clientArea = this.get_position();
this.DoLayout();
if (this.state.captured.Count > 0)
{
using (new GUIViewportScope(position1))
{
foreach (Manipulator manipulator in this.state.captured)
manipulator.Overlay(Event.get_current(), this.state);
this.Repaint();
}
}
if (this.state.showQuadTree)
this.state.spacePartitioner.DebugDraw();
if (Event.get_current().get_type() == 7)
{
this.RebuildGraphIfNecessary(true);
this.state.ProcessEndFramePendingUpdates();
}
using (new GUIViewportScope(position1))
this.state.InvokeWindowOnGuiFinished(Event.get_current());
if (Event.get_current().get_type() != 7)
return;
this.hierarchyChangedThisFrame = false;
}
}
private void DetectActiveSceneChanges()
{
if (this.m_CurrentSceneHashCode == -1)
this.m_CurrentSceneHashCode = SceneManager.GetActiveScene().GetHashCode();
if (this.m_CurrentSceneHashCode == SceneManager.GetActiveScene().GetHashCode())
return;
bool flag = false;
for (int index = 0; index < SceneManager.get_sceneCount(); ++index)
{
Scene sceneAt = SceneManager.GetSceneAt(index);
// ISSUE: explicit reference operation
if (sceneAt.GetHashCode() == this.m_CurrentSceneHashCode && ((Scene) @sceneAt).get_isLoaded())
{
flag = true;
break;
}
}
if (!flag)
{
this.ClearCurrentTimeline();
this.m_CurrentSceneHashCode = SceneManager.GetActiveScene().GetHashCode();
}
}
private void DetectStateChanges()
{
// ISSUE: unable to decompile the method.
}
private void Initialize()
{
if (!this.m_HasBeenInitialized)
{
this.InitializeStateChange();
this.InitializeEditorCallbacks();
this.m_HasBeenInitialized = true;
}
this.InitializeTimeArea();
if (this.treeView != null || !Object.op_Inequality((Object) this.state.editSequence.asset, (Object) null))
return;
this.treeView = new TimelineTreeViewGUI(this, this.state.editSequence.asset, this.get_position());
this.state.Refresh();
}
private static bool PerformUndo()
{
return Event.get_current().get_isKey() && Event.get_current().get_keyCode() == 122 && EditorGUI.get_actionKey();
}
public void RebuildGraphIfNecessary(bool evaluate = true)
{
if (this.state == null || Object.op_Equality((Object) this.state.editSequence.director, (Object) null) || (Object.op_Equality((Object) this.state.editSequence.asset, (Object) null) || EditorApplication.get_isPlaying()))
return;
if (this.state.rebuildGraph)
{
double time = this.state.editSequence.time;
this.state.GatherProperties(this.state.editSequence.director);
this.state.RebuildPlayableGraph();
this.state.editSequence.time = time;
if (evaluate)
this.state.EvaluateImmediate();
this.Repaint();
}
this.state.rebuildGraph = false;
}
public TrackAsset AddTrack(Type type, TrackAsset parent = null, string name = null)
{
if (Object.op_Equality((Object) this.state.editSequence.asset, (Object) null))
return (TrackAsset) null;
TrackAsset track = this.state.editSequence.asset.CreateTrack(type, parent, name);
if (Object.op_Inequality((Object) track, (Object) null))
this.state.Refresh();
return track;
}
public T AddTrack<T>(TrackAsset parent = null, string name = null) where T : TrackAsset, new()
{
return (T) this.AddTrack(typeof (T), parent, name);
}
internal static bool IsEditingTimelineAsset(TimelineAsset timelineAsset)
{
return Object.op_Inequality((Object) TimelineWindow.instance, (Object) null) && TimelineWindow.instance.state != null && Object.op_Equality((Object) TimelineWindow.instance.state.editSequence.asset, (Object) timelineAsset);
}
internal static void RepaintIfEditingTimelineAsset(TimelineAsset timelineAsset)
{
if (!TimelineWindow.IsEditingTimelineAsset(timelineAsset))
return;
TimelineWindow.instance.Repaint();
}
[MenuItem("Assets/Create/Timeline", false, 450)]
public static void CreateNewTimeline()
{
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, (EndNameEditAction) ScriptableObject.CreateInstance<TimelineWindow.DoCreateTimeline>(), "New Timeline.playable", EditorGUIUtility.IconContent("TimelineAsset Icon").get_image() as Texture2D, (string) null);
}
[MenuItem("Window/Sequencing/Timeline", false, 1)]
public static void ShowWindow()
{
Type[] typeArray = new Type[1];
int index = 0;
Type type = typeof (SceneView);
typeArray[index] = type;
EditorWindow.GetWindow<TimelineWindow>(typeArray);
TimelineWindow.instance.Focus();
}
[OnOpenAsset(1)]
public static bool OnDoubleClick(int instanceID, int line)
{
TimelineAsset seq = EditorUtility.InstanceIDToObject(instanceID) as TimelineAsset;
if (Object.op_Equality((Object) seq, (Object) null))
return false;
TimelineWindow.ShowWindow();
TimelineWindow.instance.SetCurrentTimeline(seq);
return true;
}
public virtual void AddItemsToMenu(GenericMenu menu)
{
bool flag = this.state == null || Object.op_Equality((Object) this.state.editSequence.asset, (Object) null);
this.m_LockTracker.AddItemsToMenu(menu, flag);
}
protected virtual void ShowButton(Rect r)
{
bool flag = this.state == null || Object.op_Equality((Object) this.state.editSequence.asset, (Object) null);
this.m_LockTracker.ShowButton(r, DirectorStyles.Instance.lockButton, flag);
}
internal void TreeViewKeyboardCallback()
{
if (Event.get_current().get_type() != 4 || !TimelineAction.HandleShortcut(this.state, Event.get_current()))
return;
Event.get_current().Use();
}
public void ClearCurrentTimeline()
{
this.SetCurrentTimeline((TimelineAsset) null, (PlayableDirector) null, (TimelineClip) null, true);
}
public void SetCurrentTimeline(TimelineAsset seq)
{
this.SetCurrentTimeline(seq, (PlayableDirector) null, (TimelineClip) null, false);
}
public void SetCurrentTimeline(PlayableDirector director, TimelineClip hostClip = null)
{
this.SetCurrentTimeline(!Object.op_Inequality((Object) director, (Object) null) ? (TimelineAsset) null : director.get_playableAsset() as TimelineAsset, director, hostClip, false);
}
private void SetCurrentTimeline(TimelineAsset seq, PlayableDirector instanceOfDirector, TimelineClip hostClip, bool force = false)
{
if (this.state == null || !force && this.state.editSequence.hostClip == hostClip && (Object.op_Equality((Object) this.state.editSequence.director, (Object) instanceOfDirector) && Object.op_Equality((Object) this.state.editSequence.asset, (Object) seq)))
return;
this.state.SetCurrentSequence(seq, instanceOfDirector, hostClip);
}
private void OnBeforeSequenceChange()
{
this.treeView = (TimelineTreeViewGUI) null;
this.m_TimeAreaDirty = true;
this.state.Reset();
this.m_PlayableLookup.ClearPlayableLookup();
this.EnableEditAssetMode();
}
private void OnAfterSequenceChange()
{
if (Object.op_Inequality((Object) this.state.editSequence.asset, (Object) null) && Object.op_Inequality((Object) this.state.editSequence.director, (Object) null))
this.EnableActiveMode();
this.Repaint();
this.m_SequencePath = this.state.GetCurrentSequencePath();
this.m_LastFrameHadSequence = Object.op_Inequality((Object) this.state.editSequence.asset, (Object) null);
TimelineWindowViewPrefs.SaveAll();
}
private void DoBreadcrumbGUI()
{
if (this.state == null || Object.op_Equality((Object) this.state.editSequence.director, (Object) null))
return;
List<string> labels = new List<string>();
foreach (ISequenceState sequence in this.state.GetAllSequences())
labels.Add(DisplayNameHelper.GetDisplayName(sequence));
EditorGUI.DisabledScope disabledScope;
// ISSUE: explicit reference operation
((EditorGUI.DisabledScope) @disabledScope).\u002Ector(this.currentMode.headerState.breadCrumb == TimelineModeGUIState.Disabled);
try
{
BreadcrumbDrawer.Draw(this.breadCrumbAreaWidth, labels, new Action<int>(this.NavigateToBreadcrumbIndex));
}
finally
{
disabledScope.Dispose();
}
}
private void NavigateToBreadcrumbIndex(int index)
{
this.state.PopSequencesUntilCount(index + 1);
}
private void DoSequenceSelectorGUI()
{
EditorGUI.DisabledScope disabledScope;
// ISSUE: explicit reference operation
((EditorGUI.DisabledScope) @disabledScope).\u002Ector(this.currentMode.headerState.sequenceSelector == TimelineModeGUIState.Disabled);
try
{
GUIContent guiContent = DirectorStyles.sequenceSelectorIcon;
GUIStyle toolbarPopup = EditorStyles.get_toolbarPopup();
GUILayoutOption[] guiLayoutOptionArray = new GUILayoutOption[1];
int index = 0;
GUILayoutOption guiLayoutOption = GUILayout.Width(32f);
guiLayoutOptionArray[index] = guiLayoutOption;
if (GUILayout.Button(guiContent, toolbarPopup, guiLayoutOptionArray))
{
PlayableDirector[] inSceneUsingAsset = TimelineUtility.GetDirectorsInSceneUsingAsset((PlayableAsset) null);
GenericMenu genericMenu = new GenericMenu();
TimelineWindow.SequenceMenuNameFormater menuNameFormater = new TimelineWindow.SequenceMenuNameFormater();
foreach (PlayableDirector director in inSceneUsingAsset)
{
if (director.get_playableAsset() is TimelineAsset)
{
string str = menuNameFormater.Format(DisplayNameHelper.GetDisplayName(director));
bool flag = Object.op_Equality((Object) this.state.masterSequence.director, (Object) director);
// ISSUE: method pointer
genericMenu.AddItem(new GUIContent(str), flag, new GenericMenu.MenuFunction2((object) this, __methodptr(\u003CDoSequenceSelectorGUI\u003Em__0)), (object) director);
}
}
if (inSceneUsingAsset.Length == 0)
genericMenu.AddDisabledItem(DirectorStyles.noTimelinesInScene);
genericMenu.ShowAsContext();
}
GUILayout.Space(10f);
}
finally
{
disabledScope.Dispose();
}
}
private void DurationGUI(TimelineWindow.TimelineItemArea area, double duration)
{
if (!this.currentMode.ShouldShowTimeArea(this.state))
return;
bool drawhead = area == TimelineWindow.TimelineItemArea.Header;
if (this.state.IsEditingASubTimeline())
{
if (!drawhead)
return;
this.HighlightTimeAreaRange(this.state.editSequence.GetEvaluableRange(), DirectorStyles.Instance.customSkin.colorSubSequenceDurationLine);
}
else
{
if (this.state.editSequence.asset.get_durationMode() == null && duration <= 0.0)
return;
if (this.m_TimelineDuration == null)
this.m_TimelineDuration = new TimeAreaItem(TimelineWindow.styles.endmarker, new Action<double>(this.OnTrackDurationDrag))
{
tooltip = "End of sequence marker",
boundOffset = new Vector2(0.0f, -DirectorStyles.kDurationGuiThickness)
};
this.DrawDuration(drawhead, !drawhead, duration);
}
}
private void DrawDuration(bool drawhead, bool drawline, double duration)
{
if (this.state.TimeIsInRange((float) duration))
{
Color color1 = DirectorStyles.Instance.customSkin.colorEndmarker;
Color color2 = Color.get_white();
bool flag = !EditorApplication.get_isPlaying() && this.state.editSequence.asset.get_durationMode() == 1;
if (flag)
{
if (Event.get_current().get_type() == null)
{
Rect bounds1 = this.m_TimelineDuration.bounds;
// ISSUE: explicit reference operation
if (((Rect) @bounds1).Contains(Event.get_current().get_mousePosition()) && this.m_PlayHead != null)
{
Rect bounds2 = this.m_PlayHead.bounds;
// ISSUE: explicit reference operation
if (((Rect) @bounds2).Contains(Event.get_current().get_mousePosition()))
flag = false;
}
}
}
else
{
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Color& local = @color1;
// ISSUE: explicit reference operation
double num = (^local).a * 0.660000026226044;
// ISSUE: explicit reference operation
(^local).a = (__Null) num;
color2 = DirectorStyles.Instance.customSkin.colorDuration;
}
if (flag)
this.m_TimelineDuration.HandleManipulatorsEvents(this.state);
this.m_TimelineDuration.lineColor = color1;
this.m_TimelineDuration.headColor = color2;
this.m_TimelineDuration.drawHead = drawhead;
this.m_TimelineDuration.drawLine = drawline;
this.m_TimelineDuration.canMoveHead = flag;
this.m_TimelineDuration.Draw(this.treeviewBounds, this.state, duration);
}
if (!Object.op_Inequality((Object) this.state.editSequence.asset, (Object) null) || !drawhead)
return;
this.HighlightTimeAreaRange(this.state.editSequence.GetEvaluableRange(), DirectorStyles.Instance.customSkin.colorDurationLine);
}
private void HighlightTimeAreaRange(Range range, Color lineColor)
{
if (range.length <= 0.0 || !this.state.RangeIsVisible(range))
return;
double num1 = (double) this.state.TimeToPixel(range.start);
Rect timeAreaRect1 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num2 = (double) ((Rect) @timeAreaRect1).get_xMin();
double num3 = (double) Math.Max((float) num1, (float) num2);
Rect timeAreaRect2 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num4 = (double) ((Rect) @timeAreaRect2).get_y() - (double) DirectorStyles.kDurationGuiThickness;
Rect timeAreaRect3 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num5 = (double) ((Rect) @timeAreaRect3).get_height();
double num6 = num4 + num5;
double num7 = (double) this.state.TimeToPixel(range.end);
Rect timeAreaRect4 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num8 = (double) ((Rect) @timeAreaRect4).get_xMax();
double num9 = (double) Math.Min((float) num7, (float) num8);
Rect timeAreaRect5 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num10 = (double) ((Rect) @timeAreaRect5).get_y();
Rect timeAreaRect6 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num11 = (double) ((Rect) @timeAreaRect6).get_height();
double num12 = num10 + num11;
EditorGUI.DrawRect(Rect.MinMaxRect((float) num3, (float) num6, (float) num9, (float) num12), lineColor);
}
private void OnTrackDurationDrag(double newTime)
{
if (this.state.editSequence.asset.get_durationMode() == 1)
{
this.state.editSequence.asset.set_fixedDuration(newTime);
this.state.UpdateRootPlayableDuration(newTime);
}
this.m_TimelineDuration.showTooltip = true;
}
private void OnSelectionChangedInactive()
{
if (this.get_hasFocus())
return;
this.RefreshSelection(true);
}
private void InitializeEditorCallbacks()
{
// ISSUE: method pointer
Undo.postprocessModifications = (__Null) Delegate.Combine((Delegate) Undo.postprocessModifications, (Delegate) new Undo.PostprocessModifications((object) this, __methodptr(PostprocessAnimationRecordingModifications)));
// ISSUE: method pointer
Undo.postprocessModifications = (__Null) Delegate.Combine((Delegate) Undo.postprocessModifications, (Delegate) new Undo.PostprocessModifications((object) this, __methodptr(ProcessAssetModifications)));
// ISSUE: method pointer
Undo.undoRedoPerformed = (__Null) Delegate.Combine((Delegate) Undo.undoRedoPerformed, (Delegate) new Undo.UndoRedoCallback((object) this, __methodptr(OnUndoRedo)));
EditorApplication.add_playModeStateChanged(new Action<PlayModeStateChange>(this.OnPlayModeStateChanged));
// ISSUE: method pointer
AnimationUtility.onCurveWasModified = (__Null) Delegate.Combine((Delegate) AnimationUtility.onCurveWasModified, (Delegate) new AnimationUtility.OnCurveWasModified((object) this, __methodptr(OnCurveModified)));
// ISSUE: method pointer
EditorApplication.editorApplicationQuit = (__Null) Delegate.Combine((Delegate) EditorApplication.editorApplicationQuit, (Delegate) new UnityAction((object) this, __methodptr(OnEditorQuit)));
Selection.selectionChanged = (__Null) Delegate.Combine((Delegate) Selection.selectionChanged, (Delegate) new Action(this.OnSelectionChangedInactive));
}
private void OnEditorQuit()
{
TimelineWindowViewPrefs.SaveAll();
}
private void RemoveEditorCallbacks()
{
EditorApplication.remove_playModeStateChanged(new Action<PlayModeStateChange>(this.OnPlayModeStateChanged));
// ISSUE: method pointer
Undo.undoRedoPerformed = (__Null) Delegate.Remove((Delegate) Undo.undoRedoPerformed, (Delegate) new Undo.UndoRedoCallback((object) this, __methodptr(OnUndoRedo)));
// ISSUE: method pointer
Undo.postprocessModifications = (__Null) Delegate.Remove((Delegate) Undo.postprocessModifications, (Delegate) new Undo.PostprocessModifications((object) this, __methodptr(PostprocessAnimationRecordingModifications)));
// ISSUE: method pointer
Undo.postprocessModifications = (__Null) Delegate.Remove((Delegate) Undo.postprocessModifications, (Delegate) new Undo.PostprocessModifications((object) this, __methodptr(ProcessAssetModifications)));
// ISSUE: method pointer
AnimationUtility.onCurveWasModified = (__Null) Delegate.Remove((Delegate) AnimationUtility.onCurveWasModified, (Delegate) new AnimationUtility.OnCurveWasModified((object) this, __methodptr(OnCurveModified)));
// ISSUE: method pointer
EditorApplication.editorApplicationQuit = (__Null) Delegate.Remove((Delegate) EditorApplication.editorApplicationQuit, (Delegate) new UnityAction((object) this, __methodptr(OnEditorQuit)));
Selection.selectionChanged = (__Null) Delegate.Remove((Delegate) Selection.selectionChanged, (Delegate) new Action(this.OnSelectionChangedInactive));
}
private void OnCurveModified(AnimationClip clip, EditorCurveBinding binding, AnimationUtility.CurveModifiedType type)
{
InspectorWindow.RepaintAllInspectors();
if (type != 2)
this.state.Evaluate();
if (this.state != null && type != 1)
this.state.rebuildGraph = true;
Playable p;
if (type == 1 && this.state != null && this.m_PlayableLookup.GetPlayableFromAnimClip(clip, out p))
AnimationPlayableExtensions.SetAnimatedProperties<Playable>((M0) p, clip);
if (type != null)
return;
bool previewMode = this.state.previewMode;
this.state.previewMode = false;
this.state.previewMode = previewMode;
}
private void OnPlayModeStateChanged(PlayModeStateChange playModeState)
{
if (playModeState == 1 || playModeState == 3)
TimelineWindowViewPrefs.SaveAll();
if (playModeState != 1 && playModeState != 3 || this.state == null)
return;
this.state.Stop();
}
private UndoPropertyModification[] PostprocessAnimationRecordingModifications(UndoPropertyModification[] modifications)
{
if (!this.state.recording)
return modifications;
UndoPropertyModification[] propertyModificationArray = TimelineRecording.ProcessUndoModification(modifications, this.state);
if (propertyModificationArray != modifications && (Object.op_Equality((Object) EditorWindow.get_focusedWindow(), (Object) null) || EditorWindow.get_focusedWindow() is InspectorWindow || EditorWindow.get_focusedWindow() is TimelineWindow))
this.Repaint();
return propertyModificationArray;
}
private UndoPropertyModification[] ProcessAssetModifications(UndoPropertyModification[] modifications)
{
bool flag = false;
for (int index = 0; index < modifications.Length && !flag; ++index)
{
// ISSUE: object of a compiler-generated type is created
// ISSUE: variable of a compiler-generated type
TimelineWindow.\u003CProcessAssetModifications\u003Ec__AnonStorey0 modificationsCAnonStorey0 = new TimelineWindow.\u003CProcessAssetModifications\u003Ec__AnonStorey0();
// ISSUE: reference to a compiler-generated field
modificationsCAnonStorey0.mod = modifications[index];
// ISSUE: reference to a compiler-generated field
// ISSUE: reference to a compiler-generated field
if (modificationsCAnonStorey0.mod.previousValue != null && ((PropertyModification) modificationsCAnonStorey0.mod.previousValue).target is AvatarMask)
{
// ISSUE: reference to a compiler-generated method
flag = Object.op_Inequality((Object) this.state.editSequence.asset, (Object) null) && Enumerable.Any<AnimationTrack>(Enumerable.OfType<AnimationTrack>((IEnumerable) this.state.editSequence.asset.get_flattenedTracks()), new Func<AnimationTrack, bool>(modificationsCAnonStorey0.\u003C\u003Em__0));
}
}
if (flag)
{
this.state.rebuildGraph = true;
this.Repaint();
}
return modifications;
}
private void OnUndoRedo()
{
List<string> list1 = new List<string>();
List<string> list2 = new List<string>();
Undo.GetRecords(list1, list2);
bool flag = Enumerable.Any<string>((IEnumerable<string>) list2, (Func<string, bool>) (x => x.IndexOf("Timeline", StringComparison.OrdinalIgnoreCase) >= 0));
if (!flag)
flag = Enumerable.Any<string>((IEnumerable<string>) list1, (Func<string, bool>) (x => x.IndexOf("Timeline", StringComparison.OrdinalIgnoreCase) >= 0));
if (!flag)
return;
TimelineWindow.ValidateSelection();
if (this.state != null)
{
this.state.RebindAnimators();
this.state.Refresh();
}
this.Repaint();
}
private static void ValidateSelection()
{
using (IEnumerator<ITimelineItem> enumerator = Enumerable.Select<EditorItem<TimelineClip>, ITimelineItem>((IEnumerable<EditorItem<TimelineClip>>) Selection.GetFiltered<EditorItem<TimelineClip>>((SelectionMode) 0), (Func<EditorItem<TimelineClip>, ITimelineItem>) (x => x.item)).GetEnumerator())
{
while (((IEnumerator) enumerator).MoveNext())
{
ITimelineItem current = enumerator.Current;
TrackAsset parentTrack = current.get_parentTrack();
if (Object.op_Inequality((Object) current.get_parentTrack(), (Object) null) && !Enumerable.Contains<ITimelineItem>((IEnumerable<ITimelineItem>) parentTrack.get_clips(), current))
SelectionManager.Remove(current);
}
}
}
private void EnableActiveMode()
{
this.m_CurrentMode = SequencerModeType.Active;
}
private void EnableInactiveMode()
{
this.m_CurrentMode = SequencerModeType.Inactive;
}
private void EnableEditAssetMode()
{
this.m_CurrentMode = SequencerModeType.EditAsset;
}
private void DoLayout()
{
EventType rawType = Event.get_current().get_rawType();
Vector2 mousePosition = Event.get_current().get_mousePosition();
this.Initialize();
this.HandleSplitterResize();
bool flag = Event.get_current().get_type() != 7 && Event.get_current().get_type() != 8;
if (flag)
{
PickerUtils.DoPick(this.state, mousePosition);
if (Object.op_Inequality((Object) this.state.editSequence.asset, (Object) null))
this.m_PreTreeViewControl.HandleManipulatorsEvents(this.state);
}
this.SequencerGUI();
if (flag && Object.op_Inequality((Object) this.state.editSequence.asset, (Object) null))
this.m_PostTreeViewControl.HandleManipulatorsEvents(this.state);
this.m_RectangleSelect.OnGUI(this.state, rawType, mousePosition);
this.m_RectangleZoom.OnGUI(this.state, rawType, mousePosition);
}
private void TimelineSectionGUI()
{
GUILayout.BeginVertical(new GUILayoutOption[0]);
GUIStyle toolbarButton = EditorStyles.get_toolbarButton();
GUILayoutOption[] guiLayoutOptionArray = new GUILayoutOption[1];
int index = 0;
Rect timeAreaRect = this.state.timeAreaRect;
// ISSUE: explicit reference operation
GUILayoutOption guiLayoutOption = GUILayout.Width(((Rect) @timeAreaRect).get_width());
guiLayoutOptionArray[index] = guiLayoutOption;
GUILayout.BeginHorizontal(toolbarButton, guiLayoutOptionArray);
this.DoSequenceSelectorGUI();
this.DoBreadcrumbGUI();
this.OptionsGUI();
GUILayout.EndHorizontal();
this.TimelineGUI();
GUILayout.EndVertical();
}
private void SplitterGUI()
{
if (this.state.IsEditingAnEmptyTimeline())
return;
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rect& local1 = @this.m_SplitterLineRect;
double num1 = (double) this.state.sequencerHeaderWidth - 1.0;
double num2 = 0.0;
double num3 = 1.0;
Rect clientArea1 = this.clientArea;
// ISSUE: explicit reference operation
double num4 = (double) ((Rect) @clientArea1).get_height();
((Rect) local1).Set((float) num1, (float) num2, (float) num3, (float) num4);
EditorGUI.DrawRect(this.m_SplitterLineRect, DirectorStyles.Instance.customSkin.colorTopOutline3);
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rect& local2 = @this.m_SplitterLineRect;
double num5 = (double) this.state.sequencerHeaderWidth;
double num6 = 0.0;
double num7 = 1.0;
Rect clientArea2 = this.clientArea;
// ISSUE: explicit reference operation
double num8 = (double) ((Rect) @clientArea2).get_height();
((Rect) local2).Set((float) num5, (float) num6, (float) num7, (float) num8);
EditorGUI.DrawRect(this.m_SplitterLineRect, DirectorStyles.Instance.customSkin.colorTopOutline3);
}
private void TrackViewsGUI()
{
using (new GUIViewportScope(this.treeviewBounds))
this.TracksGUI(this.treeviewBounds, this.state, this.currentMode.TrackState(this.state));
}
private void DrawHeaderBackground()
{
Rect timeAreaRect = this.state.timeAreaRect;
// ISSUE: explicit reference operation
((Rect) @timeAreaRect).set_xMin(0.0f);
EditorGUI.DrawRect(timeAreaRect, DirectorStyles.Instance.customSkin.colorTimelineBackground);
}
private void HandleBottomFillerDragAndDrop(Rect rect)
{
// ISSUE: explicit reference operation
if (Event.get_current().get_type() != 9 && Event.get_current().get_type() != 15 && Event.get_current().get_type() != 10 || (TimelineWindow.instance.treeView == null || TimelineWindow.instance.treeView.timelineDragging == null || !((Rect) @rect).Contains(Event.get_current().get_mousePosition())))
return;
((TreeViewDragging) TimelineWindow.instance.treeView.timelineDragging).DragElement((TreeViewItem) null, (Rect) null, -1);
}
private void DrawHeaderBackgroundBottomFiller()
{
Rect treeviewBounds1 = this.treeviewBounds;
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rect& local1 = @treeviewBounds1;
Rect treeviewBounds2 = this.treeviewBounds;
// ISSUE: explicit reference operation
double num1 = (double) ((Rect) @treeviewBounds2).get_yMax();
((Rect) local1).set_yMin((float) num1);
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rect& local2 = @treeviewBounds1;
Rect treeviewBounds3 = this.treeviewBounds;
// ISSUE: explicit reference operation
double num2 = (double) ((Rect) @treeviewBounds3).get_yMax() + 15.0;
((Rect) local2).set_yMax((float) num2);
if (Object.op_Inequality((Object) this.state.editSequence.asset, (Object) null) && !this.state.IsEditingAnEmptyTimeline())
{
// ISSUE: explicit reference operation
((Rect) @treeviewBounds1).set_width(this.state.sequencerHeaderWidth);
}
using (new GUIViewportScope(treeviewBounds1))
EditorGUI.DrawRect(treeviewBounds1, DirectorStyles.Instance.customSkin.colorSequenceBackground);
this.HandleBottomFillerDragAndDrop(treeviewBounds1);
}
private void SequencerGUI()
{
double duration = this.state.editSequence.duration;
this.DrawHeaderBackground();
this.DurationGUI(TimelineWindow.TimelineItemArea.Header, duration);
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
this.SequencerHeaderGUI();
this.TimelineSectionGUI();
GUILayout.EndHorizontal();
this.TrackViewsGUI();
this.DurationGUI(TimelineWindow.TimelineItemArea.Lines, duration);
this.PlayRangeGUI(TimelineWindow.TimelineItemArea.Lines);
this.TimeCursorGUI(TimelineWindow.TimelineItemArea.Lines);
this.DrawHeaderBackgroundBottomFiller();
this.SubTimelineRangeGUI();
this.PlayRangeGUI(TimelineWindow.TimelineItemArea.Header);
this.TimeCursorGUI(TimelineWindow.TimelineItemArea.Header);
this.SplitterGUI();
}
private void SubTimelineRangeGUI()
{
if (!this.state.IsEditingASubTimeline() || this.state.IsEditingAnEmptyTimeline())
return;
Color color = DirectorStyles.Instance.customSkin.colorSubSequenceOverlay;
Range evaluableRange = this.state.editSequence.GetEvaluableRange();
Vector2 vector2;
// ISSUE: explicit reference operation
((Vector2) @vector2).\u002Ector(this.state.TimeToPixel(evaluableRange.start), this.state.TimeToPixel(evaluableRange.end));
Rect clipArea = this.clipArea;
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rect& local1 = @clipArea;
double num1 = (double) ((Rect) local1).get_yMin();
Rect timeAreaRect1 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num2 = (double) ((Rect) @timeAreaRect1).get_height();
double num3 = num1 - num2;
((Rect) local1).set_yMin((float) num3);
// ISSUE: explicit reference operation
if ((double) ((Rect) @clipArea).get_xMin() < vector2.x)
{
Rect rect = clipArea;
// ISSUE: explicit reference operation
// ISSUE: explicit reference operation
((Rect) @rect).set_xMin(((Rect) @clipArea).get_xMin());
// ISSUE: explicit reference operation
// ISSUE: explicit reference operation
((Rect) @rect).set_xMax(Mathf.Min((float) vector2.x, ((Rect) @clipArea).get_xMax()));
EditorGUI.DrawRect(rect, color);
}
// ISSUE: explicit reference operation
if ((double) ((Rect) @clipArea).get_xMax() <= vector2.y)
return;
Rect rect1 = clipArea;
// ISSUE: explicit reference operation
// ISSUE: explicit reference operation
((Rect) @rect1).set_xMin(Mathf.Max((float) vector2.y, ((Rect) @clipArea).get_xMin()));
// ISSUE: explicit reference operation
// ISSUE: explicit reference operation
((Rect) @rect1).set_xMax(((Rect) @clipArea).get_xMax());
EditorGUI.DrawRect(rect1, color);
// ISSUE: explicit reference operation
// ISSUE: explicit reference operation
((Rect) @rect1).set_xMin(((Rect) @rect1).get_xMax());
// ISSUE: explicit reference operation
((Rect) @rect1).set_width(this.verticalScrollbarWidth);
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rect& local2 = @rect1;
Rect timeAreaRect2 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num4 = (double) ((Rect) @timeAreaRect2).get_y();
Rect timeAreaRect3 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num5 = (double) ((Rect) @timeAreaRect3).get_height();
double num6 = num4 + num5;
((Rect) local2).set_yMax((float) num6);
EditorGUI.DrawRect(rect1, color);
}
private void HandleSplitterResize()
{
WindowState state = this.state;
Rect position1 = this.get_position();
// ISSUE: explicit reference operation
double num1 = (double) ((Rect) @position1).get_width();
state.mainAreaWidth = (float) num1;
if (Object.op_Equality((Object) this.state.editSequence.asset, (Object) null))
return;
Rect rect;
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rect& local1 = @rect;
double num2 = (double) this.state.sequencerHeaderWidth - 3.0;
double num3 = 0.0;
double num4 = 6.0;
Rect clientArea = this.clientArea;
// ISSUE: explicit reference operation
double num5 = (double) ((Rect) @clientArea).get_height();
((Rect) local1).\u002Ector((float) num2, (float) num3, (float) num4, (float) num5);
EditorGUIUtility.AddCursorRect(rect, (MouseCursor) 19);
// ISSUE: explicit reference operation
if (Event.get_current().get_type() == null && ((Rect) @rect).Contains(Event.get_current().get_mousePosition()))
this.m_SplitterCaptured = 1;
if (this.m_SplitterCaptured <= 0)
return;
if (Event.get_current().get_type() == 1)
{
this.m_SplitterCaptured = 0;
Event.get_current().Use();
}
if (Event.get_current().get_type() == 3)
{
if (this.m_SplitterCaptured == 1)
{
// ISSUE: variable of the null type
__Null local2 = Event.get_current().get_delta().x;
Rect position2 = this.get_position();
// ISSUE: explicit reference operation
double num6 = (double) ((Rect) @position2).get_width();
this.m_HierarchySplitterPerc = Mathf.Clamp(this.m_HierarchySplitterPerc + (float) (local2 / num6), (float) this.m_HierachySplitterMinMax.x, (float) this.m_HierachySplitterMinMax.y);
this.state.sequencerHeaderWidth += (float) Event.get_current().get_delta().x;
}
Event.get_current().Use();
}
}
public void ShowNewTracksContextMenu(TrackAsset parentTrack)
{
this.ShowNewTracksContextMenu(parentTrack, (TimelineGroupGUI) null);
}
private void AddMenuItem(GenericMenu menu, TrackAsset parentTrack, TimelineGroupGUI parentGroup, Type type)
{
// ISSUE: object of a compiler-generated type is created
// ISSUE: variable of a compiler-generated type
TimelineWindow.\u003CAddMenuItem\u003Ec__AnonStorey1 itemCAnonStorey1 = new TimelineWindow.\u003CAddMenuItem\u003Ec__AnonStorey1();
// ISSUE: reference to a compiler-generated field
itemCAnonStorey1.parentTrack = parentTrack;
// ISSUE: reference to a compiler-generated field
itemCAnonStorey1.parentGroup = parentGroup;
// ISSUE: reference to a compiler-generated field
itemCAnonStorey1.\u0024this = this;
// ISSUE: method pointer
GenericMenu.MenuFunction2 menuFunction2 = new GenericMenu.MenuFunction2((object) itemCAnonStorey1, __methodptr(\u003C\u003Em__0));
string trackCategoryName = TimelineHelpers.GetTrackCategoryName(type);
if (!string.IsNullOrEmpty(trackCategoryName))
trackCategoryName += "/";
GUIContent guiContent = new GUIContent(trackCategoryName + TimelineHelpers.GetTrackMenuName(type));
// ISSUE: reference to a compiler-generated field
// ISSUE: reference to a compiler-generated field
if (Object.op_Inequality((Object) itemCAnonStorey1.parentTrack, (Object) null) && itemCAnonStorey1.parentTrack.get_lockedInHierarchy())
menu.AddDisabledItem(guiContent, false);
else
menu.AddItem(guiContent, false, menuFunction2, (object) type);
}
public void ShowNewTracksContextMenu(TrackAsset parentTrack, TimelineGroupGUI parentGroup)
{
// ISSUE: object of a compiler-generated type is created
// ISSUE: variable of a compiler-generated type
TimelineWindow.\u003CShowNewTracksContextMenu\u003Ec__AnonStorey2 menuCAnonStorey2 = new TimelineWindow.\u003CShowNewTracksContextMenu\u003Ec__AnonStorey2();
// ISSUE: reference to a compiler-generated field
menuCAnonStorey2.parentTrack = parentTrack;
// ISSUE: reference to a compiler-generated field
menuCAnonStorey2.\u0024this = this;
GenericMenu menu = new GenericMenu();
// ISSUE: reference to a compiler-generated field
// ISSUE: reference to a compiler-generated field
menuCAnonStorey2.title = !Object.op_Equality((Object) menuCAnonStorey2.parentTrack, (Object) null) ? L10n.Tr("Track Sub-Group") : L10n.Tr("Track Group");
// ISSUE: reference to a compiler-generated field
// ISSUE: reference to a compiler-generated field
if (Object.op_Inequality((Object) menuCAnonStorey2.parentTrack, (Object) null) && menuCAnonStorey2.parentTrack.get_lockedInHierarchy())
{
// ISSUE: reference to a compiler-generated field
menu.AddDisabledItem(new GUIContent(menuCAnonStorey2.title));
}
else
{
// ISSUE: reference to a compiler-generated field
// ISSUE: method pointer
menu.AddItem(new GUIContent(menuCAnonStorey2.title), false, new GenericMenu.MenuFunction2((object) menuCAnonStorey2, __methodptr(\u003C\u003Em__0)), (object) null);
}
menu.AddSeparator("");
List<Type> list1 = Enumerable.ToList<Type>(Enumerable.Where<Type>(TypeUtility.AllTrackTypes(), (Func<Type, bool>) (x => x != typeof (GroupTrack))));
List<Type> list2 = Enumerable.ToList<Type>(Enumerable.Where<Type>((IEnumerable<Type>) list1, (Func<Type, bool>) (x => x.Assembly.Equals((object) typeof (TimelineAsset).Assembly))));
List<Type> list3 = Enumerable.ToList<Type>(Enumerable.Except<Type>((IEnumerable<Type>) list1, (IEnumerable<Type>) list2));
foreach (Type type in list2)
{
// ISSUE: reference to a compiler-generated field
this.AddMenuItem(menu, menuCAnonStorey2.parentTrack, parentGroup, type);
}
if (Enumerable.Any<Type>((IEnumerable<Type>) list2) && Enumerable.Any<Type>((IEnumerable<Type>) list3))
menu.AddSeparator("");
foreach (Type type in list3)
{
// ISSUE: reference to a compiler-generated field
this.AddMenuItem(menu, menuCAnonStorey2.parentTrack, parentGroup, type);
}
menu.ShowAsContext();
}
private void OptionsGUI()
{
if (this.currentMode.headerState.options == TimelineModeGUIState.Hidden || Object.op_Equality((Object) this.state.editSequence.asset, (Object) null))
return;
EditorGUI.DisabledScope disabledScope;
// ISSUE: explicit reference operation
((EditorGUI.DisabledScope) @disabledScope).\u002Ector(this.currentMode.headerState.options == TimelineModeGUIState.Disabled);
try
{
GUILayout.FlexibleSpace();
if (!GUILayout.Button((Texture) TimelineWindow.styles.options.get_normal().get_background(), EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
return;
GenericMenu menu = new GenericMenu();
// ISSUE: method pointer
menu.AddItem(EditorGUIUtility.TrTextContent("Seconds", (string) null, (Texture) null), !this.state.timeInFrames, new GenericMenu.MenuFunction2((object) this, __methodptr(ChangeTimeCode)), (object) "seconds");
// ISSUE: method pointer
menu.AddItem(EditorGUIUtility.TrTextContent("Frames", (string) null, (Texture) null), this.state.timeInFrames, new GenericMenu.MenuFunction2((object) this, __methodptr(ChangeTimeCode)), (object) "frames");
menu.AddSeparator("");
TimeAreaContextMenu.AddTimeAreaMenuItems(menu, this.state);
menu.AddSeparator("");
if (false | this.AddStandardFrameRateMenu(menu, "Frame Rate/Film (24)", 24f) | this.AddStandardFrameRateMenu(menu, "Frame Rate/PAL (25)", 25f) | this.AddStandardFrameRateMenu(menu, "Frame Rate/NTSC (29.97)", 29.97f) | this.AddStandardFrameRateMenu(menu, "Frame Rate/30", 30f) | this.AddStandardFrameRateMenu(menu, "Frame Rate/50", 50f) | this.AddStandardFrameRateMenu(menu, "Frame Rate/60", 60f))
{
menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Frame Rate/Custom", (string) null, (Texture) null));
}
else
{
GenericMenu genericMenu = menu;
GUIContent guiContent = EditorGUIUtility.TrTextContent("Frame Rate/Custom (" + (object) this.state.editSequence.frameRate + ")", (string) null, (Texture) null);
int num = 1;
// ISSUE: reference to a compiler-generated field
if (TimelineWindow.\u003C\u003Ef__am\u0024cache5 == null)
{
// ISSUE: reference to a compiler-generated field
// ISSUE: method pointer
TimelineWindow.\u003C\u003Ef__am\u0024cache5 = new GenericMenu.MenuFunction((object) null, __methodptr(\u003COptionsGUI\u003Em__6));
}
// ISSUE: reference to a compiler-generated field
GenericMenu.MenuFunction menuFunction = TimelineWindow.\u003C\u003Ef__am\u0024cache5;
genericMenu.AddItem(guiContent, num != 0, menuFunction);
}
menu.AddSeparator("");
if (this.state.playRangeEnabled)
{
// ISSUE: method pointer
menu.AddItem(EditorGUIUtility.TrTextContent("Play Range Mode/Loop", (string) null, (Texture) null), this.state.playRangeLoopMode, new GenericMenu.MenuFunction((object) this, __methodptr(\u003COptionsGUI\u003Em__7)));
// ISSUE: method pointer
menu.AddItem(EditorGUIUtility.TrTextContent("Play Range Mode/Once", (string) null, (Texture) null), !this.state.playRangeLoopMode, new GenericMenu.MenuFunction((object) this, __methodptr(\u003COptionsGUI\u003Em__8)));
}
else
menu.AddDisabledItem(EditorGUIUtility.TrTextContent("Play Range Mode", (string) null, (Texture) null));
menu.AddSeparator("");
// ISSUE: method pointer
menu.AddItem(EditorGUIUtility.TrTextContent("Show Audio Waveforms", (string) null, (Texture) null), this.state.showAudioWaveform, new GenericMenu.MenuFunction((object) this, __methodptr(\u003COptionsGUI\u003Em__9)));
// ISSUE: method pointer
menu.AddItem(EditorGUIUtility.TrTextContent("Enable Audio Scrubbing", (string) null, (Texture) null), !this.state.muteAudioScrubbing, new GenericMenu.MenuFunction((object) this, __methodptr(\u003COptionsGUI\u003Em__A)));
menu.AddSeparator("");
// ISSUE: method pointer
menu.AddItem(EditorGUIUtility.TrTextContent("Snap to Frame", (string) null, (Texture) null), this.state.frameSnap, new GenericMenu.MenuFunction((object) this, __methodptr(\u003COptionsGUI\u003Em__B)));
// ISSUE: method pointer
menu.AddItem(EditorGUIUtility.TrTextContent("Edge Snap", (string) null, (Texture) null), this.state.edgeSnaps, new GenericMenu.MenuFunction((object) this, __methodptr(\u003COptionsGUI\u003Em__C)));
if (Unsupported.IsDeveloperMode())
{
GenericMenu genericMenu1 = menu;
GUIContent guiContent1 = EditorGUIUtility.TrTextContent("Show Snapping Debug", (string) null, (Texture) null);
int num1 = SnapEngine.displayDebugLayout ? 1 : 0;
// ISSUE: reference to a compiler-generated field
if (TimelineWindow.\u003C\u003Ef__am\u0024cache6 == null)
{
// ISSUE: reference to a compiler-generated field
// ISSUE: method pointer
TimelineWindow.\u003C\u003Ef__am\u0024cache6 = new GenericMenu.MenuFunction((object) null, __methodptr(\u003COptionsGUI\u003Em__D));
}
// ISSUE: reference to a compiler-generated field
GenericMenu.MenuFunction menuFunction1 = TimelineWindow.\u003C\u003Ef__am\u0024cache6;
genericMenu1.AddItem(guiContent1, num1 != 0, menuFunction1);
// ISSUE: method pointer
menu.AddItem(EditorGUIUtility.TrTextContent("Debug TimeArea", (string) null, (Texture) null), false, new GenericMenu.MenuFunction((object) this, __methodptr(\u003COptionsGUI\u003Em__E)));
GenericMenu genericMenu2 = menu;
GUIContent guiContent2 = EditorGUIUtility.TrTextContent("Edit Skin", (string) null, (Texture) null);
int num2 = 0;
// ISSUE: reference to a compiler-generated field
if (TimelineWindow.\u003C\u003Ef__am\u0024cache7 == null)
{
// ISSUE: reference to a compiler-generated field
// ISSUE: method pointer
TimelineWindow.\u003C\u003Ef__am\u0024cache7 = new GenericMenu.MenuFunction((object) null, __methodptr(\u003COptionsGUI\u003Em__F));
}
// ISSUE: reference to a compiler-generated field
GenericMenu.MenuFunction menuFunction2 = TimelineWindow.\u003C\u003Ef__am\u0024cache7;
genericMenu2.AddItem(guiContent2, num2 != 0, menuFunction2);
// ISSUE: method pointer
menu.AddItem(EditorGUIUtility.TrTextContent("Show QuadTree Debugger", (string) null, (Texture) null), this.state.showQuadTree, new GenericMenu.MenuFunction((object) this, __methodptr(\u003COptionsGUI\u003Em__10)));
}
menu.ShowAsContext();
}
finally
{
disabledScope.Dispose();
}
}
private bool AddStandardFrameRateMenu(GenericMenu menu, string name, float value)
{
// ISSUE: object of a compiler-generated type is created
// ISSUE: variable of a compiler-generated type
TimelineWindow.\u003CAddStandardFrameRateMenu\u003Ec__AnonStorey3 menuCAnonStorey3 = new TimelineWindow.\u003CAddStandardFrameRateMenu\u003Ec__AnonStorey3();
// ISSUE: reference to a compiler-generated field
menuCAnonStorey3.value = value;
// ISSUE: reference to a compiler-generated field
menuCAnonStorey3.\u0024this = this;
// ISSUE: reference to a compiler-generated field
bool flag = this.state.editSequence.frameRate.Equals(menuCAnonStorey3.value);
// ISSUE: method pointer
// ISSUE: reference to a compiler-generated field
menu.AddItem(EditorGUIUtility.TextContent(name), flag, new GenericMenu.MenuFunction2((object) menuCAnonStorey3, __methodptr(\u003C\u003Em__0)), (object) menuCAnonStorey3.value);
return flag;
}
private void ChangeTimeCode(object obj)
{
if (obj.ToString() == "frames")
this.state.timeInFrames = true;
else
this.state.timeInFrames = false;
}
private void SequencerHeaderGUI()
{
EditorGUI.DisabledScope disabledScope;
// ISSUE: explicit reference operation
((EditorGUI.DisabledScope) @disabledScope).\u002Ector(Object.op_Equality((Object) this.state.editSequence.asset, (Object) null));
try
{
GUILayout.BeginVertical(new GUILayoutOption[0]);
this.TransportToolbarGUI();
GUILayoutOption[] guiLayoutOptionArray = new GUILayoutOption[1];
int index = 0;
Rect sequenceHeaderBounds = this.sequenceHeaderBounds;
// ISSUE: explicit reference operation
GUILayoutOption guiLayoutOption = GUILayout.Width(((Rect) @sequenceHeaderBounds).get_width());
guiLayoutOptionArray[index] = guiLayoutOption;
GUILayout.BeginHorizontal(guiLayoutOptionArray);
if (Object.op_Inequality((Object) this.state.editSequence.asset, (Object) null))
{
GUILayout.Space(DirectorStyles.kBaseIndent);
this.AddButtonGUI();
GUILayout.FlexibleSpace();
TimelineWindow.EditModeToolbarGUI();
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
}
finally
{
disabledScope.Dispose();
}
}
private void TransportToolbarGUI()
{
GUIStyle toolbarButton = EditorStyles.get_toolbarButton();
GUILayoutOption[] guiLayoutOptionArray = new GUILayoutOption[1];
int index = 0;
Rect sequenceHeaderBounds = this.sequenceHeaderBounds;
// ISSUE: explicit reference operation
GUILayoutOption guiLayoutOption = GUILayout.Width(((Rect) @sequenceHeaderBounds).get_width());
guiLayoutOptionArray[index] = guiLayoutOption;
GUILayout.BeginHorizontal(toolbarButton, guiLayoutOptionArray);
EditorGUI.DisabledScope disabledScope1;
// ISSUE: explicit reference operation
((EditorGUI.DisabledScope) @disabledScope1).\u002Ector(this.currentMode.ToolbarState(this.state) == TimelineModeGUIState.Disabled);
try
{
EditorGUI.DisabledScope disabledScope2;
// ISSUE: explicit reference operation
((EditorGUI.DisabledScope) @disabledScope2).\u002Ector(Application.get_isPlaying());
try
{
this.PreviewModeButtonGUI();
}
finally
{
disabledScope2.Dispose();
}
this.GotoBeginingSequenceGUI();
this.PreviousEventButtonGUI();
this.PlayButtonGUI();
this.NextEventButtonGUI();
this.GotoEndSequenceGUI();
GUILayout.Space(10f);
this.PlayRangeButtonGUI();
GUILayout.FlexibleSpace();
this.TimeCodeGUI();
this.ReferenceTimeGUI();
}
finally
{
disabledScope1.Dispose();
}
GUILayout.EndHorizontal();
}
private void PreviewModeButtonGUI()
{
EditorGUI.BeginChangeCheck();
bool flag = GUILayout.Toggle(this.state.previewMode, DirectorStyles.previewContent, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]);
if (!EditorGUI.EndChangeCheck())
return;
if (!flag)
this.state.SetPlaying(false);
this.state.previewMode = flag;
if (flag && this.state.previewMode)
this.state.rebuildGraph = true;
}
private void GotoBeginingSequenceGUI()
{
if (!GUILayout.Button(DirectorStyles.gotoBeginingContent, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
return;
this.state.editSequence.time = 0.0;
this.state.EnsurePlayHeadIsVisible();
}
private void PlayButtonGUIEditor()
{
EditorGUI.BeginChangeCheck();
bool start = GUILayout.Toggle(this.state.playing, DirectorStyles.playContent, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]);
if (!EditorGUI.EndChangeCheck())
return;
this.state.SetPlaying(start);
}
private void PlayButtonGUIPlayMode()
{
bool flag = Object.op_Inequality((Object) this.state.masterSequence.director, (Object) null) && ((Behaviour) this.state.masterSequence.director).get_isActiveAndEnabled();
EditorGUI.DisabledScope disabledScope;
// ISSUE: explicit reference operation
((EditorGUI.DisabledScope) @disabledScope).\u002Ector(!flag);
try
{
this.PlayButtonGUIEditor();
}
finally
{
disabledScope.Dispose();
}
}
private void PlayButtonGUI()
{
if (!Application.get_isPlaying())
this.PlayButtonGUIEditor();
else
this.PlayButtonGUIPlayMode();
}
private void NextEventButtonGUI()
{
if (!GUILayout.Button(DirectorStyles.nextFrameContent, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
return;
++this.state.referenceSequence.frame;
}
private void PreviousEventButtonGUI()
{
if (!GUILayout.Button(DirectorStyles.previousFrameContent, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
return;
--this.state.referenceSequence.frame;
}
private void GotoEndSequenceGUI()
{
if (!GUILayout.Button(DirectorStyles.gotoEndContent, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]))
return;
this.state.editSequence.time = ((PlayableAsset) this.state.editSequence.asset).get_duration();
this.state.EnsurePlayHeadIsVisible();
}
private void PlayRangeButtonGUI()
{
EditorGUI.DisabledScope disabledScope;
// ISSUE: explicit reference operation
((EditorGUI.DisabledScope) @disabledScope).\u002Ector(EditorApplication.get_isPlaying() || this.state.IsEditingASubTimeline());
try
{
this.state.playRangeEnabled = GUILayout.Toggle(this.state.playRangeEnabled, DirectorStyles.Instance.playrangeContent, EditorStyles.get_toolbarButton(), new GUILayoutOption[0]);
}
finally
{
disabledScope.Dispose();
}
}
private void AddButtonGUI()
{
if (this.currentMode.trackOptionsState.newButton == TimelineModeGUIState.Hidden)
return;
EditorGUI.DisabledScope disabledScope;
// ISSUE: explicit reference operation
((EditorGUI.DisabledScope) @disabledScope).\u002Ector(this.currentMode.trackOptionsState.newButton == TimelineModeGUIState.Disabled);
try
{
if (!EditorGUILayout.DropdownButton(DirectorStyles.newContent, (FocusType) 2, GUIStyle.op_Implicit("Dropdown"), new GUILayoutOption[0]))
return;
TrackAsset parentTrack = (TrackAsset) null;
List<TrackAsset> list = Enumerable.ToList<TrackAsset>(SelectionManager.SelectedTracks());
if (list.Count == 1)
{
parentTrack = (TrackAsset) (list[0] as GroupTrack);
if (Object.op_Inequality((Object) parentTrack, (Object) null) && parentTrack.get_lockedInHierarchy())
parentTrack = (TrackAsset) null;
}
this.ShowNewTracksContextMenu(parentTrack);
}
finally
{
disabledScope.Dispose();
}
}
private static void EditModeToolbarGUI()
{
EditMode.EditType editType1 = EditMode.editType;
TimelineWindow.k_EditModes[0] = editType1 != EditMode.EditType.Mix ? DirectorStyles.mixOff : DirectorStyles.mixOn;
TimelineWindow.k_EditModes[1] = editType1 != EditMode.EditType.Ripple ? DirectorStyles.rippleOff : DirectorStyles.rippleOn;
TimelineWindow.k_EditModes[2] = editType1 != EditMode.EditType.Replace ? DirectorStyles.replaceOff : DirectorStyles.replaceOn;
EditMode.EditType editType2 = (EditMode.EditType) GUILayout.Toolbar((int) editType1, TimelineWindow.k_EditModes, DirectorStyles.Instance.editModesToolbar, new GUILayoutOption[0]);
if (editType2 == editType1)
return;
EditMode.editType = editType2;
}
private void TimeCodeGUI()
{
EditorGUI.BeginChangeCheck();
string str = !Object.op_Inequality((Object) this.state.editSequence.asset, (Object) null) ? "0" : TimeReferenceUtility.ToTimeString(this.state.editSequence.time, "F1");
int num1 = 0;
double num2 = 16.0;
GUIStyle toolbarTextField = EditorStyles.get_toolbarTextField();
GUILayoutOption[] guiLayoutOptionArray = new GUILayoutOption[1];
int index = 0;
GUILayoutOption guiLayoutOption = GUILayout.MinWidth(28f);
guiLayoutOptionArray[index] = guiLayoutOption;
Rect controlRect = EditorGUILayout.GetControlRect(num1 != 0, (float) num2, toolbarTextField, guiLayoutOptionArray);
int controlId = GUIUtility.GetControlID("RenameFieldTextField".GetHashCode(), (FocusType) 2, controlRect);
string timeString = EditorGUI.DelayedTextFieldInternal(controlRect, controlId, (GUIContent) GUIContent.none, str, (string) null, EditorStyles.get_toolbarTextField());
if (!EditorGUI.EndChangeCheck())
return;
this.state.editSequence.time = TimeReferenceUtility.FromTimeString(timeString);
}
private void ReferenceTimeGUI()
{
EditorGUI.BeginChangeCheck();
int num1 = 0;
double num2 = 16.0;
GUIStyle toolbarButton = EditorStyles.get_toolbarButton();
GUILayoutOption[] guiLayoutOptionArray = new GUILayoutOption[1];
int index = 0;
GUILayoutOption guiLayoutOption = GUILayout.Width(50f);
guiLayoutOptionArray[index] = guiLayoutOption;
this.state.timeReferenceMode = (TimeReferenceMode) EditorGUI.CycleButton(EditorGUILayout.GetControlRect(num1 != 0, (float) num2, toolbarButton, guiLayoutOptionArray), (int) this.state.timeReferenceMode, TimelineWindow.k_TimeReferenceGUIContents, EditorStyles.get_toolbarButton());
if (!EditorGUI.EndChangeCheck())
return;
this.OnTimeReferenceModeChanged();
}
private void OnTimeReferenceModeChanged()
{
this.m_TimeAreaDirty = true;
this.InitTimeAreaFrameRate();
this.SyncTimeAreaShownRange();
foreach (EditorWindow editorWindow in InspectorWindow.GetAllInspectorWindows())
editorWindow.Repaint();
}
private void InitializeManipulators()
{
this.m_PreTreeViewControl.AddManipulator((Manipulator) new TimelinePanManipulator());
this.m_PreTreeViewControl.AddManipulator((Manipulator) new InlineCurveResize());
this.m_PreTreeViewControl.AddManipulator((Manipulator) new TrackZoom());
this.m_PreTreeViewControl.AddManipulator((Manipulator) new Jog());
this.m_PreTreeViewControl.AddManipulator((Manipulator) TimelineZoomManipulator.Instance);
this.m_PreTreeViewControl.AddManipulator((Manipulator) new ClipContextMenu());
this.m_PreTreeViewControl.AddManipulator((Manipulator) new TrimClip());
this.m_PreTreeViewControl.AddManipulator((Manipulator) new SelectAndMoveClip());
this.m_PreTreeViewControl.AddManipulator((Manipulator) new TrackDoubleClick());
this.m_PreTreeViewControl.AddManipulator((Manipulator) new DrillIntoClip());
this.m_PreTreeViewControl.AddManipulator((Manipulator) new ClipActionsShortcutManipulator());
this.m_PostTreeViewControl.AddManipulator((Manipulator) new TimeAreaContextMenu());
this.m_PostTreeViewControl.AddManipulator((Manipulator) new TrackShortcutManipulator());
this.m_PostTreeViewControl.AddManipulator((Manipulator) new TimelineShortcutManipulator());
this.m_PostTreeViewControl.AddManipulator((Manipulator) new ClearSelection());
}
private void PlayRangeGUI(TimelineWindow.TimelineItemArea area)
{
if (!this.currentMode.ShouldShowPlayRange(this.state) || this.treeView == null || Object.op_Inequality((Object) this.state.masterSequence.asset, (Object) null) && !Enumerable.Any<TrackAsset>(this.state.masterSequence.asset.GetRootTracks()))
return;
if (this.m_PlayRangeStart == null)
{
this.m_PlayRangeStart = new TimeAreaItem(TimelineWindow.styles.playTimeRangeStart, new Action<double>(this.OnTrackHeadMinSelectDrag));
Vector2 vector2;
// ISSUE: explicit reference operation
((Vector2) @vector2).\u002Ector(-2f, 0.0f);
this.m_PlayRangeStart.boundOffset = vector2;
}
if (this.m_PlayRangeEnd == null)
{
this.m_PlayRangeEnd = new TimeAreaItem(TimelineWindow.styles.playTimeRangeEnd, new Action<double>(this.OnTrackHeadMaxSelectDrag));
Vector2 vector2;
// ISSUE: explicit reference operation
((Vector2) @vector2).\u002Ector(2f, 0.0f);
this.m_PlayRangeEnd.boundOffset = vector2;
}
if (area == TimelineWindow.TimelineItemArea.Header)
{
this.DrawPlayRange(true, false);
}
else
{
if (area != TimelineWindow.TimelineItemArea.Lines)
return;
this.DrawPlayRange(false, true);
}
}
private void DrawPlayRange(bool drawHeads, bool drawLines)
{
Rect timeAreaRect1 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rect& local = @timeAreaRect1;
Rect clientArea = this.clientArea;
// ISSUE: explicit reference operation
double num1 = (double) ((Rect) @clientArea).get_height();
((Rect) local).set_height((float) num1);
this.m_PlayRangeEnd.HandleManipulatorsEvents(this.state);
this.m_PlayRangeStart.HandleManipulatorsEvents(this.state);
if (Vector2.op_Equality(this.state.playRange, TimelineAssetViewModel.NoPlayRangeSet))
{
float num2 = 0.01f;
double num3 = 0.0;
WindowState state1 = this.state;
Rect timeAreaRect2 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num4 = (double) ((Rect) @timeAreaRect2).get_xMin();
double num5 = (double) state1.PixelToTime((float) num4);
float num6 = Mathf.Max((float) num3, (float) num5);
double duration = this.state.masterSequence.duration;
WindowState state2 = this.state;
Rect timeAreaRect3 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num7 = (double) ((Rect) @timeAreaRect3).get_xMax();
double num8 = (double) state2.PixelToTime((float) num7);
float num9 = Mathf.Min((float) duration, (float) num8);
if ((double) Mathf.Abs(num9 - num6) <= (double) num2)
{
this.state.playRange = new Vector2(num6, num9);
return;
}
float num10 = (float) (((double) num9 - (double) num6) * 0.25 / 2.0);
float num11 = num6 + num10;
float num12 = num9 - num10;
if ((double) num12 < (double) num11)
{
float num13 = num11;
num11 = num12;
num12 = num13;
}
if ((double) Mathf.Abs(num12 - num11) < (double) num2)
{
if ((double) num11 - (double) num2 > 0.0)
num11 -= num2;
else if ((double) num12 + (double) num2 < this.state.masterSequence.duration)
num12 += num2;
}
this.state.playRange = new Vector2(num11, num12);
}
this.m_PlayRangeStart.drawHead = drawHeads;
this.m_PlayRangeStart.drawLine = drawLines;
this.m_PlayRangeEnd.drawHead = drawHeads;
this.m_PlayRangeEnd.drawLine = drawLines;
Vector2 playRange = this.state.playRange;
this.m_PlayRangeStart.Draw(timeAreaRect1, this.state, (double) playRange.x);
this.m_PlayRangeEnd.Draw(timeAreaRect1, this.state, (double) playRange.y);
if (!this.state.playRangeEnabled || this.m_PlayHead == null)
return;
double num14 = (double) this.state.TimeToPixel((double) playRange.x);
Rect timeAreaRect4 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num15 = (double) ((Rect) @timeAreaRect4).get_xMin();
Rect timeAreaRect5 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num16 = (double) ((Rect) @timeAreaRect5).get_xMax();
double num17 = (double) Mathf.Clamp((float) num14, (float) num15, (float) num16);
Rect bounds = this.m_PlayHead.bounds;
// ISSUE: explicit reference operation
double num18 = (double) ((Rect) @bounds).get_yMax();
double num19 = (double) this.state.TimeToPixel((double) playRange.y);
Rect timeAreaRect6 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num20 = (double) ((Rect) @timeAreaRect6).get_xMin();
Rect timeAreaRect7 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num21 = (double) ((Rect) @timeAreaRect7).get_xMax();
double num22 = (double) Mathf.Clamp((float) num19, (float) num20, (float) num21);
// ISSUE: explicit reference operation
double num23 = (double) ((Rect) @timeAreaRect1).get_height();
Rect timeAreaRect8 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num24 = (double) ((Rect) @timeAreaRect8).get_height();
double num25 = num23 + num24;
Rect rect = Rect.MinMaxRect((float) num17, (float) num18, (float) num22, (float) num25);
EditorGUI.DrawRect(rect, DirectorStyles.Instance.customSkin.colorRange);
// ISSUE: explicit reference operation
((Rect) @rect).set_height(3f);
EditorGUI.DrawRect(rect, Color.get_white());
}
private void OnTrackHeadMinSelectDrag(double newTime)
{
Vector2 playRange = this.state.playRange;
playRange.x = (__Null) newTime;
this.state.playRange = playRange;
this.m_PlayRangeStart.showTooltip = true;
}
private void OnTrackHeadMaxSelectDrag(double newTime)
{
Vector2 playRange = this.state.playRange;
playRange.y = (__Null) newTime;
this.state.playRange = playRange;
this.m_PlayRangeEnd.showTooltip = true;
}
private void OnPreviewPlayModeChanged(bool isPlaying)
{
if (EditorApplication.get_isPlaying())
return;
if (isPlaying)
{
this.PreparePreviewPlay();
// ISSUE: method pointer
EditorApplication.update = (__Null) Delegate.Combine((Delegate) EditorApplication.update, (Delegate) new EditorApplication.CallbackFunction((object) this, __methodptr(OnPreviewPlay)));
}
else
{
// ISSUE: method pointer
EditorApplication.update = (__Null) Delegate.Remove((Delegate) EditorApplication.update, (Delegate) new EditorApplication.CallbackFunction((object) this, __methodptr(OnPreviewPlay)));
}
}
private void PreparePreviewPlay()
{
if (this.state == null || Object.op_Equality((Object) this.state.masterSequence.asset, (Object) null) || (Object.op_Equality((Object) this.state.masterSequence.director, (Object) null) || !this.state.playRangeEnabled) || this.state.isJogging)
return;
this.EnsurePlayRangeIsRespected();
}
internal void OnPreviewPlay()
{
if (this.state == null || Object.op_Equality((Object) this.state.masterSequence.asset, (Object) null) || Object.op_Equality((Object) this.state.masterSequence.director, (Object) null))
return;
PlayableDirector director = this.state.masterSequence.director;
if (director.get_timeUpdateMode() == 3)
{
this.Repaint();
}
else
{
if (this.state.isJogging)
this.ApplyJog();
else if (this.state.playRangeEnabled)
this.EnsurePlayRangeIsRespected();
if (director.get_extrapolationMode() == 2)
{
PlayableGraph playableGraph1 = director.get_playableGraph();
// ISSUE: explicit reference operation
if (((PlayableGraph) @playableGraph1).IsValid())
{
PlayableGraph playableGraph2 = director.get_playableGraph();
// ISSUE: explicit reference operation
if (((PlayableGraph) @playableGraph2).IsDone())
{
this.state.masterSequence.time = 0.0;
this.state.Pause();
}
}
}
this.Repaint();
AudioMixerWindow.RepaintAudioMixerWindow();
}
}
private void ApplyJog()
{
this.state.masterSequence.time = Math.Max(0.0, Math.Min(this.state.masterSequence.duration, this.state.masterSequence.time + (double) this.state.playbackSpeed));
}
private void EnsurePlayRangeIsRespected()
{
Vector2 playRange = this.state.playRange;
double time = this.state.masterSequence.time;
if (time <= (double) playRange.y && time >= (double) playRange.x)
return;
this.state.masterSequence.time = (double) playRange.x;
}
private void OnSelectionChange()
{
this.RefreshSelection(false);
}
private void RefreshSelection(bool forceRebuild)
{
if (this.locked || this.state != null && this.state.recording)
{
this.RestoreLastSelection(forceRebuild);
}
else
{
Object object1 = (Object) (Selection.get_activeObject() as TimelineAsset);
if (Object.op_Inequality(object1, (Object) null))
{
this.SetCurrentSelection(object1);
}
else
{
Object object2 = (Object) Selection.get_activeGameObject();
if (Object.op_Inequality(object2, (Object) null) && !TimelineUtility.IsPrefabOrAsset(object2))
this.SetCurrentSelection(object2);
else
this.RestoreLastSelection(forceRebuild);
}
}
}
private void RestoreLastSelection(bool forceRebuild)
{
this.state.SetCurrentSequencePath(this.m_SequencePath, forceRebuild);
}
private void SetCurrentSelection(Object obj)
{
GameObject gameObject = obj as GameObject;
if (Object.op_Inequality((Object) gameObject, (Object) null))
{
this.SetCurrentTimeline(TimelineUtility.GetDirectorComponentForGameObject(gameObject), (TimelineClip) null);
}
else
{
TimelineAsset seq = obj as TimelineAsset;
if (Object.op_Inequality((Object) seq, (Object) null))
this.SetCurrentTimeline(seq);
}
this.Repaint();
}
private void InitializeStateChange()
{
this.state.OnPlayStateChange += new Action<bool>(this.OnPreviewPlayModeChanged);
this.state.OnDirtyStampChange += (Action) (() =>
{
this.state.UpdateRecordingState();
if (this.treeView == null || !Object.op_Inequality((Object) this.state.editSequence.asset, (Object) null))
return;
this.treeView.Reload();
});
this.state.OnRebuildGraphChange += (Action) (() =>
{
if (this.state.rebuildGraph || this.treeView == null)
return;
List<TimelineTrackBaseGUI> allTrackGuis = this.treeView.allTrackGuis;
if (allTrackGuis != null)
{
for (int index = 0; index < allTrackGuis.Count; ++index)
allTrackGuis[index].OnGraphRebuilt();
}
});
this.state.OnTimeChange += (Action) (() =>
{
if (!EditorApplication.get_isPlaying())
{
this.state.UpdateRecordingState();
EditorApplication.SetSceneRepaintDirty();
}
this.state.Evaluate();
InspectorWindow.RepaintAllInspectors();
});
this.state.OnRecordingChange += (Action) (() =>
{
if (this.state.recording)
return;
TrackAssetRecordingExtensions.ClearRecordingState();
});
this.state.OnBeforeSequenceChange += new Action(this.OnBeforeSequenceChange);
this.state.OnAfterSequenceChange += new Action(this.OnAfterSequenceChange);
}
private void InitializeTimeArea()
{
if (this.m_TimeArea != null)
return;
TimelineWindow.TimelineTimeArea timelineTimeArea = new TimelineWindow.TimelineTimeArea(this.state, false);
((ZoomableArea) timelineTimeArea).set_hRangeLocked(false);
((ZoomableArea) timelineTimeArea).set_vRangeLocked(true);
((ZoomableArea) timelineTimeArea).set_margin(10f);
((ZoomableArea) timelineTimeArea).set_scaleWithWindow(true);
((ZoomableArea) timelineTimeArea).set_hSlider(true);
((ZoomableArea) timelineTimeArea).set_vSlider(false);
((ZoomableArea) timelineTimeArea).set_hBaseRangeMin(0.0f);
((ZoomableArea) timelineTimeArea).set_hBaseRangeMax(WindowState.kMaxShownTime);
((ZoomableArea) timelineTimeArea).set_hRangeMin(0.0f);
((ZoomableArea) timelineTimeArea).set_hScaleMax(TimelineWindow.k_MaxTimeAreaScaling);
((ZoomableArea) timelineTimeArea).set_rect(this.state.timeAreaRect);
this.m_TimeArea = timelineTimeArea;
this.m_TimeAreaDirty = true;
this.InitTimeAreaFrameRate();
this.SyncTimeAreaShownRange();
}
private void TimelineGUI()
{
if (!this.currentMode.ShouldShowTimeArea(this.state))
return;
Rect timeAreaRect = this.state.timeAreaRect;
TimelineWindow.TimelineTimeArea timelineTimeArea = this.m_TimeArea;
// ISSUE: explicit reference operation
double num1 = (double) ((Rect) @timeAreaRect).get_x();
// ISSUE: explicit reference operation
double num2 = (double) ((Rect) @timeAreaRect).get_y();
// ISSUE: explicit reference operation
double num3 = (double) ((Rect) @timeAreaRect).get_width();
Rect clientArea = this.clientArea;
// ISSUE: explicit reference operation
// ISSUE: explicit reference operation
double num4 = (double) ((Rect) @clientArea).get_height() - (double) ((Rect) @timeAreaRect).get_y();
Rect rect = new Rect((float) num1, (float) num2, (float) num3, (float) num4);
((ZoomableArea) timelineTimeArea).set_rect(rect);
if ((double) this.m_LastFrameRate != (double) this.state.referenceSequence.frameRate)
this.InitTimeAreaFrameRate();
this.SyncTimeAreaShownRange();
((ZoomableArea) this.m_TimeArea).BeginViewGUI();
this.m_TimeArea.TimeRuler(timeAreaRect, this.state.referenceSequence.frameRate, true, false, 1f, !this.state.timeInFrames ? (TimeArea.TimeFormat) 1 : (TimeArea.TimeFormat) 2);
((ZoomableArea) this.m_TimeArea).EndViewGUI();
}
private void InitTimeAreaFrameRate()
{
this.m_LastFrameRate = this.state.referenceSequence.frameRate;
this.m_TimeArea.get_hTicks().SetTickModulosForFrameRate(this.m_LastFrameRate);
}
private void SyncTimeAreaShownRange()
{
Vector2 timeAreaShownRange = this.state.timeAreaShownRange;
// ISSUE: variable of the null type
__Null local1 = timeAreaShownRange.x;
Rect shownArea1 = ((ZoomableArea) this.m_TimeArea).get_shownArea();
// ISSUE: explicit reference operation
double num1 = (double) ((Rect) @shownArea1).get_x();
if (Mathf.Approximately((float) local1, (float) num1))
{
// ISSUE: variable of the null type
__Null local2 = timeAreaShownRange.y;
Rect shownArea2 = ((ZoomableArea) this.m_TimeArea).get_shownArea();
// ISSUE: explicit reference operation
double num2 = (double) ((Rect) @shownArea2).get_xMax();
if (Mathf.Approximately((float) local2, (float) num2))
goto label_6;
}
if (this.m_TimeAreaDirty)
{
((ZoomableArea) this.m_TimeArea).SetShownHRange((float) timeAreaShownRange.x, (float) timeAreaShownRange.y);
this.m_TimeAreaDirty = false;
}
else
this.state.TimeAreaChanged();
label_6:
((ZoomableArea) this.m_TimeArea).set_hBaseRangeMax((float) this.state.editSequence.duration);
}
private void TimeCursorGUI(TimelineWindow.TimelineItemArea area)
{
this.DrawTimeOnSlider();
if (!this.CanDrawTimeCursor(area))
return;
if (this.m_PlayHead == null)
{
this.m_PlayHead = new TimeAreaItem(TimelineWindow.styles.timeCursor, new Action<double>(this.OnTrackHeadDrag));
this.m_PlayHead.AddManipulator((Manipulator) new PlayheadContextMenu(this.m_PlayHead));
}
bool drawHead = area == TimelineWindow.TimelineItemArea.Header;
this.DrawTimeCursor(drawHead, !drawHead);
}
private bool CanDrawTimeCursor(TimelineWindow.TimelineItemArea area)
{
return this.currentMode.ShouldShowTimeCursor(this.state) && (this.treeView != null && !Object.op_Equality((Object) this.state.editSequence.asset, (Object) null) && (!Object.op_Inequality((Object) this.state.editSequence.asset, (Object) null) || !this.state.IsEditingAnEmptyTimeline())) && (area != TimelineWindow.TimelineItemArea.Lines || this.state.TimeIsInRange((float) this.state.editSequence.time));
}
private void DrawTimeOnSlider()
{
if (!this.currentMode.ShouldShowTimeCursor(this.state))
return;
this.m_TimeArea.DrawTimeOnSlider((float) this.state.editSequence.time, Color.op_Multiply(TimelineWindow.styles.timeCursor.get_normal().get_textColor(), !EditorGUIUtility.get_isProSkin() ? 0.9f : 0.7f), (float) this.state.editSequence.duration, DirectorStyles.kDurationGuiThickness, 0.0f);
}
private void DrawTimeCursor(bool drawHead, bool drawline)
{
this.m_PlayHead.HandleManipulatorsEvents(this.state);
if (Event.get_current().get_type() == null && Event.get_current().get_button() == 0)
{
Rect timeAreaRect = this.state.timeAreaRect;
// ISSUE: explicit reference operation
if (((Rect) @timeAreaRect).Contains(Event.get_current().get_mousePosition()))
{
this.state.SetPlaying(false);
this.m_PlayHead.HandleManipulatorsEvents(this.state);
this.state.editSequence.time = Math.Max(0.0, this.state.GetSnappedTimeAtMousePosition(Event.get_current().get_mousePosition()));
}
}
this.state.isClipSnapping = false;
this.m_PlayHead.drawLine = drawline;
this.m_PlayHead.drawHead = drawHead;
this.m_PlayHead.Draw(this.treeviewBounds, this.state, this.state.editSequence.time);
}
private void OnTrackHeadDrag(double newTime)
{
this.state.editSequence.time = Math.Max(0.0, newTime);
this.m_PlayHead.showTooltip = true;
}
private void TracksGUI(Rect clientRect, WindowState state, TimelineModeGUIState trackState)
{
if (Event.get_current().get_type() == 7 && this.treeView != null)
{
Rect newSize;
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rect& local1 = @newSize;
double num1 = 0.0;
double num2 = 0.0;
Rect position = this.get_position();
// ISSUE: explicit reference operation
double num3 = (double) ((Rect) @position).get_width();
// ISSUE: variable of the null type
__Null local2 = this.treeView.contentSize.y;
((Rect) local1).\u002Ector((float) num1, (float) num2, (float) num3, (float) local2);
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rect& local3 = @newSize;
double num4 = (double) ((Rect) local3).get_xMin() + (double) state.sequencerHeaderWidth;
((Rect) local3).set_xMin((float) num4);
Vector2 newScreenSpaceOffset;
// ISSUE: explicit reference operation
((Vector2) @newScreenSpaceOffset).\u002Ector(0.0f, (float) (42.0 - this.treeView.scrollPosition.y));
state.spacePartitioner.Clear(newSize, newScreenSpaceOffset);
}
if (state.IsEditingASubTimeline() && !state.IsEditingAnEmptyTimeline())
{
Rect rect1 = clientRect;
// ISSUE: explicit reference operation
((Rect) @rect1).set_width(state.sequencerHeaderWidth);
EditorGUI.DrawRect(rect1, DirectorStyles.Instance.customSkin.colorSequenceBackground);
Rect rect2 = clientRect;
// ISSUE: explicit reference operation
// ISSUE: explicit reference operation
((Rect) @rect2).set_xMin(((Rect) @rect1).get_xMax());
EditorGUI.DrawRect(rect2, DirectorStyles.Instance.customSkin.colorSubSequenceBackground);
}
else
EditorGUI.DrawRect(clientRect, DirectorStyles.Instance.customSkin.colorSequenceBackground);
if (!state.IsEditingAnEmptyTimeline())
this.m_TimeArea.DrawMajorTicks(this.tracksBounds, state.referenceSequence.frameRate);
GUILayout.BeginVertical(new GUILayoutOption[0]);
GUILayout.Space(5f);
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
if (Object.op_Equality((Object) this.state.editSequence.asset, (Object) null))
this.DrawNoSequenceGUI(state);
else if (state.IsEditingAnEmptyTimeline())
this.DrawEmptySequenceGUI(clientRect, trackState);
else
this.DrawTracksGUI(clientRect, trackState);
GUILayout.EndHorizontal();
GUILayout.EndVertical();
this.DrawShadowUnderTimeline();
}
private void DrawShadowUnderTimeline()
{
Rect timeAreaRect1 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
((Rect) @timeAreaRect1).set_xMin(0.0f);
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
Rect& local = @timeAreaRect1;
Rect timeAreaRect2 = this.state.timeAreaRect;
// ISSUE: explicit reference operation
double num = (double) ((Rect) @timeAreaRect2).get_yMax();
((Rect) local).set_yMin((float) num);
// ISSUE: explicit reference operation
((Rect) @timeAreaRect1).set_height(15f);
GUI.Box(timeAreaRect1, (GUIContent) GUIContent.none, DirectorStyles.Instance.bottomShadow);
}
private void DrawEmptySequenceGUI(Rect clientRect, TimelineModeGUIState trackState)
{
GUILayout.BeginVertical(new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
this.DrawTracksGUI(clientRect, trackState);
GUILayout.Label(DirectorStyles.emptyTimelineMessage, new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
GUILayout.EndVertical();
}
private void DrawNoSequenceGUI(WindowState windowState)
{
// ISSUE: unable to decompile the method.
}
private void DrawTracksGUI(Rect clientRect, TimelineModeGUIState trackState)
{
GUILayoutOption[] guiLayoutOptionArray = new GUILayoutOption[1];
int index = 0;
// ISSUE: explicit reference operation
GUILayoutOption guiLayoutOption = GUILayout.Height(((Rect) @clientRect).get_height());
guiLayoutOptionArray[index] = guiLayoutOption;
GUILayout.BeginVertical(guiLayoutOptionArray);
EditorGUI.DisabledScope disabledScope;
// ISSUE: explicit reference operation
((EditorGUI.DisabledScope) @disabledScope).\u002Ector(trackState == TimelineModeGUIState.Disabled);
try
{
if (this.treeView != null)
this.treeView.OnGUI(clientRect);
}
finally
{
disabledScope.Dispose();
}
GUILayout.EndVertical();
}
[Serializable]
public class TimelineWindowPreferences
{
public bool frameSnap = true;
public bool edgeSnaps = true;
public bool muteAudioScrub = true;
public bool playRangeLoopMode = true;
public EditMode.EditType editType = EditMode.EditType.Mix;
public TimeReferenceMode timeReferenceMode = TimeReferenceMode.Local;
}
internal class DoCreateTimeline : EndNameEditAction
{
public DoCreateTimeline()
{
base.\u002Ector();
}
public virtual void Action(int instanceId, string pathName, string resourceFile)
{
TimelineAsset timelineAsset = (TimelineAsset) ScriptableObject.CreateInstance<TimelineAsset>();
AssetDatabase.CreateAsset((Object) timelineAsset, pathName);
ProjectWindowUtil.ShowCreatedAsset((Object) timelineAsset);
}
}
private class SequenceMenuNameFormater
{
private Dictionary<int, int> m_UniqueItem = new Dictionary<int, int>();
public string Format(string text)
{
int hashCode = text.GetHashCode();
int num1 = 0;
if (this.m_UniqueItem.ContainsKey(hashCode))
{
int num2 = this.m_UniqueItem[hashCode] + 1;
this.m_UniqueItem[hashCode] = num2;
return string.Format("{0}{1}", (object) text, (object) num2);
}
this.m_UniqueItem.Add(hashCode, num1);
return text;
}
}
private enum TimelineItemArea
{
Header,
Lines,
}
private class PlayableLookup
{
private readonly Dictionary<AnimationClip, Playable> m_AnimationClipToPlayable = new Dictionary<AnimationClip, Playable>(10);
private const int initialDictionarySize = 10;
public void UpdatePlayableLookup(TimelineClip clip, GameObject go, Playable p)
{
PlayableDirector playableDirector = (PlayableDirector) go.GetComponent<PlayableDirector>();
PlayableDirector director = TimelineWindow.instance.state.editSequence.director;
if (!Object.op_Inequality((Object) clip.get_curves(), (Object) null) || !Object.op_Inequality((Object) playableDirector, (Object) null) || (!Object.op_Equality((Object) playableDirector, (Object) director) || !Object.op_Equality((Object) clip.get_parentTrack().get_timelineAsset(), (Object) TimelineWindow.instance.state.editSequence.asset)))
return;
this.m_AnimationClipToPlayable[clip.get_curves()] = p;
}
public bool GetPlayableFromAnimClip(AnimationClip clip, out Playable p)
{
if (!Object.op_Equality((Object) clip, (Object) null))
return this.m_AnimationClipToPlayable.TryGetValue(clip, out p);
p = Playable.get_Null();
return false;
}
public void ClearPlayableLookup()
{
this.m_AnimationClipToPlayable.Clear();
}
}
internal static class Styles
{
public static string DurationModeText = L10n.Tr("Duration Mode/{0}");
}
private class TimelineTimeArea : TimeArea
{
private readonly WindowState m_State;
public TimelineTimeArea(WindowState state, bool minimalGUI)
{
this.\u002Ector(minimalGUI);
this.m_State = state;
}
public virtual string FormatTickTime(float time, float frameRate, TimeArea.TimeFormat timeFormat)
{
time = this.m_State.timeReferenceMode != TimeReferenceMode.Global ? time : (float) this.m_State.editSequence.ToGlobalTime((double) time);
return this.FormatTime(time, frameRate, timeFormat);
}
}
}
}