Esempio n. 1
0
        private void InitializeMusicListScrollBar()
        {
            var scroller = m_MusicList.AddUIComponent <UIScrollbar>();

            scroller.width            = 15;
            scroller.height           = m_MusicList.height;
            scroller.relativePosition = new Vector3(width - 15 - 15f, 0);
            scroller.orientation      = UIOrientation.Vertical;

            //All credits to https://github.com/justacid/Skylines-ExtendedPublicTransport
            {
                var track = scroller.AddUIComponent <UISlicedSprite>();
                track.relativePosition = Vector2.zero;
                track.autoSize         = true;
                track.size             = track.parent.size;
                track.fillDirection    = UIFillDirection.Vertical;
                track.spriteName       = "ScrollbarTrack";
                scroller.trackObject   = track;

                {
                    UISlicedSprite thumbSprite = track.AddUIComponent <UISlicedSprite>();
                    thumbSprite.relativePosition = Vector2.zero;
                    thumbSprite.fillDirection    = UIFillDirection.Vertical;
                    thumbSprite.autoSize         = true;
                    thumbSprite.width            = thumbSprite.parent.width;
                    thumbSprite.spriteName       = "ChirpScrollbarThumb";
                    thumbSprite.color            = new Color32(255, 255, 255, 128);
                    //thumbSprite.color = new Color32(0, 100, 180, 255);

                    scroller.thumbObject = thumbSprite;
                }
            }

            m_MusicList.scrollbar = scroller;

            scroller.isVisible = true;
        }