AIsOfCatan.GameState.GetLatestEvents C# (CSharp) Метод

GetLatestEvents() публичный Метод

public GetLatestEvents ( int amount ) : List
amount int
Результат List
        public List<LogEvent> GetLatestEvents(int amount)
        {
            return log.Skip(Math.Max(0, log.Count() - amount)).Take(amount).ToList();
        }

Usage Example

Пример #1
0
        public MapScreen(GameState initial)
        {
            latestGameState = initial;

            for (int i = 0; i < board.Length; i++)
            {
                board[i] = new GUITile[Board.GetRowLength(i)];

                for (int j = 0; j < board[i].Length; j++)
                {
                    bool    omit = OmittedTile(GetTerrainIndex(i, j));
                    GUITile tile = new GUITile(j, i, latestGameState.Board.GetTile(i, j), omit);
                    AddDrawableComponent(tile);
                    board[i][j] = tile;
                }
            }

            //Entire Screen size: GraphicsAdapter.DefaultAdapter.CurrentDisplayMode


            const int logWidth = 350;

            //int gameH = graphics.Viewport.Height;
            //int gameW = graphics.Viewport.Width;
            const int screenWidth  = 1280;
            const int screenHeight = 720;

            //Debug.WriteLine(string.Format("width {0}, height {1}", gameW, gameH));

            gamelog = new GUILogList <GUIBufferTextBlock>(new Vector2((screenWidth - logWidth) / TXAGame.SCALE, 1 / TXAGame.SCALE), screenHeight - 2, logWidth - 1);

            //AddButton(new TXAButton(new Vector2(750 / TXAGame.SCALE, 50 / TXAGame.SCALE), "Debug Log"), InsertText);

            AddDrawableComponent(gamelog);

            robber = new GUIRobber(GetRobberPos());

            AddDrawableComponent(robber);

            latestGameState.GetLatestEvents(int.MaxValue).Skip(gamelog.Count).ForEach(a => InsertLogEvent(a.ToString()));
            //lastLogPoll = DateTime.Now;

            //Test Roads and pieces
            UpdateGameState(initial);
        }
All Usage Examples Of AIsOfCatan.GameState::GetLatestEvents