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

◆ CreateStarsContainer()

UIElement Terraria.GameContent.Bestiary.NPCPortraitInfoElement.CreateStarsContainer ( )
inlineprivate

Definition at line 108 of file NPCPortraitInfoElement.cs.

109 {
110 int num = 14;
111 int num2 = 14;
112 int num3 = -4;
113 int num4 = num + num3;
114 int num5 = 5;
115 int num6 = 5;
116 int value = _filledStarsCount.Value;
117 float num7 = 1f;
118 int num8 = num4 * Math.Min(num6, num5) - num3;
119 double num9 = (double)num4 * Math.Ceiling((double)num5 / (double)num6) - (double)num3;
120 UIElement uIElement = new UIPanel(Main.Assets.Request<Texture2D>("Images/UI/Bestiary/Stat_Panel", (AssetRequestMode)1), null, 5, 21)
121 {
122 Width = new StyleDimension((float)num8 + num7 * 2f, 0f),
123 Height = new StyleDimension((float)num9 + num7 * 2f, 0f),
124 BackgroundColor = Color.Gray * 0f,
125 BorderColor = Color.Transparent,
126 Left = new StyleDimension(10f, 0f),
127 Top = new StyleDimension(6f, 0f),
128 VAlign = 0f
129 };
130 uIElement.SetPadding(0f);
131 for (int num10 = num5 - 1; num10 >= 0; num10--)
132 {
133 string text = "Images/UI/Bestiary/Icon_Rank_Light";
134 if (num10 >= value)
135 {
136 text = "Images/UI/Bestiary/Icon_Rank_Dim";
137 }
138 UIImage element = new UIImage(Main.Assets.Request<Texture2D>(text, (AssetRequestMode)1))
139 {
140 Left = new StyleDimension((float)(num4 * (num10 % num6)) - (float)num8 * 0.5f + (float)num * 0.5f, 0f),
141 Top = new StyleDimension((float)(num4 * (num10 / num6)) - (float)num9 * 0.5f + (float)num2 * 0.5f, 0f),
142 HAlign = 0.5f,
143 VAlign = 0.5f
144 };
145 uIElement.Append(element);
146 }
147 return uIElement;
148 }
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static double Ceiling(double a)
static Color Transparent
Definition Color.cs:76

References Terraria.GameContent.Bestiary.NPCPortraitInfoElement._filledStarsCount, Terraria.Main.Assets, System.Math.Ceiling(), System.Collections.Generic.Left, System.Math.Min(), System.text, Microsoft.Xna.Framework.Color.Transparent, and System.value.

Referenced by Terraria.GameContent.Bestiary.NPCPortraitInfoElement.ProvideUIElement().