Example #1
0
 private void FireGameEnded(LobbyClientGameServerOutboundConnection con, PropertyBag gameProps, string msg)
 {
     if (GameEndedInvoker != null)
     {
         GameEndedInvoker(con, gameProps, msg);
     }
 }
Example #2
0
 private void FireGameStartReply(LobbyClientGameServerOutboundConnection con, bool result, string msg)
 {
     if (GameStartReplyInvoker != null)
     {
         GameStartReplyInvoker(con, result, msg);
     }
 }
Example #3
0
 private ClientGame FireGameActivating(LobbyClientGameServerOutboundConnection con, Game gameData)
 {
     if (GameActivatingInvoker != null)
     {
         return(GameActivatingInvoker(con, gameData));
     }
     return(null);
 }
Example #4
0
        private void OnGameServer_SocketKilled(object sender, string msg)
        {
            //base.OnGameServer_SocketKilled(sender, msg);
            LobbyClientGameServerOutboundConnection con = sender as LobbyClientGameServerOutboundConnection;

            con.BeforeLoginRequest -= new LobbyClientGameServerOutboundConnection.OnBeforeLoginRequestDelegate(OnGameServer_OnBeforeLoginRequest);
            con.SocketKilled       -= new SocketKilledDelegate(OnGameServer_SocketKilled);
            con.PlayerJoined       -= new PlayerJoinedDelegate(OnGameServer_PlayerJoined);
            con.PlayerRemoved      -= new PlayerRemovedDelegate(OnGameServer_PlayerRemoved);
            con.ContentCreateGameRequestResolved -= new CreateGameRequestResolvedDelegate(OnGameServer_CreateGameRequestResolved);
            con.GameStartReply   -= new GameStartReplyDelegate(OnGameServer_GameStartReply);
            con.ObserverJoined   -= new PlayerJoinedDelegate(OnGameServer_ObserverJoined);
            con.ObserverRemoved  -= new PlayerRemovedDelegate(OnGameServer_ObserverRemoved);
            con.GameEnded        -= new GameEndDelegate(OnGameServer_GameEnded);
            con.JoinGameResolved -= new JoinGameResultDelegate(OnGameServer_JoinResult);
        }
Example #5
0
        protected override void OnAfterGameServerConnectionCreate(ClientGameServerOutboundConnection con)
        {
            base.OnAfterGameServerConnectionCreate(con);
            LobbyClientGameServerOutboundConnection lcon = con as LobbyClientGameServerOutboundConnection;

            lcon.ContentCreateGameRequestResolved += new CreateGameRequestResolvedDelegate(OnGameServer_CreateGameRequestResolved);
            lcon.SocketKilled     += new SocketKilledDelegate(OnGameServer_SocketKilled);
            lcon.PlayerJoined     += new PlayerJoinedDelegate(OnGameServer_PlayerJoined);
            lcon.ObserverJoined   += new PlayerJoinedDelegate(OnGameServer_ObserverJoined);
            lcon.PlayerRemoved    += new PlayerRemovedDelegate(OnGameServer_PlayerRemoved);
            lcon.ObserverRemoved  += new PlayerRemovedDelegate(OnGameServer_ObserverRemoved);
            lcon.GameStartReply   += new GameStartReplyDelegate(OnGameServer_GameStartReply);
            lcon.GameEnded        += new GameEndDelegate(OnGameServer_GameEnded);
            lcon.JoinGameResolved += new JoinGameResultDelegate(OnGameServer_JoinResult);
            lcon.GameActivating   += new LobbyClientGameServerOutboundConnection.GameActivatingDelegate(OnGameServer_GameActivating);

            lcon.BeforeLoginRequest += new LobbyClientGameServerOutboundConnection.OnBeforeLoginRequestDelegate(OnGameServer_OnBeforeLoginRequest);
        }
Example #6
0
        private void HandlePacket(LobbyClientGameServerOutboundConnection con, PacketReply msg, PacketHandlerMap map)
        {
            Action <INetworkConnection, Packet> handler = map.GetHandlerDelegate(msg.PacketSubTypeID);

            if (handler != null)
            {
                try
                {
                    handler(con, msg);
                }
                catch (Exception e)
                {
                    Log.LogMsg("Exception thrown whilst processing game packet type " + msg.PacketTypeID.ToString() + ", sub-type " + msg.PacketSubTypeID + ". Object = " + this.GetType().ToString() + ", Message: " + e.Message + ". Stack:\r\n " + e.StackTrace);
                }

                con.OnAfterPacketProcessed(msg);
                return;
            }

            con.KillConnection("Did not have a registered game packet handler for game packet. " + msg.PacketTypeID.ToString() + ", SubType " + msg.PacketSubTypeID.ToString() + ". ");
        }
Example #7
0
 /// <summary>
 /// Adds a packet to the queue for serial processing.  If the con.ProcessPacketsImmediately is set to true, then we will not queue the packet
 /// but rather will execute the handler immediately.
 /// </summary>
 /// <param name="con">the connection which sent the packet</param>
 /// <param name="msg">the packet</param>
 public void HandleGamePacketReply(LobbyClientGameServerOutboundConnection con, PacketReply msg)
 {
     HandlePacket(con, msg, m_GameReplyHandlerMap);
 }
 private void FireGameStartReply(LobbyClientGameServerOutboundConnection con, bool result, string msg)
 {
     if (GameStartReplyInvoker != null)
     {
         GameStartReplyInvoker(con, result, msg);
     }
 }
 private void FireGameEnded(LobbyClientGameServerOutboundConnection con, PropertyBag gameProps, string msg)
 {
     if (GameEndedInvoker != null)
     {
         GameEndedInvoker(con, gameProps, msg);
     }
 }
 private ClientGame FireGameActivating(LobbyClientGameServerOutboundConnection con, Game gameData)
 {
     if (GameActivatingInvoker != null)
     {
         return GameActivatingInvoker(con, gameData);
     }
     return null;
 }
Example #11
0
 /// <summary>
 /// Adds a packet to the queue for serial processing.  If the con.ProcessPacketsImmediately is set to true, then we will not queue the packet
 /// but rather will execute the handler immediately.
 /// </summary>
 /// <param name="con">the connection which sent the packet</param>
 /// <param name="msg">the packet</param>
 public void HandleGamePacketReply(LobbyClientGameServerOutboundConnection con, PacketReply msg)
 {
     HandlePacket(con, msg, m_GameReplyHandlerMap);
 }
Example #12
0
 /// <summary>
 /// Adds a packet to the queue for serial processing.  If the con.ProcessPacketsImmediately is set to true, then we will not queue the packet
 /// but rather will execute the handler immediately.
 /// </summary>
 /// <param name="con">the connection which sent the packet</param>
 /// <param name="msg">the packet</param>
 public void HandleGamePacket(LobbyClientGameServerOutboundConnection con, PacketGameMessage msg)
 {
     HandlePacket(con, msg, m_PacketHandlers);
 }
Example #13
0
        private void HandlePacket(LobbyClientGameServerOutboundConnection con, PacketReply msg, PacketHandlerMap map)
        {
            Action<INetworkConnection, Packet> handler = map.GetHandlerDelegate(msg.PacketSubTypeID);
            if (handler != null)
            {
                try
                {
                    handler(con, msg);
                }
                catch (Exception e)
                {
                    Log.LogMsg("Exception thrown whilst processing game packet type " + msg.PacketTypeID.ToString() + ", sub-type " + msg.PacketSubTypeID + ". Object = " + this.GetType().ToString() + ", Message: " + e.Message + ". Stack:\r\n " + e.StackTrace);
                }

                con.OnAfterPacketProcessed(msg);
                return;
            }

            con.KillConnection("Did not have a registered game packet handler for game packet. " + msg.PacketTypeID.ToString() + ", SubType " + msg.PacketSubTypeID.ToString() + ". ");
        }
Example #14
0
 void OnGameServer_GameEnded(LobbyClientGameServerOutboundConnection con, PropertyBag finalProperties, string msg)
 {
     Log.LogMsg(">>> Game ended <<<");
     FireGameEnded(con, finalProperties, msg);
 }
Example #15
0
 protected override ClientGameServerOutboundConnection OnGameServerConnectionCreate(bool isBlocking)
 {
     LobbyClientGameServerOutboundConnection con = new LobbyClientGameServerOutboundConnection(isBlocking);
     return con;
 }
Example #16
0
 void OnGameServer_GameStartReply(LobbyClientGameServerOutboundConnection con, bool result, string msg)
 {
     Log.LogMsg("Game start request [" + (result? "SUCCEEDED: " : "FAILED: ") + msg + "].");
     FireGameStartReply(con, result, msg);
 }
Example #17
0
        protected override ClientGameServerOutboundConnection OnGameServerConnectionCreate(bool isBlocking)
        {
            LobbyClientGameServerOutboundConnection con = new LobbyClientGameServerOutboundConnection(isBlocking);

            return(con);
        }
Example #18
0
 ClientGame OnGameServer_GameActivating(LobbyClientGameServerOutboundConnection con, Game gameData)
 {
     return OnCreateCurrentGameObject(gameData);
 }
Example #19
0
 void OnGameServer_GameEnded(LobbyClientGameServerOutboundConnection con, PropertyBag finalProperties, string msg)
 {
     Log.LogMsg(">>> Game ended <<<");
     FireGameEnded(con, finalProperties, msg);
 }
Example #20
0
 void OnGameServer_GameStartReply(LobbyClientGameServerOutboundConnection con, bool result, string msg)
 {
     Log.LogMsg("Game start request [" + (result? "SUCCEEDED: " : "FAILED: ") + msg + "].");
     FireGameStartReply(con, result, msg);
 }
Example #21
0
 /// <summary>
 /// Adds a packet to the queue for serial processing.  If the con.ProcessPacketsImmediately is set to true, then we will not queue the packet
 /// but rather will execute the handler immediately.
 /// </summary>
 /// <param name="con">the connection which sent the packet</param>
 /// <param name="msg">the packet</param>
 public void HandleGamePacket(LobbyClientGameServerOutboundConnection con, PacketGameMessage msg)
 {
     HandlePacket(con, msg, m_PacketHandlers);
 }
Example #22
0
 ClientGame OnGameServer_GameActivating(LobbyClientGameServerOutboundConnection con, Game gameData)
 {
     return(OnCreateCurrentGameObject(gameData));
 }