Exemplo n.º 1
0
        public void DrawListEntry(BuddyListEntry entry)
        {
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.BeginVertical();
                {
                    //Vector2 baseposition = EditorGUILayout.GetControlRect().position;
                    _entryWidthCounter += (entry.BuddyEntry == null ? 57 : 64) + 5;
                    Vector2 baseposition = new Vector2(1, _entryWidthCounter);
                    Vector2 size         = new Vector2(20, 28);
                    Rect    upRect       = new Rect(baseposition, size);
                    Rect    downRect     = new Rect(baseposition.x, baseposition.y + size.y + 0, size.x, size.y);

                    //GUIStyle pristineButton = GUI.skin.button;
                    //GUI.skin.button.stretchHeight = true;
                    //GUI.skin.button.stretchWidth = true;
                    //GUI.skin.button.padding = new RectOffset(1,1,0,0);

                    if (GUI.Button(upRect, AudioBuddy.ArrowUp))
                    {
                        _moveUp = entry;
                    }
                    if (GUI.Button(downRect, AudioBuddy.ArrowDown))
                    {
                        _moveDown = entry;
                    }

                    //GUI.skin.button = pristineButton;
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(AudioBuddy.SubtleBG);
                {
                    EditorGUILayout.BeginHorizontal();
                    {
                        EditorGUILayout.LabelField(entry.NameInList, EditorStyles.whiteLabel);
                        if (GUILayout.Button("X"))
                        {
                            _forDelete.Add(entry);
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    DrawEntryObjectFields(entry);

                    //TODO: Adapt Speaker to work with delay
                    //entry.Delay = EditorGUILayout.FloatField("Delay",entry.Delay);

                    DrawEntryDuration(entry);
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space(5);
        }
Exemplo n.º 2
0
 public void DrawEntryDuration(BuddyListEntry entry)
 {
     EditorGUILayout.BeginHorizontal();
     {
         if (entry.BuddyEntry != null)
         {
             float _originalWidth = EditorGUIUtility.labelWidth;
             EditorGUIUtility.labelWidth = 80;
             EditorGUILayout.FloatField("Length", entry.BuddyEntry.GetDuration(), EditorStyles.helpBox);
             entry.Delay = EditorGUILayout.FloatField("Delay", entry.Delay);
             EditorGUILayout.FloatField("Timestamp", entry.Timestamp, EditorStyles.helpBox);
             EditorGUIUtility.labelWidth = _originalWidth;
         }
     }
     EditorGUILayout.EndHorizontal();
 }
Exemplo n.º 3
0
 public void DrawEntryObjectFields(BuddyListEntry entry)
 {
     EditorGUILayout.BeginHorizontal();
     {
         entry.BuddyEntry = (AudioBuddyObject)EditorGUILayout.ObjectField(entry.BuddyEntry, typeof(AudioBuddyObject), false);
         if (entry.BuddyEntry != null)
         {
             entry.NameInList = entry.BuddyEntry.name;
             if (GUILayout.Button("Reset"))
             {
                 entry.BuddyEntry = null;
             }
         }
     }
     EditorGUILayout.EndHorizontal();
     if (entry.BuddyEntry == null)
     {
         GUILayout.Label("Please assign a valid Audio Buddy Object", EditorStyles.centeredGreyMiniLabel);
     }
 }
Exemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            _moveUp   = null;
            _moveDown = null;
            //base.OnInspectorGUI();
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.LabelField($"{listObject.name} Audio Buddy List", EditorStyles.whiteLargeLabel);
            GUILayout.Label($"{listObject.SoundList.Count} entries are in this list");
            GUILayout.Label($"Duration of List: {listObject.GetDuration()}");
            GUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("Add entry"))
                {
                    listObject.SoundList.Add(new BuddyListEntry());
                }

                if (GUILayout.Button("Remove Entry") && listObject.SoundList.Count > 0)
                {
                    listObject.SoundList.RemoveAt(0);
                }
            }
            GUILayout.EndVertical();

            //listObject.Duration = 0;
            _entryWidthCounter = 21;
            foreach (BuddyListEntry entry in listObject.SoundList)
            {
                DrawListEntry(entry);
                float entryDuration = entry.BuddyEntry != null ? entry.BuddyEntry.Duration : 0f;
            }

            ApplyDeletions();
            ApplyMovement();
            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(target);
            }
        }
Exemplo n.º 5
0
 public PlaybackEntry(BuddyListEntry listEntry)
 {
     SoundEntry = listEntry.BuddyEntry;
     Delay      = listEntry.Delay;
 }