예제 #1
0
    /** 接受数据 */
    public void onReceivePage(int page, IntObjectMap <KeyData> dic, IntSet changePageSet)
    {
        if (changePageSet != null && !changePageSet.isEmpty())
        {
            changePageSet.forEach(k =>
            {
                //清CD
                _lockDic.put(k, 0);
            });
        }

        SList <KeyData> list = _list;

        if (dic != null)
        {
            dic.forEach((k, v) =>
            {
                ensureSize(k);
                list.set(k, v);
            });

            //有值才刷新
            onRefreshPage(page);
        }
    }
예제 #2
0
    /// <summary>
    /// 读完所有表后处理
    /// </summary>
    public static void afterReadConfigAll()
    {
        activityIDToUIIDdic.clear();
        functionIDToUIIDdic.clear();

        foreach (UIConfig config in _dic)
        {
            if (config != null)
            {
                if (config.activityIDs.Length > 0)
                {
                    for (int i = 0; i < config.activityIDs.Length; ++i)
                    {
                        activityIDToUIIDdic.put(config.activityIDs[i], config.id);
                    }
                }

                if (config.functionIDs.Length > 0)
                {
                    for (int i = 0; i < config.functionIDs.Length; ++i)
                    {
                        functionIDToUIIDdic.put(config.functionIDs[i], config.id);
                    }
                }
            }
        }
    }
예제 #3
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        this.modelID = stream.readInt();

        int partsLen = stream.readLen();

        if (this.parts != null)
        {
            this.parts.clear();
            this.parts.ensureCapacity(partsLen);
        }
        else
        {
            this.parts = new IntIntMap(partsLen);
        }

        IntIntMap partsT = this.parts;

        for (int partsI = partsLen - 1; partsI >= 0; --partsI)
        {
            int partsK;
            int partsV;
            partsK = stream.readInt();

            partsV = stream.readInt();

            partsT.put(partsK, partsV);
        }
    }
예제 #4
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        base.toReadBytesFull(stream);

        stream.startReadObj();

        int itemPriceDicLen = stream.readLen();

        if (this.itemPriceDic != null)
        {
            this.itemPriceDic.clear();
            this.itemPriceDic.ensureCapacity(itemPriceDicLen);
        }
        else
        {
            this.itemPriceDic = new IntIntMap(itemPriceDicLen);
        }

        IntIntMap itemPriceDicT = this.itemPriceDic;

        for (int itemPriceDicI = itemPriceDicLen - 1; itemPriceDicI >= 0; --itemPriceDicI)
        {
            int itemPriceDicK;
            int itemPriceDicV;
            itemPriceDicK = stream.readInt();

            itemPriceDicV = stream.readInt();

            itemPriceDicT.put(itemPriceDicK, itemPriceDicV);
        }

        stream.endReadObj();
    }
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        int attributesLen = stream.readLen();

        if (this.attributes != null)
        {
            this.attributes.clear();
            this.attributes.ensureCapacity(attributesLen);
        }
        else
        {
            this.attributes = new IntIntMap(attributesLen);
        }

        IntIntMap attributesT = this.attributes;

        for (int attributesI = attributesLen - 1; attributesI >= 0; --attributesI)
        {
            int attributesK;
            int attributesV;
            attributesK = stream.readInt();

            attributesV = stream.readInt();

            attributesT.put(attributesK, attributesV);
        }
    }
예제 #6
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        this.way = stream.readInt();

        int dicLen = stream.readLen();

        if (this.dic != null)
        {
            this.dic.clear();
            this.dic.ensureCapacity(dicLen);
        }
        else
        {
            this.dic = new IntIntMap(dicLen);
        }

        IntIntMap dicT = this.dic;

        for (int dicI = dicLen - 1; dicI >= 0; --dicI)
        {
            int dicK;
            int dicV;
            dicK = stream.readInt();

            dicV = stream.readInt();

            dicT.put(dicK, dicV);
        }
    }
예제 #7
0
    /** 是否有物品位置 */
    public bool hasItemPlace(SList <ItemData> list)
    {
        if (list.size() == 1)
        {
            return(hasItemPlace(list.get(0)));
        }

        _tempDic.clear();

        ItemData[] values = list.getValues();
        ItemData   data;

        for (int i = 0, len = list.size(); i < len; ++i)
        {
            data = values[i];

            if (!ensureNum(data.num))
            {
                _tempDic.clear();
                return(false);
            }

            //有必要
            if (ItemConfig.get(data.id).totalPlusMax > 0)
            {
                _tempDic.put(data.id, data.num);
            }
        }

        if (!_tempDic.isEmpty())
        {
            ItemConfig config;

            foreach (var kv in _tempDic.entrySet())
            {
                config = ItemConfig.get(kv.key);

                //超出总上限
                if ((getItemNum(kv.key) + kv.value) > config.totalPlusMax)
                {
                    return(false);
                }
            }
        }

        return(hasFreeGrid(list.size()));
    }
예제 #8
0
    /** 刷新单个buff的变量属性 */
    private void refreshOneBuffAttributeVar(BuffData data)
    {
        int[][] actions = data.levelConfig.actions;
        int[]   args;

        for (int index = 0; index < actions.Length; ++index)
        {
            args = actions[index];

            switch (args[0])
            {
            case BuffActionType.AddAttributeVar:
            {
                int oldValue = _attributeVarDic.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                int value = _parent.getSkillVarValueT(args[2], data.adderInstanceID);

                if (oldValue != value)
                {
                    _parent.attribute.addOneAttribute(args[1], value - oldValue);

                    _attributeVarDic.put(data.instanceID << CommonSetting.buffActionIndexOff | index, value);
                }
            }
            break;

            case BuffActionType.AddAttributeRefreshVar:
            {
                BuffAddAttributeRefreshVarData oldData = _attributeRefreshVarDic.get(data.instanceID << CommonSetting.buffActionIndexOff | index);

                int value = _parent.getSkillVarValueT(oldData.varID, data.adderInstanceID);

                if (oldData.value != value)
                {
                    _parent.attribute.addOneAttribute(args[1], value - oldData.value);

                    oldData.value = value;
                }
            }
            break;
            }
        }
    }
예제 #9
0
    /** 缓存到当前数据(见BuffKeepType) */
    public void saveCache(MUnitCacheData data, int keepType)
    {
        data.cacheTime = getTimeMillis();

        //当前属性
        IntIntMap currentAttributes = data.currentAttributes;

        currentAttributes.clear();

        int[] currentList = AttributeControl.attribute.currentList;

        for (int i = currentList.Length - 1; i >= 0; --i)
        {
            currentAttributes.put(currentList[i], attribute.getAttribute(currentList[i]));
        }

        //buff
        IntObjectMap <BuffData> buffs = data.buffs;

        buffs.clear();

        BuffData[] values = buff.getBuffDatas().getValues();
        BuffData   v;

        for (int i = values.Length - 1; i >= 0; --i)
        {
            if ((v = values[i]) != null)
            {
                if (v.config.keepType == keepType)
                {
                    buffs.put(v.instanceID, (BuffData)v.clone());                   //clone
                }
            }
        }

        //cd
        IntObjectMap <CDData> cds = data.cds;

        cds.clear();

        CDData[] cdValues = cd.getCDs().getValues();
        CDData   cdV;

        for (int i = cdValues.Length - 1; i >= 0; --i)
        {
            if ((cdV = cdValues[i]) != null)
            {
                if (CDConfig.get(cdV.id).keepType == keepType)
                {
                    cds.put(cdV.id, (CDData)cdV.clone());                   //clone
                }
            }
        }
    }
예제 #10
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is UnitAvatarData))
        {
            return;
        }

        UnitAvatarData mData = (UnitAvatarData)data;

        this.modelID = mData.modelID;

        if (mData.parts != null)
        {
            if (this.parts != null)
            {
                this.parts.clear();
                this.parts.ensureCapacity(mData.parts.size());
            }
            else
            {
                this.parts = new IntIntMap(mData.parts.size());
            }

            IntIntMap partsT = this.parts;
            if (!mData.parts.isEmpty())
            {
                int   partsKFreeValue = mData.parts.getFreeValue();
                int[] partsKKeys      = mData.parts.getKeys();
                int[] partsVValues    = mData.parts.getValues();
                for (int partsKI = partsKKeys.Length - 1; partsKI >= 0; --partsKI)
                {
                    int partsK = partsKKeys[partsKI];
                    if (partsK != partsKFreeValue)
                    {
                        int partsV = partsVValues[partsKI];
                        int partsW;
                        int partsU;
                        partsW = partsK;

                        partsU = partsV;

                        partsT.put(partsW, partsU);
                    }
                }
            }
        }
        else
        {
            this.parts = null;
            nullObjError("parts");
        }
    }
예제 #11
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        base.toCopy(data);

        if (!(data is GameAuctionToolData))
        {
            return;
        }

        GameAuctionToolData mData = (GameAuctionToolData)data;

        if (mData.itemPriceDic != null)
        {
            if (this.itemPriceDic != null)
            {
                this.itemPriceDic.clear();
                this.itemPriceDic.ensureCapacity(mData.itemPriceDic.size());
            }
            else
            {
                this.itemPriceDic = new IntIntMap(mData.itemPriceDic.size());
            }

            IntIntMap itemPriceDicT = this.itemPriceDic;
            if (!mData.itemPriceDic.isEmpty())
            {
                int   itemPriceDicKFreeValue = mData.itemPriceDic.getFreeValue();
                int[] itemPriceDicKKeys      = mData.itemPriceDic.getKeys();
                int[] itemPriceDicVValues    = mData.itemPriceDic.getValues();
                for (int itemPriceDicKI = itemPriceDicKKeys.Length - 1; itemPriceDicKI >= 0; --itemPriceDicKI)
                {
                    int itemPriceDicK = itemPriceDicKKeys[itemPriceDicKI];
                    if (itemPriceDicK != itemPriceDicKFreeValue)
                    {
                        int itemPriceDicV = itemPriceDicVValues[itemPriceDicKI];
                        int itemPriceDicW;
                        int itemPriceDicU;
                        itemPriceDicW = itemPriceDicK;

                        itemPriceDicU = itemPriceDicV;

                        itemPriceDicT.put(itemPriceDicW, itemPriceDicU);
                    }
                }
            }
        }
        else
        {
            this.itemPriceDic = null;
            nullObjError("itemPriceDic");
        }
    }
예제 #12
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is RoleAttributeData))
        {
            return;
        }

        RoleAttributeData mData = (RoleAttributeData)data;

        if (mData.attributes != null)
        {
            if (this.attributes != null)
            {
                this.attributes.clear();
                this.attributes.ensureCapacity(mData.attributes.size());
            }
            else
            {
                this.attributes = new IntIntMap(mData.attributes.size());
            }

            IntIntMap attributesT = this.attributes;
            if (!mData.attributes.isEmpty())
            {
                int   attributesKFreeValue = mData.attributes.getFreeValue();
                int[] attributesKKeys      = mData.attributes.getKeys();
                int[] attributesVValues    = mData.attributes.getValues();
                for (int attributesKI = attributesKKeys.Length - 1; attributesKI >= 0; --attributesKI)
                {
                    int attributesK = attributesKKeys[attributesKI];
                    if (attributesK != attributesKFreeValue)
                    {
                        int attributesV = attributesVValues[attributesKI];
                        int attributesW;
                        int attributesU;
                        attributesW = attributesK;

                        attributesU = attributesV;

                        attributesT.put(attributesW, attributesU);
                    }
                }
            }
        }
        else
        {
            this.attributes = null;
            nullObjError("attributes");
        }
    }
예제 #13
0
    /** 移除特效 */
    public void removeEffect(int id)
    {
        int num = _effectNumDic.get(id);

        if (num <= 0)
        {
            return;
        }

        _effectNumDic.put(id, --num);

        EffectConfig config = EffectConfig.get(id);

        //还超
        if (config.plusMax > 0 && num >= config.plusMax)
        {
            return;
        }

        SList <UnitEffect> unitEffects = _effectList;
        UnitEffect         effect;

        for (int i = 0, len = unitEffects.length(); i < len; ++i)
        {
            effect = unitEffects[i];

            //是
            if (effect.id == id)
            {
                unitEffects.remove(i);
                effect.dispose();
                GameC.pool.unitEffectPool.back(effect);
                break;
            }
        }
    }
예제 #14
0
    /** 设置部件 */
    public void setPart(int type, int partID)
    {
        //空部件不处理
        if (partID <= 0)
        {
            return;
        }

        _partDic.put(type, partID);

        _partReady.remove(type);

        AssetPoolLoadTool tool = getPartLoadTool(type);

        AvatarPartConfig config = AvatarPartConfig.get(type, partID);

        tool.loadOne(config.sourceT, obj => partLoadOver(type, partID, obj));
    }
예제 #15
0
    public void writeForCopy()
    {
        doRefresh();

        IntIntMap dic = _attributesDataDic;

        dic.clear();

        int[] attributes = _attributes;
        int   v;

        for (int i = attributes.Length - 1; i >= 0; --i)
        {
            if ((v = (attributes[i])) != 0)
            {
                dic.put(i, v);
            }
        }
    }
예제 #16
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        this.instanceID = stream.readInt();

        this.identity = (UnitIdentityData)stream.readDataSimpleNotNull();

        if (stream.readBoolean())
        {
            this.pos = (UnitPosData)stream.readDataSimpleNotNull();
        }
        else
        {
            this.pos = null;
        }

        int attributesLen = stream.readLen();

        if (this.attributes != null)
        {
            this.attributes.clear();
            this.attributes.ensureCapacity(attributesLen);
        }
        else
        {
            this.attributes = new IntIntMap(attributesLen);
        }

        IntIntMap attributesT = this.attributes;

        for (int attributesI = attributesLen - 1; attributesI >= 0; --attributesI)
        {
            int attributesK;
            int attributesV;
            attributesK = stream.readInt();

            attributesV = stream.readInt();

            attributesT.put(attributesK, attributesV);
        }
    }
예제 #17
0
    public void setData(UnitAvatarData data)
    {
        _data = data;

        if (data != null)
        {
            _lastDispatchModelID = data.modelID;

            int[]       nowParts       = _nowParts;
            IntIntMap[] normalPartsDic = _normalPartsDic;

            (_dataParts = data.parts).forEach((k, v) =>
            {
                IntIntMap map = new IntIntMap();
                map.put(v, 1);
                normalPartsDic[k] = map;
                nowParts[k]       = v;
            });
        }
        else
        {
            _dataParts = null;
        }
    }
예제 #18
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        int statusLen = stream.readLen();

        if (this.status != null)
        {
            this.status.clear();
            this.status.ensureCapacity(statusLen);
        }
        else
        {
            this.status = new IntBooleanMap(statusLen);
        }

        IntBooleanMap statusT = this.status;

        for (int statusI = statusLen - 1; statusI >= 0; --statusI)
        {
            int  statusK;
            bool statusV;
            statusK = stream.readInt();

            statusV = stream.readBoolean();

            statusT.put(statusK, statusV);
        }

        int attributesLen = stream.readLen();

        if (this.attributes != null)
        {
            this.attributes.clear();
            this.attributes.ensureCapacity(attributesLen);
        }
        else
        {
            this.attributes = new IntIntMap(attributesLen);
        }

        IntIntMap attributesT = this.attributes;

        for (int attributesI = attributesLen - 1; attributesI >= 0; --attributesI)
        {
            int attributesK;
            int attributesV;
            attributesK = stream.readInt();

            attributesV = stream.readInt();

            attributesT.put(attributesK, attributesV);
        }

        int skillsLen = stream.readLen();

        if (this.skills != null)
        {
            this.skills.clear();
            this.skills.ensureCapacity(skillsLen);
        }
        else
        {
            this.skills = new IntObjectMap <SkillData>(skillsLen);
        }

        IntObjectMap <SkillData> skillsT = this.skills;

        for (int skillsI = skillsLen - 1; skillsI >= 0; --skillsI)
        {
            SkillData skillsV;
            skillsV = (SkillData)stream.readDataSimpleNotNull();

            skillsT.put(skillsV.id, skillsV);
        }

        int buffsLen = stream.readLen();

        if (this.buffs != null)
        {
            this.buffs.clear();
            this.buffs.ensureCapacity(buffsLen);
        }
        else
        {
            this.buffs = new IntObjectMap <BuffData>(buffsLen);
        }

        IntObjectMap <BuffData> buffsT = this.buffs;

        for (int buffsI = buffsLen - 1; buffsI >= 0; --buffsI)
        {
            BuffData buffsV;
            buffsV = (BuffData)stream.readDataSimpleNotNull();

            buffsT.put(buffsV.instanceID, buffsV);
        }

        int cdsLen = stream.readLen();

        if (this.cds != null)
        {
            this.cds.clear();
            this.cds.ensureCapacity(cdsLen);
        }
        else
        {
            this.cds = new IntObjectMap <CDData>(cdsLen);
        }

        IntObjectMap <CDData> cdsT = this.cds;

        for (int cdsI = cdsLen - 1; cdsI >= 0; --cdsI)
        {
            CDData cdsV;
            cdsV = (CDData)stream.createData(CDData.dataID);
            cdsV.readBytesSimple(stream);

            cdsT.put(cdsV.id, cdsV);
        }
    }
예제 #19
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        this.clientTaskInstanceIDIndex = stream.readInt();

        int acceptsLen = stream.readLen();

        if (this.accepts != null)
        {
            this.accepts.clear();
            this.accepts.ensureCapacity(acceptsLen);
        }
        else
        {
            this.accepts = new IntObjectMap <QuestData>(acceptsLen);
        }

        IntObjectMap <QuestData> acceptsT = this.accepts;

        for (int acceptsI = acceptsLen - 1; acceptsI >= 0; --acceptsI)
        {
            QuestData acceptsV;
            BaseData  acceptsVT = stream.readDataFullNotNull();
            if (acceptsVT != null)
            {
                if (acceptsVT is QuestData)
                {
                    acceptsV = (QuestData)acceptsVT;
                }
                else
                {
                    acceptsV = new QuestData();
                    if (!(acceptsVT.GetType().IsAssignableFrom(typeof(QuestData))))
                    {
                        stream.throwTypeReadError(typeof(QuestData), acceptsVT.GetType());
                    }
                    acceptsV.shadowCopy(acceptsVT);
                }
            }
            else
            {
                acceptsV = null;
            }

            acceptsT.put(acceptsV.id, acceptsV);
        }

        int completeLinesLen = stream.readLen();

        if (this.completeLines != null)
        {
            this.completeLines.clear();
            this.completeLines.ensureCapacity(completeLinesLen);
        }
        else
        {
            this.completeLines = new IntIntMap(completeLinesLen);
        }

        IntIntMap completeLinesT = this.completeLines;

        for (int completeLinesI = completeLinesLen - 1; completeLinesI >= 0; --completeLinesI)
        {
            int completeLinesK;
            int completeLinesV;
            completeLinesK = stream.readInt();

            completeLinesV = stream.readInt();

            completeLinesT.put(completeLinesK, completeLinesV);
        }

        int completeIDsLen = stream.readLen();

        if (this.completeIDs != null)
        {
            this.completeIDs.clear();
            this.completeIDs.ensureCapacity(completeIDsLen);
        }
        else
        {
            this.completeIDs = new IntSet();
        }

        IntSet completeIDsT = this.completeIDs;

        for (int completeIDsI = completeIDsLen - 1; completeIDsI >= 0; --completeIDsI)
        {
            int completeIDsV;
            completeIDsV = stream.readInt();

            completeIDsT.add(completeIDsV);
        }

        int completeQuestsDicLen = stream.readLen();

        if (this.completeQuestsDic != null)
        {
            this.completeQuestsDic.clear();
            this.completeQuestsDic.ensureCapacity(completeQuestsDicLen);
        }
        else
        {
            this.completeQuestsDic = new IntObjectMap <QuestCompleteData>(completeQuestsDicLen);
        }

        IntObjectMap <QuestCompleteData> completeQuestsDicT = this.completeQuestsDic;

        for (int completeQuestsDicI = completeQuestsDicLen - 1; completeQuestsDicI >= 0; --completeQuestsDicI)
        {
            QuestCompleteData completeQuestsDicV;
            BaseData          completeQuestsDicVT = stream.readDataFullNotNull();
            if (completeQuestsDicVT != null)
            {
                if (completeQuestsDicVT is QuestCompleteData)
                {
                    completeQuestsDicV = (QuestCompleteData)completeQuestsDicVT;
                }
                else
                {
                    completeQuestsDicV = new QuestCompleteData();
                    if (!(completeQuestsDicVT.GetType().IsAssignableFrom(typeof(QuestCompleteData))))
                    {
                        stream.throwTypeReadError(typeof(QuestCompleteData), completeQuestsDicVT.GetType());
                    }
                    completeQuestsDicV.shadowCopy(completeQuestsDicVT);
                }
            }
            else
            {
                completeQuestsDicV = null;
            }

            completeQuestsDicT.put(completeQuestsDicV.id, completeQuestsDicV);
        }

        stream.endReadObj();
    }
예제 #20
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        int statusLen = stream.readLen();

        if (this.status != null)
        {
            this.status.clear();
            this.status.ensureCapacity(statusLen);
        }
        else
        {
            this.status = new IntBooleanMap(statusLen);
        }

        IntBooleanMap statusT = this.status;

        for (int statusI = statusLen - 1; statusI >= 0; --statusI)
        {
            int  statusK;
            bool statusV;
            statusK = stream.readInt();

            statusV = stream.readBoolean();

            statusT.put(statusK, statusV);
        }

        int attributesLen = stream.readLen();

        if (this.attributes != null)
        {
            this.attributes.clear();
            this.attributes.ensureCapacity(attributesLen);
        }
        else
        {
            this.attributes = new IntIntMap(attributesLen);
        }

        IntIntMap attributesT = this.attributes;

        for (int attributesI = attributesLen - 1; attributesI >= 0; --attributesI)
        {
            int attributesK;
            int attributesV;
            attributesK = stream.readInt();

            attributesV = stream.readInt();

            attributesT.put(attributesK, attributesV);
        }

        int skillsLen = stream.readLen();

        if (this.skills != null)
        {
            this.skills.clear();
            this.skills.ensureCapacity(skillsLen);
        }
        else
        {
            this.skills = new IntObjectMap <SkillData>(skillsLen);
        }

        IntObjectMap <SkillData> skillsT = this.skills;

        for (int skillsI = skillsLen - 1; skillsI >= 0; --skillsI)
        {
            SkillData skillsV;
            BaseData  skillsVT = stream.readDataFullNotNull();
            if (skillsVT != null)
            {
                if (skillsVT is SkillData)
                {
                    skillsV = (SkillData)skillsVT;
                }
                else
                {
                    skillsV = new SkillData();
                    if (!(skillsVT.GetType().IsAssignableFrom(typeof(SkillData))))
                    {
                        stream.throwTypeReadError(typeof(SkillData), skillsVT.GetType());
                    }
                    skillsV.shadowCopy(skillsVT);
                }
            }
            else
            {
                skillsV = null;
            }

            skillsT.put(skillsV.id, skillsV);
        }

        int buffsLen = stream.readLen();

        if (this.buffs != null)
        {
            this.buffs.clear();
            this.buffs.ensureCapacity(buffsLen);
        }
        else
        {
            this.buffs = new IntObjectMap <BuffData>(buffsLen);
        }

        IntObjectMap <BuffData> buffsT = this.buffs;

        for (int buffsI = buffsLen - 1; buffsI >= 0; --buffsI)
        {
            BuffData buffsV;
            BaseData buffsVT = stream.readDataFullNotNull();
            if (buffsVT != null)
            {
                if (buffsVT is BuffData)
                {
                    buffsV = (BuffData)buffsVT;
                }
                else
                {
                    buffsV = new BuffData();
                    if (!(buffsVT.GetType().IsAssignableFrom(typeof(BuffData))))
                    {
                        stream.throwTypeReadError(typeof(BuffData), buffsVT.GetType());
                    }
                    buffsV.shadowCopy(buffsVT);
                }
            }
            else
            {
                buffsV = null;
            }

            buffsT.put(buffsV.instanceID, buffsV);
        }

        int cdsLen = stream.readLen();

        if (this.cds != null)
        {
            this.cds.clear();
            this.cds.ensureCapacity(cdsLen);
        }
        else
        {
            this.cds = new IntObjectMap <CDData>(cdsLen);
        }

        IntObjectMap <CDData> cdsT = this.cds;

        for (int cdsI = cdsLen - 1; cdsI >= 0; --cdsI)
        {
            CDData cdsV;
            cdsV = (CDData)stream.createData(CDData.dataID);
            cdsV.readBytesFull(stream);

            cdsT.put(cdsV.id, cdsV);
        }

        stream.endReadObj();
    }
예제 #21
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is UnitFightData))
        {
            return;
        }

        UnitFightData mData = (UnitFightData)data;

        if (mData.status != null)
        {
            if (this.status != null)
            {
                this.status.clear();
                this.status.ensureCapacity(mData.status.size());
            }
            else
            {
                this.status = new IntBooleanMap(mData.status.size());
            }

            IntBooleanMap statusT = this.status;
            if (!mData.status.isEmpty())
            {
                int    statusKFreeValue = mData.status.getFreeValue();
                int[]  statusKKeys      = mData.status.getKeys();
                bool[] statusVValues    = mData.status.getValues();
                for (int statusKI = statusKKeys.Length - 1; statusKI >= 0; --statusKI)
                {
                    int statusK = statusKKeys[statusKI];
                    if (statusK != statusKFreeValue)
                    {
                        bool statusV = statusVValues[statusKI];
                        int  statusW;
                        bool statusU;
                        statusW = statusK;

                        statusU = statusV;

                        statusT.put(statusW, statusU);
                    }
                }
            }
        }
        else
        {
            this.status = null;
            nullObjError("status");
        }

        if (mData.attributes != null)
        {
            if (this.attributes != null)
            {
                this.attributes.clear();
                this.attributes.ensureCapacity(mData.attributes.size());
            }
            else
            {
                this.attributes = new IntIntMap(mData.attributes.size());
            }

            IntIntMap attributesT = this.attributes;
            if (!mData.attributes.isEmpty())
            {
                int   attributesKFreeValue = mData.attributes.getFreeValue();
                int[] attributesKKeys      = mData.attributes.getKeys();
                int[] attributesVValues    = mData.attributes.getValues();
                for (int attributesKI = attributesKKeys.Length - 1; attributesKI >= 0; --attributesKI)
                {
                    int attributesK = attributesKKeys[attributesKI];
                    if (attributesK != attributesKFreeValue)
                    {
                        int attributesV = attributesVValues[attributesKI];
                        int attributesW;
                        int attributesU;
                        attributesW = attributesK;

                        attributesU = attributesV;

                        attributesT.put(attributesW, attributesU);
                    }
                }
            }
        }
        else
        {
            this.attributes = null;
            nullObjError("attributes");
        }

        if (mData.skills != null)
        {
            if (this.skills != null)
            {
                this.skills.clear();
                this.skills.ensureCapacity(mData.skills.size());
            }
            else
            {
                this.skills = new IntObjectMap <SkillData>(mData.skills.size());
            }

            IntObjectMap <SkillData> skillsT = this.skills;
            if (!mData.skills.isEmpty())
            {
                SkillData[] skillsVValues = mData.skills.getValues();
                for (int skillsVI = skillsVValues.Length - 1; skillsVI >= 0; --skillsVI)
                {
                    SkillData skillsV = skillsVValues[skillsVI];
                    if (skillsV != null)
                    {
                        SkillData skillsU;
                        if (skillsV != null)
                        {
                            skillsU = (SkillData)skillsV.clone();
                        }
                        else
                        {
                            skillsU = null;
                            nullObjError("skillsU");
                        }

                        skillsT.put(skillsU.id, skillsU);
                    }
                }
            }
        }
        else
        {
            this.skills = null;
            nullObjError("skills");
        }

        if (mData.buffs != null)
        {
            if (this.buffs != null)
            {
                this.buffs.clear();
                this.buffs.ensureCapacity(mData.buffs.size());
            }
            else
            {
                this.buffs = new IntObjectMap <BuffData>(mData.buffs.size());
            }

            IntObjectMap <BuffData> buffsT = this.buffs;
            if (!mData.buffs.isEmpty())
            {
                BuffData[] buffsVValues = mData.buffs.getValues();
                for (int buffsVI = buffsVValues.Length - 1; buffsVI >= 0; --buffsVI)
                {
                    BuffData buffsV = buffsVValues[buffsVI];
                    if (buffsV != null)
                    {
                        BuffData buffsU;
                        if (buffsV != null)
                        {
                            buffsU = (BuffData)buffsV.clone();
                        }
                        else
                        {
                            buffsU = null;
                            nullObjError("buffsU");
                        }

                        buffsT.put(buffsU.instanceID, buffsU);
                    }
                }
            }
        }
        else
        {
            this.buffs = null;
            nullObjError("buffs");
        }

        if (mData.cds != null)
        {
            if (this.cds != null)
            {
                this.cds.clear();
                this.cds.ensureCapacity(mData.cds.size());
            }
            else
            {
                this.cds = new IntObjectMap <CDData>(mData.cds.size());
            }

            IntObjectMap <CDData> cdsT = this.cds;
            if (!mData.cds.isEmpty())
            {
                CDData[] cdsVValues = mData.cds.getValues();
                for (int cdsVI = cdsVValues.Length - 1; cdsVI >= 0; --cdsVI)
                {
                    CDData cdsV = cdsVValues[cdsVI];
                    if (cdsV != null)
                    {
                        CDData cdsU;
                        if (cdsV != null)
                        {
                            cdsU = (CDData)BytesControl.createData(CDData.dataID);
                            cdsU.copy(cdsV);
                        }
                        else
                        {
                            cdsU = null;
                            nullObjError("cdsU");
                        }

                        cdsT.put(cdsU.id, cdsU);
                    }
                }
            }
        }
        else
        {
            this.cds = null;
            nullObjError("cds");
        }
    }
예제 #22
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        int currentAttributesLen = stream.readLen();

        if (this.currentAttributes != null)
        {
            this.currentAttributes.clear();
            this.currentAttributes.ensureCapacity(currentAttributesLen);
        }
        else
        {
            this.currentAttributes = new IntIntMap(currentAttributesLen);
        }

        IntIntMap currentAttributesT = this.currentAttributes;

        for (int currentAttributesI = currentAttributesLen - 1; currentAttributesI >= 0; --currentAttributesI)
        {
            int currentAttributesK;
            int currentAttributesV;
            currentAttributesK = stream.readInt();

            currentAttributesV = stream.readInt();

            currentAttributesT.put(currentAttributesK, currentAttributesV);
        }

        int buffsLen = stream.readLen();

        if (this.buffs != null)
        {
            this.buffs.clear();
            this.buffs.ensureCapacity(buffsLen);
        }
        else
        {
            this.buffs = new IntObjectMap <BuffData>(buffsLen);
        }

        IntObjectMap <BuffData> buffsT = this.buffs;

        for (int buffsI = buffsLen - 1; buffsI >= 0; --buffsI)
        {
            BuffData buffsV;
            BaseData buffsVT = stream.readDataFullNotNull();
            if (buffsVT != null)
            {
                if (buffsVT is BuffData)
                {
                    buffsV = (BuffData)buffsVT;
                }
                else
                {
                    buffsV = new BuffData();
                    if (!(buffsVT.GetType().IsAssignableFrom(typeof(BuffData))))
                    {
                        stream.throwTypeReadError(typeof(BuffData), buffsVT.GetType());
                    }
                    buffsV.shadowCopy(buffsVT);
                }
            }
            else
            {
                buffsV = null;
            }

            buffsT.put(buffsV.instanceID, buffsV);
        }

        int cdsLen = stream.readLen();

        if (this.cds != null)
        {
            this.cds.clear();
            this.cds.ensureCapacity(cdsLen);
        }
        else
        {
            this.cds = new IntObjectMap <CDData>(cdsLen);
        }

        IntObjectMap <CDData> cdsT = this.cds;

        for (int cdsI = cdsLen - 1; cdsI >= 0; --cdsI)
        {
            CDData cdsV;
            cdsV = (CDData)stream.createData(CDData.dataID);
            cdsV.readBytesFull(stream);

            cdsT.put(cdsV.id, cdsV);
        }

        this.cacheTime = stream.readLong();

        stream.endReadObj();
    }
예제 #23
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        this.way = stream.readInt();

        if (stream.readBoolean())
        {
            int autoUseItemsLen = stream.readLen();
            if (this.autoUseItems != null)
            {
                this.autoUseItems.clear();
                this.autoUseItems.ensureCapacity(autoUseItemsLen);
            }
            else
            {
                this.autoUseItems = new IntIntMap(autoUseItemsLen);
            }

            IntIntMap autoUseItemsT = this.autoUseItems;
            for (int autoUseItemsI = autoUseItemsLen - 1; autoUseItemsI >= 0; --autoUseItemsI)
            {
                int autoUseItemsK;
                int autoUseItemsV;
                autoUseItemsK = stream.readInt();

                autoUseItemsV = stream.readInt();

                autoUseItemsT.put(autoUseItemsK, autoUseItemsV);
            }
        }
        else
        {
            this.autoUseItems = null;
        }

        if (stream.readBoolean())
        {
            int itemsLen = stream.readLen();
            if (this.items != null)
            {
                this.items.clear();
                this.items.ensureCapacity(itemsLen);
            }
            else
            {
                this.items = new IntObjectMap <ItemData>(itemsLen);
            }

            IntObjectMap <ItemData> itemsT = this.items;
            for (int itemsI = itemsLen - 1; itemsI >= 0; --itemsI)
            {
                int      itemsK;
                ItemData itemsV;
                itemsK = stream.readInt();

                if (stream.readBoolean())
                {
                    itemsV = (ItemData)stream.readDataSimpleNotNull();
                }
                else
                {
                    itemsV = null;
                }

                itemsT.put(itemsK, itemsV);
            }
        }
        else
        {
            this.items = null;
        }
    }
예제 #24
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is MUnitCacheData))
        {
            return;
        }

        MUnitCacheData mData = (MUnitCacheData)data;

        if (mData.currentAttributes != null)
        {
            if (this.currentAttributes != null)
            {
                this.currentAttributes.clear();
                this.currentAttributes.ensureCapacity(mData.currentAttributes.size());
            }
            else
            {
                this.currentAttributes = new IntIntMap(mData.currentAttributes.size());
            }

            IntIntMap currentAttributesT = this.currentAttributes;
            if (!mData.currentAttributes.isEmpty())
            {
                int   currentAttributesKFreeValue = mData.currentAttributes.getFreeValue();
                int[] currentAttributesKKeys      = mData.currentAttributes.getKeys();
                int[] currentAttributesVValues    = mData.currentAttributes.getValues();
                for (int currentAttributesKI = currentAttributesKKeys.Length - 1; currentAttributesKI >= 0; --currentAttributesKI)
                {
                    int currentAttributesK = currentAttributesKKeys[currentAttributesKI];
                    if (currentAttributesK != currentAttributesKFreeValue)
                    {
                        int currentAttributesV = currentAttributesVValues[currentAttributesKI];
                        int currentAttributesW;
                        int currentAttributesU;
                        currentAttributesW = currentAttributesK;

                        currentAttributesU = currentAttributesV;

                        currentAttributesT.put(currentAttributesW, currentAttributesU);
                    }
                }
            }
        }
        else
        {
            this.currentAttributes = null;
            nullObjError("currentAttributes");
        }

        if (mData.buffs != null)
        {
            if (this.buffs != null)
            {
                this.buffs.clear();
                this.buffs.ensureCapacity(mData.buffs.size());
            }
            else
            {
                this.buffs = new IntObjectMap <BuffData>(mData.buffs.size());
            }

            IntObjectMap <BuffData> buffsT = this.buffs;
            if (!mData.buffs.isEmpty())
            {
                BuffData[] buffsVValues = mData.buffs.getValues();
                for (int buffsVI = buffsVValues.Length - 1; buffsVI >= 0; --buffsVI)
                {
                    BuffData buffsV = buffsVValues[buffsVI];
                    if (buffsV != null)
                    {
                        BuffData buffsU;
                        if (buffsV != null)
                        {
                            buffsU = (BuffData)buffsV.clone();
                        }
                        else
                        {
                            buffsU = null;
                            nullObjError("buffsU");
                        }

                        buffsT.put(buffsU.instanceID, buffsU);
                    }
                }
            }
        }
        else
        {
            this.buffs = null;
            nullObjError("buffs");
        }

        if (mData.cds != null)
        {
            if (this.cds != null)
            {
                this.cds.clear();
                this.cds.ensureCapacity(mData.cds.size());
            }
            else
            {
                this.cds = new IntObjectMap <CDData>(mData.cds.size());
            }

            IntObjectMap <CDData> cdsT = this.cds;
            if (!mData.cds.isEmpty())
            {
                CDData[] cdsVValues = mData.cds.getValues();
                for (int cdsVI = cdsVValues.Length - 1; cdsVI >= 0; --cdsVI)
                {
                    CDData cdsV = cdsVValues[cdsVI];
                    if (cdsV != null)
                    {
                        CDData cdsU;
                        if (cdsV != null)
                        {
                            cdsU = (CDData)BytesControl.createData(CDData.dataID);
                            cdsU.copy(cdsV);
                        }
                        else
                        {
                            cdsU = null;
                            nullObjError("cdsU");
                        }

                        cdsT.put(cdsU.id, cdsU);
                    }
                }
            }
        }
        else
        {
            this.cds = null;
            nullObjError("cds");
        }

        this.cacheTime = mData.cacheTime;
    }
예제 #25
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        int currentAttributesLen = stream.readLen();

        if (this.currentAttributes != null)
        {
            this.currentAttributes.clear();
            this.currentAttributes.ensureCapacity(currentAttributesLen);
        }
        else
        {
            this.currentAttributes = new IntIntMap(currentAttributesLen);
        }

        IntIntMap currentAttributesT = this.currentAttributes;

        for (int currentAttributesI = currentAttributesLen - 1; currentAttributesI >= 0; --currentAttributesI)
        {
            int currentAttributesK;
            int currentAttributesV;
            currentAttributesK = stream.readInt();

            currentAttributesV = stream.readInt();

            currentAttributesT.put(currentAttributesK, currentAttributesV);
        }

        int buffsLen = stream.readLen();

        if (this.buffs != null)
        {
            this.buffs.clear();
            this.buffs.ensureCapacity(buffsLen);
        }
        else
        {
            this.buffs = new IntObjectMap <BuffData>(buffsLen);
        }

        IntObjectMap <BuffData> buffsT = this.buffs;

        for (int buffsI = buffsLen - 1; buffsI >= 0; --buffsI)
        {
            BuffData buffsV;
            buffsV = (BuffData)stream.readDataSimpleNotNull();

            buffsT.put(buffsV.instanceID, buffsV);
        }

        int cdsLen = stream.readLen();

        if (this.cds != null)
        {
            this.cds.clear();
            this.cds.ensureCapacity(cdsLen);
        }
        else
        {
            this.cds = new IntObjectMap <CDData>(cdsLen);
        }

        IntObjectMap <CDData> cdsT = this.cds;

        for (int cdsI = cdsLen - 1; cdsI >= 0; --cdsI)
        {
            CDData cdsV;
            cdsV = (CDData)stream.createData(CDData.dataID);
            cdsV.readBytesSimple(stream);

            cdsT.put(cdsV.id, cdsV);
        }

        this.cacheTime = stream.readLong();
    }
예제 #26
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        base.toReadBytesFull(stream);

        stream.startReadObj();

        this.way = stream.readInt();

        if (stream.readBoolean())
        {
            int autoUseItemsLen = stream.readLen();
            if (this.autoUseItems != null)
            {
                this.autoUseItems.clear();
                this.autoUseItems.ensureCapacity(autoUseItemsLen);
            }
            else
            {
                this.autoUseItems = new IntIntMap(autoUseItemsLen);
            }

            IntIntMap autoUseItemsT = this.autoUseItems;
            for (int autoUseItemsI = autoUseItemsLen - 1; autoUseItemsI >= 0; --autoUseItemsI)
            {
                int autoUseItemsK;
                int autoUseItemsV;
                autoUseItemsK = stream.readInt();

                autoUseItemsV = stream.readInt();

                autoUseItemsT.put(autoUseItemsK, autoUseItemsV);
            }
        }
        else
        {
            this.autoUseItems = null;
        }

        if (stream.readBoolean())
        {
            int itemsLen = stream.readLen();
            if (this.items != null)
            {
                this.items.clear();
                this.items.ensureCapacity(itemsLen);
            }
            else
            {
                this.items = new IntObjectMap <ItemData>(itemsLen);
            }

            IntObjectMap <ItemData> itemsT = this.items;
            for (int itemsI = itemsLen - 1; itemsI >= 0; --itemsI)
            {
                int      itemsK;
                ItemData itemsV;
                itemsK = stream.readInt();

                if (stream.readBoolean())
                {
                    BaseData itemsVT = stream.readDataFullNotNull();
                    if (itemsVT != null)
                    {
                        if (itemsVT is ItemData)
                        {
                            itemsV = (ItemData)itemsVT;
                        }
                        else
                        {
                            itemsV = new ItemData();
                            if (!(itemsVT.GetType().IsAssignableFrom(typeof(ItemData))))
                            {
                                stream.throwTypeReadError(typeof(ItemData), itemsVT.GetType());
                            }
                            itemsV.shadowCopy(itemsVT);
                        }
                    }
                    else
                    {
                        itemsV = null;
                    }
                }
                else
                {
                    itemsV = null;
                }

                itemsT.put(itemsK, itemsV);
            }
        }
        else
        {
            this.items = null;
        }

        stream.endReadObj();
    }
예제 #27
0
    //buff响应

    /** 执行单个动作 */
    protected virtual void doOneAction(BuffData data, int index, int[] args, bool isAdd, bool isFull)
    {
        bool isDriveAll = _parent.isDriveAll();

        switch (args[0])
        {
        case BuffActionType.AddStatus:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            if (isAdd)
            {
                _parent.status.addStatus(args[1]);
            }
            else
            {
                _parent.status.subStatus(args[1]);
            }
        }
        break;

        case BuffActionType.AddAttribute:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            _parent.attribute.addOneAttribute(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.AddAttributeVar:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            if (isAdd)
            {
                int value = _parent.getSkillVarValueT(args[2], data.adderInstanceID);

                _parent.attribute.addOneAttribute(args[1], value);

                _attributeVarDic.put(data.instanceID << CommonSetting.buffActionIndexOff | index, value);
            }
            else
            {
                int value = _attributeVarDic.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                _parent.attribute.subOneAttribute(args[1], value);
            }
        }
        break;

        case BuffActionType.IntervalMakeAttack:
        {
            //不是客户端驱动战斗
//				if(!SceneDriveType.isClientDriveAttackHapen(CommonSetting.sceneDriveType))
//					return;

            //不是客户端驱动战斗
            if (!_parent.isSelfDriveAttackHapen())
            {
                return;
            }

            if (isAdd)
            {
                BuffIntervalActionData mData = GameC.pool.buffIntervalActionDataPool.getOne();
                mData.adderInstanceID = data.adderInstanceID;
                mData.readFromConfig(args);

                mData.type = BuffIntervalActionType.Attack;

                Unit selfUnit = _parent.getUnit();

                UnitFightDataLogic attackerLogic = null;

                if (data.adderInstanceID == -1)
                {
                    attackerLogic = _parent;
                }
                else
                {
                    Unit attacker;

                    if (selfUnit != null && (attacker = selfUnit.getScene().getFightUnit(data.adderInstanceID)) != null)
                    {
                        attackerLogic = attacker.fight.getDataLogic();
                    }
                }

                //存在再添加
                if ((args.Length > 4 && args[4] > 0) && attackerLogic != null)
                {
                    mData.calculateSelfAttackValue(attackerLogic);
                }

                _intervalActions.put(data.instanceID << CommonSetting.buffActionIndexOff | index, mData);
            }
            else
            {
                BuffIntervalActionData mData = _intervalActions.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                if (mData == null)
                {
                    Ctrl.throwError("不该找不到BuffIntervalActionData");
                }
                else
                {
                    GameC.pool.buffIntervalActionDataPool.back(mData);
                }
            }
        }
        break;

        case BuffActionType.AddGroupCDTimeMaxPercent:
        {
            if (!isDriveAll)
            {
                return;
            }

            _parent.cd.addGroupTimeMaxPercent(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.AddGroupCDTimeMaxValue:
        {
            if (!isDriveAll)
            {
                return;
            }

            _parent.cd.addGroupTimeMaxValue(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.AddSkillProb:
        {
            addSkillProb(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.ChangeFacade:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (isAdd)
            {
                _parent.avatar.addFacade(args[1]);
            }
            else
            {
                _parent.avatar.removeFacade(args[1]);
            }
        }
        break;

        case BuffActionType.AddAvatarPart:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (isAdd)
            {
                _parent.avatar.addPart(args[1], args[2]);
            }
            else
            {
                _parent.avatar.removePart(args[1], args[2]);
            }
        }
        break;

        case BuffActionType.AttackProbAction:
        {
            if (!isDriveAll)
            {
                return;
            }

            IntObjectMap <int[]> dic = _attackProbActions[args[1]];

            if (dic == null)
            {
                dic = new IntObjectMap <int[]>();
                _attackProbActions[args[1]] = dic;
            }

            if (isAdd)
            {
                dic.put(data.instanceID << CommonSetting.buffActionIndexOff | index, args);
            }
            else
            {
                dic.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);
            }
        }
        break;

        case BuffActionType.AddShield:
        case BuffActionType.AddShieldVar:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                Ctrl.throwError("不支持初始化添加护盾");
                return;
            }

            //盾同一个buff就存在一个,不然会互斥

            if (isAdd)
            {
                int value;

                if (args[0] == BuffActionType.AddShield)
                {
                    value = args[2];
                }
                else
                {
                    value = _parent.getSkillVarValueT(args[2], data.adderInstanceID);
                }

                //盾值
                _parent.attribute.addOneAttribute(args[1], value);

                _shieldBuffDic.computeIfAbsent(args[1], k => new SList <DIntData>()).add(DIntData.create(data.instanceID, value));
            }
            else
            {
                SList <DIntData> list = _shieldBuffDic.get(args[1]);
                DIntData         v;
                for (int i = 0, len = list.length(); i < len; ++i)
                {
                    if ((v = list.get(i)).key == data.instanceID)
                    {
                        //移除剩余盾值
                        if (v.value > 0)
                        {
                            _parent.attribute.subOneAttribute(args[1], v.value);
                        }

                        list.remove(i);
                        --len;
                        --i;
                    }
                }
            }
        }
        break;

        case BuffActionType.SkillReplace:
        {
            if (isAdd)
            {
                if (ShineSetting.openCheck)
                {
                    if (_skillReplaceDic.contains(args[1]))
                    {
                        Ctrl.throwError("目前,相同技能ID同时只支持一个替换技能");
                    }
                }

                _skillReplaceDic.put(args[1], args[2]);
            }
            else
            {
                _skillReplaceDic.remove(args[1]);
            }
        }
        break;

        case BuffActionType.SkillProbReplace:
        {
            SList <int[]> list = _skillProbReplaceDic.computeIfAbsent(args[1], k => new SList <int[]>());

            if (isAdd)
            {
                int[] a;

                for (int i = 0, len = list.length(); i < len; ++i)
                {
                    a = list.get(i);

                    if (compareSkillProbArgs(args, a) <= 0)
                    {
                        list.insert(i, args);
                        return;
                    }
                }

                list.add(args);
            }
            else
            {
                int[] a;

                for (int i = 0, len = list.length(); i < len; ++i)
                {
                    a = list.get(i);

                    if (args[2] == a[2] && args[3] == a[3])
                    {
                        list.remove(i);
                        break;
                    }
                }
            }
        }
        break;

        case BuffActionType.IntervalAddAttribute:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            if (isAdd)
            {
                BuffIntervalActionData mData = GameC.pool.buffIntervalActionDataPool.getOne();
                mData.type = BuffIntervalActionType.AddAttribute;
                mData.readFromConfig(args);

                _intervalActions.put(data.instanceID << CommonSetting.buffActionIndexOff | index, mData);
            }
            else
            {
                BuffIntervalActionData mData = _intervalActions.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                if (mData == null)
                {
                    Ctrl.throwError("不该找不到BuffIntervalActionData");
                }
                else
                {
                    GameC.pool.buffIntervalActionDataPool.back(mData);
                }
            }
        }
        break;

        case BuffActionType.IntervalAddAttributeVar:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            if (isAdd)
            {
                BuffIntervalActionData mData = GameC.pool.buffIntervalActionDataPool.getOne();
                mData.type = BuffIntervalActionType.AddAttributeVar;
                mData.readFromConfig(args);

                _intervalActions.put(data.instanceID << CommonSetting.buffActionIndexOff | index, mData);
            }
            else
            {
                BuffIntervalActionData mData = _intervalActions.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                if (mData == null)
                {
                    Ctrl.throwError("不该找不到BuffIntervalActionData");
                }
                else
                {
                    GameC.pool.buffIntervalActionDataPool.back(mData);
                }
            }
        }
        break;

        case BuffActionType.SkillLevelUp:
        {
            _skillLevelUpDic.addValue(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.AddBuffLastTime:
        {
            if (!isDriveAll)
            {
                return;
            }

            _buffLastTimeAddDic.addValue(args[1], isAdd ? args[2] : -args[2]);
        }
        break;

        case BuffActionType.BuffLevelUp:
        {
            if (!isDriveAll)
            {
                return;
            }

            int level = isAdd ? args[2] : -args[2];

            _buffLevelUpDic.addValue(args[1], level);

            //需要立即更新
            if (args.Length > 3 && args[3] > 0)
            {
                if (data.config.hasGroup(args[1]))
                {
                    Ctrl.throwError("不能影响自己所在组的buffLevel");
                    return;
                }

                refreshBuffLevelUp(args[1], level);
            }
        }
        break;

        case BuffActionType.AddAttributeRefreshVar:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            SkillVarConfig vConfig = SkillVarConfig.get(args[2]);

            foreach (int[] v in vConfig.args)
            {
                switch (v[0])
                {
                case SkillVarSourceType.SelfAttribute:
                case SkillVarSourceType.TargetAttribute:
                {
                    _addAttributeRefreshVarASet.addValue(v[1], isAdd ? 1 : -1);
                }
                break;

                case SkillVarSourceType.SelfCurrentAttributePercent:
                case SkillVarSourceType.TargetCurrentAttributePercent:
                case SkillVarSourceType.SelfCurrentAttributeLostPercent:
                case SkillVarSourceType.TargetCurrentAttributeLostPercent:
                {
                    //当前+max
                    _addAttributeRefreshVarASet.addValue(v[1], isAdd ? 1 : -1);
                    _addAttributeRefreshVarASet.addValue(AttributeControl.attribute.currentToMaxMap[v[1]], isAdd ? 1 : -1);
                }
                break;
                }
            }

            if (isAdd)
            {
                int value = _parent.getSkillVarValueT(vConfig.id, data.adderInstanceID);

                _parent.attribute.addOneAttribute(args[1], value);

                BuffAddAttributeRefreshVarData bData = new BuffAddAttributeRefreshVarData();
                bData.adderInstanceID = data.adderInstanceID;
                bData.varID           = vConfig.id;
                bData.type            = args[1];
                bData.value           = value;

                _attributeRefreshVarDic.put(data.instanceID << CommonSetting.buffActionIndexOff | index, bData);
            }
            else
            {
                BuffAddAttributeRefreshVarData bData = _attributeRefreshVarDic.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);

                _parent.attribute.subOneAttribute(args[1], bData.value);
            }
        }
        break;

        case BuffActionType.UseSkillProbAction:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (isAdd)
            {
                _useSkillProbActions.put(data.instanceID << CommonSetting.buffActionIndexOff | index, args);
            }
            else
            {
                _useSkillProbActions.remove(data.instanceID << CommonSetting.buffActionIndexOff | index);
            }
        }
        break;

        case BuffActionType.IgnoreBuffGroup:
        {
            if (!isDriveAll)
            {
                return;
            }

            if (!isFull)
            {
                return;
            }

            _ignoreBuffGroupDic.addValue(args[0], isAdd ? 1 : -1);

            if (isAdd)
            {
                removeBuffByGroup(args[0]);
            }
        }
        break;
        }
    }
예제 #28
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is KeepSaveData))
        {
            return;
        }

        KeepSaveData mData = (KeepSaveData)data;

        if (mData.booleanDic != null)
        {
            if (this.booleanDic != null)
            {
                this.booleanDic.clear();
                this.booleanDic.ensureCapacity(mData.booleanDic.size());
            }
            else
            {
                this.booleanDic = new IntBooleanMap(mData.booleanDic.size());
            }

            IntBooleanMap booleanDicT = this.booleanDic;
            if (!mData.booleanDic.isEmpty())
            {
                int    booleanDicKFreeValue = mData.booleanDic.getFreeValue();
                int[]  booleanDicKKeys      = mData.booleanDic.getKeys();
                bool[] booleanDicVValues    = mData.booleanDic.getValues();
                for (int booleanDicKI = booleanDicKKeys.Length - 1; booleanDicKI >= 0; --booleanDicKI)
                {
                    int booleanDicK = booleanDicKKeys[booleanDicKI];
                    if (booleanDicK != booleanDicKFreeValue)
                    {
                        bool booleanDicV = booleanDicVValues[booleanDicKI];
                        int  booleanDicW;
                        bool booleanDicU;
                        booleanDicW = booleanDicK;

                        booleanDicU = booleanDicV;

                        booleanDicT.put(booleanDicW, booleanDicU);
                    }
                }
            }
        }
        else
        {
            this.booleanDic = null;
            nullObjError("booleanDic");
        }

        if (mData.intDic != null)
        {
            if (this.intDic != null)
            {
                this.intDic.clear();
                this.intDic.ensureCapacity(mData.intDic.size());
            }
            else
            {
                this.intDic = new IntIntMap(mData.intDic.size());
            }

            IntIntMap intDicT = this.intDic;
            if (!mData.intDic.isEmpty())
            {
                int   intDicKFreeValue = mData.intDic.getFreeValue();
                int[] intDicKKeys      = mData.intDic.getKeys();
                int[] intDicVValues    = mData.intDic.getValues();
                for (int intDicKI = intDicKKeys.Length - 1; intDicKI >= 0; --intDicKI)
                {
                    int intDicK = intDicKKeys[intDicKI];
                    if (intDicK != intDicKFreeValue)
                    {
                        int intDicV = intDicVValues[intDicKI];
                        int intDicW;
                        int intDicU;
                        intDicW = intDicK;

                        intDicU = intDicV;

                        intDicT.put(intDicW, intDicU);
                    }
                }
            }
        }
        else
        {
            this.intDic = null;
            nullObjError("intDic");
        }

        if (mData.longDic != null)
        {
            if (this.longDic != null)
            {
                this.longDic.clear();
                this.longDic.ensureCapacity(mData.longDic.size());
            }
            else
            {
                this.longDic = new IntLongMap(mData.longDic.size());
            }

            IntLongMap longDicT = this.longDic;
            if (!mData.longDic.isEmpty())
            {
                int    longDicKFreeValue = mData.longDic.getFreeValue();
                int[]  longDicKKeys      = mData.longDic.getKeys();
                long[] longDicVValues    = mData.longDic.getValues();
                for (int longDicKI = longDicKKeys.Length - 1; longDicKI >= 0; --longDicKI)
                {
                    int longDicK = longDicKKeys[longDicKI];
                    if (longDicK != longDicKFreeValue)
                    {
                        long longDicV = longDicVValues[longDicKI];
                        int  longDicW;
                        long longDicU;
                        longDicW = longDicK;

                        longDicU = longDicV;

                        longDicT.put(longDicW, longDicU);
                    }
                }
            }
        }
        else
        {
            this.longDic = null;
            nullObjError("longDic");
        }

        if (mData.stringDic != null)
        {
            if (this.stringDic != null)
            {
                this.stringDic.clear();
                this.stringDic.ensureCapacity(mData.stringDic.size());
            }
            else
            {
                this.stringDic = new SMap <string, string>(mData.stringDic.size());
            }

            SMap <string, string> stringDicT = this.stringDic;
            if (!mData.stringDic.isEmpty())
            {
                string[] stringDicKKeys   = mData.stringDic.getKeys();
                string[] stringDicVValues = mData.stringDic.getValues();
                for (int stringDicKI = stringDicKKeys.Length - 1; stringDicKI >= 0; --stringDicKI)
                {
                    string stringDicK = stringDicKKeys[stringDicKI];
                    if (stringDicK != null)
                    {
                        string stringDicV = stringDicVValues[stringDicKI];
                        string stringDicW;
                        string stringDicU;
                        stringDicW = stringDicK;

                        stringDicU = stringDicV;

                        stringDicT.put(stringDicW, stringDicU);
                    }
                }
            }
        }
        else
        {
            this.stringDic = null;
            nullObjError("stringDic");
        }
    }
예제 #29
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        int booleanDicLen = stream.readLen();

        if (this.booleanDic != null)
        {
            this.booleanDic.clear();
            this.booleanDic.ensureCapacity(booleanDicLen);
        }
        else
        {
            this.booleanDic = new IntBooleanMap(booleanDicLen);
        }

        IntBooleanMap booleanDicT = this.booleanDic;

        for (int booleanDicI = booleanDicLen - 1; booleanDicI >= 0; --booleanDicI)
        {
            int  booleanDicK;
            bool booleanDicV;
            booleanDicK = stream.readInt();

            booleanDicV = stream.readBoolean();

            booleanDicT.put(booleanDicK, booleanDicV);
        }

        int intDicLen = stream.readLen();

        if (this.intDic != null)
        {
            this.intDic.clear();
            this.intDic.ensureCapacity(intDicLen);
        }
        else
        {
            this.intDic = new IntIntMap(intDicLen);
        }

        IntIntMap intDicT = this.intDic;

        for (int intDicI = intDicLen - 1; intDicI >= 0; --intDicI)
        {
            int intDicK;
            int intDicV;
            intDicK = stream.readInt();

            intDicV = stream.readInt();

            intDicT.put(intDicK, intDicV);
        }

        int longDicLen = stream.readLen();

        if (this.longDic != null)
        {
            this.longDic.clear();
            this.longDic.ensureCapacity(longDicLen);
        }
        else
        {
            this.longDic = new IntLongMap(longDicLen);
        }

        IntLongMap longDicT = this.longDic;

        for (int longDicI = longDicLen - 1; longDicI >= 0; --longDicI)
        {
            int  longDicK;
            long longDicV;
            longDicK = stream.readInt();

            longDicV = stream.readLong();

            longDicT.put(longDicK, longDicV);
        }

        int stringDicLen = stream.readLen();

        if (this.stringDic != null)
        {
            this.stringDic.clear();
            this.stringDic.ensureCapacity(stringDicLen);
        }
        else
        {
            this.stringDic = new SMap <string, string>(stringDicLen);
        }

        SMap <string, string> stringDicT = this.stringDic;

        for (int stringDicI = stringDicLen - 1; stringDicI >= 0; --stringDicI)
        {
            string stringDicK;
            string stringDicV;
            stringDicK = stream.readUTF();

            stringDicV = stream.readUTF();

            stringDicT.put(stringDicK, stringDicV);
        }

        stream.endReadObj();
    }
예제 #30
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        this.clientTaskInstanceIDIndex = stream.readInt();

        int acceptsLen = stream.readLen();

        if (this.accepts != null)
        {
            this.accepts.clear();
            this.accepts.ensureCapacity(acceptsLen);
        }
        else
        {
            this.accepts = new IntObjectMap <QuestData>(acceptsLen);
        }

        IntObjectMap <QuestData> acceptsT = this.accepts;

        for (int acceptsI = acceptsLen - 1; acceptsI >= 0; --acceptsI)
        {
            QuestData acceptsV;
            acceptsV = (QuestData)stream.readDataSimpleNotNull();

            acceptsT.put(acceptsV.id, acceptsV);
        }

        int completeLinesLen = stream.readLen();

        if (this.completeLines != null)
        {
            this.completeLines.clear();
            this.completeLines.ensureCapacity(completeLinesLen);
        }
        else
        {
            this.completeLines = new IntIntMap(completeLinesLen);
        }

        IntIntMap completeLinesT = this.completeLines;

        for (int completeLinesI = completeLinesLen - 1; completeLinesI >= 0; --completeLinesI)
        {
            int completeLinesK;
            int completeLinesV;
            completeLinesK = stream.readInt();

            completeLinesV = stream.readInt();

            completeLinesT.put(completeLinesK, completeLinesV);
        }

        int completeIDsLen = stream.readLen();

        if (this.completeIDs != null)
        {
            this.completeIDs.clear();
            this.completeIDs.ensureCapacity(completeIDsLen);
        }
        else
        {
            this.completeIDs = new IntSet();
        }

        IntSet completeIDsT = this.completeIDs;

        for (int completeIDsI = completeIDsLen - 1; completeIDsI >= 0; --completeIDsI)
        {
            int completeIDsV;
            completeIDsV = stream.readInt();

            completeIDsT.add(completeIDsV);
        }

        int completeQuestsDicLen = stream.readLen();

        if (this.completeQuestsDic != null)
        {
            this.completeQuestsDic.clear();
            this.completeQuestsDic.ensureCapacity(completeQuestsDicLen);
        }
        else
        {
            this.completeQuestsDic = new IntObjectMap <QuestCompleteData>(completeQuestsDicLen);
        }

        IntObjectMap <QuestCompleteData> completeQuestsDicT = this.completeQuestsDic;

        for (int completeQuestsDicI = completeQuestsDicLen - 1; completeQuestsDicI >= 0; --completeQuestsDicI)
        {
            QuestCompleteData completeQuestsDicV;
            completeQuestsDicV = (QuestCompleteData)stream.readDataSimpleNotNull();

            completeQuestsDicT.put(completeQuestsDicV.id, completeQuestsDicV);
        }
    }