This repository has been archived by the owner on Apr 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathCompositeModCaller.cs
79 lines (66 loc) · 2 KB
/
CompositeModCaller.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
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
namespace VRCModLoader
{
internal class CompositeModCaller
{
IEnumerable<VRCModController> modControllers;
private delegate void CompositeCall(VRCModController modController);
public CompositeModCaller(IEnumerable<VRCModController> modControllers)
{
this.modControllers = modControllers;
}
public void OnApplicationStart()
{
Invoke(modController => modController.OnApplicationStart());
}
public void OnApplicationQuit()
{
Invoke(modController => modController.OnApplicationQuit());
}
public void OnLevelWasLoaded(int level)
{
Invoke(modController => modController.OnLevelWasLoaded(level));
}
public void OnLevelWasInitialized(int level)
{
Invoke(modController => modController.OnLevelWasInitialized(level));
}
public void OnUpdate()
{
Invoke(modController => modController.OnUpdate());
}
public void OnFixedUpdate()
{
Invoke(modController => modController.OnFixedUpdate());
}
public void OnLateUpdate()
{
Invoke(modController => modController.OnLateUpdate());
}
public void OnGUI()
{
Invoke(modController => modController.OnGUI());
}
public void OnModSettingsApplied()
{
Invoke(modController => modController.OnModSettingsApplied());
}
private void Invoke(CompositeCall callback)
{
foreach (var modController in modControllers)
{
try
{
callback(modController);
}
catch (Exception ex)
{
VRCModLogger.LogError("{0}: {1}", modController.mod.Name, ex);
}
}
}
}
}