public void SetAlignment(DisplayLineAlignment align) { if (aligned) { return; } this.aligned = true; this.align = align; if (buttons.Length == 0) { return; } //DisplayLineの幅 int width = 0; for (var i = 0; i < buttons.Length; ++i) { width += buttons[i].Width; } //現在位置 int pointX = buttons[0].PointX; //目標位置 int movetoX = 0; if (align == DisplayLineAlignment.LEFT) { //位置固定に対応 if (IsLogicalLine) { return; } movetoX = 0; } else if (align == DisplayLineAlignment.CENTER) { movetoX = Config.WindowX / 2 - width / 2; } else if (align == DisplayLineAlignment.RIGHT) { movetoX = Config.WindowX - width; } //移動距離 int shiftX = movetoX - pointX; if (shiftX != 0) { this.ShiftPositionX(shiftX); } }
public void SetAlignment(DisplayLineAlignment align) { if (aligned) { return; } aligned = true; Align = align; if (Buttons.Length == 0) { return; } //DisplayLineの幅 var width = 0; foreach (var button in Buttons) { width += button.Width; } //現在位置 var pointX = Buttons[0].PointX; //目標位置 var movetoX = 0; if (align == DisplayLineAlignment.LEFT) { //位置固定に対応 if (IsLogicalLine) { return; } movetoX = 0; } else if (align == DisplayLineAlignment.CENTER) { movetoX = Config.WindowX / 2 - width / 2; } else if (align == DisplayLineAlignment.RIGHT) { movetoX = Config.WindowX - width; } //移動距離 var shiftX = movetoX - pointX; if (shiftX != 0) { ShiftPositionX(shiftX); } }
public void ResetStyle() { userStyle = defaultStyle; alignment = DisplayLineAlignment.LEFT; }
public void PrintSingleLine(string str, bool center, bool temporary) { if (string.IsNullOrEmpty(str)) return; PrintFlush(false); printBuffer.Append(str, Style); ConsoleDisplayLine dispLine = BufferToSingleLine(true, temporary); if (dispLine == null) return; DisplayLineAlignment curAlignment = alignment; if (center) alignment = DisplayLineAlignment.CENTER; addDisplayLine(dispLine); alignment = curAlignment; RefreshStrings(false); }
//public void PrintLine(string str, bool force) //{ // bool b = force_temporary; // if (force_temporary) // force_temporary = false; // PrintSingleLine(str, false, false); // force_temporary = b; //} public void PrintError(string str) { if (string.IsNullOrEmpty(str)) return; if (Program.DebugMode) { this.DebugPrint(str); this.DebugNewLine(); } PrintFlush(false); ConsoleDisplayLine dispLine = PrintPlainwithSingleLine(str); if (dispLine == null) return; DisplayLineAlignment curAlignment = alignment; addDisplayLine(dispLine); alignment = curAlignment; RefreshStrings(false); //printBuffer.Append(str, defaultStyle); //ConsoleDisplayLine dispLine = BufferToSingleLine(true, false); //if (dispLine == null) // return; //DisplayLineAlignment curAlignment = alignment; //addDisplayLine(dispLine); //alignment = curAlignment; //RefreshStrings(false); }
internal void PrintErrorButton(string str, string p, ScriptPosition pos) { if (string.IsNullOrEmpty(str)) return; ConsoleDisplayLine dispLine = printBuffer.AppendErrButton(str, Style, p, pos, new StringMeasure(getGraphics(), this.bgColor, Config.TextDrawingMode)); if (dispLine == null) return; DisplayLineAlignment curAlignment = alignment; addDisplayLine(dispLine); alignment = curAlignment; RefreshStrings(false); if (Program.DebugMode) { this.DebugPrint(str); this.DebugNewLine(); } }
public void ResetStyle() { style = defaultStyle; alignment = DisplayLineAlignment.LEFT; }
public void SetAlignment(DisplayLineAlignment align) { //DisplayLineの幅 int width = 0; foreach (ConsoleButtonString button in buttons) width += button.Width; //現在位置 int pointX = buttons[0].PointX; //目標位置 int movetoX = 0; if (align == DisplayLineAlignment.LEFT) movetoX = 0; else if (align == DisplayLineAlignment.CENTER) movetoX = Config.WindowX / 2 - width / 2; else if (align == DisplayLineAlignment.RIGHT) movetoX = Config.WindowX - width; //移動距離 int shiftX = movetoX - pointX; if(shiftX != 0) this.ShiftPositionX(shiftX); }