• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Block类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Block的典型用法代码示例。如果您正苦于以下问题:C# Block类的具体用法?C# Block怎么用?C# Block使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: DrawSearchHighlight

		private void DrawSearchHighlight(DrawingContext dc, Block block)
		{
			foreach (var pair in _curSearchMatches)
			{
				int txtOffset = 0;
				double y = block.Y;

				for (int i = 0; i < block.Text.Length; i++)
				{
					int start = Math.Max(txtOffset, pair.Item1);
					int end = Math.Min(txtOffset + block.Text[i].Length, pair.Item2);

					if (end > start)
					{
						double x1 = block.Text[i].GetDistanceFromCharacterHit(new CharacterHit(start, 0)) + block.TextX;
						double x2 = block.Text[i].GetDistanceFromCharacterHit(new CharacterHit(end, 0)) + block.TextX;

						dc.DrawRectangle(_searchBrush.Value, null,
							new Rect(new Point(x1, y), new Point(x2, y + _lineHeight)));
					}

					y += _lineHeight;
					txtOffset += block.Text[i].Length;
				}
			}
		}
开发者ID:derrickcreamer,项目名称:Floe,代码行数:26,代码来源:ChatPresenter_Searching.cs


示例2: BlockUpdate

 public BlockUpdate( Player origin, short x, short y, short z, Block blockType ) {
     Origin = origin;
     X = x;
     Y = y;
     Z = z;
     BlockType = blockType;
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:7,代码来源:BlockUpdate.cs


示例3: recursiveBlockDivision

	private void recursiveBlockDivision(Block block, ArrayList blocks, int loopsLeft) {
		if (loopsLeft < 0) {
			return;
		}
		float currentMagnitude = (block.c3 - block.c1).magnitude;
		Block[] newBlocks = subDivideBlock (block);
		bool subDivide;
		if (Mathf.Max ((block.c2 - block.c1).magnitude, (block.c4 - block.c1).magnitude) > maximumBlockSize) { //block too large, subdivide			
			subDivide = true;
		} else if (newBlocks [0].IsNull) { //block can be  subdivided, keep it like this			
			subDivide = false;
			blocks.Add (block);
		} else {
			if (currentMagnitude < minimumBlockSize * 6 && Random.value <= 0.2) {
				subDivide = false;
			} else if (Random.value <= 0.2) {				
				subDivide = false;
				blocks.Add (block);
			} else {
				subDivide = true;
			}
		}

		if (subDivide) {
			recursiveBlockDivision (newBlocks [0], blocks, loopsLeft - 1);
			recursiveBlockDivision (newBlocks [1], blocks, loopsLeft - 1);
		}
	}
开发者ID:ManuelKers,项目名称:shady,代码行数:28,代码来源:GenerateCity.cs


示例4: GetFormattingObject

        /// <summary>
        /// Get formatting object for body element
        /// </summary>
        /// <param name="regionId"></param>
        /// <param name="tick"></param>
        /// <returns></returns>
        public override FormattingObject GetFormattingObject(TimeCode tick)
        {

            Block block = null;

            if (TemporallyActive(tick))
            {
                block = new Block(this);

                foreach (var child in Children)
                {
                    if (child is DivElement)
                    {
                        var fo = (child as DivElement).GetFormattingObject(tick);
                        if (fo != null)
                        {
                            fo.Parent = block;
                            block.Children.Add(fo);
                        }
                    }

                    if (child is SetElement)
                    {
                        var fo = ((child as SetElement).GetFormattingObject(tick)) as Animation;
                        if (fo != null)
                        {
                            // fo.Parent = block;
                            block.Animations.Add(fo);
                        }
                    }
                }
            }
            return block;
        }
开发者ID:Ginichen,项目名称:Silverlight-Player-for-PlayReady-with-Token-Auth,代码行数:40,代码来源:BodyElement.cs


示例5: IsSwitchType2

		bool IsSwitchType2(Block switchBlock) {
			Local local = null;
			foreach (var instr in switchBlock.Instructions) {
				if (!instr.IsLdloc())
					continue;
				local = Instr.GetLocalVar(blocks.Locals, instr);
				break;
			}
			if (local == null)
				return false;

			foreach (var source in switchBlock.Sources) {
				var instrs = source.Instructions;
				for (int i = 1; i < instrs.Count; i++) {
					var ldci4 = instrs[i - 1];
					if (!ldci4.IsLdcI4())
						continue;
					var stloc = instrs[i];
					if (!stloc.IsStloc())
						continue;
					if (Instr.GetLocalVar(blocks.Locals, stloc) != local)
						continue;

					return true;
				}
			}

			return false;
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:29,代码来源:SwitchCflowDeobfuscator.cs


示例6: PlaySoundPlayer

		public static void PlaySoundPlayer(AudioClip clip, bool loop, Block player,
			PlayerAudioType type)
		{
			if (clip == null)
				return;

			var audio = _instance.PlayerAudioSource;
			if (!audio.enabled)
				return;

			if (player == Block.Player1)
				_instance._player1 = type;
			else if (player == Block.Player2)
				_instance._player2 = type;

			if (type == PlayerAudioType.Idle)
				if (_instance._player1 == PlayerAudioType.Move ||
					_instance._player2 == PlayerAudioType.Move)
					return;

			if (audio.clip == clip && audio.isPlaying)
				return;

			audio.loop = loop;
			audio.clip = clip;
			audio.Play();
		}
开发者ID:Thanhvx-dth,项目名称:Tanks,代码行数:27,代码来源:AudioManager.cs


示例7: Build

    public void Build(Vector3 pos, int width, int height)
    {
        for (int i = -10; i < width + 10; i++)
        {
            for (int j = -10; j < height + 10; j++)
            {
                GameObject cell = Resources.Load("Cell", typeof(GameObject)) as GameObject;

                float x = i * dx, y = j * dy;
                if (j % 2 != 0) {
                    x += dx/2;
                }

                cell.transform.position = pos + new Vector3(x, y, 0);
                GameObject cellClone = Instantiate(cell);

                cellClone.GetComponent<CellPosition>().Set(i, j);
                Entity e;
                if (i < 0 || i >= width || j < 0 || j > height)
                    e = new Block(Block.BlockType.Water);
                else
                    e = Entity.getRandom();

                cellClone.GetComponent<CellContent>().SetEntity(e);

                if (i == 0 && j == 0)
                    Camera.main.GetComponent<CameraMotion>().minpos = cellClone.transform.position;
                if (i == width-1 && j == height-1)
                    Camera.main.GetComponent<CameraMotion>().maxpos = cellClone.transform.position;
            }
        }
    }
开发者ID:RatushnenkoV,项目名称:TheGame,代码行数:32,代码来源:BuildGreed.cs


示例8: FireworkParticle

 public FireworkParticle(World world, Vector3I pos, Block block)
     : base(world)
 {
     _startingPos = pos;
     _nextZ = pos.Z - 1;
     _block = block;
 }
开发者ID:EricKilla,项目名称:LegendCraft,代码行数:7,代码来源:ParticleSystem.cs


示例9: Deobfuscate

		protected override bool Deobfuscate(Block block) {
			bool modified = false;
			var instructions = block.Instructions;
			for (int i = 0; i < instructions.Count; i++) {
				var instr = instructions[i];
				switch (instr.OpCode.Code) {
				// Xenocode generates stloc + ldloc (bool). Replace it with dup + stloc. It will eventually
				// become dup + pop and be removed.
				case Code.Stloc:
				case Code.Stloc_S:
				case Code.Stloc_0:
				case Code.Stloc_1:
				case Code.Stloc_2:
				case Code.Stloc_3:
					if (i + 1 >= instructions.Count)
						break;
					if (!instructions[i + 1].IsLdloc())
						break;
					var local = Instr.GetLocalVar(locals, instr);
					if (local.Type.ElementType != ElementType.Boolean)
						continue;
					if (local != Instr.GetLocalVar(locals, instructions[i + 1]))
						break;
					instructions[i] = new Instr(OpCodes.Dup.ToInstruction());
					instructions[i + 1] = instr;
					modified = true;
					break;

				default:
					break;
				}
			}

			return modified;
		}
开发者ID:GodLesZ,项目名称:de4dot,代码行数:35,代码来源:StLdlocFixer.cs


示例10: Start

    void Start()
    {
        filter = gameObject.GetComponent<MeshFilter>();
        coll = gameObject.GetComponent<MeshCollider>();

        //past here is just to set up an example chunk
        blocks = new Block[chunkSize, chunkSize, chunkSize];

        for (int x = 0; x < chunkSize; x++)
        {
            for (int y = 0; y < chunkSize; y++)
            {
                for (int z = 0; z < chunkSize; z++)
                {
                    blocks[x, y, z] = new BlockAir();
                }
            }
        }

        blocks[1, 1, 1] = new Block();
        blocks[1, 2, 1] = new Block();
        blocks[1, 2, 2] = new Block();
        blocks[2, 2, 2] = new Block();

        UpdateChunk();
    }
开发者ID:billy1234,项目名称:TerrainGenMaster,代码行数:26,代码来源:Chunk.cs


示例11: GenerateChunk

    /// <summary>
    /// Generate a chunk and return it. The terrain object remains unmodified.
    /// </summary>
    /// <param name="terrain">The terrain.</param>
    /// <param name="chunkIndex">The chunk index.</param>
    /// <returns>The chunk.</returns>
    public Chunk GenerateChunk(Terrain terrain, Vector2I chunkIndex)
    {
        Chunk chunk = new Chunk();

        // Calculate the position of the chunk in world coordinates
        var chunkPos = new Vector2I(chunkIndex.X * Chunk.SizeX, chunkIndex.Y * Chunk.SizeY);

        // Get the surface heights for this chunk
        int[] surfaceHeights = this.GenerateSurfaceHeights(chunkPos);

        // For now, fill the terrain with mud under the surface
        for (int x = 0; x < Chunk.SizeX; x++)
        {
            int surfaceHeight = surfaceHeights[x];
            if (surfaceHeight > 0)
            {
                for (int y = 0; y < surfaceHeight; y++)
                {
                    chunk[x, y] = new Block(BlockType.Dirt);
                }
            }
        }

        return chunk;
    }
开发者ID:andynygard,项目名称:game-dwarves,代码行数:31,代码来源:TerrainChunkGenerator.cs


示例12: BlockFloat

 public BlockFloat(World world, Vector3I position, Block Type)
     : base(world)
 {
     _pos = position;
     _nextPos = position.Z + 1;
     type = Type;
 }
开发者ID:venofox,项目名称:AtomicCraft,代码行数:7,代码来源:WaterPhysics.cs


示例13: TwitterClient

        public TwitterClient(IRestClient client, string consumerKey, string consumerSecret, string callback)
            : base(client)
        {
            Encode = true;
            Statuses = new Statuses(this);
            Account = new Account(this);
            DirectMessages = new DirectMessages(this);
            Favourites = new Favourites(this);
            Block = new Block(this);
            Friendships = new Friendship(this);
            Lists = new List(this);
            Search = new Search(this);
            Users = new Users(this);
            FriendsAndFollowers = new FriendsAndFollowers(this);

            OAuthBase = "https://api.twitter.com/oauth/";
            TokenRequestUrl = "request_token";
            TokenAuthUrl = "authorize";
            TokenAccessUrl = "access_token";
            Authority = "https://api.twitter.com/";
            Version = "1";

#if !SILVERLIGHT
            ServicePointManager.Expect100Continue = false;
#endif
            Credentials = new OAuthCredentials
            {
                ConsumerKey = consumerKey,
                ConsumerSecret = consumerSecret,
            };

            if (!string.IsNullOrEmpty(callback))
                ((OAuthCredentials)Credentials).CallbackUrl = callback;
        }
开发者ID:hsinchen,项目名称:MahApps.Twitter,代码行数:34,代码来源:TwitterClient.cs


示例14: subDivideBlock

	private Block[] subDivideBlock(Block originBlock) {

	
		bool xSpace = Mathf.Abs(originBlock.c3.x-originBlock.c1.x) > minimumBlockSize * 2.1;
		bool ySpace = Mathf.Abs(originBlock.c3.y-originBlock.c1.y) > minimumBlockSize * 2.1;
        float roadWidth = Random.Range(roadWidthMin, roadWidthMax);
		if (!xSpace && !ySpace) { 
			Block b1 = new Block ();
			Block b2 = new Block ();
			Debug.Assert (b1.IsNull);
			Debug.Assert (b2.IsNull);
			return new Block[2]{new Block(), new Block()}; 
		}

		bool xSplit = (xSpace && Random.value < 0.5f) || !ySpace;
		float splitPlace;
		if (xSplit) {
			splitPlace = Random.Range (originBlock.c1.x+minimumBlockSize, originBlock.c3.x-minimumBlockSize);
			Block block1 = new Block (originBlock.c1, new Vector2(splitPlace-roadWidth/2, originBlock.c3.y));
			Block block2 = new Block (new Vector2(splitPlace+roadWidth/2, originBlock.c1.y), originBlock.c3);
			return new Block[2]{block1,block2};
					
		} else {
			splitPlace = Random.Range (originBlock.c1.y+minimumBlockSize, originBlock.c3.y-minimumBlockSize);
			Block block1 = new Block (originBlock.c1, new Vector2(originBlock.c3.x, splitPlace-roadWidth/2));
			Block block2 = new Block (new Vector2(originBlock.c1.x, splitPlace+roadWidth/2), originBlock.c3);
			return new Block[2]{block1,block2};
		}
	}
开发者ID:ManuelKers,项目名称:shady,代码行数:29,代码来源:GenerateCity.cs


示例15: Zombie

 public Zombie(int x, int y)
     : base(x, y)
 {
     updateTimer.Start();
     lagTimer.Start();
     zombieBlock = Block.CreateBlock(0, xBlock, yBlock, 32, 0);
 }
开发者ID:CheeseSoftware,项目名称:DynamicEEBot,代码行数:7,代码来源:Zombie.cs


示例16: CanFloat

 public static bool CanFloat(Block block)
 {
     switch (block)
     {
         case Block.Red:
         case Block.Orange:
         case Block.Yellow:
         case Block.Lime:
         case Block.Green:
         case Block.Teal:
         case Block.Aqua:
         case Block.Cyan:
         case Block.Blue:
         case Block.Indigo:
         case Block.Violet:
         case Block.Magenta:
         case Block.Pink:
         case Block.Black:
         case Block.Gray:
         case Block.White:
         case Block.Sponge:
         case Block.Wood:
         case Block.Leaves:
             return true;
         default:
             return false;
     }
 }
开发者ID:venofox,项目名称:AtomicCraft,代码行数:28,代码来源:Physics.cs


示例17: UndoBlock

 public UndoBlock( Vector3I coord, Block block )
 {
     X = (short)coord.X;
     Y = (short)coord.Y;
     Z = (short)coord.Z;
     Block = block;
 }
开发者ID:Blingpancakeman,项目名称:800craft,代码行数:7,代码来源:UndoState.cs


示例18: GetEmptyWorld

        private WorldBlock[, ,] GetEmptyWorld(int sizeX, int sizeY, Block fillBlock, Block borderBlock)
        {
            var blockArray = new WorldBlock[2, sizeX, sizeY];

            int maxX = sizeX - 1;
            int maxY = sizeY - 1;

            // Fill the middle with GravityNothing blocks
            for (var l = Layer.Background; l >= Layer.Foreground; l += -1)
                for (int x = 0; x <= maxX; x++)
                    for (int y = 0; y <= maxY; y++)
                        NewBlock(blockArray, l, x, y, fillBlock);

            // Border drawing
            for (int y = 0; y <= maxY; y++)
            {
                blockArray[0, 0, y].SetBlock(borderBlock);
                blockArray[0, maxX, y].SetBlock(borderBlock);
            }

            for (int x = 0; x <= maxX; x++)
            {
                blockArray[0, x, 0].SetBlock(borderBlock);
                blockArray[0, x, maxY].SetBlock(borderBlock);
            }

            return blockArray;
        }
开发者ID:KylerM,项目名称:CupCake,代码行数:28,代码来源:WorldService.cs


示例19: Main

 static void Main(string[] args)
 {
     InitComplements();
       var seq = new List<byte[]>();
       var b = new Block { Count = -1 };
       Index line = Index.None, start = Index.None, end = Index.None;
       using (var r = new BinaryReader(Console.OpenStandardInput())) {
      using (var w = Console.OpenStandardOutput()) {
         while (b.Read(r) > 0) {
            seq.Add(b.Data);
            if (line.Pos < 0) line = b.IndexOf(Gt, 0);
            while (line.Pos >= 0) {
               if (start.Pos < 0) {
                  var off = line.InBlock(b) ? line.Pos : 0;
                  start = b.IndexOf(Lf, off);
                  if (start.Pos < 0) {
                      w.Write(b.Data, off, b.Data.Length - off);
                      seq.Clear(); break;
                  }
                  w.Write(b.Data, off, start.Pos + 1 - off);
               }
               if (end.Pos < 0) {
                  end = b.IndexOf(Gt, start.InBlock(b) ? start.Pos : 0);
                  if (end.Pos < 0) break;
               }
               w.Reverse(start.Pos, end.Pos, seq);
               if (seq.Count > 1) seq.RemoveRange(0, seq.Count - 1);
               line = end; end = Index.None; start = Index.None;
            }
         }
         if (start.Pos >= 0 && end.Pos < 0)
            w.Reverse(start.Pos, seq[seq.Count -1].Length, seq);
      }
       }
 }
开发者ID:kjk,项目名称:kjkpub,代码行数:35,代码来源:revcomp.cs


示例20: Mixin

 internal Mixin(string name, string args, Block block, bool call)
 {
     Name = name;
     // Args = args;
     Block = block;
     // Call = call;
 }
开发者ID:moonwa,项目名称:jade.net,代码行数:7,代码来源:Mixin.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# BlockCommandComment类代码示例发布时间:2022-05-24
下一篇:
C# BlobServiceClient类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap