本文整理汇总了C#中Terraria.Item.GetAlpha方法的典型用法代码示例。如果您正苦于以下问题:C# Item.GetAlpha方法的具体用法?C# Item.GetAlpha怎么用?C# Item.GetAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terraria.Item
的用法示例。
在下文中一共展示了Item.GetAlpha方法的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;
}
示例2: DrawItem
static void DrawItem(Item item, SpriteBatch sb, Vector2 position, Color? tint = null)
{
sb.Draw(item.GetTexture(), position, item.GetAlpha(tint ?? Color.White));
if (item.color != default(Color))
sb.Draw(item.GetTexture(), position, ComposeColour(item, tint));
}
示例3: 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++)
{
//.........这里部分代码省略.........
示例4: 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);
}
}
示例5: DrawItem
static void DrawItem(Item item, SpriteBatch sb, Vector2 position, float rotation,
Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth, Color? tint = null)
{
sb.Draw(item.GetTexture(), position, item.GetAlpha(tint ?? Color.White));
if (item.color != default(Color))
sb.Draw(item.GetTexture(), position, null, ComposeColour(item, tint), rotation, origin, scale, effects, layerDepth);
}