示例#1
0
    //send a player's landmark to database, status : unlimited, no duplicates locations
    public void sendlandmark()
    {
        Debug.Log("sendlandmarks called");
        WWWForm form = new WWWForm();

        //check if name is not empty and less than 16
        if (NameString.text != "" && NameString.text.Length < 16)
        {
            if (LatString.text != "" && LonString.text != "")
            {
                form.AddField("Name", NameString.GetComponent <Text>().text);
                form.AddField("PlayerID", Player.playername);
                form.AddField("Lon", LonString.GetComponent <Text>().text);
                form.AddField("Lat", LatString.GetComponent <Text>().text);
                WWW uploadLandmark = new WWW(url, form);
                StartCoroutine(WaitForRequest(uploadLandmark));
            }
            else
            {
                debug.text = "Location services must be on to work.";
            }
        }
        else
        {
            debug.text = "Name cannot be blank or more than 16 characters";
        }
    }
示例#2
0
    public void sendlandmark()
    {
        Debug.Log("sendlandmarks called");
        WWWForm form = new WWWForm();

        //check if name is not empty and less than 16
        if (NameString.text != "" && NameString.text.Length < 16)
        {
            if (LatString.text != "" && LonString.text != "")
            {
                form.AddField("NameFromUnity", NameString.GetComponent <Text>().text);
                form.AddField("LonFromUnity", LonString.GetComponent <Text>().text);
                form.AddField("LatFromUnity", LatString.GetComponent <Text>().text);
                WWW upload = new WWW(url, form);
                // yield return download;
                //Debug.Log(download.error);
                if (!string.IsNullOrEmpty(upload.error))
                {
                    print(upload.error);
                }
                else
                {
                    print("Finished Uploading Landmark");
                }
            }
            else
            {
                debug.text = "Lat/Lon not set. Location must be on to work.";
            }
        }
        else
        {
            debug.text = "Name cannot be blank or more than 16 characters";
        }
    }