Esempio n. 1
0
 public void Start()
 {
     _acceptPlayers = false;
     _gameStarted   = true;
     _broadcaster.Start();
     GameStarted = true;
     State.Instance.Handler.GameStarted = true;
     // Just a precaution, shouldn't happen though.
     if (_gameSettings.AllowSpectators == false)
     {
         foreach (var p in State.Instance.Players)
         {
             if (p.IsSpectator)
             {
                 p.Kick(false, L.D.ServerMessage__SpectatorsNotAllowed);
             }
         }
     }
     if (State.Instance.Engine.IsLocal == false)
     {
         try
         {
             var c   = new ApiClient();
             var req = new PutGameHistoryReq(State.Instance.Engine.ApiKey,
                                             State.Instance.Engine.Game.Id.ToString());
             foreach (var p in State.Instance.Players.ToArray())
             {
                 req.Usernames.Add(p.Nick);
             }
             c.CreateGameHistory(req);
         }
         catch (Exception e)
         {
             Log.Error("Start Error creating Game History", e);
         }
     }
 }
Esempio n. 2
0
 public void Start()
 {
     _acceptPlayers = false;
     _gameStarted = true;
     _broadcaster.Start();
     GameStarted = true;
     State.Instance.Handler.GameStarted = true;
     // Just a precaution, shouldn't happen though.
     if (_gameSettings.AllowSpectators == false)
     {
         foreach (var p in State.Instance.Players)
         {
             if (p.IsSpectator)
                 p.Kick(false, L.D.ServerMessage__SpectatorsNotAllowed);
         }
     }
     if (State.Instance.Engine.IsLocal == false)
     {
         try
         {
             var c = new ApiClient();
             var req = new PutGameHistoryReq(State.Instance.Engine.ApiKey,
                 State.Instance.Engine.Game.Id.ToString());
             foreach (var p in State.Instance.Players.ToArray())
             {
                 req.Usernames.Add(p.Nick);
             }
             c.CreateGameHistory(req);
         }
         catch (Exception e)
         {
             Log.Error("Start Error creating Game History", e);
         }
     }
 }
Esempio n. 3
0
 public void CreateGameHistory(PutGameHistoryReq req)
 {
     var client = Client;
     var resp   = client.PostAsJsonAsync("api/gamehistory/put", req).Result;
 }