Empty implementation of IBlock interface. References a block outside the boundary of the IBlockStorage. Returns AIR as its material, setting the material does nothing.
Inheritance: IBlock
コード例 #1
0
 private void VisitEmptyBlock(EmptyBlock block)
 {
     if (block.Prev != null && block.Next != null)
     {
         NewLine();
     }
 }
コード例 #2
0
        public static void AddAttributes(EmptyBlock self)
        {
            LanguageService ls = LanguageService.Get(self);

            if (ls == null)
            {
                return;
            }
            if (!(self.Next is ITypeDeclaration) && !(self.Next is IClassLevel))
            {
                return;
            }
            foreach (var attributeType in ls.GetAttributeTypes())
            {
                var name = attributeType.Name.Replace("Attribute", "");
                CreateBlocksItem item = new CreateBlocksItem(
                    name,
                    () => new AttributeBlock()
                {
                    Text = name
                }
                    );
                item.Picture = Icons.TypeClass;
                self.Completion.Items.Add(item);
            }
        }
コード例 #3
0
ファイル: MarkdownParser.cs プロジェクト: xoofx/markdig
        /// <summary>
        /// Parses the specified markdown into an AST <see cref="MarkdownDocument"/>
        /// </summary>
        /// <param name="text">A Markdown text</param>
        /// <param name="pipeline">The pipeline used for the parsing.</param>
        /// <param name="context">A parser context used for the parsing.</param>
        /// <returns>An AST Markdown document</returns>
        /// <exception cref="ArgumentNullException">if reader variable is null</exception>
        public static MarkdownDocument Parse(string text, MarkdownPipeline?pipeline = null, MarkdownParserContext?context = null)
        {
            if (text is null)
            {
                ThrowHelper.ArgumentNullException_text();
            }

            pipeline ??= Markdown.DefaultPipeline;

            text = FixupZero(text);

            var document = new MarkdownDocument
            {
                IsOpen = true
            };

            if (pipeline.PreciseSourceLocation)
            {
                int roughLineCountEstimate = text.Length / 32;
                roughLineCountEstimate    = Math.Max(4, Math.Min(512, roughLineCountEstimate));
                document.LineStartIndexes = new List <int>(roughLineCountEstimate);
            }

            var blockProcessor = BlockProcessor.Rent(document, pipeline.BlockParsers, context, pipeline.TrackTrivia);

            try
            {
                blockProcessor.Open(document);

                ProcessBlocks(blockProcessor, new LineReader(text));

                if (pipeline.TrackTrivia)
                {
                    Block?lastBlock = blockProcessor.LastBlock;
                    if (lastBlock is null && document.Count == 0)
                    {
                        // this means we have unassigned characters
                        var noBlocksFoundBlock         = new EmptyBlock(null);
                        List <StringSlice> linesBefore = blockProcessor.UseLinesBefore();
                        noBlocksFoundBlock.LinesAfter = new List <StringSlice>();
                        noBlocksFoundBlock.LinesAfter.AddRange(linesBefore);
                        document.Add(noBlocksFoundBlock);
                    }
                    else if (lastBlock != null && blockProcessor.LinesBefore != null)
                    {
                        // this means we're out of lines, but still have unassigned empty lines.
                        // thus, we'll assign the empty unsassigned lines to the last block
                        // of the document.
                        var rootMostContainerBlock = Block.FindRootMostContainerParent(lastBlock);
                        rootMostContainerBlock.LinesAfter ??= new List <StringSlice>();
                        var linesBefore = blockProcessor.UseLinesBefore();
                        rootMostContainerBlock.LinesAfter.AddRange(linesBefore);
                    }
                }

                // At this point the LineIndex is the same as the number of lines in the document
                document.LineCount = blockProcessor.LineIndex;
            }
コード例 #4
0
ファイル: GameRuleTest.cs プロジェクト: GDxU/Richman4L
        public void AccessExpressionTest( )
        {
            GameRule emptyRule = GameRule.GenerateEmpty( );

            Game.PeapareNew( );
            Game.Current.GameRule = emptyRule;
            EmptyBlock block = new EmptyBlock(new MapPosition(1, 1));
            GameValue  c     = block.Flammability;
        }
コード例 #5
0
        public EmptyBlock GenerateEmptyBlockAtPosition(Point aPosition)
        {
            EmptyBlock block = new EmptyBlock(myGridBundle);

            block.LoadContent();

            myGridBundle.Container.SetBlock(aPosition, block);

            return(block);
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="field"></param>
        /// <param name="withWall"></param>
        /// <param name="leftPadding"></param>
        public static void Draw(Field field, bool withWall, int leftPadding)
        {
            var defaultForegroundColor = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Red;
            for (int y = 0; y < field.Height; ++y)
            {
                for (int p = 0; p < leftPadding; ++p)
                {
                    System.Console.Write(PaddingSpace.ToString());
                }

                if (withWall)
                {
                    Console.ForegroundColor = ConsoleColor.Gray;
                    System.Console.Write(Wall);
                    Console.ForegroundColor = ConsoleColor.Red;
                }

                for (int x = 0; x < field.Width; ++x)
                {
                    System.Console.Write("{0}", field.FieldBlocks[y, x] == 0 ? EmptyBlock.ToString() : NormalBlock.ToString());
                }

                if (withWall)
                {
                    Console.ForegroundColor = ConsoleColor.Gray;
                    System.Console.Write(Wall);
                }

                System.Console.WriteLine();
            }

            for (int p = 0; p < leftPadding; ++p)
            {
                System.Console.Write(PaddingSpace.ToString());
            }

            if (withWall)
            {
                Console.ForegroundColor = ConsoleColor.Gray;

                for (int x = 0; x < field.Width + 2; ++x)
                {
                    System.Console.Write(Wall);
                }
                System.Console.WriteLine();
            }

            Console.ForegroundColor = defaultForegroundColor;
        }
コード例 #7
0
 private BlockType ConstructBlock(int rowNo,int columnNo,ref int adjacentBlocks)
 {
     adjacentBlocks = CalculateNeibourMines(rowNo, columnNo);
     if (adjacentBlocks == 0)
     {
         currentBlocks[rowNo, columnNo] = new EmptyBlock();
         return BlockType.EmptyBlock;
     }
     else
     {
         currentBlocks[rowNo, columnNo] = new NumberBlock(adjacentBlocks);
         return BlockType.NumberBlock;
     }
 }
コード例 #8
0
 public void addEmptyBlock(int x, int y)
 {
     if (blocks[x, y] == null)
     {
         GameObject obj = new GameObject();
         EmptyBlock b   = obj.AddComponent <EmptyBlock>();
         b.init(background.color, background.color, this, emptyBlockFolder.transform);
         b.transform.localPosition = new Vector3(x, y, 0);
         blocks[x, y] = b;
     }
     else
     {
         GameObject obj = blocks[x, y].gameObject;
         DestroyImmediate(blocks[x, y]);
         blocks[x, y] = obj.AddComponent <EmptyBlock>();
         blocks[x, y].init(background.color, background.color, this, emptyBlockFolder.transform);
     }
 }
コード例 #9
0
        public void GenerateGrid()
        {
            if (myGridBundle.Behavior != null)
            {
                myGridBundle.Behavior.OnGridReset();
            }
            myGridBundle.Container.RemoveAll();
            myGridBundle.Container.GenerateTiles();

            myGridBundle.Container.myBlocks = new List <AbstractBlock>();

            for (int columns = 0; columns < myGridBundle.Container.GetInitialWidth(); ++columns)
            {
                FrozenBlock block = new FrozenBlock(myGridBundle);
                block.SetPosition(columns, 0);
                myGridBundle.Container.myBlocks.Add(block);

                Tile tiley = myGridBundle.Container.myGrid[0][columns];
                tiley.SetBlock(block);
            }

            for (int rows = 1; rows < myGridBundle.Container.GetInitialHeight(); ++rows)
            {
                for (int columns = 0; columns < myGridBundle.Container.GetInitialWidth(); ++columns)
                {
                    EmptyBlock block = new EmptyBlock(myGridBundle);
                    //ColorBlock block = new ColorBlock(myGridBundle);
                    block.SetPosition(columns, rows);
                    myGridBundle.Container.myBlocks.Add(block);

                    Tile tiley = myGridBundle.Container.myGrid[rows][columns];
                    tiley.SetBlock(block);
                }
            }

            foreach (AbstractBlock block in myGridBundle.Container.myBlocks)
            {
                block.LoadContent();
            }

            myGridBundle.Container.PrintGrid();
            myGridBundle.Container.EnsureUnique();
        }
コード例 #10
0
        public void AddEmptyRow()
        {
            myGridBundle.Container.myGrid.Add(new List <Tile>());
            int row = myGridBundle.Container.myGrid.Count() - 1;

            for (int columns = 0; columns < myGridBundle.Container.GetInitialWidth(); ++columns)
            {
                Tile tiley = new Tile();
                myGridBundle.Container.myGrid[row].Add(tiley);

                EmptyBlock block = new EmptyBlock(myGridBundle);
                block.SetPosition(columns, row); //here
                myGridBundle.Container.myBlocks.Add(block);
                tiley.SetBlock(block);

                //myGridBundle.Container.SetBlock(new Point(columns, row), block);
            }
            //myGridBundle.Container.EnsureUnique();
        }
コード例 #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="block"></param>
        /// <param name="leftPadding"></param>
        public static void Draw(Defs.Blocks[,] block, int leftPadding)
        {
            var defaultForegroundColor = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Red;
            for (int y = 0; y < block.GetLength(0); ++y)
            {
                for (int p = 0; p < leftPadding; ++p)
                {
                    System.Console.Write(PaddingSpace.ToString());
                }

                for (int x = 0, max = block.GetLength(1); x < max; ++x)
                {
                    System.Console.Write("{0}", block[y, x] == 0 ? EmptyBlock.ToString() : NormalBlock.ToString());
                }
                System.Console.WriteLine();
            }
            Console.ForegroundColor = defaultForegroundColor;
        }
コード例 #12
0
ファイル: Map.cs プロジェクト: spritefun/gta2net
        private Map()
        {
            cityBlocks = new Block[MaxWidth, MaxLength, MaxHeight];

            Filename = string.Empty;

            Zones      = new List <Zone>();
            Objects    = new List <MapObject>();
            Animations = new List <TileAnimation>();
            Lights     = new List <Light>();

            for (var i = 0; i < Width; i++)
            {
                for (var j = 0; j < Length; j++)
                {
                    for (var k = 0; k < Height; k++)
                    {
                        cityBlocks[i, j, k] = new EmptyBlock(new Vector3(i, j, k));
                    }
                }
            }
        }
コード例 #13
0
        private void ProcessBlocks()
        {
            while (true)
            {
                // Get the precise position of the begining of the line
                var lineText = lineReader.ReadLine();

                // If this is the end of file and the last line is empty
                if (lineText.Text is null)
                {
                    if (trackTrivia)
                    {
                        Block?lastBlock = blockProcessor.LastBlock;
                        if (lastBlock is null && document.Count == 0)
                        {
                            // this means we have unassigned characters
                            var noBlocksFoundBlock         = new EmptyBlock(null);
                            List <StringSlice> linesBefore = blockProcessor.UseLinesBefore();
                            noBlocksFoundBlock.LinesAfter = new List <StringSlice>();
                            noBlocksFoundBlock.LinesAfter.AddRange(linesBefore);
                            document.Add(noBlocksFoundBlock);
                        }
                        else if (lastBlock != null && blockProcessor.LinesBefore != null)
                        {
                            // this means we're out of lines, but still have unassigned empty lines.
                            // thus, we'll assign the empty unsassigned lines to the last block
                            // of the document.
                            var rootMostContainerBlock = Block.FindRootMostContainerParent(lastBlock);
                            rootMostContainerBlock.LinesAfter ??= new List <StringSlice>();
                            var linesBefore = blockProcessor.UseLinesBefore();
                            rootMostContainerBlock.LinesAfter.AddRange(linesBefore);
                        }
                    }
                    break;
                }
                blockProcessor.ProcessLine(lineText);
            }
コード例 #14
0
 public MoreThan3TextBlocksCondition(EmptyBlock parent)
 {
     Parent = parent;
 }