Example #1
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);
     }
 }
Example #2
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)");
            }
        }
    }
Example #3
0
    void Awake()
    {
        foreach (SurfaceObject surfaceObject in SurfaceObjectDetector.Instance.surfaceObjects)
        {
            GameObject        obj = Instantiate(calibrationButtonPrefab);
            CalibrationButton calibrationButton = obj.GetComponent <CalibrationButton>();
            calibrationButton.Init(this, surfaceObject);
            calibrationButtons.Add(calibrationButton);
            calibrationButton.transform.SetParent(calibrationButtonParent);
        }

        calibrationText.enabled = false;
    }
    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;
        }
    }