示例#1
0
        public Board GetOpponentBoard([FromBody] string playerName)
        {
            Player p = gameObj.GetOpponent(playerName);

            if (p != null)
            {
                return(p.PlayerBoard);
            }

            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));
        }