当前位置: 首页>>代码示例>>C#>>正文


C# WWWForm类代码示例

本文整理汇总了C#中WWWForm的典型用法代码示例。如果您正苦于以下问题:C# WWWForm类的具体用法?C# WWWForm怎么用?C# WWWForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WWWForm类属于命名空间,在下文中一共展示了WWWForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoginCR

    IEnumerator LoginCR()
    {
        WWWForm form = new WWWForm();
        string action="login";
        form.AddField("id",FB.UserId);
        form.AddField("hash",Util.Md5Sum(safeHash));

        form.AddField("action",action);
        WWW hs_post = new WWW(controllerPHP,form);
        yield return hs_post;
        if (hs_post.error!=null){
            Debug.Log ("ERRO |"+hs_post.error+"|");
        }else{
            JSONObject jObj=new JSONObject(hs_post.text);
            Debug.Log (Regex.Unescape(hs_post.text)+" FOI AQUI");
            if (Regex.Unescape(hs_post.text)==""){

                Debug.Log ("SUCESSO");
            }else if (jObj["result"].str!=null){

            }else{

            }
        }
    }
开发者ID:Praesidium,项目名称:Sexualidade-quiz,代码行数:25,代码来源:connectionController.cs

示例2: POST

    //POST请求(Form表单传值、效率低、安全 ,)  
    IEnumerator POST(string url, Dictionary<string, string> post)
    {
        //表单   
        WWWForm form = new WWWForm();
        //从集合中取出所有参数,设置表单参数(AddField()).  
        foreach (KeyValuePair<string, string> post_arg in post)
        {
            form.AddField(post_arg.Key, post_arg.Value);
        }
        //表单传值,就是post   
        WWW www = new WWW(url, form);

        yield return www;
        mJindu = www.progress;

        if (www.error != null)
        {
            //POST请求失败  
            mContent = "error :" + www.error;
        }
        else
        {
            //POST请求成功  
            mContent = www.text;
        }
    }
开发者ID:sorpcboy,项目名称:moredo,代码行数:27,代码来源:NetClientTemplate.cs

示例3: AddScore

 /// <summary>
 /// Adds Score to database
 /// </summary>
 /// <param name="name"></param>
 /// <param name="id"></param>
 /// <param name="score"></param>
 /// <returns></returns>
 private IEnumerator AddScore(string name, string id, string score)
 {
     WWWForm f = new WWWForm();
     f.AddField("ScoreID", id);
     f.AddField("Name", name);
     f.AddField("Point", score);
     WWW w = new WWW("demo/theappguruz/score/add", f);
     yield return w;
     if (w.error == null)
     {
         JSONObject jsonObject = new JSONObject(w.text);
         string data = jsonObject.GetField("Status").str;
         if (data != null && data.Equals("Success"))
         {
             Debug.Log("Successfull");
         }
         else
         {
             Debug.Log("Fatel Error");
         }
     }
     else
     {
         Debug.Log("No Internet Or Other Network Issue" + w.error);
     }
 }
开发者ID:power7714,项目名称:centralized-leader-board-unity-used-personal-web-api,代码行数:33,代码来源:Test.cs

示例4: WaitForRequest

    public IEnumerator WaitForRequest()
    {
        //  yield return new WaitForEndOfFrame();
        WWWForm form = new WWWForm();
            form.AddField("username", Id.name);
            form.AddField("wheatbought", f.aaa);
            form.AddField("dogsbought", 3);
            form.AddField("timeplayed", 4);
            form.AddField("timeplayedlvl1", 5);
            form.AddField("timeplayedlvl2", 6);
            form.AddField("timeplayedlvl3", 7);
            form.AddField("deathsinlvl1", 8);
            form.AddField("deathsinlvl2", 9);
            form.AddField("deathsinlvl3", 10);
            form.AddField("sheepkilledinlvl1", 11);
            form.AddField("sheepkilledinlvl2", 12);
            form.AddField("sheepkilledinlvl3", 13);
            form.AddField("score", 14);
            www = new WWW(url, form);
            yield return www;

        if (!string.IsNullOrEmpty(www.error))
        {
            print(www.error);
        }
        else
        {
            print("Finished Uploading scores");
        }
    }
开发者ID:rickoskam,项目名称:ShepherdGame,代码行数:30,代码来源:PostData2.cs

示例5: doLogin

    private IEnumerator doLogin()
    {
        string url = connect.getURL() + "/login/login.php";
        // isSucess = false;
        WWWForm form = new WWWForm();
        Debug.Log("initial Login:"+user.getAccount()+","+user.getPassword());
        form.AddField("act", user.getAccount());
        form.AddField("psd", user.getPassword());
        form.AddField("hash", connect.getHash());
        byte[] rawData = form.data;
        WWW www = new WWW(url, rawData);
        yield return www;

        // check for errors
        if (www.error == null)
        {
            string temp = www.text;
            Debug.Log("temp:" + temp + " num:" + temp.Length);
            Debug.Log(www.text);
            if (temp.Length == 5) //success login
            {
                user.loadAllfromServer();
                changeScene("Main");
            }
            else//帳密有誤
            {
                changeScene("Login");
            }
        }
        else
        {
            changeScene("Login");
            Debug.Log("WWW Error: " + www.error);
        }
    }
开发者ID:ivan-lin1993,项目名称:JiaBong,代码行数:35,代码来源:initial.cs

示例6: GetCountUser

    public IEnumerator GetCountUser()
    {
        //todo offline
        //if (EndGetCountUserEvent != null)
        //{
        //    EndGetCountUserEvent(0);
        //}
        //yield break;

        WWWForm form = new WWWForm();

        form.AddField(GameConst.NameHeaderParamKey, GetKeyMD5("counter", GameConst.SekretKey));

        Debug.Log(string.Format("{0} {1} {2}", "GetCountUser key", "counter", GetKeyMD5("counter", GameConst.SekretKey)));

        form.AddField("action", "counter");

        WWW www = new WWW(GameConst.URLServer, form);
        yield return www;

        if (www.error != null)
        {
            Debug.Log(www.error);
            yield break;
        }

        if (EndGetCountUserEvent != null)
        {
            var aaa = int.Parse(www.text) + 7500;
            EndGetCountUserEvent(aaa);
        }
    }
开发者ID:PhilipMantrov,项目名称:Jeka3,代码行数:32,代码来源:NetData.cs

示例7: SetScore

    IEnumerator SetScore(int score, string name, string url)
    {
        WWWForm form = new WWWForm();
        form.AddField("Name", name);
        form.AddField("Record", score);
        WWW w = new WWW(url, form);
        yield return w;

        if (!string.IsNullOrEmpty(w.error))
        {
            print(w.error);
        }
        else {
            switch (w.text)
            {
                case "1":
                    print("Sucesso");
                    break;
                case "-1":

                    print( "Erro ao cadastrar.");

                    break;

                default:
                    print(w.text);
                    break;
            }
        }
    }
开发者ID:Lucasmiiller01,项目名称:DefensordoFeudo,代码行数:30,代码来源:ScoreManaher.cs

示例8: Start

    // Use this for initialization
    IEnumerator Start()
    {
        // Create a form object for sending high score data to the server
        WWWForm form = new WWWForm();

        //Retrieves the Leo number from the use to submit to the url
        form.AddField ("ctl00$Copy$leonumber", leoDiamondNumber);

        // Create a download object
        WWW download = new WWW( traceLeo_url, form );

        // Wait until the download is done
        yield return download;

        if(!string.IsNullOrEmpty(download.error)) {
            print( "Error downloading: " + download.error );
        } else {
            // show the data
            Debug.Log(download.text);

            if(download.text.Contains("ctl00_Copy_rolLink")){
                Debug.Log("LEO DIAMOND TRACED!!!");
            }else{
                Debug.Log("Nope. Sorry.");
            }
        }
    }
开发者ID:shawmakesmusic,项目名称:leo,代码行数:28,代码来源:WWWFormScore.cs

示例9: sendData

    IEnumerator sendData()
    {
        Debug.Log("signUp button pressed");

        WWWForm signUpForm = new WWWForm();

        Debug.Log("Entered email text: " + emailField.text);
        signUpForm.AddField("UserEmail", emailField.text);

        Debug.Log("Entered password text: " + passwordField.text);
        signUpForm.AddField("UserPassword", passwordField.text);

        WWW php = new WWW(url, signUpForm);

        yield return php; //we wait for the form to check the PHP file, so our game dont just hang

        if (php.error != null) {
            print(php.error); //if there is an error, tell us
        } else {
            print("Test ok");
            formText = php.text; //here we return the data our PHP told us
            php.Dispose(); //clear our form in game

            print(formText);
        }
    }
开发者ID:CovalentGaming,项目名称:Super-Dash,代码行数:26,代码来源:PhPConnection.cs

示例10: LoginCoroutine

    IEnumerator LoginCoroutine(string username, string password)
    {
        WWWForm loginForm = new WWWForm ();
        loginForm.AddField ("myform_username", username);
        loginForm.AddField ("myform_password", password);
        loginForm.AddField ("myform_hash", server.SecretKey);

        WWW www = new WWW (server.Url + "/php/Login.php", loginForm);
        yield return www;

        if (www.error != null) {
            response.text = "Error communicating with server: " + www.error;
        } else {
            string wwwOutput = www.text;
            if (wwwOutput == "PASSWORD CORRECT") {

                server.Login (username, password);

                response.text = wwwOutput;
                yield return new WaitForSeconds(0.5f);
                FindObjectOfType<LevelManager> ().LoadLevel ("Initialising");

            } else {
                response.text = wwwOutput;
            }

        }
    }
开发者ID:ocoulson,项目名称:MScProjectUnity,代码行数:28,代码来源:Login.cs

示例11: DBCallOffline

	// it looks like most of the classes using the DatabaseManager have callbacks that only use the string 'data' to process, so we could cache these strings
	// based on the parameter set passed in, like 'LoadCases','Owner', or 'LoadCase', 'caseName', and the string containing the data we want to use for offline session

	public void DBCallOffline(string URL, WWWForm form, DatabaseMgr.Callback callback){

		// if we can find a match in our list of cached responses, send it back
		// first, find the arguments
		string strFormData = Encoding.UTF8.GetString(form.data, 0, form.data.Length);  //"command=cmd&param=paramvalue"

		string[] fields = strFormData.Split ('&');
		string command = "";
		string param1 = "";
		string[] pair;
		if (fields [0].Contains ("=")) {
			pair = fields [0].Split ('=');
			command = pair [1];
			if (fields.Length > 1 && fields[1].Contains("=")){
				pair = fields [1].Split ('=');
				param1 = pair [1].Replace("+"," ");

			}
		}
		string data = "";
		foreach (CachedDBResult result in OfflineDBResults) {
			if (result.command == command && result.param1 == param1){
				data = result.data;
				break;
			}
		}

		// don't use coroutine here because the timescale might be 0 and
		// then we will never return...		
		//StartCoroutine(CallbackAfterDelay(callback,data)); 

		// do callback
		if ( callback != null )
			callback(true,data,"",null);
	}
开发者ID:MedStarSiTEL,项目名称:UnityTrauma,代码行数:38,代码来源:TraumaOfflineAssetContainer.cs

示例12: NameCheckRequest

 public void NameCheckRequest(string playername, int checkNumber)
 {
     WWWForm nameform = new WWWForm();
     nameform.AddField("name", playername);
     WWW www1 = new WWW(namecheckurl, nameform);
     StartCoroutine(WaitForNameCheck(www1,checkNumber,playername));
 }
开发者ID:hansbickhofe,项目名称:retrovoke,代码行数:7,代码来源:LoginMenu.cs

示例13: GetCharaList

    public IEnumerator GetCharaList()
    {
        Debug.Log ("GetCharaList");

        string url = ConfURL.HOST_NAME+ConfURL.PLAYER_LIST;
        WWWForm form = new WWWForm ();

        form.AddField ("UUID", _uuid);

        WWW www = new WWW(url, form);
        yield return www;

        Debug.Log (www);

        if (www.error != null) {
            Debug.Log("Error");
        } else {
            Debug.Log("Success");
            var charaAPI = MiniJSON.Json.Deserialize (www.text) as Dictionary<string,object>;

            foreach(KeyValuePair<string, object> data in charaAPI) {
                Debug.Log(data.Key);
                Debug.Log(data.Value);
            }

        }
    }
开发者ID:syo-sa1982,项目名称:SearcherClient,代码行数:27,代码来源:CharaSelect.cs

示例14: SendScore

    private IEnumerator SendScore()
    {
        if (!button.IsInteractable())
            yield break;
        WWWForm form = new WWWForm();
        System.Collections.Generic.Dictionary<string,string> headers = form.headers;
        Hashtable rawData = new Hashtable();
        rawData ["name"] = GameObject.FindGameObjectWithTag("EmailInput").GetComponent<InputField>().text;
        rawData ["score"] = Player.score;
        rawData ["device"] = SystemInfo.deviceModel;
        rawData ["duration"] = Time.timeSinceLevelLoad.ToString ();
        string json = "{\"score\":\""+rawData["score"]+"\","+
            " \"duration\":\""+rawData["duration"]+"\","+
                " \"name\":\""+rawData["name"]+"\","+
                " \"device\":\""+rawData["device"]+"\" }";
        byte[] bytes = Encoding.UTF8.GetBytes(json);

        headers["Content-Type"] = "application/json";
        headers["X-Parse-Application-Id"] = "AgbCv2IdOihHPcIuvH3PItFACXiwNG0pDfVuuvnD";
        headers["X-Parse-REST-API-Key"] = "9YPTNj3LuPArgOUImPhUQKi5jqkhSfLKb3IvMnfd";
        headers["X-Parse-Master-Key"] = "ycsMy49UqD1T5IbmhffM1uuNuKXBcfIL2g314I0q";

        WWW postRequest = new WWW( scorePostUrl, bytes, headers );
        yield return postRequest;
        if (!string.IsNullOrEmpty(postRequest.error)) {
            Debug.Log(postRequest.error);
        }
        else {
            Debug.Log("Finished Uploading Scores");
            Initiate.Fade(restartScene, null, 0.95f);
        }
    }
开发者ID:agusfagus,项目名称:Frutitas,代码行数:32,代码来源:ScoreSender.cs

示例15: RegisterWithAccount

    public void RegisterWithAccount()
    {
        string email = txtEmail.text;
        string password = txtPassword.text;
        string confirm = txtConfirm.text;
        if (email.Length == 0 || password.Length == 0 || confirm.Length == 0) {
            Debug.LogError("Khong duoc de trong!");
            return;
        }

        if (!password.Equals (confirm)) {
            Debug.LogError("Mat khau khong trung khop!");
            return;
        }

        if (!toggleAgree.isOn) {
            Debug.LogError ("Chua dong y dieu khoan");
            return;
        }

        int iRand = Random.Range (0, 27);
        string avatar = @"/assets/images/avatar/" + (iRand < 10 ? "00" + iRand : "0" + iRand) + ".png";

        WWWForm formReg = new WWWForm();
        formReg.AddField("name", email);
        formReg.AddField("email", email);
        formReg.AddField("password", password);
        formReg.AddField ("avatar", avatar);
        WWW regHTTP = new WWW(Constants.URLREG, formReg);
        StartCoroutine(WaitForRegRequest(regHTTP));
    }
开发者ID:sonth3vn,项目名称:DFTChess,代码行数:31,代码来源:RegisterController.cs


注:本文中的WWWForm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。