diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/UI/LoopScrollView/LoopItemObject.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/UI/LoopScrollView/LoopItemObject.cs')
-rw-r--r-- | Client/Assets/Scripts/UI/LoopScrollView/LoopItemObject.cs | 47 |
1 files changed, 47 insertions, 0 deletions
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;
+
+/// <summary>
+/// item对像的封装类LoopItemObject,不要求具体的item类来继承它。
+/// 但我们要示具体的item对像一定要包含UIWidget组件。
+/// </summary>
+[System.Serializable]
+public class LoopItemObject:ILoopItemObject
+{
+ /// <summary>
+ /// The widget.
+ /// </summary>
+ public UIWidget widget;
+
+ /// <summary>
+ /// 本item,在实际整个scrollview中的索引位置,
+ /// 即对就数据,在数据列表中的索引
+ /// </summary>
+ public int _dataIndex = -1;
+
+ public int dataIndex
+ {
+ get { return _dataIndex; }
+ set { _dataIndex = value; }
+ }
+
+ public bool isVisible()
+ {
+ LoopScrollView sc = NGUITools.FindInParents<LoopScrollView>(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;
+ }
+
+}
|