private void FireGameEnded(LobbyClientGameServerOutboundConnection con, PropertyBag gameProps, string msg) { if (GameEndedInvoker != null) { GameEndedInvoker(con, gameProps, msg); } }
private void FireGameStartReply(LobbyClientGameServerOutboundConnection con, bool result, string msg) { if (GameStartReplyInvoker != null) { GameStartReplyInvoker(con, result, msg); } }
private ClientGame FireGameActivating(LobbyClientGameServerOutboundConnection con, Game gameData) { if (GameActivatingInvoker != null) { return(GameActivatingInvoker(con, gameData)); } return(null); }
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); }
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); }
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() + ". "); }
/// <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; }
/// <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); }
/// <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); }
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() + ". "); }
void OnGameServer_GameEnded(LobbyClientGameServerOutboundConnection con, PropertyBag finalProperties, string msg) { Log.LogMsg(">>> Game ended <<<"); FireGameEnded(con, finalProperties, msg); }
protected override ClientGameServerOutboundConnection OnGameServerConnectionCreate(bool isBlocking) { LobbyClientGameServerOutboundConnection con = new LobbyClientGameServerOutboundConnection(isBlocking); return con; }
void OnGameServer_GameStartReply(LobbyClientGameServerOutboundConnection con, bool result, string msg) { Log.LogMsg("Game start request [" + (result? "SUCCEEDED: " : "FAILED: ") + msg + "]."); FireGameStartReply(con, result, msg); }
protected override ClientGameServerOutboundConnection OnGameServerConnectionCreate(bool isBlocking) { LobbyClientGameServerOutboundConnection con = new LobbyClientGameServerOutboundConnection(isBlocking); return(con); }
ClientGame OnGameServer_GameActivating(LobbyClientGameServerOutboundConnection con, Game gameData) { return OnCreateCurrentGameObject(gameData); }
void OnGameServer_GameEnded(LobbyClientGameServerOutboundConnection con, PropertyBag finalProperties, string msg) { Log.LogMsg(">>> Game ended <<<"); FireGameEnded(con, finalProperties, msg); }
void OnGameServer_GameStartReply(LobbyClientGameServerOutboundConnection con, bool result, string msg) { Log.LogMsg("Game start request [" + (result? "SUCCEEDED: " : "FAILED: ") + msg + "]."); FireGameStartReply(con, result, msg); }
/// <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); }
ClientGame OnGameServer_GameActivating(LobbyClientGameServerOutboundConnection con, Game gameData) { return(OnCreateCurrentGameObject(gameData)); }