public void OnGUI()
{
AnimationWindowSelectionItem selectedItem = this.state.selectedItem;
if ((selectedItem != null) && selectedItem.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 newClip = AnimationWindowUtility.CreateNewClip(selectedItem.rootGameObject.name);
if (newClip != null)
{
AnimationWindowUtility.AddClipToAnimationPlayerComponent(this.state.activeAnimationPlayer, newClip);
this.state.selection.UpdateClip(this.state.selectedItem, newClip);
this.state.currentTime = 0f;
this.state.ResampleAnimation();
GUIUtility.ExitGUI();
}
}
else
{
this.state.selection.UpdateClip(this.state.selectedItem, this.IndexToClip(this.selectedIndex));
this.state.currentTime = 0f;
this.state.ResampleAnimation();
}
}
}
}
}