예제 #1
0
 private void DoCreateAudioItem(List <DayActionModel> audioModel)
 {
     audioModel.ForEach(audio =>
     {
         mResLoader.LoadSync <GameObject>("ItemAudio")
         .Instantiate()
         .transform
         .LocalIdentity()
         .Parent(AudioScrollView.Find("Viewport").Find("Content"))
         .LocalScale(1, 1, 1)
         .ApplySelfTo(audioItem =>
         {
             var image = audioItem.transform.Find("Image").Find("Image").GetComponent <Image>();
             ImageDownloadUtils.Instance.SetAsyncImage(audio.thumbnailPath, image);
             var name  = audioItem.transform.Find("ImageBottom/Text").GetComponent <Text>();
             name.text = audio.name;
             audioItem.GetComponent <Button>().onClick.RemoveAllListeners();
             audioItem.GetComponent <Button>().onClick
             .AddListener(delegate { OnClickAudio(audio); });
         })
         .Show();
     });
     if (audioModel.Count == 0)
     {
         NoData.gameObject.SetActive(true);
         NoData.transform.Find("Text").GetComponent <Text>().text = "暂无已解锁音频哦~";
     }
     else
     {
         NoData.gameObject.SetActive(false);
     }
 }
예제 #2
0
        public void ShowAudio()
        {
            VideoScrollView.gameObject.SetActive(false);
            AudioScrollView.gameObject.SetActive(true);
            PicBookScrollView.gameObject.SetActive(false);
            if (AudioScrollView.Find("Viewport").Find("Content").childCount > 0)
            {
                NoData.gameObject.SetActive(false);
                return;
            }
            // 创建视频Item
            var index = PlayerPrefsUtil.GetBoxMonthIndex();
            // 取出该盒子下的音频列表
            var total = PlayerPrefsUtil.ContentModel.boxList[index].audioList;

            for (int i = 0; i < total.Count; i++)
            {
                var model = total[i];
                if (isCotainCheck(model))
                {
                    audioList.Add(model);
                }
            }
            DoCreateAudioItem(audioList);
        }