Esempio n. 1
0
        static void Main(string[] args)
        {
            Timer generateTimer = null;
            Timer consumeTimer  = null;

            try
            {
                string dbName = $"matchmaking.db";
                if (File.Exists(dbName))
                {
                    File.Delete(dbName);
                }
                using (var dbContext = new MatchMakingContext())
                {
                    dbContext.Database.EnsureCreated();
                }

                //matchMaker.TestingAlgorithms(new MatchMakingContext());

                generateTimer = new Timer(GeneratePlayers, 0, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(0.1));
                consumeTimer  = new Timer(StartMatches, null, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(0.1));

                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                generateTimer?.Dispose();
                consumeTimer?.Dispose();
            }
        }
Esempio n. 2
0
 public QueueController(MatchMakingContext matchmakingContext, MatchMaker matchMaker)
 {
     _matchmakingContext = matchmakingContext;
     _matchMaker         = matchMaker;
 }