コード例 #1
0
    /*
     * Converts frame anchors to text anchors
     */
    public static TextAnchor FrameAnchorToTextAnchor(UIFrame.AnchorLocation anchor)
    {
        switch (anchor)
        {
        case UIFrame.AnchorLocation.BOTTOM:
            return(TextAnchor.LowerCenter);

        case UIFrame.AnchorLocation.BOTTOM_LEFT:
            return(TextAnchor.LowerLeft);

        case UIFrame.AnchorLocation.BOTTOM_RIGHT:
            return(TextAnchor.LowerRight);

        case UIFrame.AnchorLocation.CENTER:
            return(TextAnchor.MiddleCenter);

        case UIFrame.AnchorLocation.LEFT:
            return(TextAnchor.MiddleLeft);

        case UIFrame.AnchorLocation.RIGHT:
            return(TextAnchor.MiddleRight);

        case UIFrame.AnchorLocation.TOP:
            return(TextAnchor.UpperCenter);

        case UIFrame.AnchorLocation.TOP_LEFT:
            return(TextAnchor.UpperLeft);

        case UIFrame.AnchorLocation.TOP_RIGHT:
            return(TextAnchor.UpperRight);
        }
        return(TextAnchor.MiddleCenter);
    }
コード例 #2
0
        /*
         * Button
         * Pressable clip button
         */
        public static ClipButtonAttachment CreateClipButton(InstrumentClip clip, UIFrame.AnchorLocation anchor)
        {
            GameObject button = Instantiate(Instance.clipButtonPrefab) as GameObject;

            ClipButtonAttachment attach = button.GetComponent <ClipButtonAttachment>();

            attach.Init(clip);

            UIFrame frame = button.GetComponent <UIFrame>();

            frame.SetAnchor(anchor);

            return(attach);
        }
コード例 #3
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);
        }