From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/UI/LoopScrollView/LoopItemObject.cs | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Client/Assets/Scripts/UI/LoopScrollView/LoopItemObject.cs (limited to 'Client/Assets/Scripts/UI/LoopScrollView/LoopItemObject.cs') diff --git a/Client/Assets/Scripts/UI/LoopScrollView/LoopItemObject.cs b/Client/Assets/Scripts/UI/LoopScrollView/LoopItemObject.cs new file mode 100644 index 00000000..dd3610e2 --- /dev/null +++ b/Client/Assets/Scripts/UI/LoopScrollView/LoopItemObject.cs @@ -0,0 +1,47 @@ +using UnityEngine; +using System.Collections; +using XUtliPoolLib; + +/// +/// item对像的封装类LoopItemObject,不要求具体的item类来继承它。 +/// 但我们要示具体的item对像一定要包含UIWidget组件。 +/// +[System.Serializable] +public class LoopItemObject:ILoopItemObject +{ + /// + /// The widget. + /// + public UIWidget widget; + + /// + /// 本item,在实际整个scrollview中的索引位置, + /// 即对就数据,在数据列表中的索引 + /// + public int _dataIndex = -1; + + public int dataIndex + { + get { return _dataIndex; } + set { _dataIndex = value; } + } + + public bool isVisible() + { + LoopScrollView sc = NGUITools.FindInParents(widget.gameObject); + if (sc != null) return sc.IsVisible(this); + return false; + } + + public GameObject GetObj() + { + return widget != null ? widget.gameObject : null; + } + + + public void SetHeight(int height) + { + widget.height = height; + } + +} -- cgit v1.1-26-g67d0