12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using System;
- using UnityEngine;
- using UnityEngine.EventSystems;
- using UnityEngine.UI;
- public class SChooseItem : MonoBehaviour,IPointerClickHandler
- {
- public Text tname;
- /// <summary>
- /// 当选择场景时触发事件
- /// </summary>
- public event Action<SceneValue, bool> OnSelectScene;
- private SceneValue m_SceneData;
- public SceneValue SceneData
- {
- get { return m_SceneData; }
- set {
- Debug.Log("valuevaluevalue==>");
- Debug.Log("valuevaluevalue==>"+value.name);
- m_SceneData = value; }
- }
- public GameObject sceneChoose_go;
- private SceneChoose mSceneChoose;
- public void OnPointerClick(PointerEventData eventData)
- {
- Debug.Log("valuevaluevalue==>");
- Debug.Log("valuevaluevalue==>" + m_SceneData.name);
- mSceneChoose = sceneChoose_go.GetComponent<SceneChoose>();
- OnSelectScene?.Invoke(m_SceneData, true);
- mSceneChoose.OnClickOKBtn(m_SceneData);
- }
- public Camera xrCamera;
- public void init(SceneValue sv)
- {
- xrCamera = OpenXRCamera.Instance.GetComponent<Camera>();
- rectTransform = GetComponent<RectTransform>();
- SceneData = sv;
- tname.text = sv.name;
- }
- public Mask mask;
- public GameObject model;
- private RectTransform rectTransform;
- // Update is called once per frame
- void Update()
- {
- if (mask)
- {
- //if(mask.IsRaycastLocationValid(rectTransform.position, xrCamera))
- //{
- // model.SetActive(true);
- //}
- //else
- //{
- // model.SetActive(false);
- //}
- // Debug.LogError( " MASK YC ");
- model.SetActive(mask.IsRaycastLocationValid(rectTransform.position, xrCamera));
- }
- }
- }
|