当前位置: 首页>>代码示例>>C#>>正文


C# IGameMode.GetType方法代码示例

本文整理汇总了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;
		}
开发者ID:NexusMods,项目名称:NexusModManager-4.5,代码行数:51,代码来源:ScriptTypeRegistry.cs

示例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);
 }
开发者ID:EECS390IndieTeam,项目名称:GameProject,代码行数:9,代码来源:GameModeManager.cs


注:本文中的IGameMode.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。