本文整理汇总了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 ();
}