Exemplo n.º 1
0
        public List <BattleExtented> GetListBattles(string sessionId)
        {
            HackJsonp();
            List <BattleExtented> toReturn = new List <BattleExtented>();

            try
            {
                var session   = sessionManager.GetSession(sessionId, false);
                var allBattle = gameManager.GetAllBattles(session.PlayerInBattle.Player).Select(o => o.Battle).ToList();
                foreach (var battle in allBattle)
                {
                    List <Player>  playersInGame = new List <Player>();
                    BattleExtented battleEx      = new BattleExtented()
                    {
                        Battle = battle
                    };
                    foreach (int playerId in battle.Players)
                    {
                        var player = playerManager.Get(playerId);
                        playersInGame.Add(new Player()
                        {
                            Login    = player.Login,
                            PlayerId = playerId
                        }
                                          );
                    }
                    battleEx.InGame = playersInGame;
                    toReturn.Add(battleEx);
                }
                return(toReturn);
            }
            catch (Exception e)
            {
                // J'ai pas trouvé mieux POUR l'instant.
                // Hello, je suis repassé par là, en fait c'est pas mal, non?
                throw  e;
            }
        }
Exemplo n.º 2
0
 public List<BattleExtented> GetListBattles(string sessionId)
 {
     HackJsonp();
     List<BattleExtented> toReturn = new List<BattleExtented>();
     try
     {
         var session = sessionManager.GetSession(sessionId, false);
         var allBattle = gameManager.GetAllBattles(session.PlayerInBattle.Player).Select(o => o.Battle).ToList();
         foreach (var battle in allBattle)
         {
             List<Player> playersInGame = new List<Player>();
             BattleExtented battleEx = new BattleExtented()
             {
                 Battle = battle
             };
             foreach (int playerId in battle.Players)
             {
                 var player = playerManager.Get(playerId);
                 playersInGame.Add(new Player()
                 {
                     Login = player.Login,
                     PlayerId = playerId
                 }
                 );
             }
             battleEx.InGame = playersInGame;
             toReturn.Add(battleEx);
         }
         return toReturn;
     }
     catch (Exception e)
     {
         // J'ai pas trouvé mieux POUR l'instant.
         // Hello, je suis repassé par là, en fait c'est pas mal, non?
         throw  e;
     }
 }