Remove runtime mod merging. Closes #3421.
This commit is contained in:
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA
|
||||
Sprite stripe, logo;
|
||||
string[] messages;
|
||||
|
||||
public void Init(Dictionary<string, string> info)
|
||||
public void Init(Manifest m, Dictionary<string, string> info)
|
||||
{
|
||||
this.info = info;
|
||||
|
||||
|
||||
@@ -9,13 +9,14 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
public class NullLoadScreen : ILoadScreen
|
||||
{
|
||||
public void Init(Dictionary<string, string> info) {}
|
||||
public void Init(Manifest m, Dictionary<string, string> info) {}
|
||||
|
||||
public void Display()
|
||||
{
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace OpenRA.Mods.RA.Server
|
||||
lastPing = Environment.TickCount;
|
||||
isBusy = true;
|
||||
|
||||
var mod = server.ModData.Manifest.Mod;
|
||||
Action a = () =>
|
||||
{
|
||||
try
|
||||
@@ -60,14 +61,13 @@ namespace OpenRA.Mods.RA.Server
|
||||
using (var wc = new WebClient())
|
||||
{
|
||||
wc.Proxy = null;
|
||||
|
||||
wc.DownloadData(
|
||||
wc.DownloadData(
|
||||
server.Settings.MasterServer + url.F(
|
||||
server.Settings.ExternalPort, Uri.EscapeUriString(server.Settings.Name),
|
||||
(int)server.State,
|
||||
server.LobbyInfo.Clients.Where(c1 => c1.Bot == null).Count(),
|
||||
server.LobbyInfo.Clients.Where(c1 => c1.Bot != null).Count(),
|
||||
Game.CurrentMods.Select(f => "{0}@{1}".F(f.Key, f.Value.Version)).JoinWith(","),
|
||||
"{0}@{1}".F(mod.Id, mod.Version),
|
||||
server.LobbyInfo.GlobalSettings.Map,
|
||||
server.Map.PlayerCount));
|
||||
|
||||
|
||||
@@ -99,14 +99,16 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
template = panel.Get<ScrollItemWidget>("ASSET_TEMPLATE");
|
||||
PopulateAssetList();
|
||||
|
||||
var palette = (WidgetUtils.ActiveModId() == "d2k") ? "d2k.pal" : "egopal.pal";
|
||||
// TODO: Horrible hack
|
||||
var modID = Game.modData.Manifest.Mod.Id;
|
||||
var palette = (modID == "d2k") ? "d2k.pal" : "egopal.pal";
|
||||
|
||||
panel.Get<ButtonWidget>("EXPORT_BUTTON").OnClick = () =>
|
||||
{
|
||||
var ExtractGameFiles = new string[][]
|
||||
{
|
||||
new string[] {"--extract", WidgetUtils.ActiveModId(), palette, "--userdir"},
|
||||
new string[] {"--extract", WidgetUtils.ActiveModId(), "{0}.shp".F(spriteImage.Image), "--userdir"},
|
||||
new string[] {"--extract", modID, palette, "--userdir"},
|
||||
new string[] {"--extract", modID, "{0}.shp".F(spriteImage.Image), "--userdir"},
|
||||
};
|
||||
|
||||
var ExportToPng = new string[][]
|
||||
@@ -131,11 +133,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
var ExtractGameFilesList = new List<string[]>();
|
||||
var ExportToPngList = new List<string[]>();
|
||||
|
||||
ExtractGameFilesList.Add(new string[] { "--extract", WidgetUtils.ActiveModId(), palette, "--userdir"} );
|
||||
ExtractGameFilesList.Add(new string[] { "--extract", modID, palette, "--userdir"} );
|
||||
|
||||
foreach (var shp in AvailableShps)
|
||||
{
|
||||
ExtractGameFilesList.Add(new string[] { "--extract", WidgetUtils.ActiveModId(), shp, "--userdir" } );
|
||||
ExtractGameFilesList.Add(new string[] { "--extract", modID, shp, "--userdir" } );
|
||||
ExportToPngList.Add(new string[] { "--png", Platform.SupportDir+shp, Platform.SupportDir+palette } );
|
||||
Console.WriteLine(Platform.SupportDir+shp);
|
||||
}
|
||||
@@ -148,7 +150,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
{ "ExtractGameFiles", ExtractGameFiles },
|
||||
{ "ExportToPng", ExportToPng },
|
||||
{ "ImportFromPng", ImportFromPng}
|
||||
{ "ImportFromPng", ImportFromPng }
|
||||
};
|
||||
|
||||
Ui.OpenWindow("CONVERT_ASSETS_PANEL", args);
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
|
||||
// Save the package to a temp file
|
||||
var file = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
||||
var dest = new string[] { Platform.SupportDir, "Content", Game.modData.Manifest.Mods[0] }.Aggregate(Path.Combine);
|
||||
var dest = new string[] { Platform.SupportDir, "Content", Game.modData.Manifest.Mod.Id }.Aggregate(Path.Combine);
|
||||
|
||||
Action<DownloadProgressChangedEventArgs> onDownloadProgress = i =>
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
|
||||
var versionLabel = Ui.Root.GetOrNull<LabelWidget>("VERSION_LABEL");
|
||||
if (versionLabel != null)
|
||||
versionLabel.GetText = WidgetUtils.ActiveModVersion;
|
||||
versionLabel.Text = Game.modData.Manifest.Mod.Version;
|
||||
|
||||
widget.Get<ButtonWidget>("MAINMENU_BUTTON_JOIN").OnClick = () => OpenGamePanel("JOINSERVER_BG");
|
||||
widget.Get<ButtonWidget>("MAINMENU_BUTTON_CREATE").OnClick = () => OpenGamePanel("CREATESERVER_BG");
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
var modList = panel.Get<ScrollPanelWidget>("MOD_LIST");
|
||||
var loadButton = panel.Get<ButtonWidget>("LOAD_BUTTON");
|
||||
loadButton.OnClick = () => LoadMod(currentMod.Id, onSwitch);
|
||||
loadButton.IsDisabled = () => currentMod.Id == Game.CurrentMods.Keys.First();
|
||||
loadButton.IsDisabled = () => currentMod.Id == Game.modData.Manifest.Mod.Id;
|
||||
|
||||
panel.Get<ButtonWidget>("BACK_BUTTON").OnClick = () => { Ui.CloseWindow(); onExit(); };
|
||||
currentMod = Mod.AllMods[Game.modData.Manifest.Mods[0]];
|
||||
currentMod = Game.modData.Manifest.Mod;
|
||||
|
||||
// Mod list
|
||||
var modTemplate = modList.Get<ScrollItemWidget>("MOD_TEMPLATE");
|
||||
@@ -47,13 +47,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
|
||||
void LoadMod(string mod, Action onSwitch)
|
||||
{
|
||||
var mods = Mod.AllMods[mod].WithPrerequisites();
|
||||
|
||||
Game.RunAfterTick(() =>
|
||||
{
|
||||
Ui.CloseWindow();
|
||||
onSwitch();
|
||||
Game.InitializeWithMods(mods);
|
||||
Game.InitializeWithMod(mod);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
panel.Get<ButtonWidget>("CANCEL_BUTTON").OnClick = () => { Ui.CloseWindow(); onExit(); };
|
||||
|
||||
var rl = panel.Get<ScrollPanelWidget>("REPLAY_LIST");
|
||||
|
||||
var dir = new[] { Platform.SupportDir, "Replays", WidgetUtils.ActiveModId(), WidgetUtils.ActiveModVersion() }.Aggregate(Path.Combine);
|
||||
|
||||
var template = panel.Get<ScrollItemWidget>("REPLAY_TEMPLATE");
|
||||
|
||||
var mod = Game.modData.Manifest.Mod;
|
||||
var dir = new[] { Platform.SupportDir, "Replays", mod.Id, mod.Version }.Aggregate(Path.Combine);
|
||||
|
||||
rl.RemoveChildren();
|
||||
if (Directory.Exists(dir))
|
||||
{
|
||||
|
||||
@@ -149,17 +149,15 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
return (game == null) ? null : Game.modData.FindMapByUid(game.Map);
|
||||
}
|
||||
|
||||
static string GenerateModLabel(KeyValuePair<string,string> mod)
|
||||
public static string GenerateModLabel(GameServer s)
|
||||
{
|
||||
if (Mod.AllMods.ContainsKey(mod.Key))
|
||||
return "{0} ({1})".F(Mod.AllMods[mod.Key].Title, mod.Value);
|
||||
Mod mod;
|
||||
var modVersion = s.Mods.Split('@');
|
||||
|
||||
return "Unknown Mod: {0}".F(mod.Key);
|
||||
}
|
||||
if (modVersion.Length == 2 && Mod.AllMods.TryGetValue(modVersion[0], out mod))
|
||||
return "{0} ({1})".F(mod.Title, modVersion[1]);
|
||||
|
||||
public static string GenerateModsLabel(GameServer s)
|
||||
{
|
||||
return s.UsefulMods.Select(m => GenerateModLabel(m)).JoinWith("\n");
|
||||
return "Unknown mod: {0}".F(s.Mods);
|
||||
}
|
||||
|
||||
bool Filtered(GameServer game)
|
||||
@@ -237,7 +235,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
ip.GetText = () => game.Address;
|
||||
|
||||
var version = item.Get<LabelWidget>("VERSION");
|
||||
version.GetText = () => GenerateModsLabel(game);
|
||||
version.GetText = () => GenerateModLabel(game);
|
||||
version.IsVisible = () => !game.CompatibleVersion();
|
||||
|
||||
var location = item.Get<LabelWidget>("LOCATION");
|
||||
|
||||
Reference in New Issue
Block a user