Ejemplo n.º 1
0
 // GET: Room
 public ActionResult Index(Lobby lobby)
 {
     var cookie = Request.Cookies["userid"];
     if (cookie == null)
         return Redirect("/");
     ViewBag.RoomContainer = lobby;
     var username = FormsAuthentication.Decrypt(cookie.Value).Name;
     var currentUser = lobby.GetPlayerByName(username);
     var room = currentUser?.Room;
     ViewBag.CanJoin = room == null || !room.IsFull;
     ViewBag.CurrentUser = currentUser;
     return View();
 }
Ejemplo n.º 2
0
        // GET: Game
        public ActionResult Index(Lobby lobby)
        {
            var cookie = Request.Cookies["userid"];
            if (cookie == null)
                return Redirect("/");
            var userName = FormsAuthentication.Decrypt(cookie.Value).Name;
            var currentPlayer = lobby.GetPlayerByName(userName);
            var room = currentPlayer?.Room;
            if (room == null)
                return RedirectToRoute(new {controller="Home"});
            var gameSession = room.CreateGameSession();
            ViewBag.Player =  gameSession.Players.Single(p => p.Name == userName);

            Response.CacheControl = "no-cache";
            return View(gameSession);
        }
Ejemplo n.º 3
0
 public LobbyHub(Lobby lobby)
 {
     _lobby = lobby;
 }
Ejemplo n.º 4
0
 public GameHub(Lobby lobby)
 {
     _lobby = lobby;
 }