Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles user intent to enter a mode where they can place an anchor to host or to exit this mode if
        /// already in it.
        /// </summary>
        public void OnEnterHostingModeClick()
        {
            if (m_CurrentMode == ApplicationMode.Hosting)
            {
                m_CurrentMode = ApplicationMode.Ready;
                _ResetStatus();
                return;
            }

            m_CurrentMode = ApplicationMode.Hosting;
            m_CurrentRoom = Random.Range(1, 9999);

            GameObject eventSystem;

            eventSystem = GameObject.Find("EventSystem");
            GameDataRelay gameDataRelay = eventSystem.GetComponent <GameDataRelay>();

            gameDataRelay.seq.setHostLocalizationRentalNumber(m_CurrentRoom);

            UIController.SetRoomTextValue(m_CurrentRoom);
            UIController.ShowHostingModeBegin();
        }
Ejemplo n.º 3
0
 void Awake()
 {
     eventSystem   = GameObject.Find("EventSystem");
     gameDataRelay = eventSystem.GetComponent <GameDataRelay>();
 }