Beispiel #1
0
        public void RtmpConn_MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            try {
                if (CurrentQueue != null && CurrentQueue.HandleMessage(e))
                {
                    return;
                }

                if (CurrentLobby != null && CurrentLobby.HandleMessage(e))
                {
                    return;
                }
            } catch (Exception x) {
                ThrowException(x, "Exception while dispatching message");
            }

            var response  = e.Body as LcdsServiceProxyResponse;
            var config    = e.Body as ClientDynamicConfigurationNotification;
            var invite    = e.Body as InvitationRequest;
            var endofgame = e.Body as EndOfGameStats;

            try {
                if (response != null)
                {
                    if (response.status.Equals("ACK"))
                    {
                        Log($"Acknowledged call of method {response.methodName} [{response.messageId}]");
                    }
                    else if (response.messageId != null && RiotServices.Delegates.ContainsKey(response.messageId))
                    {
                        RiotServices.Delegates[response.messageId](response);
                        RiotServices.Delegates.Remove(response.messageId);
                    }
                    else
                    {
                        Log($"Unhandled LCDS response of method {response.methodName} [{response.messageId}], {response.payload}");
                    }
                }
                else if (config != null)
                {
                    Log("Received Configuration Notification");
                }
                else if (invite != null)
                {
                    ShowInvite(invite);
                }
                else if (endofgame != null)
                {
                    //TODO End of game
                }
                else
                {
                    Log($"Receive [{e.Subtopic}, {e.ClientId}]: '{e.Body}'");
                }
            } catch (Exception x) {
                ThrowException(x, "Exception while handling message");
            }
        }
 private void OnLobbyCreated(LobbyCreated_t pCallback, bool bIOFailure)
 {
     if (bIOFailure == false)
     {
         Debug.Log("[" + LobbyCreated_t.k_iCallback + " - LobbyCreated] - " + pCallback.m_eResult + " -- " + pCallback.m_ulSteamIDLobby);
         // //set the lobby to our class level
         // m_Lobby = ;
         // currentLobby = GetLobbyDataInfo (
         m_Lobby       = new CurrentLobby();
         m_Lobby.lobby = (CSteamID)pCallback.m_ulSteamIDLobby;
     }
     else
     {
         Debug.LogError("Failed to create a lobby");
     }
 }
Beispiel #3
0
 public void Logout()
 {
     if (Connected)
     {
         try {
             SaveSettings(Settings.Username, Settings);
             RtmpConn.MessageReceived -= RtmpConn_MessageReceived;
             HeartbeatTimer.Dispose();
             new Thread(async() => {
                 Connected = false;
                 CurrentQueue?.Cancel();
                 CurrentLobby?.Dispose();
                 await RiotServices.LoginService.Logout();
                 await RtmpConn.LogoutAsync();
                 RtmpConn.Close();
             }).Start();
         } catch { }
     }
     ChatManager?.Dispose();
 }
 ///<summary>
 /// Join a lobby
 /// <param>CSteamID object of the lobby wanting to Leave</param>
 ///</summary>
 public void LeaveLobby(CSteamID lobby)
 {
     SteamMatchmaking.LeaveLobby(lobby);
     m_Lobby = null;
     m_PlayerList.Clear();
 }