using UnityEngine;
using System.Collections;
///
/// warp下Element对应标记
///
[DisallowMultipleComponent]
public class UIWarpContentItem : MonoBehaviour
{
///
/// 数据索引
///
private int index = -1;
///
/// 元素列表优化
///
private UIWarpContent warpContent = null;
///
/// 销毁
///
private void OnDestroy()
{
warpContent = null;
}
///
/// 元素列表优化对象
///
public UIWarpContent WarpContent
{
set
{
warpContent = value;
}
}
///
/// 数据索引
///
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);
}
}
}
}