Browse Source

Merge branch 'master' of https://github.com/artman41/IPA-Reloaded

pull/46/head
andruzzzhka 6 years ago
parent
commit
abc380be50
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 IllusionPlugin;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
@ -27,7 +28,8 @@ namespace IllusionInjector {
} }
public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) { 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 { try {
plugin.OnSceneLoaded(scene, sceneMode); plugin.OnSceneLoaded(scene, sceneMode);
} }
@ -38,7 +40,8 @@ namespace IllusionInjector {
} }
public void OnSceneUnloaded(Scene scene) { 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 { try {
plugin.OnSceneUnloaded(scene); plugin.OnSceneUnloaded(scene);
} }
@ -49,7 +52,8 @@ namespace IllusionInjector {
} }
public void OnActiveSceneChanged(Scene prevScene, Scene nextScene) { 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 { try {
plugin.OnActiveSceneChanged(prevScene, nextScene); plugin.OnActiveSceneChanged(prevScene, nextScene);
} }


+ 0
- 21
IllusionPlugin/IPlugin.cs View File

@ -32,32 +32,11 @@ namespace IllusionPlugin
/// </summary> /// </summary>
void OnApplicationQuit(); 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> /// <summary>
/// Gets invoked on every graphic update. /// Gets invoked on every graphic update.
/// </summary> /// </summary>
void OnUpdate(); void OnUpdate();
/// <summary> /// <summary>
/// Gets invoked on ever physics update. /// Gets invoked on ever physics update.
/// </summary> /// </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