本文整理匯總了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 ();
}
示例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 ();
}
示例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");
}
}
示例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 ();
}
}
示例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 ();
}
}
示例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 ();
}
}
示例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 ();
}