Ejemplo n.º 1
0
        private void OnEnable()
        {
            AudioBlender blender = (AudioBlender)target;

            blender.EditorAwake();
            if (blender.serializeObject == null)
            {
                blender.serializeObject = CreateInstance <EditorSerializeObject>();
            }
            if (blender.serializeObject.edit && blender.serializeObject.selection >= 0 && blender.serializeObject.selection < blender.sequenceCount && editorWindow == null)
            {
                OpenEditorWindow(blender.GetSequence(blender.serializeObject.selection));
            }
            if (playIcon == null)
            {
                playIcon = ImageDB.GetImage("play.png", "Blenda/Editor/Images");
            }
            if (pauseIcon == null)
            {
                pauseIcon = ImageDB.GetImage("pause.png", "Blenda/Editor/Images");
            }
            if (stopIcon == null)
            {
                stopIcon = ImageDB.GetImage("stop.png", "Blenda/Editor/Images");
            }
            playContent             = new GUIContent(playIcon);
            pauseContent            = new GUIContent(pauseIcon);
            stopContent             = new GUIContent(stopIcon);
            Undo.undoRedoPerformed += UndoRedo;
        }
Ejemplo n.º 2
0
        void OnDisable()
        {
            Undo.undoRedoPerformed -= UndoRedo;
            AudioBlender blender = (AudioBlender)target;

            blender.serializeObject.edit = false;
        }
Ejemplo n.º 3
0
        void OnDelete(object o)
        {
            Sequence sequence = (Sequence)o;

            if (!EditorUtility.DisplayDialog("Delete Sequence", "Are you sure you want to delete sequence " + sequence.name + "?", "Yes", "No"))
            {
                return;
            }
            AudioBlender blender = (AudioBlender)target;

            Undo.RegisterCompleteObjectUndo(blender, "Delete sequence");
            blender.RemoveSequence(sequence);
            Undo.FlushUndoRecordObjects();
            Repaint();
        }
Ejemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();
            AudioBlender blender = (AudioBlender)target;

            Undo.RecordObject(blender, "Edit Audio Blender");
            blender.serializeObject.edit = editorWindow != null;
            base.OnInspectorGUI();
            EditorGUILayout.Space();
            if (Application.isPlaying)
            {
                EditorGUILayout.BeginHorizontal();
                if (BlendaEditorGUI.EditorLayoutSelectableButton(new GUIContent(playContent), true, blender.isPlaying))
                {
                    blender.Play();
                }
                if (BlendaEditorGUI.EditorLayoutSelectableButton(new GUIContent(pauseContent), true, blender.isPaused))
                {
                    blender.Pause();
                }
                if (BlendaEditorGUI.EditorLayoutSelectableButton(new GUIContent(stopContent)))
                {
                    blender.Stop();
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.Space();

            for (int i = 0; i < blender.sequenceCount; i++)
            {
                if (SequenceField(blender.GetSequence(i), blender.serializeObject.selection == i))
                {
                    Repaint();
                    renameSequence = null;
                    blender.serializeObject.selection = i;
                }
            }
            GUI.color = Color.white;
            EditorGUILayout.Space();
            if (GUILayout.Button("Add Sequence"))
            {
                blender.AddSequence("Sequence " + (blender.sequenceCount + 1));
            }
            if (EditorGUI.EndChangeCheck() && editorWindow != null)
            {
                editorWindow.Repaint();
            }
        }
Ejemplo n.º 5
0
        void UndoRedo()
        {
            AudioBlender blender = (AudioBlender)target;

            Repaint();
        }