BoxNewUser.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. titleIds.Add(15);
  21. videoUrlDict.Add(15, "https://www.bilibili.com/video/BV1Eu4y1L7gh/?vd_source=ab2d11694c7b3b358b665454a7089856");
  22. titleIds.Add(16);
  23. videoUrlDict.Add(16, "https://www.bilibili.com/video/BV1Ku4y1c74Y/?vd_source=ab2d11694c7b3b358b665454a7089856");
  24. titleIds.Add(17);
  25. videoUrlDict.Add(17, "https://www.bilibili.com/video/BV1B64y1L7n1/?vd_source=ab2d11694c7b3b358b665454a7089856");
  26. titleIds.Add(18);
  27. videoUrlDict.Add(18, "https://www.bilibili.com/video/BV1eC4y1y75u/?vd_source=ab2d11694c7b3b358b665454a7089856");
  28. titleIds.Add(19);
  29. videoUrlDict.Add(19, "https://www.bilibili.com/video/BV1qc411Q7Xy/?vd_source=ab2d11694c7b3b358b665454a7089856");
  30. titleIds.Add(101);
  31. videoUrlDict.Add(101, "https://www.bilibili.com/video/BV1Se41117qt/");
  32. titleIds.Add(102);
  33. videoUrlDict.Add(102, "https://www.bilibili.com/video/BV1394y1K7yT/");
  34. titleIds.Add(103);
  35. videoUrlDict.Add(103, "https://www.bilibili.com/video/BV1sc411Y7QW/");
  36. titleIds.Add(104);
  37. videoUrlDict.Add(104, "https://www.bilibili.com/video/BV1U5411k7ZT/");
  38. titleIds.Add(105);
  39. videoUrlDict.Add(105, "https://www.bilibili.com/video/BV1Cz421Q7f9/");
  40. }
  41. else
  42. {
  43. //titleIds.Add(14);
  44. //videoUrlDict.Add(14, "https://youtu.be/5AfYbdeFv54");
  45. titleIds.Add(20);
  46. videoUrlDict.Add(20, "https://youtu.be/SWuFjGNDTbk");
  47. titleIds.Add(21);
  48. videoUrlDict.Add(21, "https://youtu.be/5Ve9e81fbfc");
  49. titleIds.Add(22);
  50. videoUrlDict.Add(22, "https://youtu.be/yvBTbYjEKG4");
  51. titleIds.Add(23);
  52. videoUrlDict.Add(23, "https://youtu.be/CEY8LWODknI");
  53. titleIds.Add(201);
  54. videoUrlDict.Add(201, "https://youtu.be/DG0oKrXf390");
  55. titleIds.Add(202);
  56. videoUrlDict.Add(202, "https://youtu.be/6vV2EcxsRLk");
  57. titleIds.Add(203);
  58. videoUrlDict.Add(203, "https://youtu.be/R6jrrifMiiw");
  59. titleIds.Add(204);
  60. videoUrlDict.Add(204, "https://youtu.be/as5wvjRVcS0");
  61. titleIds.Add(205);
  62. videoUrlDict.Add(205, "https://youtu.be/EOC8bFgF0Zo");
  63. titleIds.Add(206);
  64. videoUrlDict.Add(206, "https://youtu.be/QPoVLZMpS-8");
  65. }
  66. scrollViewContentItem.SetActive(false);
  67. int titleSeq = 1;
  68. for (int i = 1; i < titleIds.Count; i++)
  69. {
  70. var titleId = titleIds[i];
  71. string title = TextAutoLanguage2.GetTextByKey("course_title_" + titleId);
  72. GameObject item = Instantiate(scrollViewContentItem, scrollViewContent.transform);
  73. item.GetComponentInChildren<Text>().text = titleSeq + "、" + title;
  74. titleSeq++;
  75. Button btn = item.transform.Find("Btn").GetComponent<Button>();
  76. btn.onClick.AddListener(delegate () {
  77. AudioMgr.ins.PlayBtn();
  78. if (titleId == 0)
  79. {
  80. NewUserGuiderManager.ins.ReviewNewUserGuide();
  81. return;
  82. }
  83. else
  84. {
  85. Application.OpenURL(videoUrlDict[titleId]);
  86. return;
  87. }
  88. });
  89. item.SetActive(true);
  90. }
  91. }
  92. }