Пример #1
0
        private void HandleJoinAcceptedTC(string message)
        {
            hextechSocket.appManager.joinedLobby = true;
            var dto = JsonConvert.DeserializeObject <JoinAcceptedTC>(message);

            hextechSocket.appManager.ViewModel.ChangeView(ViewState.CURRENT_LOBBY);
            CurrentLobbyView view = hextechSocket.appManager.ViewModel.GetView <CurrentLobbyView>();

            view.SetLobbyJoin(dto.ownerIconId, dto.ownerSummonerName);
            hextechSocket.appManager.notifyManager.DisplayNotification();

            /* Task.Run(() =>
             * {
             *  var invitesJson = hextechSocket.appManager.leagueClient.GetFromAPI("lol-lobby/v2/received-invitations");
             *  var invites = JsonConvert.DeserializeObject<List<CurrentInvites>>(invitesJson);
             *  string inviteId = null;
             *  foreach (var invite in invites)
             *  {
             *      if (invite.fromSummonerName == dto.ownerSummonerName)
             *      {
             *          inviteId = invite.invitationId;
             *          break;
             *      }
             *  }
             *  if (inviteId == null) return;
             *  var resp = hextechSocket.appManager.leagueClient.SendApiRequest("POST", $"lol-lobby/v2/received-invitations/{inviteId}/accept", null);
             *  if (resp.StatusCode == System.Net.HttpStatusCode.NoContent) return;
             *  MessageBox.Show(null, "Failed to accept invite. Please do so manually.", "League Client error", MessageBoxButtons.OK, MessageBoxIcon.Information);
             * });
             */
        }
Пример #2
0
        private void HandleRegisterLobbyTC(string message)
        {
            var dto = JsonConvert.DeserializeObject <RegisterLobbyTC>(message);

            hextechSocket.appManager.ViewModel.ChangeView(ViewState.CURRENT_LOBBY);
            CurrentLobbyView view     = hextechSocket.appManager.ViewModel.GetView <CurrentLobbyView>();
            CurrentSummoner  summoner = null;

            Task.Run(() =>
            {
                var data = hextechSocket.appManager.leagueClient.GetFromAPI("lol-summoner/v1/current-summoner");
                summoner = JsonConvert.DeserializeObject <CurrentSummoner>(data);
                if (summoner == null)
                {
                    Console.WriteLine("Critical Error summoner is null");
                }
                view.setLobbyCreate(summoner.profileIconId, summoner.displayName, dto.uuid);
            });
        }