• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# WWWForm类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: LogCallback

    private static void LogCallback(string message, string trace, LogType type)
    {
        if (System.Array.IndexOf(logTypes, type) != -1) {
            string supportData = null;
            try {
                if (collectSupportData != null) {
                    supportData = collectSupportData();
                }
            }
            catch {
            }
            try {
                var form = new WWWForm();
                form.AddField("application", SafeString(appName));
                form.AddField("version", SafeString(version));
                form.AddField("userData", SafeString(userData));
                form.AddField("supportData", SafeString(supportData));
                form.AddField("userId", SafeString(userId));
                form.AddField("message", SafeString(message));
                form.AddField("trace", SafeString(trace));

                new WWW(uri, form.data);
            }
            catch {
            }
        }
    }
开发者ID:duke1102,项目名称:unity-plus,代码行数:27,代码来源:ErrorReporter.cs


示例17: LoadFromPHP

 IEnumerator LoadFromPHP()
 {
     WWWForm form = new WWWForm();
     form.AddField("Service", "Load");
     form.AddField("User", "teste");
     WWW w = new WWW(url, form);
     yield return w;
     Debug.Log(w.text);
     if (w.text == "error") {
         //USUARIO NAO EXISTE
         Debug.Log ("NAO ECZISTE!");
     } else
     {
         string[] datas = w.text.Split(';');
         foreach(string data in datas)
         {
             string[] info = data.Split('=');
             switch(info[0])
             {
                 case "XP":
                     XP = int.Parse(info[1]);
                     break;
                 case "Nivel":
                     Nivel = int.Parse(info[1]);
                     break;
                 case "Lvl_Max":
                     Lvl_Max = int.Parse(info[1]);
                     break;
             }
         }
     }
 }
开发者ID:danielkropf,项目名称:The-RPG,代码行数:32,代码来源:SavePHP.cs


示例18: ScreenshotHappy

    public IEnumerator ScreenshotHappy(int playerCount)
    {
        //Miro dove stanno i giocatori (trucco: con 0 fa tutto lo schermo
        Vector2 imageFrom = playerCount <=1 ? new Vector2(0, 0) : new Vector2(Screen.width / 2, Screen.height / 2);
        Vector2 imageTo = playerCount == 1 ? new Vector2(Screen.width / 2, Screen.height / 2) : new Vector2(Screen.width, Screen.height);
        
        byte[] temp = GetScreenshot(CaptureMethod.RenderToTex_Synch, imageFrom, imageTo).EncodeToJPG();
        byte[] report = new byte[temp.Length];
        for (int i = 0; i < report.Length; i++)
        {
            report[i] = (byte)temp[i];
        } // for
        // create a form to send the data to the sever
        WWWForm form = new WWWForm();
        // add the necessary data to the form
        form.AddBinaryData("upload_file", report, "spinder.jpg", "image/jpeg"); ;
        // send the data via web
        WWW www2 = new WWW("http://risingpixel.azurewebsites.net/other/apps/spinder/upload.php", form);
        // wait for the post completition
        while (!www2.isDone)
        {
            Debug.Log("I'm waiting... " + www2.uploadProgress);
            yield return new WaitForEndOfFrame();
        } // while
        // print the server answer on the debug log
        Debug.Log(www2.text);
        // destroy the www
        www2.Dispose();

        yield return null;
        taking = false;

        yield return new WaitForSeconds(.2f);
    }
开发者ID:Gounemond,项目名称:GGJ2016,代码行数:34,代码来源:TakeAScreenshot.cs


示例19: SavePosi

    public void SavePosi()
    {
        {
            //when the button is clicked        
            //setup url to the ASP.NET webpage that is going to be called
            string customUrl = url + "SameGame/Create";

            //setup a form
            WWWForm form = new WWWForm();

            //Setup the paramaters

            //Save the perks position
            string x = transform.position.x.ToString("0.00");
            string y = transform.position.y.ToString("0.00");
            string z = transform.position.z.ToString("0.00");

            string rx = transform.rotation.x.ToString("0.00");
            string ry = transform.rotation.y.ToString("0.00");
            string rz = transform.rotation.z.ToString("0.00");

            form.AddField("PerksName", transform.name);
            form.AddField("PerkPosition", x + "," + y + "," + z);
            form.AddField("PerkRotation", rx + "," + ry + "," + rz);
            form.AddField("Username", username + "");



            //Call the server
            WWW www = new WWW(customUrl, form);
            StartCoroutine(WaitForRequest(www));
        }
    }
开发者ID:SoulfulSolutions,项目名称:The_Last_Ranger,代码行数:33,代码来源:SavePerksPos.cs


示例20: Start

 // Use this for initialization
 void Start()
 {
     WWWForm form = new WWWForm ();
     form.AddField("UID",1);
     data = new WWW ("http://128.199.83.67/APPgame/backside/php/getleveldata.php", form);
     StartCoroutine (get_data_from_mysql (data));
 }
开发者ID:lagane100,项目名称:APPgame,代码行数:8,代码来源:get_data.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WaitCallback类代码示例发布时间:2022-05-24
下一篇:
C# WWW类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap