// This console domonstrates a classic MS-DOS or Windows Command Prompt style console. public DOSConsole() : base(80, 23) { this.IsVisible = false; // This is our cusotmer keyboard handler we'll be using to process the cursor on this console. _keyboardHandlerObject = new InputHandling.ClassicConsoleKeyboardHandler(); // Assign our custom handler method from our handler object to this consoles keyboard handler. // We could have overridden the ProcessKeyboard method, but I wanted to demonstrate how you // can use your own handler on any console type. KeyboardHandler = _keyboardHandlerObject.HandleKeyboard; // Our custom handler has a call back for processing the commands the user types. We could handle // this in any method object anywhere, but we've implemented it on this console directly. _keyboardHandlerObject.EnterPressedAction = EnterPressedActionHandler; // Enable the keyboard and setup the prompt. UseKeyboard = true; virtualCursor.IsVisible = true; Prompt = "Prompt> "; // Startup description ClearText(); VirtualCursor.Position = new Point(0, 24); VirtualCursor.Print("Try typing in the following commands: help, ver, cls, look. If you type exit or quit, the program will end.").NewLine().NewLine(); _keyboardHandlerObject.VirtualCursorLastY = 24; TimesShiftedUp = 0; virtualCursor.DisableWordBreak = true; virtualCursor.Print(Prompt); virtualCursor.DisableWordBreak = false; }
private void EnterPressedActionHandler(string value) { if (value.ToLower() == "help") { VirtualCursor.Print(" There is no help available right now, sorry.").NewLine(); } else if (value.ToLower() == "ver") { VirtualCursor.Print(" SadConsole for MonoGame and XNA 4.0").NewLine(); } else if (value.ToLower() == "cls") { Clear(); } else if (value.ToLower() == "look") { VirtualCursor.Print(" Looking around you discover that you are in a dark and empty room. There is a computer monitor in front of you and Visual Studio is opened, waiting for your next command.").NewLine(); } else if (value.ToLower() == "exit" || value.ToLower() == "quit") { Environment.Exit(0); } else { VirtualCursor.Print(" Unknown command").NewLine(); } }
public CastleConsole() : base(40, 25) { currentTurnCount = 0; this.mapReader = new MapReader(); GameResult = GameResult.Quit; ItemManager = new ItemManager(UpdateMap); this.gameOver = false; this.IsVisible = false; this.firstRelease = true; RunTick = false; keyboardHandlerObject = new ClassicConsoleKeyboardHandler(); VirtualCursor.Position = new Point(Room.MapWidth + 1, Room.MapHeight + 4); KeyboardHandler = keyboardHandlerObject.HandleKeyboard; keyboardHandlerObject.EnterPressedAction = EnterPressedActionHandler; // Enable the keyboard and setup the prompt. CanUseKeyboard = true; VirtualCursor.IsVisible = true; // Startup description CellData.Clear(); _cellData.TimesShiftedUp = 0; VirtualCursor.Print(CastleAdventureResources.CommandPrompt); currentRoomIndex = 1; player = new Player(); player.Position = new Microsoft.Xna.Framework.Point(_cellData.Width / 2, _cellData.Height / 2); DrawBorder(); DrawRoom(); }
public void PrintMessage(ColoredString text) { if (text.ToString() != lastMessage) { ShiftDown(1); VirtualCursor.Print(text).CarriageReturn(); lastMessage = text.ToString(); } }
//public MessagesConsole( int width, int height ) : base( width, height ) //{ // GameWorld.MessageConsole = this; // PrintMessage( "works!" ); //} public void PrintMessage(string text) { if (text != lastMessage) { ShiftDown(1); VirtualCursor.Print(text).CarriageReturn(); lastMessage = text; } }
private void ResetPrompt() { // Reset the command for (int x = Room.MapWidth + 2; x < Room.MapWidth + 16; x++) { SetGlyph(x, Room.MapHeight + 4, 0, Color.White); } VirtualCursor.Position = new Point(Room.MapWidth + 1, Room.MapHeight + 4); VirtualCursor.Print("?"); keyboardHandlerObject.VirtualCursorLastY = Room.MapHeight + 4; }
private void ResetPrompt() { // Reset the command for (int x = Room.MapWidth + 2; x < Room.MapWidth + 16; x++) { this.CellData.SetCharacter(x, Room.MapHeight + 4, 0, CastleGame.GameColor); } VirtualCursor.Position = new Point(Room.MapWidth + 1, Room.MapHeight + 4); VirtualCursor.Print(CastleAdventureResources.CommandPrompt); keyboardHandlerObject.VirtualCursorLastY = Room.MapHeight + 4; }
public void Mouse(MouseInfo info) { //System.Console.WriteLine( "Process mouse Gui" ); Clear(); VirtualCursor.Position = new Point(1, 1); Point mapCell = info.WorldLocation + TextSurface.RenderArea.Location; RootConsole.mapViewport.renderer.HighlightTile(mapCell); //mouseConsole.VirtualCursor.Position = infoPos; VirtualCursor.Print(mapCell.ToString()).Right(2); VirtualCursor.Print(GameConstants.Map.GetTile(mapCell).ToString()).CarriageReturn(); //VirtualCursor.Position = new Point( 40, 40 ); //VirtualCursor.Print( "AAAAAAAAAAAAAAAAAAAAAAAAAAARGHH!!" ); //SetCellAppearance( 2, 2, new CellAppearance( Color.Blue, Color.Yellow, 42 )); //Appearance.CopyAppearanceTo( sadConsoleCell ); }
private void EnterPressedActionHandler(string value) { if (value.ToLower() == "help") { VirtualCursor.NewLine(). Print(" Advanced Example: Command Prompt - HELP").NewLine(). Print(" =======================================").NewLine().NewLine(). Print(" help - Display this help info").NewLine(). Print(" ver - Display version info").NewLine(). Print(" cls - Clear the screen").NewLine(). Print(" look - Example adventure game cmd").NewLine(). Print(" exit,quit - Quit the program").NewLine(). Print(" ").NewLine(); } else if (value.ToLower() == "ver") { VirtualCursor.Print(" SadConsole for MonoGame").NewLine(); } else if (value.ToLower() == "cls") { ClearText(); } else if (value.ToLower() == "look") { VirtualCursor.Print(" Looking around you discover that you are in a dark and empty room. To your left there is a computer monitor in front of you and Visual Studio is opened, waiting for your next command.").NewLine(); } else if (value.ToLower() == "exit" || value.ToLower() == "quit") { Environment.Exit(0); } else { VirtualCursor.Print(" Unknown command").NewLine(); } }
public void PrintMessage(ColoredString text) { ShiftDown(1); VirtualCursor.Print(text).CarriageReturn(); }
public void EnterPressedActionHandler(string value) { //MessageBoxZ.MessageZ(); if (value.ToLower() == "help") { VirtualCursor.NewLine(). Print(" Advanced Example: Command Prompt - HELP").NewLine(). Print(" =======================================").NewLine().NewLine(). Print(" help - Display this help info").NewLine(). Print(" ver - Display version info").NewLine(). Print(" cls - Clear the screen").NewLine(). Print(" look - Example adventure game cmd").NewLine(). Print(" exit,quit - Quit the program").NewLine(). Print(" ").NewLine(); } else if (value.ToLower() == "ver") { VirtualCursor.Print(" SadConsole for MonoGame").NewLine(); } else if (value.ToLower() == "cls") { ClearText(); } else if (value.ToLower() == "cls2") { //Program.MainConsole.middleConsolel.Clear(); } else if (value.ToLower() == "look") { VirtualCursor.Print(" Looking around you discover that you are in a dark and empty room. To your left there is a computer monitor in front of you and Visual Studio is opened, waiting for your next command.").NewLine(); } else if (value.ToLower() == "exit" || value.ToLower() == "quit") { Environment.Exit(0); } else if (value.ToLower() == "1") { StarterProject.Program.MainConsole.middleConsolel.VirtualCursor.Print("1"); } else if (value.ToLower() == "2") { //Program.MainConsole.consoles[0].VirtualCursor.NewLine().Print("out_put text").NewLine().Print("vvv"); Program.MainConsole.middleConsolel.Clear(); } else if (value.ToLower() == "3") { //Program.zz.ShitMethod(); } else { virtualCursor.Print("unknown command"); } //else //VirtualCursor.Print("value").NewLine //virtualCursor.Print(value).NewLine(); }
public void PrintMessage(ColoredString text) { VirtualCursor.Print(text).NewLine(); }