public override void OnCreateFailed(XString reason) { LogWriteLine("********* SESSION CREATE FAILED: " + reason.GetString() + " ******"); if (CreateFailed != null) { CreateFailed(reason); } }
/// <summary> /// Kicks off the process of creating the shared space. /// </summary> void StartAnchorProcess() { // First, are there any anchors in this room? int anchorCount = currentRoom.GetAnchorCount(); Debug.Log(anchorCount + " anchors"); // If there are anchors, we should attach to the first one. if (anchorCount > 0) { // Extract the name of the anchor. HoloToolkit.Sharing.XString storedAnchorString = currentRoom.GetAnchorName(0); string storedAnchorName = storedAnchorString.GetString(); // Attempt to attach to the anchor in our local anchor store. if (AttachToCachedAnchor(storedAnchorName) == false) { Debug.Log("Starting room download"); // If we cannot find the anchor by name, we will need the full data blob. MakeAnchorDataRequest(); } } }
/// <summary> /// Called before creating anchor. Used to check if import required. /// </summary> /// <param name="anchorId">Name of the anchor to import.</param> /// <param name="objectToAnchor">GameObject </param> /// <returns>Success.</returns> protected override bool ImportAnchor(string anchorId, GameObject objectToAnchor) { if (SharingStage.Instance == null || SharingStage.Instance.Manager == null || SharingStage.Instance.CurrentRoom == null) { Debug.LogErrorFormat("[SharingWorldAnchorManager] Failed to import anchor \"{0}\"! The sharing service was not ready.", anchorId); if (AnchorDebugText != null) { AnchorDebugText.text += string.Format("\nFailed to import anchor \"{0}\"! The sharing service was not ready.", anchorId); } return(false); } int roomAnchorCount = SharingStage.Instance.CurrentRoom.GetAnchorCount(); for (int i = 0; i < roomAnchorCount; i++) { XString roomAnchorId = SharingStage.Instance.CurrentRoom.GetAnchorName(i); if (roomAnchorId.GetString().Equals(anchorId)) { bool downloadStarted = SharingStage.Instance.CurrentRoomManager.DownloadAnchor(SharingStage.Instance.CurrentRoom, anchorId); if (downloadStarted) { if (ShowDetailedLogs) { Debug.Log("[SharingWorldAnchorManager] Found a match! Attempting to download anchor..."); } if (AnchorDebugText != null) { AnchorDebugText.text += "\nFound a match! Attempting to download anchor..."; } } else { Debug.LogWarning("[SharingWorldAnchorManager] Found a match, but we've failed to start download!"); if (AnchorDebugText != null) { AnchorDebugText.text += "\nFound a match, but we've failed to start download!"; } } return(downloadStarted); } } if (ShowDetailedLogs) { Debug.LogFormat("[SharingWorldAnchorManager] No matching anchor found for \"{0}\" in room {1}.", anchorId, SharingStage.Instance.CurrentRoom.GetName().GetString()); } if (AnchorDebugText != null) { AnchorDebugText.text += string.Format("\nNo matching anchor found for \"{0}\" in room {1}.", anchorId, SharingStage.Instance.CurrentRoom.GetName().GetString()); } return(false); }
public override void OnCreateFailed(XString reason) { LogWriteLine("********* SESSION CREATE FAILED: " + reason.GetString() + " ******"); CreateFailed?.Invoke(reason); }