逻辑bug
This commit is contained in:
parent
31f7d6f4bd
commit
fea27cdfd4
|
@ -12,7 +12,7 @@ public class LevelPage : PageView
|
|||
get
|
||||
{
|
||||
int tTotalCount = GameConfig.Instance.LevelSort.Count + 1;//add coming soon
|
||||
int tUnlockedCount = 23;// PlayerData.Instance.UnlockedLevel;
|
||||
int tUnlockedCount = PlayerData.Instance.UnlockedLevel;
|
||||
int tEnoughCount = (tUnlockedCount / CountPerPage + 1) + (tUnlockedCount % CountPerPage == 0 ? -1 : 0);
|
||||
|
||||
return Mathf.Min(tTotalCount, tEnoughCount * CountPerPage);
|
||||
|
|
|
@ -8,6 +8,9 @@ public class PageSpot : MonoBehaviour
|
|||
|
||||
private Transform mCtn;
|
||||
private List<GameObject> mLightSpots;
|
||||
private List<GameObject> mSpotList;
|
||||
|
||||
private int mSpotCount;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
@ -16,16 +19,16 @@ public class PageSpot : MonoBehaviour
|
|||
|
||||
public void Init(int pTotalCount)
|
||||
{
|
||||
mSpotCount = pTotalCount;
|
||||
mLightSpots = new List<GameObject>();
|
||||
|
||||
for (int i = 0; i < pTotalCount; i++)
|
||||
{
|
||||
GameObject tSpot = Instantiate(mTplSpot, mCtn);
|
||||
tSpot.SetActive(true);
|
||||
tSpot.transform.localScale = Vector3.one;
|
||||
|
||||
GameObject tSpot = GetSpot(i);
|
||||
mLightSpots.Add(tSpot.transform.GetChild(0).gameObject);
|
||||
}
|
||||
|
||||
HideUnused();
|
||||
}
|
||||
|
||||
public void SetPageIndex(int pCurrentIndex)
|
||||
|
@ -35,4 +38,36 @@ public class PageSpot : MonoBehaviour
|
|||
mLightSpots[i].SetActive(pCurrentIndex == i);
|
||||
}
|
||||
}
|
||||
|
||||
private GameObject GetSpot(int pSpotIndex)
|
||||
{
|
||||
if (mSpotList == null)
|
||||
{
|
||||
mSpotList = new List<GameObject>();
|
||||
}
|
||||
|
||||
GameObject tCell = null;
|
||||
if (pSpotIndex < mSpotList.Count)
|
||||
{
|
||||
tCell = mSpotList[pSpotIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
tCell = Instantiate(mTplSpot, mCtn);
|
||||
tCell.transform.localScale = Vector3.one;
|
||||
mSpotList.Add(tCell);
|
||||
}
|
||||
|
||||
tCell.SetActive(true);
|
||||
|
||||
return tCell;
|
||||
}
|
||||
|
||||
private void HideUnused()
|
||||
{
|
||||
for (int i = mSpotCount; i < mSpotList.Count; i++)
|
||||
{
|
||||
mSpotList[i].SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -145,7 +145,7 @@ public class PanelMain : BasePanel
|
|||
|
||||
private void InitLevelIcons()
|
||||
{
|
||||
mTotalLevel = GameConfig.Instance.LevelSort.Count;
|
||||
mTotalLevel = PlayerData.Instance.UnlockedLevel;
|
||||
|
||||
int tLevel = 0;
|
||||
for (int i = 0; i < mImgLevelIcons.Length; i++)
|
||||
|
|
Loading…
Reference in New Issue