Exemplo n.º 1
0
    public override bool AddDockableAttachment(BaseAttachment attach)
    {
        SliderAttachment slider = attach as SliderAttachment;

        slider.SetCloneable(false);
        slider.SetIsDraggable(true);
        slider.SetToolmodeResponse(new BaseTool.ToolMode[] { BaseTool.ToolMode.GRABBING });
        slider.DockInto(m_paramscroller);

        //iTween.MoveTo(slider.gameObject, iTween.Hash("position", transform.position, "time", 0.5f, "islocal", true));
        //iTween.RotateTo(slider.gameObject, iTween.Hash("rotation", transform.rotation, "time", 0.5f));

        return(true);
    }
Exemplo n.º 2
0
        /*
         * 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);
        }
Exemplo n.º 3
0
        public static BaseAttachment CreateGhostDragger(BaseAttachment attach)
        {
            BaseAttachment ghostAttach = null;

            if (attach.GetType() == typeof(SliderAttachment))
            {
                SliderAttachment slider = attach as SliderAttachment;
                ghostAttach = UIFactory.CreateSlider(slider.musicRef, UIFrame.AnchorLocation.BOTTOM_LEFT);
            }
            else if (attach.GetType() == typeof(ClipButtonAttachment))
            {
                ClipButtonAttachment clipButton = attach as ClipButtonAttachment;
                ghostAttach = UIFactory.CreateClipButton(clipButton.musicRef, UIFrame.AnchorLocation.BOTTOM_LEFT);
            }
            else if (attach.GetType() == typeof(ClipCubeAttachment))
            {
                ClipCubeAttachment cubeButton = attach as ClipCubeAttachment;
                ghostAttach = UIFactory.CreateClipCube(cubeButton.musicRef);
            }
            else if (attach.GetType() == typeof(InstrumentAttachment))
            {
                InstrumentAttachment instrument = attach as InstrumentAttachment;
                ghostAttach = UIFactory.CreateInstrument(instrument.musicRef);
            }
            else if (attach.GetType() == typeof(RBFTrainingSpawnerAttachment))
            {
                ghostAttach = UIFactory.CreateRBFSphereTraining();
            }

            ghostAttach.transform.parent     = attach.transform;
            ghostAttach.transform.position   = attach.transform.position;
            ghostAttach.transform.localScale = attach.transform.localScale;
            ghostAttach.transform.parent     = null;
            ghostAttach.SetTransient(true);
            ghostAttach.SetCloneable(false);

            return(ghostAttach);
        }
    /*
     * 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();
        }
    }