public void Initialize(IARModeUIController resolver)
        {
            m_ARModeUIController = (ARModeUIController)resolver;
            m_Raycaster          = RaycasterRef.Resolve(m_ARModeUIController);

            DisposeSelectors();
            m_FirstSelectedPlaneGetter      = UISelectorFactory.createSelector <GameObject>(ARPlacementContext.current, nameof(IARPlacementDataProvider.firstSelectedPlane));
            m_SecondSelectedPlaneGetter     = UISelectorFactory.createSelector <GameObject>(ARPlacementContext.current, nameof(IARPlacementDataProvider.secondSelectedPlane));
            m_PlacementRuleGameObjectGetter = UISelectorFactory.createSelector <GameObject>(ARPlacementContext.current, nameof(IARPlacementDataProvider.placementRulesGameObject));
            m_ObjectSelectionInfoGetter     = UISelectorFactory.createSelector <SelectObjectAction.IObjectSelectionInfo>(ProjectContext.current, nameof(IObjectSelectorDataProvider.objectSelectionInfo));

            m_States = new Dictionary <ViewBasedInstructionUI, SetARInstructionUIAction.InstructionUIStep>
            {
                { ViewBasedInstructionUI.Init, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)ViewBasedInstructionUI.Init, onNext = StartInstruction
                  } },
                { ViewBasedInstructionUI.AlignModelView, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)ViewBasedInstructionUI.AlignModelView, onNext = AlignModelViewNext, onBack = AlignModelViewBack
                  } },
                { ViewBasedInstructionUI.FindTheFloor, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)ViewBasedInstructionUI.FindTheFloor, onNext = FindTheFloorNext, onBack = FindTheFloorBack
                  } },
                { ViewBasedInstructionUI.ConfirmPlacement, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)ViewBasedInstructionUI.ConfirmPlacement, onNext = ConfirmPlacementNext, onBack = ConfirmPlacementBack
                  } },
                { ViewBasedInstructionUI.OnBoardingComplete, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)ViewBasedInstructionUI.OnBoardingComplete, onNext = OnBoardingCompleteNext
                  } },
            };
            Dispatcher.Dispatch(SelectObjectAction.From(new ObjectSelectionInfo()));
        }
Ejemplo n.º 2
0
        public void Initialize(IARModeUIController resolver)
        {
            DisposeSelectors();
            m_ARModeUIController              = (ARModeUIController)resolver;
            m_MarkerController                = m_MarkerControllerResolverRef.Resolve(m_ARModeUIController).MarkerController;
            m_PlacementStateDataSelector      = UISelectorFactory.createSelector <ARPlacementStateData>(ARContext.current, "placementStateData");
            m_PlacementRuleGameObjectSelector = UISelectorFactory.createSelector <GameObject>(ARPlacementContext.current, "placementRulesGameObject");
            m_ProgressStateActionSelector     = UISelectorFactory.createSelector <SetProgressStateAction.ProgressState>(ProgressContext.current, nameof(IProgressDataProvider.progressState));

            m_States = new Dictionary <MarkerBasedInstructionUIState, SetARInstructionUIAction.InstructionUIStep>
            {
                {
                    MarkerBasedInstructionUIState.Init,
                    new SetARInstructionUIAction.InstructionUIStep()
                    {
                        stepIndex = (int)MarkerBasedInstructionUIState.Init,
                        onNext    = StartInstruction
                    }
                },
                {
                    MarkerBasedInstructionUIState.Selection,
                    new SetARInstructionUIAction.InstructionUIStep()
                    {
                        stepIndex = (int)MarkerBasedInstructionUIState.Selection,
                        onNext    = SelectionNext,
                        onBack    = SelectionBack
                    }
                },
                {
                    MarkerBasedInstructionUIState.Anchoring,
                    new SetARInstructionUIAction.InstructionUIStep()
                    {
                        stepIndex = (int)MarkerBasedInstructionUIState.Anchoring,
                        onNext    = AnchoringNext,
                        onBack    = AnchoringBack
                    }
                },
                //{ MarkerBasedInstructionUIState.Alignment, new SetARInstructionUIAction.InstructionUIStep(){stepIndex = (int)MarkerBasedInstructionUIState.Alignment, onNext = AlignmentNext, onBack = AlignmentBack}},
                {
                    MarkerBasedInstructionUIState.OnBoardingComplete,
                    new SetARInstructionUIAction.InstructionUIStep()
                    {
                        stepIndex = (int)MarkerBasedInstructionUIState.OnBoardingComplete,
                        onNext    = OnBoardingComplete
                    }
                }
            };
        }
Ejemplo n.º 3
0
        public void Initialize(IARModeUIController resolver)
        {
            DisposeResources();
            m_ARModeUIController              = (ARModeUIController)resolver;
            m_Raycaster                       = RaycasterRef.Resolve(m_ARModeUIController);
            m_FirstSelectedPlaneSelector      = UISelectorFactory.createSelector <GameObject>(ARPlacementContext.current, nameof(IARPlacementDataProvider.firstSelectedPlane));
            m_SecondSelectedPlaneSelector     = UISelectorFactory.createSelector <GameObject>(ARPlacementContext.current, nameof(IARPlacementDataProvider.secondSelectedPlane));
            m_BoundinBoxRootSelector          = UISelectorFactory.createSelector <Transform>(ARPlacementContext.current, nameof(IARPlacementDataProvider.boundingBoxRootNode));
            m_ModelFloorSelector              = UISelectorFactory.createSelector <GameObject>(ARPlacementContext.current, nameof(IARPlacementDataProvider.modelFloor));
            m_ARFloorSelector                 = UISelectorFactory.createSelector <GameObject>(ARPlacementContext.current, nameof(IARPlacementDataProvider.arFloor));
            m_FirstARSelectedPlaneSelector    = UISelectorFactory.createSelector <GameObject>(ARPlacementContext.current, nameof(IARPlacementDataProvider.firstARSelectedPlane));
            m_SecondARSelectedPlaneSelector   = UISelectorFactory.createSelector <GameObject>(ARPlacementContext.current, nameof(IARPlacementDataProvider.secondARSelectedPlane));
            m_ModelPlacementLocationSelector  = UISelectorFactory.createSelector <Vector3>(ARPlacementContext.current, nameof(IARPlacementDataProvider.modelPlacementLocation));
            m_ARPlacementLocationSelector     = UISelectorFactory.createSelector <Vector3>(ARPlacementContext.current, nameof(IARPlacementDataProvider.arPlacementLocation));
            m_ARPlacementAlignmentSelector    = UISelectorFactory.createSelector <Vector3>(ARPlacementContext.current, nameof(IARPlacementDataProvider.arPlacementAlignment));
            m_RootSelector                    = UISelectorFactory.createSelector <Transform>(PipelineContext.current, nameof(IPipelineDataProvider.rootNode));
            m_PlacementRuleGameObjectSelector = UISelectorFactory.createSelector <GameObject>(ARPlacementContext.current, nameof(IARPlacementDataProvider.placementRulesGameObject));
            m_ObjectSelectionInfoSelector     = UISelectorFactory.createSelector <SelectObjectAction.IObjectSelectionInfo>(ProjectContext.current, nameof(IObjectSelectorDataProvider.objectSelectionInfo));

            m_States = new Dictionary <WallBasedInstructionUI, SetARInstructionUIAction.InstructionUIStep>
            {
                { WallBasedInstructionUI.Init, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)WallBasedInstructionUI.Init, onNext = StartInstruction
                  } },
                { WallBasedInstructionUI.AlignModelView, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)WallBasedInstructionUI.AlignModelView, onNext = AlignModelView, onBack = AlignModelViewBack
                  } },
                { WallBasedInstructionUI.FindModelFloor, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)WallBasedInstructionUI.FindModelFloor, onNext = FindModelFloor, onBack = FindModelFloorBack
                  } },
                {
                    WallBasedInstructionUI.FindFirstWall, new SetARInstructionUIAction.InstructionUIStep
                    {
                        stepIndex   = (int)WallBasedInstructionUI.FindFirstWall, onNext = FindFirstWallNext, onBack = FindFirstWallBack,
                        validations = new IPlacementValidation[] { new WallSizeValidation(1.0f) }
                    }
                },
                {
                    WallBasedInstructionUI.FindSecondWall, new SetARInstructionUIAction.InstructionUIStep
                    {
                        stepIndex   = (int)WallBasedInstructionUI.FindSecondWall, onNext = FindSecondWallNext, onBack = FindSecondWallBack,
                        validations = new IPlacementValidation[] { new WallSizeValidation(1.0f), new ParallelWallValidation(0.3f) }
                    }
                },
                { WallBasedInstructionUI.ConfirmAnchorPoint, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)WallBasedInstructionUI.ConfirmAnchorPoint, onNext = ConfirmAnchorPointNext, onBack = ConfirmAnchorPointBack
                  } },
                { WallBasedInstructionUI.FindTheFloor, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)WallBasedInstructionUI.FindTheFloor, onNext = FindTheARFloorNext, onBack = FindTheARFloorBack
                  } },
                { WallBasedInstructionUI.FindFirstARWall, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)WallBasedInstructionUI.FindFirstARWall, onNext = FindFirstARWallNext, onBack = FindFirstARWallBack
                  } },
                { WallBasedInstructionUI.FindSecondARWall, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)WallBasedInstructionUI.FindSecondARWall, onNext = FindSecondARWallNext, onBack = FindSecondARWallBack
                  } },
                { WallBasedInstructionUI.ConfirmARAnchorPoint, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)WallBasedInstructionUI.ConfirmARAnchorPoint, onNext = ConfirmARAnchorPointNext, onBack = ConfirmARAnchorPointBack
                  } },

                // TODO: Bring step back once we have adjustments enabled
                //{ WallBasedInstructionUI.ConfirmPlacement, new InstructionUIStep{ stepIndex = (int)WallBasedInstructionUI.ConfirmPlacement, onNext = ConfirmPlacementNext, onBack = ConfirmPlacementBack } },
                { WallBasedInstructionUI.OnBoardingComplete, new SetARInstructionUIAction.InstructionUIStep {
                      stepIndex = (int)WallBasedInstructionUI.OnBoardingComplete, onNext = OnBoardingCompleteNext
                  } },
            };
            m_PlaneSelector          = new SpatialOrientedPlaneSelector();
            m_ARAxisTrackingSelector = UISelectorFactory.createSelector <bool>(DebugOptionContext.current, nameof(IDebugOptionDataProvider.ARAxisTrackingEnabled));
            Dispatcher.Dispatch(SelectObjectAction.From(new ObjectSelectionInfo()));
        }