forked from bloodypenguin/cities-skylines-unlimiter-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnlockAllCheat.cs
60 lines (56 loc) · 1.91 KB
/
UnlockAllCheat.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
using System;
using System.Collections;
using EightyOne.Areas;
namespace EightyOne
{
public static class UnlockAllCheat
{
public static volatile bool CheatInProgress = false;
public static void UnlockAllAreas()
{
if (!GameAreaManager.exists || !SimulationManager.exists || LoadingManager.instance.m_loadedEnvironment == null)
{
return;
}
SimulationManager.instance.AddAction(() =>
{
GameAreaManager.instance.StartCoroutine(UnlockAllCoroutine());
});
}
private static IEnumerator UnlockAllCoroutine()
{
var instance = GameAreaManager.instance;
for (var i = 0; i < FakeGameAreaManager.GRID; ++i)
{
for (var j = 0; j < FakeGameAreaManager.GRID; ++j)
{
var i1 = i;
var j1 = j;
SimulationManager.instance.AddAction(() =>
{
try
{
if (instance.IsUnlocked(i1, j1))
{
return;
}
var areaIndex = FakeGameAreaManager.GetTileIndex(i1, j1);
//This method gets inlined and can't be detoured
CheatInProgress = true;
instance.UnlockArea(areaIndex);
}
catch (Exception e)
{
UnityEngine.Debug.LogException(e);
}
finally
{
CheatInProgress = false;
}
});
yield return null;
}
}
}
}
}