/// <summary> /// /// </summary> /// <param name="script"></param> /// <param name="dungeon"></param> public PressurePlateScriptForm(PressurePlateScript script, Dungeon dungeon) { InitializeComponent(); if (script == null) Script = new PressurePlateScript(); else Script = script; ActionBox.Dungeon = dungeon; ActionBox.Script = Script; SetCondition(Script.Condition); }
/// <summary> /// /// </summary> /// <param name="node"></param> /// <returns></returns> public override bool Load(XmlNode xml) { if (xml == null || xml.Name != Tag) return false; IsHidden = xml.Attributes["hidden"] != null ? bool.Parse(xml.Attributes["hidden"].Value) : false; Reusable = xml.Attributes["reusable"] != null ? bool.Parse(xml.Attributes["reusable"].Value) : false; WasUsed = xml.Attributes["used"] != null ? bool.Parse(xml.Attributes["used"].Value) : false; DecorationPrimary = xml.Attributes["primary"] != null ? int.Parse(xml.Attributes["primary"].Value) : -1; DecorationSecondary = xml.Attributes["secondary"] != null ? int.Parse(xml.Attributes["secondary"].Value) : -1; foreach (XmlNode node in xml) { switch (node.Name.ToLower()) { case "scripts": { foreach (XmlNode sub in node) { PressurePlateScript script = new PressurePlateScript(); script.Load(sub); Scripts.Add(script); } } break; default: { base.Load(node); } break; } } return true; }