Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
InGameNotificationsTracker.cs
Go to the documentation of this file.
8
9namespace Terraria.UI;
10
12{
14
15 public static void Initialize()
16 {
17 Main.Achievements.OnAchievementCompleted += AddCompleted;
18 SocialAPI.JoinRequests.OnRequestAdded += JoinRequests_OnRequestAdded;
19 SocialAPI.JoinRequests.OnRequestRemoved += JoinRequests_OnRequestRemoved;
20 }
21
26
28 {
29 for (int num = _notifications.Count - 1; num >= 0; num--)
30 {
31 if (_notifications[num].CreationObject == request)
32 {
33 _notifications.RemoveAt(num);
34 }
35 }
36 }
37
38 public static void DrawInGame(SpriteBatch sb)
39 {
40 float num = Main.screenHeight - 40;
42 {
43 num -= 25f;
44 }
47 {
48 notification.DrawInGame(sb, positionAnchorBottom);
50 if (positionAnchorBottom.Y < -100f)
51 {
52 break;
53 }
54 }
55 }
56
58 {
59 int num = 4;
60 int num2 = area.Height / 5 - num;
61 Rectangle area2 = new Rectangle(area.X, area.Y, area.Width - 6, num2);
62 int num3 = 0;
64 {
65 notification.DrawInNotificationsArea(spriteBatch, area2, ref gamepadPointIdLocalIndexToUse);
66 area2.Y += num2 + num;
67 num3++;
68 if (num3 >= 5)
69 {
70 break;
71 }
72 }
73 }
74
75 public static void AddCompleted(Achievement achievement)
76 {
77 if (Main.netMode != 2)
78 {
80 }
81 }
82
90
91 public static void Clear()
92 {
93 _notifications.Clear();
94 }
95
96 public static void Update()
97 {
98 for (int i = 0; i < _notifications.Count; i++)
99 {
100 _notifications[i].Update();
101 if (_notifications[i].ShouldBeRemoved)
102 {
104 i--;
105 }
106 }
107 }
108}
static int netMode
Definition Main.cs:2095
static int screenWidth
Definition Main.cs:1719
static void AddCompleted(Achievement achievement)
static List< IInGameNotification > _notifications
static void AddJoinRequest(UserJoinToServerRequest request)
static void JoinRequests_OnRequestRemoved(UserJoinToServerRequest request)
static void JoinRequests_OnRequestAdded(UserJoinToServerRequest request)
static void DrawInIngameOptions(SpriteBatch spriteBatch, Rectangle area, ref int gamepadPointIdLocalIndexToUse)