コード例 #1
0
        private void DrawChooseHeroFromConsole(int choice, Hero hero)
        {
            Drawer draw = new Drawer();
            string choicePointer = "==>";

            Console.ResetColor();
            Console.Clear();

            draw.DrawString("Choose your hero!", ConsoleColor.Black, 5, 5);

            draw.DrawString("Warrior", ConsoleColor.Black, 8, 8);
            draw.DrawString("Rogue", ConsoleColor.Black, 10, 8);
            draw.DrawString("Mage", ConsoleColor.Black, 12, 8);

            draw.DrawString(choicePointer, ConsoleColor.DarkMagenta, (6 + choice * 2), 4);

            draw.DrawImage(hero.Image,ConsoleColor.Black,15,4);

            draw.DrawString("Strength: " + hero.Statistics.Strength, ConsoleColor.Black, 33, 55);
            draw.DrawString("Dexterity: " + hero.Statistics.Dexterity, ConsoleColor.Black, 35, 55);
            draw.DrawString("Willpower: " + hero.Statistics.EillPower, ConsoleColor.Black, 37, 55);

            draw.DrawString("Weapon: " + hero.Weapon.name, ConsoleColor.Black, 20, 55);
            draw.DrawString("Weapon Damage: " + hero.Weapon.damage, ConsoleColor.Black, 21, 55);

            draw.DrawString("Magic: " + hero.Weapon.magic.Name, ConsoleColor.Black, 23, 55);
            draw.DrawString("Magic Damage: " + hero.Weapon.magic.damage, ConsoleColor.Black, 24, 55);
            draw.DrawString("Magic Damage on Self: " + hero.Weapon.magic.damageOnSelf, ConsoleColor.Black, 25, 55);
            draw.DrawString("Magic Chance to Stun: " + hero.Weapon.magic.chanceToStun, ConsoleColor.Black, 26, 55);

            Console.SetCursorPosition(0, 0);
        }
コード例 #2
0
        public void DrawConversation(Hero hero, NPC npc)
        {
            Drawer draw = new Drawer();

            Console.BackgroundColor = ConsoleColor.Black;
            Console.Clear();
            draw.DrawImage(hero.Image, ConsoleColor.Black, 5, 5);
            draw.DrawImage(npc.Image, ConsoleColor.Black, 5, 55);

            draw.PrintConversation(npc.ConversationPath);

            Console.ReadLine();
            Console.Clear();
            Console.ResetColor();
            // the matrix must be rewriten now
        }
コード例 #3
0
        private static void DrawChoosen(int choice)
        {
            Drawer draw = new Drawer();
            Images startImage = new Images();
            string choicePointer = "==>";

            Console.ResetColor();
            Console.Clear();
            draw.DrawImage(startImage.IntroText, ConsoleColor.Black, 5, 10);
            draw.DrawString("New Game", ConsoleColor.Black, 24, 40);
            draw.DrawString("Load Game", ConsoleColor.Black, 26, 40);
            draw.DrawString("Exit", ConsoleColor.Black, 28, 40);

            draw.DrawString(choicePointer, ConsoleColor.DarkMagenta, (22 + choice * 2), 35);

            Console.SetCursorPosition(0, 0);
        }
コード例 #4
0
 private string GetHeroName()
 {
     Drawer draw = new Drawer();
     draw.DrawString("Name your hero:", ConsoleColor.DarkGray, 10, 45);
     Console.SetCursorPosition(62, 10);
     Console.ResetColor();
     string name = Console.ReadLine();
     while (string.IsNullOrWhiteSpace(name))
     {
         Console.SetCursorPosition(62, 10);
         name = Console.ReadLine();
     }
     return name;
 }
コード例 #5
0
        private void DrawMenuInConsole(Hero hero, Weapon weapon)
        {
            Drawer draw = new Drawer();

            Console.ResetColor();
            Console.Clear();

            string message = "You have found a new weapon!";
            draw.DrawString(message, ConsoleColor.Black,
                6, Console.WindowWidth / 2 - message.Length / 2);

            message = "The weapon is " + weapon.name + " and it's damage is " + weapon.damage;
            draw.DrawString(message, ConsoleColor.Black,
                10, Console.WindowWidth / 2 - message.Length / 2);

            message = "The weapon's magic is " + weapon.magic.Name + " and it's effects are: ";
            draw.DrawString(message, ConsoleColor.Black,
                11, Console.WindowWidth / 2 - message.Length / 2);

            int line = 13;
            if (weapon.magic.damage > 0)
            {
                message = "Damage: " + weapon.magic.damage;
                draw.DrawString(message, ConsoleColor.Black,
                    line, Console.WindowWidth / 2 - message.Length / 2);
                line++;
            }
            if (weapon.magic.damageOnSelf != 0)
            {
                if (weapon.magic.damageOnSelf > 0)
                {
                    message = "Damage on self: " + weapon.magic.damageOnSelf;
                    draw.DrawString(message, ConsoleColor.Black,
                        line, Console.WindowWidth / 2 - message.Length / 2);
                    line++;
                }
                else
                {
                    message = "Heal: " + (0 - weapon.magic.damageOnSelf);
                    draw.DrawString(message, ConsoleColor.Black,
                        line, Console.WindowWidth / 2 - message.Length / 2);
                    line++;
                }
            }
            if (weapon.magic.chanceToStun > 0)
            {
                message = "Chance to stun: " + (100 * weapon.magic.chanceToStun) + "%";
                draw.DrawString(message, ConsoleColor.Black,
                    line, Console.WindowWidth / 2 - message.Length / 2);
                line++;
            }

            message = "Your current weapon is " + hero.Weapon.name + " and it's damage is " + hero.Weapon.damage;
            draw.DrawString(message, ConsoleColor.Black,
                17, Console.WindowWidth / 2 - message.Length / 2);

            message = "The weapon's magic is " + hero.Weapon.magic.Name + " and it's effects are: ";
            draw.DrawString(message, ConsoleColor.Black,
                18, Console.WindowWidth / 2 - message.Length / 2);

            line = 20;
            if (hero.Weapon.magic.damage > 0)
            {
                message = "Damage: " + hero.Weapon.magic.damage;
                draw.DrawString(message, ConsoleColor.Black,
                    line, Console.WindowWidth / 2 - message.Length / 2);
                line++;
            }
            if (hero.Weapon.magic.damageOnSelf != 0)
            {
                if (hero.Weapon.magic.damageOnSelf > 0)
                {
                    message = "Damage on self: " + hero.Weapon.magic.damageOnSelf;
                    draw.DrawString(message, ConsoleColor.Black,
                        line, Console.WindowWidth / 2 - message.Length / 2);
                    line++;
                }
                else
                {
                    message = "Heal: " + (0 - hero.Weapon.magic.damageOnSelf);
                    draw.DrawString(message, ConsoleColor.Black,
                        line, Console.WindowWidth / 2 - message.Length / 2);
                    line++;
                }
            }
            if (hero.Weapon.magic.chanceToStun > 0)
            {
                message = "Chance to stun: " + (100 * hero.Weapon.magic.chanceToStun) + "%";
                draw.DrawString(message, ConsoleColor.Black,
                    line, Console.WindowWidth / 2 - message.Length / 2);
                line++;
            }

            message = "Do you want to leave your weapon behind, and take the new weapon?";
            draw.DrawString(message, ConsoleColor.Black,
                    25, Console.WindowWidth / 2 - message.Length / 2);
            message = "[Y /N] ";
            draw.DrawString(message, ConsoleColor.Black,
                    27, Console.WindowWidth / 2 - message.Length / 2);
            Console.SetCursorPosition(0, 0);
        }
コード例 #6
0
        private void DrawMenu()
        {
            Drawer draw = new Drawer();
            ConsoleColor color = ConsoleColor.White;

            for (int i = 0; i < 15; i++) // draw a box
            {
                draw.DrawString(whiteSpace, color, (centerRow - 5) + i, (centerCol - whiteSpace.Length / 2));
            }
            for (int i = 1; i <= 3; i++) // draw on top
            {
                draw.DrawString(whiteSpace, ConsoleColor.Red, (centerRow - 5) - i, (centerCol - whiteSpace.Length / 2));
            }

            string message = "Game Paused";
            draw.DrawString(message, ConsoleColor.Red, (centerRow - 5) - 2, (centerCol - message.Length / 2));

            for (int i = 1; i <= options.Length; i++)
            {
                draw.DrawString(options[i - 1], color, (centerRow - 5) + 2 * i, (centerCol - options[i - 1].Length / 2));
            }
            draw.DrawString(choicePointerLeft, color, (centerRow - 5) + 2 * choice, (centerCol - options[choice - 1].Length / 2) - choicePointerLeft.Length - 1);
            draw.DrawString(choicePointerRight, color, (centerRow - 5) + 2 * choice, (centerCol + options[choice - 1].Length / 2) + 2);

            Console.SetCursorPosition(0, 0);
        }
コード例 #7
0
        private void MenuShowHeroStats(Hero hero)
        {
            Drawer draw = new Drawer();

            Console.ResetColor();
            Console.Clear();

            draw.DrawString("Name : " + hero.Name, ConsoleColor.Black, 4, 8);
            draw.DrawImage(hero.Image, ConsoleColor.Black, 5, 4);

            draw.DrawString("Strength: " + hero.Statistics.Strength, ConsoleColor.Black, 23, 45);
            draw.DrawString("Dexterity: " + hero.Statistics.Dexterity, ConsoleColor.Black, 25, 45);
            draw.DrawString("Willpower: " + hero.Statistics.EillPower, ConsoleColor.Black, 27, 45);

            draw.DrawString("Weapon: " + hero.Weapon.name, ConsoleColor.Black, 10, 45);
            draw.DrawString("Weapon Damage: " + hero.Weapon.damage, ConsoleColor.Black, 11, 45);

            draw.DrawString("Magic: " + hero.Weapon.magic.Name, ConsoleColor.Black, 13, 45);
            draw.DrawString("Magic Damage: " + hero.Weapon.magic.damage, ConsoleColor.Black, 14, 45);
            draw.DrawString("Magic Damage on Self: " + hero.Weapon.magic.damageOnSelf, ConsoleColor.Black, 15, 45);
            draw.DrawString("Magic Chance to Stun: " + hero.Weapon.magic.chanceToStun, ConsoleColor.Black, 16, 45);

            Console.SetCursorPosition(0, 0);

            Console.ReadKey();
        }
コード例 #8
0
ファイル: Battle.cs プロジェクト: TeamSazeracProject/TheGame
        void DrawDamage(bool damageOnEnemy)
        {
            Drawer draw = new Drawer();
            Images img = new Images();
            Console.ForegroundColor = ConsoleColor.Red;

            if (damageOnEnemy)
            {
                draw.DrawImageWithoutSpaces(img.Damage, 5, 55);
            }
            else
            {
                draw.DrawImageWithoutSpaces(img.Damage, 5, 5);
            }
            Console.ResetColor();
        }
コード例 #9
0
ファイル: Battle.cs プロジェクト: TeamSazeracProject/TheGame
        void DrawBattle(Hero hero, Enemy enemy)
        {
            Drawer draw = new Drawer();

            Console.BackgroundColor = ConsoleColor.Black;
            Console.Clear();

            int heroLifeBarBlocks = (int)(20 * (double)currentHeroHP / totalHeroHP);
            int enemyLifeBarBlocks = (int)(20 * (double)currentEnemyHP / totalEnemyHP);

            if (heroLifeBarBlocks < 0)
            {
                heroLifeBarBlocks = 0;
            }
            if (enemyLifeBarBlocks < 0)
            {
                enemyLifeBarBlocks = 0;
            }

            draw.DrawString(hero.Name + " (" + hero.level + ")", ConsoleColor.DarkGray, 2, 5);
            draw.DrawString(new string(' ', heroLifeBarBlocks), ConsoleColor.DarkRed, 3, 15);
            draw.DrawString(currentHeroHP + " / " + totalHeroHP, ConsoleColor.DarkRed, 3, 36);
            draw.DrawImage(hero.Image, ConsoleColor.Black, 5, 5);
            for (int i = 0; i < 7; i++)
            {
                draw.DrawString(boxRow, ConsoleColor.DarkYellow, 40 + i, 10);
                if (i == 1)
                { draw.DrawString("Press [A] to Attack", ConsoleColor.DarkYellow, 40 + i, 13); }
                else if (i == 3)
                { draw.DrawString("Press [S] to use a Spell", ConsoleColor.DarkYellow, 40 + i, 13); }
                else if (i == 5)
                { draw.DrawString("Press [E] to Escape", ConsoleColor.DarkYellow, 40 + i, 13); }
            }

            draw.DrawString(enemy.Name, ConsoleColor.DarkGray, 2, 55);
            draw.DrawString(new string(' ', enemyLifeBarBlocks), ConsoleColor.DarkRed, 3, 65);
            draw.DrawString(currentEnemyHP + " / " + totalEnemyHP, ConsoleColor.DarkRed, 3, 86);
            draw.DrawImage(enemy.Image, ConsoleColor.Black, 5, 55);
            for (int i = 0; i < 7; i++)
            {
                draw.DrawString(boxRow, ConsoleColor.DarkYellow, 40 + i, 60);
                draw.DrawString(message[i], ConsoleColor.DarkYellow, 40 + i, 63);
            }
            Console.BackgroundColor = ConsoleColor.Black;
            Console.SetCursorPosition(0,0);
        }