private void DoCreateVideoItem(List <DayActionModel> videoList) { for (var i = 0; i < videoList.Count; i++) { var video = videoList[i]; mResLoader.LoadSync <GameObject>("ItemVideo") .Instantiate() .transform .LocalIdentity() .Parent(VideoScrollView.Find("Viewport").Find("Content")) .LocalScale(1, 1, 1) .ApplySelfTo(itemVideo => { var image = itemVideo.transform.Find("Video_Btn").Find("Image").Find("Video_Image") .GetComponent <Image>(); ImageDownloadUtils.Instance.SetAsyncImage(video.thumbnailPath, image); var name = itemVideo.transform.Find("Video_Btn").Find("V_Text").GetComponent <Text>(); name.text = video.name; itemVideo.transform.Find("Video_Btn").GetComponent <Button>().onClick.RemoveAllListeners(); itemVideo.transform.Find("Video_Btn").GetComponent <Button>().onClick .AddListener(delegate { OnVideoClick(video); }); }) .Show(); } if (videoList.Count == 0) { NoData.gameObject.SetActive(true); NoData.transform.Find("Text").GetComponent <Text>().text = "暂无已解锁视频哦~"; } else { NoData.gameObject.SetActive(false); } }
public void ShowVideo() { VideoScrollView.gameObject.SetActive(true); AudioScrollView.gameObject.SetActive(false); PicBookScrollView.gameObject.SetActive(false); if (VideoScrollView.Find("Viewport").Find("Content").childCount > 0) { NoData.gameObject.SetActive(false); return; } // 创建视频Item var index = PlayerPrefsUtil.GetBoxMonthIndex(); var total = PlayerPrefsUtil.ContentModel.boxList[index].videoList; for (int i = 0; i < total.Count; i++) { var model = total[i]; if (isCotainCheck(model)) { videoList.Add(model); } } DoCreateVideoItem(videoList); }