当前位置: 首页>>代码示例>>C#>>正文


C# Block.ToString方法代码示例

本文整理汇总了C#中Block.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Block.ToString方法的具体用法?C# Block.ToString怎么用?C# Block.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Block的用法示例。


在下文中一共展示了Block.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RotateAntiClockwise

 public void RotateAntiClockwise()
 {
     var resolver = new TestResolver();
     var block = new Block(resolver.Resolve<BlocksContent>(),
         new FixedRandom(new[] { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.9f }), new Point(8, 1));
     Assert.AreEqual("O.../OOO./..../....", block.ToString());
     block.RotateAntiClockwise();
     Assert.AreEqual(".O../.O../OO../....", block.ToString());
 }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:9,代码来源:BlockTests.cs

示例2: CheckIBlockAppearsATenthOfTheTime

		public void CheckIBlockAppearsATenthOfTheTime()
		{
			int count = 0;
			for (int i = 0; i < 1000; i++)
			{
				var block = new Block(displayMode, content, Vector2D.Zero);
				if (block.ToString() == "OOOO/..../..../...." || block.ToString() == "O.../O.../O.../O...")
					count++;
			}

			Assert.AreEqual(100, count, 50);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:12,代码来源:BlockTests.cs

示例3: CheckIBlockAppearsATenthOfTheTime

        public void CheckIBlockAppearsATenthOfTheTime(Type resolver)
        {
            Start(resolver, (BlocksContent content) =>
            {
                int count = 0;
                var random = new PseudoRandom();
                for (int i = 0; i < 10000; i++)
                {
                    var block = new Block(content, random, Point.Zero);
                    if (block.ToString() == "OOOO/..../..../...." || block.ToString() == "O.../O.../O.../O...")
                        count++;
                }

                Assert.AreEqual(1000, count, 70);
            });
        }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:16,代码来源:BlockTests.cs

示例4: It_has_a_useful_ToString_method

        public void It_has_a_useful_ToString_method()
        {
            var a = new Block("a");

            Assert.AreEqual("Block(\"a\")", a.ToString());
        }
开发者ID:reicheltp,项目名称:Nustache,代码行数:6,代码来源:Describe_Block.cs

示例5: WriteCallback

 static void WriteCallback( Player player, Vector3I[] marks, object tag )
 {
     Block block = new Block();
     string sentence = ( string )tag;
     //block bugfix kinda
     if ( player.LastUsedBlockType == Block.Undefined ) {
         block = Block.Stone;
     } else {
         block = player.LastUsedBlockType;
     }
     Direction direction = DirectionFinder.GetDirection( marks );
     try {
         FontHandler render = new FontHandler( block, marks, player, direction ); //create new instance
         render.CreateGraphicsAndDraw( sentence ); //render the sentence
         if ( render.blockCount > 0 ) {
             player.Message( "/Write (Size {0}, {1}: Writing '{2}' using {3} blocks of {4}",
                 player.font.Size,
                 player.font.FontFamily.Name,
                 sentence, render.blockCount,
                 block.ToString() );
         } else {
             player.Message( "&WNo direction was set" );
         }
         render = null; //get lost
     } catch ( Exception e ) {
         player.Message( e.Message );
         Logger.Log( LogType.Error, "WriteCommand: " + e );
     }
 }
开发者ID:727021,项目名称:800craft,代码行数:29,代码来源:BuildingCommands.cs

示例6: Draw2DCallback

        static void Draw2DCallback( Player player, Vector3I[] marks, object tag )
        {
            Block block = new Block();
            Draw2DData data = ( Draw2DData )tag;
            int radius = data.Radius;
            int Points = data.Points;
            bool fill = data.Fill;
            string Shape = data.Shape;
            if ( player.LastUsedBlockType == Block.Undefined ) {
                block = Block.Stone;
            } else {
                block = player.LastUsedBlockType;
            }
            Direction direction = DirectionFinder.GetDirection( marks );
            try {
                ShapesLib lib = new ShapesLib( block, marks, player, radius, direction );
                switch ( Shape.ToLower() ) {
                    case "polygon":
                        lib.DrawRegularPolygon( Points, 18, fill );
                        break;
                    case "star":
                        lib.DrawStar( Points, radius, fill );
                        break;
                    case "spiral":
                        lib.DrawSpiral();
                        break;
                    default:
                        player.Message( "&WUnknown shape" );
                        CdDraw2D.PrintUsage( player );
                        lib = null;
                        return;
                }

                if ( lib.blockCount > 0 ) {
                    player.Message( "/Draw2D: Drawing {0} with a size of '{1}' using {2} blocks of {3}",
                        Shape,
                        radius,
                        lib.blockCount,
                        block.ToString() );
                } else {
                    player.Message( "&WNo direction was set" );
                }
                lib = null; //get lost
            } catch ( Exception e ) {
                player.Message( e.Message );
            }
        }
开发者ID:727021,项目名称:800craft,代码行数:47,代码来源:BuildingCommands.cs

示例7: ParseStatement


//.........这里部分代码省略.........
                        }
                    case JSToken.ConditionalCompilationEnd:
                        {
                            ConditionalCompilationEnd endStatement = new ConditionalCompilationEnd(m_currentToken.Clone(), this);
                            GetNextToken();
                            return endStatement;
                        }

                    case JSToken.AspNetBlock:
                        return ParseAspNetBlock(consumeSemicolonIfPossible: true);

                    default:
                        m_noSkipTokenSet.Add(NoSkipTokenSet.s_EndOfStatementNoSkipTokenSet);
                        bool exprError = false;
                        try
                        {
                            bool bAssign;
                            // if this statement starts with a function within parens, we want to know now
                            bool parenFunction = (m_currentToken.Token == JSToken.LeftParenthesis && m_scanner.PeekToken() == JSToken.Function);
                            statement = ParseUnaryExpression(out bAssign, false);
                            if (statement != null && parenFunction)
                            {
                                FunctionObject functionObject = statement.LeftHandSide as FunctionObject;
                                if (functionObject != null)
                                {
                                    functionObject.LeftHandFunctionExpression = true;
                                }
                            }

                            // look for labels
                            if (statement is Lookup && JSToken.Colon == m_currentToken.Token)
                            {
                                // can be a label
                                id = statement.ToString();
                                if (m_labelTable.ContainsKey(id))
                                {
                                    // there is already a label with that name. Ignore the current label
                                    ReportError(JSError.BadLabel, statement.Context.Clone(), true);
                                    id = null;
                                    GetNextToken(); // skip over ':'
                                    return new Block(CurrentPositionContext(), this);
                                }
                                else
                                {
                                    GetNextToken();
                                    int labelNestCount = m_labelTable.Count + 1;
                                    m_labelTable.Add(id, new LabelInfo(m_blockType.Count, labelNestCount));
                                    if (JSToken.EndOfFile != m_currentToken.Token)
                                    {
                                        statement = new LabeledStatement(
                                            statement.Context.Clone(),
                                            this,
                                            id,
                                            labelNestCount,
                                            ParseStatement(fSourceElement)
                                            );
                                    }
                                    else
                                    {
                                        // end of the file!
                                        //just pass null for the labeled statement
                                        statement = new LabeledStatement(
                                            statement.Context.Clone(),
                                            this,
                                            id,
                                            labelNestCount,
开发者ID:nuxleus,项目名称:ajaxmin,代码行数:67,代码来源:jsparser.cs

示例8: ValidateDefinition

		protected void ValidateDefinition(string expStr, int expVariations, int expChildCount, Block org)
		{
			var tp = org.GetType().Name;
			var name = tp.Substring(5, 1);
			var rot = tp.Substring(6);
			Block.RotationType rotation = Block.RotationType.None;

			if (!String.IsNullOrEmpty(rot) && !Enum.TryParse<Block.RotationType>(rot, out rotation))
			{
				Assert.Fail("Type '{0}', name does not fit into contract.", tp);
			}

			Assert.AreEqual(name, org.Name, "Name");
			Assert.AreEqual(rotation, org.Rotation, "Rotation");

			Assert.AreEqual(expStr, org.ToString(), "ToString().");
			Assert.AreEqual(4, org.Count, "Count should be 4.");
			Assert.AreEqual(expVariations, org.Variations.Length, "Variations.Length");
			Assert.AreEqual(expChildCount, org.ChildCount, "ChildCount");
		}
开发者ID:Corniel,项目名称:AIGames.BlockBattle.Kubisme,代码行数:20,代码来源:BlockTest.cs

示例9: PlaceRandomBlock

        /// <summary>
        /// Places a random block on the map
        /// </summary>
        /// <param name="block">Blocktype to place</param>
        /// <param name="map">Map to place block in</param>
        /// <returns>Updated map</returns>
        public void PlaceRandomBlock(Block block, Map map)
        {
            var randX = _rand.Next(1, map.MapWidth);
            var randY = _rand.Next(1, map.MapHeight);
            while (IsWall(randX, randY, map))
            {
                randX = _rand.Next(1, map.MapWidth);
                randY = _rand.Next(1, map.MapHeight);
            }

            map.MapBlocks[randX, randY] = block;
            Palettes palette;
            Enum.TryParse(block.ToString(), out palette);

            map.ActionBlocks.Add(new BlockTile
            {
                Block = block,
                Coordinate = new Coordinate { X = randX, Y = randY },
                Palette = palette
            });
        }
开发者ID:SUHAFUTI,项目名称:Glorious-Console-Adventure,代码行数:27,代码来源:MapHandler.cs

示例10: getBlockName

 /// <summary> Get the name of the block, used when blockdefinition blocks should show their Name instead of ID .</summary>
 public static string getBlockName(Block block) {
     Block outBlock;
     if (GetBlockByName(block.ToString(), false, out outBlock)) {
         if (outBlock > MaxCustomBlockType) {
             return BlockDefinition.GlobalDefinitions[(int)outBlock].Name;
         }
         return outBlock.ToString();
     } else {
         return Block.None.ToString();
     }
 }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:12,代码来源:Map.cs

示例11: SetBlockOnTheRoad

    public void SetBlockOnTheRoad(Block area)
    {
        Debug.Log(area.ToString() + "通路に設定");
        NextToAreaList.Add(area);
        area.NextToAreaList.Add(this);

        area.SetBlockType(BlockType.Road);
        area.ConnectRoomList.AddRange(ConnectRoomList);
        area.PreRoom = this;
    }
开发者ID:yoshikimaehara,项目名称:Unity-test,代码行数:10,代码来源:Block.cs

示例12: SetBlockNextToRoom

    public void SetBlockNextToRoom(Block block)
    {
        Debug.Log("今の部屋:" + this.ToString());
        Debug.Log("隣の部屋:" + block.ToString());
        NextToAreaList.Add(block);
        block.NextToAreaList.Add(this);

        copyconnRoomList(block);
        block.copyconnRoomList(this);
    }
开发者ID:yoshikimaehara,项目名称:Unity-test,代码行数:10,代码来源:Block.cs

示例13: SetCell

		public void SetCell(int x, int y, Block type)
		{
			if (type == Block.Player1 || type == Block.Player2 || type == Block.Base)
			{
				var block = FindBlock(type);
				if (block != null)
				{
					Destroy(_blocks[block.X, block.Y].gameObject);
					_blocks[block.X, block.Y] = null;
				}
			}

			if (_blocks[x, y] != null)
			{
				Destroy(_blocks[x, y].gameObject);
				_blocks[x, y] = null;
			}

			var prefab = type.GetPrefab();
			if (prefab == null)
				return;

			var item = Instantiate(prefab);
			item.name = type.ToString();
			item.transform.SetParent(transform);

			var pos = prefab.transform.position;
			pos.x = x;
			pos.y = y;
			item.transform.position = pos;

			if (item is ISpawn)
				(item as ISpawn).SpawnPoint = pos;
			item.EditorMode = EditorMode;
			item.X = x;
			item.Y = y;

			_blocks[x, y] = item;
		}
开发者ID:Thanhvx-dth,项目名称:Tanks,代码行数:39,代码来源:FieldController.cs

示例14: ParsePageSelector

        private bool ParsePageSelector(Block token)
        {
            if (token.GrammarSegment == GrammarSegment.Colon || token.GrammarSegment == GrammarSegment.Whitespace)
            {
                return true;
            }

            if (token.GrammarSegment == GrammarSegment.Ident)
            {
                CastRuleSet<PageRule>().Selector = new SimpleSelector(token.ToString());
                return true;
            }

            if (token.GrammarSegment == GrammarSegment.CurlyBraceOpen)
            {
                SetParsingContext(ParsingContext.InDeclaration);
                return true;
            }

            return false;
        }
开发者ID:jtuttle87,项目名称:CssParser,代码行数:21,代码来源:Parser.Blocks.cs

示例15: ParseKeyframeText

        private bool ParseKeyframeText(Block token)
        {
            if (token.GrammarSegment == GrammarSegment.CurlyBraceOpen)
            {
                _frame = null;
                SetParsingContext(ParsingContext.InDeclaration);
                return true;
            }

            if (token.GrammarSegment == GrammarSegment.CurlyBracketClose)
            {
                ParseKeyframesData(token);
                return false;
            }

            if (token.GrammarSegment == GrammarSegment.Comma)
            {
                return true;
            }

            if (_frame == null)
            {
                _frame = new KeyframeRule();
                _frame.AddValue(token.ToString());

                CastRuleSet<KeyframesRule>().Declarations.Add(_frame);
                _activeRuleSets.Push(_frame);
            }
            else
            {
                _frame.AddValue(token.ToString());
            }

            return true;
        }
开发者ID:jtuttle87,项目名称:CssParser,代码行数:35,代码来源:Parser.Blocks.cs


注:本文中的Block.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。