ProjectPlugin.cs
1 using Utils; 2 3 namespace Core 4 { 5 public interface IProjectPlugin 6 { 7 void Awake(IPluginAccess access); 8 void Announce(); 9 void Decommission(); 10 } 11 12 public interface IHasLogPrefix 13 { 14 string LogPrefix { get; } 15 } 16 17 public interface IHasMetadata 18 { 19 void AddMetadata(IAddMetadata metadata); 20 } 21 22 public interface IPluginAccess 23 { 24 T GetPlugin<T>() where T : IProjectPlugin; 25 } 26 27 public static class ProjectPlugin 28 { 29 /// <summary> 30 /// On some platforms and in some cases, not all required plugin assemblies are automatically loaded into the app domain. 31 /// In this case, the runtime needs a slight push to load it before the EntryPoint class is instantiated. 32 /// Used ProjectPlugin.Load<>() before you create an EntryPoint to ensure all plugins you want to use are loaded. 33 /// </summary> 34 public static void Load<T>() where T : IProjectPlugin 35 { 36 var type = typeof(T); 37 FrameworkAssert.That(type != null, $"Unable to load plugin."); 38 } 39 } 40 }