/// <summary> /// Validates the node. /// Overloaded in child classes to validate that each type of node follows the correct business logic. /// This checks stuff that isn't validated by the XML validation /// </summary> public override void ValidateNode() { base.ValidateNode(); //check for a bullet node BulletDescriptionNode = GetChild(ENodeName.bullet) as BulletNode; //if it didn't find one, check for the bulletref node if (null == BulletDescriptionNode) { //make sure that dude knows what he's doing BulletRefNode refNode = GetChild(ENodeName.bulletRef) as BulletRefNode; refNode.FindMyBulletNode(); BulletDescriptionNode = refNode.ReferencedBulletNode; } Debug.Assert(null != BulletDescriptionNode); }
/// <summary> /// Parse a specified node and bullet into this task /// </summary> /// <param name="myNode">the node for this dude</param> /// <param name="bullet">the bullet this dude is controlling</param> public override void ParseChildNode(BulletMLNode childNode, Bullet bullet) { System.Diagnostics.Debug.Assert(null != childNode); System.Diagnostics.Debug.Assert(null != bullet); switch (childNode.Name) { case ENodeName.bulletRef: { //Create a task for the bullet ref BulletRefNode refNode = childNode as BulletRefNode; BulletRefTask = new BulletMLTask(refNode.ReferencedBulletNode, this); //populate the params of the bullet ref for (int i = 0; i < childNode.ChildNodes.Count; i++) { BulletRefTask.ParamList.Add(childNode.ChildNodes[i].GetValue(this)); } BulletRefTask.ParseTasks(bullet); ChildTasks.Add(BulletRefTask); } break; case ENodeName.bullet: { //Create a task for the bullet ref BulletRefTask = new BulletMLTask(childNode, this); BulletRefTask.ParseTasks(bullet); ChildTasks.Add(BulletRefTask); } break; default: { //run the node through the base class if we don't want it base.ParseChildNode(childNode, bullet); } break; } }