Browse Source

Moved some plugin interface stuff around

4.0.0-beta
Anairkoen Schno 4 years ago
parent
commit
162e79e3fa
7 changed files with 31 additions and 49 deletions
  1. +0
    -1
      IPA.Loader/IPA.Loader.csproj
  2. +13
    -9
      IPA.Loader/Loader/Composite/CompositeBSPlugin.cs
  3. +1
    -1
      IPA.Loader/PluginInterfaces/BeatSaber/IDisablablePlugin.cs
  4. +16
    -1
      IPA.Loader/PluginInterfaces/BeatSaber/IEnhancedPlugin.cs
  5. +0
    -12
      IPA.Loader/PluginInterfaces/BeatSaber/IPlugin.cs
  6. +0
    -24
      IPA.Loader/PluginInterfaces/IGenericEnhancedPlugin.cs
  7. +1
    -1
      IPA.Loader/PluginInterfaces/IPA/IEnhancedPlugin.cs

+ 0
- 1
IPA.Loader/IPA.Loader.csproj View File

@ -128,7 +128,6 @@
<Compile Include="PluginInterfaces\BeatSaber\IDisablablePlugin.cs" />
<Compile Include="PluginInterfaces\BeatSaber\IEnhancedPlugin.cs" />
<Compile Include="PluginInterfaces\BeatSaber\IPlugin.cs" />
<Compile Include="PluginInterfaces\IGenericEnhancedPlugin.cs" />
<Compile Include="Config\IniFile.cs" />
<Compile Include="PluginInterfaces\IPA\IEnhancedPlugin.cs" />
<Compile Include="PluginInterfaces\IPA\IPlugin.cs" />


+ 13
- 9
IPA.Loader/Loader/Composite/CompositeBSPlugin.cs View File

@ -43,21 +43,25 @@ namespace IPA.Loader.Composite
}
}
public void OnUpdate() {
Invoke(plugin => plugin.Plugin.OnUpdate());
public void OnUpdate()
{
Invoke(plugin => {
if (plugin.Plugin is IEnhancedPlugin saberPlugin)
saberPlugin.OnUpdate();
});
}
public void OnFixedUpdate() {
Invoke(plugin => plugin.Plugin.OnFixedUpdate());
public void OnFixedUpdate()
{
Invoke(plugin => {
if (plugin.Plugin is IEnhancedPlugin saberPlugin)
saberPlugin.OnFixedUpdate();
});
}
public string Name => throw new InvalidOperationException();
public string Version => throw new InvalidOperationException();
public void OnLateUpdate() {
Invoke(plugin => {
if (plugin.Plugin is IGenericEnhancedPlugin saberPlugin)
if (plugin.Plugin is IEnhancedPlugin saberPlugin)
saberPlugin.OnLateUpdate();
});
}


+ 1
- 1
IPA.Loader/PluginInterfaces/BeatSaber/IDisablablePlugin.cs View File

@ -3,7 +3,7 @@
/// <summary>
/// Provides methods to allow runtime disabling of a plugin.
/// </summary>
public interface IDisablablePlugin
public interface IDisablablePlugin : IPlugin
{
/// <summary>


+ 16
- 1
IPA.Loader/PluginInterfaces/BeatSaber/IEnhancedPlugin.cs View File

@ -10,7 +10,22 @@ namespace IPA
/// <summary>
/// An enhanced version of a standard BeatSaber plugin.
/// </summary>
public interface IEnhancedPlugin : IPlugin, IGenericEnhancedPlugin
public interface IEnhancedPlugin : IPlugin
{
/// <summary>
/// Gets invoked on every graphic update.
/// </summary>
void OnUpdate();
/// <summary>
/// Gets invoked on ever physics update.
/// </summary>
void OnFixedUpdate();
/// <summary>
/// Called after Update.
/// </summary>
void OnLateUpdate();
}
}

+ 0
- 12
IPA.Loader/PluginInterfaces/BeatSaber/IPlugin.cs View File

@ -28,18 +28,6 @@ namespace IPA
/// </summary>
void OnApplicationQuit();
// TODO: move more of these out of IPlugin
/// <summary>
/// Gets invoked on every graphic update.
/// </summary>
void OnUpdate();
/// <summary>
/// Gets invoked on ever physics update.
/// </summary>
void OnFixedUpdate();
/// <summary>
/// Gets invoked whenever a scene is loaded.
/// </summary>


+ 0
- 24
IPA.Loader/PluginInterfaces/IGenericEnhancedPlugin.cs View File

@ -1,24 +0,0 @@
// ReSharper disable CheckNamespace
using System;
namespace IPA
{
/// <summary>
/// A generic interface for the modification for enhanced plugins.
/// </summary>
public interface IGenericEnhancedPlugin
{
/// <summary>
/// Gets a list of executables this plugin should be executed on (without the file ending)
/// </summary>
/// <example>{ "PlayClub", "PlayClubStudio" }</example>
[Obsolete("Ignored.")]
string[] Filter { get; }
/// <summary>
/// Called after Update.
/// </summary>
void OnLateUpdate();
}
}

+ 1
- 1
IPA.Loader/PluginInterfaces/IPA/IEnhancedPlugin.cs View File

@ -7,7 +7,7 @@ namespace IPA.Old
/// <summary>
/// An enhanced version of the standard IPA plugin.
/// </summary>
[Obsolete("When building plugins for Beat Saber, use IEnhancedBeatSaberPlugin")]
[Obsolete("When building plugins for Beat Saber, use IPA.IEnhancedPlugin")]
public interface IEnhancedPlugin : IPlugin
{
/// <summary>


Loading…
Cancel
Save