using System; using System.Collections; using System.Collections.Generic; using QFramework; using UnityEngine; using UnityEngine.SceneManagement; using VRTK; /// /// 左手柄操作 /// public class LeftHandleController : MonoBehaviour { [SerializeField] private GameObject m_UICanvasPanel; /// /// 射线检测到的物体信息 /// private GameObject m_RayModelInfo; private VRTK_ControllerEvents m_LeftHandleController; // Start is called before the first frame update void Start() { Debug.Log("进入当前流程"); m_UICanvasPanel = transform.Find("UICanvas").gameObject; if (m_UICanvasPanel.activeInHierarchy) { m_UICanvasPanel.SetActive(false); } } /// /// 左手柄菜单键事件 /// /// /// private void LeftHandleEvent_ButtonTwoPressed(object sender, ControllerInteractionEventArgs e) { CloseAllPanel(); m_UICanvasPanel.SetActive(!m_UICanvasPanel.activeSelf); // 初始化面板操作 if (m_UICanvasPanel.activeSelf) { //m_UICanvasPanel.transform.Find("MenuPanel").GetComponent().InitOperation(); } } /// /// 左手柄菜单键事件 - 教学模式 /// /// /// private void RightHandleEvent_ButtonTwoPressed(object sender, ControllerInteractionEventArgs e) { CloseAllPanel(); } /// /// 右手柄射线检测滑入 /// /// /// /// private void RightPointer_DestinationMarkerEnter(object sender, DestinationMarkerEventArgs e) { } /// /// 右手柄扳机事件 /// /// /// private void RightHandleEvent_TriggerPressed(object sender, ControllerInteractionEventArgs e) { if (m_RayModelInfo == null) { return; } // 跳转场景 SceneManager.LoadSceneAsync("02.Operation"); } private void OnDisable() { // m_LeftHandleController.ButtonTwoPressed -= LeftHandleEvent_ButtonTwoPressed; // VREquipmentModel.Instance.RightControllerEvent.ButtonTwoPressed -= RightHandleEvent_ButtonTwoPressed; // VREquipmentModel.Instance.RightControllerEvent.TriggerPressed -= RightHandleEvent_TriggerPressed; } /// /// 关闭所有已打开面板 /// private void CloseAllPanel() { //PanelLoad.Instance.ClosePositiveAbnormalStatePanel(); //PanelLoad.Instance.CloseDetailedIntroductionPanel(); //PanelLoad.Instance.CloseAutomaticDisassemblyPanel(); } }