public Ship GetNextShipToPlace([FromBody] string playerName) { Player p = gameObj.GetPlayer(playerName); if (p != null) { if (p.ShipsToPlace.Count > 0) { return(p.ShipsToPlace.Last()); } } return(null); }
public ActionResult Index() { ViewBag.Title = "Battleship Game"; if (Request.Cookies["playerName"] != null) { string playerName = Request.Cookies["playerName"].Value; currentPlayer = gameObj.GetPlayer(playerName); opponentPlayer = gameObj.GetOpponent(playerName); } ViewData["lbl_currentPlayer"] = lbl_currentPlayer; ViewData["lbl_opponent"] = lbl_opponent; return(View(WebApiApplication.BattleshipGameObj)); }