For anyone interested, I replaced the mod orderer that was based on the C# Comparer interface with a simple mod orderer that doesn't get confused...
So in TaleWorlds.MountAndBlade.Launcher.LauncherModsVM I placed this method: (part after the while bracket is vanilla code).
- private void LoadSubModules(bool isMultiplayer)
- {
- Queue queue = new Queue(ModuleInfo.GetModules().Where((ModuleInfo x) => this.IsVisible(isMultiplayer, x)).OrderBy((ModuleInfo x) => x.DependedModuleIds.Count()));
- HashSet added = new HashSet();
- List list = new List();
- int failedCount = 0;
- while (failedCount < queue.Count)
- {
- ModuleInfo next = queue.Dequeue();
- var failed = false;
- foreach (string dep in next.DependedModuleIds)
- {
- if (!added.Contains(dep))
- {
- queue.Enqueue(next);
- failedCount++;
- failed = true;
- break;
- }
- }
- if(failed)
- continue;
- failedCount = 0;
- list.Add(next);
- added.Add(next.Id);
- }
- for (int i = 0; i < list.Count; i++)
- {
- ModuleInfo moduleInfo = list[i];
- LauncherModuleVM launcherModuleVM = new LauncherModuleVM(moduleInfo, new Action(this.ChangeLoadingOrderOf), new Action(this.ChangeIsSelectedOf));
- this.Modules.Add(launcherModuleVM);
- UserModData userModData = this._userData.GetUserModData(isMultiplayer, moduleInfo.Id);
- if (userModData != null)
- {
- launcherModuleVM.IsSelected = userModData.IsSelected;
- }
- }
- }
复制代码 |