Esempio n. 1
0
            public override void Build(ref ColoredString.ColoredGlyphEffect glyphState, ColoredString.ColoredGlyphEffect[] glyphString, int surfaceIndex, ICellSurface surface, ref int stringIndex, string processedString, ParseCommandStacks commandStack)
            {
                glyphState.Glyph = Glyph;

                if (Counter != -1)
                {
                    Counter--;

                    if (Counter == 0)
                    {
                        commandStack.RemoveSafe(this);
                    }
                }
            }
Esempio n. 2
0
        /// <inheritdoc />
        public override void Build(ref ColoredString.ColoredGlyphEffect glyphState, ColoredString.ColoredGlyphEffect[] glyphString, int surfaceIndex,
                                   ICellSurface surface, ref int stringIndex, string processedString, ParseCommandStacks commandStack)
        {
            if (CommandType == CommandTypes.Background)
            {
                glyphState.Background = GradientString[Length - _counter].Foreground;
            }
            else
            {
                glyphState.Foreground = GradientString[Length - _counter].Foreground;
            }

            _counter--;

            if (_counter == 0)
            {
                commandStack.RemoveSafe(this);
            }
        }
Esempio n. 3
0
        /// <inheritdoc />
        public override void Build(ref ColoredString.ColoredGlyphEffect glyphState, ColoredString.ColoredGlyphEffect[] glyphString, int surfaceIndex,
                                   ICellSurface surface, ref int stringIndex, string processedString, ParseCommandStacks commandStack)
        {
            if (RandomGlyph)
            {
                glyphState.GlyphCharacter = (char)SadConsole.GameHost.Instance.Random.Next(RandomGlyphMin, RandomGlyphMax);
            }
            else
            {
                glyphState.GlyphCharacter = Glyph;
            }

            if (_counter != -1)
            {
                _counter--;
            }

            if (_counter == 0)
            {
                commandStack.RemoveSafe(this);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Builds a glyph.
 /// </summary>
 /// <param name="glyphState">The current glyph being built.</param>
 /// <param name="glyphString">The current string of glyphs that has been processed until now.</param>
 /// <param name="surfaceIndex">Where on the surface this flyph will appear.</param>
 /// <param name="surface">The surface associated with the glyph.</param>
 /// <param name="stringIndex">Where in the original string this glyph is from.</param>
 /// <param name="processedString">The entire string being processed.</param>
 /// <param name="commandStack">The state of commands.</param>
 public abstract void Build(ref ColoredString.ColoredGlyphEffect glyphState, ColoredString.ColoredGlyphEffect[] glyphString, int surfaceIndex,
                            ICellSurface surface, ref int stringIndex, string processedString, ParseCommandStacks commandStack);
Esempio n. 5
0
        /// <inheritdoc />
        public override void Build(ref ColoredString.ColoredGlyphEffect glyphState, ColoredString.ColoredGlyphEffect[] glyphString, int surfaceIndex,
                                   ICellSurface surface, ref int stringIndex, string processedString, ParseCommandStacks commandStack)
        {
            byte r = 0;
            byte g = 0;
            byte b = 0;
            byte a = 0;

            if (Default)
            {
                if (CommandType == CommandTypes.Background)
                {
                    (surface != null ? surface.DefaultBackground : Color.Transparent).Deconstruct(out r, out g, out b, out a);
                }
                else
                {
                    (surface != null ? surface.DefaultForeground : Color.White).Deconstruct(out r, out g, out b, out a);
                }
            }
            else
            {
                if (CommandType == CommandTypes.Background)
                {
                    glyphState.Background.Deconstruct(out r, out g, out b, out a);
                }
                else
                {
                    glyphState.Foreground.Deconstruct(out r, out g, out b, out a);
                }

                if (!KeepRed)
                {
                    r = R;
                }

                if (!KeepGreen)
                {
                    g = G;
                }

                if (!KeepBlue)
                {
                    b = B;
                }

                if (!KeepAlpha)
                {
                    a = A;
                }
            }

            if (CommandType == CommandTypes.Background)
            {
                glyphState.Background = new Color(r, g, b, a);
            }
            else
            {
                glyphState.Foreground = new Color(r, g, b, a);
            }

            if (_counter != -1)
            {
                _counter--;

                if (_counter == 0)
                {
                    commandStack.RemoveSafe(this);
                }
            }
        }