// IItemFactory public void Put(IScrollItem <TData> widget) { foreach (var item in widget.RectTransform.GetComponentsInChildren <IScrollItem <TData> >()) { item.Suspend(); } //! remove widget.RectTransform.gameObject.SetActive(false); _itemsCache.Push(widget); }
public void AddItem(Key uid, GUIBase_Widget w, IScrollItem itemGui) { //Debug.Log("Adding item: " + uid); Item <Key> itm = new Item <Key>(uid, w, itemGui); int curIndex = m_Items.Count; w.transform.localPosition = new Vector2(ItemOffset * curIndex, w.transform.localPosition.y); w.SetModify(true); m_Items.Add(itm); ComputeScrollLimits(); }
private void DebugWindow(IScrollItem <TData> item) { var cutting = new Straight { Direction = GrowDirection, }; VectorGeneric2 intersection; _window.Last.Value.RectTransform.GetIntersectionInParentSpace(cutting, out intersection); // UnityEngine.Debug.Log("<color=magenta> inside: " + intersection.Origin + " :: " + intersection.Target + "</color>"); ScrollerExtensions.MultiLine(item.RectTransform, Color.yellow); ScrollerExtensions.Cross(intersection.Target, Color.magenta); ScrollerExtensions.Cross(intersection.Origin, Color.red); ScrollerExtensions.MultiLine(RectTransform.GetSidesInLocalSpace(), Color.yellow * .5f); }
public void Put(IScrollItem <ExampleScrollItemData> item) { _itemFactory.Put(item); }
public override void OnDrag(PointerEventData eventData) { if (_eDragDirection != EDrageDirection.None) { if (_eDragDirection == EDrageDirection.Horizontal) { _fScrollDelta += eventData.delta.x; } if (_eDragDirection == EDrageDirection.Vertical) { _fScrollDelta += eventData.delta.y; } OnDrag_OtherSide?.Invoke(new DragEventMsg(eventData, _fScrollDelta, Calculate_NormalizeDelta())); } else { base.OnDrag(eventData); } if (_listScrollItem.Count == 0) { return; } float fMinX = _pRectTransform.rect.xMin; float fMaxX = _pRectTransform.rect.xMax; float fMinY = _pRectTransform.rect.yMin; float fMaxY = _pRectTransform.rect.yMax; _listScrollItem_Temp.Clear(); for (int i = 0; i < _listScrollItem.Count; i++) { IScrollItem pScrollItemCurrent = _listScrollItem[i]; RectTransform pTransformChild = pScrollItemCurrent.rectTransform; Vector3 vecPos = GetWorldPointInWidget(_pRectTransform, GetWidgetWorldPoint(pTransformChild)); bool bIsShow = false; if (horizontal && fMinX < vecPos.x && vecPos.x < fMaxX) { bIsShow = true; pScrollItemCurrent.IScrollItem_OnChangeScrollIndex(1 - CalculateScrollPosition_0_1(pTransformChild).x); } if (bIsShow == false && vertical && fMinY < vecPos.y && vecPos.y < fMaxY) { bIsShow = true; pScrollItemCurrent.IScrollItem_OnChangeScrollIndex(1 - CalculateScrollPosition_0_1(pTransformChild).y); } if (bIsShow == false) { continue; } _listScrollItem_Temp.Add(pScrollItemCurrent); } }
//public delegate void DrawDelegte(TKey key, GUIBase_Widget w); //public DrawDelegte m_DrawDelegate; public Item(TKey id, GUIBase_Widget w, IScrollItem itemGui) { m_UID = id; m_Widget = w; m_ItemGui = itemGui; }