/// <summary> /// Zwróć rozmieszczenie wszystkich bonusów dla zadanej gry. /// </summary> /// <param name="gameDao">gra</param> /// <param name="message">wiadomośc, przekazywana w razie porażki</param> /// <returns></returns> public static List <BoardElementLocationDao> GetAllBonusesForGame(GameDao gameDao, out String message) { try { message = null; List <BoardElementLocationDao> bonuses = new List <BoardElementLocationDao>(); var query = from element in DataManager.DataBaseContext.BoardElementLocations where (element.BoardElement.ElementType == BoardElementType.BombAmountBonus || element.BoardElement.ElementType == BoardElementType.FastBonus || element.BoardElement.ElementType == BoardElementType.InmortalBonus || element.BoardElement.ElementType == BoardElementType.PointBonus || element.BoardElement.ElementType == BoardElementType.SlowBonus || element.BoardElement.ElementType == BoardElementType.StrenghtBonus) && element.Game.Id == gameDao.Id select element; BoardElementLocation[] bElements = query.ToArray(); for (int i = 0; i < bElements.Length; i++) { BoardElementLocationDao block = Mapper.Map <BoardElementLocationDao>(bElements[i]); bonuses.Add(block); } return(bonuses); } catch (Exception e) { var declaringType = MethodBase.GetCurrentMethod().DeclaringType; if (declaringType != null) { Logger.LogMessage(declaringType.Name, MethodBase.GetCurrentMethod().Name, e.StackTrace); } message = e.Message; } return(null); }
/// <summary> /// Zwróć wszystkie jednostkowe pola dla danej gry. /// </summary> /// <param name="gameDao">gra</param> /// <param name="message">wiadomośc, przekazywana w razie porażki</param> /// <returns></returns> public static List <BoardElementLocationDao> GetAllBlocksForGame(GameDao gameDao, out String message) { try { message = null; List <BoardElementLocationDao> blocks = new List <BoardElementLocationDao>(); var query = from element in DataManager.DataBaseContext.BoardElementLocations where element.Game.Id == gameDao.Id && (element.BoardElement.ElementType == BoardElementType.BlackBlock || element.BoardElement.ElementType == BoardElementType.GrayBlock || element.BoardElement.ElementType == BoardElementType.WhiteBlock || element.BoardElement.ElementType == BoardElementType.RedBlock) orderby element.XLocation, element.YLocation select element; BoardElementLocation[] bElements = query.ToArray(); for (int i = 0; i < bElements.Length; i++) { BoardElementLocationDao block = Mapper.Map <BoardElementLocation, BoardElementLocationDao>(bElements[i]); blocks.Add(block); } return(blocks); } catch (Exception e) { var declaringType = MethodBase.GetCurrentMethod().DeclaringType; if (declaringType != null) { Logger.LogMessage(declaringType.Name, MethodBase.GetCurrentMethod().Name, e.StackTrace); } message = e.Message; } return(null); }