Files
Main/Assets/GameAssets/Resources/GameUI/Common/UIListView/ItemHolder.cs
2025-01-25 04:38:09 +08:00

73 lines
2.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);
}
}
}
}