internal static void InitMenu() { ModMenu = new UIMenu("Map Editor", "~b~" + Translation.Translate("EXTERNAL MODS")); ModMenu.DisableInstructionalButtons(true); ModMenu.OnItemSelect += (menu, item, index) => { var tmpMod = Mods[index]; if (CurrentMod == tmpMod) { UI.Notify("~b~~h~Map Editor~h~~n~~w~Mod ~h~" + tmpMod.Name + "~h~ " + Translation.Translate("has been disconnected.")); CurrentMod.ModDisconnectInvoker(); CurrentMod = null; } else { UI.Notify("~b~~h~Map Editor~h~~n~~w~Mod ~h~" + tmpMod.Name + "~h~ " + Translation.Translate("has been connected.")); tmpMod.ModSelectInvoker(); CurrentMod = tmpMod; } }; }
public static void SuscribeMod(ModListener mod) { Mods.Add(mod); ModMenu.AddItem(new UIMenuItem(mod.ButtonString, mod.Description)); }
/// <summary> /// This method is encapsulated, so if MapEditor.dll is missing, the script won't crash! /// </summary> private void AttachMapEditor() { var thisMod = new ModListener() { ButtonString = "Create a Community Race", Description = "Create a race for the Community Races mod.", Name = "Community Races", }; ModManager.SuscribeMod(thisMod); thisMod.OnMapSaved += SaveMap; }