private void UpdateClientStatus(object state) { UniversalGameStatus = new GameStatus(GameStatusEnum.GAMEON, 30); Broadcaster.DisableGamePlay = false; Application["CurrentGridSolution"] = CurrentGridSolution = null; CurrentServedObject = new ServedObject { Status = MvcApplication.UniversalGameStatus, Grid = CurrentGrid, TotalWords = lst[servedGridIndex-1].Solution.Count() }; GlobalHost.ConnectionManager.GetHubContext<MoveShapeHub>().Clients.All.StartNewGame(CurrentServedObject); gameStatusTimer.Stop(); }
private void GenerateNewGrid(object state) { var curGrid = lst[servedGridIndex++]; LatestServedTime = DateTime.Now.AddSeconds(30); UniversalGameStatus = new GameStatus(GameStatusEnum.SCOREDISPLAY, 30); gameStatusTimer.Start(); Application["CurrentGrid"] = CurrentGrid = curGrid.Grid; Application["CurrentGridSolution"] = CurrentGridSolution = servedGridIndex > 1 ? lst[servedGridIndex - 2].Solution : null;// distribute results of the previous grid Broadcaster.DisableGamePlay = true; CurrentServedObject = new ServedObject { Status = MvcApplication.UniversalGameStatus, Solution = MvcApplication.CurrentGridSolution }; GlobalHost.ConnectionManager.GetHubContext<MoveShapeHub>().Clients.All.DisableGamePlay(CurrentServedObject); curGrid.Grid.ServedOn = LatestServedTime; if ((lst.Count() - servedGridIndex) < 10) Task.Factory.StartNew(new Action(AddNewGrids)); }