-
Notifications
You must be signed in to change notification settings - Fork 181
/
Copy pathLoadInfo.cs
285 lines (224 loc) · 8.05 KB
/
LoadInfo.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
using System.Collections.Generic;
using Il2CppAssets.Scripts.Models.Towers;
using BTD_Mod_Helper.Api.ModOptions;
using BTD_Mod_Helper.Api.Towers;
#if RELEASE
using UltimateCrosspathing.Loaders;
#else
using System.IO;
using Il2CppAssets.Scripts.Models;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using UltimateCrosspathing.Tasks;
#endif
namespace UltimateCrosspathing
{
public abstract class LoadInfo : ModContent
{
private static readonly Dictionary<string, LoadInfo> Cache = new();
public virtual ModByteLoader<TowerModel> Loader { get; }
public abstract ModSettingBool Enabled { get; }
public bool? loaded = null;
public sealed override void Register()
{
Cache[Name] = this;
}
public static bool TryFind(string baseId, out LoadInfo loadInfo) => Cache.TryGetValue(baseId, out loadInfo);
public static bool ShouldWork(string baseId) => TryFind(baseId, out var loadInfo)
? loadInfo.Enabled && loadInfo.loaded != false
: Find<ModTower>(baseId) != null;
#if DEBUG
public static void ExportTowers()
{
foreach (var info in GetContent<LoadInfo>().Where(info => info.Enabled))
{
info.Export();
}
ModHelper.Msg<UltimateCrosspathingMod>("Finished exporting!");
}
public void Export()
{
var towerModels = GenerateTask.TowerModels.Where(model => model.baseId == Name).ToList();
var dummy = ModTowerHelper.CreateTowerModel(Id);
dummy.behaviors = new Il2CppReferenceArray<Model>(towerModels.Count);
for (var i = 0; i < towerModels.Count; i++)
{
dummy.behaviors[i] = towerModels[i];
dummy.AddChildDependant(towerModels[i]);
}
ModByteLoader.Generate(dummy,
Path.Combine(GetInstance<UltimateCrosspathingMod>().ModSourcesPath, "Loaders", Name + "Loader.cs"),
Path.Combine(GetInstance<UltimateCrosspathingMod>().ModSourcesPath, "Bytes", Name + "s.bytes"),
"UltimateCrosspathing.Loaders"
);
}
#endif
}
public class Alchemist : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<AlchemistLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.AlchemistEnabled;
}
public class BananaFarm : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<BananaFarmLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.BananaFarmEnabled;
}
public class BeastHandler : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<BeastHandlerLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.BeastHandlerEnabled;
}
public class BombShooter : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<BombShooterLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.BombShooterEnabled;
}
public class BoomerangMonkey : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<BoomerangMonkeyLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.BoomerangMonkeyEnabled;
}
public class DartlingGunner : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<DartlingGunnerLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.DartlingGunnerEnabled;
}
public class DartMonkey : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<DartMonkeyLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.DartMonkeyEnabled;
}
public class Druid : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<DruidLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.DruidEnabled;
}
public class EngineerMonkey : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<EngineerMonkeyLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.EngineerMonkeyEnabled;
}
public class GlueGunner : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<GlueGunnerLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.GlueGunnerEnabled;
}
public class HeliPilot : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<HeliPilotLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.HeliPilotEnabled;
}
public class IceMonkey : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<IceMonkeyLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.IceMonkeyEnabled;
}
public class MonkeyAce : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<MonkeyAceLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.MonkeyAceEnabled;
}
public class MonkeyBuccaneer : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<MonkeyBuccaneerLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.MonkeyBuccaneerEnabled;
}
public class MonkeySub : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<MonkeySubLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.MonkeySubEnabled;
}
public class MonkeyVillage : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<MonkeyVillageLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.MonkeyVillageEnabled;
}
public class MortarMonkey : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<MortarMonkeyLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.MortarMonkeyEnabled;
}
public class NinjaMonkey : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<NinjaMonkeyLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.NinjaMonkeyEnabled;
}
public class SniperMonkey : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<SniperMonkeyLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.SniperMonkeyEnabled;
}
public class SpikeFactory : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<SpikeFactoryLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.SpikeFactoryEnabled;
}
public class SuperMonkey : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<SuperMonkeyLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.SuperMonkeyEnabled;
}
public class TackShooter : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<TackShooterLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.TackShooterEnabled;
}
public class WizardMonkey : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<WizardMonkeyLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.WizardMonkeyEnabled;
}
public class Mermonkey : LoadInfo
{
#if RELEASE
public override ModByteLoader<TowerModel> Loader => GetInstance<MermonkeyLoader>();
#endif
public override ModSettingBool Enabled => TowerSettings.MermonkeyEnabled;
}
}