new public void RemoveItem(CButtonToggle tog) { tweenState.Remove(tog); tweenTargetPos.Remove(tog); EventUtil.RemoveHover(tog.gameObject, OnTogHover); base.RemoveItem(tog); }
new public void RemoveItems() { if (_nowUseList != null) { foreach (var tog in _nowUseList) { EventUtil.RemoveHover(tog.gameObject, OnTogHover); } } tweenState.Clear(); tweenTargetPos.Clear(); base.RemoveItems(); }
protected virtual void ResetItems() { CItemRender item; for (int i = 0; i < _allItem.Count; i++) { item = _allItem[i]; item.name = "Item" + i; CItemRender w = item; if (item.IsActive() == false) { item.SetActive(true); } w.SetAlpha(1); if (_dataCondition != null) { w.SetCondition(_dataCondition); } w.index = i + preIndex; w.Data = _dataProvider[i]; int offX = i / RowNum; int offY = i / ColNum; float itemX, itemY; if (_horizon) { itemY = -(itemHeight + gapV) * (i % RowNum); //一列一列的顺序? itemX = offX * (itemWidth + gapU); } else { itemY = (offY * (_itemHeight * item.localScale.y + gapV) * -1); itemX = (itemWidth + gapU) * (i % ColNum); } item.tran.localPosition = new Vector3(PaddingLeft + itemX, -PaddingTop + itemY, 0); // UIEventListener listener = UIEventListener.Get(item.go); UIEventListener.Get(item.go); //listener.onHover = OnItemHover; if (IsAddItemEvent == true) { EventUtil.AddHover(item.go, OnItemHover, item.go); EventUtil.AddDoubleClick(item.go, OnDoubleClickItem, item); EventUtil.AddClick(item.go, OnItemPress, item.go); } else { EventUtil.RemoveHover(item.go, OnItemHover); EventUtil.RemoveDoubleClick(item.go, OnDoubleClickItem); EventUtil.RemoveClick(item.go, OnItemPress); } } if (_dataProvider == null) { TotalWidth = 0; TotalHeight = 0; } else { if (_horizon) { var itemW = (_itemWidth + gapU) * Mathf.CeilToInt(_dataProvider.Count / (float)RowNum) - gapU; TotalWidth = PaddingLeft * 2 + itemW; } else { var itemH = (_itemHeight + gapV) * Mathf.CeilToInt(_dataProvider.Count / (float)ColNum) - gapV; TotalHeight = PaddingTop + itemH + PaddingBottom; } } UpdateScrollBar(); }