コード例 #1
0
        public static bool UploadBattleResult(BattleResult result)
        {
            string request = "add_battle_result2";
            //Dictionary<string, object> dic = new Dictionary<string, object>();
            JObject dic = new JObject();

            dic.Add("user_id", result.user_id);
            dic.Add("tank", result.tank);
            dic.Add("modes", result.mode);
            dic.Add("victory", result.victory);
            dic.Add("honor", result.honor);
            dic.Add("shoot", result.shoot);
            dic.Add("hits", result.hits);
            dic.Add("penertration", result.penertration);
            dic.Add("damage_caused", result.damage_caused);
            dic.Add("hits_received", result.hits_received);
            dic.Add("damage_received", result.damage_received);
            dic.Add("enermy_detected", result.enermy_detected);

            string param = "param=" + dic.ToString();

            //Console.WriteLine(param);
            for (int i = 1; i <= mMaxRetryTimes; i++)
            {
                string response = HttpConnect.HttpPostSafe(mBaseURL + request, param);
                if (response != "")
                {
                    Log.AddLog("上传战斗结果成功。");
                    return(true);
                }
                Log.Record("上传战斗结果异常,正在重试第" + i.ToString() + "次");
            }
            Log.Record("上传战斗结果失败,重试了" + mMaxRetryTimes.ToString() + "次仍然失败,已丢弃数据");
            return(false);
        }
コード例 #2
0
        public static bool BattleEnd(string uid)
        {
            JObject param = new JObject();

            param.Add("id", uid);
            string response = HttpConnect.HttpPostSafe(mBaseURL + "mBattleEnd", "param=" + param.ToString());

            if (response == "")
            {
                return(false);
            }
            param = JObject.Parse(response);
            return((bool)param.GetValue("result"));
        }
コード例 #3
0
 public void uploadDamage()
 {
     if (this.damages.Count > 0)
     {
         string param = "param=" + this.getJSON();
         for (int i = 0; i < this.mMaxRetryTimes; i++)
         {
             try
             {
                 string result = HttpConnect.HttpPost(HttpConnect.mBaseURL + "add_damage", param);
                 Log.AddLog("上传" + this.damages.Count.ToString() + "条数据," + (this.damages.Count - int.Parse(result)).ToString() + "条失败");
                 break;
             }
             catch (Exception e)
             {
                 Log.Record("第" + (i + 1).ToString() + "次数据上传失败,正在第" + (i + 2).ToString() + "次尝试。");
             }
         }
     }
 }