当前位置: 首页>>代码示例>>C#>>正文


C# Communicator.SendPayload方法代码示例

本文整理汇总了C#中Communicator.SendPayload方法的典型用法代码示例。如果您正苦于以下问题:C# Communicator.SendPayload方法的具体用法?C# Communicator.SendPayload怎么用?C# Communicator.SendPayload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Communicator的用法示例。


在下文中一共展示了Communicator.SendPayload方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetAssets

 public void GetAssets(Action<Response<IList<Asset>>> callback)
 {
     var payload = new Dictionary<string, object> {{"key", Key}};
      var communicator = new Communicator(this);
      communicator.SendPayload<IList<Asset>>(Communicator.Get, "assets", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<IList<Asset>> (r.Raw); }
     if (callback != null) { callback(r); }
      });
 }
开发者ID:n1ckd0r,项目名称:mogade-csharp,代码行数:10,代码来源:Driver.cs

示例2: GetGameConfiguration

 public void GetGameConfiguration(Action<Response<GameConfiguration>> callback)
 {
     var payload = new Dictionary<string, object>(0);
      var communicator = new Communicator(this);
      communicator.SendPayload<GameConfiguration>(Communicator.POST, "conf", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<GameConfiguration>(r.Raw); }
     callback(r);
      });
 }
开发者ID:intfrr,项目名称:mogade-csharp,代码行数:10,代码来源:Driver.cs

示例3: AchievementEarned

 public void AchievementEarned(string achievementId, string userName, string uniqueIdentifier, Action<Response<Achievement>> callback)
 {
     var payload = new Dictionary<string, object> { { "aid", achievementId }, { "username", userName }, { "userkey", uniqueIdentifier } };
      var communicator = new Communicator(this);
      communicator.SendPayload<Achievement>(Communicator.Post, "achievements", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<Achievement>(r.Raw); }
     if (callback != null) { callback(r); }
      });
 }
开发者ID:n1ckd0r,项目名称:mogade-csharp,代码行数:10,代码来源:Driver.cs

示例4: LogAsync

 public void LogAsync(string message, Action<LogResponse> callback)
 {
     var communicator = new Communicator(this);
     var callbackWrapper = callback == null ? (Action<Response>) null : r =>
     {
     if (r.Success)
     {
         callback(JsonConvert.DeserializeObject<LogResponse>(r.Raw));
     }
     };
     communicator.SendPayload(Communicator.POST, string.Concat("inputs/", _inputKey), message, callbackWrapper);
 }
开发者ID:EAAppFoundry,项目名称:loggly-csharp,代码行数:12,代码来源:Logger.cs

示例5: GetGameVersion

 public void GetGameVersion(Action<Response<int>> callback)
 {
     var payload = new Dictionary<string, object>(0);
      var communicator = new Communicator(this);
      communicator.SendPayload<int>(Communicator.POST, "conf/version", payload, r =>
      {
     if (r.Success)
     {
        var container = ((JContainer) JsonConvert.DeserializeObject(r.Raw))["version"];
        r.Data = container == null ? 0 : container.Value<int>();
     }
     callback(r);
      });
 }
开发者ID:intfrr,项目名称:mogade-csharp,代码行数:14,代码来源:Driver.cs

示例6: LogAsync

        public void LogAsync(string message, Action<LogResponse> callback)
        {
            var communicator = new Communicator(this);
            var callbackWrapper = callback == null ? (Action<Response>)null : r =>
            {
                if (r.Success)
                {
                    var js = new JavaScriptSerializer();
                    callback(js.Deserialize<LogResponse>(r.Raw));
                }
            };

            try{
                communicator.SendPayload(Communicator.POST, string.Format(Routes.Log, _inputKey), message, callbackWrapper);
            }catch(Exception ex)
            {
                // yes I know it's bad)
            }
        }
开发者ID:rakyury,项目名称:logphoria,代码行数:19,代码来源:Logger.cs

示例7: GetYesterdaysLeaders

 public void GetYesterdaysLeaders(string leaderboardId, Action<Response<LeaderboardScores>> callback)
 {
     ValidationHelper.AssertValidId(leaderboardId, "leaderboardId");
      var payload = new Dictionary<string, object> { { "leaderboard_id", leaderboardId } };
      var communicator = new Communicator(this);
      communicator.SendPayload<LeaderboardScores>(Communicator.POST, "scores/yesterdays_leaders", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<LeaderboardScores>(r.Raw); }
     callback(r);
      });
 }
开发者ID:intfrr,项目名称:mogade-csharp,代码行数:11,代码来源:Driver.cs

示例8: GetUserSettings

 public void GetUserSettings(string userName, string uniqueIdentifier, Action<Response<UserSettings>> callback)
 {
     ValidationHelper.AssertNotNullOrEmpty(userName, 20, "username");
      ValidationHelper.AssertNotNullOrEmpty(uniqueIdentifier, 50, "unique identifier");
      var payload = new Dictionary<string, object> { { "username", userName }, { "unique", uniqueIdentifier } };
      var communicator = new Communicator(this);
      communicator.SendPayload<UserSettings>(Communicator.POST, "conf/my", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<UserSettings>(r.Raw); }
     callback(r);
      });
 }
开发者ID:intfrr,项目名称:mogade-csharp,代码行数:12,代码来源:Driver.cs

示例9: Log

 public void Log(string message, bool json, Action<LogResponse> callback)
 {
     var communicator = new Communicator(this);
      var callbackWrapper = callback == null ? (Action<Response>) null : r =>
      {
     if (r.Success)
     {
        var res = JsonConvert.DeserializeObject<LogResponse>(r.Raw);
        res.Success = true;
        callback(res);
     }
     else
     {
        var res = new LogResponse{ Success = false };
        callback(res);
     }
      };
      communicator.SendPayload(Communicator.POST, string.Concat("inputs/", _inputKey), message, json, callbackWrapper);
 }
开发者ID:jasmeetsangari,项目名称:loggly-csharp,代码行数:19,代码来源:Logger.cs

示例10: GetRank

 public void GetRank(string leaderboardId, int score, LeaderboardScope scope, Action<Response<int>> callback)
 {
     var payload = new Dictionary<string, object> { { "lid", leaderboardId }, { "score", score }, { "scopes", (int)scope } };
      var communicator = new Communicator(this);
      communicator.SendPayload<int>(Communicator.Get, "ranks", payload, r =>
      {
     if (r.Success)
     {
        r.Data = JsonConvert.DeserializeObject<int>(r.Raw);
     }
     callback(r);
      });
 }
开发者ID:n1ckd0r,项目名称:mogade-csharp,代码行数:13,代码来源:Driver.cs

示例11: GetRanks

 public void GetRanks(string leaderboardId, int score, LeaderboardScope[] scopes, Action<Response<Ranks>> callback)
 {
     var realScopes = new int[scopes.Length];
      for (var i = 0; i < scopes.Length; ++i)
      {
     realScopes[i] = (int)scopes[i];
      }
      var payload = new Dictionary<string, object> { { "lid", leaderboardId },  { "score", score }, { "scopes", realScopes } };
      var communicator = new Communicator(this);
      communicator.SendPayload<Ranks>(Communicator.Get, "ranks", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<Ranks>(r.Raw); }
     callback(r);
      });
 }
开发者ID:n1ckd0r,项目名称:mogade-csharp,代码行数:15,代码来源:Driver.cs

示例12: LogApplicationStart

 public void LogApplicationStart(string uniqueIdentifier)
 {
     var payload = new Dictionary<string, object> { { "unique", uniqueIdentifier }};
      var communicator = new Communicator(this);
      communicator.SendPayload<object>(Communicator.PUT, "analytics/start", payload, null);
 }
开发者ID:intfrr,项目名称:mogade-csharp,代码行数:6,代码来源:Driver.cs

示例13: LogApplicationStart

 public void LogApplicationStart(string uniqueIdentifier, Action<Response> callback)
 {
     var payload = new Dictionary<string, object> { { "userkey", uniqueIdentifier } };
      var communicator = new Communicator(this);
      communicator.SendPayload<object>(Communicator.Post, "stats", payload, r =>
      {
     if (callback != null) { callback(r); }
      });
 }
开发者ID:n1ckd0r,项目名称:mogade-csharp,代码行数:9,代码来源:Driver.cs

示例14: SaveScore

 public void SaveScore(string leaderboardId, Score score, string uniqueIdentifier, Action<Response<SavedScore>> callback)
 {
     var payload = new Dictionary<string, object> {{"lid", leaderboardId}, {"username", score.UserName}, {"userkey", uniqueIdentifier}, {"points", score.Points}, {"data", score.Data}};
      var communicator = new Communicator(this);
      communicator.SendPayload<SavedScore>(Communicator.Post, "scores", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<SavedScore>(r.Raw); }
     if (callback != null) { callback(r); }
      });
 }
开发者ID:n1ckd0r,项目名称:mogade-csharp,代码行数:10,代码来源:Driver.cs

示例15: GetLeaderboard

 private void GetLeaderboard(IDictionary<string, object> payload, Action<Response<LeaderboardScores>> callback)
 {
     var communicator = new Communicator(this);
      communicator.SendPayload<LeaderboardScores>(Communicator.Get, "scores", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<LeaderboardScores>(r.Raw); }
     callback(r);
      });
 }
开发者ID:n1ckd0r,项目名称:mogade-csharp,代码行数:9,代码来源:Driver.cs


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