private void Draw(string label, ref Vector2 value) { UnityGUI.BeginChangeCheck(); value = UnityGUI.Vector2(label, value); var changed = UnityGUI.EndChangeCheck(); if (changed) { UpdateValues(label); } }
void OnGUI() { UnityGUI.Header("Coordinates"); headset = UnityGUI.Enum("Headset", headset); UnityGUI.Space(); UnityGUI.BeginHorizontal(); UnityGUI.Label(" ", "X", UnityGUI.BoldLabel); UnityGUI.Label("Y", UnityGUI.BoldLabel); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Resolution", headset.GetWidth().ToString()); UnityGUI.Label(headset.GetHeight().ToString()); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Field of View", ((int)headset.GetFieldOfView(Axis.Horizontal)).ToString()); UnityGUI.Label(((int)headset.GetFieldOfView(Axis.Vertical)).ToString()); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Diameter (um)", ((int)headset.GetRetinalDiameter(Axis.Horizontal)).ToString()); UnityGUI.Label(((int)headset.GetRetinalDiameter(Axis.Vertical)).ToString()); UnityGUI.EndHorizontal(); UnityGUI.Space(); Draw("Pixel", ref pixel); Draw("Visual Angle", ref angle); Draw("Retina (um)", ref retina); Draw("Polar", ref polar); UnityGUI.Separator(); UnityGUI.Header("Electrode Count"); UnityGUI.BeginChangeCheck(); pattern = UnityGUI.Enum("Pattern", pattern); layout = UnityGUI.Enum("Layout", layout); fieldOfView = UnityGUI.Float("Field of View", fieldOfView); var changed = UnityGUI.EndChangeCheck(); if (changed) { numElectrodes = pattern.GetElectrodePositions(layout, fieldOfView).Length; } UnityGUI.Space(); UnityGUI.Label("Electode Count", numElectrodes.ToString()); }