using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; public class VRSelectorMenu : MonoBehaviour { public static VRSelectorMenu CreateSelector() { if (VRSelectorMenu.m_Instance == null) { VRSelectorMenu.m_Instance = UnityEngine.Object.FindObjectOfType(); } return VRSelectorMenu.m_Instance; } private void Start() { if (VRSelectorMenu.m_Instance != null) { } VRSelectorMenu.m_Instance = this; base.gameObject.SetActive(false); } public void Open() { for (int i = 0; i < this.m_ParentButtonArea.childCount; i++) { this.m_ParentButtonArea.GetChild(i).gameObject.SetActive(false); } VRCanvasManager.Instance.OpenVRCanvas(VRCanvasManager.VRCanvasType.NONE); UICanvasFade component = base.GetComponent(); component.FadeIn(); } public void Close(UnityAction callback = null) { UICanvasFade component = base.GetComponent(); component.FadeOut(component.fadeTime, component.isTimeScaling, callback); VRCanvasManager.Instance.OpenVRCanvas(VRCanvasManager.VRCanvasType.MainMenu); } public void SelectStart(List choices, UnityAction callback) { VRSelectorMenu.m_Instance.Open(); for (int i = 0; i < choices.Count; i++) { VRChoices.SelectPair choice = choices[i]; GameObject gameObject; if (this.m_ParentButtonArea.childCount > i) { gameObject = this.m_ParentButtonArea.GetChild(i).gameObject; } else { gameObject = UnityEngine.Object.Instantiate(this.m_PrefabSelectorButton); gameObject.transform.SetParent(this.m_ParentButtonArea, false); } gameObject.SetActive(true); Button component = gameObject.GetComponent