Exemplo n.º 1
0
 public MatchMakerService(GameServerServiceImpl gameServerService)
 {
     _gameServerService = gameServerService;
     _gameServerService.ProcessGameData = ProcessGameData;
     _gameServerService.GetMatchGame    = GetMatchGame;
     _timer      = new Timer((e) => { MatchMakerEvent(); }, null, Timeout.Infinite, Timeout.Infinite);
     _matchGames = new ConcurrentDictionary <int, MatchGameService>();
 }
Exemplo n.º 2
0
        public MatchGameService(GameServerServiceImpl gameServerService, int index, UserDataInfo player1, UserDataInfo player2)
        {
            _gameServerService = gameServerService;
            _random            = new Random();
            GameId             = index;

            Player1             = player1;
            Player1.GameId      = GameId;
            Player1.PlayerId    = 1;
            Player1.PlayerState = PlayerState.None;

            Player2             = player2;
            Player2.GameId      = GameId;
            Player2.PlayerId    = 2;
            Player2.PlayerState = PlayerState.None;

            _id    = 2;
            _token = $"matchgame{GameId}";

            _game = null;
        }