Beispiel #1
0
    protected virtual BuffData toCreateBuff(int id, int level, int adderInstanceID, BuffData eData)
    {
        BuffData buff = eData != null ? eData : GameC.pool.buffDataPool.getOne();

        buff.instanceID  = getBuffInstanceID();
        buff.id          = id;
        buff.config      = BuffConfig.get(id);
        buff.level       = getBuffUseLevel(buff.config, level);
        buff.levelConfig = BuffLevelConfig.get(id, buff.level);
        //客户端用
        buff.timeMax = getBuffUseLastTime(buff);

        buff.adderInstanceID = adderInstanceID;

        if (eData == null)
        {
            buff.lastTime = getBuffUseLastTime(buff);
            buff.lastNum  = buff.levelConfig.lastNum;
            //叠层强制1
            if (buff.config.plusType == BuffPlusType.AddFloor)
            {
                buff.lastNum = 1;
            }
        }

        return(buff);
    }
Beispiel #2
0
    /** 设置数据 */
    public void setData(IntObjectMap <BuffData> datas)
    {
        _buffDataDic = datas;

        if (datas != null && !datas.isEmpty())
        {
            BuffData[] values = datas.getValues();
            BuffData   data;

            for (int i = values.Length - 1; i >= 0; --i)
            {
                if ((data = values[i]) != null)
                {
                    data.config      = BuffConfig.get(data.id);
                    data.levelConfig = BuffLevelConfig.get(data.id, data.level);

                    toAddBuffToDic(data);

                    doAddActions(data, _parent.isDriveAll());
                }
            }

            for (int i = values.Length - 1; i >= 0; --i)
            {
                if ((data = values[i]) != null)
                {
                    data.timeMax = getBuffUseLastTime(data);
                }
            }
        }
    }
Beispiel #3
0
    /** 刷新当前buff等级 */
    private void refreshBuffLevelUp(int groupID, int level)
    {
        BuffData[] dataValues = _buffDatas.getValues();
        BuffData   data;

        for (int i = dataValues.Length - 1; i >= 0; --i)
        {
            if ((data = dataValues[i]) != null)
            {
                if (data.config.hasGroup(groupID))
                {
                    doRemoveActions(data, true);

                    _parent.onRemoveBuff(data);

                    data.level      += level;
                    data.levelConfig = BuffLevelConfig.get(data.id, data.level);
                    data.timeMax     = getBuffUseLastTime(data);

                    doAddActions(data, true);

                    _parent.onAddBuff(data);
                }
            }
        }
    }
Beispiel #4
0
    //server部分

    /** 服务器添加buff */
    public void addBuffByServer(BuffData data)
    {
        data.config      = BuffConfig.get(data.id);
        data.levelConfig = BuffLevelConfig.get(data.id, data.level);
        data.timeMax     = getBuffUseLastTime(data);

        toAddBuff(data);
    }
Beispiel #5
0
 public void reloadConfig()
 {
     config      = BuffConfig.get(id);
     levelConfig = BuffLevelConfig.get(id, level);
 }