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

◆ ProvideUIElement()

UIElement Terraria.GameContent.Bestiary.NPCPortraitInfoElement.ProvideUIElement ( BestiaryUICollectionInfo info)
inline

Implements Terraria.GameContent.Bestiary.IBestiaryInfoElement.

Definition at line 21 of file NPCPortraitInfoElement.cs.

22 {
24 {
25 Width = new StyleDimension(0f, 1f),
26 Height = new StyleDimension(112f, 0f)
27 };
28 uIElement.SetPadding(0f);
29 BestiaryEntry bestiaryEntry = new BestiaryEntry();
32 bestiaryEntry.Icon = info.OwnerEntry.Icon.CreateClone();
33 bestiaryEntry.UIInfoProvider = info.OwnerEntry.UIInfoProvider;
35 bool flag = info.UnlockState > BestiaryEntryUnlockState.NotKnownAtAll_0;
36 if (flag)
37 {
39 IEnumerable<IBestiaryBackgroundImagePathAndColorProvider> source = info.OwnerEntry.Info.OfType<IBestiaryBackgroundImagePathAndColorProvider>();
40 IEnumerable<IPreferenceProviderElement> preferences = info.OwnerEntry.Info.OfType<IPreferenceProviderElement>();
41 IEnumerable<IBestiaryBackgroundImagePathAndColorProvider> enumerable = source.Where((IBestiaryBackgroundImagePathAndColorProvider provider) => preferences.Any((IPreferenceProviderElement preference) => preference.Matches(provider)));
42 bool flag2 = false;
43 foreach (IBestiaryBackgroundImagePathAndColorProvider item in enumerable)
44 {
45 Asset<Texture2D> backgroundImage = item.GetBackgroundImage();
46 if (backgroundImage != null)
47 {
49 flag2 = true;
50 Color? backgroundColor = item.GetBackgroundColor();
51 if (backgroundColor.HasValue)
52 {
54 }
55 break;
56 }
57 }
58 foreach (IBestiaryInfoElement item2 in info.OwnerEntry.Info)
59 {
60 if (item2 is IBestiaryBackgroundImagePathAndColorProvider bestiaryBackgroundImagePathAndColorProvider)
61 {
63 if (backgroundImage2 == null)
64 {
65 continue;
66 }
67 if (!flag2)
68 {
70 }
72 if (backgroundColor2.HasValue)
73 {
75 }
76 }
77 if (!flag2 && item2 is IBestiaryBackgroundOverlayAndColorProvider bestiaryBackgroundOverlayAndColorProvider && bestiaryBackgroundOverlayAndColorProvider.GetBackgroundOverlayImage() != null)
78 {
80 }
81 }
83 select x as IBestiaryBackgroundOverlayAndColorProvider);
84 }
86 {
87 Left = new StyleDimension(4f, 0f),
88 HAlign = 0f
89 };
90 uIElement.Append(element);
91 if (flag && _filledStarsCount.HasValue)
92 {
94 uIElement.Append(element2);
95 }
96 return uIElement;
97 }
void AddRange(IEnumerable< KeyValuePair< TKey, TValue > > collection)
void Add(TKey key, TValue value)
float GetSortingValueForElement(IBestiaryInfoElement element)

References Terraria.GameContent.Bestiary.NPCPortraitInfoElement._filledStarsCount, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.AddRange(), Terraria.GameContent.Bestiary.NPCPortraitInfoElement.CreateStarsContainer(), System.Linq.enumerable, Terraria.GameContent.Bestiary.NPCPortraitInfoElement.GetSortingValueForElement(), System.info, System.item, System.Collections.Generic.Left, System.list, System.Linq.source, and Microsoft.Xna.Framework.Color.White.