CourseView.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. /* 教程界面(主界面功能) */
  6. public class CourseView : MonoBehaviour
  7. {
  8. [SerializeField] GameObject scrollViewContent;
  9. [SerializeField] GameObject scrollViewContentItem;
  10. string[] titles = {
  11. "弓的介绍及护具佩戴",
  12. "热身",
  13. "站姿",
  14. "沉肩转臂",
  15. "搭箭推弓",
  16. "预开弓",
  17. "举弓开弓",
  18. "靠位",
  19. "瞄准",
  20. "撒放",
  21. "结束动作"
  22. };
  23. public void Awake() {
  24. scrollViewContentItem.SetActive(false);
  25. int id = 0;
  26. foreach (string title in titles)
  27. {
  28. id++;
  29. int currentID = id;
  30. GameObject item = Instantiate<GameObject>(scrollViewContentItem, scrollViewContent.transform);
  31. item.GetComponent<Text>().text = currentID + "、" + title;
  32. item.GetComponentInChildren<Button>().onClick.AddListener(delegate() {
  33. GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/VideoView"));
  34. VideoView videoView = o.GetComponent<VideoView>();
  35. videoView.url = $"https://smartbow-course-1258277015.cos.ap-guangzhou.myqcloud.com/{currentID}.mp4";
  36. });
  37. item.SetActive(true);
  38. }
  39. }
  40. public void back() {
  41. AudioMgr.ins.PlayBtn();
  42. Destroy(this.gameObject);
  43. }
  44. }