/// <summary> /// /// </summary> public virtual void DeactivateAllSubmenus() { SelectorMenu.Instance.gameObject.SetActive(true); if (RenameDialog.Visible) { RenameDialog.Cancel(); } TransformMenu.Instance.Hide(); RobotSteppingMenu.Instance.Hide(); MainSettingsMenu.Instance.Hide(); ActionObjectMenu.Instance.Hide(); FavoritesButtons.SetActive(false); HomeButtons.SetActive(false); UtilityButtons.SetActive(false); AddButtons.SetActive(false); RobotButtons.SetActive(false); FavoritesButton.GetComponent <Image>().enabled = false; RobotButton.GetComponent <Image>().enabled = false; AddButton.GetComponent <Image>().enabled = false; UtilityButton.GetComponent <Image>().enabled = false; HomeButton.GetComponent <Image>().enabled = false; MainSettingsButton.GetComponent <Image>().enabled = false; MoveButton.GetComponent <Image>().enabled = false; MoveButton2.GetComponent <Image>().enabled = false; OpenMenuButton.GetComponent <Image>().enabled = false; RobotSelectorButton.GetComponent <Image>().enabled = false; RobotSteppingButton.GetComponent <Image>().enabled = false; RobotSelector.Close(false); }
protected virtual void Start() { LockingEventsCache.Instance.OnObjectLockingEvent += OnObjectLockingEvent; SceneManager.Instance.OnRobotSelected += OnRobotSelected; if (MoveButton != null && MoveButton2 != null) { MoveButton.SetDescription(MOVE_BTN_LABEL); MoveButton2.SetDescription(MOVE_BTN_LABEL); } if (RemoveButton != null) { RemoveButton.SetDescription(REMOVE_BTN_LABEL); } if (RenameButton != null) { RenameButton.SetDescription(RENAME_BTN_LABEL); } if (CalibrationButton != null) { CalibrationButton.SetDescription(CALIBRATION_BTN_LABEL); } if (OpenMenuButton != null) { OpenMenuButton.SetDescription(OPEN_MENU_BTN_LABEL); } if (RobotSteppingButton != null) { RobotSteppingButton.SetDescription(ROBOT_STEPPING_MENU_BTN_LABEL); } if (RobotSelectorButton != null) { RobotSelectorButton.SetDescription(ROBOT_SELECTOR_MENU_BTN_LABEL); } }
public void OpenMenuButtonClick() { InteractiveObject selectedObject = SelectorMenu.Instance.GetSelectedObject(); if (selectedObject is null) { return; } if (!SelectorMenu.Instance.gameObject.activeSelf && !OpenMenuButton.GetComponent <Image>().enabled) //other menu/dialog opened { SetActiveSubmenu(CurrentSubmenuOpened); //close all other opened menus/dialogs and takes care of red background of buttons } if (OpenMenuButton.GetComponent <Image>().enabled) { OpenMenuButton.GetComponent <Image>().enabled = false; SelectorMenu.Instance.gameObject.SetActive(true); selectedObject.CloseMenu(); } else { OpenMenuButton.GetComponent <Image>().enabled = true; SelectorMenu.Instance.gameObject.SetActive(false); selectedObject.OpenMenu(); } }
protected async virtual Task UpdateBtns(InteractiveObject obj) { if (CanvasGroup.alpha == 0) { return; } UpdateRobotSelectorAndSteppingButtons(); if (requestingObject || obj == null) { SelectedObjectText.text = ""; MoveButton.SetInteractivity(false, $"{MOVE_BTN_LABEL}\n(no object selected)"); MoveButton2.SetInteractivity(false, $"{MOVE_BTN_LABEL}\n(no object selected)"); RemoveButton.SetInteractivity(false, $"{REMOVE_BTN_LABEL}\n(no object selected)"); RenameButton.SetInteractivity(false, $"{RENAME_BTN_LABEL}\n(no object selected)"); CalibrationButton.SetInteractivity(false, $"{CALIBRATION_BTN_LABEL}\n(no object selected)"); OpenMenuButton.SetInteractivity(false, $"{OPEN_MENU_BTN_LABEL}\n(no object selected)"); } else if (obj.IsLocked && obj.LockOwner != LandingScreen.Instance.GetUsername()) { SelectedObjectText.text = obj.GetName() + "\n" + obj.GetObjectTypeName(); MoveButton.SetInteractivity(false, $"{MOVE_BTN_LABEL}\n(object is used by {obj.LockOwner})"); MoveButton2.SetInteractivity(false, $"{MOVE_BTN_LABEL}\n(object is used by {obj.LockOwner})"); RemoveButton.SetInteractivity(false, $"{REMOVE_BTN_LABEL}\n(object is used by {obj.LockOwner})"); RenameButton.SetInteractivity(false, $"{RENAME_BTN_LABEL}\n(object is used by {obj.LockOwner})"); CalibrationButton.SetInteractivity(false, $"{CALIBRATION_BTN_LABEL}\n(object is used by {obj.LockOwner})"); OpenMenuButton.SetInteractivity(false, $"{OPEN_MENU_BTN_LABEL}\n(object is used by {obj.LockOwner})"); } else { SelectedObjectText.text = obj.GetName() + "\n" + obj.GetObjectTypeName(); MoveButton.SetInteractivity(false, $"{MOVE_BTN_LABEL}\n(loading...)"); MoveButton2.SetInteractivity(false, $"{MOVE_BTN_LABEL}\n(loading...)"); RemoveButton.SetInteractivity(false, $"{REMOVE_BTN_LABEL}\n(loading...)"); Task <RequestResult> tMove = Task.Run(() => obj.Movable()); Task <RequestResult> tRemove = Task.Run(() => obj.Removable()); UpdateMoveAndRemoveBtns(selectedObject.GetId(), tMove, tRemove); RenameButton.SetInteractivity(obj.GetType() == typeof(ActionPoint3D) || obj.GetType() == typeof(Action3D) || (obj.GetType().IsSubclassOf(typeof(ActionObject)) && !SceneManager.Instance.SceneStarted && GameManager.Instance.GetGameState() == GameStateEnum.SceneEditor) || obj.GetType() == typeof(APOrientation), $"{RENAME_BTN_LABEL}\n(selected object could not be renamed)"); CalibrationButton.SetInteractivity(obj.GetType() == typeof(Recalibrate) || obj.GetType() == typeof(CreateAnchor) || obj.GetType() == typeof(RecalibrateUsingServer), $"{CALIBRATION_BTN_LABEL}\n(selected object is not calibration cube)"); if (obj is Action3D action) { OpenMenuButton.SetInteractivity(action.Parameters.Count > 0, "Open action parameters menu\n(action has no parameters)"); } else { OpenMenuButton.SetInteractivity(obj.HasMenu(), $"{OPEN_MENU_BTN_LABEL}\n(selected object has no menu)"); } } }
protected async override Task UpdateBtns(InteractiveObject obj) { try { if (CanvasGroup.alpha == 0) { return; } if (requestingObject || obj == null) { SelectedObjectText.text = ""; OpenMenuButton.SetInteractivity(false, "No object selected"); CalibrationButton.SetInteractivity(false, "No object selected"); } else if (obj.IsLocked) { SelectedObjectText.text = obj.GetName() + "\n" + obj.GetObjectTypeName(); OpenMenuButton.SetInteractivity(false, "Object is locked"); CalibrationButton.SetInteractivity(false, "Object is locked"); } else { SelectedObjectText.text = obj.GetName() + "\n" + obj.GetObjectTypeName(); CalibrationButton.SetInteractivity(obj.GetType() == typeof(Recalibrate) || obj.GetType() == typeof(CreateAnchor) || obj.GetType() == typeof(RecalibrateUsingServer), "Selected object is not calibration cube"); if (obj is Action3D action) { OpenMenuButton.SetInteractivity(action.Parameters.Count > 0, "Action has no parameters"); } else { OpenMenuButton.SetInteractivity(obj.HasMenu(), "Selected object has no menu"); } } } finally { previousUpdateDone = true; } }
/// <summary> /// Open the Flux Menu /// </summary> public void OpenMenu() { OpenMenuButton.Click(); }