using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class LevelPage : PageView { public Action DelClickLevel; public override int Count { get { int tTotalCount = GameConfig.Instance.LevelSort.Count + 1;//add coming soon int tUnlockedCount = PlayerData.Instance.UnlockedLevel; int tEnoughCount = (tUnlockedCount / CountPerPage + 1) + (tUnlockedCount % CountPerPage == 0 ? -1 : 0); return Mathf.Min(tTotalCount, tEnoughCount * CountPerPage); } } protected override void ConfigCell(GameObject pCellGob, int pIndex) { LevelCell tCell = pCellGob.GetComponent(); if (pIndex < PlayerData.Instance.UnlockedLevel) { tCell.Init(pIndex); tCell.DelClick = OnClickLevel; } else { if (pIndex < GameConfig.Instance.LevelSort.Count) { tCell.SetEmpty(); } else { tCell.SetComingSoon(); } } } private void OnClickLevel(int pLevelIndex) { DelClickLevel?.Invoke(pLevelIndex); } }