-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGiftsUI.cs
46 lines (41 loc) · 1.54 KB
/
GiftsUI.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using BTD_Mod_Helper.Api.Enums;
using BTD_Mod_Helper.Extensions;
using Il2CppAssets.Scripts.Unity.UI_New.InGame;
using Il2CppAssets.Scripts.Unity.UI_New.Popups;
using MelonLoader;
using UnityEngine;
using UnityEngine.Video;
namespace BrotherMonkey;
public class Gift
{
[RegisterTypeInIl2Cpp(false)]
public class GiftUI : MonoBehaviour
{
public static GiftUI instance = null;
public void Close()
{
if (gameObject)
{
gameObject.Destroy();
}
}
public static void CreatePanel(int Cash, double Lives)
{
if (InGame.instance != null)
{
RectTransform rect = InGame.instance.uiRect;
var panel = rect.gameObject.AddModHelperPanel(new("Panel_", 0, 0, 0, 0), VanillaSprites.BrownPanel);
instance = panel.AddComponent<GiftUI>();
var image = panel.AddImage(new("Image_", 0, 0, 1000), VanillaSprites.GiftBlue);
var Claim = image.AddButton(new("Button_", 0, -500, 450, 450 / 2), VanillaSprites.GreenBtnLong, new System.Action(() =>
{
InGame.instance.AddCash(Cash);
InGame.instance.AddHealth(Lives);
instance.Close();
PopupScreen.instance?.ShowOkPopup($"You were rewarded with {Cash}$ and {Lives} Lives");
}));
Claim.AddText(new("Title_", 0, 0, 300, 150), "CLAIM!", 70);
}
}
}
}