// Use this for initialization public override void Awake() { base.Awake(); AddAcceptedDocktype(typeof(SliderAttachment)); SetAsDock(true); m_paramscroller.SetItemScale(UIFactory.sliderScale.x); m_innerPlugScale = m_plugInner.localScale; m_exteriorPlugScale = m_plugExterior.localScale; HideControls(); }
/* * Controls */ public void InitInstrumentControls() { if (musicRef != null) { m_rotator = new GameObject("rotator"); m_rotator.transform.parent = transform; m_rotator.transform.localPosition = Vector3.zero; //Create clipbuttons ScrollerAttachment clipScroller = UIFactory.CreateParamScroller(); clipScroller.SetItemSpacing(m_clipCubeSpacing); clipScroller.AddAcceptedDocktype(typeof(ClipCubeAttachment)); clipScroller.transform.parent = m_rotator.transform; clipScroller.SetOffset(new Vector3(-m_controlsMirrorOffset, m_controlsYOffset + 0.02f, 0.0f)); //clipScroller.transform.localPosition = new Vector3(-m_controlsMirrorOffset, m_controlsYOffset + 0.02f, 0.0f); clipScroller.SetItemScale(UIFactory.sliderScale.x); foreach (InstrumentClip clip in musicRef.clipList) { ClipCubeAttachment cube = UIFactory.CreateClipCube(clip, true); cube.SetCloneable(true); cube.SetColour(musicRef.color); cube.DockInto(clipScroller); } //Create param sliders ScrollerAttachment paramScroller = UIFactory.CreateParamScroller(); paramScroller.transform.parent = m_rotator.transform; paramScroller.SetOffset(new Vector3(m_controlsMirrorOffset, m_controlsYOffset, 0.0f)); //paramScroller.transform.localPosition = new Vector3(m_controlsMirrorOffset, m_controlsYOffset, 0.0f); paramScroller.SetItemScale(UIFactory.sliderScale.x); foreach (BaseInstrumentParam param in musicRef.paramList) { SliderAttachment slider = UIFactory.CreateSlider(param, UIFrame.AnchorLocation.BOTTOM_LEFT); slider.SetCloneable(true); slider.DockInto(paramScroller); } if (musicRef.clipList.Count < clipScroller.numDisplayedAttachments) { clipScroller.SetNumDisplayedAttachments(musicRef.clipList.Count); } if (musicRef.paramList.Count < paramScroller.numDisplayedAttachments) { paramScroller.SetNumDisplayedAttachments(musicRef.paramList.Count); } m_parameterScroller = paramScroller.gameObject; m_clipScroller = clipScroller.gameObject; //Central divider float largestHeight = (clipScroller.upperVisibleBounds > paramScroller.upperVisibleBounds) ? clipScroller.upperVisibleBounds : paramScroller.upperVisibleBounds; m_dividingQuad = UIFactory.CreateGuiQuad(); m_dividingQuad.transform.localScale = new Vector3(m_dividerWidth, largestHeight, 1.0f); m_dividingQuad.transform.parent = m_rotator.transform; m_dividingQuad.transform.localPosition = new Vector3(0.0f, m_controlsYOffset, 0.0f); DisableControls(); } }