123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using UnityEngine;
- using System.Collections;
- /// <summary>
- /// warp下Element对应标记
- /// </summary>
- [DisallowMultipleComponent]
- public class UIWarpContentItem : MonoBehaviour
- {
- /// <summary>
- /// 数据索引
- /// </summary>
- private int index = -1;
- /// <summary>
- /// 元素列表优化
- /// </summary>
- private UIWarpContent warpContent = null;
- /// <summary>
- /// 销毁
- /// </summary>
- private void OnDestroy()
- {
- warpContent = null;
- }
- /// <summary>
- /// 元素列表优化对象
- /// </summary>
- public UIWarpContent WarpContent
- {
- set
- {
- warpContent = value;
- }
- }
- /// <summary>
- /// 数据索引
- /// </summary>
- public int Index
- {
- get
- {
- return index;
- }
- set
- {
- index = value;
- transform.localPosition = warpContent.getLocalPositionByIndex(index);
- gameObject.name = (index < 10) ? ("0" + index) : (string.Empty + index);
- if (warpContent.onInitializeItem != null && index >= 0)
- {
- warpContent.onInitializeItem(gameObject, index);
- }
- }
- }
- }
|