示例#1
0
        public ClientGame(Game g, LobbyClient client, ClientGameServerOutboundConnection con)
        {
            Connection = con;
            this.Client = client;
            this.AbandonedTimestamp = g.AbandonedTimestamp;
            this.Players = g.Players;
            this.GameID = g.GameID;
            this.IsShuttingDown = g.IsShuttingDown;
            this.Observers = g.Observers;
            this.Owner = g.Owner;
            this.Properties = g.Properties;

            RegisterGamePacketHandler((int)LobbyGameMessageSubType.GameInfoNotification, OnGameInfoNotification);
            RegisterGamePacketHandler((int)LobbyGameMessageSubType.GamePropertiesUpdateNotification, OnGamePropertiesUpdate);
            RegisterGamePacketHandler((int)LobbyGameMessageSubType.Chat, OnGameChat);
            RegisterGamePacketHandler((int)LobbyGameMessageSubType.NewOwner, OnNewGameOwner);
        }
示例#2
0
 public ClientGameTB(Game g, LobbyClient client, ClientGameServerOutboundConnection con) : base(g, client, con)
 {
     RegisterGamePacketHandler((int)TurnedGameMessageSubType.PhaseUpdate, OnPhaseEntered);
     RegisterGamePacketHandler((int)TurnedGameMessageSubType.TurnOrderUpdate, OnTurnOrderUpdateReceived);
 }
示例#3
0
文件: Client.cs 项目: kamilion/WISP
    /// <summary>
    /// Disconnects and cleans up any current game server connection and initizialzed a new one (m_GameServer).
    /// </summary>
    private void SetupGameServerConnection(bool isBlocking)
    {
        GameServerReadyForPlay  = false;
        if (m_GameServer != null)
        {
            //// Clean up current connection object
            //if (m_LoginCon != null && (m_LoginCon.IsAlive || m_LoginCon.ConnectionInProgress))
            //{
            //    m_LoginCon.KillConnection("Client requested disconnection.");
            //}

            if (m_GameServer != null)
            {
                if (m_GameServer.IsAlive || m_GameServer.ConnectionInProgress)
                {
                    m_GameServer.KillConnection("Client requested disconnection.");
                }
            }

            //if (m_CentralServer != null && (m_CentralServer.IsAlive || m_CentralServer.ConnectionInProgress))
            //{
            //    m_CentralServer.KillConnection("Client requested disconnection.");
            //}

            m_GameServer.SocketKilled -= new SocketKilledDelegate(OnGameServer_SocketKilled);
            m_GameServer.ServerReady -= new EventHandler(OnGameServer_ServerReady);
            m_GameServer.AuthTicketRejected -= new ClientServerOutboundConnection.AuthTicketRejectedDelegate(OnGameServer_AuthTicketRejected);
            m_GameServer.ServerTransferDirective -= new ServerTransferDirectiveDelegate(OnGameServer_ServerTransferResult);
        }

        m_GameServer = OnGameServerConnectionCreate(isBlocking);
        OnAfterGameServerConnectionCreate(m_GameServer);
    }
示例#4
0
文件: Client.cs 项目: kamilion/WISP
 protected virtual void OnAfterGameServerConnectionCreate(ClientGameServerOutboundConnection con)
 {
     m_GameServer.ProcessIncomingPacketsImmediately = ProcessNetworkingImmediately;
     m_GameServer.SocketKilled += new SocketKilledDelegate(OnGameServer_SocketKilled);
     m_GameServer.ServerReady += new EventHandler(OnGameServer_ServerReady);
     m_GameServer.AuthTicketRejected += new ClientServerOutboundConnection.AuthTicketRejectedDelegate(OnGameServer_AuthTicketRejected);
     m_GameServer.ServerTransferDirective += new ServerTransferDirectiveDelegate(OnGameServer_ServerTransferResult);
 }
示例#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);
        }