Exemple #1
0
        public GameServer()
        {
            GameUniverse=new Universe();

            this.OnConnect += GameServer_OnConnect;
            this.OnDisconnect += (sender, e) => Logger.Trace("Client disconnected: {0}", e.Connection.ToString());
            this.DataReceived += GameServer_DataReceived;
            this.DataSent += (sender, e) => { };
        }
Exemple #2
0
        public GameServer()
        {
            GameUniverse=new Universe();

            this.OnConnect += ClientManager.OnConnect;
            this.OnDisconnect += ClientManager.OnDisconnect;
            this.DataReceived += GameServer_DataReceived;
            this.DataSent += (sender, e) => { };
        }
Exemple #3
0
        public static void OnConnect(object sender, ConnectionEventArgs e)
        {
            Logger.Trace("Game-Client connected: {0}", e.Connection.ToString());

            // atm, just creating a universe - though clients should be able to join existing ones.
            var universe = new Universe();           
            var gameClient = new GameClient(e.Connection, universe);
            e.Connection.Client = gameClient;

            Universes.Add(universe);
            ClientUniverseMapper.Add(gameClient, universe);
        }
Exemple #4
0
        public GameServer()
        {
            GameUniverse = new Universe();

            this.OnConnect += GameServer_OnConnect;
            this.OnDisconnect += (sender, e) => Logger.Trace("Client disconnected: {0}", e.Connection.ToString());
            this.DataReceived += GameServer_DataReceived;
            this.DataSent += (sender, e) => { };

            mainThread = Thread.CurrentThread;

            thread = new Thread(new ThreadStart(() => { GameServer_Thread(); }));
            thread.Start();
        }
Exemple #5
0
 public GameClient(IConnection connection, Universe gameUniverse)
 {
     this.Connection = connection;
     _outgoingBuffer.WriteInt(32, 0);
     GameUniverse = gameUniverse;
 }