Esempio n. 1
0
        void Awake()
        {
            m_DisposeOnDestroy.Add(m_DeviceCapabilitySelector = UISelectorFactory.createSelector <SetVREnableAction.DeviceCapability>(PipelineContext.current, nameof(IPipelineDataProvider.deviceCapability), OnDeviceCapabilityChanged));
            m_DisposeOnDestroy.Add(m_WalkInstructionSelector  = UISelectorFactory.createSelector <IWalkInstructionUI>(WalkModeContext.current, nameof(IWalkModeDataProvider.instruction)));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <SetForceNavigationModeAction.ForceNavigationModeTrigger>(ForceNavigationModeContext.current, nameof(IForceNavigationModeDataProvider.navigationMode), OnForceNavigationMode));
            m_DisposeOnDestroy.Add(m_ActiveSubDialogSelector = UISelectorFactory.createSelector <OpenDialogAction.DialogType>(UIStateContext.current, nameof(IDialogDataProvider.activeSubDialog), OnActiveSubDialogChanged));
            m_DisposeOnDestroy.Add(m_NavigationModeSelector  = UISelectorFactory.createSelector <SetNavigationModeAction.NavigationMode>(NavigationContext.current, nameof(INavigationDataProvider.navigationMode), OnNavigationModeChanged));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(UIStateContext.current, nameof(IToolBarDataProvider.toolbarsEnabled), OnToolBarEnabledChanged));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <List <NavigationModeInfo> >(NavigationContext.current, nameof(INavigationModeInfosDataProvider <NavigationModeInfo> .navigationModeInfos),
                                                                                                 list =>
            {
                if (list != null)
                {
                    foreach (var info in list)
                    {
                        m_SceneDictionary[info.navigationMode] = info.modeScenePath;
                    }
                }
            }));

            m_NavigationButton.buttonClicked += OnNavigationButtonClicked;

            m_FlyButton.selected        = true;
            m_FlyButton.buttonClicked  += OnFlyButtonClicked;
            m_ARButton.buttonClicked   += OnARButtonClicked;
            m_VRButton.buttonClicked   += OnVRButtonClicked;
            m_WalkButton.buttonClicked += OnWalkButtonClicked;
        }
        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()));
        }
Esempio n. 3
0
        void Awake()
        {
            m_DialogWindow = GetComponent <DialogWindow>();

            m_ActiveDialogSelector = UISelectorFactory.createSelector <OpenDialogAction.DialogType>(UIStateContext.current, nameof(IDialogDataProvider.activeDialog),
                                                                                                    type =>
            {
                m_DialogButton.selected = type == OpenDialogAction.DialogType.SunStudy;
            });

            TimeOfDaySelector  = UISelectorFactory.createSelector <int>(SunStudyContext.current, nameof(ISunstudyDataProvider.timeOfDay), OnTimeOfDayChanged);
            TimeOfYearSelector = UISelectorFactory.createSelector <int>(SunStudyContext.current, nameof(ISunstudyDataProvider.timeOfYear), OnTimeOfYearChanged);
            UtcOffsetSelector  = UISelectorFactory.createSelector <int>(SunStudyContext.current, nameof(ISunstudyDataProvider.utcOffset), OnUtcChanged);
            LatitudeSelector   = UISelectorFactory.createSelector <int>(SunStudyContext.current, nameof(ISunstudyDataProvider.latitude), OnLatitudeChanged);
            LongitudeSelector  = UISelectorFactory.createSelector <int>(SunStudyContext.current, nameof(ISunstudyDataProvider.longitude), OnLongitudeChanged);
            NorthAngleSelector = UISelectorFactory.createSelector <int>(SunStudyContext.current, nameof(ISunstudyDataProvider.northAngle), OnNorthAngleChanged);

            // Initialize controls with current values
            OnTimeOfDayChanged(TimeOfDaySelector.GetValue());
            OnTimeOfYearChanged(TimeOfYearSelector.GetValue());
            OnUtcChanged(UtcOffsetSelector.GetValue());
            OnLatitudeChanged(LatitudeSelector.GetValue());
            OnLongitudeChanged(LongitudeSelector.GetValue());
            OnNorthAngleChanged(NorthAngleSelector.GetValue());

            QueryArgHandler.Register(this, k_NorthAngleQueryKey, OnNorthAngleControlChanged, NorthAngleQueryValue);
            QueryArgHandler.Register(this, k_TimeOfDayQueryKey, OnTimeOfDayControlChanged, TimeOfDayQueryValue);
            QueryArgHandler.Register(this, k_TimeOfYearQueryKey, OnTimeOfYearControlChanged, TimeOfYearQueryValue);
            QueryArgHandler.Register(this, k_UtcOffsetQueryKey, OnUtcOffsetControlChanged, UtcOffsetQueryValue);
            QueryArgHandler.Register(this, k_LatitudeQueryKey, OnLatitudeControlChanged, LatitudeQueryValue);
            QueryArgHandler.Register(this, k_LongitudeQueryKey, OnLongitudeControlChanged, LongitudeQueryValue);
        }
        void Awake()
        {
            m_BackgroundButton.onClick.AddListener(OnBackgroundButtonClicked);
            m_LoginButton.onClick.AddListener(OnLoginButtonClicked);
            m_RegionButton.onClick.AddListener(OnRegionButtonClicked);
            m_HiddenButton.onClick.AddListener(OnHiddenButtonClicked);
            m_WelcomeButton.onClick.AddListener(OnWelcomeButtonClicked);

            m_CloudURLInput.onValueChanged.AddListener(OnCustomURLChanged);

            foreach (var button in m_RegionButtons)
            {
                button.regionButtonClicked += OnRegionOptionButtonClicked;
            }

            foreach (var button in m_CloudButtons)
            {
                button.cloudButtonClicked += OnCloudOptionButtonClicked;
            }

            m_CloudOKButton.onClick.AddListener(OnCloudOKButtonClicked);
            m_CloudCancelButton.onClick.AddListener(OnCloudCancelButtonClicked);

            UIStateManager.loginSettingChanged += OnLoginSettingChanged;

            m_VREnableSelector           = UISelectorFactory.createSelector <bool>(VRContext.current, nameof(IVREnableDataProvider.VREnable), OnVREnableChanged);
            m_LoggedStateSelector        = UISelectorFactory.createSelector <LoginState>(SessionStateContext <UnityUser, LinkPermission> .current, nameof(ISessionStateDataProvider <UnityUser, LinkPermission> .loggedState), OnLoggedStateChanged);
            m_LinkShareLoggedOutSelector = UISelectorFactory.createSelector <bool>(SessionStateContext <UnityUser, LinkPermission> .current, nameof(ISessionStateDataProvider <UnityUser, LinkPermission> .linkShareLoggedOut));

            UpdateSettings();

            // Init to LoginState.LoginSessionFromCache state.
            // If no previous session is found, LoginState.LoggedOut will be dispatched and UI will get unlocked.
            OnLoginSessionFromCache();
        }
 public override void Awake()
 {
     base.Awake();
     m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <string>(FollowUserContext.current, nameof(IFollowUserDataProvider.userId), OnFollow));
     m_DisposeOnDestroy.Add(m_ActiveDialogSelector = UISelectorFactory.createSelector <OpenDialogAction.DialogType>(UIStateContext.current, nameof(IDialogDataProvider.activeDialog)));
     m_DisposeOnDestroy.Add(m_SelectedUserSelector = UISelectorFactory.createSelector <IUserInfoDialogDataProvider>(UIStateContext.current, nameof(IUIStateDataProvider.SelectedUserData)));
 }
 void Awake()
 {
     m_CharacterController = GetComponent <CharacterController>();
     m_RunningAction       = m_InputActionAsset["Run Action"];
     m_InputActionAsset["Jump Action"].performed += OnJump;
     m_MovingAction = m_InputActionAsset["Walk Navigation Action"];
     m_StepCycle    = 0f;
     m_NextStep     = m_StepCycle / 2f;
     m_Jumping      = false;
     m_Rigidbody    = GetComponent <Rigidbody>();
     m_DisposeOnDestroy.Add(m_BoundsGetter            = UISelectorFactory.createSelector <Bounds>(ProjectContext.current, "zoneBounds"));
     m_DisposeOnDestroy.Add(m_WalkInstructionSelector = UISelectorFactory.createSelector <IWalkInstructionUI>(WalkModeContext.current, nameof(IWalkModeDataProvider.instruction)));
     m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(NavigationContext.current, nameof(INavigationDataProvider.moveEnabled),
                                                                    data =>
     {
         if (data)
         {
             m_MovingAction.Enable();
         }
         else
         {
             m_MovingAction.Disable();
         }
     }));
 }
Esempio n. 7
0
        void Awake()
        {
            m_DisposeOnDestroy.Add(m_ToolBarEnabledSelector         = UISelectorFactory.createSelector <bool>(UIStateContext.current, nameof(IToolBarDataProvider.toolbarsEnabled)));
            m_DisposeOnDestroy.Add(m_CurrentARInstructionUISelector = UISelectorFactory.createSelector <IARInstructionUI>(ARContext.current, nameof(IARModeDataProvider.currentARInstructionUI)));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(ARToolStateContext.current, nameof(IARToolStatePropertiesDataProvider.previousStepEnabled),
                                                                           data =>
            {
                m_BackButton.button.interactable = m_ToolBarEnabledSelector.GetValue() && data;
                CheckButtonValidations();
            }));

            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <SetARToolStateAction.IUIButtonValidator>(ARToolStateContext.current, nameof(IARToolStatePropertiesDataProvider.okButtonValidator),
                                                                                                              data =>
            {
                m_Validator = data;
                CheckButtonValidations();
            }));

            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <SetOrbitTypeAction.OrbitType>(ToolStateContext.current, nameof(IToolStateDataProvider.orbitType)));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <OpenDialogAction.DialogType>(UIStateContext.current, nameof(IDialogDataProvider.activeDialog)));

            ProjectContext.current.stateChanged += OnProjectStateDataChanged;

            m_OkButton.buttonClicked   += OnOkButtonClicked;
            m_BackButton.buttonClicked += OnBackButtonClicked;
        }
        protected override void Awake()
        {
            m_UnscaledScreenSize = Vector2.zero;

            m_scaleFactorSelector = UISelectorFactory.createSelector <float>(UIStateContext.current, nameof(IUIStateDisplayProvider <DisplayData> .display) + "." + nameof(IDisplayDataProvider.scaleFactor), OnScaleFactorChanged);
            m_CanvasScaler        = GetComponent <CanvasScaler>();
        }
        void Start()
        {
            if (m_XrRig == null)
            {
                m_XrRig = FindObjectOfType <XRRig>();
            }

            m_XrRayInteractor        = GetComponent <XRRayInteractor>();
            m_XrInteractorLineVisual = GetComponent <XRInteractorLineVisual>();
            m_LinePoints             = new Vector3[k_MaxLinePoints];
            m_TeleportationTarget.gameObject.SetActive(false);
            m_MainCamera = Camera.main.transform;

            m_DisposeOnDestroy.Add(m_RootSelector           = UISelectorFactory.createSelector <Transform>(PipelineContext.current, nameof(IPipelineDataProvider.rootNode)));
            m_DisposeOnDestroy.Add(m_CamInfoSelector        = UISelectorFactory.createSelector <CameraTransformInfo>(ProjectContext.current, nameof(ITeleportDataProvider.cameraTransformInfo)));
            m_DisposeOnDestroy.Add(m_TeleportPickerSelector = UISelectorFactory.createSelector <IPicker>(ProjectContext.current, nameof(ITeleportDataProvider.teleportPicker),
                                                                                                         async =>
            {
                SetInitialTeleportDistance();
            }));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <SetActiveToolAction.ToolType>(ToolStateContext.current, nameof(IToolStateDataProvider.activeTool),
                                                                                                   type =>
            {
                m_CanTeleport = type != SetActiveToolAction.ToolType.SelectTool;
            }));
            m_TeleportAction = m_InputActionAsset["VR/Teleport"];
            m_InputActionAsset["VR/Select"].performed += OnTeleport;
        }
Esempio n. 10
0
        void Awake()
        {
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(UIStateContext.current, nameof(IToolBarDataProvider.toolbarsEnabled),
                                                                           data =>
            {
                m_ToolbarsEnabled = data;
            }));

            m_LeftSideBarController = GameObject.FindObjectOfType <LeftSideBarController>();

            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(ARToolStateContext.current, nameof(IARToolStatePropertiesDataProvider.scaleEnabled),
                                                                           data =>
            {
                m_ScaleButton.transform.parent.gameObject.SetActive(m_ToolbarsEnabled && data);
                m_LeftSideBarController.UpdateLayout();
            }));

            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(ARToolStateContext.current, nameof(IARToolStatePropertiesDataProvider.previousStepEnabled),
                                                                           data =>
            {
                m_BackButton.button.interactable = m_ToolbarsEnabled && data;
            }));


            m_DisposeOnDestroy.Add(m_CurrentARInstructionUIGetter = UISelectorFactory.createSelector <IARInstructionUI>(ARContext.current, nameof(IARModeDataProvider.currentARInstructionUI)));

            m_BackButton.buttonClicked   += OnBackButtonClicked;
            m_ScaleButton.buttonClicked  += OnScaleButtonClicked;
            m_TargetButton.buttonClicked += OnTargetButtonClicked;
        }
        public IEnumerator LandingPageUITests_Topbar_ButtonsCheck()
        {
            //Given the scene is loaded
            yield return(WaitAFrame());

            using (var loggedSelector = UISelectorFactory.createSelector <LoginState>(SessionStateContext <UnityUser, LinkPermission> .current, nameof(ISessionStateDataProvider <UnityUser, LinkPermission> .loggedState)))
            {
                yield return(WaitAFrame());

                yield return(new WaitUntil(() => loggedSelector.GetValue() == LoginState.LoggedIn));
            }
            yield return(WaitAFrame());

            var leftTopBar        = GivenGameObjectNamed("Left Topbar").transform.GetChild(0).gameObject;
            var projectListButton = GivenChildNamed(leftTopBar, "ProjectListButton");
            var refreshButton     = GivenChildNamed(leftTopBar, "RefreshProjectsButton");
            var helpButton        = GivenChildNamed(leftTopBar, "HelpButton");

            //When user is loggedin

            //Then the projectlistbutton and the refreshbutton should be visible
            Assert.IsTrue(projectListButton.transform.parent.gameObject.activeInHierarchy);
            Assert.IsTrue(refreshButton.transform.parent.gameObject.activeInHierarchy);

            //And the help button should be hidden
            Assert.IsFalse(helpButton.transform.parent.gameObject.activeInHierarchy);
        }
        public IEnumerator LandingPageUITests_ProjectList_Collaborators()
        {
            yield return(GivenUserIsLoggedInAndLandingScreenIsOpen());

            var landingPageDialog = Resources.FindObjectsOfTypeAll <LandingScreenUIController>().First();

            //When the project receives the list
            yield return(AddProjects(new[] { "A", "B", "C", "D", "E", "F", "G", "H" }));

            using (var roomSelector = UISelectorFactory.createSelector <IProjectRoom[]>(SessionStateContext <UnityUser, LinkPermission> .current, nameof(ISessionStateDataProvider <UnityUser, LinkPermission> .rooms)))
            {
                //When User connects to Room A
                List <IProjectRoom> data = roomSelector.GetValue().ToList();
                ((ProjectRoom)data[0]).users.Add(new UserIdentity("1", 1, "User Alpha", DateTime.UtcNow, null));
                ((ProjectRoom)data[0]).users.Add(new UserIdentity("2", 2, "User Beta", DateTime.UtcNow.AddSeconds(5), null));

                yield return(WaitAFrame());

                //TODO switch to forceUpdate on Value change
                Dispatcher.Dispatch(SetProjectRoomAction.From(data.Cast <IProjectRoom>().ToArray()));
            }
            yield return(WaitAFrame());

            //Then UI should display all projects with the searched string in the name
            var notFoundDisplayObj   = GivenChildNamed(landingPageDialog.gameObject, "No Project Panel");
            var projectListContainer = GivenGameObjectNamed("Project List Container");
            var items = projectListContainer.GetComponentsInChildren <ProjectListItem>();

            Assert.IsFalse(notFoundDisplayObj.activeInHierarchy);
            var avatars = items[0].gameObject.GetComponentsInChildren <UserDetailsUIController>();

            Assert.AreEqual(2, avatars.Length);
            yield return(WaitAFrame());
        }
        public IEnumerator LandingPageUITests_ProjectList_Search()
        {
            yield return(GivenUserIsLoggedInAndLandingScreenIsOpen());

            var landingPageDialog = Resources.FindObjectsOfTypeAll <LandingScreenUIController>().First();

            //Given a list of projects
            yield return(AddProjects(new[] { "Bay A", "Shop A", "Station A", "Bay B", "Shop B", "Station B", "Bay C", "Shop C", "Station C" }));

            //When we search for one of the names
            using (var filterGetter = UISelectorFactory.createSelector <string>(LandingScreenContext.current, nameof(IProjectListFilterDataProvider.searchString)))
            {
                Dispatcher.Dispatch(SetLandingScreenFilterProjectServerAction.From("Bay"));
                yield return(new WaitUntil(() => filterGetter.GetValue() == "Bay"));
            }
            yield return(WaitAFrame());

            //Then UI should display all projects with the searched string in the name
            var notFoundDisplayObj   = GivenChildNamed(landingPageDialog.gameObject, "No Project Panel");
            var projectListContainer = GivenGameObjectNamed("Project List Container");
            var items = projectListContainer.GetComponentsInChildren <ProjectListItem>();

            Assert.IsFalse(notFoundDisplayObj.activeInHierarchy);
            Assert.AreEqual(3, items.Length);
            Assert.IsTrue(items[0].room.project.name.Contains("Bay"));
            yield return(WaitAFrame());
        }
Esempio n. 14
0
 void OnEnable()
 {
     m_DisposeOnDisable.Add(m_ActiveProjectSelector = UISelectorFactory.createSelector <Project>(ProjectManagementContext <Project> .current, nameof(IProjectDataProvider <Project> .activeProject), OnActiveProjectChanged));
     m_DisposeOnDisable.Add(m_ActiveDialogSelector  = UISelectorFactory.createSelector <OpenDialogAction.DialogType>(UIStateContext.current, nameof(IDialogDataProvider.activeDialog), OnActiveDialogChanged));
     m_DisposeOnDisable.Add(m_DialogModeSelector    = UISelectorFactory.createSelector <SetDialogModeAction.DialogMode>(UIStateContext.current, nameof(IDialogDataProvider.dialogMode), OnDialogModeChanged));
     m_DisposeOnDestroy.Add(m_LoginStateSelector    = UISelectorFactory.createSelector <LoginState>(SessionStateContext <UnityUser, LinkPermission> .current, nameof(ISessionStateDataProvider <UnityUser, LinkPermission> .loggedState)));
 }
        void Awake()
        {
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <SetProgressStateAction.ProgressState>(ProgressContext.current, nameof(IProgressDataProvider.progressState), OnProgressStateChanged));
            m_DisposeOnDestroy.Add(m_ProgressTotalCountGetter = UISelectorFactory.createSelector <int>(ProgressContext.current, nameof(IProgressDataProvider.totalCount)));
            m_DisposeOnDestroy.Add(m_ProgressCurrentGetter    = UISelectorFactory.createSelector <int>(ProgressContext.current, nameof(IProgressDataProvider.currentProgress)));

            m_Initialized = true;
        }
Esempio n. 16
0
        void Awake()
        {
            m_ActiveSubDialogSelector = UISelectorFactory.createSelector <OpenDialogAction.DialogType>(UIStateContext.current, nameof(IDialogDataProvider.activeSubDialog), OnActiveSubDialogChanged);
            m_ActiveDialogSelector    = UISelectorFactory.createSelector <OpenDialogAction.DialogType>(UIStateContext.current, nameof(IDialogDataProvider.activeDialog), OnActiveDialogChanged);

            m_Button = GetComponent <Button>();
            m_Button.onClick.AddListener(OnDialogButtonClick);
        }
 void Awake()
 {
     m_PlacementRootGetter       = UISelectorFactory.createSelector <Transform>(ARPlacementContext.current, "placementRoot");
     m_BoundingBoxRootNodeGetter = UISelectorFactory.createSelector <Transform>(ARPlacementContext.current, "boundingBoxRootNode");
     m_RootGetter   = UISelectorFactory.createSelector <Transform>(PipelineContext.current, "rootNode");
     m_ARModeGetter = UISelectorFactory.createSelector <bool>(ARContext.current, nameof(IARModeDataProvider.arEnabled));
     m_MarkerController.AlignedObject = this;
 }
        void Awake()
        {
            m_SelectionTarget.gameObject.SetActive(false);

            m_Disposable.Add(UISelectorFactory.createSelector <bool>(MeasureToolContext.current, nameof(IMeasureToolDataProvider.toolState), OnToolStateDataChanged));
            m_Disposable.Add(m_VREnableGetter = UISelectorFactory.createSelector <bool>(VRContext.current, nameof(IVREnableDataProvider.VREnable)));
            m_Disposable.Add(UISelectorFactory.createSelector <IPicker>(ProjectContext.current, nameof(IObjectSelectorDataProvider.objectPicker), OnObjectSelectorChanged));
        }
Esempio n. 19
0
 protected override void Awake()
 {
     if (tableContainer == null)
     {
         tableContainer = transform.parent.GetComponent <RectTransform>();
     }
     m_ScreenSizeQualifierGetter = UISelectorFactory.createSelector <SetDisplayAction.ScreenSizeQualifier>(UIStateContext.current, nameof(IUIStateDisplayProvider <DisplayData> .display) + "." + nameof(IDisplayDataProvider.screenSizeQualifier));
 }
 void Start()
 {
     m_AccessTokenSelector   = UISelectorFactory.createSelector <AccessToken>(ProjectManagementContext <Project> .current, nameof(IProjectDataProvider <Project> .accessToken), OnAccessToken);
     m_ActiveProjectSelector = UISelectorFactory.createSelector <Project>(ProjectManagementContext <Project> .current, nameof(IProjectDataProvider <Project> .activeProject), OnActiveProjectChanged);
     if (m_GraphicManager == null)
     {
         m_GraphicManager = FindObjectOfType <MarkerGraphicManager>();
     }
 }
Esempio n. 21
0
        void Awake()
        {
            m_Camera            = GetComponent <FreeFlyCamera>();
            m_IsFollowingGetter = UISelectorFactory.createSelector <bool>(FollowUserContext.current, nameof(IFollowUserDataProvider.isFollowing), OnUserObjectChanged);
            m_UserObjectGetter  = UISelectorFactory.createSelector <GameObject>(FollowUserContext.current, nameof(IFollowUserDataProvider.userObject));

            m_PosElasticity = m_Camera.settings.positionElasticity;
            m_RotElasticity = m_Camera.settings.rotationElasticity;
        }
Esempio n. 22
0
        void Awake()
        {
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <IButtonVisibility>(AppBarContext.current, nameof(IAppBarDataProvider.buttonVisibility), OnButtonVisibilityChanged));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <IButtonInteractable>(AppBarContext.current, nameof(IAppBarDataProvider.buttonInteractable), OnButtonInteractableChanged));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <SetHelpModeIDAction.HelpModeEntryID>(UIStateContext.current, nameof(IHelpModeDataProvider.helpModeEntryId), OnHelpModeEntryChanged));

            m_RefreshVisibility = true;
            m_Interactable      = true;
        }
        protected IEnumerator GivenUserIsLoggedIn()
        {
            using (var loggedGetter = UISelectorFactory.createSelector <LoginState>(SessionStateContext <UnityUser, LinkPermission> .current, nameof(ISessionStateDataProvider <UnityUser, LinkPermission> .loggedState)))
            {
                yield return(WaitAFrame());

                yield return(new WaitUntil(() => loggedGetter.GetValue() == LoginState.LoggedIn));
            }
        }
Esempio n. 24
0
 void Awake()
 {
     m_DisposeOnDestroy.Add(m_ModelScaleSelector = UISelectorFactory.createSelector <SetModelScaleAction.ArchitectureScale>(ARPlacementContext.current, nameof(IARPlacementDataProvider.modelScale), OnModelScaleChanged));
     m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(NavigationContext.current, nameof(INavigationDataProvider.showScaleReference),
                                                                    data =>
     {
         m_ARScaleText.gameObject.SetActive(data);
     }));
 }
Esempio n. 25
0
        public IEnumerator Multiplayer_WhenFollowCameraButtonClicked_And_InVRMode_JumpInsteadOfFollow()
        {
            using (var usersSelector = UISelectorFactory.createSelector <List <NetworkUserData> >(RoomConnectionContext.current, nameof(IRoomConnectionDataProvider <NetworkUserData> .users)))
            {
                //Given a user in a certain position and rotation
                yield return(WaitAFrame());

                var    position      = new Vector3(5, 5, 5);
                var    rotation      = Quaternion.FromToRotation(Vector3.zero, Vector3.up);
                Camera mainCamera    = GivenObjectNamed <Camera>("Main Camera");
                var    freeFlyCamera = mainCamera.GetComponent <FreeFlyCamera>();
                mainCamera.transform.rotation = Quaternion.identity;
                mainCamera.transform.position = Vector3.zero;
                yield return(WaitAFrame());

                freeFlyCamera.enabled = true;
                yield return(WaitAFrame());

                AddUserToRoom(user);
                var userObject = GivenObjects <UserUIButton>()
                                 .Find((userCtrl) => userCtrl.MatchmakerId == user.matchmakerId);
                var userData       = usersSelector.GetValue().Find(u => u.matchmakerId == userObject.MatchmakerId);
                var objectToFollow = userData.visualRepresentation;
                objectToFollow.transform.position = position;
                objectToFollow.transform.rotation = rotation;

                //Given the app is in VR mode
                GivenViewerIsInVRMode();

                //When clicking on the avatar
                userObject.m_Button.onClick.Invoke();
                yield return(WaitAFrame());

                //Then the user info popup should show
                Assert.True(IsDialogOpen("CollaborationUserInfoDialog"));
                var userDialog = GivenObjectNamed <UserDetailsUIController>("CollaborationUserInfoDialog");

                //When click on "follow user" button
                userDialog.m_FollowCameraButton.onClick.Invoke();
                yield return(WaitAFrame());

                yield return(new WaitWhile(() => freeFlyCamera.enabled == false));

                //Then camera should jump to its user
                Assert.That(mainCamera.transform.position.Equals(position));

                //When the user moves
                objectToFollow.transform.position = new Vector3(10, 10, 10);
                ;
                objectToFollow.transform.rotation = Quaternion.FromToRotation(Vector3.zero, Vector3.down);
                yield return(WaitAFrame());

                //Then the current user should stayed in the previous position
                Assert.That(mainCamera.transform.position.Equals(position));
            }
        }
Esempio n. 26
0
        void Start()
        {
            m_SelectorToDispose = UISelectorFactory.createSelector <bool>(SceneOptionContext.current, nameof(ISceneOptionData <SkyboxData> .enableStatsInfo), OnEnableStatsInfoChanged);

            m_FrameTimes = new TimeSpan[m_FrameBufferCount];
            for (var i = 0; i < m_FrameTimes.Length; ++i)
            {
                m_FrameTimes[i] = TimeSpan.FromMilliseconds(-1);
            }
        }
        protected virtual void Awake()
        {
            m_SelectedDatas = new List <SelectionData>();

            m_DisposeOnDestroy.Add(m_MeasureToolStateSelector = UISelectorFactory.createSelector <bool>(MeasureToolContext.current, nameof(IMeasureToolDataProvider.toolState), OnMeasureToolStateDataChanged));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <List <NetworkUserData> >(RoomConnectionContext.current, nameof(IRoomConnectionDataProvider <NetworkUserData> .users), OnUsersChanged));
            m_DisposeOnDestroy.Add(m_LocalUserSelector = UISelectorFactory.createSelector <NetworkUserData>(RoomConnectionContext.current, nameof(IRoomConnectionDataProvider <NetworkUserData> .localUser), OnLocalUserChanged));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(VRContext.current, nameof(IVREnableDataProvider.VREnable), OnVREnable));
            m_DisposeOnDestroy.Add(m_ObjectPickerSelector        = UISelectorFactory.createSelector <IPicker>(ProjectContext.current, nameof(IObjectSelectorDataProvider.objectPicker)));
            m_DisposeOnDestroy.Add(m_ObjectSelectionInfoSelector = UISelectorFactory.createSelector <SelectObjectAction.IObjectSelectionInfo>(ProjectContext.current, nameof(IObjectSelectorDataProvider.objectSelectionInfo), OnObjectSelectionInfoChanged));
            m_DisposeOnDestroy.Add(m_HOLDFilterSelector          = UISelectorFactory.createSelector <bool>(SceneOptionContext.current, nameof(ISceneOptionData <SkyboxData> .filterHlods)));
            m_DisposeOnDestroy.Add(m_UnityUserSelector           = UISelectorFactory.createSelector <UnityUser>(SessionStateContext <UnityUser, LinkPermission> .current, nameof(ISessionStateDataProvider <UnityUser, LinkPermission> .user)));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <LoginState>(SessionStateContext <UnityUser, LinkPermission> .current, nameof(ISessionStateDataProvider <UnityUser, LinkPermission> .loggedState), OnLoggedStateChanged));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <HighlightFilterInfo>(ProjectContext.current, nameof(IProjectSortDataProvider.highlightFilter), info =>
            {
                StartCoroutine(WaitBeforeUpdateHighlight());
            }));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <Project>(ProjectManagementContext <Project> .current, nameof(IProjectDataProvider <Project> .activeProject), project =>
            {
                m_SelectedDatas.Clear();
                UpdateMultiSelection();
            }));
            m_DisposeOnDestroy.Add(m_ActiveToolSelector = UISelectorFactory.createSelector <SetActiveToolAction.ToolType>(ToolStateContext.current, nameof(IToolStateDataProvider.activeTool),
                                                                                                                          type =>
            {
                if (type != SetActiveToolAction.ToolType.SelectTool)
                {
                    StartCoroutine(UnselectObject());
                }

                m_SelectMode = type == SetActiveToolAction.ToolType.SelectTool && m_MeasureToolStateSelector.GetValue() == false;
                UpdateMultiSelection();
            }));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <OpenDialogAction.DialogType>(UIStateContext.current, nameof(IDialogDataProvider.activeSubDialog),
                                                                                                  type =>
            {
                UpdateMultiSelection();
            }));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <Color[]>(UIStateContext.current, nameof(IUIStateDataProvider.colorPalette),
                                                                              palette =>
            {
                SetColorPalette(palette);
            }));

            OrphanUIController.onPointerClick += OnPointerClick;

            m_Reflect.StreamingStarting += bridge =>
            {
                m_Reflect.ViewerBridge.GameObjectCreating   += OnGameObjectCreating;
                m_Reflect.ViewerBridge.GameObjectDestroying += OnGameObjectDestroying;
                m_Reflect.ViewerBridge.GameObjectEnabling   += OnGameObjectEnabling;
            };

            QueryArgHandler.Register(this, k_SelectionQueryKey, SelectionFromQueryValue, SelectionToQueryValue);
        }
        void Start()
        {
            m_DialogButton.buttonClicked += OnDialogButtonClicked;

            m_TextureToggle.onValueChanged.AddListener(OnTextureToggleChanged);
            m_LightDataToggle.onValueChanged.AddListener(OnLightDataToggleChanged);

            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(SceneOptionContext.current, nameof(ISceneOptionData <SkyboxData> .enableLightData), newData => { m_LightDataToggle.on = newData; }));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <bool>(SceneOptionContext.current, nameof(ISceneOptionData <SkyboxData> .enableTexture), newData => { m_TextureToggle.on = newData; }));
            m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <OpenDialogAction.DialogType>(UIStateContext.current, nameof(IDialogDataProvider.activeDialog), OnActiveDialogChanged));
        }
Esempio n. 29
0
 void Awake()
 {
     m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <int>(SunStudyContext.current, nameof(ISunstudyDataProvider.altitude), (alt) =>
     {
         m_AltitudeDialControl.selectedValue = alt;
     }));
     m_DisposeOnDestroy.Add(UISelectorFactory.createSelector <int>(SunStudyContext.current, nameof(ISunstudyDataProvider.azimuth), (az) =>
     {
         m_AzimuthDialControl.selectedValue = az;
     }));
 }
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        var user = ScriptableObject.CreateInstance <UserSO>();

        user.user = new UserDummy();
        var realUser = property.serializedObject.targetObject as UIStateManager;

        if (realUser)
        {
            try
            {
                if (Application.isPlaying)
                {
                    using (var userSelector = UISelectorFactory.createSelector <UnityUser>(SessionStateContext <UnityUser, LinkPermission> .current, nameof(ISessionStateDataProvider <UnityUser, LinkPermission> .user)))
                    {
                        user.user.AccessToken = userSelector.GetValue().AccessToken;
                        user.user.DisplayName = userSelector.GetValue().DisplayName;
                        user.user.UserId      = userSelector.GetValue().UserId;
                        m_valid = true;
                    }
                }
            }
            catch (Exception)
            {
                m_valid = false;
            }
        }

        SerializedObject serializedObject = new UnityEditor.SerializedObject(user);

        SerializedProperty serializedPropertyUser = serializedObject.FindProperty("user");

        EditorGUI.BeginProperty(position, label, property);

        EditorGUI.LabelField(new Rect(position.x, position.y, position.width, 16), label);

        if (m_valid)
        {
            var tokenRect  = new Rect(position.x, position.y + 18, position.width, 16);
            var nameRect   = new Rect(position.x, position.y + 36, position.width, 16);
            var userIdRect = new Rect(position.x, position.y + 54, position.width, 16);

            EditorGUI.indentLevel++;

            EditorGUI.PropertyField(tokenRect, serializedPropertyUser.FindPropertyRelative("AccessToken"));
            EditorGUI.PropertyField(nameRect, serializedPropertyUser.FindPropertyRelative("DisplayName"));
            EditorGUI.PropertyField(userIdRect, serializedPropertyUser.FindPropertyRelative("UserId"));

            EditorGUI.indentLevel--;
        }
        EditorGUI.EndProperty();

        ScriptableObject.DestroyImmediate(user);
    }