public void Reset() { _mainConsole.Clear(); _mainConsole.Cursor.Position = new Point(0, 0); _scrollingCounter = 0; _scrollBar.Value = _scrollingCounter; }
public SubConsoleCursor() { mainView = new Console(80, 23); subView = new Console(new SurfaceView(mainView.TextSurface, new Rectangle(4, 4, 25, 10))); UseKeyboard = true; // Setup main view mainView.FillWithRandomGarbage(); mainView.MouseMove += (s, e) => { if (e.MouseState.Mouse.LeftButtonDown) { e.MouseState.Cell.Background = Color.Blue; } }; // Setup sub view subView.Position = new Point(4, 4); subView.MouseMove += (s, e) => { if (e.MouseState.Mouse.LeftButtonDown) { e.MouseState.Cell.Background = Color.Red; } }; subView.Clear(); subView.VirtualCursor.IsVisible = true; // Ad the consoles to the list. Children.Add(mainView); Children.Add(subView); }
private void _listBox_SelectedItemChanged(object sender, ListBox.SelectedItemEventArgs e) { var baseItem = e.Item as BaseItem; _itemConsole.Clear(); _itemConsole.Print(1, 1, $"{Coloring.Orange(baseItem.Name)} [{Coloring.DarkGrey(baseItem.GetType().Name)}]"); _itemConsole.Print(1, 2, $"Weigth: {Coloring.Gainsboro(baseItem.Weight.ToString("######0.00").PadLeft(10))} lbs.", Color.Gainsboro); _itemConsole.Print(1, 3, $"Cost: {Coloring.Gold(baseItem.Cost.ToString("######0.00").PadLeft(10))} Gold", Color.Gainsboro); if (baseItem is Weapon weapon) { _itemConsole.Print(1, 5, $"{Coloring.DarkGrey("Damage:")} {Coloring.Green(weapon.MinDmg.ToString())} - {Coloring.Green(weapon.MaxDmg.ToString())}", Color.Gainsboro); _itemConsole.Print(1, 6, $"{Coloring.DarkGrey("Critical:")} {Coloring.Yellow(weapon.CriticalMinRoll)} / {Coloring.Yellow(weapon.CriticalMultiplier)}x ", Color.Gainsboro); _itemConsole.Print(1, 7, $"{Coloring.DarkGrey("Range:")} {weapon.Range}", Color.Gainsboro); _itemConsole.Print(1, 8, $"{Coloring.DarkGrey("Damage:")} {string.Join(",",weapon.WeaponDamageTypes)}", Color.Gainsboro); _itemConsole.Print(1, 9, $"{Coloring.DarkGrey("Effort:")} {weapon.WeaponEffortType}", Color.Gainsboro); } else if (baseItem is Armor armor) { _itemConsole.Print(1, 5, $"{Coloring.DarkGrey("Armor:")} {Coloring.Green(armor.ArmorBonus.ToString())}", Color.Gainsboro); _itemConsole.Print(1, 6, $"{Coloring.DarkGrey("Penaltiy:")} {Coloring.Red(armor.ArmorCheckPenalty.ToString())}", Color.Gainsboro); _itemConsole.Print(1, 7, $"{Coloring.DarkGrey("Max Dex:")} {armor.MaxDexterityBonus}", Color.Gainsboro); _itemConsole.Print(1, 8, $"{Coloring.DarkGrey("Spellf.:")} {armor.ArcaneSpellFailureChance}", Color.Gainsboro); _itemConsole.Print(1, 9, $"{Coloring.DarkGrey("Effort:")} {armor.ArmorEffortType}", Color.Gainsboro); } //_itemConsole.Print(1, 15, $"{baseItem.Description}", Color.Gainsboro); }
public void RemoveItemFromConsole(Item item) { if (item != null) { inventoryConsole.Clear(new Rectangle(0, 0, Width, Height)); } }
public void Stop() { _mapConsole.IsVisible = false; _mapConsole.Children.Clear(); _entities.Clear(); _statsConsole.Clear(); }
private void RefreshBackingPanel() { topBarPane.Clear(); var text = new SadConsole.ColoredString(" X: ", Settings.Appearance_Text) + new SadConsole.ColoredString(topBarMousePosition.X.ToString(), Settings.Appearance_TextValue) + new SadConsole.ColoredString(" Y: ", Settings.Appearance_Text) + new SadConsole.ColoredString(topBarMousePosition.Y.ToString(), Settings.Appearance_TextValue) + new SadConsole.ColoredString(" Layer: ", Settings.Appearance_Text) + new SadConsole.ColoredString(topBarLayerName, Settings.Appearance_TextValue) + new SadConsole.ColoredString(" Tool: ", Settings.Appearance_Text) + new SadConsole.ColoredString(topBarToolName, Settings.Appearance_TextValue); topBarPane.Print(0, 0, text); }
private void SetMessage(string text) { messageData.TextSurface = new BasicSurface(text.Length, 1) { DefaultBackground = new Color(0, 0, 0, 128) }; messageData.Clear(); messageData.Print(0, 0, text); // Center the message console messageData.Position = new Point(40 - text.Length / 2, 0); }
public MainScreen() { MainScreen.Instance = this; // Create the basic consoles QuickSelectPane = new SadConsoleEditor.Consoles.QuickSelectPane(); QuickSelectPane.Redraw(); QuickSelectPane.IsVisible = false; topBarPane = new SadConsole.Console(Settings.Config.WindowWidth, 1); topBarPane.TextSurface.DefaultBackground = Settings.Color_MenuBack; topBarPane.Clear(); topBarPane.FocusOnMouseClick = false; topBarPane.IsVisible = false; borderConsole = new SadConsoleEditor.Consoles.BorderConsole(10, 10); borderConsole.IsVisible = false; //borderConsole.UseMouse = false; borderConsole.MouseHandler = ProcessMouseForBrush; ToolsPane = new Consoles.ToolPane(); ToolsPane.Position = new Point(Settings.Config.WindowWidth - ToolsPane.Width - 1, 1); ToolsPane.IsVisible = false; brushScreen = new Consoles.BrushConsoleContainer(); var boundsLocation = new Point(0, topBarPane.TextSurface.Height).TranslateFont(topBarPane.TextSurface.Font, Settings.Config.ScreenFont) + new Point(1); InnerEmptyBounds = new Rectangle(boundsLocation, new Point(1, QuickSelectPane.Position.Y).PixelLocationToConsole(QuickSelectPane.TextSurface.Font.Size.X, QuickSelectPane.TextSurface.Font.Size.Y) - boundsLocation); InnerEmptyBounds.Width = new Point(ToolsPane.Position.X - 1, 0).TranslateFont(SadConsole.Global.FontDefault, Settings.Config.ScreenFont).X - 1; InnerEmptyBoundsPixels = new Rectangle(InnerEmptyBounds.Location.ConsoleLocationToPixel(Settings.Config.ScreenFont), InnerEmptyBounds.Size.ConsoleLocationToPixel(Settings.Config.ScreenFont)); // Add the consoles to the main console list Children.Add(borderConsole); Children.Add(brushScreen); Children.Add(QuickSelectPane); Children.Add(topBarPane); Children.Add(ToolsPane); // Setup the file types for base editors. EditorFileTypes = new Dictionary <Type, FileLoaders.IFileLoader[]>(3); OpenEditors = new List <SadConsoleEditor.Editors.IEditor>(); //EditorFileTypes.Add(typeof(Editors.DrawingEditor), new FileLoaders.IFileLoader[] { new FileLoaders.BasicSurface() }); // Add valid editors Editors = new Dictionary <string, SadConsoleEditor.Editors.Editors>(); Editors.Add("Console Draw", SadConsoleEditor.Editors.Editors.Console); Editors.Add("Animated Game Object", SadConsoleEditor.Editors.Editors.GameObject); Editors.Add("Game Scene", SadConsoleEditor.Editors.Editors.Scene); //Editors.Add("User Interface Console", SadConsoleEditor.Editors.Editors.GUI); }
private void ProcessTurn(GameTime time) { GameTime++; //MovementSystem.ProcessTurn(Entities); // Print game time and FPS String elapsedTime = $"Time: {GameTime}"; //String fps = $"FPS: {Math.Round(1f / time.ElapsedGameTime.TotalSeconds)}"; MainConsole.Clear(new Rectangle(1, 1, elapsedTime.Length, 1)); //MainConsole.Clear(new Rectangle(1, 2, fps.Length, 1)); MainConsole.Print(1, 1, elapsedTime); //MainConsole.Print(1, 2, fps); }
public void Update() { _statsConsole.Clear(); _rewardConsole.Clear(); //_statsConsole.Fill(DefaultForeground, new Color(20, 20, 20, 50), null); switch (_mogwai.Adventure.AdventureState) { case AdventureState.Extended: ChangeImage("travel.png"); break; case AdventureState.Completed: ChangeImage("victory.png"); _statsConsole.Print(1, 1, $"Gratulations {Coloring.Name(_mogwai.Name)}, you're a true hero!", Color.Brown); _statsConsole.Print(1, 2, $" Promise me you'll always remember that you're", Color.Brown); _statsConsole.Print(1, 3, $"braver than you believe, stronger than you seem,", Color.Brown); _statsConsole.Print(1, 4, $"and smarter than you think.", Color.Brown); _statsConsole.Print(1, 6, $" You're history, {Coloring.Name(_mogwai.Name)}, HURRAY!", Color.Gold); _statsConsole.Print(1, 8, $" Book of Mogwai, Ch.1337", Color.DarkGray); _statsConsole.Print(1, 9, $"'they will stand up as one and fight as legions!'", Color.OrangeRed); AddStatistic(true); break; case AdventureState.Failed: ChangeImage("fail.png"); //_statsConsole.Print(1, 1, $" 1 2 3 4 5 6"); //_statsConsole.Print(1, 2, $"123456789012345678901234567890123456789012345678901234567890"); _statsConsole.Print(1, 1, $"You died trying to free the world of this"); _statsConsole.Print(1, 2, $"terrible injustice, {Coloring.Name(_mogwai.Name)}!"); _statsConsole.Print(1, 3, $" The brave do not live forever but the cautious"); _statsConsole.Print(1, 4, $"do not live at all."); _statsConsole.Print(1, 6, $" May your soul be free now, {Coloring.Name(_mogwai.Name)}!", Color.Gold); _statsConsole.Print(11, 8, $" Book of Mogwai, Ch.7487", Color.DarkGray); _statsConsole.Print(11, 9, $"'A hero died and the world lost hope.'", Color.OrangeRed); AddStatistic(false); break; default: throw new ArgumentOutOfRangeException(); } }
private void UpdateInventoryText() { _textConsole.Clear(); _textConsole.Cursor.Position = new Point(0, 0); if (_inventoryDict.Count > _maxLineRows) { foreach (var item in _inventoryDict.OrderBy(x => x.Key).Take(_maxLineRows - 1)) { _textConsole.Cursor.Print(string.Format("{0} : {1}\r\n", item.Value, item.Key)); } _textConsole.Cursor.Print("<More Items..>"); } else { foreach (var item in _inventoryDict.OrderBy(x => x.Key)) { _textConsole.Cursor.Print(string.Format("{0} : {1}\r\n", item.Value, item.Key)); } } }
public static void ClearSelectionBox() { // Clear visual box display SelectionBox.Clear(); // Add all entities in selection to SelectedEntities list for (int x = SelectionBox.Position.X + 1; x < SelectionBox.Position.X + SelectionBox.Width - 1; x++) { for (int y = SelectionBox.Position.Y + 1; y < SelectionBox.Position.Y + SelectionBox.Height - 1; y++) { Entities.GameEntity entity = GameLogic.GameMapScreen.CurrentMap.GetActor(new Coord(x, y)); if (entity != null) { System.Console.WriteLine($"{entity.Name} selected"); SelectedEntities.Add(entity); //entity.AddGoRogueComponent(new Entities.SelectedActorComponent()); } } } ActiveSelecting = false; }
public SubConsoleCursor() { mainView = new Console(80, 23); subView = new Console(mainView.GetSubSurface(new Rectangle(mainView.Width - 26, mainView.Height - 11, 25, 10)), mainView.Font); subView.Cursor.IsEnabled = true; UseKeyboard = true; // Setup main view mainView.FillWithRandomGarbage(mainView.Font); mainView.MouseMove += (s, e) => { if (e.Mouse.LeftButtonDown) { e.Cell.Background = Color.Blue; } }; // Setup sub view subView.Position = new Point(4, 4); subView.DefaultBackground = Color.Black; subView.MouseMove += (s, e) => { if (e.Mouse.LeftButtonDown) { e.Cell.Background = Color.Red; } }; subView.IsDirtyChanged += (s, e) => mainView.IsDirty = subView.IsDirty; subView.Clear(); subView.Cursor.IsVisible = true; subView.Cursor .Print("The left-side box is a small console that uses a small area of the bottom-right of this whole console.") .CarriageReturn() .LineFeed(); // Ad the consoles to the list. Children.Add(mainView); Children.Add(subView); IsVisible = false; }
public SubConsoleCursor() { mainView = new Console(80, 23); subView = Console.FromSurface(mainView.GetViewSurface(new Rectangle(30, 4, 25, 10))); UseKeyboard = true; // Setup main view mainView.FillWithRandomGarbage(); mainView.MouseMove += (s, e) => { if (e.MouseState.Mouse.LeftButtonDown) { e.MouseState.Cell.Background = Color.Blue; } }; // Setup sub view subView.Position = new Point(4, 4); subView.DefaultBackground = Color.Black; subView.MouseMove += (s, e) => { if (e.MouseState.Mouse.LeftButtonDown) { e.MouseState.Cell.Background = Color.Red; } }; subView.DirtyChanged += (s, e) => mainView.IsDirty = subView.IsDirty; subView.Clear(); subView.Cursor.IsVisible = true; subView.Cursor .Print("The left box is a whole console which is a view into the box on the right.") .CarriageReturn() .LineFeed(); // Ad the consoles to the list. Children.Add(mainView); Children.Add(subView); IsVisible = false; }
public static void Transparent(this SadConsole.Console c) { c.DefaultBackground = Color.Transparent; c.DefaultForeground = Color.Transparent; c.Clear(); }