Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UIBestiaryEntryGrid.cs
Go to the documentation of this file.
1using System;
5using Terraria.UI;
6
8
10{
12
13 private MouseEvent _clickOnEntryEvent;
14
15 private int _atEntryIndex;
16
17 private int _lastEntry;
18
19 public event Action OnGridContentsChanged;
20
31
32 public void UpdateEntries()
33 {
35 }
36
38 {
46 for (int i = atEntryIndex; i < num; i++)
47 {
49 }
50 int num2 = 0;
51 float num3 = 0.5f / (float)maxEntriesWidth;
52 float num4 = 0.5f / (float)maxEntriesHeight;
53 for (int j = 0; j < maxEntriesHeight; j++)
54 {
55 for (int k = 0; k < maxEntriesWidth; k++)
56 {
57 if (num2 >= list.Count)
58 {
59 break;
60 }
62 num2++;
63 uIElement.OnLeftClick += _clickOnEntryEvent;
64 uIElement.VAlign = (uIElement.HAlign = 0.5f);
65 uIElement.Left.Set(0f, (float)k / (float)maxEntriesWidth - 0.5f + num3);
66 uIElement.Top.Set(0f, (float)j / (float)maxEntriesHeight - 0.5f + num4);
67 uIElement.SetSnapPoint("Entries", num2, new Vector2(0.2f, 0.7f));
69 }
70 }
71 }
72
73 public override void Recalculate()
74 {
75 base.Recalculate();
77 }
78
80 {
82 maxEntriesWidth = rectangle.Width / 72;
83 maxEntriesHeight = rectangle.Height / 72;
84 int num = 0;
86 }
87
88 public string GetRangeText()
89 {
93 int num2 = Math.Min(atEntryIndex + 1, num);
94 return $"{num2}-{num} ({_lastEntry})";
95 }
96
98 {
99 element.OnLeftClick += delegate
100 {
102 };
103 }
104
110
117
119 {
121 if (this.OnGridContentsChanged != null)
122 {
124 }
125 }
126}
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static byte Max(byte val1, byte val2)
Definition Math.cs:738
void GetEntriesToShow(out int maxEntriesWidth, out int maxEntriesHeight, out int maxEntriesToHave)
void FixBestiaryRange(int offset, int maxEntriesToHave)
UIBestiaryEntryGrid(List< BestiaryEntry > workingSet, MouseEvent clickOnEntryEvent)
void MakeButtonGoByOffset(UIElement element, int howManyPages)
StyleDimension Height
Definition UIElement.cs:29
void Append(UIElement element)
Definition UIElement.cs:166
StyleDimension Width
Definition UIElement.cs:27
CalculatedStyle GetDimensions()
Definition UIElement.cs:382
void SetPadding(float pixels)
Definition UIElement.cs:361