Пример #1
0
        static void Main(string[] args)
        {
            var match = new Match
            {
                ID = 69
            };
            //BridgeTest();

            var request = new CustomCalculationServiceRequest
            {
                MethodType = CustomCalculationServiceRequest.RequestTypeEnum.POST,
                MethodController = "Calculation",
                Key = "raktelis",
                MethodName = "CalculateStatistics",
                Body = new Match() { ID = 69, Duration = 123456789 },
            };


            var connection = new CustomCalculationServiceConnection();
            var mt = JsonConvert.SerializeObject(new Match(){ID = 5});
            var re = JsonConvert.DeserializeObject(mt);
            var re2 = JsonConvert.DeserializeObject<Match>(mt);
            var c = connection.Request(request);

            Console.WriteLine("GREAT success!");
            Console.ReadKey();
        }
Пример #2
0
 public static Match GenerateMath(int id)
 {
     var match = new Match
     {
         ID = id,
         StartTime = 97856321,
     };
     switch (id)
     {
         case 1:
             match.BarracksStatusDire = 3;
             match.BarracksStatusRadiant = 9;
             match.Cluster = 5;
             match.Duration = 6845;
             match.Engine = 14;
             match.FirstBloodTime = 69;
             match.HumanPlayers = 1;
             match.GameMode = 1;
             match.RadiantWin = true;
             match.TowerStatusDire = 9;
             match.TowerStatusRadiant = 8;
             break;
         case 2:
             match.BarracksStatusDire = 8;
             match.BarracksStatusRadiant = 7;
             match.Cluster = 53;
             match.Duration = 7835;
             match.Engine = 2;
             match.FirstBloodTime = 453;
             match.HumanPlayers = 1;
             match.GameMode = 12;
             match.RadiantWin = false;
             match.TowerStatusDire = 1;
             match.TowerStatusRadiant = 7;
             break;
         default:
             match.BarracksStatusDire = 3;
             match.BarracksStatusRadiant = 89;
             match.Cluster = 9;
             match.Duration = 12387;
             match.Engine = 35;
             match.FirstBloodTime = 25;
             match.HumanPlayers = 35;
             match.GameMode = 7;
             match.RadiantWin = true;
             match.TowerStatusDire = 8;
             match.TowerStatusRadiant = 1;
             break;
     }
     match.Players = new List<InGamePlayer>();
     for (int i = 0; i < 10; i++)
     {
         ((List<InGamePlayer>)match.Players).Add(PlayersFacotry.GeneratePlayer(i%5,i%5));
     }
     return match;
 }
Пример #3
0
 public Match GetMatchStatistics(Match match)
 {
     var request = new CustomCalculationServiceRequest
     {
         MethodType = CustomCalculationServiceRequest.RequestTypeEnum.POST,
         MethodController = "Calculation",
         Key = Key,
         MethodName = "Statistics",
         Body = match,
     };
     return _connectioToApi.Request<Match>(request);
 }
Пример #4
0
 public Match CalculateMatchDetails(Match match)
 {
     var request = new CustomCalculationServiceRequest
     {
         MethodName = "MyMethod",
         MethodController = "Calculation",
         Body = match,
         URLParameters = new[] { "2" },
         MethodType = CustomCalculationServiceRequest.RequestTypeEnum.POST
     };
     CustomCalculationServiceConnection a = new CustomCalculationServiceConnection();
     object response = a.Request(request);
     return null;
 }
 public Match CalculateStatistics(Match match)
 {
     //TODO some math
     return match;
 }