/// <inheritdoc /> protected override void PrepareStyle(TextDialogueItem currentText) { var startPart = new StringBuilder(); var endPart = new StringBuilder(); if (currentText.Bold == true) { startPart.Append("<b>"); endPart.Append("</b>"); } if (!string.IsNullOrEmpty(currentText.Color)) { startPart.Append(currentText.Color.StartsWith("#") ? $"<color={currentText.Color}>" : $"<color=\"{currentText.Color}\">"); endPart.Append("</color>"); } if (currentText.Italic == true) { startPart.Append("<i>"); endPart.Append("</i>"); } if (currentText.Underline == true) { startPart.Append("<u>"); endPart.Append("</u>"); } if (currentText.Strikethrough == true) { startPart.Append("<s>"); endPart.Append("</s>"); } if (currentText.FontSize.HasValue) { if (currentText.RelativeSize == true) { startPart.Append(currentText.FontSize >= 0 ? $"<size=+{currentText.FontSize}>" : $"<size=-{currentText.FontSize}>"); endPart.Append("</size>"); } else { startPart.Append($"<size={currentText.FontSize}>"); endPart.Append("</size>"); } } _styleStart = startPart.ToString(); _styleEnd = endPart.ToString(); }
/// <summary> /// 准备文本段样式 /// </summary> /// <param name="currentText">目标文本段</param> protected abstract void PrepareStyle(TextDialogueItem currentText);