public void StopAzureSession()
 {
     DebugWindowMessaging.Clear();
     CloudManager.EnableProcessing = false;
     CloudManager.ResetSession();
     Debug.Log("Azure Session Stopped!!");
 }
 public void StartAzureSession()
 {
     DebugWindowMessaging.Clear();
     CloudManager.ResetSessionStatusIndicators();
     CloudManager.EnableProcessing = true;
     Debug.Log("Azure Session Started!!");
 }
    //public void ShareAnchorNetwork()
    //{
    //    PV = GenericNetworkManager.instance.localUser;
    //    DebugWindowMessaging.Clear();
    //    Debug.Log("ShareAnchorNetwork RPC - AzureAnchorID" + GenericNetworkManager.instance.AzureAnchorID);
    //    if (PV != null)
    //    {
    //        PV.RPC("RPC_SetSharedAnchorID", RpcTarget.AllBuffered, GenericNetworkManager.instance.AzureAnchorID);
    //        Debug.Log("AzureAnchorID user "  + " " +PV.Controller.UserId);
    //    }
    //    else
    //    {
    //        Debug.Log("PV is null");
    //    }
    //}

    public void GetSharedAnchorNetwork()
    {
        DebugWindowMessaging.Clear();
        Debug.Log("GetSharedAnchorNetwork - AzureAnchorID" + GenericNetworkManager.instance.AzureAnchorID);
        FindAzureAnchor(GenericNetworkManager.instance.AzureAnchorID);
        Debug.Log("Recieved anchor network!");
    }
    public void CreateAzureAnchor(GameObject theObject)
    {
        DebugWindowMessaging.Clear();
        Debug.Log("Create_Azure_Anchor button is pressed");
        Debug.Log("Wait for sometime and press Share_Azure_Anchor");
        //First we create a local anchor at the location of the object in question
        theObject.AddARAnchor();

        //Then we create a new local cloud anchor
        CloudSpatialAnchor localCloudAnchor = new CloudSpatialAnchor();

        //Now we set the local cloud anchor's position to the local anchor's position
        localCloudAnchor.LocalAnchor = theObject.GetNativeAnchorPointer();

        //Check to see if we got the local anchor pointer
        if (localCloudAnchor.LocalAnchor == IntPtr.Zero)
        {
            Debug.Log("Didn't get the local XR anchor pointer...");
            return;
        }

        // In this sample app we delete the cloud anchor explicitly, but here we show how to set an anchor to expire automatically
        localCloudAnchor.Expiration = DateTimeOffset.Now.AddDays(7);

        //Save anchor to cloud
        Task.Run(async() =>
        {
            while (!CloudManager.EnoughDataToCreate)
            {
                await Task.Delay(330);
            }

            bool success = false;
            try
            {
                currentCloudAnchor = await CloudManager.StoreAnchorInCloud(localCloudAnchor);

                //Save the Azure Anchor ID
                GenericNetworkManager.instance.AzureAnchorID = currentCloudAnchor.Identifier;
                Debug.Log("Azure anchor ID saved!");

                success          = currentCloudAnchor != null;
                localCloudAnchor = null;

                if (success)
                {
                    Debug.Log("Successfully Created Anchor");
                }
            }
            catch (Exception ex)
            {
                Debug.Log(ex);
                Debug.Log("Anchor creation failure");
            }
        });
    }
    //Start looking for specified anchors
    public void FindAzureAnchor(string AnchorIDtoFind)
    {
        DebugWindowMessaging.Clear(); DebugWindowMessaging.Clear();
        //Provide list of anchor IDs to locate
        SetUpAnchorIDsToLocate();

        //Start watching for Anchors
        currentWatcher = CloudManager.CreateWatcher();
        Debug.Log("Azure anchors found!");
    }
 public void DeleteAzureAnchor(string AnchorIDtoDelete)
 {
     DebugWindowMessaging.Clear();
     //Delete the anchor with the ID specified off the server and locally
     Task.Run(async() =>
     {
         await CloudManager.DeleteAnchorAsync(currentCloudAnchor);
         currentCloudAnchor = null;
     });
     Debug.Log("Azure anchor deleted");
 }
    void Awake()
    {
        if (debugWindow == null)
        {
            debugWindow = this;
        }
        else
        {
            Destroy(this.gameObject);
        }

        Application.logMessageReceived += HandleLog;
    }
示例#8
0
 public void PVShareAnchorNetwork()
 {
     DebugWindowMessaging.Clear();
     Debug.Log("ShareAnchorNetwork RPC - AzureAnchorID" + GenericNetworkManager.instance.AzureAnchorID);
     if (PV != null)
     {
         PV.RPC("RPC_SetSharedAnchorID", RpcTarget.AllBuffered, GenericNetworkManager.instance.AzureAnchorID);
         Debug.Log("AzureAnchorID user " + " " + PV.Controller.UserId);
     }
     else
     {
         Debug.Log("PV is null");
     }
 }
示例#9
0
 public void PVShareAnchorNetwork()
 {
     DebugWindowMessaging.Clear();
     Debug.Log("\nPhotonRoom.PVShareAnchorNetwork()");
     Debug.Log("GenericNetworkManager.AzureAnchorID: " + GenericNetworkManager.instance.AzureAnchorID);
     if (PV != null)
     {
         PV.RPC("RPC_SetSharedAnchorID", RpcTarget.AllBuffered, GenericNetworkManager.instance.AzureAnchorID);
         Debug.Log("Azure Anchor ID shared by user: "******"PV is null");
     }
 }
示例#10
0
 public void RemoveLocalAnchor(GameObject theObject)
 {
     DebugWindowMessaging.Clear();
     theObject.RemoveARAnchor();
     Debug.Log("Local anchor removed");
 }