Beispiel #1
0
        public void SetMapTileMatrix(MapTileType[][] tileMatrix)
        {
            MapTileMatrix = tileMatrix;

            //broadcast the new map to all clients.
            MulticastNullTerminated(CommandStringHelper.GetUpdateMapCommandStringFromTileMatrix(tileMatrix));
        }
Beispiel #2
0
        protected override void OnConnected(TcpSession session)
        {
            var currentGameServerSession = _gameServerSessionsById[session.Id];

            //send map tiles to the connected client.
            currentGameServerSession.SendNullTerminated(CommandStringHelper.GetUpdateMapCommandStringFromTileMatrix(MapTileMatrix));

            //send the client's ID to the client.
            currentGameServerSession.SendNullTerminated(CommandStringHelper.GetClientIdCommandStringFromClientId(session.Id));

            //send a message to all other clients that a player has joined, and attach the player's initial position.
            MulticastNullTerminated(CommandStringHelper.GetPlayerUpdateCommandStringFromGameServerSession(currentGameServerSession));
        }