Beispiel #1
0
 protected virtual void OnSceneStateEvent(object sender, SceneStateEventArgs args)
 {
     if (args.Event.State == SceneStateData.StateEnum.Stopping)
     {
         if (TransformMenu.Instance.CanvasGroup.alpha == 1 && TransformMenu.Instance.RobotTabletBtn.CurrentState == TwoStatesToggleNew.States.Left)
         {
             MoveButton.GetComponent <Image>().enabled  = false;
             MoveButton2.GetComponent <Image>().enabled = false;
             TransformMenu.Instance.Hide();
             SelectorMenu.Instance.gameObject.SetActive(true);
         }
         if (RobotSteppingMenu.Instance.CanvasGroup.alpha == 1)
         {
             Debug.LogError(RobotSteppingButton.GetComponent <Image>().enabled);
             RobotSteppingButton.GetComponent <Image>().enabled = false;
             Debug.LogError(RobotSteppingButton.GetComponent <Image>().enabled);
             RobotSteppingMenu.Instance.Hide();
             SelectorMenu.Instance.gameObject.SetActive(true);
         }
         if (RobotSelector.Opened())
         {
             RobotSelector.Close(false);
             RobotSelectorButton.GetComponent <Image>().enabled = false;
         }
         UpdateVisibility();
     }
     else if (args.Event.State == SceneStateData.StateEnum.Started || args.Event.State == SceneStateData.StateEnum.Stopped)
     {
         UpdateBuildAndSaveBtns();
         UpdateRobotSelectorAndSteppingButtons();
     }
 }
Beispiel #2
0
    /// <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);
    }
Beispiel #3
0
 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);
     }
 }
Beispiel #4
0
    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)");
            }
        }
    }
Beispiel #5
0
    private async void UpdateMoveAndRemoveBtns(string objId, Task <RequestResult> movable, Task <RequestResult> removable)
    {
        RequestResult move   = await movable;
        RequestResult remove = await removable;

        if (selectedObject != null && objId != selectedObject.GetId()) // selected object was updated in the meantime
        {
            return;
        }
        MoveButton.SetInteractivity(move.Success, $"{MOVE_BTN_LABEL}\n({move.Message})");
        MoveButton2.SetInteractivity(move.Success, $"{MOVE_BTN_LABEL}\n({move.Message})");
        RemoveButton.SetInteractivity(remove.Success, $"{REMOVE_BTN_LABEL}\n({remove.Message})");
    }