Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

Commit

Permalink
Default values for Level for easier test level making
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed Jul 31, 2015
1 parent d80816c commit 5e5eec6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions EdgeTool/Core/Level/Level.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ private Level(string path) : this()
{
var element = XHelper.Load(path + ".xml").GetElement("Level");
ID = element.GetAttributeValue<int>("ID");
Name = element.GetAttributeValue("Name");
var thresholds = element.GetAttributeValue("TimeThresholds").Split(',')
Name = element.GetAttributeValueWithDefault("Name", string.Empty);
var thresholds = element.GetAttributeValueWithDefault("TimeThresholds", "1,2,3,4,5").Split(',')
.Select(str => ushort.Parse(str.Trim())).ToArray();
SPlusTime = thresholds[0];
STime = thresholds[1];
Expand Down Expand Up @@ -448,10 +448,12 @@ public void Write(BinaryWriter writer)
}
public XElement GetXElement()
{
var element = new XElement("Level", new XAttribute("ID", ID), new XAttribute("Name", Name),
new XAttribute("TimeThresholds", $"{SPlusTime},{STime},{ATime},{BTime},{CTime}"),
new XAttribute("Size", Size), new XAttribute("SpawnPoint", SpawnPoint),
var element = new XElement("Level", new XAttribute("ID", ID), new XAttribute("Size", Size),
new XAttribute("SpawnPoint", SpawnPoint),
new XAttribute("ExitPoint", ExitPoint));
element.SetAttributeValueWithDefault("Name", Name, string.Empty);
element.SetAttributeValueWithDefault("TimeThresholds", $"{SPlusTime},{STime},{ATime},{BTime},{CTime}",
"1,2,3,4,5");
element.SetAttributeValueWithDefault("Theme", Theme);
element.SetAttributeValueWithDefault("MusicJava", MusicJava);
element.SetAttributeValueWithDefault("Music", Music, 6);
Expand Down

0 comments on commit 5e5eec6

Please sign in to comment.