soundvision/UnityProject/Assets/Editor/PdBackendEditor.cs

49 lines
1.1 KiB
C#
Raw Normal View History

2019-09-29 19:53:47 +00:00
using UnityEditor;
2019-09-29 16:04:26 +00:00
using UnityEngine;
namespace cylvester
{
[CustomEditor(typeof(PdBackend))]
public class PdBackendEditor : Editor
{
2019-10-01 13:08:35 +00:00
private PdBackend pdBackend_;
private readonly string[] samples_ =
{
"No Playback",
"Back_Back",
"Brutal_Synth",
"Dialog",
"Drums",
"Fox_Melo",
"Kick",
"Pads+Strings",
"Rose_Sax",
"Roses_Front"
};
2019-09-29 16:04:26 +00:00
private void Awake()
{
2019-10-01 13:08:35 +00:00
pdBackend_ = (PdBackend) target;
2019-09-29 16:04:26 +00:00
}
public override void OnInspectorGUI ()
{
2019-10-01 13:08:35 +00:00
pdBackend_ = (PdBackend) target;
2019-09-29 16:04:26 +00:00
2019-09-29 19:53:47 +00:00
if (Application.isPlaying)
{
2019-10-01 13:08:35 +00:00
RenderSamplePlayback();
2019-09-29 19:53:47 +00:00
Repaint();
}
2019-09-29 16:04:26 +00:00
}
2019-10-01 13:08:35 +00:00
private void RenderSamplePlayback()
{
GUILayout.Space(5);
pdBackend_.samplePlayback = EditorGUILayout.Popup("Sample File to play", pdBackend_.samplePlayback, samples_);
}
2019-09-29 16:04:26 +00:00
}
}