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

C# Terraria.Tile类代码示例

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

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



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

示例1: isTheSameAs

 public bool isTheSameAs(Tile compTile)
 {
     if (this.active != compTile.active)
     {
         return false;
     }
     if (this.active)
     {
         if (this.type != compTile.type)
         {
             return false;
         }
         if (Main.tileFrameImportant[(int)this.type])
         {
             if (this.frameX != compTile.frameX)
             {
                 return false;
             }
             if (this.frameY != compTile.frameY)
             {
                 return false;
             }
         }
     }
     return this.wall == compTile.wall && this.liquid == compTile.liquid && this.lava == compTile.lava && this.wire == compTile.wire;
 }
开发者ID:vharonftw,项目名称:Terraria-Server-,代码行数:26,代码来源:Tile.cs


示例2: LiquidRenderer

 static LiquidRenderer()
 {
     LiquidRenderer.WATERFALL_LENGTH = new int[] { 10, 3, 2 };
     LiquidRenderer.DEFAULT_OPACITY = new float[] { 0.6f, 0.95f, 0.95f };
     LiquidRenderer.EMPTY_TILE = new Tile();
     LiquidRenderer.Instance = new LiquidRenderer();
 }
开发者ID:hastinbe,项目名称:TerrariaAPI-Server,代码行数:7,代码来源:LiquidRenderer.cs


示例3: Tile

		public Tile(Tile copy)
		{
			if (copy == null)
			{
				this.type = 0;
				this.wall = 0;
				this.liquid = 0;
				this.sTileHeader = 0;
				this.bTileHeader = 0;
				this.bTileHeader2 = 0;
				this.bTileHeader3 = 0;
				this.frameX = 0;
				this.frameY = 0;
				return;
			}
			this.type = copy.type;
			this.wall = copy.wall;
			this.liquid = copy.liquid;
			this.sTileHeader = copy.sTileHeader;
			this.bTileHeader = copy.bTileHeader;
			this.bTileHeader2 = copy.bTileHeader2;
			this.bTileHeader3 = copy.bTileHeader3;
			this.frameX = copy.frameX;
			this.frameY = copy.frameY;
		}
开发者ID:vito19,项目名称:TerrariaAPI-Server,代码行数:25,代码来源:Tile.cs


示例4: IsTileTheSame

        public static bool IsTileTheSame(Tile tile1, Tile tile2)
        {
            if (tile1.active() != tile2.active())
                return false;

            if (tile1.active())
            {
                if (tile1.type != tile2.type)
                    return false;

                if (Main.tileFrameImportant[(int)tile1.type])
                {
                    if ((tile1.frameX != tile2.frameX) || (tile1.frameX != tile2.frameX))
                        return false;
                }
            }
            return
                tile1.wall == tile2.wall
                &&
                tile1.liquid == tile2.liquid
                &&
                tile1.lava() == tile2.lava()
                &&
                tile1.wire() == tile2.wire()
                &&
                tile1.wire2() == tile2.wire2()
                &&
                tile1.wire3() == tile2.wire3();
        }
开发者ID:VanixxGraphix,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:29,代码来源:World.cs


示例5: TileEvent

 public TileEvent(Tile tile, Player player, int changeType)
     : base(player)
 {
     base.setState(false);
     this.tile = tile;
     this.changeType = changeType;
 }
开发者ID:pandabear41,项目名称:tLinux,代码行数:7,代码来源:TileEvent.cs


示例6: GetTileSafely

 public static Tile GetTileSafely(int i, int j)
 {
     Tile tile = Main.tile[i, j];
     if (tile == null)
     {
         tile = new Tile();
         Main.tile[i, j] = tile;
     }
     return tile;
 }
开发者ID:hastinbe,项目名称:TerrariaAPI-Server,代码行数:10,代码来源:Framing.cs


示例7: WorldRenderer

 public WorldRenderer(Tile[,] tiles, int worldWidth, int worldHeight, double worldSurface, double rockLayer)
 {
     Tiles = tiles;
     MaxX = worldWidth;
     MaxY = worldHeight;
     SurfaceY = (int)worldSurface;
     RockLayerY = (int)rockLayer + (600 / 16);
     HellLayerY = MaxY - 195;
     Colors = TerrariaColors.GetColors();
 }
开发者ID:Jaex,项目名称:Terraria-API,代码行数:10,代码来源:WorldRenderer.cs


示例8: LoadWorldData

		public static Tile[,] LoadWorldData(string path)
		{
			Tile[,] tile;
			using (BinaryReader reader = new BinaryReader(new FileStream(path, FileMode.Open)))
			{
				int xLen = reader.ReadInt32();
				int yLen = reader.ReadInt32();
				tile = new Tile[xLen, yLen];

				for (int i = 0; i < xLen; i++)
				{
					for (int j = 0; j < yLen; j++)
					{
						tile[i, j] = ReadTile(reader);
					}
				}
				return tile;
			}
		}
开发者ID:Jewsus,项目名称:Mazes,代码行数:19,代码来源:Tools.cs


示例9: isTheSameAs

 public bool isTheSameAs(Tile compTile)
 {
     if (this.active != compTile.active)
     {
         return false;
     }
     if (this.active)
     {
         if (this.type != compTile.type)
         {
             return false;
         }
         if (Main.tileFrameImportant[this.type])
         {
             if (this.frameX != compTile.frameX)
             {
                 return false;
             }
             if (this.frameY != compTile.frameY)
             {
                 return false;
             }
         }
     }
     if (this.wall != compTile.wall)
     {
         return false;
     }
     if (this.liquid != compTile.liquid)
     {
         return false;
     }
     if (this.lava != compTile.lava)
     {
         return false;
     }
     if (this.wire != compTile.wire)
     {
         return false;
     }
     return true;
 }
开发者ID:vharonftw,项目名称:Terraria-client-,代码行数:42,代码来源:Tile.cs


示例10: k_Constructor

		public void k_Constructor(Tile copy)
		{
			if (copy == null)
			{
				k_block = null;
				k_wall_protoID = 0;
				k_wall_variant = 0;
				k_wall_colourID = 0;
				k_liquid_protoID = 0;
				k_liquid_amount = 0;
				k_wireFlags = 0;
			}
			else
			{
				k_block = copy.k_block.Copy();
				k_wall_protoID = copy.k_wall_protoID;
				k_wall_variant = copy.k_wall_variant;
				k_wall_colourID = copy.k_wall_colourID;
				k_liquid_protoID = copy.k_liquid_protoID;
				k_liquid_amount = copy.k_liquid_amount;
				k_wireFlags = copy.k_wireFlags;
			}
		}
开发者ID:EmuDevs,项目名称:EDTerraria,代码行数:23,代码来源:Tile.cs


示例11: LoadWorldData

		public static Tile[,] LoadWorldData(string path)
		{
			Tile[,] tile;
			// GZipStream is already buffered, but it's much faster to have a 1 MB buffer.
			using (var reader =
				new BinaryReader(
					new BufferedStream(
						new GZipStream(File.Open(path, FileMode.Open), CompressionMode.Decompress), BUFFER_SIZE)))
			{
				reader.ReadInt32();
				reader.ReadInt32();
				int width = reader.ReadInt32();
				int height = reader.ReadInt32();
				tile = new Tile[width, height];

				for (int i = 0; i < width; i++)
				{
					for (int j = 0; j < height; j++)
						tile[i, j] = ReadTile(reader);
				}
				return tile;
			}
		}
开发者ID:Marcus101RR,项目名称:WorldEdit,代码行数:23,代码来源:Tools.cs


示例12: Tiles

 public Tiles(Tile Maintile, Point Loc)
 {
     this.maintile = Maintile;
      this.loc = Loc;
 }
开发者ID:dantedom,项目名称:editormod,代码行数:5,代码来源:TileBufferStructure.cs


示例13: DrawWaterfall


//.........这里部分代码省略.........
							Rectangle value = new Rectangle(num24 * 18, 0, 16, 16);
							Rectangle value2 = new Rectangle(num23 * 18, 0, 16, 16);
							Vector2 origin = new Vector2(8f, 8f);
							Vector2 position;
							if (num14 % 2 == 0)
							{
								position = new Vector2((float)(num13 * 16 + 9), (float)(num14 * 16 + 8)) - Main.screenPosition;
							}
							else
							{
								position = new Vector2((float)(num13 * 16 + 8), (float)(num14 * 16 + 8)) - Main.screenPosition;
							}
							bool flag = false;
							for (int j = 0; j < num22; j++)
							{
								Color color = Lighting.GetColor(num13, num14);
								float num25 = 0.6f;
								float num26 = 0.3f;
								if (j > num22 - 8)
								{
									float num27 = (float)(num22 - j) / 8f;
									num25 *= num27;
									num26 *= num27;
								}
								Color color2 = color * num25;
								Color color3 = color * num26;
								spriteBatch.Draw(this.waterfallTexture[12], position, new Rectangle?(value), color3, 0f, origin, 1f, SpriteEffects.None, 0f);
								spriteBatch.Draw(this.waterfallTexture[11], position, new Rectangle?(value2), color2, 0f, origin, 1f, SpriteEffects.None, 0f);
								if (flag)
								{
									break;
								}
								num14++;
								Tile tile = Main.tile[num13, num14];
								if (WorldGen.SolidTile(tile))
								{
									flag = true;
								}
								if (tile.liquid > 0)
								{
									int num28 = (int)(16f * ((float)tile.liquid / 255f)) & 254;
									if (num28 >= 15)
									{
										break;
									}
									value2.Height -= num28;
									value.Height -= num28;
								}
								if (num14 % 2 == 0)
								{
									position.X += 1f;
								}
								else
								{
									position.X -= 1f;
								}
								position.Y += 16f;
							}
							this.waterfalls[i].stopAtStep = 0;
						}
					}
				}
				IL_1879:
				i++;
				continue;
				IL_3FA:
开发者ID:NoviaDroid,项目名称:TerrariaRefractoring_1.3.2.1,代码行数:67,代码来源:WaterfallManager.cs


示例14: SolidTile

		public static bool SolidTile(Tile testTile)
		{
			try
			{
				if (testTile == null)
				{
					bool result = true;
					return result;
				}
				if (testTile.active() && Main.tileSolid[(int)testTile.type] && !Main.tileSolidTop[(int)testTile.type] && !testTile.halfBrick() && testTile.slope() == 0 && !testTile.inActive())
				{
					bool result = true;
					return result;
				}
			}
			catch
			{
			}
			return false;
		}
开发者ID:NoviaDroid,项目名称:TerrariaRefractoring_1.3.2.1,代码行数:20,代码来源:WorldGen.cs


示例15: TrackColors

 public static void TrackColors(int i, int j, Tile trackTile, out int frontColor, out int backColor)
 {
     int num;
     int num1;
     Tile tile;
     int num2;
     if (trackTile.type != 314)
     {
         frontColor = 0;
         backColor = 0;
     }
     else
     {
         frontColor = trackTile.color();
         backColor = frontColor;
         if (trackTile.frameY == -1)
         {
             return;
         }
         int num3 = Minecart._leftSideConnection[trackTile.frameX];
         int num4 = Minecart._rightSideConnection[trackTile.frameX];
         int num5 = Minecart._leftSideConnection[trackTile.frameY];
         int num6 = Minecart._rightSideConnection[trackTile.frameY];
         int num7 = 0;
         int num8 = 0;
         int num9 = 0;
         int num10 = 0;
         for (int i1 = 0; i1 < 4; i1++)
         {
             switch (i1)
             {
                 case 1:
                 {
                     num = num4;
                     break;
                 }
                 case 2:
                 {
                     num = num5;
                     break;
                 }
                 case 3:
                 {
                     num = num6;
                     break;
                 }
                 default:
                 {
                     num = num3;
                     break;
                 }
             }
             switch (num)
             {
                 case 0:
                 {
                     num1 = -1;
                     break;
                 }
                 case 1:
                 {
                     num1 = 0;
                     break;
                 }
                 case 2:
                 {
                     num1 = 1;
                     break;
                 }
                 default:
                 {
                     num1 = 0;
                     break;
                 }
             }
             tile = (i1 % 2 != 0 ? Main.tile[i + 1, j + num1] : Main.tile[i - 1, j + num1]);
             if (tile == null || !tile.active() || tile.type != 314)
             {
                 num2 = 0;
             }
             else
             {
                 num2 = tile.color();
             }
             switch (i1)
             {
                 case 1:
                 {
                     num8 = num2;
                     break;
                 }
                 case 2:
                 {
                     num9 = num2;
                     break;
                 }
                 case 3:
                 {
                     num10 = num2;
                     break;
//.........这里部分代码省略.........
开发者ID:Celant,项目名称:TerrariaAPI-Server,代码行数:101,代码来源:Minecart.cs


示例16: TrackCollision

 public static BitsByte TrackCollision(ref Vector2 Position, ref Vector2 Velocity, ref Vector2 lastBoost, int Width, int Height, bool followDown, bool followUp, int fallStart, bool trackOnly)
 {
     int num;
     int num1;
     Matrix matrix;
     Minecart.TrackState trackState;
     if (followDown && followUp)
     {
         followDown = false;
         followUp = false;
     }
     Vector2 vector2 = new Vector2((float)(Width / 2) - 25f, (float)(Height / 2));
     Vector2 position = Position + new Vector2((float)(Width / 2) - 25f, (float)(Height / 2));
     Vector2 vector21 = position + Minecart._trackMagnetOffset;
     Vector2 velocity = Velocity;
     float x = velocity.Length();
     velocity.Normalize();
     Vector2 y = vector21;
     Tile tile = null;
     bool flag = false;
     bool flag1 = true;
     int num2 = -1;
     int num3 = -1;
     int num4 = -1;
     Minecart.TrackState trackState1 = Minecart.TrackState.NoTrack;
     bool flag2 = false;
     bool flag3 = false;
     bool flag4 = false;
     bool flag5 = false;
     Vector2 zero = Vector2.Zero;
     Vector2 zero1 = Vector2.Zero;
     BitsByte bitsByte = new BitsByte();
     while (true)
     {
         int x1 = (int)(y.X / 16f);
         int y1 = (int)(y.Y / 16f);
         int x2 = (int)y.X % 16 / 2;
         if (flag1)
         {
             num4 = x2;
         }
         bool flag6 = x2 != num4;
         if ((trackState1 == Minecart.TrackState.OnBack || trackState1 == Minecart.TrackState.OnTrack || trackState1 == Minecart.TrackState.OnFront) && x1 != num2)
         {
             num = (trackState1 != Minecart.TrackState.OnBack ? tile.FrontTrack() : tile.BackTrack());
             num1 = (velocity.X >= 0f ? Minecart._rightSideConnection[num] : Minecart._leftSideConnection[num]);
             switch (num1)
             {
                 case 0:
                 {
                     y1--;
                     y.Y = y.Y - 2f;
                     break;
                 }
                 case 2:
                 {
                     y1++;
                     y.Y = y.Y + 2f;
                     break;
                 }
             }
         }
         Minecart.TrackState trackState2 = Minecart.TrackState.NoTrack;
         bool flag7 = false;
         if (x1 != num2 || y1 != num3)
         {
             if (!flag1)
             {
                 flag7 = true;
             }
             else
             {
                 flag1 = false;
             }
             tile = Main.tile[x1, y1];
             if (tile == null)
             {
                 tile = new Tile();
                 Main.tile[x1, y1] = tile;
             }
             flag = (!tile.nactive() || tile.type != 314 ? false : true);
         }
         if (flag)
         {
             Minecart.TrackState trackState3 = Minecart.TrackState.NoTrack;
             int num5 = tile.FrontTrack();
             int num6 = tile.BackTrack();
             int num7 = Minecart._tileHeight[num5][x2];
             switch (num7)
             {
                 case -4:
                 {
                     if (trackState1 != Minecart.TrackState.OnFront)
                     {
                         break;
                     }
                     if (!trackOnly)
                     {
                         trackState2 = Minecart.TrackState.NoTrack;
                         flag4 = true;
//.........这里部分代码省略.........
开发者ID:Celant,项目名称:TerrariaAPI-Server,代码行数:101,代码来源:Minecart.cs


示例17: PreRenderPhase

 public static void PreRenderPhase()
 {
     float num1 = (float)Main.tileColor.R / (float)byte.MaxValue;
     float num2 = (float)Main.tileColor.G / (float)byte.MaxValue;
     float num3 = (float)Main.tileColor.B / (float)byte.MaxValue;
     Stopwatch stopwatch = new Stopwatch();
     stopwatch.Start();
     int num4 = 0;
     int num5 = Main.screenWidth / 16 + Lighting.offScreenTiles * 2 + 10;
     int num6 = 0;
     int num7 = Main.screenHeight / 16 + Lighting.offScreenTiles * 2 + 10;
     Lighting.minX = num5;
     Lighting.maxX = num4;
     Lighting.minY = num7;
     Lighting.maxY = num6;
     Lighting.RGB = Lighting.lightMode == 0 || Lighting.lightMode == 3;
     for (int index1 = num4; index1 < num5; ++index1)
     {
         Lighting.LightingState[] lightingStateArray = Lighting.states[index1];
         for (int index2 = num6; index2 < num7; ++index2)
         {
             Lighting.LightingState lightingState = lightingStateArray[index2];
             lightingState.r2 = 0.0f;
             lightingState.g2 = 0.0f;
             lightingState.b2 = 0.0f;
             lightingState.stopLight = false;
             lightingState.wetLight = false;
             lightingState.honeyLight = false;
         }
     }
     if (Main.wof >= 0)
     {
         if (Main.player[Main.myPlayer].gross)
         {
             try
             {
                 int num8 = (int)Main.screenPosition.Y / 16 - 10;
                 int num9 = (int)((double)Main.screenPosition.Y + (double)Main.screenHeight) / 16 + 10;
                 int num10 = (int)Main.npc[Main.wof].position.X / 16;
                 int num11 = Main.npc[Main.wof].direction <= 0 ? num10 + 2 : num10 - 3;
                 int num12 = num11 + 8;
                 float num13 = (float)(0.5 * (double)Main.demonTorch + 1.0 * (1.0 - (double)Main.demonTorch));
                 float num14 = 0.3f;
                 float num15 = (float)(1.0 * (double)Main.demonTorch + 0.5 * (1.0 - (double)Main.demonTorch));
                 float num16 = num13 * 0.2f;
                 float num17 = num14 * 0.1f;
                 float num18 = num15 * 0.3f;
                 for (int index1 = num11; index1 <= num12; ++index1)
                 {
                     Lighting.LightingState[] lightingStateArray = Lighting.states[index1 - num11];
                     for (int index2 = num8; index2 <= num9; ++index2)
                     {
                         Lighting.LightingState lightingState = lightingStateArray[index2 - Lighting.firstToLightY];
                         if ((double)lightingState.r2 < (double)num16)
                             lightingState.r2 = num16;
                         if ((double)lightingState.g2 < (double)num17)
                             lightingState.g2 = num17;
                         if ((double)lightingState.b2 < (double)num18)
                             lightingState.b2 = num18;
                     }
                 }
             }
             catch
             {
             }
         }
     }
     Main.sandTiles = 0;
     Main.evilTiles = 0;
     Main.bloodTiles = 0;
     Main.shroomTiles = 0;
     Main.snowTiles = 0;
     Main.holyTiles = 0;
     Main.meteorTiles = 0;
     Main.jungleTiles = 0;
     Main.dungeonTiles = 0;
     Main.campfire = false;
     Main.sunflower = false;
     Main.starInBottle = false;
     Main.heartLantern = false;
     Main.campfire = false;
     Main.clock = false;
     Main.musicBox = -1;
     Main.waterCandles = 0;
     for (int index = 0; index < Main.player[Main.myPlayer].NPCBannerBuff.Length; ++index)
         Main.player[Main.myPlayer].NPCBannerBuff[index] = false;
     Main.player[Main.myPlayer].hasBanner = false;
     int[] numArray = WorldGen.tileCounts;
     int num19 = Lighting.firstToLightX;
     int num20 = Lighting.lastToLightX;
     int num21 = Lighting.firstToLightY;
     int num22 = Lighting.lastToLightY;
     int num23 = (num20 - num19 - Main.zoneX) / 2;
     int num24 = (num22 - num21 - Main.zoneY) / 2;
     Main.fountainColor = -1;
     Main.monolithType = -1;
     for (int index1 = num19; index1 < num20; ++index1)
     {
         Lighting.LightingState[] lightingStateArray = Lighting.states[index1 - Lighting.firstToLightX];
         for (int index2 = num21; index2 < num22; ++index2)
//.........这里部分代码省略.........
开发者ID:EmuDevs,项目名称:EDTerraria,代码行数:101,代码来源:Lighting.cs


示例18: Update

        protected override void Update(GameTime gameTime)
        {
            #region Modifier Keys

            // Detect modifier keys
            bool shift = keyState.IsKeyDown(Keys.LeftShift) || keyState.IsKeyDown(Keys.RightShift);
            bool alt = keyState.IsKeyDown(Keys.LeftAlt) || keyState.IsKeyDown(Keys.RightAlt);
            bool ctrl = keyState.IsKeyDown(Keys.LeftControl) || keyState.IsKeyDown(Keys.RightControl);

            #endregion

            #region buildMode

            if (buildMode)
            {
                try
                {
                    FieldInfo tilex = player[myPlayer].GetType().GetField("tileRangeX");
                    FieldInfo tiley = player[myPlayer].GetType().GetField("tileRangeY");
                    tilex.SetValue(player[myPlayer], 1000);
                    tiley.SetValue(player[myPlayer], 1000);

                    for (int i = 0; i < player[myPlayer].inventory.Length; i++)
                    {
                        Item it = player[myPlayer].inventory[i];

                        if (i == 10)
                        {
                            player[myPlayer].inventory[i].SetDefaults(0);
                            player[myPlayer].inventory[i].name = "";
                            player[myPlayer].inventory[i].stack = 0;
                            player[myPlayer].inventory[i].UpdateItem(0);
                        }
                        else if (it.name != "Magic Mirror") // Prevent Magic Mirror being hax'd, which prevents it from working.
                        {
                            if (it.name != "")
                            {
                                #region Item Stack Sizes

                                // Set this to false if you want items to be stacked only to their default max stack size.
                                bool haxItemStack = true;

                                // The amount of items you want in a hax'd stack.
                                int haxItemStackSize = 999;

                                // Note: The haxItemStack toggle has no affect on single-stacked items.
                                // In order to keep them unstackable we need to up their max stack size. 10 is a good, solid, number.
                                if (it.maxStack == 1)
                                {
                                    it.stack = 10;
                                    it.maxStack = 10;
                                }
                                if (haxItemStack)
                                {
                                    it.stack = haxItemStackSize;
                                }
                                else
                                {
                                    it.stack = it.maxStack;
                                }

                                #endregion

                                #region Placeable Items!

                                // ItemName_TileID
                                string[] placeableItems = new string[]
                                {
                                    "Sapphire_63",
                                    "Ruby_64",
                                    "Emerald_65",
                                    "Topaz_66",
                                    "Amethyst_67",
                                    "Diamond_68"
                                };
                                for (int j = 0; j < placeableItems.Length; j++)
                                {
                                    string[] pi = placeableItems[j].Split('_');
                                    if (pi[0] == it.name)
                                    {
                                        it.useTime = 0;
                                        it.createTile = Convert.ToByte(pi[1]);
                                    }

                                }

                                #endregion

                                #region itemHax

                                if (itemHax)
                                {
                                    if (it.name.ToLower().Contains("axe") || it.name.ToLower().Contains("hammer") || it.useTime == 10 || it.useTime == 7 || it.name.ToLower().Contains("phase"))
                                    {
                                        it.autoReuse = true;
                                        it.useTime = 0;
                                    }

                                    if (it.hammer > 0 || it.axe > 0)
                                    {
//.........这里部分代码省略.........
开发者ID:kpcrisp23,项目名称:Buildaria,代码行数:101,代码来源:Core.cs


示例19: LightTiles

 public static void LightTiles(int firstX, int lastX, int firstY, int lastY)
 {
     Main.render = true;
     Lighting.oldSkyColor = Lighting.skyColor;
     float num1 = (float)Main.tileColor.R / (float)byte.MaxValue;
     float num2 = (float)Main.tileColor.G / (float)byte.MaxValue;
     float num3 = (float)Main.tileColor.B / (float)byte.MaxValue;
     Lighting.skyColor = (float)(((double)num1 + (double)num2 + (double)num3) / 3.0);
     if (Lighting.lightMode < 2)
     {
         Lighting.brightness = 1.2f;
         Lighting.offScreenTiles2 = 34;
         Lighting.offScreenTiles = 40;
     }
     else
     {
         Lighting.brightness = 1f;
         Lighting.offScreenTiles2 = 18;
         Lighting.offScreenTiles = 23;
     }
     if (Main.player[Main.myPlayer].blind)
         Lighting.brightness = 1f;
     Lighting.defBrightness = Lighting.brightness;
     Lighting.firstTileX = firstX;
     Lighting.lastTileX = lastX;
     Lighting.firstTileY = firstY;
     Lighting.lastTileY = lastY;
     Lighting.firstToLightX = Lighting.firstTileX - Lighting.offScreenTiles;
     Lighting.firstToLightY = Lighting.firstTileY - Lighting.offScreenTiles;
     Lighting.lastToLightX = Lighting.lastTileX + Lighting.offScreenTiles;
     Lighting.lastToLightY = Lighting.lastTileY + Lighting.offScreenTiles;
     if (Lighting.firstToLightX < 0)
         Lighting.firstToLightX = 0;
     if (Lighting.lastToLightX >= Main.maxTilesX)
         Lighting.lastToLightX = Main.maxTilesX - 1;
     if (Lighting.firstToLightY < 0)
         Lighting.firstToLightY = 0;
     if (Lighting.lastToLightY >= Main.maxTilesY)
         Lighting.lastToLightY = Main.maxTilesY - 1;
     ++Lighting.lightCounter;
     ++Main.renderCount;
     int num4 = Main.screenWidth / 16 + Lighting.offScreenTiles * 2;
     int num5 = Main.screenHeight / 16 + Lighting.offScreenTiles * 2;
     Vector2 vector2_1 = Main.screenLastPosition;
     if (Main.renderCount < 3)
         Lighting.doColors();
     if (Main.renderCount == 2)
     {
         Vector2 vector2_2 = Main.screenPosition;
         int num6 = (int)((double)Main.screenPosition.X / 16.0) - Lighting.scrX;
         int num7 = (int)((double)Main.screenPosition.Y / 16.0) - Lighting.scrY;
         if (num6 > 16)
             num6 = 0;
         if (num7 > 16)
             num7 = 0;
         int num8 = 0;
         int num9 = num4;
         int num10 = 0;
         int num11 = num5;
         if (num6 < 0)
             num8 -= num6;
         else
             num9 -= num6;
         if (num7 < 0)
             num10 -= num7;
         else
             num11 -= num7;
         if (Lighting.RGB)
         {
             for (int index1 = num8; index1 < num4; ++index1)
             {
                 Lighting.LightingState[] lightingStateArray1 = Lighting.states[index1];
                 Lighting.LightingState[] lightingStateArray2 = Lighting.states[index1 + num6];
                 for (int index2 = num10; index2 < num11; ++index2)
                 {
                     Lighting.LightingState lightingState1 = lightingStateArray1[index2];
                     Lighting.LightingState lightingState2 = lightingStateArray2[index2 + num7];
                     lightingState1.r = lightingState2.r2;
                     lightingState1.g = lightingState2.g2;
                     lightingState1.b = lightingState2.b2;
                 }
             }
         }
         else
         {
             for (int index1 = num8; index1 < num9; ++index1)
             {
                 Lighting.LightingState[] lightingStateArray1 = Lighting.states[index1];
                 Lighting.LightingState[] lightingStateArray2 = Lighting.states[index1 + num6];
                 for (int index2 = num10; index2 < num11; ++index2)
                 {
                     Lighting.LightingState lightingState1 = lightingStateArray1[index2];
                     Lighting.LightingState lightingState2 = lightingStateArray2[index2 + num7];
                     lightingState1.r = lightingState2.r2;
                     lightingState1.g = lightingState2.r2;
                     lightingState1.b = lightingState2.r2;
                 }
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:EmuDevs,项目名称:EDTerraria,代码行数:101,代码来源:Lighting.cs


示例20: DrawTiles

        protected void DrawTiles(bool solidOnly = true)
        {
            Vector2 vector3;
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            int num = (int)((255f * (1f - gfxQuality)) + (30f * gfxQuality));
            int num2 = (int)((50f * (1f - gfxQuality)) + (2f * gfxQuality));
            Vector2 vector = new Vector2((float)offScreenRange, (float)offScreenRange);
            if (drawToScreen)
            {
                vector = new Vector2();
            }
            int index = 0;
            int[] numArray = new int[0x3e8];
            int[] numArray2 = new int[0x3e8];
            int num4 = (int)(((screenPosition.X - vector.X) / 16f) - 1f);
            int maxTilesX = ((int)(((screenPosition.X + screenWidth) + vector.X) / 16f)) + 2;
            int num6 = (int)(((screenPosition.Y - vector.Y) / 16f) - 1f);
            int maxTilesY = ((int)(((screenPosition.Y + screenHeight) + vector.Y) / 16f)) + 5;
            if (num4 < 0)
            {
                num4 = 0;
            }
            if (maxTilesX > Main.maxTilesX)
            {
                maxTilesX = Main.maxTilesX;
            }
            if (num6 < 0)
            {
                num6 = 0;
            }
            if (maxTilesY > Main.maxTilesY)
            {
                maxTilesY = Main.maxTilesY;
            }
            int height = 0x10;
            int width = 0x10;
            for (int i = num6; i < (maxTilesY + 4); i++)
            {
                for (int k = num4 - 2; k < (maxTilesX + 2); k++)
                {
                    if (tile[k, i] == null)
                    {
                        tile[k, i] = new Tile();
                    }
                    bool flag = tileSolid[tile[k, i].type];
                    if (tile[k, i].type == 11)
                    {
                        flag = true;
                    }
                    if (tile[k, i].active && (flag == solidOnly))
                    {
                        Color color8;
                        Color color = Lighting.GetColor(k, i);
                        int num12 = 0;
                        if ((tile[k, i].type == 0x4e) || (tile[k, i].type == 0x55))
                        {
                            num12 = 2;
                        }
                        if ((tile[k, i].type == 0x21) || (tile[k, i].type == 0x31))
                        {
                            num12 = -4;
                        }
                        if ((((tile[k, i].type == 3) || (tile[k, i].type == 4)) || ((tile[k, i].type == 5) || (tile[k, i].type == 0x18))) || (((tile[k, i].type == 0x21) || (tile[k, i].type == 0x31)) || (((tile[k, i].type == 0x3d) || (tile[k, i].type == 0x47)) || (tile[k, i].type == 110))))
                        {
                            height = 20;
                        }
                        else if (((((tile[k, i].type == 15) || (tile[k, i].type == 14)) || ((tile[k, i].type == 0x10) || (tile[k, i].type == 0x11))) || (((tile[k, i].type == 0x12) || (tile[k, i].type == 20)) || ((tile[k, i].type == 0x15) || (tile[k, i].type == 0x1a)))) || ((((tile[k, i].type == 0x1b) || (tile[k, i].type == 0x20)) || ((tile[k, i].type == 0x45) || (tile[k, i].type == 0x48))) || ((tile[k, i].type == 0x4d) || (tile[k, i].type == 80))))
                        {
                            height = 0x12;
                        }
                        else if (tile[k, i].type == 0x89)
                        {
                            height = 0x12;
                        }
                        else if (tile[k, i].type == 0x87)
                        {
                            num12 = 2;
                            height = 0x12;
                        }
                        else if (tile[k, i].type == 0x84)
                        {
                            num12 = 2;
                            height = 0x12;
                        }
                        else
                        {
                            height = 0x10;
                        }
                        if ((tile[k, i].type == 4) || (tile[k, i].type == 5))
                        {
                            width = 20;
                        }
                        else
                        {
                            width = 0x10;
                        }
                        if (((tile[k, i].type == 0x49) || (tile[k, i].type == 0x4a)) || (tile[k, i].type == 0x71))
                        {
                            num12 -= 12;
//.........这里部分代码省略.........
开发者ID:Heloo88,项目名称:ModTerraria_Heloo,代码行数:101,代码来源:Main.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ModLoader.ModRecipe类代码示例发布时间:2022-05-26
下一篇:
C# Terraria.Projectile类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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