Beispiel #1
0
 protected override void Awake()
 {
     base.Awake();
     childRectTrans = GetComponentsInChildren <RectTransform>();
     Com            = GO.SafeAddComponet <Slider>();
     Com.handleRect = Handle;
     Com.fillRect   = Fill;
 }
Beispiel #2
0
 protected override void Awake()
 {
     base.Awake();
     Com = GO.SafeAddComponet <Dropdown>();
     Template.gameObject.SetActive(false);
     Com.template       = Template;
     Com.captionText    = CaptionText;
     Com.alphaFadeSpeed = 0.15f;
     Com.itemText       = ItemText;
 }
Beispiel #3
0
        protected override void Start()
        {
            base.Start();
            ScrollRect         = GO.SafeAddComponet <ScrollRect>();
            ScrollRectTrans    = ScrollRect.transform as RectTransform;
            ScrollRect.content = Content;
            if (ScrollRect != null)
            {
                if (ScrollRect.vertical)
                {
                    ScrollRect.verticalScrollbar = Scrollbar;
                }
                else if (ScrollRect.horizontal)
                {
                    ScrollRect.horizontalScrollbar = Scrollbar;
                }

                ScrollRect.horizontalScrollbarVisibility = ScrollbarVisibility;
                ScrollRect.verticalScrollbarVisibility   = ScrollbarVisibility;
                ScrollRect.movementType = ScrollRect.MovementType.Clamped;
                ScrollRect.onValueChanged.AddListener(_ScrollRect_OnValueChanged);
                ScrollRect.inertia          = true;
                ScrollRect.decelerationRate = 0.2f;
            }
            if (Scrollbar != null)
            {
                Scrollbar.size = 0.0f;
                Scrollbar.onValueChanged.AddListener(_ScrollBar_OnValueChanged);
            }

            ContentSizeFitter = Content.GetComponentInChildren <ContentSizeFitter>();
            if (ContentSizeFitter != null)
            {
                if (LayoutElement == null)// LayoutElement = Content.gameObject.AddComponent<LayoutElement>();
                {
                    EnsureLayoutElement();
                }
                if (IsVertical)
                {
                    LayoutElement.minHeight = ScrollRectTrans.sizeDelta.y + 100;
                }
                else if (IsHorizontal)
                {
                    LayoutElement.minWidth = ScrollRectTrans.sizeDelta.x + 100;
                }
            }
        }