-
Notifications
You must be signed in to change notification settings - Fork 0
/
TowerCheat.cs
115 lines (105 loc) · 3.96 KB
/
TowerCheat.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using MelonLoader;
using BTD_Mod_Helper;
using TowerCheat;
using Il2CppAssets.Scripts.Unity.UI_New.InGame;
using UnityEngine;
using BTD_Mod_Helper.Api.Components;
using BTD_Mod_Helper.Extensions;
using BTD_Mod_Helper.Api.Enums;
using Il2CppAssets.Scripts.Simulation.Towers;
using System;
using Il2CppAssets.Scripts.Models.Towers.Behaviors;
using System.Linq;
using Il2CppAssets.Scripts.Models.Towers;
using Il2CppAssets.Scripts.Models.Towers.Behaviors.Attack;
using Il2CppNinjaKiwi.Common;
using TowerCheat.TowerMethod;
using Il2CppAssets.Scripts.Models.Towers.Behaviors.Emissions;
using Il2CppAssets.Scripts.Models.Towers.Projectiles.Behaviors;
using UnityEngine.Events;
using Il2CppAssets.Scripts.Unity.Bloons.Behaviors;
using Il2CppAssets.Scripts.Models.Bloons.Behaviors;
using BTD_Mod_Helper.Api;
using TowerCheat.UI;
using TowerCheat.UIPanels;
[assembly: MelonInfo(typeof(TowerCheat.TowerCheat), ModHelperData.Name, ModHelperData.Version, ModHelperData.RepoOwner)]
[assembly: MelonGame("Ninja Kiwi", "BloonsTD6")]
namespace TowerCheat;
public class TowerCheat : BloonsTD6Mod
{
static bool IsMenuOpen = false;
static GameObject upgrades;
static GameObject tower;
static ModHelperScrollPanel panel;
public override void OnApplicationStart()
{
}
public override void OnTowerSelected(Tower tower)
{
base.OnTowerSelected(tower);
CloseMenu();
}
public override void OnMatchStart()
{
base.OnMatchStart();
tower = GameObject.Find("TowerElements");
upgrades = GameObject.Find("SelectedTowerOptions");
panel = tower.AddModHelperScrollPanel(new Info("CheatPanel", 0, -333, 900, 1100), RectTransform.Axis.Vertical, VanillaSprites.BlueInsertPanel, 50, 100);
panel.ScrollRect.verticalScrollbarSpacing = 100;
panel.SetActive(false);
}
public override void OnUpdate()
{
base.OnUpdate();
if (Input.GetKeyUp(KeyCode.F1))
{
if (IsMenuOpen)
{
CloseMenu();
}
else
{
OpenMenu();
}
}
}
public void CloseMenu()
{
IsMenuOpen = false;
upgrades.active = true;
panel.SetActive(false);
}
public void OpenMenu()
{
if (InGame.instance.inputManager.SelectedTower != null)
{
IsMenuOpen = true;
upgrades.active = false;
panel.SetActive(true);
LoadScrollContent();
}
}
public static void LoadScrollContent(bool DestroyOldContent = true)
{
if (DestroyOldContent) { panel.ScrollContent.transform.DestroyAllChildren(); }
panel.AddScrollContent(Panels.Tower(InGame.instance.inputManager.SelectedTower.tower));
panel.AddScrollContent(Panels.Divider());
foreach (var attack in InGame.instance.inputManager.SelectedTower.tower.rootModel.Cast<TowerModel>().GetAttackModels())
{
panel.AddScrollContent(Panels.Weapon(attack));
if (Panels.EffectsPanel(attack) != null)
{
panel.AddScrollContent(Panels.EffectsPanel(attack));
}
if (attack.weapons[0].projectile.HasBehavior<CreateProjectileOnContactModel>()) { panel.AddScrollContent(Panels.SplitshotPanel(attack)); }
if (attack.weapons[0].projectile.HasBehavior<WindModel>()) { panel.AddScrollContent(Panels.WindPanel(attack)); }
if (attack.weapons[0].emission.Is<ArcEmissionModel>()) { panel.AddScrollContent(Panels.MultishotPanel(attack)); }
panel.AddScrollContent(Panels.Divider());
}
foreach (var abil in InGame.instance.inputManager.SelectedTower.tower.rootModel.Cast<TowerModel>().GetAbilities())
{
panel.AddScrollContent(Panels.AbilityPanel(abil));
panel.AddScrollContent(Panels.Divider());
}
}
}