Пример #1
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.playerID  = 0L;
     this.showData  = null;
     this.attribute = null;
     this.force     = null;
 }
Пример #2
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is RoleAttributeData))
        {
            return;
        }

        RoleAttributeData mData = (RoleAttributeData)data;

        this.attributes = mData.attributes;
    }
Пример #3
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");
        }
    }
Пример #4
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is SceneRoleData))
        {
            return;
        }

        SceneRoleData mData = (SceneRoleData)data;

        this.playerID  = mData.playerID;
        this.showData  = mData.showData;
        this.attribute = mData.attribute;
        this.force     = mData.force;
    }
Пример #5
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        RoleAttributeData mData = (RoleAttributeData)data;

        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);
            }
        }

        return(true);
    }
Пример #6
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is SceneRoleData))
        {
            return;
        }

        SceneRoleData mData = (SceneRoleData)data;

        this.playerID = mData.playerID;

        if (mData.showData != null)
        {
            this.showData = (RoleShowData)mData.showData.clone();
        }
        else
        {
            this.showData = null;
        }

        if (mData.attribute != null)
        {
            this.attribute = (RoleAttributeData)mData.attribute.clone();
        }
        else
        {
            this.attribute = null;
        }

        if (mData.force != null)
        {
            this.force = (RoleForceData)mData.force.clone();
        }
        else
        {
            this.force = null;
            nullObjError("force");
        }
    }
Пример #7
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        this.playerID = stream.readLong();

        if (stream.readBoolean())
        {
            this.showData = (RoleShowData)stream.readDataSimpleNotNull();
        }
        else
        {
            this.showData = null;
        }

        if (stream.readBoolean())
        {
            this.attribute = (RoleAttributeData)stream.readDataSimpleNotNull();
        }
        else
        {
            this.attribute = null;
        }

        this.force = (RoleForceData)stream.readDataSimpleNotNull();
    }
Пример #8
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        this.playerID = stream.readLong();

        if (stream.readBoolean())
        {
            BaseData showDataT = stream.readDataFullNotNull();
            if (showDataT != null)
            {
                if (showDataT is RoleShowData)
                {
                    this.showData = (RoleShowData)showDataT;
                }
                else
                {
                    this.showData = new RoleShowData();
                    if (!(showDataT.GetType().IsAssignableFrom(typeof(RoleShowData))))
                    {
                        stream.throwTypeReadError(typeof(RoleShowData), showDataT.GetType());
                    }
                    this.showData.shadowCopy(showDataT);
                }
            }
            else
            {
                this.showData = null;
            }
        }
        else
        {
            this.showData = null;
        }

        if (stream.readBoolean())
        {
            BaseData attributeT = stream.readDataFullNotNull();
            if (attributeT != null)
            {
                if (attributeT is RoleAttributeData)
                {
                    this.attribute = (RoleAttributeData)attributeT;
                }
                else
                {
                    this.attribute = new RoleAttributeData();
                    if (!(attributeT.GetType().IsAssignableFrom(typeof(RoleAttributeData))))
                    {
                        stream.throwTypeReadError(typeof(RoleAttributeData), attributeT.GetType());
                    }
                    this.attribute.shadowCopy(attributeT);
                }
            }
            else
            {
                this.attribute = null;
            }
        }
        else
        {
            this.attribute = null;
        }

        BaseData forceT = stream.readDataFullNotNull();

        if (forceT != null)
        {
            if (forceT is RoleForceData)
            {
                this.force = (RoleForceData)forceT;
            }
            else
            {
                this.force = new RoleForceData();
                if (!(forceT.GetType().IsAssignableFrom(typeof(RoleForceData))))
                {
                    stream.throwTypeReadError(typeof(RoleForceData), forceT.GetType());
                }
                this.force.shadowCopy(forceT);
            }
        }
        else
        {
            this.force = null;
        }

        stream.endReadObj();
    }