public void OnGUI_Animation() { InitGUIStyles(); EditorGUI.BeginChangeCheck(); //--[ Show Animation ]------------------------------------------ GUI.color = GUITools.White; GUITools.BeginContents(); GUILayout.Space(2); OnGUI_AnimationContent(); GUITools.EndContents(false); GUI.color = GUITools.White; //--[ Show Sequence (if anyone is selected) ]------------------------------------------ if (mCurrentSequenceIndex >= 0) { OnGUI_SequenceContent(); } if (EditorGUI.EndChangeCheck()) { mAnimation.InitTimes(mTextAnimation, true); } if (mSequence_IsDragging || mTimeLine_PlayingStartTime > 0) { /*Repaint();*/ HandleUtility.Repaint(); } }
public void OnGUI_Animations() { //GUI.color = showAnim ? new Color(1, 1, 1, 0.5f) : GUITools.White; GUI.color = GUITools.White; GUITools.BeginContents(); GUILayout.Space(2); //--[ Popup: ON ENABLE PLAY ]--------------------- EditorGUIUtility.labelWidth = 100; string[] mCurrentAnimations = new string[] { "None", "" }.Union(mTarget._AnimationSlots.Select(x => x == null ? "<empty>" : x.GetName())).ToArray(); int index = (mSerialized_OnEnable_PlayAnim.intValue < 0) ? 0 : (mSerialized_OnEnable_PlayAnim.intValue + 2); int newIndex = EditorGUILayout.Popup("On Enable Play:", index, mCurrentAnimations); if (index != newIndex) { mSerialized_OnEnable_PlayAnim.intValue = (newIndex < 2 ? -1 : newIndex - 2); } GUILayout.Space(5); EditorGUILayout.PropertyField(mSerialized_TimeSource); EditorGUILayout.PropertyField(mSerialized_OnAnimation_Finished); mAnimationsReorderableList.DoLayoutList(); GUITools.EndContents(false); GUI.color = GUITools.White; if (mAnimationsReorderableList.index >= 0) { OnGUI_AnimationSlot(); } }
void OnGUI_SequenceContent() { GUILayout.Space(10); var seq = mAnimation._Sequences[mCurrentSequenceIndex]; var changed = GUI.changed; GUI.backgroundColor = Color.blue; GUILayout.BeginVertical(EditorStyles.textArea); GUI.backgroundColor = Color.white; var boxArea = new GUIStyle("Box"); boxArea.overflow = new RectOffset(4, 4, 0, 0); GUILayout.BeginHorizontal(boxArea); GUILayout.Toggle(true, "Sequence:", EditorStyles.foldout, GUITools.DontExpandWidth); seq._Name = EditorGUILayout.TextField(seq._Name, GUILayout.ExpandWidth(true)); if (GUILayout.Button("X", EditorStyles.miniButton, GUITools.DontExpandWidth)) { mCurrentSequenceIndex = -1; } GUILayout.EndHorizontal(); GUILayout.Space(-4); GUI.backgroundColor = GUITools.DarkGray; GUILayout.BeginVertical(GUILayout.Height(1)); GUI.backgroundColor = Color.white; GUI.changed = changed; // ignore changed in the header GUITools.BeginContents(); if (mCurrentSequenceIndex >= 0) { OnGUI_Sequence(); } GUITools.EndContents(true); GUILayout.EndVertical(); }