using System; using UnityEngine; using UnityEngine.UI; public class VREventText : MonoBehaviour { private void Awake() { this.m_txEventName = base.transform.Find("Canvas/Text").GetComponent(); this.m_txGauge = base.transform.Find("Canvas/Gauge").GetComponent(); this.m_txEventName.gameObject.SetActive(this.m_bEnable); this.m_txGauge.gameObject.SetActive(this.m_bEnable); this.UpdateEnableText(); } public void SetEventName(string f_strEventName) { this.m_txEventName.text = f_strEventName; } public void UseGauge(bool f_bUse) { this.m_txGauge.gameObject.SetActive(f_bUse); this.m_bUseGauge = f_bUse; } public void SetGaugeRate(float f_fRate) { this.m_txGauge.Range = 1f; f_fRate = Mathf.Min(1f, Mathf.Max(f_fRate, 0f)); this.m_txGauge.Range = 1f - 0.5f * f_fRate; } public void Show(VREventText.TYPE f_eType, string f_strEventName, float f_fRate = 0f) { this.m_unTypeFlag |= (uint)f_eType; this.SetEventName(f_strEventName); this.UseGauge(true); this.SetGaugeRate(f_fRate); this.UpdateEnableText(); } public void Hide(VREventText.TYPE f_eType) { this.m_unTypeFlag &= (uint)(~(uint)f_eType); this.UpdateEnableText(); } private void UpdateEnableText() { bool flag = this.m_unTypeFlag != 0U; if (this.m_bEnable != flag) { this.m_txEventName.gameObject.SetActive(flag); this.m_txGauge.gameObject.SetActive(flag); this.m_bEnable = flag; } } private void Update() { this.UpdateEnableText(); } private Text m_txEventName; private UGuiRule m_txGauge; private VREventText.dgCallBackEvent m_dgCallBack; private bool m_bUseGauge; private uint m_unTypeFlag; private bool m_bEnable; public delegate void dgCallBackEvent(); public enum TYPE { CHOICES = 1, GRAB, LOOK = 4 } }