Example #1
0
        private void MenuBarGame(object sender, EventArgs args)
        {
            bool debugMenu = Settings.DebugMenu;
            int  quitItem  = 8;

            _gameMenu = new GameMenu(_canvas.Palette);
            _gameMenu.Items.Add(new GameMenu.Item("Tax Rate"));
            _gameMenu.Items.Add(new GameMenu.Item("Luxuries Rate"));
            _gameMenu.Items.Add(new GameMenu.Item("FindCity"));
            _gameMenu.Items.Add(new GameMenu.Item("Options"));
            _gameMenu.Items.Add(new GameMenu.Item("Save Game")
            {
                Enabled = (Game.GameTurn > 0)
            });
            _gameMenu.Items.Add(new GameMenu.Item("REVOLUTION!"));
            _gameMenu.Items.Add(new GameMenu.Item(null));
            if (debugMenu)
            {
                quitItem += 2;
                _gameMenu.Items.Add(new GameMenu.Item("Debug Options"));
                _gameMenu.Items.Add(new GameMenu.Item(null));
                _gameMenu.Items[7].Selected += (s, a) => GameTask.Enqueue(Show.Screen <DebugOptions>());
            }
            _gameMenu.Items.Add(new GameMenu.Item("Retire")
            {
                Enabled = false
            });
            _gameMenu.Items.Add(new GameMenu.Item("QUIT to DOS"));

            _gameMenu.Items[0].Selected        += (s, a) => GameTask.Enqueue(Show.TaxRate);
            _gameMenu.Items[1].Selected        += (s, a) => GameTask.Enqueue(Show.LuxuryRate);
            _gameMenu.Items[2].Selected        += (s, a) => GameTask.Enqueue(Show.Search);
            _gameMenu.Items[3].Selected        += (s, a) => GameTask.Enqueue(Show.Screen <GameOptions>());
            _gameMenu.Items[4].Selected        += (s, a) => GameTask.Enqueue(Show.Screen <SaveGame>());
            _gameMenu.Items[5].Selected        += (s, a) => GameTask.Enqueue(Show.Screen <Revolution>());
            _gameMenu.Items[quitItem].Selected += (s, a) => GameTask.Enqueue(Show.Screen <ConfirmQuit>());

            _menuX = 16;
            _menuY = 8;

            _update = true;
        }
Example #2
0
        public override bool MouseUp(ScreenEventArgs args)
        {
            if (_gameMenu == null)
            {
                return(false);
            }
            if (args.Y < 8)
            {
                _menuBar.MouseDown(args);
                if (!_menuBar.MenuDrag)
                {
                    _gameMenu.KeepOpen = true;
                    return(true);
                }
            }

            _gameMenu.MouseUp(args);
            _gameMenu = null;
            _redraw   = true;
            return(true);
        }
Example #3
0
        private void MenuBarWorld(object sender, EventArgs args)
        {
            _gameMenu = new GameMenu(_canvas.Palette);
            _gameMenu.Items.Add(new GameMenu.Item("Wonders of the World (F7)"));
            _gameMenu.Items.Add(new GameMenu.Item("Top 5 Cities (F8)"));
            _gameMenu.Items.Add(new GameMenu.Item("Civilization Score (F9)"));
            _gameMenu.Items.Add(new GameMenu.Item("World Map (F10)"));
            _gameMenu.Items.Add(new GameMenu.Item("Demographics"));
            _gameMenu.Items.Add(new GameMenu.Item("SpaceShips")
            {
                Enabled = false
            });

            _gameMenu.Items[2].Selected += (s, a) => Common.AddScreen(new CivilizationScore());
            _gameMenu.Items[3].Selected += (s, a) => Common.AddScreen(new WorldMap());

            _menuX = 144;
            _menuY = 8;

            _update = true;
        }
Example #4
0
        private void MenuBarCivilopedia(object sender, EventArgs args)
        {
            _gameMenu = new GameMenu(_canvas.Palette);
            _gameMenu.Items.Add(new GameMenu.Item("Complete"));
            _gameMenu.Items.Add(new GameMenu.Item("Civilization Advances"));
            _gameMenu.Items.Add(new GameMenu.Item("City Improvements"));
            _gameMenu.Items.Add(new GameMenu.Item("Military Units"));
            _gameMenu.Items.Add(new GameMenu.Item("Terrain Types"));
            _gameMenu.Items.Add(new GameMenu.Item("Miscellaneous"));

            _gameMenu.Items[0].Selected += (s, a) => Common.AddScreen(new Civilopedia(Civilopedia.Complete));
            _gameMenu.Items[1].Selected += (s, a) => Common.AddScreen(new Civilopedia(Civilopedia.Advances));
            _gameMenu.Items[2].Selected += (s, a) => Common.AddScreen(new Civilopedia(Civilopedia.Improvements));
            _gameMenu.Items[3].Selected += (s, a) => Common.AddScreen(new Civilopedia(Civilopedia.Units));
            _gameMenu.Items[4].Selected += (s, a) => Common.AddScreen(new Civilopedia(Civilopedia.TerrainType));
            _gameMenu.Items[5].Selected += (s, a) => Common.AddScreen(new Civilopedia(Civilopedia.Misc));

            _menuX = 182;
            _menuY = 8;

            _update = true;
        }
Example #5
0
        private void MenuBarAdvisors(object sender, EventArgs args)
        {
            _gameMenu = new GameMenu(_canvas.Palette);
            _gameMenu.Items.Add(new GameMenu.Item("City Status (F1)"));
            _gameMenu.Items.Add(new GameMenu.Item("Military Advisor (F2)"));
            _gameMenu.Items.Add(new GameMenu.Item("Intelligence Advisor (F3)"));
            _gameMenu.Items.Add(new GameMenu.Item("Attitude Advisor (F4)"));
            _gameMenu.Items.Add(new GameMenu.Item("Trade Advisor (F5)"));
            _gameMenu.Items.Add(new GameMenu.Item("Science Advisor (F6)"));

            _gameMenu.Items[0].Selected += (s, a) => Common.AddScreen(new CityStatus());
            _gameMenu.Items[1].Selected += (s, a) => { Common.AddScreen(new MilitaryLosses()); Common.AddScreen(new MilitaryStatus()); };
            _gameMenu.Items[2].Selected += (s, a) => Common.AddScreen(new IntelligenceReport());
            _gameMenu.Items[3].Selected += (s, a) => Common.AddScreen(new AttitudeSurvey());
            _gameMenu.Items[4].Selected += (s, a) => Common.AddScreen(new TradeReport());
            _gameMenu.Items[5].Selected += (s, a) => Common.AddScreen(new ScienceReport());

            _menuX = 112;
            _menuY = 8;

            _update = true;
        }
Example #6
0
        private void MenuBarGame(object sender, EventArgs args)
        {
            _gameMenu = new GameMenu("MenuBarGame", Palette.Copy());
            _gameMenu.Items.Add("Tax Rate").OnSelect((s, a) => GameTask.Enqueue(Show.TaxRate));
            _gameMenu.Items.Add("Luxuries Rate").OnSelect((s, a) => GameTask.Enqueue(Show.LuxuryRate));
            _gameMenu.Items.Add("FindCity").OnSelect((s, a) => GameTask.Enqueue(Show.Search));
            _gameMenu.Items.Add("Options").OnSelect((s, a) => GameTask.Enqueue(Show.Screen <GameOptions>()));
            _gameMenu.Items.Add("Save Game").SetEnabled(Game.GameTurn > 0).OnSelect((s, a) => GameTask.Enqueue(Show.Screen <SaveGame>()));
            _gameMenu.Items.Add("REVOLUTION!").OnSelect((s, a) => GameTask.Enqueue(Show.Screen <Revolution>()));
            _gameMenu.Items.Add(null);
            if (Settings.DebugMenu)
            {
                _gameMenu.Items.Add("Debug Options").OnSelect((s, a) => GameTask.Enqueue(Show.Screen <DebugOptions>()));
                _gameMenu.Items.Add(null);
            }
            _gameMenu.Items.Add("Retire").Disable();
            _gameMenu.Items.Add("QUIT to DOS").OnSelect((s, a) => GameTask.Enqueue(Show.Screen <ConfirmQuit>()));

            _menuX = 16;
            _menuY = 8;

            _update = true;
        }
Example #7
0
        private void MenuBarWorld(object sender, EventArgs args)
        {
            _gameMenu = new GameMenu("MenuBarWorld", Palette);
            _gameMenu.Items.Add("Wonders of the World (F7)").OnSelect((s, a) => {
                if (Game.BuiltWonders.Length == 0)
                {
                    GameTask.Enqueue(Show.Empty);
                }
                else
                {
                    Common.AddScreen(new WorldWonders());
                }
            });
            _gameMenu.Items.Add("Top 5 Cities (F8)").OnSelect((s, a) => Common.AddScreen(new TopCities()));;
            _gameMenu.Items.Add("Civilization Score (F9)").OnSelect((s, a) => Common.AddScreen(new CivilizationScore()));
            _gameMenu.Items.Add("World Map (F10)").OnSelect((s, a) => Common.AddScreen(new WorldMap()));
            _gameMenu.Items.Add("Demographics").OnSelect((s, a) => Common.AddScreen(new Demographics()));
            _gameMenu.Items.Add("SpaceShips").Disable();

            _menuX = 144;
            _menuY = 8;

            _update = true;
        }
Example #8
0
        public override bool KeyDown(KeyboardEventArgs args)
        {
            if (GameTask.Any())
            {
                return(true);
            }

            if (CheckShift56(args))
            {
                return(true);
            }

            if (_gameMenu != null)
            {
                if (!_gameMenu.KeyDown(args))
                {
                    _gameMenu = null;
                    _redraw   = true;
                }
                return(true);
            }

            if (_menuBar.KeyDown(args) && _gameMenu != null)
            {
                _gameMenu.KeepOpen = true;
                return(true);
            }

            switch (args.Key)
            {
            case Key.F1:
                Common.AddScreen(new CityStatus());
                return(true);

            case Key.F2:
                Common.AddScreen(new MilitaryLosses());
                Common.AddScreen(new MilitaryStatus());
                return(true);

            case Key.F3:
                Common.AddScreen(new IntelligenceReport());
                return(true);

            case Key.F4:
                Common.AddScreen(new AttitudeSurvey());
                return(true);

            case Key.F5:
                Common.AddScreen(new TradeReport());
                return(true);

            case Key.F6:
                Common.AddScreen(new ScienceReport());
                return(true);

            case Key.F7:
                if (Game.BuiltWonders.Length == 0)
                {
                    GameTask.Enqueue(Show.Empty);
                }
                else
                {
                    Common.AddScreen(new WorldWonders());
                }
                return(true);

            case Key.F8:
                Common.AddScreen(new TopCities());
                return(true);

            case Key.F9:
                Common.AddScreen(new CivilizationScore());
                return(true);

            case Key.F10:
                Common.AddScreen(new WorldMap());
                return(true);

            case Key.Plus:
                GameTask.Enqueue(Show.TaxRate);
                return(true);

            case Key.Minus:
                GameTask.Enqueue(Show.LuxuryRate);
                return(true);

            case Key.Slash:
                GameTask.Enqueue(Show.Search);
                return(true);
            }
            return(_gameMap.KeyDown(args));
        }