本文整理汇总了C#中IGameMode.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IGameMode.GetType方法的具体用法?C# IGameMode.GetType怎么用?C# IGameMode.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGameMode
的用法示例。
在下文中一共展示了IGameMode.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DiscoverScriptTypes
/// <summary>
/// Searches for script type assemblies in the specified path, and loads
/// any script types that are found into a registry.
/// </summary>
/// <remarks>
/// A script type is loaded if the class implements <see cref="IScriptType"/> and is
/// not abstract. Once loaded, the type is added to the registry.
/// </remarks>
/// <param name="p_strSearchPath">The path in which to search for script type assemblies.</param>
/// <param name="p_gmdGameMode">The current game mode.</param>
/// <returns>A registry containing all of the discovered script types.</returns>
public static IScriptTypeRegistry DiscoverScriptTypes(string p_strSearchPath, IGameMode p_gmdGameMode)
{
Trace.TraceInformation("Discovering Script Types...");
Trace.Indent();
Trace.TraceInformation("Discovering Generic Script Types...");
Trace.Indent();
Trace.TraceInformation("Looking in: {0}", p_strSearchPath);
IScriptTypeRegistry stgRegistry = new ScriptTypeRegistry();
if (!Directory.Exists(p_strSearchPath))
{
Trace.TraceError("Script Type search path does not exist.");
Trace.Unindent();
Trace.Unindent();
return stgRegistry;
}
string[] strAssemblies = Directory.GetFiles(p_strSearchPath, "*.dll");
RegisterScriptTypes(stgRegistry, strAssemblies);
Trace.Unindent();
Trace.TraceInformation("Discovering Game Mode Specific Script Types...");
Trace.Indent();
string strGameModeSearchPath = Path.GetDirectoryName(Assembly.GetAssembly(p_gmdGameMode.GetType()).Location);
Trace.TraceInformation("Looking in: {0}", strGameModeSearchPath);
if (!Directory.Exists(strGameModeSearchPath))
{
Trace.TraceError("Game Mode Specific Script Type search path does not exist.");
Trace.Unindent();
Trace.Unindent();
return stgRegistry;
}
List<string> lstAssemblies = new List<string>();
foreach (IScriptType stpType in stgRegistry.Types)
lstAssemblies.AddRange(Directory.GetFiles(strGameModeSearchPath, String.Format("{0}.{1}.dll", p_gmdGameMode.ModeId, stpType.TypeId)));
RegisterScriptTypes(stgRegistry, lstAssemblies);
Trace.Unindent();
Trace.Unindent();
return stgRegistry;
}
示例2: GetSupportedMapsForGameMode
/// <summary>
/// returns a list of the class names of all maps that support the given game mode
/// </summary>
/// <param name="gameMode"></param>
/// <returns></returns>
public static IEnumerable<string> GetSupportedMapsForGameMode(IGameMode gameMode)
{
return GetSupportedMapsForGameMode(gameMode.GetType().Name);
}