Skip to content
This repository was archived by the owner on Jan 30, 2024. It is now read-only.

Commit bbaa63a

Browse files
committed
Added message shards
1 parent 08e2901 commit bbaa63a

3 files changed

Lines changed: 295 additions & 4 deletions

File tree

BigMessage.cs

Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
using GTA;
2+
using GTA.Native;
3+
4+
namespace NativeUI
5+
{
6+
public class BigMessageHandler
7+
{
8+
private Scaleform _sc;
9+
private int _start;
10+
private int _timer;
11+
12+
public BigMessageHandler()
13+
{
14+
_sc = new Scaleform(0);
15+
_sc.Load("MP_BIG_MESSAGE_FREEMODE");
16+
}
17+
18+
public void ShowMissionPassedMessage(string msg, int time = 5000)
19+
{
20+
_start = Game.GameTime;
21+
_sc.CallFunction("SHOW_MISSION_PASSED_MESSAGE", msg, "", 100, true, 0, true);
22+
_timer = time;
23+
}
24+
25+
public void ShowColoredShard(string msg, string desc, HudColor textColor, HudColor bgColor, int time = 5000)
26+
{
27+
_start = Game.GameTime;
28+
_sc.CallFunction("SHOW_SHARD_CENTERED_MP_MESSAGE", msg, desc, (int)bgColor, (int)textColor);
29+
_timer = time;
30+
}
31+
32+
public void ShowOldMessage(string msg, int time = 5000)
33+
{
34+
_start = Game.GameTime;
35+
_sc.CallFunction("SHOW_MISSION_PASSED_MESSAGE", msg);
36+
_timer = time;
37+
}
38+
39+
public void ShowSimpleShard(string title, string subtitle, int time = 5000)
40+
{
41+
_start = Game.GameTime;
42+
_sc.CallFunction("SHOW_SHARD_CREW_RANKUP_MP_MESSAGE", title, subtitle);
43+
_timer = time;
44+
}
45+
46+
public void ShowRankupMessage(string msg, string subtitle, int rank, int time = 5000)
47+
{
48+
_start = Game.GameTime;
49+
_sc.CallFunction("SHOW_BIG_MP_MESSAGE", msg, subtitle, rank, "", "");
50+
_timer = time;
51+
}
52+
53+
public void ShowWeaponPurchasedMessage(string bigMessage, string weaponName, WeaponHash weapon, int time = 5000)
54+
{
55+
_start = Game.GameTime;
56+
_sc.CallFunction("SHOW_WEAPON_PURCHASED", bigMessage, weaponName, unchecked((int)weapon), "", 100);
57+
_timer = time;
58+
}
59+
60+
public void ShowMpMessageLarge(string msg, int time = 5000)
61+
{
62+
_start = Game.GameTime;
63+
_sc.CallFunction("SHOW_CENTERED_MP_MESSAGE_LARGE", msg, "test", 100, true, 100);
64+
_sc.CallFunction("TRANSITION_IN");
65+
_timer = time;
66+
}
67+
68+
public void ShowCustomShard(string funcName, params object[] paremeters)
69+
{
70+
_sc.CallFunction(funcName, paremeters);
71+
}
72+
73+
internal void Update()
74+
{
75+
_sc.Render2D();
76+
if (_start != 0 && Game.GameTime - _start > _timer)
77+
{
78+
_sc.CallFunction("TRANSITION_OUT");
79+
_start = 0;
80+
}
81+
}
82+
}
83+
84+
public class BigMessageThread : Script
85+
{
86+
public static BigMessageHandler MessageInstance { get; set; }
87+
88+
public BigMessageThread()
89+
{
90+
MessageInstance = new BigMessageHandler();
91+
92+
Tick += (sender, args) =>
93+
{
94+
MessageInstance.Update();
95+
};
96+
}
97+
}
98+
99+
public enum HudColor
100+
{
101+
HUD_COLOUR_PURE_WHITE = 0,
102+
HUD_COLOUR_WHITE = 1,
103+
HUD_COLOUR_BLACK = 2,
104+
HUD_COLOUR_GREY = 3,
105+
HUD_COLOUR_GREYLIGHT = 4,
106+
HUD_COLOUR_GREYDARK = 5,
107+
HUD_COLOUR_RED = 6,
108+
HUD_COLOUR_REDLIGHT = 7,
109+
HUD_COLOUR_REDDARK = 8,
110+
HUD_COLOUR_BLUE = 9,
111+
HUD_COLOUR_BLUELIGHT = 10,
112+
HUD_COLOUR_BLUEDARK = 11,
113+
HUD_COLOUR_YELLOW = 12,
114+
HUD_COLOUR_YELLOWLIGHT = 13,
115+
HUD_COLOUR_YELLOWDARK = 14,
116+
HUD_COLOUR_ORANGE = 15,
117+
HUD_COLOUR_ORANGELIGHT = 16,
118+
HUD_COLOUR_ORANGEDARK = 17,
119+
HUD_COLOUR_GREEN = 18,
120+
HUD_COLOUR_GREENLIGHT = 19,
121+
HUD_COLOUR_GREENDARK = 20,
122+
HUD_COLOUR_PURPLE = 21,
123+
HUD_COLOUR_PURPLELIGHT = 22,
124+
HUD_COLOUR_PURPLEDARK = 23,
125+
HUD_COLOUR_PINK = 24,
126+
HUD_COLOUR_RADAR_HEALTH = 25,
127+
HUD_COLOUR_RADAR_ARMOUR = 26,
128+
HUD_COLOUR_RADAR_DAMAGE = 27,
129+
HUD_COLOUR_NET_PLAYER1 = 28,
130+
HUD_COLOUR_NET_PLAYER2 = 29,
131+
HUD_COLOUR_NET_PLAYER3 = 30,
132+
HUD_COLOUR_NET_PLAYER4 = 31,
133+
HUD_COLOUR_NET_PLAYER5 = 32,
134+
HUD_COLOUR_NET_PLAYER6 = 33,
135+
HUD_COLOUR_NET_PLAYER7 = 34,
136+
HUD_COLOUR_NET_PLAYER8 = 35,
137+
HUD_COLOUR_NET_PLAYER9 = 36,
138+
HUD_COLOUR_NET_PLAYER10 = 37,
139+
HUD_COLOUR_NET_PLAYER11 = 38,
140+
HUD_COLOUR_NET_PLAYER12 = 39,
141+
HUD_COLOUR_NET_PLAYER13 = 40,
142+
HUD_COLOUR_NET_PLAYER14 = 41,
143+
HUD_COLOUR_NET_PLAYER15 = 42,
144+
HUD_COLOUR_NET_PLAYER16 = 43,
145+
HUD_COLOUR_NET_PLAYER17 = 44,
146+
HUD_COLOUR_NET_PLAYER18 = 45,
147+
HUD_COLOUR_NET_PLAYER19 = 46,
148+
HUD_COLOUR_NET_PLAYER20 = 47,
149+
HUD_COLOUR_NET_PLAYER21 = 48,
150+
HUD_COLOUR_NET_PLAYER22 = 49,
151+
HUD_COLOUR_NET_PLAYER23 = 50,
152+
HUD_COLOUR_NET_PLAYER24 = 51,
153+
HUD_COLOUR_NET_PLAYER25 = 52,
154+
HUD_COLOUR_NET_PLAYER26 = 53,
155+
HUD_COLOUR_NET_PLAYER27 = 54,
156+
HUD_COLOUR_NET_PLAYER28 = 55,
157+
HUD_COLOUR_NET_PLAYER29 = 56,
158+
HUD_COLOUR_NET_PLAYER30 = 57,
159+
HUD_COLOUR_NET_PLAYER31 = 58,
160+
HUD_COLOUR_NET_PLAYER32 = 59,
161+
HUD_COLOUR_SIMPLEBLIP_DEFAULT = 60,
162+
HUD_COLOUR_MENU_BLUE = 61,
163+
HUD_COLOUR_MENU_GREY_LIGHT = 62,
164+
HUD_COLOUR_MENU_BLUE_EXTRA_DARK = 63,
165+
HUD_COLOUR_MENU_YELLOW = 64,
166+
HUD_COLOUR_MENU_YELLOW_DARK = 65,
167+
HUD_COLOUR_MENU_GREEN = 66,
168+
HUD_COLOUR_MENU_GREY = 67,
169+
HUD_COLOUR_MENU_GREY_DARK = 68,
170+
HUD_COLOUR_MENU_HIGHLIGHT = 69,
171+
HUD_COLOUR_MENU_STANDARD = 70,
172+
HUD_COLOUR_MENU_DIMMED = 71,
173+
HUD_COLOUR_MENU_EXTRA_DIMMED = 72,
174+
HUD_COLOUR_BRIEF_TITLE = 73,
175+
HUD_COLOUR_MID_GREY_MP = 74,
176+
HUD_COLOUR_NET_PLAYER1_DARK = 75,
177+
HUD_COLOUR_NET_PLAYER2_DARK = 76,
178+
HUD_COLOUR_NET_PLAYER3_DARK = 77,
179+
HUD_COLOUR_NET_PLAYER4_DARK = 78,
180+
HUD_COLOUR_NET_PLAYER5_DARK = 79,
181+
HUD_COLOUR_NET_PLAYER6_DARK = 80,
182+
HUD_COLOUR_NET_PLAYER7_DARK = 81,
183+
HUD_COLOUR_NET_PLAYER8_DARK = 82,
184+
HUD_COLOUR_NET_PLAYER9_DARK = 83,
185+
HUD_COLOUR_NET_PLAYER10_DARK = 84,
186+
HUD_COLOUR_NET_PLAYER11_DARK = 85,
187+
HUD_COLOUR_NET_PLAYER12_DARK = 86,
188+
HUD_COLOUR_NET_PLAYER13_DARK = 87,
189+
HUD_COLOUR_NET_PLAYER14_DARK = 88,
190+
HUD_COLOUR_NET_PLAYER15_DARK = 89,
191+
HUD_COLOUR_NET_PLAYER16_DARK = 90,
192+
HUD_COLOUR_NET_PLAYER17_DARK = 91,
193+
HUD_COLOUR_NET_PLAYER18_DARK = 92,
194+
HUD_COLOUR_NET_PLAYER19_DARK = 93,
195+
HUD_COLOUR_NET_PLAYER20_DARK = 94,
196+
HUD_COLOUR_NET_PLAYER21_DARK = 95,
197+
HUD_COLOUR_NET_PLAYER22_DARK = 96,
198+
HUD_COLOUR_NET_PLAYER23_DARK = 97,
199+
HUD_COLOUR_NET_PLAYER24_DARK = 98,
200+
HUD_COLOUR_NET_PLAYER25_DARK = 99,
201+
HUD_COLOUR_NET_PLAYER26_DARK = 100,
202+
HUD_COLOUR_NET_PLAYER27_DARK = 101,
203+
HUD_COLOUR_NET_PLAYER28_DARK = 102,
204+
HUD_COLOUR_NET_PLAYER29_DARK = 103,
205+
HUD_COLOUR_NET_PLAYER30_DARK = 104,
206+
HUD_COLOUR_NET_PLAYER31_DARK = 105,
207+
HUD_COLOUR_NET_PLAYER32_DARK = 106,
208+
HUD_COLOUR_BRONZE = 107,
209+
HUD_COLOUR_SILVER = 108,
210+
HUD_COLOUR_GOLD = 109,
211+
HUD_COLOUR_PLATINUM = 110,
212+
HUD_COLOUR_GANG1 = 111,
213+
HUD_COLOUR_GANG2 = 112,
214+
HUD_COLOUR_GANG3 = 113,
215+
HUD_COLOUR_GANG4 = 114,
216+
HUD_COLOUR_SAME_CREW = 115,
217+
HUD_COLOUR_FREEMODE = 116,
218+
HUD_COLOUR_PAUSE_BG = 117,
219+
HUD_COLOUR_FRIENDLY = 118,
220+
HUD_COLOUR_ENEMY = 119,
221+
HUD_COLOUR_LOCATION = 120,
222+
HUD_COLOUR_PICKUP = 121,
223+
HUD_COLOUR_PAUSE_SINGLEPLAYER = 122,
224+
HUD_COLOUR_FREEMODE_DARK = 123,
225+
HUD_COLOUR_INACTIVE_MISSION = 124,
226+
HUD_COLOUR_DAMAGE = 125,
227+
HUD_COLOUR_PINKLIGHT = 126,
228+
HUD_COLOUR_PM_MITEM_HIGHLIGHT = 127,
229+
HUD_COLOUR_SCRIPT_VARIABLE = 128,
230+
HUD_COLOUR_YOGA = 129,
231+
HUD_COLOUR_TENNIS = 130,
232+
HUD_COLOUR_GOLF = 131,
233+
HUD_COLOUR_SHOOTING_RANGE = 132,
234+
HUD_COLOUR_FLIGHT_SCHOOL = 133,
235+
HUD_COLOUR_NORTH_BLUE = 134,
236+
HUD_COLOUR_SOCIAL_CLUB = 135,
237+
HUD_COLOUR_PLATFORM_BLUE = 136,
238+
HUD_COLOUR_PLATFORM_GREEN = 137,
239+
HUD_COLOUR_PLATFORM_GREY = 138,
240+
HUD_COLOUR_FACEBOOK_BLUE = 139,
241+
HUD_COLOUR_INGAME_BG = 140,
242+
HUD_COLOUR_DARTS = 141,
243+
HUD_COLOUR_WAYPOINT = 142,
244+
HUD_COLOUR_MICHAEL = 143,
245+
HUD_COLOUR_FRANKLIN = 144,
246+
HUD_COLOUR_TREVOR = 145,
247+
HUD_COLOUR_GOLF_P1 = 146,
248+
HUD_COLOUR_GOLF_P2 = 147,
249+
HUD_COLOUR_GOLF_P3 = 148,
250+
HUD_COLOUR_GOLF_P4 = 149,
251+
HUD_COLOUR_WAYPOINTLIGHT = 150,
252+
HUD_COLOUR_WAYPOINTDARK = 151,
253+
HUD_COLOUR_PANEL_LIGHT = 152,
254+
HUD_COLOUR_MICHAEL_DARK = 153,
255+
HUD_COLOUR_FRANKLIN_DARK = 154,
256+
HUD_COLOUR_TREVOR_DARK = 155,
257+
HUD_COLOUR_OBJECTIVE_ROUTE = 156,
258+
HUD_COLOUR_PAUSEMAP_TINT = 157,
259+
HUD_COLOUR_PAUSE_DESELECT = 158,
260+
HUD_COLOUR_PM_WEAPONS_PURCHASABLE = 159,
261+
HUD_COLOUR_PM_WEAPONS_LOCKED = 160,
262+
HUD_COLOUR_END_SCREEN_BG = 161,
263+
HUD_COLOUR_CHOP = 162,
264+
HUD_COLOUR_PAUSEMAP_TINT_HALF = 163,
265+
HUD_COLOUR_NORTH_BLUE_OFFICIAL = 164,
266+
HUD_COLOUR_SCRIPT_VARIABLE_2 = 165,
267+
HUD_COLOUR_H = 166,
268+
HUD_COLOUR_HDARK = 167,
269+
HUD_COLOUR_T = 168,
270+
HUD_COLOUR_TDARK = 169,
271+
HUD_COLOUR_HSHARD = 170,
272+
HUD_COLOUR_CONTROLLER_MICHAEL = 171,
273+
HUD_COLOUR_CONTROLLER_FRANKLIN = 172,
274+
HUD_COLOUR_CONTROLLER_TREVOR = 173,
275+
HUD_COLOUR_CONTROLLER_CHOP = 174,
276+
HUD_COLOUR_VIDEO_EDITOR_VIDEO = 175,
277+
HUD_COLOUR_VIDEO_EDITOR_AUDIO = 176,
278+
HUD_COLOUR_VIDEO_EDITOR_TEXT = 177,
279+
HUD_COLOUR_HB_BLUE = 178,
280+
HUD_COLOUR_HB_YELLOW = 179,
281+
}
282+
}

NativeUI.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<Reference Include="System.Xml" />
5050
</ItemGroup>
5151
<ItemGroup>
52+
<Compile Include="BigMessage.cs" />
5253
<Compile Include="InstructionalButton.cs" />
5354
<Compile Include="MenuPool.cs" />
5455
<Compile Include="PauseMenu\TabItem.cs" />

TimerBars.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using System.Drawing;
3+
using GTA;
34
using Font = GTA.Font;
45

56
namespace NativeUI
@@ -18,8 +19,11 @@ public virtual void Draw(int interval)
1819
SizeF res = UIMenu.GetScreenResolutionMantainRatio();
1920
Point safe = UIMenu.GetSafezoneBounds();
2021

21-
new UIResText(Label, new Point((int)res.Width - safe.X - 180, (int)res.Height - safe.Y - (90 + (4 * interval))), 0.3f, Color.White, Font.ChaletLondon, UIResText.Alignment.Right).Draw();
22-
new Sprite("timerbars", "all_black_bg", new Point((int)res.Width - safe.X - 298, (int)res.Height - safe.Y - (100 + (4 * interval))), new Size(300, 37), 0f, Color.FromArgb(180, 255, 255, 255)).Draw();
22+
new UIResText(Label, new Point((int)res.Width - safe.X - 180, (int)res.Height - safe.Y - (10 + (4 * interval))), 0.3f, Color.White, Font.ChaletLondon, UIResText.Alignment.Right).Draw();
23+
new Sprite("timerbars", "all_black_bg", new Point((int)res.Width - safe.X - 298, (int)res.Height - safe.Y - (20 + (4 * interval))), new Size(300, 37), 0f, Color.FromArgb(180, 255, 255, 255)).Draw();
24+
25+
UI.HideHudComponentThisFrame(HudComponent.AreaName);
26+
UI.HideHudComponentThisFrame(HudComponent.VehicleName);
2327
}
2428
}
2529

@@ -38,13 +42,17 @@ public override void Draw(int interval)
3842
Point safe = UIMenu.GetSafezoneBounds();
3943

4044
base.Draw(interval);
41-
new UIResText(Text, new Point((int)res.Width - safe.X - 20, (int)res.Height - safe.Y - (102 + (4 * interval))), 0.5f, Color.White, Font.ChaletLondon, UIResText.Alignment.Right).Draw();
45+
new UIResText(Text, new Point((int)res.Width - safe.X - 20, (int)res.Height - safe.Y - (22 + (4 * interval))), 0.5f, Color.White, Font.ChaletLondon, UIResText.Alignment.Right).Draw();
4246
}
4347
}
4448

4549
public class BarTimerBar : TimerBarBase
4650
{
4751
public string Text { get; set; }
52+
53+
/// <summary>
54+
/// Bar percentage. Goes from 0 to 1.
55+
/// </summary>
4856
public float Percentage { get; set; }
4957

5058
public Color BackgroundColor { get; set; }
@@ -63,7 +71,7 @@ public override void Draw(int interval)
6371

6472
base.Draw(interval);
6573

66-
var start = new Point((int)res.Width - safe.X - 160, (int)res.Height - safe.Y - (88 + (4 * interval)));
74+
var start = new Point((int)res.Width - safe.X - 160, (int)res.Height - safe.Y - (8 + (4 * interval)));
6775

6876
new UIResRectangle(start, new Size(150, 15), BackgroundColor).Draw();
6977
new UIResRectangle(start, new Size((int)(150 * Percentage), 15), ForegroundColor).Draw();

0 commit comments

Comments
 (0)