Merge pull request #5401 from RoosterDragon/nodesdict

Changed MiniYaml.NodesDict property into a method.
This commit is contained in:
Paul Chote
2014-06-12 17:34:59 +12:00
21 changed files with 104 additions and 74 deletions

View File

@@ -193,12 +193,17 @@ namespace OpenRA.Mods.RA.Widgets.Logic
static IEnumerable<NewsItem> ReadNews(byte[] bytes)
{
var str = Encoding.UTF8.GetString(bytes);
return MiniYaml.FromString(str).Select(node => new NewsItem
return MiniYaml.FromString(str).Select(node =>
{
Title = node.Value.NodesDict["Title"].Value,
Author = node.Value.NodesDict["Author"].Value,
DateTime = FieldLoader.GetValue<DateTime>("DateTime", node.Key),
Content = node.Value.NodesDict["Content"].Value
var nodesDict = node.Value.ToDictionary();
return new NewsItem
{
Title = nodesDict["Title"].Value,
Author = nodesDict["Author"].Value,
DateTime = FieldLoader.GetValue<DateTime>("DateTime", node.Key),
Content = nodesDict["Content"].Value
};
});
}

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
description = widget.Get<LabelWidget>("MISSION_DESCRIPTION");
descriptionFont = Game.Renderer.Fonts[description.Font];
var yaml = new MiniYaml(null, Game.modData.Manifest.Missions.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergeLiberal)).NodesDict;
var yaml = new MiniYaml(null, Game.modData.Manifest.Missions.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergeLiberal)).ToDictionary();
var missionMapPaths = yaml["Missions"].Nodes.Select(n => Path.GetFullPath(n.Key));