Show only missing required "mod (version)"s

This commit is contained in:
atlimit8
2015-11-01 17:14:46 -06:00
parent aa594c8532
commit 74c63812eb
2 changed files with 9 additions and 3 deletions

View File

@@ -9,6 +9,7 @@
#endregion #endregion
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
@@ -255,9 +256,14 @@ namespace OpenRA
public static bool IsModInstalled(string modId) public static bool IsModInstalled(string modId)
{ {
return Manifest.AllMods[modId].RequiresMods.All(mod => ModMetadata.AllMods.ContainsKey(mod.Key) return Manifest.AllMods[modId].RequiresMods.All(IsModInstalled);
}
public static bool IsModInstalled(KeyValuePair<string, string> mod)
{
return ModMetadata.AllMods.ContainsKey(mod.Key)
&& ModMetadata.AllMods[mod.Key].Version == mod.Value && ModMetadata.AllMods[mod.Key].Version == mod.Value
&& IsModInstalled(mod.Key)); && IsModInstalled(mod.Key);
} }
public static void InitializeMod(string mod, Arguments args) public static void InitializeMod(string mod, Arguments args)

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{ {
var panel = widget.Get("INSTALL_MOD_PANEL"); var panel = widget.Get("INSTALL_MOD_PANEL");
var mods = Manifest.AllMods[modId].RequiresMods.Select(x => "{0} ({1})".F(x.Key, x.Value)); var mods = Manifest.AllMods[modId].RequiresMods.Where(m => !Game.IsModInstalled(m)).Select(m => "{0} ({1})".F(m.Key, m.Value));
var text = string.Join(", ", mods); var text = string.Join(", ", mods);
panel.Get<LabelWidget>("MOD_LIST").Text = text; panel.Get<LabelWidget>("MOD_LIST").Text = text;