81 lines
2.5 KiB
C#
81 lines
2.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
namespace AGUI
|
|
{
|
|
// Token: 0x0200107E RID: 4222
|
|
public abstract class VirtualPagedGrid<ListType, ChildType> : VirtualPagedGrid where ChildType : Component
|
|
{
|
|
// Token: 0x06023A76 RID: 146038 RVA: 0x009B6288 File Offset: 0x009B4488
|
|
protected virtual void Awake()
|
|
{
|
|
for (int i = 0; i < this.PageSize; i++)
|
|
{
|
|
ChildType childType = global::UnityEngine.Object.Instantiate<ChildType>(this.childPrefab);
|
|
this.FIHOKFLFDON(childType, false);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06023A77 RID: 146039 RVA: 0x009B62C0 File Offset: 0x009B44C0
|
|
protected virtual void Start()
|
|
{
|
|
}
|
|
|
|
// Token: 0x06023A78 RID: 146040 RVA: 0x009B62C4 File Offset: 0x009B44C4
|
|
public override void UpdateGrid()
|
|
{
|
|
int count = this.AOHMLKKGHIB.Count;
|
|
if (this.emptyDisplay != null)
|
|
{
|
|
this.emptyDisplay.SetActive(count == 0);
|
|
this.gridBaseTransform.gameObject.SetActive(count != 0);
|
|
}
|
|
base.NIMDANNHFMC = ((count != 0) ? ((count + this.PageSize - 1) / this.PageSize) : 1);
|
|
base.NJDGAOLIGDJ = Mathf.Clamp(base.NJDGAOLIGDJ, 0, base.NIMDANNHFMC - 1);
|
|
int num = base.NJDGAOLIGDJ * this.PageSize;
|
|
this.pageControls.gameObject.SetActive(base.NIMDANNHFMC > 1);
|
|
base.FGKHKGGDADA.interactable = base.NJDGAOLIGDJ > 0;
|
|
base.IECBHCPGPLH.interactable = base.NJDGAOLIGDJ < base.NIMDANNHFMC - 1;
|
|
this.pageDisplay.UpdatePageDisplay(base.NJDGAOLIGDJ, base.NIMDANNHFMC);
|
|
List<ListType> list = this.AOHMLKKGHIB.JFOBNGODCBD(num, this.PageSize).ToList<ListType>();
|
|
for (int i = 0; i < this.GBHGHHIJMKN.Count; i++)
|
|
{
|
|
bool flag = i < list.Count;
|
|
ChildType childType = this.GBHGHHIJMKN[i];
|
|
childType.gameObject.SetActive(flag);
|
|
if (flag)
|
|
{
|
|
this.HOPLMBLNPFE(list[i], this.GBHGHHIJMKN[i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06023A79 RID: 146041 RVA: 0x009B6440 File Offset: 0x009B4640
|
|
private void FIHOKFLFDON(ChildType LLIOGLHODBF, bool NNEELAHICJF = true)
|
|
{
|
|
LLIOGLHODBF.transform.SetParent(this.gridBaseTransform, false);
|
|
this.GBHGHHIJMKN.Add(LLIOGLHODBF);
|
|
if (NNEELAHICJF)
|
|
{
|
|
this.UpdateGrid();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06023A7A RID: 146042
|
|
protected abstract void HOPLMBLNPFE(ListType OKKMGANCMGB, ChildType FHPIPPKJOOM);
|
|
|
|
// Token: 0x04005B6D RID: 23405
|
|
[Header("Children")]
|
|
[SerializeField]
|
|
protected ChildType childPrefab;
|
|
|
|
// Token: 0x04005B6E RID: 23406
|
|
protected List<ChildType> GBHGHHIJMKN = new List<ChildType>();
|
|
|
|
// Token: 0x04005B6F RID: 23407
|
|
protected List<ListType> AOHMLKKGHIB = new List<ListType>();
|
|
}
|
|
}
|