Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UIBestiaryEntryInfoPage.cs
Go to the documentation of this file.
2using System.Linq;
5using Terraria.UI;
6
8
10{
21
22 private UIList _list;
23
25
27
29 {
30 Width.Set(230f, 0f);
31 Height.Set(0f, 1f);
32 SetPadding(0f);
33 BorderColor = new Color(89, 116, 213, 255);
34 BackgroundColor = new Color(73, 94, 171);
35 UIList uIList = new UIList
36 {
39 };
40 uIList.SetPadding(2f);
41 uIList.PaddingBottom = 4f;
42 uIList.PaddingTop = 4f;
44 _list = uIList;
45 uIList.ListPadding = 4f;
46 uIList.ManualSortMethod = ManualIfnoSortingMethod;
48 uIScrollbar.SetView(100f, 1000f);
49 uIScrollbar.Height.Set(-20f, 1f);
50 uIScrollbar.HAlign = 1f;
51 uIScrollbar.VAlign = 0.5f;
52 uIScrollbar.Left.Set(-6f, 0f);
57 }
58
60 {
61 if (_scrollbar != null)
62 {
63 _scrollbar.ViewPosition -= scrollWheelValue;
64 }
65 }
66
68 {
70 {
71 Width = new StyleDimension(0f, 1f),
72 Height = new StyleDimension(0f, 1f),
74 };
75 uIPanel.BorderColor = new Color(89, 116, 213, 255);
76 uIPanel.BackgroundColor = Color.Transparent;
78 }
79
81 {
82 }
83
84 public override void Recalculate()
85 {
86 base.Recalculate();
88 }
89
90 private void CheckScrollBar()
91 {
92 if (_scrollbar != null)
93 {
95 canScroll = true;
97 {
100 _list.Width.Set(0f, 1f);
101 }
102 else if (!_isScrollbarAttached && canScroll)
103 {
106 _list.Width.Set(-20f, 1f);
107 }
108 }
109 }
110
112 {
113 _list.Clear();
114 if (entry != null)
115 {
117 Recalculate();
118 }
119 }
120
122 {
123 BestiaryUICollectionInfo result = entry.UIInfoProvider?.GetEntryUICollectionInfo() ?? default(BestiaryUICollectionInfo);
124 result.OwnerEntry = entry;
125 return result;
126 }
127
129 {
132 orderby x.Key
133 select x;
134 UIElement item = null;
136 {
137 if (item2.Count() == 0)
138 {
139 continue;
140 }
141 bool flag = false;
142 foreach (IBestiaryInfoElement item3 in item2.OrderByDescending(GetIndividualElementPriority))
143 {
144 UIElement uIElement = item3.ProvideUIElement(uICollectionInfo);
145 if (uIElement != null)
146 {
148 flag = true;
149 }
150 }
151 if (flag)
152 {
154 {
156 Color = new Color(89, 116, 213, 255) * 0.9f
157 };
160 }
161 }
162 _list.Remove(item);
163 }
164
166 {
168 {
169 return bestiaryPrioritizedElement.OrderPriority;
170 }
171 return 0f;
172 }
173
175 {
176 if (element is NPCPortraitInfoElement)
177 {
178 return BestiaryInfoCategory.Portrait;
179 }
181 {
182 return BestiaryInfoCategory.FlavorText;
183 }
184 if (element is NamePlateInfoElement)
185 {
186 return BestiaryInfoCategory.Nameplate;
187 }
189 {
190 return BestiaryInfoCategory.ItemsFromCatchingNPC;
191 }
193 {
194 return BestiaryInfoCategory.ItemsFromDrops;
195 }
197 {
198 return BestiaryInfoCategory.Stats;
199 }
200 return BestiaryInfoCategory.Misc;
201 }
202}
void FillInfoForEntry(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo)
BestiaryUICollectionInfo GetUICollectionInfo(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo)
BestiaryInfoCategory GetBestiaryInfoCategory(IBestiaryInfoElement element)
void AddInfoToList(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo)
virtual void Add(UIElement item)
Definition UIList.cs:82
void SetScrollbar(UIScrollbar scrollbar)
Definition UIList.cs:141
virtual bool Remove(UIElement item)
Definition UIList.cs:90
StyleDimension Height
Definition UIElement.cs:29
void Append(UIElement element)
Definition UIElement.cs:166
StyleDimension Width
Definition UIElement.cs:27
void RemoveChild(UIElement child)
Definition UIElement.cs:182
void SetPadding(float pixels)
Definition UIElement.cs:361
static Color Transparent
Definition Color.cs:76
void Set(float pixels, float precent)
static StyleDimension FromPixelsAndPercent(float pixels, float percent)