Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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();
 }
Exemplo n.º 4
0
 public TextElementDynamic(Func <string> value, float width, TextFormatting format, DialogFormatting dialogFormat)
 {
     Value        = value;
     Width        = width;
     Format       = format;
     DialogFormat = dialogFormat;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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();
        }
Exemplo n.º 7
0
 public TextElementWord(string text, TextFormatting format, DialogFormatting dialogFormat)
 {
     Text         = text;
     Format       = format;
     DialogFormat = dialogFormat;
 }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
 public static void AppendSymbol(this TextBuilder builder, Symbol symbol, TextFormatting format = null, DialogFormatting dialogFormat = null)
 {
     builder.AppendSymbol(symbol, format, dialogFormat);
 }
Exemplo n.º 10
0
 public static void AppendDamage(this TextBuilder builder, Symbol symbol, int damage, Color color, DialogFormatting dialog = null)
 {
     AppendDescribe(builder, symbol, $"{damage:+0;-#}", color, dialog);
 }
Exemplo n.º 11
0
 public static void AppendText(this TextBuilder builder, string str, TextFormatting format = null, DialogFormatting dialogFormat = null)
 {
     builder.AppendText(str, format, dialogFormat);
 }
Exemplo n.º 12
0
        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();
        }
Exemplo n.º 13
0
 public static void AppendGain(this TextBuilder builder, Symbol symbol, int amount, Color color, DialogFormatting dialog = null)
 {
     AppendDescribe(builder, symbol, amount.ToString("+#;-#;0"), color, dialog);
 }
Exemplo n.º 14
0
 public static void AppendStored(this TextBuilder builder, Symbol symbol, int amount, Color color, DialogFormatting dialog = null)
 {
     AppendStatus(builder, symbol, amount.ToString(), color, dialog);
 }
Exemplo n.º 15
0
 public TextElementSpace(float width, TextFormatting format, DialogFormatting dialogFormat)
 {
     Width        = width;
     Format       = format;
     DialogFormat = dialogFormat;
 }
Exemplo n.º 16
0
 public TextElementIcon(IDrawableIcon icon, TextFormatting format, DialogFormatting dialogFormat)
 {
     Icon         = icon;
     Format       = format;
     DialogFormat = dialogFormat;
 }
Exemplo n.º 17
0
 public TextElementSymbol(Symbol symbol, TextFormatting format, DialogFormatting dialogFormat)
 {
     Symbol       = symbol;
     Format       = format;
     DialogFormat = dialogFormat;
 }
Exemplo n.º 18
0
 public static void AppendAsKey(this TextBuilder builder, string str, DialogFormatting dialog = null)
 {
     AppendAsKey(builder, str, Color.White, dialog);
 }