當前位置: 首頁>>代碼示例>>C#>>正文


C# API.Post方法代碼示例

本文整理匯總了C#中API.Post方法的典型用法代碼示例。如果您正苦於以下問題:C# API.Post方法的具體用法?C# API.Post怎麽用?C# API.Post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在API的用法示例。


在下文中一共展示了API.Post方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: sendAnswer

	void sendAnswer() {
		API request = new API();
		request.Post ("/game/" + PlayerPrefs.GetString ("gameId") + "/answer/" + PlayerPrefs.GetString ("questionId"), responseReady);
		request.AddField ("token", PlayerPrefs.GetString ("token"));
		request.AddField ("answer", answerText.text);
		request.AddField ("correct", correctAnswer.ToString());
		request.AddField ("position", answer.ToString());
		request.Send ();
	}
開發者ID:mengtest,項目名稱:movieschallenge_client,代碼行數:9,代碼來源:AnswerScript.cs

示例2: createGameRandom

	public void createGameRandom () {
		// send analytics
		GameAnalytics.NewDesignEvent ("ui:game:random");
		// disable buttons
		_dispatcher.Dispatch ("disable_new_game_button");
		// call the API
		API request = new API ();
		request.Post ("/game/random", processResponse);
		request.AddField ("token", PlayerPrefs.GetString("token"));
		request.Send ();
	}
開發者ID:mengtest,項目名稱:movieschallenge_client,代碼行數:11,代碼來源:CreateGame.cs

示例3: sendEndGame

	void sendEndGame(bool finished) {
		// send status of game to the server
		string uri = (finished) ? "/game/" + PlayerPrefs.GetString ("gameId") + "/finalRoundSuccess" : "/game/" + PlayerPrefs.GetString ("gameId") + "/finalRoundFailed";
		API request = new API();
		request.Post (uri, processGameEnd);
		request.AddField ("token", PlayerPrefs.GetString ("token"));
		request.Send ();
		// send analytics
		if (finished) {
			GameAnalytics.NewProgressionEvent(GA_Progression.GAProgressionStatus.GAProgressionStatusComplete, "match");
		}
	}
開發者ID:mengtest,項目名稱:movieschallenge_client,代碼行數:12,代碼來源:FinalRoundLogicScript.cs

示例4: doAuthentication

	void doAuthentication(string username, string password) {
		GameAnalytics.NewDesignEvent ("ui:user:login");
		if (!string.IsNullOrEmpty (username)
		    && !string.IsNullOrEmpty (password)) {
			API req = new API ();
			req.Post ("/authenticate", onAuthenticationFinished);
			req.AddField ("username", username);
			req.AddField ("password", password);
			req.interstitialLoading = true;
			req.Send ();
		}
	}
開發者ID:mengtest,項目名稱:movieschallenge_client,代碼行數:12,代碼來源:Authenticate.cs

示例5: createUser

	public void createUser(string username, string password, string email) {
		GameAnalytics.NewDesignEvent ("ui:user:login");
		if (!string.IsNullOrEmpty (username)
			&& !string.IsNullOrEmpty (password)
			&& !string.IsNullOrEmpty (email)) {
			API req = new API ();
			req.Post ("/user", onAuthenticationFinished);
			req.AddField ("username", username);
			req.AddField ("password", password);
			req.AddField ("email", email);
			req.interstitialLoading = true;
			req.Send ();
		}
	}
開發者ID:mengtest,項目名稱:movieschallenge_client,代碼行數:14,代碼來源:Authenticate.cs

示例6: createGame

	// create a new game
	public void createGame(string opponentUsername) {
		if (!string.IsNullOrEmpty (opponentUsername)) {
			// disable buttons
			_dispatcher.Dispatch ("disable_new_game_button");
			// create the game
			string challenger = PlayerPrefs.GetString("username");
			string challenged = opponentUsername;
			// call the API
			API request = new API ();
			request.Post ("/game", processResponse);
			request.AddField ("challenger", challenger);
			request.AddField ("challenged", challenged);
			request.AddField ("token", PlayerPrefs.GetString("token"));
			request.Send ();
		}
	}
開發者ID:mengtest,項目名稱:movieschallenge_client,代碼行數:17,代碼來源:CreateGame.cs

示例7: sendQuestion

	public void sendQuestion() {
		API request = new API ();
		request.Post ("/question", processResponse);
		request.AddField ("token", PlayerPrefs.GetString("token"));
		request.AddField ("quote", _quote.text);
		request.AddField ("category", _category.text);
		request.AddField ("difficulty", _difficulty);
		request.AddField ("correctAnswer", _correctAnswer.text);
		request.AddField ("otherAnswers", JsonMapper.ToJson(new string[] {
			_wrongAnswer1.text,
			_wrongAnswer2.text,
			_wrongAnswer3.text,
			_wrongAnswer4.text,
			_wrongAnswer5.text
		}));
		request.Send ();
	}
開發者ID:mengtest,項目名稱:movieschallenge_client,代碼行數:17,代碼來源:ContributeSendScript.cs


注:本文中的API.Post方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。