Exemplo n.º 1
0
        void StartInstruction()
        {
            Dispatcher.Dispatch(ShowModelAction.From(true));
            Dispatcher.Dispatch(SetInstructionUIStateAction.From(SetInstructionUIStateAction.InstructionUIState.Init));
            Dispatcher.Dispatch(SetARInstructionUIAction.From(new { currentARInstructionUI = this }));

            Dispatcher.Dispatch(SetAREnabledAction.From(false));
            Dispatcher.Dispatch(SetActiveToolBarAction.From(SetActiveToolBarAction.ToolbarType.ARModelAlignSidebar));
            Dispatcher.Dispatch(SetInstructionMode.From(true));
            Dispatcher.Dispatch(SetModelScaleAction.From(SetModelScaleAction.ArchitectureScale.OneToOne));

            Dispatcher.Dispatch(EnableBimFilterAction.From(true));
            Dispatcher.Dispatch(EnableSceneSettingsAction.From(true));
            Dispatcher.Dispatch(EnableSunStudyAction.From(false));
            Dispatcher.Dispatch(EnableMarkerSettingsAction.From(false));
            Dispatcher.Dispatch(ToggleMeasureToolAction.From(ToggleMeasureToolAction.ToggleMeasureToolData.defaultData));

            var toolState = SetARToolStateAction.SetARToolStateData.defaultData;

            toolState.selectionEnabled   = true;
            toolState.measureToolEnabled = true;
            toolState.scaleEnabled       = true;
            toolState.cancelEnabled      = true;
            Dispatcher.Dispatch(SetARToolStateAction.From(toolState));
            Next();
        }
Exemplo n.º 2
0
        void OnButtonClick()
        {
            var dialogMode = m_DialogModeSelector.GetValue();

            dialogMode = (dialogMode == SetDialogModeAction.DialogMode.Help) ? SetDialogModeAction.DialogMode.Normal : SetDialogModeAction.DialogMode.Help;
            Dispatcher.Dispatch(SetDialogModeAction.From(dialogMode));

            // close all (sub)dialogs, and sunstudy dial (a ToolbarType)
            if (dialogMode == SetDialogModeAction.DialogMode.Help)
            {
                Dispatcher.Dispatch(SetDeltaDNAButtonAction.From($"HelpMode"));
                Dispatcher.Dispatch(OpenDialogAction.From(OpenDialogAction.DialogType.None));
                Dispatcher.Dispatch(OpenSubDialogAction.From(OpenDialogAction.DialogType.None));

                var activeToolbar = m_ActiveToolBarSelector.GetValue();
                if (activeToolbar == SetActiveToolBarAction.ToolbarType.TimeOfDayYearDial || activeToolbar == SetActiveToolBarAction.ToolbarType.AltitudeAzimuthDial)
                {
                    Dispatcher.Dispatch(ClearStatusAction.From(true));
                    Dispatcher.Dispatch(ClearStatusAction.From(false));
                    Dispatcher.Dispatch(SetActiveToolBarAction.From(TimeRadialUIController.m_previousToolbar));
                }

                if (m_MeasureToolStateGetter.GetValue())
                {
                    Dispatcher.Dispatch(ClearStatusAction.From(true));
                    Dispatcher.Dispatch(ClearStatusAction.From(false));
                    Dispatcher.Dispatch(ToggleMeasureToolAction.From(ToggleMeasureToolAction.ToggleMeasureToolData.defaultData));
                }
            }
        }
        void OnSelectButtonClicked()
        {
            var dialogType = m_SelectButton.selected ? OpenDialogAction.DialogType.None : OpenDialogAction.DialogType.BimInfo;

            Dispatcher.Dispatch(SetSpatialSelectorAction.From(m_ObjectSelector));
            Dispatcher.Dispatch(SetActiveToolAction.From(m_SelectButton.selected ? SetActiveToolAction.ToolType.None : SetActiveToolAction.ToolType.SelectTool));
            Dispatcher.Dispatch(OpenSubDialogAction.From(dialogType));
            Dispatcher.Dispatch(ToggleMeasureToolAction.From(ToggleMeasureToolAction.ToggleMeasureToolData.defaultData));
        }
Exemplo n.º 4
0
 void CloseMeasureTool()
 {
     if (m_MeasureToolStateSelector.GetValue())
     {
         var toggleData = ToggleMeasureToolAction.ToggleMeasureToolData.defaultData;
         Dispatcher.Dispatch(ToggleMeasureToolAction.From(toggleData));
         Dispatcher.Dispatch(ClearStatusAction.From(true));
         Dispatcher.Dispatch(ClearStatusAction.From(false));
     }
 }
        void StartInstruction()
        {
            Dispatcher.Dispatch(ShowModelAction.From(true));
            Dispatcher.Dispatch(SetInstructionUIStateAction.From(SetInstructionUIStateAction.InstructionUIState.Init));
            Dispatcher.Dispatch(SetARInstructionUIAction.From(new { currentARInstructionUI = this }));
            Dispatcher.Dispatch(SetAREnabledAction.From(false));
            Dispatcher.Dispatch(SetInstructionMode.From(true));
            m_Raycaster.Reset();
            Dispatcher.Dispatch(SetModelScaleAction.From(SetModelScaleAction.ArchitectureScale.OneToOne));
            Dispatcher.Dispatch(ToggleMeasureToolAction.From(ToggleMeasureToolAction.ToggleMeasureToolData.defaultData));


            Next();
        }
        void OnMeasureToolButtonClicked()
        {
            // Helpmode
            if (HelpDialogController.SetHelpID(SetHelpModeIDAction.HelpModeEntryID.MeasureTool))
            {
                return;
            }

            var toggleData = ToggleMeasureToolAction.ToggleMeasureToolData.defaultData;

            toggleData.toolState = !m_MeasureToolStateSelector.GetValue();

            if (toggleData.toolState)
            {
                if (m_ActiveToolSelector.GetValue() == SetActiveToolAction.ToolType.SelectTool && ((ObjectSelectionInfo)m_ObjectSelectionInfoSelector.GetValue()).CurrentSelectedObject() == null)
                {
                    Dispatcher.Dispatch(SetActiveToolAction.From(SetActiveToolAction.ToolType.None));
                    Dispatcher.Dispatch(OpenSubDialogAction.From(OpenDialogAction.DialogType.None));
                }

                Dispatcher.Dispatch(SetStatusMessageWithType.From(
                                        new StatusMessageData()
                {
                    text = MeasureToolUIController.instructionStart, type = StatusMessageType.Instruction
                }));
            }
            else
            {
                Dispatcher.Dispatch(ClearStatusAction.From(true));
                Dispatcher.Dispatch(ClearStatusAction.From(false));
            }

            Dispatcher.Dispatch(ToggleMeasureToolAction.From(toggleData));

            // To initialize Anchor
            Dispatcher.Dispatch(SetSpatialSelectorAction.From(m_ObjectSelector));

            if (m_SelectButton.selected)
            {
                Dispatcher.Dispatch(SetActiveToolAction.From(SetActiveToolAction.ToolType.None));
                Dispatcher.Dispatch(OpenSubDialogAction.From(OpenDialogAction.DialogType.None));
            }
        }
Exemplo n.º 7
0
        void ActivateVRmode()
        {
            m_WalkButton.button.interactable = false;
            m_VRButton.button.interactable   = false;
            var currentNavigationMode = m_NavigationModeSelector.GetValue();

            Dispatcher.Dispatch(SetAREnabledAction.From(false));

            Dispatcher.Dispatch(ClearStatusAction.From(true));
            Dispatcher.Dispatch(ClearStatusAction.From(false));

            Dispatcher.Dispatch(SetInstructionMode.From(false));

            if (currentNavigationMode != SetNavigationModeAction.NavigationMode.Walk)
            {
                Dispatcher.Dispatch(UnloadSceneActions <Project> .From(m_SceneDictionary[currentNavigationMode]));
            }

            Dispatcher.Dispatch(CloseAllDialogsAction.From(null));

            Dispatcher.Dispatch(SetActiveToolBarAction.From(SetActiveToolBarAction.ToolbarType.VRSidebar));

            Dispatcher.Dispatch(SetThemeAction.From(ThemeController.k_VROpaque));

            Dispatcher.Dispatch(SetWalkEnableAction.From(false));

            Dispatcher.Dispatch(SetVREnableAction.From(true));

            Dispatcher.Dispatch(EnableAllNavigationAction.From(true));
            Dispatcher.Dispatch(SetNavigationModeAction.From(SetNavigationModeAction.NavigationMode.VR));
            Dispatcher.Dispatch(SetShowScaleReferenceAction.From(false));

            Dispatcher.Dispatch(LoadSceneActions <Project> .From(m_SceneDictionary[SetNavigationModeAction.NavigationMode.VR]));

            Dispatcher.Dispatch(EnableBimFilterAction.From(true));
            Dispatcher.Dispatch(EnableSceneSettingsAction.From(true));
            Dispatcher.Dispatch(EnableSunStudyAction.From(true));
            Dispatcher.Dispatch(EnableMarkerSettingsAction.From(true));

            Dispatcher.Dispatch(ToggleMeasureToolAction.From(ToggleMeasureToolAction.ToggleMeasureToolData.defaultData));
        }
Exemplo n.º 8
0
        void OnProjectOpenButtonClick(Project project)
        {
            if (!ReflectProjectsManager.IsReadyForOpening(project))
            {
                return;
            }

            var activeProject = m_ActiveProjectGetter.GetValue();

            if (activeProject?.serverProjectId == project.serverProjectId)
            {
                Dispatcher.Dispatch(OpenDialogAction.From(OpenDialogAction.DialogType.None));
                //if the project already opened, just close landing screen
                return;
            }
            Dispatcher.Dispatch(SetWalkEnableAction.From(false));

            activeProject = project;

            if (activeProject != Project.Empty)
            {
                if (m_NavigationModeGetter.GetValue() != SetNavigationModeAction.NavigationMode.VR)
                {
                    // switch to orbit mode
                    var data = new SetForceNavigationModeAction.ForceNavigationModeTrigger((int)SetNavigationModeAction.NavigationMode.Orbit);
                    Dispatcher.Dispatch(SetForceNavigationModeAction.From(data));
                }

                // first close current Project if open
                Dispatcher.Dispatch(SetStatusMessage.From("Closing {UIStateManager.current.projectStateData.activeProject.name}..."));
            }
            Dispatcher.Dispatch(SetStatusMessage.From($"Opening {activeProject.name}..."));
            Dispatcher.Dispatch(CloseAllDialogsAction.From(null));

            Dispatcher.Dispatch(SetIsOpenWithLinkSharingAction.From(false));
            Dispatcher.Dispatch(SetCachedLinkTokenAction.From(string.Empty));

            Dispatcher.Dispatch(OpenProjectActions <Project> .From(activeProject));
            Dispatcher.Dispatch(ToggleMeasureToolAction.From(ToggleMeasureToolAction.ToggleMeasureToolData.defaultData));
        }
Exemplo n.º 9
0
        void OnProjectListButtonClick()
        {
            // Helpmode
            if (HelpDialogController.SetHelpID(SetHelpModeIDAction.HelpModeEntryID.Projects))
            {
                m_ProjectListButton.selected = true;
                return;
            }

            Dispatcher.Dispatch(OpenSubDialogAction.From(OpenDialogAction.DialogType.None));
            var dialogType = m_ActiveDialogSelector.GetValue() == OpenDialogAction.DialogType.LandingScreen ? OpenDialogAction.DialogType.None : OpenDialogAction.DialogType.LandingScreen;

            Dispatcher.Dispatch(OpenDialogAction.From(dialogType));
            if (dialogType == OpenDialogAction.DialogType.None)
            {
                Dispatcher.Dispatch(CloseAllDialogsAction.From(null));
                Dispatcher.Dispatch(ResetToolBarAction.From(null));
                Dispatcher.Dispatch(ToggleMeasureToolAction.From(ToggleMeasureToolAction.ToggleMeasureToolData.defaultData));
                Dispatcher.Dispatch(ClearStatusAction.From(true));
                Dispatcher.Dispatch(ClearStatusAction.From(false));
            }
        }
        void StartInstruction()
        {
            Dispatcher.Dispatch(ShowModelAction.From(false));
            Dispatcher.Dispatch(SetInstructionUIStateAction.From(SetInstructionUIStateAction.InstructionUIState.Init));
            Dispatcher.Dispatch(SetARInstructionUIAction.From(new { currentARInstructionUI = this }));
            Dispatcher.Dispatch(SetAREnabledAction.From(true));

            m_Raycaster.Reset();
            m_ARModeUIController.ActivePlacementRules(SetModelFloorAction.PlacementRule.TableTopPlacementRule);
            Dispatcher.Dispatch(SetARPlacementRuleAction.From(SetModelFloorAction.PlacementRule.TableTopPlacementRule));

            Dispatcher.Dispatch(SetActiveToolBarAction.From(SetActiveToolBarAction.ToolbarType.ARInstructionSidebar));

            // default scale 1:100
            Dispatcher.Dispatch(SetModelScaleAction.From(SetModelScaleAction.ArchitectureScale.OneToOneHundred));

            Dispatcher.Dispatch(EnableAllNavigationAction.From(false));
            Dispatcher.Dispatch(SetShowScaleReferenceAction.From(true));
            Dispatcher.Dispatch(SetInstructionMode.From(true));

            Dispatcher.Dispatch(EnableBimFilterAction.From(false));
            Dispatcher.Dispatch(EnableSceneSettingsAction.From(true));
            Dispatcher.Dispatch(EnableSunStudyAction.From(false));
            Dispatcher.Dispatch(EnableMarkerSettingsAction.From(false));
            Dispatcher.Dispatch(
                ToggleMeasureToolAction.From(ToggleMeasureToolAction.ToggleMeasureToolData.defaultData));

            var toolState = SetARToolStateAction.SetARToolStateData.defaultData;

            toolState.selectionEnabled   = true;
            toolState.measureToolEnabled = true;
            toolState.scaleEnabled       = true;
            toolState.cancelEnabled      = true;
            Dispatcher.Dispatch(SetARToolStateAction.From(toolState));

            Next();
        }
Exemplo n.º 11
0
        //[UnityTest] // FixMe For some reason this test passes on MAC but fails on Windows (on Yamato)
        public IEnumerator MeasureToolTests_LeftSidePanelToggleTest()
        {
            yield return(WaitAFrame()); //to let all needed listeners to be added

            using (var canBeToggledGetter = UISelectorFactory.createSelector <bool>(UIStateContext.current, nameof(IToolBarDataProvider.toolbarsEnabled)))
                using (var isToolActiveGetter = UISelectorFactory.createSelector <bool>(MeasureToolContext.current, nameof(IMeasureToolDataProvider.toolState)))
                {
                    var uiRoot = GameObject.Find("UI Root");
                    Assert.IsNotNull(uiRoot);
                    var sideBar = uiRoot.GetComponentInChildren <LeftSideBarController>(true);
                    Assert.IsNotNull(sideBar);

                    Dispatcher.Dispatch(SetActiveToolBarAction.From(SetActiveToolBarAction.ToolbarType.OrbitSidebar));
                    Assert.IsTrue(sideBar.gameObject.activeSelf);
                    yield return(WaitAFrame()); //to let all needed listeners to be added

                    var measureButton = typeof(LeftSideBarController).
                                        GetField("m_MeasureToolButton", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).
                                        GetValue(sideBar) as ToolButton;

                    Assert.IsNotNull(measureButton);

                    Assert.IsFalse(canBeToggledGetter.GetValue());
                    Assert.IsFalse(isToolActiveGetter.GetValue());
                    Assert.IsFalse(measureButton.selected);

                    Dispatcher.Dispatch(AllowMeasureToolAction.From(true));
                    Assert.IsTrue(canBeToggledGetter.GetValue());
                    Assert.IsFalse(isToolActiveGetter.GetValue());
                    Assert.IsTrue(measureButton.button.interactable);
                    Assert.IsFalse(measureButton.selected);

                    Dispatcher.Dispatch(ToggleMeasureToolAction.From(true));
                    Assert.IsTrue(canBeToggledGetter.GetValue());
                    Assert.IsTrue(isToolActiveGetter.GetValue());
                    Assert.IsTrue(measureButton.button.interactable);
                    Assert.IsTrue(measureButton.selected);

                    Dispatcher.Dispatch(ToggleMeasureToolAction.From(false));
                    Assert.IsTrue(canBeToggledGetter.GetValue());
                    Assert.IsFalse(isToolActiveGetter.GetValue());
                    Assert.IsTrue(measureButton.button.interactable);
                    Assert.IsFalse(measureButton.selected);

                    measureButton.button.onClick.Invoke();
                    Assert.IsTrue(measureButton.button.interactable);
                    Assert.IsTrue(measureButton.selected);
                    Assert.IsTrue(canBeToggledGetter.GetValue());
                    Assert.IsTrue(isToolActiveGetter.GetValue());

                    measureButton.button.onClick.Invoke();
                    Assert.IsTrue(canBeToggledGetter.GetValue());
                    Assert.IsFalse(isToolActiveGetter.GetValue());
                    Assert.IsTrue(measureButton.button.interactable);
                    Assert.IsFalse(measureButton.selected);

                    Dispatcher.Dispatch(AllowMeasureToolAction.From(false));
                    Assert.IsFalse(canBeToggledGetter.GetValue());
                    Assert.IsFalse(isToolActiveGetter.GetValue());
                    Assert.IsFalse(measureButton.selected);
                }
        }
Exemplo n.º 12
0
        public IEnumerator MeasureToolTests_OnOffFlowTest()
        {
            bool userLoggedIn = false;
            bool canBeToggledChanged;

            using (var canBeToggledGetter = UISelectorFactory.createSelector <bool>(UIStateContext.current, nameof(IToolBarDataProvider.toolbarsEnabled),
                                                                                    (data) => canBeToggledChanged = true))
                using (var isToolActiveGetter = UISelectorFactory.createSelector <bool>(MeasureToolContext.current, nameof(IMeasureToolDataProvider.toolState)))
                {
                    //Reflect is just loaded and not logged in. Measure tool must be not active nor able to be activated
                    Assert.IsFalse(canBeToggledGetter.GetValue());
                    Assert.IsFalse(isToolActiveGetter.GetValue());
                    try
                    {
                        yield return(GivenUserIsLoggedIn());

                        userLoggedIn = true;
                        //Reflect is logged in. Measure tool must be not active nor able to be activated
                        Assert.IsFalse(canBeToggledGetter.GetValue());
                        Assert.IsFalse(isToolActiveGetter.GetValue());

                        //Openning a project
                        ProjectListState?listState = null;
                        using (var projectListStateSelector = UISelectorFactory.createSelector <ProjectListState>(SessionStateContext <UnityUser, LinkPermission> .current,
                                                                                                                  nameof(ISessionStateDataProvider <UnityUser, LinkPermission> .projectListState),
                                                                                                                  (data) => listState = data))
                        {
                            yield return(new WaitUntil(() => listState == ProjectListState.Ready));
                        }
                        IProjectRoom room;
                        using (var roomSelector = UISelectorFactory.createSelector <IProjectRoom[]>(SessionStateContext <UnityUser, LinkPermission> .current,
                                                                                                    nameof(ISessionStateDataProvider <UnityUser, LinkPermission> .rooms)))
                        {
                            room = roomSelector.GetValue().FirstOrDefault(r => (r is ProjectRoom pr) && pr.project != null);
                        }
                        if (room == null)
                        {
                            throw new InvalidOperationException("There must be a project room with a project available to continue the test");
                        }

                        //When project is just opened measure tool must be available, but not selected
                        Dispatcher.Dispatch(OpenProjectActions <Project> .From(((ProjectRoom)room).project));
                        canBeToggledChanged = false;
                        yield return(new WaitWhile(() => !canBeToggledChanged)); //if state fails to update means test fails; timeout will stop the test

                        Assert.IsTrue(canBeToggledGetter.GetValue());
                        Assert.IsFalse(isToolActiveGetter.GetValue());

                        Dispatcher.Dispatch(ToggleMeasureToolAction.From(true));
                        Assert.IsTrue(isToolActiveGetter.GetValue());
                        Assert.IsTrue(canBeToggledGetter.GetValue());

                        Dispatcher.Dispatch(ToggleMeasureToolAction.From(false));
                        Assert.IsFalse(isToolActiveGetter.GetValue());
                        Assert.IsTrue(canBeToggledGetter.GetValue());

                        //If project is closed, measure tool must be deactivated and not available
                        Dispatcher.Dispatch(ToggleMeasureToolAction.From(true));
                        Dispatcher.Dispatch(CloseProjectActions <Project> .From(Project.Empty));
                        Assert.IsFalse(canBeToggledGetter.GetValue());
                        Assert.IsFalse(isToolActiveGetter.GetValue());

                        //If user logged out, measure tool must be deactivated and not available
                        yield return(WhenUserLogout());

                        userLoggedIn = false;
                        Assert.IsFalse(canBeToggledGetter.GetValue());
                        Assert.IsFalse(isToolActiveGetter.GetValue());
                    }
                    finally
                    {
                        if (userLoggedIn)
                        {
                            var loginManager = GameObject.FindObjectOfType <LoginManager>();
                            loginManager.userLoggedOut.Invoke();
                        }
                    }
                }
        }