private void Start() { if (photonView.IsMine) { // If the cancel button is not the last element in the last, move it to the end if (buttons.IndexOf(cancelButton) != buttons.Count - 1) { buttons.Remove(cancelButton); buttons.Add(cancelButton); } cancelButton.transform.position = topPosition; cancelButton.Color = selectedColor; activeButton = cancelButton; // Make all other buttons size 0 for (int i = 0; i < buttons.Count; i++) { if (buttons[i] != cancelButton) { buttons[i].transform.localScale = Vector3.zero; } } controllerEvents = transform.parent.GetComponentInChildren <VRTK_ControllerEvents>(); controllerEvents.TouchpadPressed += OnTouchpadPressed; controllerEvents.TouchpadReleased += OnTouchpadReleased; } else { isEnabled = false; } }
public void SpinMenuButtonClicked(SpinMenuButton spinMenuButton) { if (isEnabled) { // If the menu is closed, open it if (!isExpanded) { isExpanded = true; ExpandButtons(); } // If the menu is open, choose the clicked button else { // But if it is the details on demand, toggle it instead if (spinMenuButton == detailsOnDemandButton) { // SpinMenuToolChanged.Invoke(spinMenuButton.RangedInteractionsToolName); } else { isExpanded = false; ActiveButtonChanged(spinMenuButton); RetractButtons(); DataLogger.Instance.LogActionData(this, PhotonNetwork.LocalPlayer, PhotonNetwork.LocalPlayer, "Spin Menu end"); } } } }
private void ActiveButtonChanged(SpinMenuButton spinMenuButton) { activeButton = spinMenuButton; foreach (SpinMenuButton button in buttons) { button.Color = (button == activeButton) ? selectedColor : unselectedColor; } SpinMenuToolChanged.Invoke(spinMenuButton.RangedInteractionsToolName); }