Exemple #1
0
        public static Types.BattleFieldItemIdentifier ParseBattleFieldId(Types.Item singleItem)
        {
            var split = singleItem.Id.Split("::");

            return(new Types.BattleFieldItemIdentifier
            {
                Round = split[0],
                Guid = split[1],
                Team = split[2],
                Type = split[3]
            });
        }
Exemple #2
0
        public static async Task <string> PostBattlefield(Types.Item input)
        {
            // instantiate http client
            var httpClient = new HttpClient();

            // deserialize current battlefield
            var serializedObj = JsonConvert.SerializeObject(input);

            // post message
            var obj      = new StringContent(serializedObj, Encoding.UTF8, "application/json");
            var response = await httpClient.PostAsync($"{Constants.APIGATEWAY_URL}/items", obj);

            // read response
            var responseString = await response.Content.ReadAsStringAsync();

            return(responseString);
        }
Exemple #3
0
        public static Types.Item GetLastItemFromBattlefield(List <Types.Item> battlefield, string action)
        {
            var lastItem = new Types.Item
            {
                Id    = "_::_::_::_",
                Value = ""
            };

            foreach (var item in battlefield)
            {
                if (item.Id.Contains(action))
                {
                    lastItem = item;
                }
            }
            return(lastItem);
        }