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


C# Item.GetColor方法代码示例

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


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

示例1: ComposeColour

		// these two methods are probably the hardest ones to debug in the entire mod. I HATE red's colour system.
		static Color ComposeColour(Item item, Color? tint = null)
		{
			Color c;

			c = item.color == default(Color) ? item.GetAlpha(tint ?? Color.White) : item.GetAlpha(item.GetColor(tint ?? Color.White));

			//c.A = 255;

			return c;
		}
开发者ID:RainbowDashGaming,项目名称:Terraria-Avalon-MODIFIED,代码行数:11,代码来源:StarterSetDisplayer.cs

示例2: DrawChat

		protected void DrawChat()
		{
			if (Main.player[Main.myPlayer].talkNPC < 0 && Main.player[Main.myPlayer].sign == -1)
			{
				Main.npcChatText = "";
				return;
			}
			if (Main.netMode == 0 && Main.autoPause && Main.player[Main.myPlayer].talkNPC >= 0)
			{
				if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 105)
				{
					Main.npc[Main.player[Main.myPlayer].talkNPC].Transform(107);
				}
				if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 106)
				{
					Main.npc[Main.player[Main.myPlayer].talkNPC].Transform(108);
				}
				if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 123)
				{
					Main.npc[Main.player[Main.myPlayer].talkNPC].Transform(124);
				}
				if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 354)
				{
					Main.npc[Main.player[Main.myPlayer].talkNPC].Transform(353);
				}
				if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 376)
				{
					Main.npc[Main.player[Main.myPlayer].talkNPC].Transform(369);
				}
			}
			Color color = new Color(200, 200, 200, 200);
			int num = (int)((Main.mouseTextColor * 2 + 255) / 3);
			Color textColor = new Color(num, num, num, num);
			int num2;
			string[] array = Utils.WordwrapString(Main.npcChatText, Main.fontMouseText, 460, 10, out num2);
			if (Main.editSign)
			{
				this.textBlinkerCount++;
				if (this.textBlinkerCount >= 20)
				{
					if (this.textBlinkerState == 0)
					{
						this.textBlinkerState = 1;
					}
					else
					{
						this.textBlinkerState = 0;
					}
					this.textBlinkerCount = 0;
				}
				if (this.textBlinkerState == 1)
				{
					string[] array2;
					IntPtr intPtr;
					(array2 = array)[(int)(intPtr = (IntPtr)num2)] = array2[(int)intPtr] + "|";
				}
			}
			num2++;
			Main.spriteBatch.Draw(Main.chatBackTexture, new Vector2((float)(Main.screenWidth / 2 - Main.chatBackTexture.Width / 2), 100f), new Rectangle?(new Rectangle(0, 0, Main.chatBackTexture.Width, (num2 + 1) * 30)), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
			Main.spriteBatch.Draw(Main.chatBackTexture, new Vector2((float)(Main.screenWidth / 2 - Main.chatBackTexture.Width / 2), (float)(100 + (num2 + 1) * 30)), new Rectangle?(new Rectangle(0, Main.chatBackTexture.Height - 30, Main.chatBackTexture.Width, 30)), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
			for (int i = 0; i < num2; i++)
			{
				Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, array[i], (float)(170 + (Main.screenWidth - 800) / 2), (float)(120 + i * 30), textColor, Color.Black, Vector2.Zero, 1f);
			}
			if (Main.npcChatCornerItem != 0)
			{
				Vector2 vector = new Vector2((float)(Main.screenWidth / 2 + Main.chatBackTexture.Width / 2), (float)(100 + (num2 + 1) * 30 + 30));
				vector -= Vector2.One * 8f;
				Item item = new Item();
				item.netDefaults(Main.npcChatCornerItem);
				float num3 = 1f;
				Texture2D texture2D = Main.itemTexture[item.type];
				if (texture2D.Width > 32 || texture2D.Height > 32)
				{
					if (texture2D.Width > texture2D.Height)
					{
						num3 = 32f / (float)texture2D.Width;
					}
					else
					{
						num3 = 32f / (float)texture2D.Height;
					}
				}
				Main.spriteBatch.Draw(texture2D, vector, null, item.GetAlpha(Color.White), 0f, new Vector2((float)texture2D.Width, (float)texture2D.Height), num3, SpriteEffects.None, 0f);
				if (item.color != default(Color))
				{
					Main.spriteBatch.Draw(texture2D, vector, null, item.GetColor(item.color), 0f, new Vector2((float)texture2D.Width, (float)texture2D.Height), num3, SpriteEffects.None, 0f);
				}
				if (new Rectangle((int)vector.X - (int)((float)texture2D.Width * num3), (int)vector.Y - (int)((float)texture2D.Height * num3), (int)((float)texture2D.Width * num3), (int)((float)texture2D.Height * num3)).Contains(new Point(Main.mouseX, Main.mouseY)))
				{
					this.MouseText(item.name, -11, 0);
				}
			}
			num = (int)Main.mouseTextColor;
			textColor = new Color(num, (int)((double)num / 1.1), num / 2, num);
			string text = "";
			string text2 = "";
			int num4 = Main.player[Main.myPlayer].statLifeMax2 - Main.player[Main.myPlayer].statLife;
			for (int j = 0; j < 22; j++)
			{
//.........这里部分代码省略.........
开发者ID:NoviaDroid,项目名称:Terraria,代码行数:101,代码来源:Main.cs

示例3: DrawItem

		protected void DrawItem(Item item)
		{
			int arg_22_0 = (int)((double)item.position.X + (double)item.width * 0.5) / 16;
			int arg_28_0 = Lighting.offScreenTiles;
			int arg_4B_0 = (int)((double)item.position.Y + (double)item.height * 0.5) / 16;
			int arg_51_0 = Lighting.offScreenTiles;
			Color color = Lighting.GetColor((int)((double)item.position.X + (double)item.width * 0.5) / 16, (int)((double)item.position.Y + (double)item.height * 0.5) / 16);
			if (!Main.gamePaused && base.IsActive && ((item.type >= 71 && item.type <= 74) || item.type == 58 || item.type == 109) && color.R > 60)
			{
				float num = (float)Main.rand.Next(500) - (Math.Abs(item.velocity.X) + Math.Abs(item.velocity.Y)) * 10f;
				if (num < (float)(color.R / 50))
				{
					int num2 = Dust.NewDust(item.position, item.width, item.height, 43, 0f, 0f, 254, default(Color), 0.5f);
					Main.dust[num2].velocity *= 0f;
				}
			}
			float rotation = item.velocity.X * 0.2f;
			float num3 = 1f;
			Color alpha = item.GetAlpha(color);
			if (item.type == 662 || item.type == 663)
			{
				alpha.R = (byte)Main.DiscoR;
				alpha.G = (byte)Main.DiscoG;
				alpha.B = (byte)Main.DiscoB;
				alpha.A = 255;
			}
			if (item.type == 520 || item.type == 521 || item.type == 547 || item.type == 548 || item.type == 549)
			{
				num3 = Main.essScale;
				alpha.R = (byte)((float)alpha.R * num3);
				alpha.G = (byte)((float)alpha.G * num3);
				alpha.B = (byte)((float)alpha.B * num3);
				alpha.A = (byte)((float)alpha.A * num3);
			}
			else
			{
				if (item.type == 58 || item.type == 184)
				{
					num3 = Main.essScale * 0.25f + 0.75f;
					alpha.R = (byte)((float)alpha.R * num3);
					alpha.G = (byte)((float)alpha.G * num3);
					alpha.B = (byte)((float)alpha.B * num3);
					alpha.A = (byte)((float)alpha.A * num3);
				}
			}
			float num4 = (float)(item.height - Main.itemTexture[item.type].Height);
			float num5 = (float)(item.width / 2 - Main.itemTexture[item.type].Width / 2);
			if (item.type >= 1522 && item.type <= 1527)
			{
				Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float)(Main.itemTexture[item.type].Width / 2) + num5, item.position.Y - Main.screenPosition.Y + (float)(Main.itemTexture[item.type].Height / 2) + num4 + 2f), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), new Color(250, 250, 250, (int)(Main.mouseTextColor / 2)), rotation, new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / 2)), (float)Main.mouseTextColor / 1000f + 0.8f, SpriteEffects.None, 0f);
				return;
			}
			Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float)(Main.itemTexture[item.type].Width / 2) + num5, item.position.Y - Main.screenPosition.Y + (float)(Main.itemTexture[item.type].Height / 2) + num4 + 2f), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), alpha, rotation, new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / 2)), num3, SpriteEffects.None, 0f);
			if (item.color != default(Color))
			{
				Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float)(Main.itemTexture[item.type].Width / 2) + num5, item.position.Y - Main.screenPosition.Y + (float)(Main.itemTexture[item.type].Height / 2) + num4 + 2f), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), item.GetColor(color), rotation, new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / 2)), num3, SpriteEffects.None, 0f);
			}
		}
开发者ID:NoviaDroid,项目名称:Terraria,代码行数:58,代码来源:Main.cs

示例4: DrawTiles


//.........这里部分代码省略.........
						{
							if (j % 2 == 1)
							{
								effects = SpriteEffects.FlipHorizontally;
							}
						}
						else
						{
							if (type == 184)
							{
								if (tile.frameY < 108)
								{
									if (j % 2 == 1)
									{
										effects = SpriteEffects.FlipHorizontally;
									}
								}
								else
								{
									if (i % 2 == 1)
									{
										effects = SpriteEffects.FlipVertically;
									}
								}
							}
							else
							{
								if (type == 185 && tile.frameY == 0 && j % 2 == 1)
								{
									effects = SpriteEffects.FlipHorizontally;
								}
							}
						}
						Color color = Lighting.GetColor(j, i);
						int num10 = 0;
						int num11 = 16;
						if (type >= 330 && type <= 333)
						{
							num10 += 2;
						}
						if (type == 4 && WorldGen.SolidTile(j, i - 1))
						{
							num10 = 2;
							if (WorldGen.SolidTile(j - 1, i + 1) || WorldGen.SolidTile(j + 1, i + 1))
							{
								num10 = 4;
							}
						}
						if (type == 336)
						{
							num10 = 2;
						}
						if (type >= 275 && type <= 282)
						{
							num10 = 2;
						}
						if (type == 285 || type == 286 || type == 309 || type == 310)
						{
							num10 = 2;
						}
						if (type == 100 || type == 283)
						{
							num10 = 2;
						}
						if (type == 78 || type == 85 || type == 210 || type == 133 || type == 134 || type == 233)
						{
开发者ID:NoviaDroid,项目名称:Terraria,代码行数:67,代码来源:Main.cs

示例5: DrawAnimatedItem

 //near end of Terraria.Main.DrawItem before default drawing call
 //  if(ItemLoader.animations.Contains(item.type))
 //  { ItemLoader.DrawAnimatedItem(item, whoAmI, color, alpha, rotation, scale); return; }
 internal static void DrawAnimatedItem(Item item, int whoAmI, Color color, Color alpha, float rotation, float scale)
 {
     int frameCount = Main.itemAnimations[item.type].FrameCount;
     int frameDuration = Main.itemAnimations[item.type].TicksPerFrame;
     Main.itemFrameCounter[whoAmI]++;
     if (Main.itemFrameCounter[whoAmI] >= frameDuration)
     {
         Main.itemFrameCounter[whoAmI] = 0;
         Main.itemFrame[whoAmI]++;
     }
     if (Main.itemFrame[whoAmI] >= frameCount)
     {
         Main.itemFrame[whoAmI] = 0;
     }
     Rectangle frame = Main.itemTexture[item.type].Frame(1, frameCount, 0, Main.itemFrame[whoAmI]);
     float offX = (float)(item.width / 2 - frame.Width / 2);
     float offY = (float)(item.height - frame.Height);
     Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float)(frame.Width / 2) + offX, item.position.Y - Main.screenPosition.Y + (float)(frame.Height / 2) + offY), new Rectangle?(frame), alpha, rotation, frame.Size() / 2f, scale, SpriteEffects.None, 0f);
     if (item.color != default(Color))
     {
         Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float)(frame.Width / 2) + offX, item.position.Y - Main.screenPosition.Y + (float)(frame.Height / 2) + offY), new Rectangle?(frame), item.GetColor(color), rotation, frame.Size() / 2f, scale, SpriteEffects.None, 0f);
     }
 }
开发者ID:trekko727,项目名称:tModLoader,代码行数:26,代码来源:ItemLoader.cs


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