static void ResetSave(ref BestiaryList BList, ref HighscoresList HSList, ref Equipment Equip) { StreamWriter SW = new StreamWriter(@"Save Files\Bestiary.txt"); SW.Close(); SW = new StreamWriter(@"Save Files\Highscores.txt"); SW.Close(); SW = new StreamWriter(@"Save Files\Equipment.txt"); SW.WriteLine("0"); SW.WriteLine("1"); SW.WriteLine("1"); SW.WriteLine("1"); SW.WriteLine("false"); SW.WriteLine("false"); SW.Close(); Equip = new Equipment(); BList = new BestiaryList(); HSList = new HighscoresList(); }
public void RemoveDead(BestiaryList BList) { int Pos = 0; while (Pos < List.Count) { Enemy Current = (Enemy)List[Pos]; if (Current.GetDead()) { string Attributes = Current.GetEAttributes(); char EType = Current.GetEType(); switch (Current.GetEType()) { case '>': case '<': case 'V': case '^': Attributes = Current.GetEAttributes() + "T"; EType = '>'; break; case 'H': case 'I': { EType = 'H'; break; } } if (BList.Find(EType) == -1) { BList.AddEntry(EType, Attributes, Current.GetSpeed(), Current.GetReload(), Current.GetMaxHealth()); } List.RemoveAt(Pos); } else { Pos++; } } }
static void NewGame(ref HighscoresList HSList, ref BestiaryList BList, ref Equipment Equip)//, SoundPlayer Music) { int Option = 1; bool Picking = true; while (Picking) { LoadNewGame(Option); ConsoleKeyInfo Key = Console.ReadKey(); if (Key.Key == ConsoleKey.UpArrow) { if (Option == 1) { Option = 5; } else { Option--; } } else if (Key.Key == ConsoleKey.DownArrow) { if (Option == 5) { Option = 1; } else { Option++; } } else if (Key.Key == ConsoleKey.Enter) { switch (Option) { case 1: { //Music.Stop(); Game Game1 = new Game(BList, null, Equip, 1); //Music.PlayLooping(); break; } case 2: { UpgradeScreen(Equip); break; } case 3: { //Music.Stop(); Game Game1 = new Game(BList, HSList, Equip, 2); //Music.PlayLooping(); break; } case 4: { ResetSave(ref BList, ref HSList, ref Equip); break; } default: { Picking = false; break; } } } } }
static void DisplayEntry(int Entry, int Option, BestiaryList List) { Console.Clear(); StreamReader SR = new StreamReader(@"Menu\BestiaryDesign.txt"); int Line = 1; while (!SR.EndOfStream) { if (Line == 11) { if (Entry == -1) { Console.WriteLine("[ Entry 00/00 ]"); } else { Console.WriteLine("[ Entry {0}/{1} ]", STwo(Entry + 1), STwo(List.Count())); } } else if (Line == 13) { if (Entry == -1) { Console.WriteLine("[ You have not defeated any enemies yet. Defeat enemies to add them to the bestiary. ]"); } else { Enemy Current = List.GetEnemy(Entry); Console.WriteLine("[ {0}: ]", Current.GetEType()); Console.WriteLine("[ ]"); Console.WriteLine("[ Health: {0} ]", Current.GetHealth()); foreach (char i in Current.GetEAttributes()) { switch (i) { case 'C': Console.WriteLine("[ Deals contact damage ]"); break; case 'I': Console.WriteLine("[ Can only move in 1 direction ]"); break; case 'S': Console.WriteLine("[ Can shoot every {0} turn/s ]", Current.GetReload()); break; } } Console.WriteLine("[ Speed: {0} ]", Current.GetSpeed()); } } else if (Line == 16) { switch (Option) { case 1: Console.WriteLine("[ --- ]"); break; case 2: Console.WriteLine("[ ---- ]"); break; case 3: Console.WriteLine("[ --- ]"); break; } } else { Console.WriteLine(SR.ReadLine()); } Line++; } SR.Close(); }
static void LoadBestiary(BestiaryList List) { bool Browsing = true; int Entry = 0; int Option = 2; while (Browsing) { if (List.Count() > 0) { DisplayEntry(Entry, Option, List); } else { Entry = -1; DisplayEntry(Entry, Option, List); } ConsoleKeyInfo Key = Console.ReadKey(); if (Key.Key == ConsoleKey.LeftArrow) { if (Option == 1) { Option = 3; } else { Option--; } } else if (Key.Key == ConsoleKey.RightArrow) { if (Option == 3) { Option = 1; } else { Option++; } } else if (Key.Key == ConsoleKey.Enter) { if (Option == 2) { Browsing = false; } else if (Option == 1) { if (Entry == 0) { Entry = List.Count() - 1; } else { Entry--; } } else if (Option == 3) { if (Entry == List.Count() - 1) { Entry = 0; } else { Entry++; } } } else if (Key.Key == ConsoleKey.Escape) { Browsing = false; } } }
static void Quit(HighscoresList HSList, BestiaryList BList, Equipment Equip) { HSList.Quit(); BList.Quit(); Equip.Quit(); }
static void Main(string[] args) { Console.OutputEncoding = Encoding.Unicode; int Option = 1; ConsoleKeyInfo Key; bool Running = true; HighscoresList HSList = new HighscoresList(); BestiaryList BList = new BestiaryList(); Equipment Equip = new Equipment(); //SoundPlayer Music = new SoundPlayer(@"Music\Menu.wav"); //Music.PlayLooping(); while (Running) { LoadMenu(Option); Key = Console.ReadKey(); if (Key.Key == ConsoleKey.UpArrow) { if (Option == 1) { Option = 5; } else { Option--; } } else if (Key.Key == ConsoleKey.DownArrow) { if (Option == 5) { Option = 1; } else { Option++; } } else if (Key.Key == ConsoleKey.Enter) { switch (Option) { case 1: { NewGame(ref HSList, ref BList, ref Equip); //, Music); break; } case 2: { HSList.DisplayHighscores(); break; } case 3: { LoadBestiary(BList); break; } case 4: { DisplayHelp(); break; } default: { Quit(HSList, BList, Equip); Running = false; break; } } } else if (Key.Key == ConsoleKey.Escape) { Quit(HSList, BList, Equip); Running = false; } } }