|
@ -7,32 +7,32 @@ namespace IPA.Loader.Composite |
|
|
{ |
|
|
{ |
|
|
internal class CompositeBSPlugin : IBeatSaberPlugin |
|
|
internal class CompositeBSPlugin : IBeatSaberPlugin |
|
|
{ |
|
|
{ |
|
|
private readonly IEnumerable<IBeatSaberPlugin> plugins; |
|
|
|
|
|
|
|
|
private readonly IEnumerable<PluginLoader.PluginInfo> plugins; |
|
|
|
|
|
|
|
|
private delegate void CompositeCall(IBeatSaberPlugin plugin); |
|
|
|
|
|
|
|
|
private delegate void CompositeCall(PluginLoader.PluginInfo plugin); |
|
|
|
|
|
|
|
|
public CompositeBSPlugin(IEnumerable<IBeatSaberPlugin> plugins) { |
|
|
|
|
|
|
|
|
public CompositeBSPlugin(IEnumerable<PluginLoader.PluginInfo> plugins) { |
|
|
this.plugins = plugins; |
|
|
this.plugins = plugins; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void OnApplicationStart() { |
|
|
public void OnApplicationStart() { |
|
|
Invoke(plugin => plugin.OnApplicationStart()); |
|
|
|
|
|
|
|
|
Invoke(plugin => plugin.Plugin.OnApplicationStart()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void OnApplicationQuit() { |
|
|
public void OnApplicationQuit() { |
|
|
Invoke(plugin => plugin.OnApplicationQuit()); |
|
|
|
|
|
|
|
|
Invoke(plugin => plugin.Plugin.OnApplicationQuit()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) { |
|
|
public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) { |
|
|
Invoke(plugin => plugin.OnSceneLoaded(scene, sceneMode)); |
|
|
|
|
|
|
|
|
Invoke(plugin => plugin.Plugin.OnSceneLoaded(scene, sceneMode)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void OnSceneUnloaded(Scene scene) { |
|
|
public void OnSceneUnloaded(Scene scene) { |
|
|
Invoke(plugin => plugin.OnSceneUnloaded(scene)); |
|
|
|
|
|
|
|
|
Invoke(plugin => plugin.Plugin.OnSceneUnloaded(scene)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void OnActiveSceneChanged(Scene prevScene, Scene nextScene) { |
|
|
public void OnActiveSceneChanged(Scene prevScene, Scene nextScene) { |
|
|
Invoke(plugin => plugin.OnActiveSceneChanged(prevScene, nextScene)); |
|
|
|
|
|
|
|
|
Invoke(plugin => plugin.Plugin.OnActiveSceneChanged(prevScene, nextScene)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void Invoke(CompositeCall callback) { |
|
|
private void Invoke(CompositeCall callback) { |
|
@ -41,17 +41,17 @@ namespace IPA.Loader.Composite |
|
|
callback(plugin); |
|
|
callback(plugin); |
|
|
} |
|
|
} |
|
|
catch (Exception ex) { |
|
|
catch (Exception ex) { |
|
|
Logger.log.Error($"{plugin.Name}: {ex}"); |
|
|
|
|
|
|
|
|
Logger.log.Error($"{plugin.Metadata.Name}: {ex}"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void OnUpdate() { |
|
|
public void OnUpdate() { |
|
|
Invoke(plugin => plugin.OnUpdate()); |
|
|
|
|
|
|
|
|
Invoke(plugin => plugin.Plugin.OnUpdate()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void OnFixedUpdate() { |
|
|
public void OnFixedUpdate() { |
|
|
Invoke(plugin => plugin.OnFixedUpdate()); |
|
|
|
|
|
|
|
|
Invoke(plugin => plugin.Plugin.OnFixedUpdate()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public string Name => throw new InvalidOperationException(); |
|
|
public string Name => throw new InvalidOperationException(); |
|
@ -62,7 +62,7 @@ namespace IPA.Loader.Composite |
|
|
|
|
|
|
|
|
public void OnLateUpdate() { |
|
|
public void OnLateUpdate() { |
|
|
Invoke(plugin => { |
|
|
Invoke(plugin => { |
|
|
if (plugin is IEnhancedBeatSaberPlugin saberPlugin) |
|
|
|
|
|
|
|
|
if (plugin.Plugin is IEnhancedBeatSaberPlugin saberPlugin) |
|
|
saberPlugin.OnLateUpdate(); |
|
|
saberPlugin.OnLateUpdate(); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|