BoxNewUser.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. for (int i = 1; i < titleIds.Count; i++)
  29. {
  30. var titleId = titleIds[i];
  31. string title = TextAutoLanguage2.GetTextByKey("course_title_" + titleId);
  32. GameObject item = Instantiate(scrollViewContentItem, scrollViewContent.transform);
  33. item.GetComponentInChildren<Text>().text = titleSeq + "、" + title;
  34. titleSeq++;
  35. Button btn = item.transform.Find("Btn").GetComponent<Button>();
  36. btn.onClick.AddListener(delegate () {
  37. AudioMgr.ins.PlayBtn();
  38. if (titleId == 0)
  39. {
  40. NewUserGuiderManager.ins.ReviewNewUserGuide();
  41. return;
  42. }
  43. else
  44. {
  45. Application.OpenURL(videoUrlDict[titleId]);
  46. return;
  47. }
  48. });
  49. item.SetActive(true);
  50. }
  51. }
  52. }