using System; using UnityEngine; public class CircleListSelectUI : MonoBehaviour { public AVRController controller { get; set; } public CircleCommandUI circleCommandUI { get { return this.m_CircleCommandUI; } } private void Start() { CircleCommandUI circleCommandUI = this.m_CircleCommandUI; circleCommandUI.funcDecide = (Func)Delegate.Combine(circleCommandUI.funcDecide, new Func(this.CallbackDecide)); } private void Update() { if (this.controller == null) { return; } AVRControllerButtons vrcontrollerButtons = this.controller.VRControllerButtons; Vector2 axis = vrcontrollerButtons.GetAxis(); if (axis.sqrMagnitude >= 0.2f) { this.m_CircleCommandUI.UpdateSelect(axis); this.SetActiveUI(true); } if (vrcontrollerButtons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_R_CLICK)) { this.SetActiveUI(false); } } private void SetActiveUI(GameObject UI, bool active) { if (UI.activeSelf && !active) { UI.SetActive(false); } else if (!UI.activeSelf && active) { UI.SetActive(true); } } public void SetActiveUI(bool active) { this.SetActiveUI(this.m_CircleCommandUI.gameObject, active); } private bool CallbackDecide() { if (this.controller == null) { return false; } AVRControllerButtons vrcontrollerButtons = this.controller.VRControllerButtons; return vrcontrollerButtons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_L_CLICK); } [SerializeField] private CircleCommandUI m_CircleCommandUI; }