コード例 #1
0
        public MapHandler(TerminalControl terminalCtl, WindowsFormsHost mapHost, Game game)
        {
            _terminal            = new Terminal(ColumnCount, RowCount);
            terminalCtl.Terminal = _terminal;
            _mapHost             = mapHost;
            _charWidth           = terminalCtl.GlyphSheet.Width;
            _charHeight          = terminalCtl.GlyphSheet.Height;
            _game = game;
            _game.HeroMoveEvent += HandleCreatureMoveEvent;
            _game.AttackEvent   += GameAttackEvent;
            NewLevelCommand levelCommand = new NewLevelCommand
            {
                Width   = ColumnCount,
                Height  = RowCount,
                FOVRows = 20,
                Filter  = (locHero, locSite) => MapCoordinates.Within(locHero, locSite, 15, 10, 12),
                Level   = 0
            };

            _game.EnqueueAndProcess(levelCommand);
            terminalCtl.Size = terminalCtl.GetPreferredSize(new System.Drawing.Size());
            _mainWindow      = (MainWindow)Application.Current.MainWindow;
        }