Beispiel #1
0
        public void AppendSymbol(Symbol symbol, TextFormatting format = null, DialogFormatting dialogFormat = null)
        {
            format       = format ?? DefaultFormat;
            dialogFormat = dialogFormat ?? DefaultDialog;

            AppendElement(new TextElementSymbol(symbol, format, dialogFormat));
        }
Beispiel #2
0
        public void AppendSpace(int width, TextFormatting format = null, DialogFormatting dialogFormat = null)
        {
            format       = format ?? DefaultFormat;
            dialogFormat = dialogFormat ?? DefaultDialog;

            AppendElement(new TextElementSpace(width, format, dialogFormat));
        }
Beispiel #3
0
 public TextBuilder(float width, float height, TextFormatting defaultFormat = null, DialogFormatting defaultDialog = null)
 {
     Root = new TextElementContainer(width, height);
     ContainerStack.Push(Root);
     DefaultFormat = defaultFormat ?? new TextFormatting();
     DefaultDialog = defaultDialog ?? new DialogFormattingIdentity();
 }
Beispiel #4
0
 public TextElementDynamic(Func <string> value, float width, TextFormatting format, DialogFormatting dialogFormat)
 {
     Value        = value;
     Width        = width;
     Format       = format;
     DialogFormat = dialogFormat;
 }
Beispiel #5
0
 public TextElementCounter(Func <int> value, int digits, TextFormatting formatFront, TextFormatting formatBack, DialogFormatting dialogFormat)
 {
     Value        = value;
     Digits       = digits;
     FormatFront  = formatFront;
     FormatBack   = formatBack;
     DialogFormat = dialogFormat;
 }
Beispiel #6
0
        public void AppendText(string str, TextFormatting format = null, DialogFormatting dialogFormat = null)
        {
            format       = format ?? DefaultFormat;
            dialogFormat = dialogFormat ?? DefaultDialog;

            StringBuilder builder = new StringBuilder();

            void pushString()
            {
                if (builder.Length > 0)
                {
                    AppendElement(new TextElementWord(builder.ToString(), format, dialogFormat));
                }
                builder.Clear();
            }

            for (int i = 0; i < str.Length; i++)
            {
                char chr = str[i];

                switch (chr)
                {
                case (' '):
                    pushString();
                    AppendElement(new TextElementSpace(4, format, dialogFormat));
                    break;

                case ('\n'):
                    pushString();
                    NewLine();
                    break;

                default:
                    builder.Append(chr);
                    break;
                }
            }

            pushString();
        }
Beispiel #7
0
 public TextElementWord(string text, TextFormatting format, DialogFormatting dialogFormat)
 {
     Text         = text;
     Format       = format;
     DialogFormat = dialogFormat;
 }
        public static void AppendAsKey(this TextBuilder builder, string str, Color color, DialogFormatting dialog = null)
        {
            TextFormatting formatting = new TextFormatting()
            {
                Bold      = true,
                GetParams = (pos) => new DialogParams()
                {
                    Color  = color,
                    Border = Color.Black,
                    Scale  = Vector2.One,
                }
            };

            builder.AppendText(str, formatting, dialog);
        }
 public static void AppendSymbol(this TextBuilder builder, Symbol symbol, TextFormatting format = null, DialogFormatting dialogFormat = null)
 {
     builder.AppendSymbol(symbol, format, dialogFormat);
 }
 public static void AppendDamage(this TextBuilder builder, Symbol symbol, int damage, Color color, DialogFormatting dialog = null)
 {
     AppendDescribe(builder, symbol, $"{damage:+0;-#}", color, dialog);
 }
 public static void AppendText(this TextBuilder builder, string str, TextFormatting format = null, DialogFormatting dialogFormat = null)
 {
     builder.AppendText(str, format, dialogFormat);
 }
        public static void AppendDescribe(this TextBuilder builder, Symbol symbol, string str, Color color, DialogFormatting dialog = null)
        {
            TextFormatting formatting = new TextFormatting()
            {
                Bold      = true,
                GetParams = (pos) => new DialogParams()
                {
                    Color  = color,
                    Border = Color.Black,
                    Scale  = Vector2.One,
                }
            };

            builder.StartNoBreak();
            builder.AppendText(str, formatting, dialog);
            builder.AppendSymbol(symbol, formatting, dialog);
            builder.EndNoBreak();
        }
 public static void AppendGain(this TextBuilder builder, Symbol symbol, int amount, Color color, DialogFormatting dialog = null)
 {
     AppendDescribe(builder, symbol, amount.ToString("+#;-#;0"), color, dialog);
 }
 public static void AppendStored(this TextBuilder builder, Symbol symbol, int amount, Color color, DialogFormatting dialog = null)
 {
     AppendStatus(builder, symbol, amount.ToString(), color, dialog);
 }
Beispiel #15
0
 public TextElementSpace(float width, TextFormatting format, DialogFormatting dialogFormat)
 {
     Width        = width;
     Format       = format;
     DialogFormat = dialogFormat;
 }
Beispiel #16
0
 public TextElementIcon(IDrawableIcon icon, TextFormatting format, DialogFormatting dialogFormat)
 {
     Icon         = icon;
     Format       = format;
     DialogFormat = dialogFormat;
 }
Beispiel #17
0
 public TextElementSymbol(Symbol symbol, TextFormatting format, DialogFormatting dialogFormat)
 {
     Symbol       = symbol;
     Format       = format;
     DialogFormat = dialogFormat;
 }
 public static void AppendAsKey(this TextBuilder builder, string str, DialogFormatting dialog = null)
 {
     AppendAsKey(builder, str, Color.White, dialog);
 }