示例#1
0
        public override void Draw(MyMap map)
        {
            const char Up = (char)86, Down = (char)94, Right = (char)60, Left = (char)62;

            ConsoleLib.SetColor(ConsoleColor.Black, GetConsoleColor());
            if (Direction == 4)
            {
                ConsoleLib.WriteChar(GetCoordMonster().x + GetCoordStartMap().x, GetCoordMonster().y + GetCoordStartMap().y, Right);
            }
            if (Direction == 3)
            {
                ConsoleLib.WriteChar(GetCoordMonster().x + GetCoordStartMap().x, GetCoordMonster().y + GetCoordStartMap().y, Left);
            }
            if (Direction == 2)
            {
                ConsoleLib.WriteChar(GetCoordMonster().x + GetCoordStartMap().x, GetCoordMonster().y + GetCoordStartMap().y, Down);
            }
            if (Direction == 1)
            {
                ConsoleLib.WriteChar(GetCoordMonster().x + GetCoordStartMap().x, GetCoordMonster().y + GetCoordStartMap().y, Up);
            }
            ConsoleLib.SetColor(ConsoleColor.White, ConsoleColor.Black);

            Eat(map);
            DrawBack(map);
            ConsoleLib.GotoXY(20, 5);         // вывод рекорда на посмотреть
            Console.Write("score :: {0}", Score);
        }
示例#2
0
文件: Menu.cs 项目: darkarki83/.NET
        public void Draw()
        {
            const char Gorizont  = (char)9552;
            const char Vertikal  = (char)9553;
            const char LeftUp    = (char)9556;
            const char RightUp   = (char)9559;
            const char RightDown = (char)9565;
            const char LeftDown  = (char)9562;

            ConsoleLib.SetColor(foregRoundMenuColor, backgRoundMenuColor);
            ConsoleLib.WriteChar(_pos.x, _pos.y, LeftUp);
            ConsoleLib.WriteChars(_pos.x + 1, _pos.y, Gorizont, Width - 2);
            ConsoleLib.WriteChar(_pos.x + Width - 1, _pos.y, RightUp);

            for (int i = 1; i <= ItemCount; i++)
            {
                ConsoleLib.WriteChar(_pos.x, _pos.y + i, Vertikal);

                string itemToDraw = Items[i - 1];

                ConsoleLib.GotoXY(_pos.x + 1, _pos.y + i);
                Console.WriteLine(itemToDraw);
                ConsoleLib.WriteChar(_pos.x + Width - 1, _pos.y + i, Vertikal);
            }

            ConsoleLib.WriteChar(_pos.x, _pos.y + Height - 1, LeftDown);
            ConsoleLib.WriteChars(_pos.x + 1, _pos.y + Height - 1, Gorizont, Width - 2);
            ConsoleLib.WriteChar(_pos.x + Width - 1, _pos.y + Height - 1, RightDown);
        }
示例#3
0
文件: Game.cs 项目: darkarki83/.NET
 public ConsoleColor CaseLeft(ConsoleColor B, ConsoleColor T, ConsoleColor TB)
 {
     ConsoleLib.GotoXY(32, 21);
     ConsoleLib.SetColor(B, T);
     Console.WriteLine("Esc");
     ConsoleLib.GotoXY(36, 21);
     ConsoleLib.SetColor(B, TB);
     Console.WriteLine("Play");
     return(T);
 }
示例#4
0
文件: Menu.cs 项目: darkarki83/.NET
        public void ChoiceOptions()
        {
            ConsoleKey keyVitrualCode;
            bool       flag = false;

            HighlightCurItem();
            do
            {
                keyVitrualCode = Console.ReadKey().Key;
                HighlightCurItem();

                if (Console.KeyAvailable != true)
                {
                    if (keyVitrualCode == ConsoleKey.Enter || keyVitrualCode == ConsoleKey.RightArrow)
                    {
                        switch (CurItem)
                        {
                        case 1:
                            ConsoleLib.SetColor(ConsoleColor.White, ConsoleColor.Black);
                            Console.Clear();
                            if (Program.PlayGame() != ConsoleKey.Enter)
                            {
                                CaseExit();
                                flag = true;
                                break;
                            }
                            Console.Clear();
                            break;

                        case 2:
                            CreateOptionMenu();
                            break;

                        case 3:
                            CaseScore();
                            break;

                        case 4:
                            CaseExit();
                            flag = true;
                            break;
                        }
                        if (flag)
                        {
                            break;
                        }
                        Draw();
                        Console.CursorVisible = true;
                    }
                    ChoiceMove(ref keyVitrualCode);

                    ClearHighlightCurItem();
                }
            }while (keyVitrualCode != ConsoleKey.Escape && keyVitrualCode != ConsoleKey.LeftArrow);
        }
示例#5
0
文件: Menu.cs 项目: darkarki83/.NET
        public void CaseScore()
        {
            ConsoleLib.SetColor(ConsoleColor.White, ConsoleColor.Black);
            Console.Clear();
            List <SaveLoad> saveLoads = new List <SaveLoad>(10);

            FileManager.Load(ref saveLoads);
            FileManager.Print(ref saveLoads);

            ConsoleKey keyVitrualCode = Console.ReadKey().Key;

            Console.Clear();
        }
示例#6
0
        public static void Print(ref List <SaveLoad> saveLoads)
        {
            int xDrow = 20;
            int yDrow = 10;

            DrawBeforPrint(xDrow, yDrow, ref saveLoads);

            for (int i = 0; i < saveLoads.Count; i++)
            {
                ConsoleLib.GotoXY(xDrow + 1, yDrow + 1 + i * 2);
                Console.WriteLine($"Name : {saveLoads[i].name}");
                ConsoleLib.GotoXY(xDrow + 21, yDrow + 1 + i * 2);
                Console.WriteLine($"Score : {saveLoads[i].score}");
            }
        }
示例#7
0
文件: Game.cs 项目: darkarki83/.NET
 public void TimerStartGame()
 {
     for (int i = 0; i < 4; i++)
     {
         Thread.Sleep(1000);
         ConsoleLib.GotoXY(34, 20);
         Console.WriteLine("START");
         ConsoleLib.GotoXY(36, 21);
         Console.WriteLine($"0{3 - i}");
     }
     ConsoleLib.GotoXY(34, 20);
     Console.WriteLine("     ");
     ConsoleLib.GotoXY(36, 21);
     Console.WriteLine("  ");
 }
示例#8
0
 public override void Draw(MyMap map)
 {
     if (SuperMonster == false)
     {
         ConsoleLib.SetColor(ConsoleColor.White, GetConsoleColor());
         ConsoleLib.WriteChar(GetCoordStartMap().x + GetCoordMonster().x, GetCoordStartMap().y + GetCoordMonster().y, (char)177);
         ConsoleLib.SetColor(ConsoleColor.White, ConsoleColor.Black);
     }
     else
     {
         ConsoleLib.SetColor(ConsoleColor.Black, ConsoleColor.White);
         ConsoleLib.WriteChar(GetCoordStartMap().x + GetCoordMonster().x, GetCoordStartMap().y + GetCoordMonster().y, (char)177);
         ConsoleLib.SetColor(ConsoleColor.White, ConsoleColor.Black);
     }
 }
示例#9
0
文件: Menu.cs 项目: darkarki83/.NET
 public void Grafica()
 {
     ConsoleLib.SetColor(ConsoleColor.White, ConsoleColor.Green);
     ConsoleLib.WriteChars(15, 38, '$', 70);
     ConsoleLib.WriteChars(42, 35, '*', 3);
     ConsoleLib.WriteChars(41, 34, '*', 5);
     ConsoleLib.WriteChars(40, 33, '*', 6);
     ConsoleLib.WriteChars(39, 32, '*', 6);
     ConsoleLib.WriteChars(38, 31, '*', 6);
     ConsoleLib.WriteChars(39, 30, '*', 6);
     ConsoleLib.WriteChars(40, 29, '*', 6);
     ConsoleLib.WriteChars(41, 28, '*', 5);
     ConsoleLib.WriteChars(42, 27, '*', 3);
     ConsoleLib.SetColor(ConsoleColor.White, ConsoleColor.Red);
 }
示例#10
0
文件: Menu.cs 项目: darkarki83/.NET
        void CreateGraphicsSwitch(int CurItem)
        {
            switch (CurItem)
            {
            case 1:
                ConsoleLib.GotoXY(35, 15);
                Console.WriteLine("Graphics ON ");
                Grafica();
                break;

            case 2:
                ConsoleLib.GotoXY(35, 15);
                Console.WriteLine("Graphics OFF");
                break;
            }
        }
示例#11
0
文件: Menu.cs 项目: darkarki83/.NET
        void CreateVolumeSwitch(int CurItem)
        {
            switch (CurItem)
            {
            case 1:
                ConsoleLib.GotoXY(35, 15);
                Console.WriteLine("  Volume ON   ");
                Sp.PlayLooping();
                break;

            case 2:
                ConsoleLib.GotoXY(35, 15);
                Console.WriteLine("  Volume OFF  ");
                Sp.Stop();
                break;
            }
        }
示例#12
0
文件: Game.cs 项目: darkarki83/.NET
        public void Play()
        {
            Console.CursorVisible = false;
            Map.Draw(6, 20);
            PacMan.Draw(Map);

            for (int i = 0; i < Monsters.Count; i++)
            {
                Monsters[i].Draw(Map);
            }

            TimerStartGame();
            bool win = false;

            do
            {
                //----------------------------------------------------------------//

                /* for (int i = 0; i < Map.SizeY; i++)
                 * {
                 *   ConsoleLib.GotoXY(80, 6 + i);
                 *   for (int j = 0; j < Map.SizeX; j++)
                 *   {
                 *       Console.Write(Map.GetPointInMap(i, j));
                 *   }
                 * }*/
                //-----------------------------------------------------------------//
                PacManMove();
                if (ExitFromGame == true)
                {
                    break;
                }
                MonsterMove();

                ConsoleLib.GotoXY(1, 1);                                     /// на посмотреть
                Console.WriteLine("point count : {0}", ThePoint.PointCount); // на посмотреть

                ConsoleLib.GotoXY(20, 5);                                    // вывод рекорда на посмотреть
                Console.Write("score :: {0}", PacMan.Score);

                if (ThePoint.PointCount < 3)
                {
                    win = WinCheck();
                }
            } while (((ThePoint.PointCount + TheSuperPoint.SuperPointCount) != 0 || win != true) && PacMan.Life != 0);
        }
示例#13
0
文件: Game.cs 项目: darkarki83/.NET
        public ConsoleKey AfterPlay()
        {
            Console.Clear();
            ConsoleLib.GotoXY(35, 20);

            if ((ThePoint.PointCount + TheSuperPoint.SuperPointCount) == 0 || WinCheck() == true)
            {
                SaveScore();
            }
            else
            {
                Console.WriteLine($"You are Loss sorry");
            }

            ConsoleLib.GotoXY(35, 21);
            Console.WriteLine($"If You want new Game Press Enter");
            ConsoleLib.GotoXY(35, 22);
            Console.WriteLine($"Exit Press ESC");
            return(Console.ReadKey().Key);
        }
示例#14
0
        public override void DeleteDraw(MyMap map)
        {
            const char Point          = (char)183;
            const char SuperPoint     = (char)164;
            const char GorizontInside = (char)9472;

            map.SetPointInMap(GetCoordMonster(), PrevSymbol);

            if (PrevSymbol == 0)
            {
                ConsoleLib.SetColor(ConsoleColor.White, ConsoleColor.Black);
                ConsoleLib.WriteChar(GetCoordMonster().x + GetCoordStartMap().x,
                                     GetCoordMonster().y + GetCoordStartMap().y, ' ');
            }
            else if (PrevSymbol == 1)
            {
                ConsoleLib.WriteChar(GetCoordMonster().x + GetCoordStartMap().x,
                                     GetCoordMonster().y + GetCoordStartMap().y, GorizontInside);
            }
            else if (PrevSymbol == 2)
            {
                ConsoleLib.SetColor(ConsoleColor.Yellow, ConsoleColor.Black);
                ConsoleLib.WriteChar(GetCoordMonster().x + GetCoordStartMap().x,
                                     GetCoordMonster().y + GetCoordStartMap().y, Point);
            }
            else if (PrevSymbol == 3)
            {
                ConsoleLib.SetColor(ConsoleColor.Green, ConsoleColor.Black);
                ConsoleLib.WriteChar(GetCoordMonster().x + GetCoordStartMap().x,
                                     GetCoordMonster().y + GetCoordStartMap().y, SuperPoint);
            }
            else
            {
                ConsoleLib.SetColor(ConsoleColor.White, ConsoleColor.Black);
                ConsoleLib.WriteChar(GetCoordMonster().x + GetCoordStartMap().x,
                                     GetCoordMonster().y + GetCoordStartMap().y, ' ');
                map.SetPointInMap(GetCoordMonster(), 0);
            }
        }
示例#15
0
文件: Game.cs 项目: darkarki83/.NET
        public void SaveScore()
        {
            ConsoleLib.GotoXY(35, 21);
            Console.WriteLine($"You are Win your score :: {PacMan.Score}");
            ConsoleLib.GotoXY(35, 22);
            Console.Write($"Write your name :: ");
            string name = Console.ReadLine();

            List <SaveLoad> saveLoads = new List <SaveLoad>(10);

            FileManager.Load(ref saveLoads);
            SaveLoad save = new SaveLoad()
            {
                name  = name,
                score = PacMan.Score
            };

            if (saveLoads.Count == 10)
            {
                for (int i = 0; i < saveLoads.Count; i++)
                {
                    if (saveLoads[i].score < save.score)
                    {
                        for (int j = saveLoads.Count - 2; j > i; j--)
                        {
                            saveLoads[j + 1] = saveLoads[j];
                        }
                        saveLoads[i] = save;
                        break;
                    }
                }
            }
            else
            {
                saveLoads.Add(save);
            }
            FileManager.Save(saveLoads);
            Console.Clear();
        }
示例#16
0
文件: Menu.cs 项目: darkarki83/.NET
        public void CreateOptionMenu()
        {
            ConsoleLib.SetColor(ConsoleColor.White, ConsoleColor.Black);
            Console.Clear();

            ConsoleLib.Coord pos = new ConsoleLib.Coord
            {
                y = 10,
                x = 35
            };

            List <string> menuOptions = new List <string>
            {
                "  Volume               ",
                "  Graphics             "
            };


            Menu newMenu = new Menu(pos, 25, 4, menuOptions, 1);

            newMenu.Draw();
            newMenu.ChoiceInsideOptions();
        }
示例#17
0
        public static void DrawBeforPrint(int xDrow, int yDrow, ref List <SaveLoad> saveLoads)
        {
            const char LeftUp                = (char)9484;
            const char RightUp               = (char)9488;
            const char Gorizont              = (char)9472;
            const char Vertikal              = (char)9474;
            const char RightDown             = (char)9496;
            const char LeftDown              = (char)9492;
            const char VertikalGorizontLeft  = (char)9508;
            const char VertikalGorizontRight = (char)9500;

            int count = 39;

            ConsoleLib.WriteChar(xDrow, yDrow, LeftUp);
            ConsoleLib.WriteChar(xDrow + 40, yDrow, RightUp);
            ConsoleLib.WriteChar(xDrow, yDrow + 20, LeftDown);
            ConsoleLib.WriteChar(xDrow + 40, yDrow + 20, RightDown);

            for (int i = 0; i <= 20; i++)
            {
                if (i % 2 == 0)
                {
                    ConsoleLib.WriteChars(xDrow + 1, yDrow + i, Gorizont, count);
                    if (i > 1 && i < 20)
                    {
                        ConsoleLib.WriteChar(xDrow + 0, yDrow + i, VertikalGorizontRight);
                        ConsoleLib.WriteChar(xDrow + 40, yDrow + i, VertikalGorizontLeft);
                    }
                }
                else
                {
                    ConsoleLib.WriteChar(xDrow, yDrow + i, Vertikal);
                    ConsoleLib.WriteChar(xDrow + 20, yDrow + i, Vertikal);
                    ConsoleLib.WriteChar(xDrow + 40, yDrow + i, Vertikal);
                }
            }
        }
示例#18
0
文件: Game.cs 项目: darkarki83/.NET
        public void PauseInGame(object sender, EventArgs e)
        {
            ConsoleLib.GotoXY(34, 20);
            Console.WriteLine("PAUSE");
            ConsoleKey choice;

            ConsoleColor back = CaseLeft(ConsoleColor.White, ConsoleColor.Red, ConsoleColor.Black);

            do
            {
                choice = Console.ReadKey().Key;
                if (choice == ConsoleKey.LeftArrow)
                {
                    back = CaseLeft(ConsoleColor.White, ConsoleColor.Red, ConsoleColor.Black);
                }
                else if (choice == ConsoleKey.RightArrow)
                {
                    back = CaseLeft(ConsoleColor.White, ConsoleColor.Black, ConsoleColor.Red);
                }
            } while (choice != ConsoleKey.Enter && choice != ConsoleKey.Escape);

            ConsoleLib.SetColor(ConsoleColor.White, ConsoleColor.Black);
            ConsoleLib.GotoXY(34, 20);
            Console.WriteLine("      ");
            ConsoleLib.GotoXY(32, 21);
            Console.WriteLine("   ");
            ConsoleLib.GotoXY(36, 21);
            Console.WriteLine("    ");
            if (choice == ConsoleKey.Enter)
            {
                if (back == ConsoleColor.Red)
                {
                    ExitFromGame = true;
                }
            }
        }
示例#19
0
文件: Menu.cs 项目: darkarki83/.NET
 public void ClearHighlightCurItem()
 {
     ConsoleLib.GotoXY(_pos.x + 1, _pos.y + CurItem);
     Console.BackgroundColor = backgRoundMenuColor;
 }
示例#20
0
文件: Menu.cs 项目: darkarki83/.NET
 public void HighlightCurItem()
 {
     ConsoleLib.GotoXY(_pos.x + 1, _pos.y + CurItem);
     Console.BackgroundColor = ConsoleColor.Red;
 }
示例#21
0
 public override void DeleteDraw(MyMap map)
 {
     map.SetPointInMap(GetCoordMonster(), 0);
     ConsoleLib.WriteChar(GetCoordMonster().x + GetCoordStartMap().x, GetCoordMonster().y + GetCoordStartMap().y, ' ');
 }
示例#22
0
文件: Menu.cs 项目: darkarki83/.NET
 public void CaseExit()
 {
     Console.Clear();
     ConsoleLib.GotoXY(35, 20);
     Console.WriteLine("Bay -- Bay");
 }