예제 #1
0
    private void OnDestroy()
    {
#if UNITY_ANDROID && AR_ON
        PlayerPrefsHelper.SaveBool("control_box_display_trackables", (bool)Trackables.GetValue());
        PlayerPrefsHelper.SaveBool("control_box_autoCalib", (bool)AutoCalibration.GetValue());
#endif
        PlayerPrefsHelper.SaveBool("control_box_display_connections", (bool)ConnectionsSwitch.GetValue());
    }
예제 #2
0
 private void Start()
 {
     SceneManager.Instance.OnLoadScene     += OnLoadScene;
     ProjectManager.Instance.OnLoadProject += OnLoadProject;
     EditConstantDialog = (EditProjectParameterDialog)AREditorResources.Instance.EditProjectParameterDialog;
     ConnectionsSwitch.AddOnValueChangedListener((_) => AREditorResources.Instance.LeftMenuProject.UpdateBtns());
     ConnectionsSwitch.AddOnValueChangedListener(ProjectManager.Instance.SetActionInputOutputVisibility);
     WebsocketManager.Instance.OnProjectParameterAdded   += OnProjectParameterAdded;
     WebsocketManager.Instance.OnProjectParameterRemoved += OnProjectParameterRemoved;
 }
예제 #3
0
    private void OnProjectOrSceneLoaded(bool project)
    {
        foreach (GameObject obj in ProjectRelatedSettings)
        {
            obj.SetActive(project);
        }
        if (project)
        {
            APSizeSlider.gameObject.SetActive(true);
            APOrientationsVisibility.gameObject.SetActive(true);
            APSizeSlider.value = ProjectManager.Instance.APSize;
            APOrientationsVisibility.SetValue(Base.ProjectManager.Instance.APOrientationsVisible);

            SwitchToProjectParametersBtn.SetInteractivity(true);
            SwitchToProjectParametersBtnImage.color = Color.white;
            GenerateParameterButtons();
            WebsocketManager.Instance.OnProjectParameterAdded   += OnProjectParameterAdded;
            WebsocketManager.Instance.OnProjectParameterRemoved += OnProjectParameterRemoved;
        }
        else
        {
            APSizeSlider.gameObject.SetActive(false);
            APOrientationsVisibility.gameObject.SetActive(false);
            SwitchToProjectParametersBtn.SetInteractivity(false, "Project parameters are available only in project editor.");
            SwitchToProjectParametersBtnImage.color = Color.gray;
        }

        Interactibility.SetValue(Base.SceneManager.Instance.ActionObjectsInteractive);
        RobotsEEVisible.SetValue(Base.SceneManager.Instance.RobotsEEVisible, false);
        ActionObjectsVisibilitySlider.SetValueWithoutNotify(SceneManager.Instance.ActionObjectsVisibility * 100f);

#if UNITY_ANDROID && AR_ON
        recalibrationTime.SetValue(CalibrationManager.Instance.AutoRecalibrateTime);
        Trackables.SetValue(PlayerPrefsHelper.LoadBool("control_box_display_trackables", false));
        CalibrationElements.Interactable = false;
        CalibrationElements.SetValue(true);
        CalibrationElementsTooltip.DisplayAlternativeDescription = true;


        bool useAutoCalib = PlayerPrefsHelper.LoadBool("control_box_autoCalib", true);

        AutoCalibTooltip.DisplayAlternativeDescription = useAutoCalib;


        AutoCalibration.SetValue(useAutoCalib);
        // If the toggle is unchanged, we need to manually call the EnableAutoReCalibration function.
        // If the toggle has changed, the function will be called automatically. So we need to avoid calling it twice.
        if (((bool)AutoCalibration.GetValue() && useAutoCalib) || (!(bool)AutoCalibration.GetValue() && !useAutoCalib))
        {
            EnableAutoReCalibration(useAutoCalib);
        }
#endif
        ConnectionsSwitch.SetValue(PlayerPrefsHelper.LoadBool("control_box_display_connections", true));
        recalibrationTime.SetValue(PlayerPrefsHelper.LoadString("/autoCalib/recalibrationTime", "120"));
        string uri = PlayerPrefsHelper.LoadString("ProjectServiceURI", "");
        ProjectServiceURI.Input.SetValue(GetProjectServiceURI(false));
        if (string.IsNullOrEmpty(uri))
        {
            ResetProjectServiceURIButton.SetInteractivity(false, "Default value is already set");
        }
        else
        {
            ResetProjectServiceURIButton.SetInteractivity(true);
        }
    }