public ActionResult<EventModel> GetEvents(GamePair gamePair) { try { Player p = gamePair.Player; string Id = gamePair.Id; Game game = null; if (GameManager.Games.ContainsKey(Id)) game = GameManager.Games[Id]; else return BadRequest(); var result = game.GetCurrentEvents(); return Ok(JsonConvert.SerializeObject(game.GetCurrentEvents().ToArray())); } catch (Exception ex) { return null; } }
public ActionResult<Player> StartGame(GamePair gamePair) { try { Player p = gamePair.Player; string Id = gamePair.Id; p.Place = PlaceType.Home; p.Company = CompanyType.Alone; Game game = new Game(); game.p = p; if (!GameManager.Games.ContainsKey(Id)) GameManager.Games.Add(Id, game); return p; } catch (Exception ex) { return null; } //return GameManager.Games["1"].p; }