UserChooseSceneItem.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class UserChooseSceneItem : MonoBehaviour
  6. {
  7. public Toggle tg;
  8. //场景ID
  9. public string id;
  10. public Text itemName;
  11. public Mask mask;
  12. public Camera xrCamera;
  13. public GameObject model;
  14. public Button gotoSceneBtn;
  15. private RectTransform rectTransform;
  16. // Start is called before the first frame update
  17. void Start()
  18. {
  19. xrCamera = OpenXRCamera.Instance.GetComponent<Camera>();
  20. rectTransform = GetComponent<RectTransform>();
  21. gotoSceneBtn.onClick.AddListener(() => {
  22. GameManager.Instance.isShowDownTip = true;
  23. UIManager.Instance.ShowUI(UINameConfig.LoadingPanel, typeof(LoadingPanel), (int)ELoadState.download);
  24. GameScene.Instance.gotoScenes(id);
  25. DownloadResManager.Instance.StartDownLoad();
  26. });
  27. }
  28. // Update is called once per frame
  29. void Update()
  30. {
  31. if(mask)
  32. {
  33. //if(mask.IsRaycastLocationValid(rectTransform.position, xrCamera))
  34. //{
  35. // model.SetActive(true);
  36. //}
  37. //else
  38. //{
  39. // model.SetActive(false);
  40. //}
  41. // Debug.LogError( " MASK YC ");
  42. model.SetActive(mask.IsRaycastLocationValid(rectTransform.position, xrCamera));
  43. }
  44. }
  45. }