public override void Read(XmlNode os) { foreach (XmlNode current in XmlObject.GetChilds(os)) { switch (current.Name) { case "Id": this.Id = ReadInt(current); break; case "Name": this.Name = ReadString(current); break; case "TaskType": this.TaskType = (TaskType)ReadInt(current); break; case "CanbeCancle": this.CanbeCancle = ReadBool(current); break; case "CanbeSearch": this.CanbeSearch = ReadBool(current); break; case "IsAutoPathFind": this.IsAutoPathFind = ReadBool(current); break; case "IsFinishedTaskCount": this.IsFinishedTaskCount = ReadBool(current); break; case "IsAutoFinish": this.IsAutoFinish = ReadBool(current); break; case "PreTaskID": this.PreTaskID = XmlObject.ReadInt(current); break; case "SubTasks": XmlObject.GetChilds(current).ForEach(delegate(XmlNode pNode) { SubTaskBase data = null; switch (XmlObject.ReadAttribute(pNode, "Type")) { case "SubTalk": data = XmlObject.ReadObject <SubTalk>(pNode); break; case "SubKillMonster": data = XmlObject.ReadObject <SubKillMonster>(pNode); break; case "SubCollectItem": data = XmlObject.ReadObject <SubCollectItem>(pNode); break; case "SubUseItem": data = XmlObject.ReadObject <SubUseItem>(pNode); break; case "SubUseSkill": data = XmlObject.ReadObject <SubUseSkill>(pNode); break; case "SubInterActive": data = XmlObject.ReadObject <SubInterActive>(pNode); break; case "SubGather": data = XmlObject.ReadObject <SubGather>(pNode); break; case "SubConvoy": data = XmlObject.ReadObject <SubConvoy>(pNode); break; case "SubTriggerCutscene": data = XmlObject.ReadObject <SubTriggerCutscene>(pNode); break; case "SubTriggerPlot": data = XmlObject.ReadObject <SubTriggerPlot>(pNode); break; } if (data != null) { this.SubTasks.Add(data); } }); break; } } }
private void CreateSubTask(SubTaskBase pData, int pTaskID, int pTaskStep) { switch (pData.Func) { case TaskSubFuncType.TYPE_TALK: { TaskTalk task = new TaskTalk(); CurThreadTask = task; task.Accept(pData as SubTalk, pTaskID, pTaskStep); } break; case TaskSubFuncType.TYPE_HUNTER: { TaskKillMonster task = new TaskKillMonster(); CurThreadTask = task; task.Accept(pData as SubKillMonster, pTaskID, pTaskStep); } break; case TaskSubFuncType.TYPE_COLLECT: { TaskCollectItem task = new TaskCollectItem(); CurThreadTask = task; task.Accept(pData as SubCollectItem, pTaskID, pTaskStep); } break; case TaskSubFuncType.TYPE_INTERACTIVE: { TaskInterActive task = new TaskInterActive(); CurThreadTask = task; task.Accept(pData as SubInterActive, pTaskID, pTaskStep); } break; case TaskSubFuncType.TYPE_CONVOY: { TaskConvoy task = new TaskConvoy(); CurThreadTask = task; task.Accept(pData as SubConvoy, pTaskID, pTaskStep); } break; case TaskSubFuncType.TYPE_STORY: { TaskTriggerPlot task = new TaskTriggerPlot(); CurThreadTask = task; task.Accept(pData as SubTriggerPlot, pTaskID, pTaskStep); } break; case TaskSubFuncType.TYPE_CUTSCENE: { TaskTriggerCutscene task = new TaskTriggerCutscene(); CurThreadTask = task; task.Accept(pData as SubTriggerCutscene, pTaskID, pTaskStep); } break; case TaskSubFuncType.TYPE_USEITEM: { TaskUseItem task = new TaskUseItem(); CurThreadTask = task; task.Accept(pData as SubUseItem, pTaskID, pTaskStep); } break; case TaskSubFuncType.TYPE_USESKILL: { TaskUseSkill task = new TaskUseSkill(); CurThreadTask = task; task.Accept(pData as SubUseSkill, pTaskID, pTaskStep); } break; case TaskSubFuncType.TYPE_GATHER: { TaskGather task = new TaskGather(); CurThreadTask = task; task.Accept(pData as SubGather, pTaskID, pTaskStep); } break; default: { CurThreadTask = null; } break; } }