當前位置: 首頁>>代碼示例>>C#>>正文


C# Player.GetHairColor方法代碼示例

本文整理匯總了C#中Terraria.Player.GetHairColor方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.GetHairColor方法的具體用法?C# Player.GetHairColor怎麽用?C# Player.GetHairColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Terraria.Player的用法示例。


在下文中一共展示了Player.GetHairColor方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DrawPlayerHead

		protected void DrawPlayerHead(Player drawPlayer, float X, float Y, float Alpha = 1f, float Scale = 1f)
		{
			int num = 0;
			int num2 = 0;
			for (int i = 0; i < 16; i++)
			{
				int num3 = i % 8;
				if (drawPlayer.dye[num3] != null && drawPlayer.armor[i].type > 0 && drawPlayer.armor[i].stack > 0 && drawPlayer.armor[i].faceSlot > 0 && drawPlayer.armor[i].faceSlot < 9)
				{
					num2 = (int)drawPlayer.dye[num3].dye;
				}
			}
			if (drawPlayer.face > 0 && drawPlayer.face < 9)
			{
				this.LoadAccFace((int)drawPlayer.face);
			}
			if (drawPlayer.dye[0] != null)
			{
				num = (int)drawPlayer.dye[0].dye;
			}
			int num4 = 0;
			switch (drawPlayer.team)
			{
			case 1:
				num4 = 1;
				break;
			case 2:
				num4 = 5;
				break;
			case 3:
				num4 = 9;
				break;
			case 4:
				num4 = 3;
				break;
			}
			if (num == 65)
			{
				num = num4;
			}
			if (num2 == 65)
			{
				num2 = num4;
			}
			this.LoadHair(drawPlayer.hair);
			Color color = this.quickAlpha(Color.White, Alpha);
			Color color2 = this.quickAlpha(drawPlayer.eyeColor, Alpha);
			Color color3 = this.quickAlpha(drawPlayer.GetHairColor(false), Alpha);
			Color color4 = this.quickAlpha(drawPlayer.skinColor, Alpha);
			Color color5 = this.quickAlpha(Color.White, Alpha);
			SpriteEffects effects = SpriteEffects.None;
			if (drawPlayer.direction < 0)
			{
				effects = SpriteEffects.FlipHorizontally;
			}
			Vector2 vector = new Vector2((float)drawPlayer.legFrame.Width * 0.5f, (float)drawPlayer.legFrame.Height * 0.4f);
			Vector2 position = drawPlayer.position;
			Rectangle bodyFrame = drawPlayer.bodyFrame;
			drawPlayer.bodyFrame.Y = 0;
			drawPlayer.position = Main.screenPosition;
			drawPlayer.position.X = drawPlayer.position.X + X;
			drawPlayer.position.Y = drawPlayer.position.Y + Y;
			drawPlayer.position.X = drawPlayer.position.X - 6f;
			drawPlayer.position.Y = drawPlayer.position.Y - 4f;
			float num5 = (float)drawPlayer.mount.PlayerHeadOffset;
			drawPlayer.position.Y = drawPlayer.position.Y - num5;
			if (drawPlayer.head > 0 && drawPlayer.head < 169)
			{
				this.LoadArmorHead(drawPlayer.head);
			}
			if (drawPlayer.face > 0 && drawPlayer.face < 9)
			{
				this.LoadAccFace((int)drawPlayer.face);
			}
			if (drawPlayer.head != 38 && drawPlayer.head != 135)
			{
				Main.spriteBatch.Draw(Main.playerHeadTexture, new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(drawPlayer.bodyFrame), color4, drawPlayer.headRotation, vector, Scale, effects, 0f);
				Main.spriteBatch.Draw(Main.playerEyeWhitesTexture, new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(drawPlayer.bodyFrame), color, drawPlayer.headRotation, vector, Scale, effects, 0f);
				Main.spriteBatch.Draw(Main.playerEyesTexture, new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(drawPlayer.bodyFrame), color2, drawPlayer.headRotation, vector, Scale, effects, 0f);
			}
			if (drawPlayer.head == 10 || drawPlayer.head == 12 || drawPlayer.head == 28 || drawPlayer.head == 62 || drawPlayer.head == 97 || drawPlayer.head == 106 || drawPlayer.head == 113 || drawPlayer.head == 116 || drawPlayer.head == 119 || drawPlayer.head == 133 || drawPlayer.head == 138 || drawPlayer.head == 139 || drawPlayer.head == 163)
			{
				Main.pixelShader.CurrentTechnique.Passes[num].Apply();
				Main.spriteBatch.Draw(Main.armorHeadTexture[drawPlayer.head], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.headRotation, vector, Scale, effects, 0f);
				Main.pixelShader.CurrentTechnique.Passes[0].Apply();
				if (!drawPlayer.invis)
				{
					Rectangle bodyFrame2 = drawPlayer.bodyFrame;
					bodyFrame2.Y -= 336;
					if (bodyFrame2.Y < 0)
					{
						bodyFrame2.Y = 0;
					}
					Main.spriteBatch.Draw(Main.playerHairTexture[drawPlayer.hair], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(bodyFrame2), color3, drawPlayer.headRotation, vector, Scale, effects, 0f);
				}
			}
			if (drawPlayer.head == 161 || drawPlayer.head == 14 || drawPlayer.head == 15 || drawPlayer.head == 16 || drawPlayer.head == 18 || drawPlayer.head == 21 || drawPlayer.head == 24 || drawPlayer.head == 25 || drawPlayer.head == 26 || drawPlayer.head == 40 || drawPlayer.head == 44 || drawPlayer.head == 51 || drawPlayer.head == 56 || drawPlayer.head == 59 || drawPlayer.head == 60 || drawPlayer.head == 67 || drawPlayer.head == 68 || drawPlayer.head == 69 || drawPlayer.head == 114 || drawPlayer.head == 121 || drawPlayer.head == 126 || drawPlayer.head == 130 || drawPlayer.head == 136 || drawPlayer.head == 140 || drawPlayer.head == 145 || drawPlayer.head == 158 || drawPlayer.head == 159)
			{
				Rectangle bodyFrame3 = drawPlayer.bodyFrame;
				bodyFrame3.Y -= 336;
//.........這裏部分代碼省略.........
開發者ID:NoviaDroid,項目名稱:Terraria,代碼行數:101,代碼來源:Main.cs

示例2: DrawPlayer


//.........這裏部分代碼省略.........
				num11 = num20;
			}
			if (num12 == 65)
			{
				num12 = num20;
			}
			if (num13 == 65)
			{
				num13 = num20;
			}
			if (num14 == 65)
			{
				num14 = num20;
			}
			if (num15 == 65)
			{
				num15 = num20;
			}
			if (num16 == 65)
			{
				num16 = num20;
			}
			if (num17 == 65)
			{
				num17 = num20;
			}
			if (num18 == 65)
			{
				num18 = num20;
			}
			drawPlayer.itemLocation.Y = drawPlayer.itemLocation.Y + drawPlayer.gfxOffY;
			SpriteEffects spriteEffects = SpriteEffects.None;
			SpriteEffects effect = SpriteEffects.FlipHorizontally;
			Color color = drawPlayer.GetImmuneAlpha(drawPlayer.GetHairColor(true), shadow);
			Color color2 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)Position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)Position.Y + (double)drawPlayer.height * 0.25) / 16.0), Color.White), shadow);
			Color color3 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)Position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)Position.Y + (double)drawPlayer.height * 0.25) / 16.0), drawPlayer.eyeColor), shadow);
			Color color4 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)Position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)Position.Y + (double)drawPlayer.height * 0.25) / 16.0), drawPlayer.skinColor), shadow);
			Color color5 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)Position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)Position.Y + (double)drawPlayer.height * 0.5) / 16.0), drawPlayer.skinColor), shadow);
			Color color6 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)Position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)Position.Y + (double)drawPlayer.height * 0.75) / 16.0), drawPlayer.skinColor), shadow);
			Color color7 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)((double)Position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)Position.Y + (double)drawPlayer.height * 0.5) / 16.0), drawPlayer.shirtColor), shadow);
			Color color8 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)((double)Position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)Position.Y + (double)drawPlayer.height * 0.5) / 16.0), drawPlayer.underShirtColor), shadow);
			Color color9 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)((double)Position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)Position.Y + (double)drawPlayer.height * 0.75) / 16.0), drawPlayer.pantsColor), shadow);
			Color color10 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)((double)Position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)Position.Y + (double)drawPlayer.height * 0.75) / 16.0), drawPlayer.shoeColor), shadow);
			Color color11 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)((double)Position.X + (double)drawPlayer.width * 0.5) / 16, (int)((double)Position.Y + (double)drawPlayer.height * 0.25) / 16, Color.White), shadow);
			Color color12 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)((double)Position.X + (double)drawPlayer.width * 0.5) / 16, (int)((double)Position.Y + (double)drawPlayer.height * 0.5) / 16, Color.White), shadow);
			Color color13 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)((double)Position.X + (double)drawPlayer.width * 0.5) / 16, (int)((double)Position.Y + (double)drawPlayer.height * 0.75) / 16, Color.White), shadow);
			if (drawPlayer.head > 0 && drawPlayer.head < 169)
			{
				this.LoadArmorHead(drawPlayer.head);
			}
			if (drawPlayer.body > 0 && drawPlayer.body < 175)
			{
				this.LoadArmorBody(drawPlayer.body);
			}
			if (drawPlayer.legs > 0 && drawPlayer.legs < 110)
			{
				this.LoadArmorLegs(drawPlayer.legs);
			}
			if (drawPlayer.handon > 0 && drawPlayer.handon < 18)
			{
				this.LoadAccHandsOn((int)drawPlayer.handon);
			}
			if (drawPlayer.handoff > 0 && drawPlayer.handoff < 11)
			{
				this.LoadAccHandsOff((int)drawPlayer.handoff);
			}
開發者ID:NoviaDroid,項目名稱:Terraria,代碼行數:67,代碼來源:Main.cs

示例3: DrawPlayer


//.........這裏部分代碼省略.........
         num10 = num18;
     }
     if (num11 == 65)
     {
         num11 = num18;
     }
     if (num12 == 65)
     {
         num12 = num18;
     }
     if (num13 == 65)
     {
         num13 = num18;
     }
     if (num14 == 65)
     {
         num14 = num18;
     }
     if (num15 == 65)
     {
         num15 = num18;
     }
     if (num16 == 65)
     {
         num16 = num18;
     }
     if (drawPlayer.shadow == 0f)
     {
         drawPlayer.position.Y = drawPlayer.position.Y + drawPlayer.gfxOffY;
     }
     drawPlayer.itemLocation.Y = drawPlayer.itemLocation.Y + drawPlayer.gfxOffY;
     SpriteEffects effects = SpriteEffects.None;
     SpriteEffects effects2 = SpriteEffects.FlipHorizontally;
     Color color = drawPlayer.GetImmuneAlpha(drawPlayer.GetHairColor(true));
     Color color2 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.25) / 16.0), Color.White));
     Color color3 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.25) / 16.0), drawPlayer.eyeColor));
     Color color4 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.25) / 16.0), drawPlayer.skinColor));
     Color color5 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.5) / 16.0), drawPlayer.skinColor));
     Color immuneAlpha = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.75) / 16.0), drawPlayer.skinColor));
     Color color6 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.5) / 16.0), drawPlayer.shirtColor));
     Color color7 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.5) / 16.0), drawPlayer.underShirtColor));
     Color color8 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.75) / 16.0), drawPlayer.pantsColor));
     Color color9 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.75) / 16.0), drawPlayer.shoeColor));
     Color color10 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.25) / 16, Color.White));
     Color color11 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.5) / 16, Color.White));
     Color color12 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.75) / 16, Color.White));
     if (drawPlayer.head > 0 && drawPlayer.head < 160)
     {
         this.LoadArmorHead(drawPlayer.head);
     }
     if (drawPlayer.body > 0 && drawPlayer.body < 168)
     {
         this.LoadArmorBody(drawPlayer.body);
     }
     if (drawPlayer.legs > 0 && drawPlayer.legs < 103)
     {
         this.LoadArmorLegs(drawPlayer.legs);
     }
     if (drawPlayer.handon > 0 && drawPlayer.handon < 18)
     {
         this.LoadAccHandsOn((int)drawPlayer.handon);
     }
     if (drawPlayer.handoff > 0 && drawPlayer.handoff < 11)
     {
         this.LoadAccHandsOff((int)drawPlayer.handoff);
     }
開發者ID:TerrariaJava,項目名稱:ExecutableSRC,代碼行數:67,代碼來源:Main.cs


注:本文中的Terraria.Player.GetHairColor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。