예제 #1
0
        /// <summary>
        /// Display the graph window and automatically open an existing AudioBank
        /// </summary>
        /// <param name="bankToLoad"></param>
        public static void OpenAudioGraph(AudioBank bankToLoad)
        {
            AudioGraph graph = GetWindow <AudioGraph>();

            graph.titleContent = new GUIContent("Audio Graph");
            graph.audioBank    = bankToLoad;
            graph.Show();
        }
예제 #2
0
        /// <summary>
        /// Display the list of buttons to select an event
        /// </summary>
        private void DrawEventList()
        {
            this.eventListRect.height = this.position.height;
            GUILayout.BeginArea(this.eventListRect);
            this.eventListScrollPosition = EditorGUILayout.BeginScrollView(this.eventListScrollPosition);
            this.audioBank = EditorGUILayout.ObjectField(this.audioBank, typeof(AudioBank), false) as AudioBank;

            if (this.audioBank == null)
            {
                EditorGUILayout.EndScrollView();
                GUILayout.EndArea();
                return;
            }

            if (this.audioBank.EditorEvents != null)
            {
                for (int i = 0; i < this.audioBank.EditorEvents.Count; i++)
                {
                    AudioEvent tempEvent = this.audioBank.EditorEvents[i];
                    if (tempEvent == null)
                    {
                        continue;
                    }

                    if (this.selectedEvent == tempEvent)
                    {
                        GUI.color = Color.white;
                    }
                    else
                    {
                        GUI.color = this.unselectedButton;
                    }

                    if (GUILayout.Button(tempEvent.name))
                    {
                        SelectEvent(tempEvent);
                    }

                    GUI.color = Color.white;
                }
            }

            EditorGUILayout.EndScrollView();
            GUILayout.EndArea();
        }
 /// <summary>
 /// Set reference for AudioBank to pass to graph window
 /// </summary>
 private void OnEnable()
 {
     this.myTarget = (AudioBank)target;
 }