public void OnGUI()
{
if (this.state.selection.canChangeAnimationClip)
{
string[] clipMenuContent = this.GetClipMenuContent();
EditorGUI.BeginChangeCheck();
this.selectedIndex = EditorGUILayout.Popup(this.ClipToIndex(this.state.activeAnimationClip), clipMenuContent, EditorStyles.toolbarPopup, new GUILayoutOption[0]);
if (EditorGUI.EndChangeCheck())
{
if (clipMenuContent[this.selectedIndex] == AnimationWindowStyles.createNewClip.text)
{
AnimationClip animationClip = AnimationWindowUtility.CreateNewClip(this.state.selection.rootGameObject.name);
if (animationClip)
{
AnimationWindowUtility.AddClipToAnimationPlayerComponent(this.state.activeAnimationPlayer, animationClip);
this.state.activeAnimationClip = animationClip;
}
GUIUtility.ExitGUI();
}
else
{
this.state.activeAnimationClip = this.IndexToClip(this.selectedIndex);
}
}
}
else if (this.state.activeAnimationClip != null)
{
Rect controlRect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight, AnimationWindowStyles.toolbarLabel, new GUILayoutOption[0]);
EditorGUI.LabelField(controlRect, CurveUtility.GetClipName(this.state.activeAnimationClip), AnimationWindowStyles.toolbarLabel);
}
}