Converted the GetAttribute methods in the ToolBox class to extension methods

This commit is contained in:
Joonas Rikkonen
2017-10-04 18:38:40 +03:00
parent 6c7c97a875
commit 1ff2054ca8
99 changed files with 854 additions and 875 deletions
@@ -12,7 +12,7 @@ namespace Barotrauma
partial void InitProjSpecific(XElement element)
{
string soundPath = ToolBox.GetAttributeString(element, "sound", "");
string soundPath = element.GetAttributeString("sound", "");
if (!string.IsNullOrWhiteSpace(soundPath))
{
sound = Sound.Load(soundPath);
@@ -46,7 +46,7 @@ namespace Barotrauma
partial void InitProjSpecific(XDocument doc)
{
soundInterval = ToolBox.GetAttributeFloat(doc.Root, "soundinterval", 10.0f);
soundInterval = doc.Root.GetAttributeFloat("soundinterval", 10.0f);
keys = new Key[Enum.GetNames(typeof(InputType)).Length];
@@ -19,9 +19,9 @@ namespace Barotrauma
public CharacterSound(XElement element)
{
Sound = Sound.Load(element.Attribute("file").Value);
Range = ToolBox.GetAttributeFloat(element, "range", 1000.0f);
Range = element.GetAttributeFloat("range", 1000.0f);
Enum.TryParse<SoundType>(ToolBox.GetAttributeString(element, "state", "Idle"), true, out Type);
Enum.TryParse<SoundType>(element.GetAttributeString("state", "Idle"), true, out Type);
}
}
}
@@ -34,7 +34,7 @@ namespace Barotrauma
LightSource = new LightSource(subElement);
break;
case "sound":
hitSound = Sound.Load(ToolBox.GetAttributeString(subElement, "file", ""));
hitSound = Sound.Load(subElement.GetAttributeString("file", ""));
break;
}
}