本文整理汇总了C#中WWWForm.AddField方法的典型用法代码示例。如果您正苦于以下问题:C# WWWForm.AddField方法的具体用法?C# WWWForm.AddField怎么用?C# WWWForm.AddField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WWWForm
的用法示例。
在下文中一共展示了WWWForm.AddField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadInfo
void loadInfo()
{
WelcomePanel.SetActive(true);
LoginPanel.SetActive(false);
RegisterPanel.SetActive(false);
MainPanel.SetActive(false);
Loading.SetActive(true);
var form = new WWWForm(); //here you create a new form connection
form.AddField("token", PlayerPrefs.GetString("sid"));
form.AddField("appid", APPID);
form.AddField("sign", md5(PlayerPrefs.GetString("sid") + APPSERECT));
//send
ObservableWWW.Post("http://tapp.vn/charge/code/authen_mini.html", form).TakeUntilDestroy(this).Subscribe(
x => {
Debug.Log(x);
JSONObject obj = new JSONObject(x);
UName.text = obj["data"]["username"].str;
FloatingButton.SetActive(true);
Loading.SetActive(false);
//GameController.GetComponent<Done_GameController>().enabled = true;
gameObject.SetActive(false);
}, // onSuccess
ex =>
{
MobileNativeMessage msg = new MobileNativeMessage("TAPP.vn", "Có lỗi xảy ra");
}// onError
);
}
示例2: CreatePlantType
public IEnumerator CreatePlantType()
{
WWWForm form = new WWWForm ();
form.AddField ("common_name", commonName);
form.AddField ("latin_name", latinName);
//form.AddField ("plant_size", "short-leafy");
//form.AddField ("model", "http://" + DataManager.dataManager.ipAddress + "/plantModel/1/");
print (DataManager.dataManager.ipAddress);
string url = DataManager.dataManager.ipAddress + ptSuffix;//plantTypeURL;//string.Concat (plantTypeURL, "/");
Debug.Log(url);
object[] parms = new object[2] { url, form };
yield return DataManager.dataManager.StartCoroutine("PostRequest", parms);
/*
WWW www = new WWW (url, form);
yield return www;
if (!string.IsNullOrEmpty (www.error))
{
print (www.error);
print (www.text);
}
*/
addPlantModule.gameObject.SetActive (true);
addPlantModule.StartCoroutine ("GetPlantTypes");
EndModule ();
yield return null;
}
示例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);
}
}
示例4: 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));
}
}
示例5: Prepare
public static WWW Prepare(string section, string action, Dictionary<string,object> postdata = null)
{
if(postdata == null)
{
postdata = new Dictionary<string,object>();
}
else
{
postdata.Remove ("publickey");
postdata.Remove ("section");
postdata.Remove ("action");
}
postdata.Add ("publickey", PUBLICKEY);
postdata.Add ("section", section);
postdata.Add ("action", action);
var json = PJSON.JsonEncode(postdata);
var post = new WWWForm();
post.AddField("data", PEncode.Base64(json));
post.AddField("hash", PEncode.MD5 (json + PRIVATEKEY));
return new WWW(APIURL, post);
}
示例6: LoginAccess
private IEnumerator LoginAccess()
{
WWWForm form = new WWWForm ();
form.AddField ("name", loginManager.GetPlayerName());
form.AddField ("room_no", loginManager.GetRoomNo());
WWW download = new WWW ("http://" + loginManager.GetURL() + "/users/login", form);
yield return download;
if (download.error == null) {
Debug.Log (download.text);
loginManager.ShowSuccess();
loginSuccess = true;
loginManager.ShowWaiting();
// cast
var json = Json.Deserialize(download.text) as Dictionary<string, object>;
// keep status
userManager.user_id = (long)json["user_id"];
userManager.play_id = (long)json["play_id"];
userManager.state = (string)json["state"];
userManager.role = (string)json["role"];
} else {
Debug.Log ("Error");
loginManager.ShowError();
}
}
示例7: 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;
}
}
}
}
示例8: sendSkillSetApi
IEnumerator sendSkillSetApi()
{
string _uuid;
if (PlayerPrefs.HasKey ("uuid")) {
_uuid = PlayerPrefs.GetString ("uuid");
} else {
yield break;
}
string url = ConfURL.HOST_NAME+ConfURL.PLAYER_SKILL_SUBMIT;
WWWForm form = new WWWForm ();
form.AddField ("UUID", _uuid);
var skillList = ListObject.GetComponentsInChildren(typeof(SkillFieldController));
List<Skill> skillApi = new List<Skill>();
foreach(SkillFieldController skill in skillList){
skillApi.Add(skill.SkillData);
Debug.Log( skill.SkillData.SkillName);
}
form.AddField ("json_api", LitJson.JsonMapper.ToJson(skillApi));
form.AddField ("player_id", playerStatus.ID);
WWW www = new WWW(url, form);
yield return www;
SceneManager.LoadScene ("Home");
}
示例9: Start
// Use this for initialization
IEnumerator Start()
{
//create webform to send to server
WWWForm form = new WWWForm();
//add name and score
form.AddField("user", player);
form.AddField("score", score);
//encrypt
form.AddField("hash", Md5Sum(player + score + "TheSecretWord"));
//connect and send
WWW send = new WWW(url, form);
//wait until complete
yield return send;
if (!string.IsNullOrEmpty(send.error))
{
Debug.Log("highscore error " + send.error);
}
else
{
Debug.Log(send.text);
}
}
示例10: PostData
IEnumerator PostData()
{
Debug.Log("in get data");
string url = "192.168.33.11:3000/users/login";
WWWForm form = new WWWForm();
form.AddField("name", strId);
form.AddField("room_no", strRo);
WWW www = new WWW(url, form);
yield return www;
if (www.error == null) {
Debug.Log(www.text);
var textAsset =www;
var jsonText = textAsset.text;
var json = Json.Deserialize (jsonText) as Dictionary<string, object>;
user_id= (long)json["user_id"];
Debug.Log (user_id);
play_id= (long)json["play_id"];
Debug.Log (play_id);
state= (string)json["state"];
Debug.Log (state);
role= (string)json["role"];
Debug.Log (role);
}
}
示例11: CreateAccountInternal
private IEnumerator CreateAccountInternal (string username, string password, string email, UnityAction<bool> callback)
{
if (settings == null) {
yield break;
}
WWWForm newForm = new WWWForm ();
newForm.AddField ("name", username);
newForm.AddField ("password", password);
newForm.AddField ("email", email);
WWW w = new WWW(settings.serverAddress + "/" + settings.createAccount, newForm);
while (!w.isDone) {
yield return new WaitForEndOfFrame();
}
if (w.error != null) {
Debug.LogError (w.error);
}
bool res = w.text.Trim ().Equals("true");
if (callback != null) {
callback.Invoke (res);
}
AccountEventData eventData = new AccountEventData ();
eventData.serverAdress = settings.serverAddress;
User user = new User (username);
user.password = password;
eventData.user = user;
eventData.result = res;
Execute("OnCreateAccount",eventData);
}
示例12: MhSend2
public IEnumerator MhSend2(string msg)
{
if (mh) yield break;
if (msg != null)
{
if (isDebug)
print(msg);
mh = true;
msg += " player:" + _Loader.playerName + " password:" + _Loader.password + " deviceId:" + SystemInfo.deviceUniqueIdentifier + " version:" + setting.version;
}
WWWForm f = new WWWForm();
if (msg != null)
f.AddField("msg", Convert.ToBase64String(Encoding.UTF8.GetBytes(msg)));
f.AddField("id", SystemInfo.deviceUniqueIdentifier);
f.AddField("version", setting.version);
if(!guest)
f.AddField("name", _Loader.playerName);
//for (int i = 0; i < 10; i++)
//{
var w = new WWW("https://tmrace.net/tm/scripts/stats2.php", f);
print(w.url + Encoding.UTF8.GetString(f.data));
yield return w;
//Debug.LogWarning(w.url + w.text);
if (string.IsNullOrEmpty(w.error))
{
if (w.text.StartsWith("1"))
mh = true;
//break;
}
//yield return new WaitForSeconds(60);
//}
}
示例13: SaveGameState
public void SaveGameState()
{
string url = "http://rangerdata.azurewebsites.net/";
//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
//creates a random user
form.AddField("GameName","Not Saved");
form.AddField("GameScore"," ");
form.AddField("GameWaveNo"," ");
form.AddField("username","LastRanger0");
//Call the server
WWW www = new WWW(customUrl, form);
StartCoroutine( WaitForRequest(www));
savepp.SavePosi ();
// saveEp.SavePosi();
savePerkPos.SavePosi();
}
示例14: checkDetails
IEnumerator checkDetails()
{
var form = new WWWForm();
form.AddField("benutzername",GameObject.FindGameObjectWithTag("Username").GetComponent<InputField>().text);
form.AddField("passwort", md5Sum(GameObject.FindGameObjectWithTag("Password").GetComponent<InputField>().text+"$K?1/[email protected]%e#el!3>s#5BRo$a1+"));
var connection = new WWW("http://www.1000sunny.de/games/eulmur/login.php", form);
yield return connection;
if (connection.error != null)
Debug.Log("ouldn't connect to the server: " + connection.error);
else if (connection.text.Equals("\n1"))
{
var getMoney = new WWW("http://www.1000sunny.de/games/eulmur/getmoney.php", form);
yield return getMoney;
var getLives = new WWW("http://www.1000sunny.de/games/eulmur/getlives.php", form);
yield return getLives;
var getClothes = new WWW("http://www.1000sunny.de/games/eulmur/getclothes.php", form);
yield return getClothes;
if (getMoney.error != null && getClothes.error != null && getLives.error != null)
Debug.Log("Couldn't connect to the server: " + connection.error);
else {
PlayerData.LoadData(GameObject.FindGameObjectWithTag("Username").GetComponent<InputField>().text,getMoney.text,getLives.text,getClothes.text);
SceneManager.LoadScene(2);
}
}
else
Debug.Log("falsches pw" + connection.text);
}
示例15: 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);
}
}