Browse Source

- Removed support for deprecated methods

refactor
artman41 6 years ago
parent
commit
2ea8350c98
8 changed files with 29 additions and 92 deletions
  1. +5
    -3
      IPA.sln
  2. +3
    -38
      IllusionInjector/CompositePlugin.cs
  3. +0
    -17
      IllusionInjector/PluginComponent.cs
  4. +0
    -3
      IllusionInjector/PluginManager.cs
  5. +19
    -4
      IllusionPlugin/IPlugin.cs
  6. +0
    -25
      IllusionPlugin/IPluginNew.cs
  7. +1
    -2
      IllusionPlugin/IllusionPlugin.csproj
  8. +1
    -0
      IllusionPlugin/Logger.cs

+ 5
- 3
IPA.sln View File

@ -1,11 +1,10 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Blend for Visual Studio 15
VisualStudioVersion = 15.0.27428.2043
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA", "IPA\IPA.csproj", "{14092533-98BB-40A4-9AFC-27BB75672A70}"
ProjectSection(ProjectDependencies) = postProject
{D1390268-F68B-4A55-B50D-EAD25756C8EF} = {D1390268-F68B-4A55-B50D-EAD25756C8EF}
{D1C61AF5-0D2D-4752-8203-1C6929025F7C} = {D1C61AF5-0D2D-4752-8203-1C6929025F7C}
{E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71} = {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}
EndProjectSection
@ -42,4 +41,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C7380FAB-02D6-4A2A-B428-B4BFCFE3A054}
EndGlobalSection
EndGlobal

+ 3
- 38
IllusionInjector/CompositePlugin.cs View File

@ -28,8 +28,7 @@ namespace IllusionInjector {
}
public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) {
foreach (var plugin1 in plugins.Where(o => o is IPluginNew)) {
var plugin = (IPluginNew) plugin1;
foreach (var plugin in plugins) {
try {
plugin.OnSceneLoaded(scene, sceneMode);
}
@ -40,8 +39,7 @@ namespace IllusionInjector {
}
public void OnSceneUnloaded(Scene scene) {
foreach (var plugin1 in plugins.Where(o => o is IPluginNew)) {
var plugin = (IPluginNew) plugin1;
foreach (var plugin in plugins) {
try {
plugin.OnSceneUnloaded(scene);
}
@ -52,8 +50,7 @@ namespace IllusionInjector {
}
public void OnActiveSceneChanged(Scene prevScene, Scene nextScene) {
foreach (var plugin1 in plugins.Where(o => o is IPluginNew)) {
var plugin = (IPluginNew) plugin1;
foreach (var plugin in plugins) {
try {
plugin.OnActiveSceneChanged(prevScene, nextScene);
}
@ -84,38 +81,6 @@ namespace IllusionInjector {
Invoke(plugin => plugin.OnFixedUpdate());
}
[Obsolete("Use OnSceneLoaded instead")]
public void OnLevelWasLoaded(int level)
{
foreach (var plugin in plugins)
{
try
{
plugin.OnLevelWasLoaded(level);
}
catch (Exception ex)
{
Console.WriteLine("{0}: {1}", plugin.Name, ex);
}
}
}
[Obsolete("Use OnSceneLoaded instead")]
public void OnLevelWasInitialized(int level)
{
foreach (var plugin in plugins)
{
try
{
plugin.OnLevelWasInitialized(level);
}
catch (Exception ex)
{
Console.WriteLine("{0}: {1}", plugin.Name, ex);
}
}
}
public string Name {
get { throw new NotImplementedException(); }


+ 0
- 17
IllusionInjector/PluginComponent.cs View File

@ -9,7 +9,6 @@ namespace IllusionInjector
public class PluginComponent : MonoBehaviour
{
private CompositePlugin plugins;
private bool freshlyLoaded = false;
private bool quitting = false;
public static PluginComponent Create()
@ -28,19 +27,9 @@ namespace IllusionInjector
SceneManager.sceneLoaded += OnSceneLoaded;
SceneManager.sceneUnloaded += OnSceneUnloaded;
}
void Start()
{
OnLevelWasLoaded(Application.loadedLevel);
}
void Update()
{
if (freshlyLoaded)
{
freshlyLoaded = false;
plugins.OnLevelWasInitialized(Application.loadedLevel);
}
plugins.OnUpdate();
}
@ -72,12 +61,6 @@ namespace IllusionInjector
quitting = true;
}
void OnLevelWasLoaded(int level)
{
plugins.OnLevelWasLoaded(level);
freshlyLoaded = true;
}
void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode)
{


+ 0
- 3
IllusionInjector/PluginManager.cs View File

@ -82,9 +82,6 @@ namespace IllusionInjector
foreach (var plugin in _Plugins)
{
debugLogger.Log($"{plugin.Name}: {plugin.Version}");
if (!(plugin is IPluginNew)) {
debugLogger.Warning($"{plugin.Name} uses a Deprecated Interface! This may cause errors!");
}
}
debugLogger.Log("-----------------------------");
}


+ 19
- 4
IllusionPlugin/IPlugin.cs View File

@ -42,9 +42,24 @@ namespace IllusionPlugin
/// </summary>
void OnFixedUpdate();
[Obsolete("Use OnSceneLoaded instead")]
void OnLevelWasLoaded(int level);
[Obsolete("Use OnSceneLoaded instead")]
void OnLevelWasInitialized(int level);
/// <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);
}
}

+ 0
- 25
IllusionPlugin/IPluginNew.cs View File

@ -1,25 +0,0 @@
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);
}
}

+ 1
- 2
IllusionPlugin/IllusionPlugin.csproj View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
@ -44,7 +44,6 @@
<Compile Include="IEnhancedPlugin.cs" />
<Compile Include="IniFile.cs" />
<Compile Include="IPlugin.cs" />
<Compile Include="IPluginNew.cs" />
<Compile Include="Logger.cs" />
<Compile Include="ModPrefs.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />


+ 1
- 0
IllusionPlugin/Logger.cs View File

@ -79,6 +79,7 @@ namespace IllusionPlugin {
f.WriteLine(d.Message);
Console.ForegroundColor = GetConsoleColour(d.WarningLevel);
Console.WriteLine(d.Message);
Console.ResetColor();
}
}


Loading…
Cancel
Save