private void CheckDependencies() { bool hasSortIssues = false; List <string> errorMessages = null; var modErrorMessages = new List <string>(); foreach (Mod mod in ModManager.Instance.Mods.Where(x => x.Enabled)) { bool?isGameVersionSatisfied = mod.IsGameVersionSatisfied(); if (!isGameVersionSatisfied.HasValue) { Debug.LogErrorFormat("Mod {0} requires unknown game version ({1}).", mod.Title, mod.ModInfo.DFUnity_Version); } else if (!isGameVersionSatisfied.Value) { modErrorMessages.Add(string.Format(ModManager.GetText("gameVersionUnsatisfied"), mod.ModInfo.DFUnity_Version)); } ModManager.Instance.CheckModDependencies(mod, modErrorMessages, ref hasSortIssues); if (modErrorMessages.Count > 0) { if (errorMessages == null) { errorMessages = new List <string>(); errorMessages.Add(ModManager.GetText("dependencyErrorMessage")); errorMessages.Add(string.Empty); } errorMessages.Add(string.Format("- {0}", mod.Title)); errorMessages.AddRange(modErrorMessages); errorMessages.Add(string.Empty); modErrorMessages.Clear(); } } if (errorMessages != null && errorMessages.Count > 0) { if (hasSortIssues) { errorMessages.Add(ModManager.GetText("sortModsQuestion")); } var messageBox = new DaggerfallMessageBox(uiManager, this); messageBox.EnableVerticalScrolling(80); messageBox.SetText(errorMessages.ToArray()); if (hasSortIssues) { messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes); messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No, true); messageBox.OnButtonClick += (sender, button) => { if (button == DaggerfallMessageBox.MessageBoxButtons.Yes) { ModManager.Instance.AutoSortMods(); Debug.Log("Mods have been sorted automatically"); } sender.CancelWindow(); moveNextStage = true; }; } else { messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.OK, true); messageBox.OnButtonClick += (sender, button) => { sender.CancelWindow(); moveNextStage = true; }; } messageBox.Show(); } else { moveNextStage = true; } }