-
Notifications
You must be signed in to change notification settings - Fork 1
/
Main.cs
89 lines (74 loc) · 2.73 KB
/
Main.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
using System;
using UnityEngine;
namespace MoreRealism
{
public class Main : AbstractMod
{
private GameObject _controllerGO;
private MoreRealismController _controllerPrefab;
public Main()
{
SetupKeyBinding();
}
public override void onEnabled()
{
GameObject controllerPrefabGO = new GameObject();
_controllerPrefab = controllerPrefabGO.AddComponent<MoreRealismController>();
_controllerPrefab.SetAsPrefab();
AssetManager.Instance.registerObject(_controllerPrefab);
_controllerGO = new GameObject();
MoreRealismController.Instance = _controllerGO.AddComponent<MoreRealismController>();
EventManager.Instance.OnStartPlayingPark += MoreRealismController.Instance.Load;
}
public override void onDisabled()
{
if (MoreRealismController.Instance != null)
{
EventManager.Instance.OnStartPlayingPark -= MoreRealismController.Instance.Load;
MoreRealismController.Instance.TryKill();
}
AssetManager.Instance.unregisterObject(_controllerPrefab);
_controllerPrefab.TryKill();
}
private void SetupKeyBinding()
{
KeyGroup group = new KeyGroup(getIdentifier());
group.keyGroupName = getName();
InputManager.Instance.registerKeyGroup(group);
RegisterKey("openSettings", KeyCode.U, "Toggle More Realism settings window",
"Use this key to toggle the settings window for the park you're currently in");
}
private void RegisterKey(string identifier, KeyCode keyCode, string name, string description = "")
{
KeyMapping key = new KeyMapping(getIdentifier() + "/" + identifier, keyCode, KeyCode.None);
key.keyGroupIdentifier = getIdentifier();
key.keyName = name;
key.keyDescription = description;
InputManager.Instance.registerKeyMapping(key);
}
public override bool isMultiplayerModeCompatible()
{
return true;
}
public override bool isRequiredByAllPlayersInMultiplayerMode()
{
return true;
}
public override string getName()
{
return "More Realism";
}
public override string getDescription()
{
return "Add new mechanics to make the game more realistic";
}
public override string getIdentifier()
{
return "TheMasterCado@MoreRealism";
}
public override string getVersionNumber()
{
return MoreRealismController.Version;
}
}
}