예제 #1
0
    /// <summary>
    /// 加载buff类
    /// 如果缓存中没有就从文件照片那个加载
    /// </summary>
    /// <param name="buffId">buffID</param>
    /// <param name="receive">buff的接受者</param>
    /// <param name="release">buff的释放者</param>
    /// <param name="buffRank">Buff等级</param>
    /// <returns></returns>
    public BuffInfo CreateBuffInfo(int buffId, DisplayOwner receive, DisplayOwner release, int buffRank = 1)
    {
        BuffInfo result = null;

        // 验证技能ID的有效性
        if (buffId > 0)
        {
            // 检查缓存
            if (buffDic.ContainsKey(buffId))
            {
                // 复制buff
                result = buffDic[buffId];
            }
            else
            {
                // 加载文件内容
                var buffTxt = GetBuffScript(buffId, SkillManager.Single.RunType);
                if (!string.IsNullOrEmpty(buffTxt))
                {
                    result = FormulaConstructor.BuffConstructor(buffTxt);
                    // 将其放入缓存
                    AddBuffInfo(result);
                }
            }
        }
        result = CopyBuffInfo(result);
        result.ReplaceData(buffRank);
        // 将实现放入实现列表
        buffInstanceDic.Add(result.AddtionId, result);
        result.ReceiveMember = receive;
        result.ReleaseMember = release;
        result.BuffRank      = buffRank;
        return(result);
    }