Game Development Reference
In-Depth Information
if (!exists)
{
IPlugin plugin = Activator.CreateInstance(type) as IPlugin;
ExecuteInitializeMethod(plugin);
pluginInstances.Add(plugin);
}
exists = false;
}
}
The following method loops through all the instantiated plugins and calls the
Release() method.
public void Release()
{
foreach (IPlugin plugin in pluginInstances)
{
ExecuteReleaseMethod(plugin);
}
}
The following method is a wrapper around executing a method of the plugin with
no return value. Remember that we cannot access objects directly from outside of
the proxy.
public void ExecuteMethodNoReturn(string interfaceName,
string method,
object[] parameters)
{
foreach (IPlugin plugin in pluginInstances)
{
foreach (Type interfaceType in plugin.GetType().GetInterfaces())
{
if (interfaceType.Name.Equals(interfaceName))
{
ExecuteMethodNoReturn(plugin,
method,
parameters);
}
}
}
}
Search Nedrilad ::




Custom Search