private static void Main() { GameManager.Load(); var mgr = GameManager.Instance; var mre = new ManualResetEventSlim(false); Console.TreatControlCAsInput = false; Console.CancelKeyPress += (sender, e) => mre.Set(); var hostCfg = new HostConfiguration { RewriteLocalhost = true, EnableClientCertificates = true, UrlReservations = new UrlReservations { CreateAutomatically = true } }; using (var host = new NancyHost(new Uri(mgr.Settings.HostUrl), new WebappBootstrapper(mgr.Settings.WebRoot), hostCfg)) using (var gameServer = new CardGameServer(mgr.Game)) { // Start analytics if (mgr.Settings.AnalyticsEnabled) { AnalyticsManager.Instance.Start(mgr.Settings.AnalyticsPath); } // Start game server try { Console.Write("Starting WebSocket server... "); gameServer.Start(); Console.WriteLine("Done."); } catch (Exception ex) { Console.WriteLine(); Console.WriteLine($"Failed to start WebSocket server: \n{ex.Message}"); return; } // Start web server try { Console.Write("Starting server... "); host.Start(); Console.WriteLine("Done."); Console.WriteLine($"Ready. Hosting on: {mgr.Settings.HostUrl}"); } catch (Exception ex) { Console.WriteLine(); Console.WriteLine($"Failed to start server: \n{ex.Message}"); return; } mre.Wait(); // Close analytics AnalyticsManager.Instance.Stop(); } }
public SpectatorConnection(CardGameServer server, CardGame game) : base(server, game) { }
public PlayerConnection(CardGameServer server, CardGame game) : base(server, game) { _idleCheckThread = new Thread(IdleCheckThread); }
public ClientConnectionBase(CardGameServer server, CardGame game) { Server = server; Game = game; _cookies = new Dictionary <string, string>(); }