/// <summary> /// Constructor /// </summary> /// <param name="script">Script handle</param> /// <param name="dungeon">Dungeon handle</param> public SpawnMonsterControl(SpawnMonster script, Dungeon dungeon) { InitializeComponent(); Action = script ?? new SpawnMonster(); TargetBox.Dungeon = dungeon; TargetBox.SetTarget(script.Target); MonsterNameBox.Items.AddRange(ResourceManager.GetAssets<Monster>().ToArray()); if (!string.IsNullOrEmpty(SpawnScript.MonsterName)) MonsterNameBox.SelectedItem = SpawnScript.MonsterName; }
/// <summary> /// Loads a party /// </summary> /// <param name="filename">Xml data</param> /// <returns>True if team successfuly loaded, otherwise false</returns> public virtual bool Load(XmlNode xml) { if (xml == null) return false; Action = null; switch (xml.Name) { case SpawnMonster.Tag: { Action = new SpawnMonster(); } break; case EnableTarget.Tag: { Action = new EnableTarget(); } break; case DisableTarget.Tag: { Action = new DisableTarget(); } break; case ActivateTarget.Tag: { Action = new ActivateTarget(); } break; case DeactivateTarget.Tag: { Action = new DeactivateTarget(); } break; case ChangePicture.Tag: { Action = new ChangePicture(); } break; case ChangeText.Tag: { Action = new ChangeText(); } break; case DisableChoice.Tag: { Action = new DisableChoice(); } break; case EnableChoice.Tag: { Action = new EnableChoice(); } break; case EndChoice.Tag: { Action = new EndChoice(); } break; case EndDialog.Tag: { Action = new EndDialog(); } break; case GiveExperience.Tag: { Action = new GiveExperience(); } break; case GiveItem.Tag: { Action = new GiveItem(); } break; case Healing.Tag: { Action = new Healing(); } break; case JoinCharacter.Tag: { Action = new JoinCharacter(); } break; case PlaySound.Tag: { Action = new PlaySound(); } break; case SetTo.Tag: { Action = new SetTo(); } break; case Teleport.Tag: { Action = new Teleport(); } break; case ToggleTarget.Tag: { Action = new ToggleTarget(); } break; case DisplayMessage.Tag: { Action = new DisplayMessage(); } break; default: { Trace.WriteLine("[ScriptBase] Load() : Unknown node \"" + xml.Name + "\" found."); return false; } } if (Action == null) return false; Action.Load(xml); return true; }