public ColoredCharacter[,] GetCurrentView() { var result = new ColoredCharacter[Size.X, Size.Y]; for (var x = 0; x < Size.X; x++) { for (var y = 0; y < Size.Y; y++) { int ax = Position.X + x, ay = Position.Y + y; if (x >= Scene.Decorations.GetLength(0) || y >= Scene.Decorations.GetLength(1)) { result[x, y] = Filler; } else { result[x, y] = Scene.GetCharacterAt(new Vector3(ax, ay, Height))?.Appearance ?? Scene.Decorations[ax, ay, Height]?.Appearance ?? Filler; } } } return(result); }
public ColoredCharacter[,] GetCurrentView() { var views = DisplayingQueue.Select(e => e.GetCurrentView()).ToArray(); var result = new ColoredCharacter[ views.Max(v => v.GetLength(0)), views.Sum(v => v.GetLength(1)) + Indentiation * (views.Length - 1)]; for (var x = 0; x < result.GetLength(0); x++) { for (var y = 0; y < result.GetLength(1); y++) { result[x, y] = new ColoredCharacter(' ', ConsoleColor.Black); } } var currentY = 0; foreach (var view in views) { result.Put(view, new Vector2(0, currentY)); currentY += view.GetLength(1) + Indentiation; } return(result); }
public ColoredCharacter[,] GetCurrentView() { var result = new ColoredCharacter[Size.X, Size.Y]; for (var x = 0; x < result.GetLength(0); x++) { for (var y = 0; y < result.GetLength(1); y++) { ColoredCharacter c; if (x == 0 && y == 0) { c = new ColoredCharacter('┌', BorderColor); } else if (x == result.GetLength(0) - 1 && y == 0) { c = new ColoredCharacter('┐', BorderColor); } else if (x == 0 && y == result.GetLength(1) - 1) { c = new ColoredCharacter('└', BorderColor); } else if (x == result.GetLength(0) - 1 && y == result.GetLength(1) - 1) { c = new ColoredCharacter('┘', BorderColor); } else if (x == 0 || x == result.GetLength(0) - 1) { c = new ColoredCharacter('│', BorderColor); } else if (y == 0 || y == result.GetLength(1) - 1) { c = new ColoredCharacter('─', BorderColor); } else { c = new ColoredCharacter(' ', BorderColor); } result[x, y] = c; } } return(result); }
public static List <ColoredCharacter> PaintCharacter(string word, string chinese) { string[] split = word.Split(separators); int j = 0; List <ColoredCharacter> coloredCharactersList = new List <ColoredCharacter> { }; foreach (string splitSymbols in split) { if (!string.IsNullOrWhiteSpace(splitSymbols)) { string style = ColorConstants.fifthTone; foreach (char symbol in splitSymbols) { if (firstTone.Contains(symbol)) { style = ColorConstants.firstTone; } if (secondTone.Contains(symbol)) { style = ColorConstants.secondTone; } if (thirdTone.Contains(symbol)) { style = ColorConstants.thirdTone; } if (fourthTone.Contains(symbol)) { style = ColorConstants.fourthTone; } } ColoredCharacter coloredCharacter = new ColoredCharacter(chinese[j], style); coloredCharactersList.Add(coloredCharacter); j++; } } return(coloredCharactersList); }
public ColoredCharacter[,] GetCurrentView() { var values = GetContent(); if (values.Length == 0) { return(new ColoredCharacter[0, 0]); } var result = new ColoredCharacter[values.Max(v => v.Length), values.Length]; for (var i = 0; i < values.Length; i++) { result.Put( values[i] .ToCharArray() .Select(c => new ColoredCharacter(c, ConsoleColor.Gray)) .ToArray() .To2D(), new Vector2(0, i)); } return(result); }