private void setSize() { if (this.message.Contains("\n")) { int longestWidth = 0; this.lines = this.message.Split('\n'); for (int i = 0; i < lines.Length; i++) { if (lines[i].Length > longestWidth) { longestWidth = lines[i].Length; } } this.position.X = (GraphicConsole.BufferWidth / 2) - longestWidth / 2 - 2; this.position.Y = (GraphicConsole.BufferHeight / 2) - 2; this.size.X = longestWidth + 4; this.size.Y = lines.Length + 4; //Line Count + spacing + border for (int i = 0; i < lines.Length; i++) { this.lines[i] = TextUtilities.CenterTextPadding(this.lines[i], longestWidth, ' '); } this.isMultilined = true; } else { this.position.X = (GraphicConsole.BufferWidth / 2) - this.message.Length / 2 - 2; this.position.Y = (GraphicConsole.BufferHeight / 2) - 2; this.size.X = this.message.Length + 4; this.size.Y = 5; this.isMultilined = false; } }
private void setSize() { if (message.Contains('\n')) { int longestWidth = 0; lines = message.Split('\n'); for (int i = 0; i < lines.Length; i++) { if (lines[i].Length > longestWidth) { longestWidth = lines[i].Length; } } position.X = (GraphicConsole.Instance.BufferWidth / 2) - longestWidth / 2 - 2; position.Y = (GraphicConsole.Instance.BufferHeight / 2) - 2; size.X = longestWidth + 4; size.Y = lines.Length + 4; //Line Count + spacing + border for (int i = 0; i < lines.Length; i++) { lines[i] = TextUtilities.CenterTextPadding(lines[i], longestWidth, ' '); } isMultilined = true; } else { position.X = (GraphicConsole.Instance.BufferWidth / 2) - message.Length / 2 - 2; position.Y = (GraphicConsole.Instance.BufferHeight / 2) - 2; size.X = message.Length + 4; size.Y = 5; isMultilined = false; } }