예제 #1
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(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);
        }
    }
예제 #2
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.booleanDic = null;
     this.intDic     = null;
     this.longDic    = null;
     this.stringDic  = null;
 }
예제 #3
0
 /// <summary>
 /// 初始化初值
 /// </summary>
 public override void initDefault()
 {
     this.booleanDic = new IntBooleanMap();
     this.intDic     = new IntIntMap();
     this.longDic    = new IntLongMap();
     this.stringDic  = new SMap <string, string>();
 }
예제 #4
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.status     = null;
     this.attributes = null;
     this.skills     = null;
     this.buffs      = null;
     this.cds        = null;
 }
예제 #5
0
 /// <summary>
 /// 初始化初值
 /// </summary>
 public override void initDefault()
 {
     this.status     = new IntBooleanMap();
     this.attributes = new IntIntMap();
     this.skills     = new IntObjectMap <SkillData>();
     this.buffs      = new IntObjectMap <BuffData>();
     this.cds        = new IntObjectMap <CDData>();
 }
예제 #6
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is KeepSaveData))
        {
            return;
        }

        KeepSaveData mData = (KeepSaveData)data;

        this.booleanDic = mData.booleanDic;
        this.intDic     = mData.intDic;
        this.longDic    = mData.longDic;
        this.stringDic  = mData.stringDic;
    }
예제 #7
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is UnitFightData))
        {
            return;
        }

        UnitFightData mData = (UnitFightData)data;

        this.status     = mData.status;
        this.attributes = mData.attributes;
        this.skills     = mData.skills;
        this.buffs      = mData.buffs;
        this.cds        = mData.cds;
    }
예제 #8
0
    private void doRefreshStatus()
    {
        _dirty = false;

        int  type;
        bool value;
        int  num = 0;

        bool[] lastStatus   = _lastStatus;
        int[]  statusCounts = _statusCounts;
        int[]  changeList   = _changeList;
        bool[] changeSet    = _changeSet;

        int[] allList = _info.allList;

        IntBooleanMap sendSelfDic  = null;
        IntBooleanMap sendOtherDic = null;

        for (int i = allList.Length - 1; i >= 0; --i)
        {
            type = allList[i];

            if (lastStatus[type] != (value = statusCounts[type] > 0))
            {
                lastStatus[type] = value;

                changeList[num++] = type;
                changeSet[type]   = true;
            }
        }

        if (num > 0)
        {
            try
            {
                toDispatch(changeSet);
            }
            catch (Exception e)
            {
                Ctrl.errorLog(e);
            }

            for (int i = num - 1; i >= 0; --i)
            {
                changeSet[changeList[i]] = false;
            }
        }
    }
예제 #9
0
    /** 写入拷贝 */
    public void writeForCopy()
    {
        IntBooleanMap dic = _statusDataDic;

        dic.clear();

        int[] statusCounts = _statusCounts;

        for (int i = statusCounts.Length - 1; i >= 0; --i)
        {
            if (statusCounts[i] > 0)
            {
                dic.put(i, true);
            }
        }
    }
예제 #10
0
    /** 设置数据 */
    public void setData(IntBooleanMap dic)
    {
        _statusDataDic = dic;

        if (dic != null && !dic.isEmpty())
        {
            //statusCount由buff生成
            bool[] lastStatus   = _lastStatus;
            int[]  statusCounts = _statusCounts;

            dic.forEach((k, v) =>
            {
                statusCounts[k] = v ? 1 : 0;
                lastStatus[k]   = v;
            });

            _dirty = false;
        }
    }
예제 #11
0
    /** 服务器设置属性 */
    public void setStatusByServer(IntBooleanMap dic)
    {
        if (!dic.isEmpty())
        {
            int    num          = 0;
            bool[] lastStatus   = _lastStatus;
            int[]  statusCounts = _statusCounts;
            int[]  changeList   = _changeList;
            bool[] changeSet    = _changeSet;

            //TODO:继续

            foreach (var kv in dic.entrySet())
            {
                statusCounts[kv.key] = kv.value ? 1 : 0;
            }

            doRefreshStatus();
        }
    }
예제 #12
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        UnitFightData mData = (UnitFightData)data;

        if (mData.status != null)
        {
            if (this.status == null)
            {
                return(false);
            }
            if (this.status.size() != mData.status.size())
            {
                return(false);
            }
            IntBooleanMap statusR = mData.status;
            if (!this.status.isEmpty())
            {
                int    statusKFreeValue = this.status.getFreeValue();
                int[]  statusKKeys      = this.status.getKeys();
                bool[] statusVValues    = this.status.getValues();
                for (int statusKI = statusKKeys.Length - 1; statusKI >= 0; --statusKI)
                {
                    int statusK = statusKKeys[statusKI];
                    if (statusK != statusKFreeValue)
                    {
                        bool statusV = statusVValues[statusKI];
                        bool statusU = statusR.get(statusK);
                        if (statusV != statusU)
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        else
        {
            if (this.status != null)
            {
                return(false);
            }
        }

        if (mData.attributes != null)
        {
            if (this.attributes == null)
            {
                return(false);
            }
            if (this.attributes.size() != mData.attributes.size())
            {
                return(false);
            }
            IntIntMap attributesR = mData.attributes;
            if (!this.attributes.isEmpty())
            {
                int   attributesKFreeValue = this.attributes.getFreeValue();
                int[] attributesKKeys      = this.attributes.getKeys();
                int[] attributesVValues    = this.attributes.getValues();
                for (int attributesKI = attributesKKeys.Length - 1; attributesKI >= 0; --attributesKI)
                {
                    int attributesK = attributesKKeys[attributesKI];
                    if (attributesK != attributesKFreeValue)
                    {
                        int attributesV = attributesVValues[attributesKI];
                        int attributesU = attributesR.get(attributesK);
                        if (attributesV != attributesU)
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        else
        {
            if (this.attributes != null)
            {
                return(false);
            }
        }

        if (mData.skills != null)
        {
            if (this.skills == null)
            {
                return(false);
            }
            if (this.skills.size() != mData.skills.size())
            {
                return(false);
            }
            IntObjectMap <SkillData> skillsR = mData.skills;
            if (!this.skills.isEmpty())
            {
                int         skillsKFreeValue = this.skills.getFreeValue();
                int[]       skillsKKeys      = this.skills.getKeys();
                SkillData[] skillsVValues    = this.skills.getValues();
                for (int skillsKI = skillsKKeys.Length - 1; skillsKI >= 0; --skillsKI)
                {
                    int skillsK = skillsKKeys[skillsKI];
                    if (skillsK != skillsKFreeValue)
                    {
                        SkillData skillsV = skillsVValues[skillsKI];
                        SkillData skillsU = skillsR.get(skillsK);
                        if (skillsU != null)
                        {
                            if (skillsV == null)
                            {
                                return(false);
                            }
                            if (!skillsV.dataEquals(skillsU))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (skillsV != null)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (this.skills != null)
            {
                return(false);
            }
        }

        if (mData.buffs != null)
        {
            if (this.buffs == null)
            {
                return(false);
            }
            if (this.buffs.size() != mData.buffs.size())
            {
                return(false);
            }
            IntObjectMap <BuffData> buffsR = mData.buffs;
            if (!this.buffs.isEmpty())
            {
                int        buffsKFreeValue = this.buffs.getFreeValue();
                int[]      buffsKKeys      = this.buffs.getKeys();
                BuffData[] buffsVValues    = this.buffs.getValues();
                for (int buffsKI = buffsKKeys.Length - 1; buffsKI >= 0; --buffsKI)
                {
                    int buffsK = buffsKKeys[buffsKI];
                    if (buffsK != buffsKFreeValue)
                    {
                        BuffData buffsV = buffsVValues[buffsKI];
                        BuffData buffsU = buffsR.get(buffsK);
                        if (buffsU != null)
                        {
                            if (buffsV == null)
                            {
                                return(false);
                            }
                            if (!buffsV.dataEquals(buffsU))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (buffsV != null)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (this.buffs != null)
            {
                return(false);
            }
        }

        if (mData.cds != null)
        {
            if (this.cds == null)
            {
                return(false);
            }
            if (this.cds.size() != mData.cds.size())
            {
                return(false);
            }
            IntObjectMap <CDData> cdsR = mData.cds;
            if (!this.cds.isEmpty())
            {
                int      cdsKFreeValue = this.cds.getFreeValue();
                int[]    cdsKKeys      = this.cds.getKeys();
                CDData[] cdsVValues    = this.cds.getValues();
                for (int cdsKI = cdsKKeys.Length - 1; cdsKI >= 0; --cdsKI)
                {
                    int cdsK = cdsKKeys[cdsKI];
                    if (cdsK != cdsKFreeValue)
                    {
                        CDData cdsV = cdsVValues[cdsKI];
                        CDData cdsU = cdsR.get(cdsK);
                        if (cdsU != null)
                        {
                            if (cdsV == null)
                            {
                                return(false);
                            }
                            if (!cdsV.dataEquals(cdsU))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (cdsV != null)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (this.cds != null)
            {
                return(false);
            }
        }

        return(true);
    }
예제 #13
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);
        }
    }
예제 #14
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        KeepSaveData mData = (KeepSaveData)data;

        if (mData.booleanDic != null)
        {
            if (this.booleanDic == null)
            {
                return(false);
            }
            if (this.booleanDic.size() != mData.booleanDic.size())
            {
                return(false);
            }
            IntBooleanMap booleanDicR = mData.booleanDic;
            if (!this.booleanDic.isEmpty())
            {
                int    booleanDicKFreeValue = this.booleanDic.getFreeValue();
                int[]  booleanDicKKeys      = this.booleanDic.getKeys();
                bool[] booleanDicVValues    = this.booleanDic.getValues();
                for (int booleanDicKI = booleanDicKKeys.Length - 1; booleanDicKI >= 0; --booleanDicKI)
                {
                    int booleanDicK = booleanDicKKeys[booleanDicKI];
                    if (booleanDicK != booleanDicKFreeValue)
                    {
                        bool booleanDicV = booleanDicVValues[booleanDicKI];
                        bool booleanDicU = booleanDicR.get(booleanDicK);
                        if (booleanDicV != booleanDicU)
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        else
        {
            if (this.booleanDic != null)
            {
                return(false);
            }
        }

        if (mData.intDic != null)
        {
            if (this.intDic == null)
            {
                return(false);
            }
            if (this.intDic.size() != mData.intDic.size())
            {
                return(false);
            }
            IntIntMap intDicR = mData.intDic;
            if (!this.intDic.isEmpty())
            {
                int   intDicKFreeValue = this.intDic.getFreeValue();
                int[] intDicKKeys      = this.intDic.getKeys();
                int[] intDicVValues    = this.intDic.getValues();
                for (int intDicKI = intDicKKeys.Length - 1; intDicKI >= 0; --intDicKI)
                {
                    int intDicK = intDicKKeys[intDicKI];
                    if (intDicK != intDicKFreeValue)
                    {
                        int intDicV = intDicVValues[intDicKI];
                        int intDicU = intDicR.get(intDicK);
                        if (intDicV != intDicU)
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        else
        {
            if (this.intDic != null)
            {
                return(false);
            }
        }

        if (mData.longDic != null)
        {
            if (this.longDic == null)
            {
                return(false);
            }
            if (this.longDic.size() != mData.longDic.size())
            {
                return(false);
            }
            IntLongMap longDicR = mData.longDic;
            if (!this.longDic.isEmpty())
            {
                int    longDicKFreeValue = this.longDic.getFreeValue();
                int[]  longDicKKeys      = this.longDic.getKeys();
                long[] longDicVValues    = this.longDic.getValues();
                for (int longDicKI = longDicKKeys.Length - 1; longDicKI >= 0; --longDicKI)
                {
                    int longDicK = longDicKKeys[longDicKI];
                    if (longDicK != longDicKFreeValue)
                    {
                        long longDicV = longDicVValues[longDicKI];
                        long longDicU = longDicR.get(longDicK);
                        if (longDicV != longDicU)
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        else
        {
            if (this.longDic != null)
            {
                return(false);
            }
        }

        if (mData.stringDic != null)
        {
            if (this.stringDic == null)
            {
                return(false);
            }
            if (this.stringDic.size() != mData.stringDic.size())
            {
                return(false);
            }
            SMap <string, string> stringDicR = mData.stringDic;
            if (!this.stringDic.isEmpty())
            {
                string[] stringDicKKeys   = this.stringDic.getKeys();
                string[] stringDicVValues = this.stringDic.getValues();
                for (int stringDicKI = stringDicKKeys.Length - 1; stringDicKI >= 0; --stringDicKI)
                {
                    string stringDicK = stringDicKKeys[stringDicKI];
                    if (stringDicK != null)
                    {
                        string stringDicV = stringDicVValues[stringDicKI];
                        string stringDicU = stringDicR.get(stringDicK);
                        if (stringDicV != stringDicU)
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        else
        {
            if (this.stringDic != null)
            {
                return(false);
            }
        }

        return(true);
    }
예제 #15
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();
    }
예제 #16
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();
    }
예제 #17
0
    /// <summary>
    /// 回池
    /// </summary>
    protected override void toRelease(DataPool pool)
    {
        base.toRelease(pool);

        this.status = null;
    }
예제 #18
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");
        }
    }
예제 #19
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");
        }
    }