๐Mod Dependency
Hard Dependency
Soft Dependency
using System.IO;
// Uses macro to wrap all soft dependencies' code. "ไธ็ฑณ_ไธญๆๅ" is the ID of the soft dependency. Chinese_Name is a namespace provided by the mod. As shown below.
#if ไธ็ฑณ_ไธญๆๅ
using Chinese_Name;
#endif
namespace ExampleMod.Content;
internal static class ExampleNameGenerators
{
public static void init()
{
// If Chinese Name mod is compiled successfully, initialize Chinese name generators. Otherwise, initialize vanilla name generators
#if ไธ็ฑณ_ไธญๆๅ
init_chinese_name_generators();
#else
init_vanilla_name_generators();
#endif
}
private static void init_chinese_name_generators()
{
string mod_folder = ExampleModMain.Instance.GetDeclaration().FolderPath;
// Because the classes and methods are provided by ChineseName, you should wrap them with macro
#if ไธ็ฑณ_ไธญๆๅ
WordLibraryManager.SubmitDirectoryToLoad(Path.Combine(mod_folder,
"additional_resources/word_libraries"));
CN_NameGeneratorLibrary.SubmitDirectoryToLoad(Path.Combine(mod_folder,
"additional_resources/name_generators"));
#endif
}
private static void init_vanilla_name_generators()
{
// No content yet
}
}How to reference to dependent mods
DLL reference
Project reference
Last updated