public void DisConnect(WCFGameUser clientUser) { if (!clientUser.CheckIn()) { return; } DisConnectTask(clientUser); }
public List <WCFGameUser> GetUserInfo(WCFGameUser clientUser) { if (clientUser == null || !clientUser.CheckIn()) { return(null); } return(TaskFactory.StartNew(() => { try { using (Agot2p6Entities dbContext = new Agot2p6Entities()) { var user = dbContext.GameUser.SingleOrDefault(p => p.Id == clientUser.Id); if (user == null || !clientUser.Check(user)) { return null; } user.LastUpdate = DateTimeOffset.UtcNow; var game = user.Game1; List <WCFGameUser> result = game.GameUser.Select(p => p.ToWCFGameUser(user, clientUser)).ToList(); if (game.OpenTime == null && result.Where(p => !string.IsNullOrEmpty(p.HomeType)).All(p => !string.IsNullOrEmpty(p.Login) && p.OnLineStatus)) { game.HomeUsersSL.ForEach(p => GamePortalServer.StartUserGame(p.Login, p.HomeType, game.Id, game.Type + (game.RandomIndex > 0 || game.IsRandomSkull ? 1 : 0))); game.OpenTime = DateTimeOffset.UtcNow; game.NewThink(); } dbContext.SaveChanges(); #if DEBUG /*var xml = new PublicFileJson<List<WCFGameUser>>("GetUserInfo.txt"); * xml.Value = result; * xml.Write();*/ #endif return result; } } catch (Exception exp) { GameException.NewGameException(clientUser.Game, "Не удалось подготовить спискок игроков.", exp, false); return null; } }).Result); }
public void DisConnect(WCFGameUser clientUser) { TaskFactory.StartNew(() => { try { if (!clientUser.CheckIn()) { return; } DisConnectTask(clientUser); } catch (Exception exp) { GameException.NewGameException(clientUser.Game, "Не удалось отключиться от игры.", exp, false); } }); }
// GameService.GameHost+<>c__DisplayClass60_0.<GetUserInfo>b__0 47 245 13 9,07% 0,00% public List <WCFGameUser> GetUserInfo(WCFGameUser clientUser) { return(TaskFactory.StartNew(() => { try { if (clientUser == null || !clientUser.CheckIn()) { return null; } using (Agot2p6Entities dbContext = new Agot2p6Entities()) { GameUser user = dbContext.GameUser.SingleOrDefault(p => p.Id == clientUser.Id); if (user == null || !clientUser.Check(user)) { return null; } user.LastUpdate = DateTimeOffset.UtcNow; Game game = user.Game1; List <WCFGameUser> result = game.GameUser.Select(p => p.ToWCFGameUser(user, clientUser)).ToList(); dbContext.SaveChanges(); #if DEBUG /*var xml = new PublicFileJson<List<WCFGameUser>>("GetUserInfo.txt"); * xml.Value = result; * xml.Write();*/ #endif return result; } } catch (Exception exp) { GameException.NewGameException(clientUser.Game, "Не удалось подготовить спискок игроков.", exp, false); return null; } }).Result); }