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(); }
// 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 Awake() { if (board == null) { board = GameObject.FindObjectOfType <Board>(); } cursor = GameObject.FindObjectOfType <VirtualCursor>(); }
//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; } }
public void PrintMessage(ColoredString text) { if (text.ToString() != lastMessage) { ShiftDown(1); VirtualCursor.Print(text).CarriageReturn(); lastMessage = text.ToString(); } }
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; }
/// <summary> /// Called when the renderer renders the text view. /// </summary> /// <param name="batch">The batch used in renderering.</param> protected virtual void OnAfterRender(SpriteBatch batch) { if (VirtualCursor.IsVisible) { int virtualCursorLocationIndex = Consoles.TextSurface.GetIndexFromPoint( new Point(VirtualCursor.Position.X - TextSurface.RenderArea.Left, VirtualCursor.Position.Y - TextSurface.RenderArea.Top), TextSurface.RenderArea.Width); if (virtualCursorLocationIndex >= 0 && virtualCursorLocationIndex < textSurface.RenderRects.Length) { VirtualCursor.Render(batch, textSurface.Font, textSurface.RenderRects[virtualCursorLocationIndex]); } } }
protected override void OnAfterRender() { if (VirtualCursor.IsVisible) { int virtualCursorLocationIndex = CellSurface.GetIndexFromPoint(new Point(VirtualCursor.Position.X - ViewArea.Location.X, VirtualCursor.Position.Y - ViewArea.Location.Y), ViewArea.Width); if (virtualCursorLocationIndex >= 0 && virtualCursorLocationIndex < _renderAreaRects.Length) { VirtualCursor.Render(Batch, Font, _renderAreaRects[virtualCursorLocationIndex]); } } base.OnAfterRender(); }
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 ); }
/// <summary> /// Called before the renderer applies a tint color. /// </summary> /// <param name="batch">The batch used in renderering.</param> protected virtual void OnBeforeRenderTint(SpriteBatch batch) { if (VirtualCursor.IsVisible) { // Bug - Virtual cursor position index is incorrectly positioned in the render area when the render area // is smaller than width. // Render int virtualCursorLocationIndex = BasicSurface.GetIndexFromPoint( new Point(VirtualCursor.Position.X - TextSurface.RenderArea.Left, VirtualCursor.Position.Y - TextSurface.RenderArea.Top), TextSurface.RenderArea.Width); if (virtualCursorLocationIndex >= 0 && virtualCursorLocationIndex < textSurface.RenderRects.Length) { VirtualCursor.Render(batch, textSurface.Font, textSurface.RenderRects[virtualCursorLocationIndex]); } } }
/// <summary> /// Updates the cell effects and cursor. Calls Update on <see cref="Children"/>. /// </summary> /// <param name="delta">Time difference for this frame (if update was called last frame).</param> public virtual void Update(TimeSpan delta) { if (!IsPaused) { Effects.UpdateEffects(delta.TotalSeconds); if (VirtualCursor.IsVisible) { VirtualCursor.Update(delta); } var copyList = new List <IScreen>(Children); foreach (var child in copyList) { child.Update(delta); } } }
private void Awake() { base.Awake(); if (enableCursor) { if (cursor == null) { cursor = FindObjectOfType <VirtualCursor>(); } } if (shipRenderer == null) { shipRenderer = GetComponentInChildren <SpriteRenderer>(); } blowUpSound = "destruction_ally"; offset = -90; }
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) { VirtualCursor.Print(text).NewLine(); }
private void Awake() => virtualCursor = GameObject.FindObjectOfType <VirtualCursor>();
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(); }