private void Awake() { HorizontalGroup = transform.Find("HorizontalGroup"); Ctr = HorizontalGroup.Find("Ctr"); Usb = HorizontalGroup.Find("Usb"); Beacon = HorizontalGroup.Find("Beacon"); CtrFlag = Ctr.Find("Flag"); UsbFlag = Usb.Find("Flag"); BeaconFlag = Beacon.Find("Flag"); CtrSwitch = Ctr.Find("Switch").GetComponent <UnityEngine.UI.Image>(); UsbSwitch = Usb.Find("Switch").GetComponent <UnityEngine.UI.Image>(); BeaconSwitch = Beacon.Find("Switch"); MirageAR_UIEventListener.Get(Ctr.gameObject).onClick = DoCtrEvent; MirageAR_UIEventListener.Get(Usb.gameObject).onClick = DoUsbEvent; MirageAR_UIEventListener.Get(Beacon.gameObject).onClick = DoBeaconEvent; SettingHint.CtrState += SetCtr; UsbState.usbState += SetUsb; #if UNITY_IOS MirageAR_UIEventListener.Get(Usb.gameObject).onClick -= DoUsbEvent; UsbState.usbState -= SetUsb; HorizontalGroup.GetComponent <UnityEngine.UI.HorizontalLayoutGroup>().spacing = -150.17f; Usb.gameObject.SetActive(false); #endif }
public static MirageAR_UIEventListener CheckAndAddListener(GameObject go) { MirageAR_UIEventListener listener = go.GetComponent <MirageAR_UIEventListener>(); if (listener == null) { listener = go.AddComponent <MirageAR_UIEventListener>(); } return(listener); }
private void OnEnable() { InvokeRepeating("UpdateHmdInfo", 0, m_UpdateFreq); InvokeRepeating("UpdateComtrollerInfo", 0, m_UpdateFreq); MirageAR_UIEventListener.Get(m_BtnCancel).onClickWithData += BtnCancel_Onclick; MirageAR_UIEventListener.Get(m_BtnQuit).onClickWithData += BtnQuit_Onclick; MirageAR_UIEventListener.Get(m_VolumeDashboard_CircleFront).onClickWithData += VolumeDashboard_CircleFront_OnClickWithData; MirageAR_UIEventListener.Get(m_VolumeDashboard_CircleFront).onPointerEnter += VolumeDashboard_CircleFront_OnPointerEnter; MirageAR_UIEventListener.Get(m_VolumeDashboard_CircleFront).onPointerExit += VolumeDashboard_CircleFront_OnPointerExit; MirageAR_UIEventListener.Get(m_BrightnessDashboard_CircleFront).onClickWithData += BrightnessDashboard_CircleFront_OnClickWithData; MirageAR_UIEventListener.Get(m_BrightnessDashboard_CircleFront).onPointerEnter += BrightnessDashboard_CircleFront_OnPointerEnter; MirageAR_UIEventListener.Get(m_BrightnessDashboard_CircleFront).onPointerExit += BrightnessDashboard_CircleFront_OnPointerExit; // Set VRTK Input Activation Mode SetVRTKInputActivationMode(); }
private void OnDisable() { CancelInvoke("UpdateHmdInfo"); CancelInvoke("UpdateComtrollerInfo"); MirageAR_UIEventListener.Get(m_BtnCancel).onClickWithData -= BtnCancel_Onclick; MirageAR_UIEventListener.Get(m_BtnQuit).onClickWithData -= BtnQuit_Onclick; MirageAR_UIEventListener.Get(m_VolumeDashboard_CircleFront).onClickWithData -= VolumeDashboard_CircleFront_OnClickWithData; MirageAR_UIEventListener.Get(m_VolumeDashboard_CircleFront).onPointerEnter -= VolumeDashboard_CircleFront_OnPointerEnter; MirageAR_UIEventListener.Get(m_VolumeDashboard_CircleFront).onPointerExit -= VolumeDashboard_CircleFront_OnPointerExit; MirageAR_UIEventListener.Get(m_BrightnessDashboard_CircleFront).onClickWithData -= BrightnessDashboard_CircleFront_OnClickWithData; MirageAR_UIEventListener.Get(m_BrightnessDashboard_CircleFront).onPointerEnter -= BrightnessDashboard_CircleFront_OnPointerEnter; MirageAR_UIEventListener.Get(m_BrightnessDashboard_CircleFront).onPointerExit -= BrightnessDashboard_CircleFront_OnPointerExit; // Recover VRTK Input Activation Mode RecoverVRTKInputActivationMode(); }