private void SetPagePageData()
{
if (curPageIndex == LastPageIndex)//假如這是最后一頁
{
startIndex =(curPageIndex - 1) * PageMaxNum;
curPageRoomNum = TotalNum - (curPageIndex-1) * PageMaxNum;
}
else if (curPageIndex > 1 && curPageIndex < LastPageIndex)//假如這既不是第一頁也不是最后一頁
{
startIndex =(curPageIndex - 1) * PageMaxNum;
curPageRoomNum = PageMaxNum;
}
else if (curPageIndex == 1 && TotalNum > PageMaxNum)//假如這是第一頁,而且總房間數大於頁面最大房間數
{
startIndex = 0;
curPageRoomNum = PageMaxNum;
}
else if (curPageIndex == 1 && TotalNum < PageMaxNum)//假如這是第一頁,而且總房間數小於頁面最大房間數
{
startIndex = 0;
curPageRoomNum = TotalNum;
}
}
private void RefreshPageState()
{
for (int i = 0; i < PageMaxNum; i++)
{
if (i < curPageRoomNum)
{
item[i].SetActive(true);
item[i].Init(data[startIndex+i]);
}
else
{
item[i].SetActive(false);
}
}
}