/// <summary> /// 服务器下发任务进行重新创建任务实例 /// </summary> /// <param name="p"></param> void _Packet(ScNpcMission p) { if (p != null && p.missions != null && p.missions.Length > 0) { for (int i = 0; i < p.missions.Length; i++) { PMission info = null; p.missions[i].CopyTo(ref info); if (info != null) { CreateTask(info); } } } }
private void CreateTask(PMission info) { Task task = new Task(info.missionId); if (!task.InitTaskData(info.conditions)) { return; } //同一任务是否可以接多次? if (!IsExistTask(info.missionId)) { m_taskList.Add(task); task.TaskBegin(); } }
void UpdateTaskConditionState(PMission info) { Task task = m_taskList.Find(((p) => p.taskID == info.missionId)); if (task != null) { for (byte i = 0; i < info.conditions.Length; i++) { task.UpdateCondition(i, (EnumTaskCondition)(info.conditions[i].conditionId), info.conditions[i].progress); } } else { Logger.Log(LogType.ERROR, "Dont Find Task By ID :{0}", info.missionId); } }