public static int RogueLike(Stream SInput) { Graphics.ConsoleWriter ConsoleOut = new Graphics.ConsoleWriter("Roguelike"); string path = @"C:\Users\hag19002983\OneDrive - Wakefield College\Steve\Steve_Resources\TEST.txt"; FileStream MPFile = File.OpenRead(path); byte[] FileBuffer = new byte[MPFile.Length]; MPFile.Read(FileBuffer, 0, (int)MPFile.Length); string Temp = System.Text.Encoding.Default.GetString(FileBuffer); string[] MPFileArray = new string[30]; MPFileArray[0] = ""; bool Quit = false; int J = 1; foreach (string Str in Temp.Split('\n')) { MPFileArray[J] = Str; J++; } //System.Windows.Forms.MessageBox.Show(MPFileArray[0]); for (int i = 1; i < 30; i++) { ConsoleOut.WriteLine(MPFileArray[i], i); ConsoleOut.SetForeground(i, ConsoleColor.Green); } Graphics.UIObject Character = new Graphics.UIObject("AB\nCD", 30, 15); ///Character.Background = ConsoleColor.Green; //Character.Foreground = ConsoleColor.; ConsoleOut.MakeObject(Character); ConsoleKeyInfo Input; while (!Quit) { ConsoleOut.Draw(); Input = Console.ReadKey(); switch (Input.Key) { case (ConsoleKey.UpArrow): Character.ChangeY(-1); break; case (ConsoleKey.DownArrow): Character.ChangeY(1); break; case (ConsoleKey.RightArrow): Character.ChangeX(1); break; case (ConsoleKey.LeftArrow): Character.ChangeX(-1); break; case (ConsoleKey.Escape): Quit = true; break; } } return(0); }
public static int HeightAndWeight(Stream Input) { Graphics.ConsoleWriter ConsoleOut = new Graphics.ConsoleWriter("Convert Height and Weight"); string TextInput = ""; Graphics.Menu InputMenu = new Graphics.Menu(); double Height = 0; double Weight = 0; double Temp = 0; ConsoleOut.MakeMenu(InputMenu); Graphics.UIObject HeightInput = new Graphics.UIObject("Input Height", ConsoleOut.XOffset("Input Height".Length), 9, null); Graphics.UIObject WeightInput = new Graphics.UIObject("Input Weight", ConsoleOut.XOffset("Input Weight".Length), 10, null); Graphics.UIObject QuitButton = new Graphics.UIObject("Go Back", ConsoleOut.XOffset("Go Back".Length), 11, null); InputMenu.AddItem(HeightInput); InputMenu.AddItem(WeightInput); InputMenu.AddItem(QuitButton); bool Quit = false; ConsoleKeyInfo InputKey; do { ConsoleOut.WriteLine("Weight: " + (Weight * 6.364).ToString() + "Kg Height: " + (Height * 2.54).ToString() + "cm ", 7); ConsoleOut.Draw(); InputKey = Console.ReadKey(); switch (InputKey.Key) { case ConsoleKey.UpArrow: InputMenu.ChangeSelected(-1); break; case ConsoleKey.DownArrow: InputMenu.ChangeSelected(1); break; case ConsoleKey.Enter: { if (InputMenu.GetSelected().Content == "Go Back") { Quit = true; } else if (InputMenu.GetSelected().Content == "Input Height") { TextInput = Console.ReadLine(); double.TryParse(TextInput, out Temp); Height = Temp; } else { TextInput = Console.ReadLine(); double.TryParse(TextInput, out Temp); Weight = Temp; } } break; } } while (!Quit); return(0); }
public static int WorkerPay(Stream Input) { Graphics.ConsoleWriter ConsoleOut = new Graphics.ConsoleWriter("Calculate Pay"); string TextInput = ""; Graphics.Menu InputMenu = new Graphics.Menu(); double Cars = 0; double Hours = 0; double Temp = 0; ConsoleOut.MakeMenu(InputMenu); Graphics.UIObject HeightInput = new Graphics.UIObject("Input Hours", ConsoleOut.XOffset("Input Hours".Length), 9, null); Graphics.UIObject WeightInput = new Graphics.UIObject("Input Cars", ConsoleOut.XOffset("Input Cars".Length), 10, null); Graphics.UIObject QuitButton = new Graphics.UIObject("Go Back", ConsoleOut.XOffset("Go Back".Length), 11, null); InputMenu.AddItem(HeightInput); InputMenu.AddItem(WeightInput); InputMenu.AddItem(QuitButton); bool Quit = false; ConsoleKeyInfo InputKey; do { ConsoleOut.WriteLine("Pay: " + (12 * Hours + 0.6 * Cars).ToString(), 7); ConsoleOut.Draw(); InputKey = Console.ReadKey(); switch (InputKey.Key) { case ConsoleKey.UpArrow: InputMenu.ChangeSelected(-1); break; case ConsoleKey.DownArrow: InputMenu.ChangeSelected(1); break; case ConsoleKey.Enter: { if (InputMenu.GetSelected().Content == "Go Back") { Quit = true; } else if (InputMenu.GetSelected().Content == "Input Hours") { TextInput = Console.ReadLine(); double.TryParse(TextInput, out Temp); Hours = Temp; } else { TextInput = Console.ReadLine(); double.TryParse(TextInput, out Temp); Cars = Temp; } } break; } } while (!Quit); return(0); }