Beispiel #1
0
        public async void InitializeLocateFlowDemo()
        {
            if (this.currentAppState == AppState.DemoStepChooseFlow)
            {
                long   anchorNumber;
                string inputText = XRUXPickerForSharedAnchorDemo.Instance.GetDemoInputField().text;
                if (!long.TryParse(inputText, out anchorNumber))
                {
                    this.feedbackBox.text = "Invalid Anchor Number!";
                }
                else
                {
                    _anchorNumberToFind = anchorNumber;
#if !UNITY_EDITOR
                    _anchorKeyToFind = await anchorExchanger.RetrieveAnchorKey(_anchorNumberToFind.Value);
#endif
                    if (_anchorKeyToFind == null)
                    {
                        this.feedbackBox.text = "Anchor Number Not Found!";
                    }
                    else
                    {
                        this._currentDemoFlow = DemoFlow.LocateFlow;
                        this.currentAppState  = AppState.DemoStepCreateSession;
                        SetChooseFlowUIVisibility(false);
                    }
                }
            }
            else
            {
                AdvanceDemo();
            }
        }
Beispiel #2
0
        private void AdvanceCreateFlowDemo()
        {
            switch (this.currentAppState)
            {
            case AppState.DemoStepCreateSession:
                this.CloudManager.ResetSessionStatusIndicators();
                this.currentCloudAnchor = null;
                this.currentAppState    = AppState.DemoStepConfigSession;
                break;

            case AppState.DemoStepConfigSession:
                this.ConfigureSession();
                this.currentAppState = AppState.DemoStepStartSession;
                break;

            case AppState.DemoStepStartSession:
                this.CloudManager.EnableProcessing = true;
                this.currentAppState = AppState.DemoStepCreateLocalAnchor;
                break;

            case AppState.DemoStepCreateLocalAnchor:
                if (this.spawnedObject != null)
                {
                    this.currentAppState = AppState.DemoStepSaveCloudAnchor;
                }
                break;

            case AppState.DemoStepSaveCloudAnchor:
                this.SaveCurrentObjectAnchorToCloud();
                this.currentAppState = AppState.DemoStepSavingCloudAnchor;
                break;

            case AppState.DemoStepStopSession:
                this.CloudManager.EnableProcessing = false;
                this.CleanupSpawnedObjects();
                this.CloudManager.ResetSession();
                if (_runningOnHoloLens)
                {
                    this.currentAppState  = AppState.DemoStepCreateSessionForQuery;
                    this._currentDemoFlow = DemoFlow.LocateFlow;
                }
                else
                {
                    this.currentAppState = AppState.DemoStepComplete;
                }
                break;

            case AppState.DemoStepComplete:
                this.currentCloudAnchor = null;
                this.currentAppState    = AppState.DemoStepChooseFlow;
                SetChooseFlowUIVisibility(true);
                this.CleanupSpawnedObjects();
                break;

            default:
                Debug.Log("Shouldn't get here for app state " + this.currentAppState);
                break;
            }
        }
Beispiel #3
0
        private void AdvanceLocateFlowDemo()
        {
            switch (this.currentAppState)
            {
            case AppState.DemoStepCreateSession:
                this.currentAppState = AppState.DemoStepChooseFlow;
                this.CloudManager.ResetSessionStatusIndicators();
                this.currentCloudAnchor = null;
                this.currentAppState    = AppState.DemoStepCreateSessionForQuery;
                break;

            case AppState.DemoStepCreateSessionForQuery:
                this.anchorsLocated = 0;
                this.ConfigureSession();
                this.currentAppState = AppState.DemoStepStartSessionForQuery;
                break;

            case AppState.DemoStepStartSessionForQuery:
                this.CloudManager.EnableProcessing = true;
                this.currentAppState = AppState.DemoStepLookForAnchor;
                break;

            case AppState.DemoStepLookForAnchor:
                this.currentAppState = AppState.DemoStepLookingForAnchor;
                this.CloudManager.CreateWatcher();
                break;

            case AppState.DemoStepLookingForAnchor:
                // Advancement will take place when anchors have all been located.
                break;

            case AppState.DemoStepStopSessionForQuery:
                this.CloudManager.EnableProcessing = false;
                this.CloudManager.ResetSession();
                this.currentAppState = AppState.DemoStepComplete;
                break;

            case AppState.DemoStepComplete:
                this.currentCloudAnchor = null;
                if (_runningOnHoloLens)
                {
                    this.currentAppState  = AppState.DemoStepCreateSession;
                    this._currentDemoFlow = DemoFlow.CreateFlow;
                }
                else
                {
                    this.currentAppState = AppState.DemoStepChooseFlow;
                    SetChooseFlowUIVisibility(true);
                }
                this.CleanupSpawnedObjects();
                break;

            default:
                Debug.Log("Shouldn't get here for app state " + this.currentAppState);
                break;
            }
        }
Beispiel #4
0
 public async Task InitializeCreateFlowDemoAsync()
 {
     if (currentAppState == AppState.DemoStepChooseFlow)
     {
         _currentDemoFlow = DemoFlow.CreateFlow;
         currentAppState  = AppState.DemoStepCreateSession;
     }
     else
     {
         await AdvanceDemoAsync();
     }
 }
 public void InitializeCreateFlowDemo()
 {
     if (currentAppState == AppState.DemoStepChooseFlow)
     {
         _currentDemoFlow = DemoFlow.CreateFlow;
         currentAppState  = AppState.DemoStepCreateSession;
     }
     else
     {
         AdvanceDemo();
     }
 }
        public async void createAnchorButtonClicked()
        {
            // Disable the Regular UI
            GameObject mainUI = GameObject.Find("MainMenuPanel_Navigation_CombinedExperience");

            //mainUI.GetComponent<MeshRenderer>().enabled = false;
            mainUI.transform.localScale = new Vector3(0, 0, 0);


            _currentDemoFlow = DemoFlow.CreateFlow;
            currentAppState  = AppState.DemoStepCreateSession;

            // Enable the Create Anchor UI
            GameObject createFlowBtn = GameObject.Find("CreateFlowButton");

            createFlowBtn.transform.localScale = new Vector3(1, 1, 1);

            GameObject anchorNbrBox = GameObject.Find("AnchorNumberBox");

            anchorNbrBox.transform.localScale = new Vector3(1, 1, 1);

            GameObject mainMenuText = GameObject.Find("CreateAnchorMenuText");

            mainMenuText.transform.localScale = new Vector3(1, 1, 1);

            GameObject exitBtn = GameObject.Find("ExitBtn");

            exitBtn.transform.localScale = new Vector3(1, 1, 1);

            GameObject submitAnchorNameBtn = GameObject.Find("SubmitAnchorNameBtn");

            submitAnchorNameBtn.transform.localScale = new Vector3(1, 1, 1);


            // Verify input from user
            //    anchorNameForCreation = GameObject.Find("AnchorNumberBox").transform.GetChild(0).transform.GetComponent<UnityEngine.UI.Text>().text;

            /*
             *  while (anchorNameForCreation.Equals(""))
             *  {
             *      feedbackBox.text = "Provide Name for Spatial Anchor";
             *  }
             */
            //   ConfigureSession();
            //   currentAppState = AppState.DemoStepStartSession;

            /*
             * await CloudManager.StartSessionAsync();
             * currentAppState = AppState.DemoStepCreateLocalAnchor;
             */
            await AdvanceCreateFlowDemoAsync();
        }
Beispiel #7
0
 public void InitializeCreateFlowDemo()
 {
     if (this.currentAppState == AppState.DemoStepChooseFlow)
     {
         this._currentDemoFlow = DemoFlow.CreateFlow;
         this.currentAppState  = AppState.DemoStepCreateSession;
         SetChooseFlowUIVisibility(false);
     }
     else
     {
         AdvanceDemo();
     }
 }
#pragma warning disable CS1998 // Conditional compile statements are removing await
        public async Task InitializeLocateFlowDemoAsync()
#pragma warning restore CS1998
        {
            string currentAnchorKey = "";

            Debug.LogError("inside ");

            if (currentAppState == AppState.DemoStepChooseFlow)
            {
                currentAppState = AppState.DemoStepInputAnchorNumber;
            }
            else if (currentAppState == AppState.DemoStepInputAnchorNumber)
            {
                // Get list of Anchors to add from the Anchor List UI
                if ((GameObject.Find("Content") == null) || (GameObject.Find("Content").transform == null))
                {
                    Debug.Log("Null in initlocateflowasync at (0)");
                }
                Transform anchorListTransform = GameObject.Find("Content").transform;

                if (_anchorKeyToFind == null)
                {
                    if (feedbackBox == null)
                    {
                        Debug.Log("FEEDBACK TEXT IS NULL!! (4)");
                    }
                    feedbackBox.text = "Anchor Number Not Found!";
                }
                else
                {
                    _currentDemoFlow = DemoFlow.LocateFlow;
                    currentAppState  = AppState.DemoStepCreateSessionForQuery;

                    // Just added this:
                    Debug.Log("Going into AdvanceLocateFlowDemoAsync()");

                    await AdvanceLocateFlowDemoAsync();
                }
            }
            else
            {
                await AdvanceDemoAsync();
            }
        }
#pragma warning disable CS1998 // Conditional compile statements are removing await
        public async Task InitializeLocateFlowDemoAsync()
#pragma warning restore CS1998
        {
            if (currentAppState == AppState.DemoStepChooseFlow)
            {
                currentAppState = AppState.DemoStepInputAnchorNumber;
            }
            else if (currentAppState == AppState.DemoStepInputAnchorNumber)
            {
                long   anchorNumber;
                string inputText = XRUXPickerForSharedAnchorDemo.Instance.GetDemoInputField().text;
                if (!long.TryParse(inputText, out anchorNumber))
                {
                    feedbackBox.text = "Invalid Anchor Number!";
                }
                else
                {
                    _anchorNumberToFind = anchorNumber;
#if !UNITY_EDITOR
                    _anchorKeyToFind = await anchorExchanger.RetrieveAnchorKey(_anchorNumberToFind.Value);
#endif
                    if (_anchorKeyToFind == null)
                    {
                        feedbackBox.text = "Anchor Number Not Found!";
                    }
                    else
                    {
                        _currentDemoFlow = DemoFlow.LocateFlow;
                        currentAppState  = AppState.DemoStepCreateSession;
                        XRUXPickerForSharedAnchorDemo.Instance.GetDemoButtons()[1].gameObject.SetActive(true);
                        XRUXPickerForSharedAnchorDemo.Instance.GetDemoInputField().text = "";
                    }
                }
            }
            else
            {
                await AdvanceDemoAsync();
            }
        }
#pragma warning disable CS1998 // Conditional compile statements are removing await
        public async Task InitializeLocateFlowDemoAsync()
#pragma warning restore CS1998
        {
            string currentAnchorKey = "";

            Debug.LogError("inside ");

            if (currentAppState == AppState.DemoStepChooseFlow)
            {
                currentAppState = AppState.DemoStepInputAnchorNumber;
            }
            else if (currentAppState == AppState.DemoStepInputAnchorNumber)
            {
                string anchorName;
                // string inputText = XRUXPickerForMainMenu.Instance.GetDemoInputField().text;

                // _anchorNumberToFind = anchorName;
                // This is where I need to change _anchorKeyToFind to a list and cycle through all rowKeys (of interest. Statically set for now) and add them to _anchorKeyToFindList
                // For now it will ignore user's actual input
                _anchorNameToFind = new List <string>();
                _anchorKeyToFind  = new List <String>();

                // Add rowkeys
                // Get list of Anchors to add from the Anchor List UI
                if ((GameObject.Find("Content") == null) || (GameObject.Find("Content").transform == null))
                {
                    Debug.Log("Null in initlocateflowasync at (0)");
                }
                Transform anchorListTransform = GameObject.Find("Content").transform;

                nbrOfDestinationAnchors = 0;
                // Now adding directly to the list containing the anchor keys, not the rows.
                //_anchorNumberToFind.Add(24); // Add first flag
                //_anchorNumberToFind.Add(25); // Add second flag

                Debug.LogError("added anchors to the list that need to be searched");

                // Add anchor keys
#if !UNITY_EDITOR
                Debug.Log("ONLY ADDING 2 ANCHORS TO SEARCH FOR !!***********************************************************************************!!");

                // Now adding directly to the list containing the anchor keys, not the rows.
                //string currentAnchorKey = await anchorExchanger.RetrieveAnchorKey(_anchorNameToFind[i]);

                int i = 0;
                foreach (Transform child in anchorListTransform)
                {
                    if (((child.Find("Toggle" + i).GetComponent <Toggle>().isOn == true) && child.Find("Toggle" + i)) && (child.Find("Toggle" + i).Find("AnchorContainer").gameObject.transform.childCount > 0))
                    {
                        Debug.Log("In initlocateflowasync, made it to (1)");

                        // First need to check if actually selected (above)
                        try
                        {
                            _anchorKeyToFind.Add(child.Find("Toggle" + i).Find("AnchorContainer").gameObject.transform.GetChild(0).name);
                            Debug.Log("In initlocateflowasync, made it to (2)");
                        }
                        catch (Exception)
                        {
                            Debug.Log("bad value was attempted to be added to _anchorKeyToFind. value was " + (currentAnchorKey != "" ? currentAnchorKey : ""));
                        }
                        nbrOfDestinationAnchors++;
                    }
                    i++;
                }
#endif

                //_anchorKeyToFind = await anchorExchanger.RetrieveAnchorKey(_anchorNameToFind.Value);
                if (_anchorKeyToFind == null)
                {
                    if (feedbackBox == null)
                    {
                        Debug.Log("FEEDBACK TEXT IS NULL!! (4)");
                    }
                    feedbackBox.text = "Anchor Number Not Found!";
                }
                else
                {
                    _currentDemoFlow = DemoFlow.LocateFlow;
                    //currentAppState = AppState.DemoStepCreateSession;
                    currentAppState = AppState.DemoStepCreateSessionForQuery;
                    //   XRUXPickerForMainMenu.Instance.GetDemoInputField().text = "";


                    // Just added this:
                    Debug.Log("Going into AdvanceLocateFlowDemoAsync()");

                    await AdvanceLocateFlowDemoAsync();
                }
            }
            else
            {
                await AdvanceDemoAsync();
            }
        }