// Copyright (c) Pixel Crushers. All rights reserved. using UnityEngine; namespace PixelCrushers.DialogueSystem { /// /// An emphasis setting specifies a text style. Chat Mapper projects define emphasis settings /// for formatting lines of dialogue. Every dialogue database stores an array of emphasis /// settings. /// [System.Serializable] public class EmphasisSetting { /// /// The color of the text. /// public Color color = Color.black; /// /// If true, draw the text in bold. /// public bool bold = false; /// /// If true, draw the text in italics. /// public bool italic = false; /// /// If true, underline the text. /// public bool underline = false; /// /// Initializes a new EmphasisSetting. /// /// /// Text color. /// /// /// Bold flag. /// /// /// Italic flag. /// /// /// Underline flag. /// public EmphasisSetting(Color color, bool bold, bool italic, bool underline) { this.color = color; this.bold = bold; this.italic = italic; this.underline = underline; } /// /// Initializes a new EmphasisSetting. /// /// /// A web RGB-format color code of the format "\#rrggbb", where rr, gg, and bb are /// hexadecimal values (e.g., \#ff0000 for red). /// /// /// A style code of the format "biu", where b=bold, i=italic, u=underline, and a dash turns /// the setting off. For example, "b--" means bold only. /// public EmphasisSetting(string colorCode, string styleCode) { color = Tools.WebColor(colorCode); bold = !string.IsNullOrEmpty(styleCode) && (styleCode.Length > 0) && (styleCode[0] == 'b'); italic = (!string.IsNullOrEmpty(styleCode)) && (styleCode.Length > 1) && (styleCode[1] == 'i'); underline = (!string.IsNullOrEmpty(styleCode)) && (styleCode.Length > 2) && (styleCode[2] == 'u'); } public bool IsEmpty { get { return (color == Color.black) && !bold && !italic && !underline; } } } }