This commit is contained in:
Chikashi Miyama 2019-09-28 20:29:31 +02:00
parent 78023946cd
commit f29a1549c5
2 changed files with 23 additions and 10 deletions

View file

@ -1,5 +1,4 @@
using UnityEditor;
using UnityEngine;
namespace cylvester
{
@ -18,19 +17,34 @@ namespace cylvester
private void OnEnable()
{
object[] foundObjects = FindObjectsOfType(typeof(PdBackend));
var foundObjects = FindObjectsOfType(typeof(PdBackend));
if (foundObjects.Length != 1)
return;
pdBackend_ = (IPdBackend) foundObjects[0];
dspToggle_ = new EditorToggle();
togglePresenter_ = new TogglePresenter(dspToggle_, pdBackend_);
}
void OnGUI ()
private void OnGUI ()
{
foundObjects.
if(!ValidatePdBackend(pdBackend_))
return;
dspToggle_.State = EditorGUILayout.Toggle("Pure Data Process", dspToggle_.State);
}
private bool ValidatePdBackend(IPdBackend pdBackend)
{
var exist = pdBackend_ != null;
if (!exist)
{
EditorGUILayout.LabelField("No Pd backend found in the scene");
}
return exist;
}
}
}

View file

@ -20,8 +20,7 @@ namespace cylvester
onToggleChanged_ = () =>
{
var state = editorToggle_.State;
// apply state to pd backend;
pdBackend.State = editorToggle_.State;
};
editorToggle_.ToggleStateChanged += onToggleChanged_;