UserChooseSceneItem.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. }
  43. }
  44. }