public void SubmitForm()
    {
        RoomName = GameObject.Find("Canvas/Panel/Text").GetComponent <Text> ().text;
        foreach (GameObject Reservetoggle in toggles)
        {
            Toggle m_Toggle = Reservetoggle.GetComponent <Toggle>();
            ReservationTime  = m_Toggle.name.Substring(1, 2);
            ReservationTime += ":00:00";
            if (m_Toggle.isOn)
            {
                //Debug.Log ("Reserve" + m_Toggle.name);
                ReservationStatus = "true";
            }
            else
            {
                //Debug.Log ("Not reserve" + m_Toggle.name);
                ReservationStatus = "false";
            }
            StartCoroutine("PostForm");
        }
        PopUpPanel = GameObject.Find("Canvas/PopUpPanel");
        PopUpPanel.transform.localScale      = new Vector3(0, 0, 0);
        EmptyGameObject.transform.localScale = new Vector3(1, 1, 1);
        GameObject Camera    = GameObject.Find("ARCamera");
        ARCamera   TakePhoto = (ARCamera)Camera.GetComponent(typeof(ARCamera));

        TakePhoto.OnStartClick();
    }
Esempio n. 2
0
    public IEnumerator PostForm()
    {
        //Debug.Log ("Post Form is started");
        WWWForm Form = new WWWForm();

        Form.AddField("RoomName", RoomName);
        UnityWebRequest submit = UnityWebRequest.Post("http://192.168.43.238:80/arroomreservation/ReservationForRoom.php", Form);

        yield return(submit.SendWebRequest());

        if (submit.isNetworkError || submit.isHttpError)
        {
            Debug.Log("Error: " + submit.downloadHandler.text);
        }
        else
        {
            //Debug.Log ("Success: " + submit.downloadHandler.text);
            if (submit.downloadHandler.text.Equals(""))
            {
                PopWindow = true;
            }
            else
            {
                PopUpPanel.transform.localScale = new Vector3(1f, 1f, 1f);
                string[] ReserveStatus = submit.downloadHandler.text.Split(',');
                for (int i = 0; i < ReserveStatus.Length - 1; i++)
                {
                    //Debug.Log (ReserveStatus [i].Substring(0,2));
                    Time = ReserveStatus [i].Substring(0, 2);
                    //Debug.Log (Time);
                    string[] mStatus = ReserveStatus [i].Split(' ');
                    //Status[i] = mStatus [1];
                    Debug.Log(mStatus [1]);
                    foreach (GameObject Reservetoggle in toggles)
                    {
                        Toggle m_Toggle        = Reservetoggle.GetComponent <Toggle> ();
                        string ReservationTime = m_Toggle.name.Substring(1, 2);
                        if (ReservationTime.Equals(Time) && mStatus [1].Equals("true"))
                        {
                            m_Toggle.isOn = true;
                        }
                        else if (ReservationTime.Equals(Time) && mStatus [1].Equals("false"))
                        {
                            m_Toggle.isOn = false;
                        }
                    }
                }
            }
        }
    }