int gameIndex;//每一页初始时候的索引 void NextGamePage() { if (GameData.CurrentPages + 1 < GameData.gameTotalPages) { GameData.CurrentPages++; Debug.Log("CurrentPages" + GameData.CurrentPages); gameIndex = GameData.CurrentPages * 4; GamePageText.text = GameData.CurrentPages + 1 + "/" + GameData.gameTotalPages.ToString(); foreach (Button item in GameItemsRoot.GetComponentsInChildren <Button>()) { Text nameText = item.transform.Find("Name").GetComponent <Text>(); //if (gameIndex< jsonTestData.instance.gameItemList.Count ) //{ // nameText.text = jsonTestData.instance.gameItemList[gameIndex].name; //} //else //{ // nameText.text = ""; //} gameIndex++; } } else { UISettingManager.ShakeUI(NextButton, new Vector3(0.05f, 0.05f, 0.05f), 1); } }
void NextPageClick() { currentPageIndex++; if (Application.platform == RuntimePlatform.Android) { if (currentPageIndex < TV189MsgReciver.totalPages || currentPageIndex == TV189MsgReciver.totalPages) { Debug.Log("currentContentID:" + currentContentID); //调用安卓那边的方法,json会回调返回 AndroidAPI.GetCurrentPagesVideos(currentContentID, currentPageIndex, 4); } else { UISettingManager.ShakeUI(NextPagButton.transform, new Vector3(5f, 5f, 5f), 1); Debug.Log("已经不能向后翻页!"); currentPageIndex = TV189MsgReciver.totalPages; pageShowText.text = currentPageIndex + "/" + TV189MsgReciver.totalPages; } } else { Debug.Log("currentContentID:" + currentContentID); TV189MsgReciver.instance.GetVideosJson(jsonTxt); } }
void NextLivePage() { currentPage++; if (currentPage < totalPages || currentPage == totalPages) { LiveItemDisplay((currentPage - 1) * 5); } else { UISettingManager.ShakeUI(LiveNextPage.transform, new Vector3(5f, 5f, 5f), 1); Debug.Log("已经不能向后翻页!"); // currentPageIndex = TV189MsgReciver.totalPages; livePageShowText.text = currentPage + "/" + totalPages; currentPage = totalPages; } }
void PriviousLivePage() { currentPage--; if (currentPage > 0) { LiveItemDisplay((currentPage - 1) * 5); } else { UISettingManager.ShakeUI(LivePreviosPage.transform, new Vector3(5f, 5f, 5f), 1); Debug.Log("已经不能向前翻页!"); // currentPageIndex = TV189MsgReciver.totalPages; currentPage = 1; livePageShowText.text = currentPage + "/" + totalPages; } }
void PriviousGamePage() { if (GameData.CurrentPages > 0) { GameData.CurrentPages--; Debug.Log("CurrentPages" + GameData.CurrentPages); GamePageText.text = GameData.CurrentPages + 1 + "/" + GameData.gameTotalPages.ToString(); gameIndex = GameData.CurrentPages * 4; foreach (Button item in GameItemsRoot.GetComponentsInChildren <Button>()) { Text nameText = item.transform.Find("Name").GetComponent <Text>(); // nameText.text = jsonTestData.instance.gameItemList[gameIndex].name; item.onClick.AddListener(delegate() { GameItemClick(item.transform); }); gameIndex++; } } else { UISettingManager.ShakeUI(PriviosButton, new Vector3(0.05f, 0.05f, 0.05f), 1); } }
void DownButtonClick() { switch (columnType) { case ColumnType.RecommendVideo: break; case ColumnType.VR: int pages = JsonDataManager.instance.GetPages(columnType); int tatalCount = JsonDataManager.vrDataItems.Count; //总共数量 int previousCount = vrPageIndex * 4; //此时已经显示过的数量 int leftCount = tatalCount - previousCount; //还剩余的数量 if (previousCount < tatalCount) //保证显示的数量不能超过总的数量 { if (leftCount < 4) //当node数量小于显示的行数 { for (int i = 0; i < 4; i++) { if (i < leftCount) { leftButtonItems[i].transform.Find("Text").GetComponent <Text>().text = JsonDataManager.vrDataItems[i].title; } else { leftButtonItems[i].transform.Find("Text").GetComponent <Text>().text = ""; } } // seletedText.text = leftButtonItems[0].transform.Find("Text").GetComponent<Text>().text; } else { for (int i = 0; i < 4; i++) { leftButtonItems[i].transform.Find("Text").GetComponent <Text>().text = JsonDataManager.vrDataItems[vrPageIndex * 4 + i].title; } } vrPageIndex++; } else { UISettingManager.ShakeUI(downButton.transform, new Vector3(5f, 5f, 5f), 1); vrPageIndex = JsonDataManager.instance.GetPages(columnType); Debug.Log("已经不能向后翻页!"); } IniSelectItem(); break; case ColumnType.GiantScreen: int gsTatalCount = JsonDataManager.screenDataItems.Count; //总共数量 // Debug.Log("gsTatalCount" + gsTatalCount); int gsPreviousCount = gsPageIndex * 4; //此时已经显示过的数量 int gsLeftCount = gsTatalCount - gsPreviousCount; //还剩余的数量 if (gsPreviousCount < gsTatalCount) //保证显示的数量不能超过总的数量 { if (gsLeftCount < 4) //当node数量小于显示的行数 { for (int i = 0; i < 4; i++) { if (i < gsLeftCount) { leftButtonItems[i].transform.Find("Text").GetComponent <Text>().text = JsonDataManager.screenDataItems[i].title; } else { leftButtonItems[i].transform.Find("Text").GetComponent <Text>().text = ""; } } } else { for (int i = 0; i < 4; i++) { leftButtonItems[i].transform.Find("Text").GetComponent <Text>().text = JsonDataManager.screenDataItems[gsPageIndex * 4 + i].title; } } gsPageIndex++; } else { UISettingManager.ShakeUI(downButton.transform, new Vector3(5f, 5f, 5f), 1); gsPageIndex = JsonDataManager.instance.GetPages(columnType); Debug.Log("已经不能向后翻页!"); } IniSelectItem(); break; case ColumnType._4K: int _4kTatalCount = JsonDataManager._4kDataItems.Count; //总共数量 int _4kPreviousCount = _4kPageIndex * 4; //此时已经显示过的数量 int _4kLeftCount = _4kTatalCount - _4kPreviousCount; //还剩余的数量 if (_4kPreviousCount < _4kTatalCount) //保证显示的数量不能超过总的数量 { if (_4kLeftCount < 4) //当node数量小于显示的行数 { for (int i = 0; i < 4; i++) { if (i < _4kLeftCount) { leftButtonItems[i].transform.Find("Text").GetComponent <Text>().text = JsonDataManager._4kDataItems[i].title; } else { leftButtonItems[i].transform.Find("Text").GetComponent <Text>().text = ""; } } } else { for (int i = 0; i < 4; i++) { leftButtonItems[i].transform.Find("Text").GetComponent <Text>().text = JsonDataManager._4kDataItems[_4kPageIndex * 4 + i].title; } } _4kPageIndex++; } else { UISettingManager.ShakeUI(downButton.transform, new Vector3(5f, 5f, 5f), 1); _4kPageIndex = JsonDataManager.instance.GetPages(columnType); Debug.Log("已经不能向后翻页!"); } IniSelectItem(); break; default: break; } }
int _4kPageIndex = 1; //当前的页面索引 void UpButtonClick() { switch (columnType) { case ColumnType.RecommendVideo: break; case ColumnType.VR: int vrTatalCount = JsonDataManager.vrDataItems.Count; //总共数量 if (vrPageIndex > 1) { vrPageIndex--; int previousCount = (vrPageIndex - 1) * 4; //此时已经显示过的数量 for (int i = 0; i < 4; i++) { leftButtonItems[i].transform.Find("Text").GetComponent <Text>().text = JsonDataManager.vrDataItems[previousCount + i].title; } seletedText.text = leftButtonItems[0].transform.Find("Text").GetComponent <Text>().text; } else { UISettingManager.ShakeUI(upButton.transform, new Vector3(5f, 5f, 5f), 1); Debug.Log("已经不能向前翻页!"); vrPageIndex = 1; } break; case ColumnType.GiantScreen: int gsTatalCount = JsonDataManager.screenDataItems.Count; //总共数量 if (gsPageIndex > 1) { gsPageIndex--; int previousCount = (gsPageIndex - 1) * 4; //此时已经显示过的数量 for (int i = 0; i < 4; i++) { leftButtonItems[i].transform.Find("Text").GetComponent <Text>().text = JsonDataManager.screenDataItems[previousCount + i].title; } seletedText.text = leftButtonItems[0].transform.Find("Text").GetComponent <Text>().text; } else { UISettingManager.ShakeUI(upButton.transform, new Vector3(5f, 5f, 5f), 1); Debug.Log("已经不能向前翻页!"); gsPageIndex = 1; } break; case ColumnType._4K: int _4kTatalCount = JsonDataManager._4kDataItems.Count; //总共数量 if (_4kPageIndex > 1) { _4kPageIndex--; int previousCount = (_4kPageIndex - 1) * 4; //此时已经显示过的数量 for (int i = 0; i < 4; i++) { leftButtonItems[i].transform.Find("Text").GetComponent <Text>().text = JsonDataManager._4kDataItems[previousCount + i].title; } } else { UISettingManager.ShakeUI(upButton.transform, new Vector3(5f, 5f, 5f), 1); Debug.Log("已经不能向前翻页!"); _4kPageIndex = 1; } break; default: break; } }