enhance script plugin features

(support service resolver with generic args)
(support requiresTarget for command)
This commit is contained in:
RaidMax
2020-09-28 20:32:53 -05:00
parent 9117440566
commit 910faf427b
10 changed files with 147 additions and 10 deletions

View File

@ -15,9 +15,10 @@ namespace SharedLibraryCore.Interfaces
/// <param name="alias">alias of command</param>
/// <param name="description">description of command</param>
/// <param name="permission">minimum required permission</param>
/// <param name="isTargetRequired">target required or not</param>
/// <param name="args">command arguments (name, is required)</param>
/// <param name="executeAction">action to peform when commmand is executed</param>
/// <returns></returns>
IManagerCommand CreateScriptCommand(string name, string alias, string description, string permission, IEnumerable<(string, bool)> args, Action<GameEvent> executeAction);
IManagerCommand CreateScriptCommand(string name, string alias, string description, string permission, bool isTargetRequired, IEnumerable<(string, bool)> args, Action<GameEvent> executeAction);
}
}

View File

@ -1,10 +1,25 @@
namespace SharedLibraryCore.Interfaces
using System.Collections.Generic;
namespace SharedLibraryCore.Interfaces
{
/// <summary>
/// interface used to dynamically resolve services by string name
/// </summary>
public interface IScriptPluginServiceResolver
{
/// <summary>
/// resolves a service with the given name
/// </summary>
/// <param name="serviceName">class name of service</param>
/// <returns></returns>
object ResolveService(string serviceName);
/// <summary>
/// resolves a service with the given name and generic params
/// </summary>
/// <param name="serviceName">class name of service</param>
/// <param name="genericParams">generic class names</param>
/// <returns></returns>
object ResolveService(string serviceName, string[] genericParameters);
}
}