TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ DrawSelf()

override void Terraria.ModLoader.Config.UI.NPCDefinitionOptionElement.DrawSelf ( SpriteBatch spriteBatch)
inlineprotected

Definition at line 17 of file NPCDefinitionOptionElement.cs.

18 {
19 //IL_0015: Unknown result type (might be due to invalid IL or missing references)
20 //IL_0023: Unknown result type (might be due to invalid IL or missing references)
21 //IL_002d: Unknown result type (might be due to invalid IL or missing references)
22 //IL_0128: Unknown result type (might be due to invalid IL or missing references)
23 //IL_0133: Unknown result type (might be due to invalid IL or missing references)
24 //IL_0138: Unknown result type (might be due to invalid IL or missing references)
25 //IL_013c: Unknown result type (might be due to invalid IL or missing references)
26 //IL_0141: Unknown result type (might be due to invalid IL or missing references)
27 //IL_0148: Unknown result type (might be due to invalid IL or missing references)
28 //IL_014d: Unknown result type (might be due to invalid IL or missing references)
29 //IL_0152: Unknown result type (might be due to invalid IL or missing references)
30 //IL_0154: Unknown result type (might be due to invalid IL or missing references)
31 //IL_015b: Unknown result type (might be due to invalid IL or missing references)
32 //IL_0165: Unknown result type (might be due to invalid IL or missing references)
33 //IL_016a: Unknown result type (might be due to invalid IL or missing references)
34 //IL_016f: Unknown result type (might be due to invalid IL or missing references)
35 //IL_0171: Unknown result type (might be due to invalid IL or missing references)
36 //IL_0173: Unknown result type (might be due to invalid IL or missing references)
37 //IL_017d: Unknown result type (might be due to invalid IL or missing references)
38 //IL_0182: Unknown result type (might be due to invalid IL or missing references)
39 //IL_0186: Unknown result type (might be due to invalid IL or missing references)
40 //IL_0188: Unknown result type (might be due to invalid IL or missing references)
41 //IL_018f: Unknown result type (might be due to invalid IL or missing references)
42 //IL_0199: Unknown result type (might be due to invalid IL or missing references)
43 CalculatedStyle dimensions = GetInnerDimensions();
44 spriteBatch.Draw(base.BackgroundTexture.Value, dimensions.Position(), (Rectangle?)null, Color.White, 0f, Vector2.Zero, base.Scale, (SpriteEffects)0, 0f);
45 if (base.Definition != null)
46 {
47 int type = ((!base.Unloaded) ? base.Type : 0);
48 Main.instance.LoadNPC(type);
49 Texture2D npcTexture = TextureAssets.Npc[type].Value;
50 int num = Interface.modConfig.UpdateCount / 8;
51 int frames = Main.npcFrameCount[type];
52 if (base.Unloaded)
53 {
54 npcTexture = TextureAssets.Item[ModContent.ItemType<UnloadedItem>()].Value;
55 frames = 1;
56 }
57 int height = npcTexture.Height / frames;
58 int width = npcTexture.Width;
59 int frame = num % frames;
60 int y = height * frame;
61 Rectangle rectangle2 = default(Rectangle);
62 ((Rectangle)(ref rectangle2))._002Ector(0, y, width, height);
63 float drawScale = 1f;
65 if ((float)width > availableWidth || (float)height > availableWidth)
66 {
67 drawScale = ((width <= height) ? (availableWidth / (float)height) : (availableWidth / (float)width));
68 }
69 drawScale *= base.Scale;
70 Vector2 vector = base.BackgroundTexture.Size() * base.Scale;
71 Vector2 position2 = dimensions.Position() + vector / 2f - rectangle2.Size() * drawScale / 2f;
72 Vector2 origin = rectangle2.Size() * 0f;
73 spriteBatch.Draw(npcTexture, position2, (Rectangle?)rectangle2, Color.White, 0f, origin, drawScale, (SpriteEffects)0, 0f);
74 }
75 if (base.IsMouseHovering)
76 {
77 UIModConfig.Tooltip = base.Tooltip;
78 }
79 }
static Asset< Texture2D >[] Npc
static Asset< Texture2D >[] Item

References Terraria.ModLoader.Config.UI.DefinitionOptionElement< NPCDefinition >.DefaultBackgroundTexture, Terraria.Main.instance, Terraria.GameContent.TextureAssets.Item, Terraria.GameContent.TextureAssets.Npc, and Terraria.Main.npcFrameCount.