Converted the GetAttribute methods in the ToolBox class to extension methods
This commit is contained in:
@@ -56,7 +56,7 @@ namespace Barotrauma
|
||||
{
|
||||
name = element.Name.ToString();
|
||||
|
||||
commonness = ToolBox.GetAttributeInt(element, "commonness", 1);
|
||||
commonness = element.GetAttributeInt("commonness", 1);
|
||||
totalWeight += commonness;
|
||||
|
||||
nameFormats = new List<string>();
|
||||
@@ -70,7 +70,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "hireable") continue;
|
||||
|
||||
string jobName = ToolBox.GetAttributeString(subElement, "name", "");
|
||||
string jobName = subElement.GetAttributeString("name", "");
|
||||
|
||||
JobPrefab jobPrefab = JobPrefab.List.Find(jp => jp.Name.ToLowerInvariant() == jobName.ToLowerInvariant());
|
||||
if (jobPrefab==null)
|
||||
@@ -78,7 +78,7 @@ namespace Barotrauma
|
||||
DebugConsole.ThrowError("Invalid job name ("+jobName+") in location type "+name);
|
||||
}
|
||||
|
||||
float jobCommonness = ToolBox.GetAttributeFloat(subElement, "commonness", 1.0f);
|
||||
float jobCommonness = subElement.GetAttributeFloat("commonness", 1.0f);
|
||||
totalHireableWeight += jobCommonness;
|
||||
|
||||
Tuple<JobPrefab, float> hireableJob = new Tuple<JobPrefab, float>(jobPrefab, jobCommonness);
|
||||
@@ -86,10 +86,10 @@ namespace Barotrauma
|
||||
hireableJobs.Add(hireableJob);
|
||||
}
|
||||
|
||||
string spritePath = ToolBox.GetAttributeString(element, "symbol", "Content/Map/beaconSymbol.png");
|
||||
string spritePath = element.GetAttributeString("symbol", "Content/Map/beaconSymbol.png");
|
||||
symbolSprite = new Sprite(spritePath, new Vector2(0.5f, 0.5f));
|
||||
|
||||
string backgroundPath = ToolBox.GetAttributeString(element, "background", "");
|
||||
string backgroundPath = element.GetAttributeString("background", "");
|
||||
backGround = new Sprite(backgroundPath, Vector2.Zero);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (string file in locationTypeFiles)
|
||||
{
|
||||
XDocument doc = ToolBox.TryLoadXml(file);
|
||||
XDocument doc = XMLExtensions.TryLoadXml(file);
|
||||
|
||||
if (doc==null)
|
||||
{
|
||||
|
||||
@@ -396,9 +396,9 @@ namespace Barotrauma
|
||||
|
||||
public static Map LoadNew(XElement element)
|
||||
{
|
||||
string mapSeed = ToolBox.GetAttributeString(element, "seed", "a");
|
||||
string mapSeed = element.GetAttributeString("seed", "a");
|
||||
|
||||
int size = ToolBox.GetAttributeInt(element, "size", 1000);
|
||||
int size = element.GetAttributeInt("size", 1000);
|
||||
Map map = new Map(mapSeed, size);
|
||||
map.Load(element);
|
||||
|
||||
@@ -407,9 +407,9 @@ namespace Barotrauma
|
||||
|
||||
public void Load(XElement element)
|
||||
{
|
||||
SetLocation(ToolBox.GetAttributeInt(element, "currentlocation", 0));
|
||||
SetLocation(element.GetAttributeInt("currentlocation", 0));
|
||||
|
||||
string discoveredStr = ToolBox.GetAttributeString(element, "discovered", "");
|
||||
string discoveredStr = element.GetAttributeString("discovered", "");
|
||||
|
||||
string[] discoveredStrs = discoveredStr.Split(',');
|
||||
for (int i = 0; i < discoveredStrs.Length; i++)
|
||||
@@ -418,7 +418,7 @@ namespace Barotrauma
|
||||
if (int.TryParse(discoveredStrs[i], out index)) locations[index].Discovered = true;
|
||||
}
|
||||
|
||||
string passedStr = ToolBox.GetAttributeString(element, "passed", "");
|
||||
string passedStr = element.GetAttributeString("passed", "");
|
||||
string[] passedStrs = passedStr.Split(',');
|
||||
for (int i = 0; i < passedStrs.Length; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user