Exemple #1
0
        public void StartGame()
        {
            SetupGameModes(Game.Instance);

            // Generate map tile graphics
            Images.MapTileGraphic = new Bitmap[Map.XDim, Map.YDim];
            for (var col = 0; col < Map.XDim; col++)
            {
                for (var row = 0; row < Map.YDim; row++)
                {
                    Images.MapTileGraphic[col, row] = Draw.MakeTileGraphic(Map.Tile[col, row], col, row, Game.Options.FlatEarth, MapImages.Terrains[Map.MapIndex]);
                }
            }

            foreach (MenuItem item in Menu.Items)
            {
                item.Enabled = true;
            }

            minimapPanel   = new MinimapPanel(this, MiniMapWidth, MiniMapHeight, Game.Instance);
            _mapPanelWidth = ClientSize.Width - MiniMapWidth;
            layout.Add(minimapPanel, _mapPanelWidth, 0);

            mapPanel = new MapPanel(this, _mapPanelWidth, ClientSize.Height, minimapPanel.Update);
            layout.Add(mapPanel, 0, 0);

            StatusPanel = new StatusPanel(this, MiniMapWidth, ClientSize.Height - MiniMapHeight);
            layout.Add(StatusPanel, _mapPanelWidth, MiniMapHeight);

            Content = layout;

            Game.OnPlayerEvent += (sender, e) =>
            {
                if (Game.GetActiveCiv == Game.GetPlayerCiv)
                {
                    CurrentGameMode = Game.GetActiveCiv.AnyUnitsAwaitingOrders ? Moving : ViewPiece;
                }
                else
                {
                    CurrentGameMode = Processing;
                }
            };
            _cheatCommands.ForEach(c =>
            {
                if (c != _openLuaConsoleCommand)
                {
                    c.Enabled = Game.Options.CheatMenu;
                }
            });

            SetupOrders(Game.Instance);

            SizeChanged += OnSizeChanged;

            BringToFront();
        }
Exemple #2
0
        public void LoadGameInitialization(string directoryPath, string SAVname)
        {
            suppressKeyEvent = false;

            Game.LoadGame(directoryPath, SAVname);
            Images.LoadGraphicsAssetsFromFiles(directoryPath);

            // Generate map tile graphics
            Images.MapTileGraphic = new Bitmap[Map.Xdim, Map.Ydim];
            for (int col = 0; col < Map.Xdim; col++)
            {
                for (int row = 0; row < Map.Ydim; row++)
                {
                    Images.MapTileGraphic[col, row] = Draw.MakeTileGraphic(Map.Tile[col, row], col, row, Game.Options.FlatEarth);
                }
            }

            //ViewPieceMode = Game.ActiveUnit == null;

            choiceMenu.Visible = false;
            choiceMenu.Dispose();
            choiceMenu = null;
            sinaiPanel.Dispose();
            sinaiPanel = null;
            foreach (MenuItem item in this.Menu.Items)
            {
                item.Enabled = true;
            }

            mapPanel = new MapPanel(this, ClientSize.Width - 262, ClientSize.Height);
            layout.Add(mapPanel, 0, 0);

            minimapPanel = new MinimapPanel(this, 262, 149);
            layout.Add(minimapPanel, ClientSize.Width - 262, 0);

            statusPanel = new StatusPanel(this, 262, ClientSize.Height - 148);
            layout.Add(statusPanel, ClientSize.Width - 262, 148);

            Content = layout;

            ////ZoomInItem.Click += MapPanel.ZoomINclicked;
            ////ZoomOutItem.Click += MapPanel.ZoomOUTclicked;
            ////MaxZoomInItem.Click += MapPanel.MaxZoomINclicked;
            ////MaxZoomOutItem.Click += MapPanel.MaxZoomOUTclicked;
            ////StandardZoomItem.Click += MapPanel.StandardZOOMclicked;
            ////MediumZoomOutItem.Click += MapPanel.MediumZoomOUTclicked;
            //StatusPanel.OnMapEvent += MapEventHappened;
            ////MapPanel.OnMapEvent += MapEventHappened;
        }