Beispiel #1
0
        public PacManUI(Game game, IDictionary <string, Action> buttons,
                        IDictionary <Keys, Action> keyMappings, ScorePanel.ScoreFormatter sf) : base()
        {
            System.Diagnostics.Debug.Assert(game != null);
            System.Diagnostics.Debug.Assert(buttons != null);
            System.Diagnostics.Debug.Assert(keyMappings != null);

            keys       = new PacKeyListener(keyMappings);
            KeyPreview = true;

            scorePanel = new ScorePanel(game.Players);
            if (sf != null)
            {
                scorePanel.setScoreFormatter(sf);
            }
            boardPanel = new BoardPanel(game);
            Panel buttonPanel = new ButtonPanel(buttons, this);

            Controls.Add(scorePanel);
            Controls.Add(boardPanel);
            Controls.Add(buttonPanel);
            DoVerticalLayout();
        }
Beispiel #2
0
 public PacManUiBuilder withScoreFormatter(ScorePanel.ScoreFormatter sf)
 {
     scoreFormatter = sf;
     return(this);
 }