Exemplo n.º 1
0
    public void Drop()
    {
        //null check
        if (!m_CurrentInteractable)
        {
            return;
        }

        if (m_CurrentInteractable.GetComponent <CustomTag>().HasTag("cue_image"))
        {
            if (ActiveUser.userID != null)
            {
                Transform transform = m_CurrentInteractable.GetComponent <Transform>();


                Image_cue image_cue = new Image_cue(ActiveUser.userID, m_CurrentInteractable.GetComponent <Image_cue>().id, 0, (float)System.Math.Round(transform.position.x, 6), (float)System.Math.Round(transform.position.y, 6), (float)System.Math.Round(transform.position.z, 6), m_CurrentInteractable.GetComponent <Image_cue>().photo);

                m_CurrentInteractable.GetComponent <Image_cue>().setImage_Cue(image_cue);

                networkManager.GetComponent <NetworkManager>().saveImage(image_cue);
            }
        }



        //detach
        m_Joint.connectedBody = null;



        //clear
        m_CurrentInteractable.m_ActiveHand = null;
        m_CurrentInteractable = null;
    }
Exemplo n.º 2
0
 public void setImage_Cue(Image_cue cue)
 {
     this.owner     = cue.owner;
     this.id        = cue.id;
     this.workspace = cue.workspace;
     this.vector_x  = cue.vector_x;
     this.vector_y  = cue.vector_y;
     this.vector_z  = cue.vector_z;
     this.photo     = cue.photo;
 }
Exemplo n.º 3
0
    public void saveImage(Image_cue cue)
    {
        if (ActiveUser.userID != null)
        {
            if (cue.id == 0)
            {
                StartCoroutine(GetRequest(ip + "rpc/get_new_id_image", (UnityWebRequest req) =>
                {
                    if (req.isNetworkError || req.isHttpError)
                    {
                        Debug.Log($"{req.error}: {req.downloadHandler.text}");
                    }
                    else
                    {
                        string body = req.downloadHandler.text;


                        cue.id      = int.Parse(body);
                        string json = JsonUtility.ToJson(cue);
                        Debug.Log(ActiveUser.userID);
                        Debug.Log("INTEGER IS " + body);
                        Debug.Log(json);

                        StartCoroutine(PostRequest(ip + "/image_cue", json));
                    }
                }));
            }
            else
            {
                string json = JsonUtility.ToJson(cue);
                Debug.Log(ActiveUser.userID);
                Debug.Log(json);

                StartCoroutine(PostRequest(ip + "/image_cue", json));
            }
        }
    }