Example #1
0
        /// <summary>
        /// Shows UI for the beginning phase of application "Hosting Mode".
        /// </summary>
        /// <param name="snackbarText">Optional text to put in the snackbar.</param>
        public void ShowHostingModeBegin(string snackbarText = null)
        {
            HostAnchorModeButton.GetComponentInChildren <Text>().text = "Cancel";
            HostAnchorModeButton.interactable = true;
            ResolveAnchorModeButton.GetComponentInChildren <Text>().text = "Resolve";
            ResolveAnchorModeButton.interactable = false;

            if (string.IsNullOrEmpty(snackbarText))
            {
                SnackbarText.text =
                    "The room code is now available. Please place an anchor to host, press Cancel to Exit.";
            }
            else
            {
                SnackbarText.text = snackbarText;
                Debug.Log("PayloadRestored, snackbar = " + snackbarText);
                if (snackbarText.Equals("Cloud anchor was created and saved."))
                {
                    Debug.Log("Got inside if statement");
                    //package data
                    //get dictionary
                    GameObject cloudController;
                    cloudController = GameObject.Find("CloudAnchorController");
                    RoomSharingServer roomSharingServer = cloudController.GetComponent <RoomSharingServer>();
                    //roomSharingServer.m_RoomAnchorsDict;
                    //_GetDeviceIpAddress()

                    string Cloud_ID = "";
                    foreach (KeyValuePair <int, XPAnchor> kvp in roomSharingServer.m_RoomAnchorsDict)
                    {
                        Cloud_ID = kvp.Value.CloudId;
                        Debug.Log("Key: " + kvp.Key + " ID: " + kvp.Value.CloudId);
                    }



                    AnchorPayload payload = new AnchorPayload
                    {
                        CloudID   = Cloud_ID,
                        ipAddress = _GetDeviceIpAddress()
                    };
                    Debug.Log("Payload Created" + roomSharingServer.m_RoomAnchorsDict.Count);



                    //send to Eventsystem
                    GameObject eventSystem;
                    eventSystem = GameObject.Find("EventSystem");
                    GameDataRelay gameDataRelay = eventSystem.GetComponent <GameDataRelay>();
                    gameDataRelay.seq.setHostLocalizationData(payload);
                }
            }

            InputRoot.SetActive(false);
        }