/* * Rotary Control * Creates a rotary param controller that uses twists to set values */ public static RotaryAttachment CreateRotary(BaseInstrumentParam param) { GameObject rotary = Instantiate(Instance.rotaryPrefab) as GameObject; RotaryAttachment attach = rotary.GetComponent <RotaryAttachment>(); attach.Init(param); return(attach); }
/* * Incoming methods */ public object instrumentValueUpdated(ZstMethod methodData) { Debug.Log(methodData.output); Dictionary <string, object> output = JsonConvert.DeserializeObject <Dictionary <string, object> >(methodData.output.ToString()); BaseInstrumentParam param = InstrumentController.Instance.FindParameter(Convert.ToInt32(output["trackindex"]), Convert.ToInt32(output["deviceindex"]), Convert.ToInt32(output["parameterindex"])); if (param != null) { param.setScaledVal(Convert.ToSingle(output["value"]), true); } return(null); }
/* * Slider * A controllable parameter slider */ public static SliderAttachment CreateSlider(BaseInstrumentParam param, UIFrame.AnchorLocation anchor) { GameObject slider = Instantiate(Instance.sliderPrefab) as GameObject; UIFrame frame = slider.GetComponent <UIFrame>(); //frame.SetAnchor(UIFrame.AnchorLocation.TOP_LEFT); frame.SetAnchor(anchor); SliderAttachment attach = slider.GetComponent <SliderAttachment>(); attach.Init(param); return(attach); }