Browse Source

- Had to split the interface as the old plugins couldn't be casted

refactor 3.6.2
artman41 6 years ago
parent
commit
0628920fdf
3 changed files with 32 additions and 24 deletions
  1. +7
    -3
      IllusionInjector/CompositePlugin.cs
  2. +0
    -21
      IllusionPlugin/IPlugin.cs
  3. +25
    -0
      IllusionPlugin/IPluginNew.cs

+ 7
- 3
IllusionInjector/CompositePlugin.cs View File

@ -1,6 +1,7 @@
using IllusionPlugin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.SceneManagement;
@ -27,7 +28,8 @@ namespace IllusionInjector {
}
public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) {
foreach (var plugin in plugins) {
foreach (var plugin1 in plugins.Where(o => o is IPluginNew)) {
var plugin = (IPluginNew) plugin1;
try {
plugin.OnSceneLoaded(scene, sceneMode);
}
@ -38,7 +40,8 @@ namespace IllusionInjector {
}
public void OnSceneUnloaded(Scene scene) {
foreach (var plugin in plugins) {
foreach (var plugin1 in plugins.Where(o => o is IPluginNew)) {
var plugin = (IPluginNew) plugin1;
try {
plugin.OnSceneUnloaded(scene);
}
@ -49,7 +52,8 @@ namespace IllusionInjector {
}
public void OnActiveSceneChanged(Scene prevScene, Scene nextScene) {
foreach (var plugin in plugins) {
foreach (var plugin1 in plugins.Where(o => o is IPluginNew)) {
var plugin = (IPluginNew) plugin1;
try {
plugin.OnActiveSceneChanged(prevScene, nextScene);
}


+ 0
- 21
IllusionPlugin/IPlugin.cs View File

@ -32,32 +32,11 @@ namespace IllusionPlugin
/// </summary>
void OnApplicationQuit();
/// <summary>
/// Gets invoked whenever a scene is loaded.
/// </summary>
/// <param name="scene">The scene currently loaded</param>
/// <param name="sceneMode">The type of loading</param>
void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode);
/// <summary>
/// Gets invoked whenever a scene is unloaded
/// </summary>
/// <param name="scene">The unloaded scene</param>
void OnSceneUnloaded(Scene scene);
/// <summary>
/// Gets invoked whenever a scene is changed
/// </summary>
/// <param name="prevScene">The Scene that was previously loaded</param>
/// <param name="nextScene">The Scene being loaded</param>
void OnActiveSceneChanged(Scene prevScene, Scene nextScene);
/// <summary>
/// Gets invoked on every graphic update.
/// </summary>
void OnUpdate();
/// <summary>
/// Gets invoked on ever physics update.
/// </summary>


+ 25
- 0
IllusionPlugin/IPluginNew.cs View File

@ -0,0 +1,25 @@
using UnityEngine.SceneManagement;
namespace IllusionPlugin {
public interface IPluginNew : IPlugin{
/// <summary>
/// Gets invoked whenever a scene is loaded.
/// </summary>
/// <param name="scene">The scene currently loaded</param>
/// <param name="sceneMode">The type of loading</param>
void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode);
/// <summary>
/// Gets invoked whenever a scene is unloaded
/// </summary>
/// <param name="scene">The unloaded scene</param>
void OnSceneUnloaded(Scene scene);
/// <summary>
/// Gets invoked whenever a scene is changed
/// </summary>
/// <param name="prevScene">The Scene that was previously loaded</param>
/// <param name="nextScene">The Scene being loaded</param>
void OnActiveSceneChanged(Scene prevScene, Scene nextScene);
}
}

Loading…
Cancel
Save