Esempio n. 1
0
 protected override void OnStart()
 {
     base.OnStart();
     if (Bar != null)
     {
         Bar.Init();
         Bar.OnChangeFun = OnBarChange;
     }
     if (hBar != null)
     {
         hBar.OnChangeFun = OnVBarChange;
     }
     if (hasStart == false)
     {
         CalculateHeight();
         CalculateWidth();
         UICameraUtil.AddGenericScroll(OnCameraScroll);
         UIEventListener.Get(this.gameObject).onScroll = OnCameraScroll;
         maskOffset = Content.clipOffset;
         hasStart   = true;
     }
 }
Esempio n. 2
0
        public void SetDataProvider <T>(IEnumerable <T> list)
        {
            SetData <T>(list);
            if (useDefaultItem && defaultItem != null)
            {
                List.itemRender = defaultItem;
                useDefaultItem  = false;
            }
            int count = _dataProvider.Count;

            if (ItemHeight != 0)
            {
                int trueListHeight = count * ItemHeight + List.PaddingTop + List.PaddingBottom;
                if (_MaxListHeight != 0)
                {
                    trueListHeight = Math.Min(trueListHeight, _MaxListHeight);
                }
                List.ListHeight = trueListHeight;
                if (isUpDirection)
                {
                    List.transform.localPosition = new Vector3(List.transform.localPosition.x, trueListHeight + 2, 0);
                }
            }
            else if (_MaxListHeight != 0)
            {
                List.ListHeight = _MaxListHeight;
            }
            List.OnItemSelect = OnItemSelect;
            List.SetDataProvider <T>(list);
            UICameraUtil.AddGenericPress(OnRelease);
            //if (UICamera.genericEventHandler != null) {
            //    UIEventListener.Get(UICamera.genericEventHandler).onPress += OnRelease;
            //}
            if (Bg != null)
            {
                Bg.ResetAndUpdateAnchors();
            }
        }
Esempio n. 3
0
 protected override void OnDisable()
 {
     base.OnDisable();
     UICameraUtil.RemoveGenericScroll(OnCameraScroll);
 }
Esempio n. 4
0
 protected override void OnEnable()
 {
     base.OnEnable();
     UICameraUtil.AddGenericScroll(OnCameraScroll);
 }