/// <summary> /// 获取行为链 /// </summary> /// <param name="paramsPacker">构造数据</param> /// <param name="formulaItem">行为链构造器</param> /// <returns></returns> protected IFormula GetIFormula(FormulaParamsPacker paramsPacker, IFormulaItem formulaItem) { IFormula result = null; // 循环构建行为链构造器 var tmpItem = formulaItem; // 数据列表放入packer中 paramsPacker.DataList = DataList; // 技能ID放入packer中 paramsPacker.SkillNum = Num; while (tmpItem != null) { if (result != null) { result = result.After(tmpItem.GetFormula(paramsPacker)); } else { result = tmpItem.GetFormula(paramsPacker); } tmpItem = tmpItem.NextFormulaItem; } // 构造器不为空 if (result != null) { // 获取构造器链head result = result.GetFirst(); // 设置行为链链头的数据域 result.DataScope = DataScope; } return(result); }