/// <summary> /// /// </summary> /// <param name="xml"></param> /// <returns></returns> public bool Load(XmlNode xml) { if (xml == null) { return(false); } Decoration = int.Parse(xml.Attributes["deco"].Value); HideItems = bool.Parse(xml.Attributes["hide"].Value); AcceptBigItems = bool.Parse(xml.Attributes["bigitems"].Value); //ItemLocation = new Point(int.Parse(xml.Attributes["x"].Value), // int.Parse(xml.Attributes["y"].Value)); foreach (XmlNode node in xml) { switch (node.Name.ToLower()) { case "onaddeditem": { foreach (XmlNode sub in node) { AlcoveScript script = new AlcoveScript(); script.Load(sub); OnAddedItem.Add(script); } } break; case "onremoveditem": { foreach (XmlNode sub in node) { AlcoveScript script = new AlcoveScript(); script.Load(sub); OnRemovedItem.Add(script); } } break; default: { } break; } } return(true); }
/// <summary> /// /// </summary> /// <param name="script">Script handle to edit</param> /// <param name="dungeon">Dungeon handle</param> public AlcoveScriptForm(AlcoveScript script, Dungeon dungeon) { InitializeComponent(); if (script == null) { Script = new AlcoveScript(); } else { Script = script; } Dungeon = dungeon; ActionBox.Dungeon = dungeon; ActionBox.Script = Script; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MoveUpBox_Click(object sender, EventArgs e) { if (Scripts == null) { return; } int id = ScriptListBox.SelectedIndex; if (id <= 0) { return; } AlcoveScript script = Scripts[id]; Scripts.RemoveAt(id); Scripts.Insert(id - 1, script); UpdateUI(); ScriptListBox.SelectedIndex = id - 1; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MoveDownBox_Click(object sender, EventArgs e) { if (Scripts == null) { return; } int id = ScriptListBox.SelectedIndex; if (id >= Scripts.Count - 1) { return; } AlcoveScript action = Scripts[id]; Scripts.RemoveAt(id); Scripts.Insert(id + 1, action); UpdateUI(); ScriptListBox.SelectedIndex = id + 1; }