73 lines
2.0 KiB
C#
73 lines
2.0 KiB
C#
using UnityEngine;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Text;
|
||
using System;
|
||
|
||
namespace Thousandto.Plugins.Common
|
||
{
|
||
/// <summary>
|
||
/// Item的转换类,用来保存Item的各个组件和对组件填充数据
|
||
/// ItemHolder会当做参数传给逻辑层,所以可被继承,用于扩展
|
||
/// </summary>
|
||
public class ItemHolder
|
||
{
|
||
/// <summary>
|
||
/// 当Item添加到滑动列表时触发
|
||
/// </summary>
|
||
public Action<ItemHolder> OnItemShow { get; set; }
|
||
|
||
/// <summary>
|
||
/// 当Item被复用前,Item中有些元素在复用时可能不需要,可以在这个回调中提前做处理
|
||
/// 比如聊天Item,里面有表情,复用时表情需要去掉
|
||
/// </summary>
|
||
public Action<ItemHolder> OnItemReUseBefore { get; set; }
|
||
|
||
/// <summary>
|
||
/// 是否新建的Item,不是复用的
|
||
/// </summary>
|
||
public bool UseNew { get; set; }
|
||
|
||
/// <summary>
|
||
/// 当前Holder对应的Transform
|
||
/// </summary>
|
||
public Transform Object { get; set; }
|
||
|
||
public float Param { get; set; }
|
||
|
||
public string ReciveTime { get; set; }
|
||
|
||
/// <summary>
|
||
/// 当前Item的尺寸
|
||
/// </summary>
|
||
public Vector2 Size { get; set; }
|
||
|
||
/// <summary>
|
||
/// item的序号,对应数据列表的序号
|
||
/// </summary>
|
||
public int Index;
|
||
|
||
/// <summary>
|
||
/// item的上下沿Y方向的坐标,用于判断是否从裁剪窗口移除掉
|
||
/// </summary>
|
||
public Vector2 TopAndBottom;
|
||
|
||
/// <summary>
|
||
/// 动画效果
|
||
/// </summary>
|
||
public BaseEffect AnimEffect;
|
||
|
||
/// <summary>
|
||
/// Item的边界
|
||
/// </summary>
|
||
public Bounds Bounds
|
||
{
|
||
get
|
||
{
|
||
return NGUIMath.CalculateRelativeWidgetBounds(Object, Object);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|