Rename Manifest.Mod -> Metadata.

This commit is contained in:
Paul Chote
2016-08-05 19:00:36 +01:00
parent 3df9efb95d
commit bf4867909f
23 changed files with 45 additions and 59 deletions

View File

@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Server
(int)server.State,
numPlayers,
numBots,
"{0}@{1}".F(mod.Id, mod.Mod.Version),
"{0}@{1}".F(mod.Id, mod.Metadata.Version),
server.LobbyInfo.GlobalSettings.Map,
numSlots,
numSpectators,

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
var maps = new List<Map>();
if (args.Length < 2)
{
Console.WriteLine("Testing mod: {0}".F(modData.Manifest.Mod.Title));
Console.WriteLine("Testing mod: {0}".F(modData.Manifest.Metadata.Title));
// Run all rule checks on the default mod rules.
CheckRules(modData, modData.DefaultRules);

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
// HACK: The engine code assumes that Game.modData is set.
Game.ModData = utility.ModData;
Console.WriteLine("This is an automatically generated listing of the new Lua map scripting API, generated for {0} of OpenRA.", Game.ModData.Manifest.Mod.Version);
Console.WriteLine("This is an automatically generated listing of the new Lua map scripting API, generated for {0} of OpenRA.", Game.ModData.Manifest.Metadata.Version);
Console.WriteLine();
Console.WriteLine("OpenRA allows custom maps and missions to be scripted using Lua 5.1.\n" +
"These scripts run in a sandbox that prevents access to unsafe functions (e.g. OS or file access), " +

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
Console.WriteLine(
"This documentation is aimed at server administrators. It displays all settings with default values and description. " +
"Please do not edit it directly, but add new `[Desc(\"String\")]` tags to the source code. This file has been " +
"automatically generated for version {0} of OpenRA.", utility.ModData.Manifest.Mod.Version);
"automatically generated for version {0} of OpenRA.", utility.ModData.Manifest.Metadata.Version);
Console.WriteLine();
Console.WriteLine("All settings can be changed by starting the game via a command-line parameter like `Game.Mod=ra`.");
Console.WriteLine();

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
Console.WriteLine(
"This documentation is aimed at modders. It displays all traits with default values and developer commentary. " +
"Please do not edit it directly, but add new `[Desc(\"String\")]` tags to the source code. This file has been " +
"automatically generated for version {0} of OpenRA.", utility.ModData.Manifest.Mod.Version);
"automatically generated for version {0} of OpenRA.", utility.ModData.Manifest.Metadata.Version);
Console.WriteLine();
var toc = new StringBuilder();

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (mpe != null)
mpe.Fade(mpe.Info.MenuEffect);
menu.Get<LabelWidget>("VERSION_LABEL").Text = modData.Manifest.Mod.Version;
menu.Get<LabelWidget>("VERSION_LABEL").Text = modData.Manifest.Metadata.Version;
var hideMenu = false;
menu.Get("MENU_BUTTONS").IsVisible = () => !hideMenu;

View File

@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public MainMenuLogic(Widget widget, World world, ModData modData)
{
rootMenu = widget;
rootMenu.Get<LabelWidget>("VERSION_LABEL").Text = modData.Manifest.Mod.Version;
rootMenu.Get<LabelWidget>("VERSION_LABEL").Text = modData.Manifest.Metadata.Version;
// Menu buttons
var mainMenu = widget.Get("MAIN_MENU");
@@ -283,9 +283,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
// Send the mod and engine version to support version-filtered news (update prompts)
var newsURL = Game.Settings.Game.NewsUrl + "?version={0}&mod={1}&modversion={2}".F(
Uri.EscapeUriString(Game.Mods["modchooser"].Mod.Version),
Uri.EscapeUriString(Game.Mods["modchooser"].Metadata.Version),
Uri.EscapeUriString(Game.ModData.Manifest.Id),
Uri.EscapeUriString(Game.ModData.Manifest.Mod.Version));
Uri.EscapeUriString(Game.ModData.Manifest.Metadata.Version));
// Append system profile data if the player has opted in
if (Game.Settings.Debug.SendSystemInformation)

View File

@@ -69,9 +69,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
modTemplate = modList.Get<ButtonWidget>("MOD_TEMPLATE");
modChooserPanel.Get<LabelWidget>("MOD_DESC").GetText = () => selectedDescription;
modChooserPanel.Get<LabelWidget>("MOD_TITLE").GetText = () => selectedMod.Mod.Title;
modChooserPanel.Get<LabelWidget>("MOD_TITLE").GetText = () => selectedMod.Metadata.Title;
modChooserPanel.Get<LabelWidget>("MOD_AUTHOR").GetText = () => selectedAuthor;
modChooserPanel.Get<LabelWidget>("MOD_VERSION").GetText = () => selectedMod.Mod.Version;
modChooserPanel.Get<LabelWidget>("MOD_VERSION").GetText = () => selectedMod.Metadata.Version;
var prevMod = modChooserPanel.Get<ButtonWidget>("PREV_MOD");
prevMod.OnClick = () => { modOffset -= 1; RebuildModList(); };
@@ -89,8 +89,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
};
sheetBuilder = new SheetBuilder(SheetType.BGRA);
allMods = Game.Mods.Values.Where(m => !m.Mod.Hidden)
.OrderBy(m => m.Mod.Title)
allMods = Game.Mods.Values.Where(m => !m.Metadata.Hidden)
.OrderBy(m => m.Metadata.Title)
.ToArray();
// Load preview images, and eat any errors
@@ -153,7 +153,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
SelectMod(mod);
};
item.TooltipText = mod.Mod.Title;
item.TooltipText = mod.Metadata.Title;
if (j < 9)
item.Key = new Hotkey((Keycode)((int)Keycode.NUMBER_1 + j), Modifiers.None);
@@ -170,8 +170,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
void SelectMod(Manifest mod)
{
selectedMod = mod;
selectedAuthor = "By " + (mod.Mod.Author ?? "unknown author");
selectedDescription = (mod.Mod.Description ?? "").Replace("\\n", "\n");
selectedAuthor = "By " + (mod.Metadata.Author ?? "unknown author");
selectedDescription = (mod.Metadata.Description ?? "").Replace("\\n", "\n");
var selectedIndex = Array.IndexOf(allMods, mod);
if (selectedIndex - modOffset > 4)
modOffset = selectedIndex - 4;

View File

@@ -316,9 +316,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
};
var queryURL = Game.Settings.Server.MasterServer + "games?version={0}&mod={1}&modversion={2}".F(
Uri.EscapeUriString(Game.Mods["modchooser"].Mod.Version),
Uri.EscapeUriString(Game.Mods["modchooser"].Metadata.Version),
Uri.EscapeUriString(Game.ModData.Manifest.Id),
Uri.EscapeUriString(Game.ModData.Manifest.Mod.Version));
Uri.EscapeUriString(Game.ModData.Manifest.Metadata.Version));
currentQuery = new Download(queryURL, _ => { }, onComplete);
}

View File

@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var template = panel.Get<ScrollItemWidget>("REPLAY_TEMPLATE");
var mod = modData.Manifest;
var dir = Platform.ResolvePath("^", "Replays", mod.Id, mod.Mod.Version);
var dir = Platform.ResolvePath("^", "Replays", mod.Id, mod.Metadata.Version);
if (Directory.Exists(dir))
ThreadPool.QueueUserWorkItem(_ => LoadReplays(dir, template));

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (!Game.Mods.ContainsKey(mod))
return IncompatibleReplayDialog("unavailable mod", mod, onCancel);
if (Game.Mods[mod].Mod.Version != version)
if (Game.Mods[mod].Metadata.Version != version)
return IncompatibleReplayDialog("incompatible version", version, onCancel);
if (replayMeta.GameInfo.MapPreview.Status != MapStatus.Available)