本文整理汇总了C#中IMod.Initialize_PreGeneration方法的典型用法代码示例。如果您正苦于以下问题:C# IMod.Initialize_PreGeneration方法的具体用法?C# IMod.Initialize_PreGeneration怎么用?C# IMod.Initialize_PreGeneration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMod
的用法示例。
在下文中一共展示了IMod.Initialize_PreGeneration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessMod
private void ProcessMod(IMod mod)
{
if (processedMods.Contains(mod))
{
return;
}
if (currentlyProcessing.Contains(mod))
{
throw new InvalidOperationException("Can't process mod [" + mod.Name + "], already processing it. Circular dependency?");
}
currentlyProcessing.Add(mod);
mod.Initialize_PreGeneration();
if (mod.InitBefore.Count() > 0)
{
throw new NotImplementedException("Mod.InitAfter and Mod.InitBefore are not yet supported. Sorry.");
}
foreach (var dependency in mod.Dependencies)
{
ProcessMod(all_mods_to_process.Union(all_possible_dependencies).Single(depModInstance => depModInstance.GetType() == dependency.Type));
}
foreach (var change in mod.Modifications)
{
if (game_injector.AssemblyContainsType(change.TargetType))
{
game_injector.Inject_Modification(change);
}
else if (lib_injector.AssemblyContainsType(change.TargetType))
{
lib_injector.Inject_Modification(change);
}
else
{
throw new InvalidOperationException("Cannot change behavoir of type [" + change.TargetType + "]!");
}
}
processedMods.Add(mod);
currentlyProcessing.Remove(mod);
}