36 lines
927 B
C#
36 lines
927 B
C#
|
using AlicizaX.ObjectPool;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace AlicizaX.UI.RecyclerView
|
||
|
{
|
||
|
internal class ViewHolderObject : ObjectBase
|
||
|
{
|
||
|
public static ViewHolderObject Create(string location, UnityEngine.Object target)
|
||
|
{
|
||
|
ViewHolderObject item = MemoryPool.Acquire<ViewHolderObject>();
|
||
|
item.Initialize(location, target);
|
||
|
return item;
|
||
|
}
|
||
|
|
||
|
protected override void OnUnspawn()
|
||
|
{
|
||
|
base.OnUnspawn();
|
||
|
(Target as ViewHolder).gameObject.SetActive(false);
|
||
|
}
|
||
|
|
||
|
protected override void OnSpawn()
|
||
|
{
|
||
|
base.OnSpawn();
|
||
|
(Target as ViewHolder).gameObject.SetActive(true);
|
||
|
}
|
||
|
|
||
|
protected override void Release(bool isShutdown)
|
||
|
{
|
||
|
if (Target != null)
|
||
|
{
|
||
|
GameObject.Destroy((Target as ViewHolder).gameObject);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|