BoxNewUser.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class BoxNewUser : MonoBehaviour
  6. {
  7. [SerializeField] GameObject scrollViewContent;
  8. [SerializeField] GameObject scrollViewContentItem;
  9. List<int> titleIds = new List<int>();
  10. Dictionary<int, string> videoUrlDict = new Dictionary<int, string>();
  11. void Start()
  12. {
  13. titleIds.Add(0);
  14. if (CommonConfig.AppLanguage == 0)
  15. {
  16. titleIds.Add(12);
  17. videoUrlDict.Add(12, "https://www.bilibili.com/video/BV1o84y1K7C9/?vd_source=b030b3eb3477713cd294deb164dcb109");
  18. titleIds.Add(13);
  19. videoUrlDict.Add(13, "https://www.bilibili.com/video/BV1hj411c7Mx/?vd_source=b030b3eb3477713cd294deb164dcb109");
  20. }
  21. else
  22. {
  23. titleIds.Add(14);
  24. videoUrlDict.Add(14, "https://youtu.be/5AfYbdeFv54");
  25. }
  26. scrollViewContentItem.SetActive(false);
  27. int titleSeq = 1;
  28. foreach (var titleId in titleIds)
  29. {
  30. string title = TextAutoLanguage2.GetTextByKey("course_title_" + titleId);
  31. GameObject item = Instantiate(scrollViewContentItem, scrollViewContent.transform);
  32. item.GetComponentInChildren<Text>().text = titleSeq + "、" + title;
  33. titleSeq++;
  34. Button btn = item.transform.Find("Btn").GetComponent<Button>();
  35. btn.onClick.AddListener(delegate () {
  36. AudioMgr.ins.PlayBtn();
  37. if (titleId == 0)
  38. {
  39. NewUserGuiderManager.ins.ReviewNewUserGuide();
  40. return;
  41. }
  42. else
  43. {
  44. Application.OpenURL(videoUrlDict[titleId]);
  45. return;
  46. }
  47. });
  48. item.SetActive(true);
  49. }
  50. }
  51. }