swiftlys2/docs/api/ai/
API Reference Shared

IInterfaceManager

Interface
Namespace: SwiftlyS2.Shared · Assembly: SwiftlyS2.CS2.dll
public interface IInterfaceManager
View source

Methods

AddSharedInterface<TInterface, TImpl>(string, TImpl)

Add a keyed shared interface for other plugin to use. The interface must be defined in the contracts dll.

void AddSharedInterface<TInterface, TImpl>(string key, TImpl implInstance) where TInterface : class where TImpl : class, TInterface
Parameters
  • keystringThe key of the interface.
  • implInstanceTImplThe implementation of the interface.

GetSharedInterface<TInterface>(string)

Get a shared interface.

TInterface GetSharedInterface<TInterface>(string key) where TInterface : class
Parameters
  • keystringThe key of the interface.
Returns
TInterface
The implementation of the interface.

HasSharedInterface(string)

Check if a shared interface exists.

bool HasSharedInterface(string key)
Parameters
  • keystringThe key of the interface.
Returns
True if the interface exists, false otherwise.

TryGetSharedInterface<TInterface>(string, out TInterface?)

Attempts to get a shared interface implementation by key.

bool TryGetSharedInterface<TInterface>(string key, out TInterface? instance) where TInterface : class
Parameters
  • keystringThe key of the interface implementation.
  • instanceTInterface?The implementation of the interface, or null if the implementation wasn't found.
Returns
true if the implementation was found, otherwise false