RemoveSafe() public method

Removes a command from the appropriate command stack and from the All stack.
public RemoveSafe ( ParseCommandBase command ) : void
command ParseCommandBase The command to remove
return void
        public override void Build(ref ColoredGlyph glyphState, ColoredGlyph[] glyphString, int surfaceIndex, ITextSurface surface, SurfaceEditor editor, 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);
        }
Beispiel #2
0
        public override void Build(ref ColoredGlyph glyphState, ColoredGlyph[] glyphString, int surfaceIndex, ITextSurface surface, SurfaceEditor editor, ref int stringIndex, string processedString, ParseCommandStacks commandStack)
        {
            glyphState.Glyph = Glyph;

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

            if (Counter == 0)
                commandStack.RemoveSafe(this);
        }
        public override void Build(ref ColoredGlyph glyphState, ColoredGlyph[] glyphString, int surfaceIndex, ITextSurface surface, SurfaceEditor editor, ref int stringIndex, string processedString, ParseCommandStacks commandStack)
        {
            Color newColor;

            if (Default)
            {
                if (CommandType == CommandTypes.Background)
                {
                    newColor = surface != null ? surface.DefaultBackground : Color.Transparent;
                }
                else
                {
                    newColor = surface != null ? surface.DefaultForeground : Color.White;
                }
            }
            else
            {
                if (CommandType == CommandTypes.Background)
                {
                    newColor = glyphState.Background;
                }
                else
                {
                    newColor = glyphState.Foreground;
                }

                newColor = Color.FromArgb(KeepAlpha ? newColor.A : A,
                                          KeepRed ? newColor.R : R,
                                          KeepGreen ? newColor.G : G,
                                          KeepBlue ? newColor.B : B
                                          );
            }

            if (CommandType == CommandTypes.Background)
            {
                glyphState.Background = newColor;
            }
            else
            {
                glyphState.Foreground = newColor;
            }

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

                if (Counter == 0)
                {
                    commandStack.RemoveSafe(this);
                }
            }
        }
Beispiel #4
0
        public override void Build(ref ColoredGlyph glyphState, ColoredGlyph[] glyphString, int surfaceIndex, ITextSurface surface, SurfaceEditor editor, ref int stringIndex, string processedString, ParseCommandStacks commandStack)
        {
            glyphState.Effect = BlinkEffect;

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

                if (Counter == 0)
                {
                    commandStack.RemoveSafe(this);
                }
            }
        }
        public override void Build(ref ColoredGlyph glyphState, ColoredGlyph[] glyphString, int surfaceIndex, Surfaces.SurfaceBase surface, ref int stringIndex, string processedString, ParseCommandStacks commandStack)
        {
            glyphState.Mirror = Mirror;

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

                if (Counter == 0)
                {
                    commandStack.RemoveSafe(this);
                }
            }
        }
        /// <inheritdoc />
        public override void Build(ref ColoredString.ColoredGlyphEffect glyphState, ColoredString.ColoredGlyphEffect[] glyphString, int surfaceIndex,
                                   ICellSurface surface, ref int stringIndex, string processedString, ParseCommandStacks commandStack)
        {
            glyphState.Mirror = Mirror;

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

                if (_counter == 0)
                {
                    commandStack.RemoveSafe(this);
                }
            }
        }
        public override void Build(ref ColoredGlyph glyphState, ColoredGlyph[] glyphString, int surfaceIndex, Surfaces.SurfaceBase 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);
            }
        }
Beispiel #8
0
        public override void Build(ref ColoredGlyph glyphState, ColoredGlyph[] glyphString, int surfaceIndex, Surfaces.SurfaceBase surface, ref int stringIndex, string processedString, ParseCommandStacks commandStack)
        {
            if (RandomGlyph)
            {
                glyphState.GlyphCharacter = (char)SadConsole.Global.Random.Next(RandomGlyphMin, RandomGlyphMax);
            }
            else
            {
                glyphState.GlyphCharacter = Glyph;
            }

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

            if (Counter == 0)
            {
                commandStack.RemoveSafe(this);
            }
        }
Beispiel #9
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);
            }
        }
Beispiel #10
0
        public override void Build(ref ColoredGlyph glyphState, ColoredGlyph[] glyphString, int surfaceIndex,
                                   CellSurface surface, ref int stringIndex, string processedString, ParseCommandStacks commandStack)
        {
            Color newColor;

            if (Default)
            {
                if (CommandType == CommandTypes.Background)
                {
                    newColor = surface != null ? surface.DefaultBackground : Color.Transparent;
                }
                else
                {
                    newColor = surface != null ? surface.DefaultForeground : Color.White;
                }
            }
            else
            {
                if (CommandType == CommandTypes.Background)
                {
                    newColor = glyphState.Background;
                }
                else
                {
                    newColor = glyphState.Foreground;
                }

                if (!KeepRed)
                {
                    newColor.R = R;
                }
                if (!KeepGreen)
                {
                    newColor.G = G;
                }
                if (!KeepBlue)
                {
                    newColor.B = B;
                }
                if (!KeepAlpha)
                {
                    newColor.A = A;
                }
            }

            if (CommandType == CommandTypes.Background)
            {
                glyphState.Background = newColor;
            }
            else
            {
                glyphState.Foreground = newColor;
            }

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

                if (Counter == 0)
                {
                    commandStack.RemoveSafe(this);
                }
            }
        }
        public override void Build(ref ColoredGlyph glyphState, ColoredGlyph[] glyphString, int surfaceIndex, ITextSurface surface, SurfaceEditor editor, ref int stringIndex, string processedString, ParseCommandStacks commandStack)
        {
            Color newColor;

            if (Default)
            {
                if (CommandType == CommandTypes.Background)
                    newColor = surface != null ? surface.DefaultBackground : Color.Transparent;
                else
                    newColor = surface != null ? surface.DefaultForeground : Color.White;
            }
            else
            {
                if (CommandType == CommandTypes.Background)
                    newColor = glyphState.Background;
                else
                    newColor = glyphState.Foreground;

                if (!KeepRed)
                    newColor.R = R;
                if (!KeepGreen)
                    newColor.G = G;
                if (!KeepBlue)
                    newColor.B = B;
                if (!KeepAlpha)
                    newColor.A = A;
            }

            if (CommandType == CommandTypes.Background)
                glyphState.Background = newColor;
            else
                glyphState.Foreground = newColor;

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

                if (Counter == 0)
                    commandStack.RemoveSafe(this);
            }
        }
Beispiel #12
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);
                }
            }
        }