Ejemplo n.º 1
0
        public GameInstance(Database.Game game, Database.GameDevice device, UdpClient client, IPEndPoint endPoint)
        {
            _masterClient = new GamePlayer(device, client, endPoint);
            _masterClient.GotGameUpdate += new EventHandler<GameUpdateEventArgs>(_masterClient_GotGameUpdate);
            _masterClient.ClientDisconnected += new EventHandler(_masterClient_ClientDisconnected);
            _allPlayers.Add(_masterClient);
            _endPointMap.Add(endPoint.ToString().GetHashCode(), _masterClient);

            _game = game;
        }
Ejemplo n.º 2
0
        public Program()
        {
            "started".Trace();
            GameServer.Database      db   = (GameServer.Database)_XmlSerializer.Deserialize(File.Open(Settings._Maps, FileMode.Open));
            List <GameServer.Server> svrs = new List <GameServer.Server>();

            foreach (Task task in db._tasks)
            {
                GameServer.Server _Server = new GameServer.Server();
                _Server._Task = task;
                _Server.StartAsync();
                svrs.Add(_Server);
            }

            PolicyServer ps = new PolicyServer {
                policyFile = "Server/PolicyFile.xml"
            };

            ps.StartAsync();

            WebServer.WebServer _WebServer = new WebServer.WebServer();
            _WebServer.StartAsync();
            Thread.Sleep(-1);
        }
Ejemplo n.º 3
0
 public GamePlayer(Database.GameDevice device, UdpClient client, IPEndPoint endPoint)
 {
     _device = device;
     _client = client;
     _endPoint = endPoint;
 }
Ejemplo n.º 4
0
        public void AddPlayer(Database.GameDevice gameDevice, UdpClient client, IPEndPoint endPoint)
        {
            lock (this)
            {
                GamePlayer addPlayer = new GamePlayer(gameDevice, client, endPoint);
                addPlayer.GotGameUpdate += new EventHandler<GameUpdateEventArgs>(_slaveClient_GotGameUpdate);
                addPlayer.ClientDisconnected += new EventHandler(addPlayer_ClientDisconnected);

                _endPointMap.Add(endPoint.ToString().GetHashCode(), addPlayer);
                _slaveClients.Add(addPlayer);
                _allPlayers.Add(addPlayer);
            }

            SendGameInfo();
        }