chicken_dy/Assets/Scripts/UI/CustomControl/LevelList/LevelPage.cs

45 lines
958 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LevelPage : PageView
{
public Action<int> DelClickLevel;
public override int Count
{
get
{
int tCount = GameConfig.Instance.LevelSort.Count + 1;
return tCount;
}
}
protected override void ConfigCell(GameObject pCellGob, int pIndex)
{
LevelCell tCell = pCellGob.GetComponent<LevelCell>();
if (pIndex < PlayerData.Instance.UnlockedLevel)
{
tCell.Init(pIndex);
tCell.DelClick = OnClickLevel;
}
else
{
if (pIndex < Count - 1)
{
tCell.SetEmpty();
}
else
{
tCell.SetComingSoon();
}
}
}
private void OnClickLevel(int pLevelIndex)
{
DelClickLevel?.Invoke(pLevelIndex);
}
}