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) => { }; }
public GameServer() { GameUniverse=new Universe(); this.OnConnect += ClientManager.OnConnect; this.OnDisconnect += ClientManager.OnDisconnect; this.DataReceived += GameServer_DataReceived; this.DataSent += (sender, e) => { }; }
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); }
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(); }
public GameClient(IConnection connection, Universe gameUniverse) { this.Connection = connection; _outgoingBuffer.WriteInt(32, 0); GameUniverse = gameUniverse; }