Merge pull request #5401 from RoosterDragon/nodesdict
Changed MiniYaml.NodesDict property into a method.
This commit is contained in:
@@ -33,7 +33,7 @@ namespace OpenRA
|
||||
{
|
||||
try
|
||||
{
|
||||
var mergedNode = MergeWithParent(node, allUnits).NodesDict;
|
||||
var mergedNode = MergeWithParent(node, allUnits).ToDictionary();
|
||||
|
||||
Name = name;
|
||||
foreach (var t in mergedNode)
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA
|
||||
static MiniYaml GetParent( MiniYaml node, Dictionary<string, MiniYaml> allUnits )
|
||||
{
|
||||
MiniYaml inherits;
|
||||
node.NodesDict.TryGetValue( "Inherits", out inherits );
|
||||
node.ToDictionary().TryGetValue( "Inherits", out inherits );
|
||||
if( inherits == null || string.IsNullOrEmpty( inherits.Value ) )
|
||||
return null;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA.GameRules
|
||||
{
|
||||
Title = value.Value;
|
||||
|
||||
var nd = value.NodesDict;
|
||||
var nd = value.ToDictionary();
|
||||
var ext = nd.ContainsKey("Extension") ? nd["Extension"].Value : "aud";
|
||||
Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key)+"."+ext;
|
||||
if (!GlobalFileSystem.Exists(Filename))
|
||||
|
||||
@@ -28,10 +28,9 @@ namespace OpenRA.GameRules
|
||||
|
||||
static Dictionary<string, string[]> Load(MiniYaml y, string name)
|
||||
{
|
||||
return y.NodesDict.ContainsKey(name)
|
||||
? y.NodesDict[name].NodesDict.ToDictionary(
|
||||
a => a.Key,
|
||||
a => FieldLoader.GetValue<string[]>("(value)", a.Value.Value))
|
||||
var nd = y.ToDictionary();
|
||||
return nd.ContainsKey(name)
|
||||
? nd[name].ToDictionary(my => FieldLoader.GetValue<string[]>("(value)", my.Value))
|
||||
: new Dictionary<string, string[]>();
|
||||
}
|
||||
|
||||
|
||||
@@ -73,10 +73,9 @@ namespace OpenRA.GameRules
|
||||
|
||||
static object LoadVersus(MiniYaml y)
|
||||
{
|
||||
return y.NodesDict.ContainsKey("Versus")
|
||||
? y.NodesDict["Versus"].NodesDict.ToDictionary(
|
||||
a => a.Key,
|
||||
a => FieldLoader.GetValue<float>("(value)", a.Value.Value))
|
||||
var nd = y.ToDictionary();
|
||||
return nd.ContainsKey("Versus")
|
||||
? nd["Versus"].ToDictionary(my => FieldLoader.GetValue<float>("(value)", my.Value))
|
||||
: new Dictionary<string, float>();
|
||||
}
|
||||
}
|
||||
@@ -126,7 +125,7 @@ namespace OpenRA.GameRules
|
||||
static object LoadProjectile(MiniYaml yaml)
|
||||
{
|
||||
MiniYaml proj;
|
||||
if (!yaml.NodesDict.TryGetValue("Projectile", out proj))
|
||||
if (!yaml.ToDictionary().TryGetValue("Projectile", out proj))
|
||||
return null;
|
||||
var ret = Game.CreateObject<IProjectileInfo>(proj.Value + "Info");
|
||||
FieldLoader.Load(ret, proj);
|
||||
|
||||
Reference in New Issue
Block a user