コード例 #1
0
        public void OpenGameMenu()
        {
            Guard.Against(GameMode.CurrentMode == EngineMode.MenuOpen);

            MenuConsole.Clear();
            MenuConsole.Print(2, 4, GameInProgress ? "R) Return to game" : "B) Begin new game");
            MenuConsole.Print(2, 6, "S) Save game");
            MenuConsole.Print(2, 8, "L) Load game");
            MenuConsole.Print(2, 10, "Q) Quit");

            MenuWindow.Show();
            GameMode.PushEngineMode(EngineMode.MenuOpen, null);
        }
コード例 #2
0
ファイル: MenuScreen.cs プロジェクト: Harkonan/MeerJager
        public void RenderMenuOptions()
        {
            MenuConsole.Clear();


            int StartLine = 1;

            foreach (var option in Menu)
            {
                string OptionText = string.Format("{0} [{1}]", option.Display, (option.Key.ToString().Length > 1 ? option.Key.ToString().TrimStart('D') : option.Key.ToString()));
                int    Lines      = (int)System.Math.Ceiling((double)OptionText.Length / (double)MenuConsole.Width);

                Color background = option.Selected ? option.Forground : option.Background;
                Color forground  = option.Selected ? option.Background : option.Forground;

                MenuConsole.Print(0, StartLine, OptionText, forground, background);
                option.X = 0;
                option.Y = StartLine;

                StartLine += Lines + 1;
            }
        }