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); }
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); }
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); }
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}"); } }
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(" "); }
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; } }
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; } }
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); }
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); }
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(); }
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; } } }
public void ClearHighlightCurItem() { ConsoleLib.GotoXY(_pos.x + 1, _pos.y + CurItem); Console.BackgroundColor = backgRoundMenuColor; }
public void HighlightCurItem() { ConsoleLib.GotoXY(_pos.x + 1, _pos.y + CurItem); Console.BackgroundColor = ConsoleColor.Red; }
public void CaseExit() { Console.Clear(); ConsoleLib.GotoXY(35, 20); Console.WriteLine("Bay -- Bay"); }