Ejemplo n.º 1
0
        public void SavePoints()
        {
            string        name  = NameField.text;
            RunPeetyPoint point = new RunPeetyPoint();

            if (!string.IsNullOrEmpty(name))
            {
                point.name   = name;
                point.points = EnviromentEngine.points;

                StartCoroutine(PostPoints(point));
            }
        }
Ejemplo n.º 2
0
        IEnumerator PostPoints(RunPeetyPoint point)
        {
            string  pointJson = JsonUtility.ToJson(point);
            Encoder encoder   = new Encoder();

            string encodedPoint = encoder.encodeString(pointJson);
            Dictionary <string, string> postData = new Dictionary <string, string>();

            postData.Add("encodedPoint", encodedPoint);

            using (UnityWebRequest www = UnityWebRequest.Post(URL, postData))
            {
                yield return(www.SendWebRequest());

                if (www.isHttpError)
                {
                    Debug.Log(www.error);
                }
                else
                {
                    PostPointsGO.SetActive(false);
                }
            }
        }