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

Commit 2ca80e6

Browse files
committed
Fixed WASTED message not going away.
1 parent 5a1c0a5 commit 2ca80e6

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

BigMessage.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using GTA;
1+
using System.Runtime.Remoting.Messaging;
2+
using GTA;
23
using GTA.Native;
34

45
namespace NativeUI
@@ -11,54 +12,73 @@ public class BigMessageHandler
1112

1213
public BigMessageHandler()
1314
{
15+
16+
}
17+
18+
public void Load()
19+
{
20+
if (_sc != null) return;
1421
_sc = new Scaleform(0);
1522
_sc.Load("MP_BIG_MESSAGE_FREEMODE");
1623
}
1724

25+
public void Dispose()
26+
{
27+
Function.Call(Hash.SET_SCALEFORM_MOVIE_AS_NO_LONGER_NEEDED, new OutputArgument(_sc.Handle));
28+
_sc = null;
29+
}
30+
1831
public void ShowMissionPassedMessage(string msg, int time = 5000)
1932
{
33+
Load();
2034
_start = Game.GameTime;
2135
_sc.CallFunction("SHOW_MISSION_PASSED_MESSAGE", msg, "", 100, true, 0, true);
2236
_timer = time;
2337
}
2438

2539
public void ShowColoredShard(string msg, string desc, HudColor textColor, HudColor bgColor, int time = 5000)
2640
{
41+
Load();
2742
_start = Game.GameTime;
2843
_sc.CallFunction("SHOW_SHARD_CENTERED_MP_MESSAGE", msg, desc, (int)bgColor, (int)textColor);
2944
_timer = time;
3045
}
3146

3247
public void ShowOldMessage(string msg, int time = 5000)
3348
{
49+
Load();
3450
_start = Game.GameTime;
3551
_sc.CallFunction("SHOW_MISSION_PASSED_MESSAGE", msg);
3652
_timer = time;
3753
}
3854

3955
public void ShowSimpleShard(string title, string subtitle, int time = 5000)
4056
{
57+
Load();
4158
_start = Game.GameTime;
4259
_sc.CallFunction("SHOW_SHARD_CREW_RANKUP_MP_MESSAGE", title, subtitle);
4360
_timer = time;
4461
}
4562

4663
public void ShowRankupMessage(string msg, string subtitle, int rank, int time = 5000)
4764
{
65+
Load();
4866
_start = Game.GameTime;
4967
_sc.CallFunction("SHOW_BIG_MP_MESSAGE", msg, subtitle, rank, "", "");
5068
_timer = time;
5169
}
5270

5371
public void ShowWeaponPurchasedMessage(string bigMessage, string weaponName, WeaponHash weapon, int time = 5000)
5472
{
73+
Load();
5574
_start = Game.GameTime;
5675
_sc.CallFunction("SHOW_WEAPON_PURCHASED", bigMessage, weaponName, unchecked((int)weapon), "", 100);
5776
_timer = time;
5877
}
5978

6079
public void ShowMpMessageLarge(string msg, int time = 5000)
6180
{
81+
Load();
6282
_start = Game.GameTime;
6383
_sc.CallFunction("SHOW_CENTERED_MP_MESSAGE_LARGE", msg, "test", 100, true, 100);
6484
_sc.CallFunction("TRANSITION_IN");
@@ -67,17 +87,21 @@ public void ShowMpMessageLarge(string msg, int time = 5000)
6787

6888
public void ShowCustomShard(string funcName, params object[] paremeters)
6989
{
90+
Load();
7091
_sc.CallFunction(funcName, paremeters);
7192
}
7293

7394
internal void Update()
7495
{
96+
if (_sc == null) return;
7597
_sc.Render2D();
7698
if (_start != 0 && Game.GameTime - _start > _timer)
7799
{
78100
_sc.CallFunction("TRANSITION_OUT");
79101
_start = 0;
102+
Dispose();
80103
}
104+
81105
}
82106
}
83107

0 commit comments

Comments
 (0)