Пример #1
0
        public GameClient()
        {
            client = new HttpClient(new HttpClientHandler
            {
                ClientCertificateOptions = ClientCertificateOption.Manual,
                ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) => true
            });

#if CHARM_BOT
            CharmBotCharmCast += (time) =>
            {
                var eventObj = new JObject
                {
                    ["EventName"]   = "CharmCast",
                    ["CharmerName"] = activePlayerName,
                    ["EventTime"]   = time,
                };
                GotEvents?.Invoke(new JObject[] { eventObj });
            };
            CharmBotCharmHit += (time, charmee) =>
            {
                var eventObj = new JObject
                {
                    ["EventName"]   = "CharmHit",
                    ["CharmerName"] = activePlayerName,
                    ["CharmeeName"] = players.FirstOrDefault(p => p?["championName"]?.ToString()?.Replace(" ", "") == charmee)?["summonerName"] ?? charmee,
                    ["EventTime"]   = time,
                };
                events.Add(eventObj);
                GotEvents?.Invoke(new JObject[] { eventObj });
            };
#endif
        }
Пример #2
0
 public void ReemitRunning()
 {
     if (gameRunning)
     {
         ClientConnected?.Invoke(players, activePlayerName);
         GotEvents?.Invoke(events.ToArray());
     }
 }
Пример #3
0
        private async Task processEvents()
        {
            while (gameRunning)
            {
                var requestedEvents = await requestEvents();

                if (requestedEvents == null)
                {
                    break;
                }
                if (requestedEvents.Length > 0)
                {
                    GotEvents?.Invoke(requestedEvents);
                }
                events.AddRange(requestedEvents);

                await Task.Delay(500);
            }
        }