Esempio n. 1
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        base.toReadBytesFull(stream);

        stream.startReadObj();

        BaseData dataT = stream.readDataFullNotNull();

        if (dataT != null)
        {
            if (dataT is FieldItemBagBindData)
            {
                this.data = (FieldItemBagBindData)dataT;
            }
            else
            {
                this.data = new FieldItemBagBindData();
                if (!(dataT.GetType().IsAssignableFrom(typeof(FieldItemBagBindData))))
                {
                    stream.throwTypeReadError(typeof(FieldItemBagBindData), dataT.GetType());
                }
                this.data.shadowCopy(dataT);
            }
        }
        else
        {
            this.data = null;
        }

        stream.endReadObj();
    }
Esempio n. 2
0
 /** 执行拾取绑定物品掉落包 */
 protected virtual void doPickUpFieldItemBagBind(FieldItemBagBindData data)
 {
     //目前直接拾取
     if (GameC.player.bag.hasItemPlace(data.items))
     {
         CUnitPickUpItemBagAllRequest.create(_unit.instanceID, data.instanceID).send();
     }
 }
Esempio n. 3
0
    public void onRemoveFieldItemBagBindByServer(int instanceID)
    {
        FieldItemBagBindData data = _selfFieldItemBagDic.remove(instanceID);

        if (data != null)
        {
            onRemoveFieldItemBagBind(data);
        }
    }
Esempio n. 4
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is FieldItemBagBindData))
        {
            return;
        }

        FieldItemBagBindData mData = (FieldItemBagBindData)data;

        this.instanceID = mData.instanceID;

        if (mData.items != null)
        {
            if (this.items != null)
            {
                this.items.clear();
                this.items.ensureCapacity(mData.items.size());
            }
            else
            {
                this.items = new SList <ItemData>();
            }

            SList <ItemData> itemsT = this.items;
            if (!mData.items.isEmpty())
            {
                ItemData[] itemsVValues = mData.items.getValues();
                for (int itemsVI = 0, itemsVLen = mData.items.length(); itemsVI < itemsVLen; ++itemsVI)
                {
                    ItemData itemsV = itemsVValues[itemsVI];
                    ItemData itemsU;
                    if (itemsV != null)
                    {
                        itemsU = (ItemData)itemsV.clone();
                    }
                    else
                    {
                        itemsU = null;
                        nullObjError("itemsU");
                    }

                    itemsT.add(itemsU);
                }
            }
        }
        else
        {
            this.items = null;
            nullObjError("items");
        }

        this.removeTime = mData.removeTime;
    }
Esempio n. 5
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is FieldItemBagBindData))
        {
            return;
        }

        FieldItemBagBindData mData = (FieldItemBagBindData)data;

        this.instanceID = mData.instanceID;
        this.items      = mData.items;
        this.removeTime = mData.removeTime;
    }
Esempio n. 6
0
    protected virtual void doPickUp(Unit unit)
    {
        if (unit.getType() == UnitType.FieldItem)
        {
            if (checkCanPickUp(unit))
            {
                CUnitPickUpItemRequest.create(_unit.instanceID, unit.instanceID).send();
            }
        }
        else
        {
            FieldItemBagBindData bData = _scene.role.getFieldItemBagBind(unit.instanceID);

            if (bData != null)
            {
                doPickUpFieldItemBagBind(bData);
            }
        }
    }
Esempio n. 7
0
        protected override void onRemoveFieldItemBagBind(FieldItemBagBindData data)
        {
            if (!_g14)
            {
                _m14 = instance.Type.GetMethod("onRemoveFieldItemBagBind", 1);
                _g14 = true;
            }

            if (_m14 != null && !_b14)
            {
                _b14   = true;
                _p1[0] = data;
                appdomain.Invoke(_m14, instance, _p1);
                _p1[0] = null;
                _b14   = false;
            }
            else
            {
                base.onRemoveFieldItemBagBind(data);
            }
        }
Esempio n. 8
0
        protected override void doPickUpFieldItemBagBind(FieldItemBagBindData data)
        {
            if (!_g12)
            {
                _m12 = instance.Type.GetMethod("doPickUpFieldItemBagBind", 1);
                _g12 = true;
            }

            if (_m12 != null && !_b12)
            {
                _b12   = true;
                _p1[0] = data;
                appdomain.Invoke(_m12, instance, _p1);
                _p1[0] = null;
                _b12   = false;
            }
            else
            {
                base.doPickUpFieldItemBagBind(data);
            }
        }
Esempio n. 9
0
    /// <summary>
    /// 写入字节流(简版)
    /// </summary>
    protected override void toWriteBytesSimple(BytesWriteStream stream)
    {
        if (this.hero != null)
        {
            stream.writeBoolean(true);
            stream.writeDataSimpleNotNull(this.hero);
        }
        else
        {
            stream.writeBoolean(false);
        }

        if (this.units != null)
        {
            stream.writeLen(this.units.size());
            if (!this.units.isEmpty())
            {
                UnitData[] unitsVValues = this.units.getValues();
                for (int unitsVI = 0, unitsVLen = this.units.length(); unitsVI < unitsVLen; ++unitsVI)
                {
                    UnitData unitsV = unitsVValues[unitsVI];
                    if (unitsV != null)
                    {
                        stream.writeDataSimpleNotNull(unitsV);
                    }
                    else
                    {
                        nullObjError("unitsV");
                    }
                }
            }
        }
        else
        {
            nullObjError("units");
        }

        if (this.roles != null)
        {
            stream.writeLen(this.roles.size());
            if (!this.roles.isEmpty())
            {
                SceneRoleData[] rolesVValues = this.roles.getValues();
                for (int rolesVI = rolesVValues.Length - 1; rolesVI >= 0; --rolesVI)
                {
                    SceneRoleData rolesV = rolesVValues[rolesVI];
                    if (rolesV != null)
                    {
                        if (rolesV != null)
                        {
                            stream.writeDataSimpleNotNull(rolesV);
                        }
                        else
                        {
                            nullObjError("rolesV");
                        }
                    }
                }
            }
        }
        else
        {
            nullObjError("roles");
        }

        if (this.selfBindFieldItemBags != null)
        {
            stream.writeBoolean(true);
            stream.writeLen(this.selfBindFieldItemBags.size());
            if (!this.selfBindFieldItemBags.isEmpty())
            {
                FieldItemBagBindData[] selfBindFieldItemBagsVValues = this.selfBindFieldItemBags.getValues();
                for (int selfBindFieldItemBagsVI = selfBindFieldItemBagsVValues.Length - 1; selfBindFieldItemBagsVI >= 0; --selfBindFieldItemBagsVI)
                {
                    FieldItemBagBindData selfBindFieldItemBagsV = selfBindFieldItemBagsVValues[selfBindFieldItemBagsVI];
                    if (selfBindFieldItemBagsV != null)
                    {
                        if (selfBindFieldItemBagsV != null)
                        {
                            stream.writeBoolean(true);
                            stream.writeDataSimpleNotNull(selfBindFieldItemBagsV);
                        }
                        else
                        {
                            stream.writeBoolean(false);
                        }
                    }
                }
            }
        }
        else
        {
            stream.writeBoolean(false);
        }

        if (this.bindVisionUnits != null)
        {
            stream.writeBoolean(true);
            stream.writeLen(this.bindVisionUnits.size());
            if (!this.bindVisionUnits.isEmpty())
            {
                int              bindVisionUnitsKFreeValue = this.bindVisionUnits.getFreeValue();
                int[]            bindVisionUnitsKKeys      = this.bindVisionUnits.getKeys();
                UnitSimpleData[] bindVisionUnitsVValues    = this.bindVisionUnits.getValues();
                for (int bindVisionUnitsKI = bindVisionUnitsKKeys.Length - 1; bindVisionUnitsKI >= 0; --bindVisionUnitsKI)
                {
                    int bindVisionUnitsK = bindVisionUnitsKKeys[bindVisionUnitsKI];
                    if (bindVisionUnitsK != bindVisionUnitsKFreeValue)
                    {
                        UnitSimpleData bindVisionUnitsV = bindVisionUnitsVValues[bindVisionUnitsKI];
                        stream.writeInt(bindVisionUnitsK);

                        if (bindVisionUnitsV != null)
                        {
                            stream.writeBoolean(true);
                            stream.writeDataSimpleNotNull(bindVisionUnitsV);
                        }
                        else
                        {
                            stream.writeBoolean(false);
                        }
                    }
                }
            }
        }
        else
        {
            stream.writeBoolean(false);
        }

        if (this.battleData != null)
        {
            stream.writeBoolean(true);
            stream.writeDataSimpleNotNull(this.battleData);
        }
        else
        {
            stream.writeBoolean(false);
        }
    }
Esempio n. 10
0
 public void onAddFieldItemBagBindByServer(FieldItemBagBindData data)
 {
     _selfFieldItemBagDic.put(data.instanceID, data);
     onAddFieldItemBagBind(data);
 }
Esempio n. 11
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        this.data = (FieldItemBagBindData)stream.readDataSimpleNotNull();
    }
Esempio n. 12
0
    /// <summary>
    /// 回池
    /// </summary>
    protected override void toRelease(DataPool pool)
    {
        base.toRelease(pool);

        this.data = null;
    }
Esempio n. 13
0
    /// <summary>
    /// 转文本输出
    /// </summary>
    protected override void toWriteDataString(DataWriter writer)
    {
        writer.writeTabs();
        writer.sb.Append("hero");
        writer.sb.Append(':');
        if (this.hero != null)
        {
            this.hero.writeDataString(writer);
        }
        else
        {
            writer.sb.Append("UnitData=null");
        }

        writer.writeEnter();
        writer.writeTabs();
        writer.sb.Append("units");
        writer.sb.Append(':');
        writer.sb.Append("List<UnitData>");
        if (this.units != null)
        {
            SList <UnitData> unitsT = this.units;
            int unitsLen            = unitsT.size();
            writer.sb.Append('(');
            writer.sb.Append(unitsLen);
            writer.sb.Append(')');
            writer.writeEnter();
            writer.writeLeftBrace();
            for (int unitsI = 0; unitsI < unitsLen; ++unitsI)
            {
                UnitData unitsV = unitsT.get(unitsI);
                writer.writeTabs();
                writer.sb.Append(unitsI);
                writer.sb.Append(':');
                if (unitsV != null)
                {
                    unitsV.writeDataString(writer);
                }
                else
                {
                    writer.sb.Append("UnitData=null");
                }

                writer.writeEnter();
            }
            writer.writeRightBrace();
        }
        else
        {
            writer.sb.Append("=null");
        }

        writer.writeEnter();
        writer.writeTabs();
        writer.sb.Append("roles");
        writer.sb.Append(':');
        writer.sb.Append("Map<long,SceneRoleData>");
        if (this.roles != null)
        {
            writer.sb.Append('(');
            writer.sb.Append(this.roles.size());
            writer.sb.Append(')');
            writer.writeEnter();
            writer.writeLeftBrace();
            if (!this.roles.isEmpty())
            {
                long            rolesKFreeValue = this.roles.getFreeValue();
                long[]          rolesKKeys      = this.roles.getKeys();
                SceneRoleData[] rolesVValues    = this.roles.getValues();
                for (int rolesKI = rolesKKeys.Length - 1; rolesKI >= 0; --rolesKI)
                {
                    long rolesK = rolesKKeys[rolesKI];
                    if (rolesK != rolesKFreeValue)
                    {
                        SceneRoleData rolesV = rolesVValues[rolesKI];
                        writer.writeTabs();
                        writer.sb.Append(rolesK);

                        writer.sb.Append(':');
                        if (rolesV != null)
                        {
                            rolesV.writeDataString(writer);
                        }
                        else
                        {
                            writer.sb.Append("SceneRoleData=null");
                        }

                        writer.writeEnter();
                    }
                }
            }
            writer.writeRightBrace();
        }
        else
        {
            writer.sb.Append("=null");
        }

        writer.writeEnter();
        writer.writeTabs();
        writer.sb.Append("selfBindFieldItemBags");
        writer.sb.Append(':');
        writer.sb.Append("Map<int,FieldItemBagBindData>");
        if (this.selfBindFieldItemBags != null)
        {
            writer.sb.Append('(');
            writer.sb.Append(this.selfBindFieldItemBags.size());
            writer.sb.Append(')');
            writer.writeEnter();
            writer.writeLeftBrace();
            if (!this.selfBindFieldItemBags.isEmpty())
            {
                int   selfBindFieldItemBagsKFreeValue = this.selfBindFieldItemBags.getFreeValue();
                int[] selfBindFieldItemBagsKKeys      = this.selfBindFieldItemBags.getKeys();
                FieldItemBagBindData[] selfBindFieldItemBagsVValues = this.selfBindFieldItemBags.getValues();
                for (int selfBindFieldItemBagsKI = selfBindFieldItemBagsKKeys.Length - 1; selfBindFieldItemBagsKI >= 0; --selfBindFieldItemBagsKI)
                {
                    int selfBindFieldItemBagsK = selfBindFieldItemBagsKKeys[selfBindFieldItemBagsKI];
                    if (selfBindFieldItemBagsK != selfBindFieldItemBagsKFreeValue)
                    {
                        FieldItemBagBindData selfBindFieldItemBagsV = selfBindFieldItemBagsVValues[selfBindFieldItemBagsKI];
                        writer.writeTabs();
                        writer.sb.Append(selfBindFieldItemBagsK);

                        writer.sb.Append(':');
                        if (selfBindFieldItemBagsV != null)
                        {
                            selfBindFieldItemBagsV.writeDataString(writer);
                        }
                        else
                        {
                            writer.sb.Append("FieldItemBagBindData=null");
                        }

                        writer.writeEnter();
                    }
                }
            }
            writer.writeRightBrace();
        }
        else
        {
            writer.sb.Append("=null");
        }

        writer.writeEnter();
        writer.writeTabs();
        writer.sb.Append("bindVisionUnits");
        writer.sb.Append(':');
        writer.sb.Append("Map<int,UnitSimpleData>");
        if (this.bindVisionUnits != null)
        {
            writer.sb.Append('(');
            writer.sb.Append(this.bindVisionUnits.size());
            writer.sb.Append(')');
            writer.writeEnter();
            writer.writeLeftBrace();
            if (!this.bindVisionUnits.isEmpty())
            {
                int              bindVisionUnitsKFreeValue = this.bindVisionUnits.getFreeValue();
                int[]            bindVisionUnitsKKeys      = this.bindVisionUnits.getKeys();
                UnitSimpleData[] bindVisionUnitsVValues    = this.bindVisionUnits.getValues();
                for (int bindVisionUnitsKI = bindVisionUnitsKKeys.Length - 1; bindVisionUnitsKI >= 0; --bindVisionUnitsKI)
                {
                    int bindVisionUnitsK = bindVisionUnitsKKeys[bindVisionUnitsKI];
                    if (bindVisionUnitsK != bindVisionUnitsKFreeValue)
                    {
                        UnitSimpleData bindVisionUnitsV = bindVisionUnitsVValues[bindVisionUnitsKI];
                        writer.writeTabs();
                        writer.sb.Append(bindVisionUnitsK);

                        writer.sb.Append(':');
                        if (bindVisionUnitsV != null)
                        {
                            bindVisionUnitsV.writeDataString(writer);
                        }
                        else
                        {
                            writer.sb.Append("UnitSimpleData=null");
                        }

                        writer.writeEnter();
                    }
                }
            }
            writer.writeRightBrace();
        }
        else
        {
            writer.sb.Append("=null");
        }

        writer.writeEnter();
        writer.writeTabs();
        writer.sb.Append("battleData");
        writer.sb.Append(':');
        if (this.battleData != null)
        {
            this.battleData.writeDataString(writer);
        }
        else
        {
            writer.sb.Append("BattleSceneData=null");
        }

        writer.writeEnter();
    }
Esempio n. 14
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        SceneEnterData mData = (SceneEnterData)data;

        if (mData.hero != null)
        {
            if (this.hero == null)
            {
                return(false);
            }
            if (!this.hero.dataEquals(mData.hero))
            {
                return(false);
            }
        }
        else
        {
            if (this.hero != null)
            {
                return(false);
            }
        }

        if (mData.units != null)
        {
            if (this.units == null)
            {
                return(false);
            }
            if (this.units.size() != mData.units.size())
            {
                return(false);
            }
            SList <UnitData> unitsT = this.units;
            SList <UnitData> unitsR = mData.units;
            int unitsLen            = unitsT.size();
            for (int unitsI = 0; unitsI < unitsLen; ++unitsI)
            {
                UnitData unitsU = unitsT.get(unitsI);
                UnitData unitsV = unitsR.get(unitsI);
                if (unitsV != null)
                {
                    if (unitsU == null)
                    {
                        return(false);
                    }
                    if (!unitsU.dataEquals(unitsV))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (unitsU != null)
                    {
                        return(false);
                    }
                }
            }
        }
        else
        {
            if (this.units != null)
            {
                return(false);
            }
        }

        if (mData.roles != null)
        {
            if (this.roles == null)
            {
                return(false);
            }
            if (this.roles.size() != mData.roles.size())
            {
                return(false);
            }
            LongObjectMap <SceneRoleData> rolesR = mData.roles;
            if (!this.roles.isEmpty())
            {
                long            rolesKFreeValue = this.roles.getFreeValue();
                long[]          rolesKKeys      = this.roles.getKeys();
                SceneRoleData[] rolesVValues    = this.roles.getValues();
                for (int rolesKI = rolesKKeys.Length - 1; rolesKI >= 0; --rolesKI)
                {
                    long rolesK = rolesKKeys[rolesKI];
                    if (rolesK != rolesKFreeValue)
                    {
                        SceneRoleData rolesV = rolesVValues[rolesKI];
                        SceneRoleData rolesU = rolesR.get(rolesK);
                        if (rolesU != null)
                        {
                            if (rolesV == null)
                            {
                                return(false);
                            }
                            if (!rolesV.dataEquals(rolesU))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (rolesV != null)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (this.roles != null)
            {
                return(false);
            }
        }

        if (mData.selfBindFieldItemBags != null)
        {
            if (this.selfBindFieldItemBags == null)
            {
                return(false);
            }
            if (this.selfBindFieldItemBags.size() != mData.selfBindFieldItemBags.size())
            {
                return(false);
            }
            IntObjectMap <FieldItemBagBindData> selfBindFieldItemBagsR = mData.selfBindFieldItemBags;
            if (!this.selfBindFieldItemBags.isEmpty())
            {
                int   selfBindFieldItemBagsKFreeValue = this.selfBindFieldItemBags.getFreeValue();
                int[] selfBindFieldItemBagsKKeys      = this.selfBindFieldItemBags.getKeys();
                FieldItemBagBindData[] selfBindFieldItemBagsVValues = this.selfBindFieldItemBags.getValues();
                for (int selfBindFieldItemBagsKI = selfBindFieldItemBagsKKeys.Length - 1; selfBindFieldItemBagsKI >= 0; --selfBindFieldItemBagsKI)
                {
                    int selfBindFieldItemBagsK = selfBindFieldItemBagsKKeys[selfBindFieldItemBagsKI];
                    if (selfBindFieldItemBagsK != selfBindFieldItemBagsKFreeValue)
                    {
                        FieldItemBagBindData selfBindFieldItemBagsV = selfBindFieldItemBagsVValues[selfBindFieldItemBagsKI];
                        FieldItemBagBindData selfBindFieldItemBagsU = selfBindFieldItemBagsR.get(selfBindFieldItemBagsK);
                        if (selfBindFieldItemBagsU != null)
                        {
                            if (selfBindFieldItemBagsV == null)
                            {
                                return(false);
                            }
                            if (!selfBindFieldItemBagsV.dataEquals(selfBindFieldItemBagsU))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (selfBindFieldItemBagsV != null)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (this.selfBindFieldItemBags != null)
            {
                return(false);
            }
        }

        if (mData.bindVisionUnits != null)
        {
            if (this.bindVisionUnits == null)
            {
                return(false);
            }
            if (this.bindVisionUnits.size() != mData.bindVisionUnits.size())
            {
                return(false);
            }
            IntObjectMap <UnitSimpleData> bindVisionUnitsR = mData.bindVisionUnits;
            if (!this.bindVisionUnits.isEmpty())
            {
                int              bindVisionUnitsKFreeValue = this.bindVisionUnits.getFreeValue();
                int[]            bindVisionUnitsKKeys      = this.bindVisionUnits.getKeys();
                UnitSimpleData[] bindVisionUnitsVValues    = this.bindVisionUnits.getValues();
                for (int bindVisionUnitsKI = bindVisionUnitsKKeys.Length - 1; bindVisionUnitsKI >= 0; --bindVisionUnitsKI)
                {
                    int bindVisionUnitsK = bindVisionUnitsKKeys[bindVisionUnitsKI];
                    if (bindVisionUnitsK != bindVisionUnitsKFreeValue)
                    {
                        UnitSimpleData bindVisionUnitsV = bindVisionUnitsVValues[bindVisionUnitsKI];
                        UnitSimpleData bindVisionUnitsU = bindVisionUnitsR.get(bindVisionUnitsK);
                        if (bindVisionUnitsU != null)
                        {
                            if (bindVisionUnitsV == null)
                            {
                                return(false);
                            }
                            if (!bindVisionUnitsV.dataEquals(bindVisionUnitsU))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (bindVisionUnitsV != null)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (this.bindVisionUnits != null)
            {
                return(false);
            }
        }

        if (mData.battleData != null)
        {
            if (this.battleData == null)
            {
                return(false);
            }
            if (!this.battleData.dataEquals(mData.battleData))
            {
                return(false);
            }
        }
        else
        {
            if (this.battleData != null)
            {
                return(false);
            }
        }

        return(true);
    }
Esempio n. 15
0
 /** 移除掉落物品包绑定 */
 protected virtual void onRemoveFieldItemBagBind(FieldItemBagBindData data)
 {
 }
Esempio n. 16
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        FieldItemBagBindData mData = (FieldItemBagBindData)data;

        if (this.instanceID != mData.instanceID)
        {
            return(false);
        }

        if (mData.items != null)
        {
            if (this.items == null)
            {
                return(false);
            }
            if (this.items.size() != mData.items.size())
            {
                return(false);
            }
            SList <ItemData> itemsT = this.items;
            SList <ItemData> itemsR = mData.items;
            int itemsLen            = itemsT.size();
            for (int itemsI = 0; itemsI < itemsLen; ++itemsI)
            {
                ItemData itemsU = itemsT.get(itemsI);
                ItemData itemsV = itemsR.get(itemsI);
                if (itemsV != null)
                {
                    if (itemsU == null)
                    {
                        return(false);
                    }
                    if (!itemsU.dataEquals(itemsV))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (itemsU != null)
                    {
                        return(false);
                    }
                }
            }
        }
        else
        {
            if (this.items != null)
            {
                return(false);
            }
        }

        if (this.removeTime != mData.removeTime)
        {
            return(false);
        }

        return(true);
    }
Esempio n. 17
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

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

        int unitsLen = stream.readLen();

        if (this.units != null)
        {
            this.units.clear();
            this.units.ensureCapacity(unitsLen);
        }
        else
        {
            this.units = new SList <UnitData>();
        }

        SList <UnitData> unitsT = this.units;

        for (int unitsI = unitsLen - 1; unitsI >= 0; --unitsI)
        {
            UnitData unitsV;
            BaseData unitsVT = stream.readDataFullNotNull();
            if (unitsVT != null)
            {
                if (unitsVT is UnitData)
                {
                    unitsV = (UnitData)unitsVT;
                }
                else
                {
                    unitsV = new UnitData();
                    if (!(unitsVT.GetType().IsAssignableFrom(typeof(UnitData))))
                    {
                        stream.throwTypeReadError(typeof(UnitData), unitsVT.GetType());
                    }
                    unitsV.shadowCopy(unitsVT);
                }
            }
            else
            {
                unitsV = null;
            }

            unitsT.add(unitsV);
        }

        int rolesLen = stream.readLen();

        if (this.roles != null)
        {
            this.roles.clear();
            this.roles.ensureCapacity(rolesLen);
        }
        else
        {
            this.roles = new LongObjectMap <SceneRoleData>(rolesLen);
        }

        LongObjectMap <SceneRoleData> rolesT = this.roles;

        for (int rolesI = rolesLen - 1; rolesI >= 0; --rolesI)
        {
            SceneRoleData rolesV;
            BaseData      rolesVT = stream.readDataFullNotNull();
            if (rolesVT != null)
            {
                if (rolesVT is SceneRoleData)
                {
                    rolesV = (SceneRoleData)rolesVT;
                }
                else
                {
                    rolesV = new SceneRoleData();
                    if (!(rolesVT.GetType().IsAssignableFrom(typeof(SceneRoleData))))
                    {
                        stream.throwTypeReadError(typeof(SceneRoleData), rolesVT.GetType());
                    }
                    rolesV.shadowCopy(rolesVT);
                }
            }
            else
            {
                rolesV = null;
            }

            rolesT.put(rolesV.playerID, rolesV);
        }

        if (stream.readBoolean())
        {
            int selfBindFieldItemBagsLen = stream.readLen();
            if (this.selfBindFieldItemBags != null)
            {
                this.selfBindFieldItemBags.clear();
                this.selfBindFieldItemBags.ensureCapacity(selfBindFieldItemBagsLen);
            }
            else
            {
                this.selfBindFieldItemBags = new IntObjectMap <FieldItemBagBindData>(selfBindFieldItemBagsLen);
            }

            IntObjectMap <FieldItemBagBindData> selfBindFieldItemBagsT = this.selfBindFieldItemBags;
            for (int selfBindFieldItemBagsI = selfBindFieldItemBagsLen - 1; selfBindFieldItemBagsI >= 0; --selfBindFieldItemBagsI)
            {
                FieldItemBagBindData selfBindFieldItemBagsV;
                if (stream.readBoolean())
                {
                    BaseData selfBindFieldItemBagsVT = stream.readDataFullNotNull();
                    if (selfBindFieldItemBagsVT != null)
                    {
                        if (selfBindFieldItemBagsVT is FieldItemBagBindData)
                        {
                            selfBindFieldItemBagsV = (FieldItemBagBindData)selfBindFieldItemBagsVT;
                        }
                        else
                        {
                            selfBindFieldItemBagsV = new FieldItemBagBindData();
                            if (!(selfBindFieldItemBagsVT.GetType().IsAssignableFrom(typeof(FieldItemBagBindData))))
                            {
                                stream.throwTypeReadError(typeof(FieldItemBagBindData), selfBindFieldItemBagsVT.GetType());
                            }
                            selfBindFieldItemBagsV.shadowCopy(selfBindFieldItemBagsVT);
                        }
                    }
                    else
                    {
                        selfBindFieldItemBagsV = null;
                    }
                }
                else
                {
                    selfBindFieldItemBagsV = null;
                }

                selfBindFieldItemBagsT.put(selfBindFieldItemBagsV.instanceID, selfBindFieldItemBagsV);
            }
        }
        else
        {
            this.selfBindFieldItemBags = null;
        }

        if (stream.readBoolean())
        {
            int bindVisionUnitsLen = stream.readLen();
            if (this.bindVisionUnits != null)
            {
                this.bindVisionUnits.clear();
                this.bindVisionUnits.ensureCapacity(bindVisionUnitsLen);
            }
            else
            {
                this.bindVisionUnits = new IntObjectMap <UnitSimpleData>(bindVisionUnitsLen);
            }

            IntObjectMap <UnitSimpleData> bindVisionUnitsT = this.bindVisionUnits;
            for (int bindVisionUnitsI = bindVisionUnitsLen - 1; bindVisionUnitsI >= 0; --bindVisionUnitsI)
            {
                int            bindVisionUnitsK;
                UnitSimpleData bindVisionUnitsV;
                bindVisionUnitsK = stream.readInt();

                if (stream.readBoolean())
                {
                    BaseData bindVisionUnitsVT = stream.readDataFullNotNull();
                    if (bindVisionUnitsVT != null)
                    {
                        if (bindVisionUnitsVT is UnitSimpleData)
                        {
                            bindVisionUnitsV = (UnitSimpleData)bindVisionUnitsVT;
                        }
                        else
                        {
                            bindVisionUnitsV = new UnitSimpleData();
                            if (!(bindVisionUnitsVT.GetType().IsAssignableFrom(typeof(UnitSimpleData))))
                            {
                                stream.throwTypeReadError(typeof(UnitSimpleData), bindVisionUnitsVT.GetType());
                            }
                            bindVisionUnitsV.shadowCopy(bindVisionUnitsVT);
                        }
                    }
                    else
                    {
                        bindVisionUnitsV = null;
                    }
                }
                else
                {
                    bindVisionUnitsV = null;
                }

                bindVisionUnitsT.put(bindVisionUnitsK, bindVisionUnitsV);
            }
        }
        else
        {
            this.bindVisionUnits = null;
        }

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

        stream.endReadObj();
    }
Esempio n. 18
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is SceneEnterData))
        {
            return;
        }

        SceneEnterData mData = (SceneEnterData)data;

        if (mData.hero != null)
        {
            this.hero = (UnitData)mData.hero.clone();
        }
        else
        {
            this.hero = null;
        }

        if (mData.units != null)
        {
            if (this.units != null)
            {
                this.units.clear();
                this.units.ensureCapacity(mData.units.size());
            }
            else
            {
                this.units = new SList <UnitData>();
            }

            SList <UnitData> unitsT = this.units;
            if (!mData.units.isEmpty())
            {
                UnitData[] unitsVValues = mData.units.getValues();
                for (int unitsVI = 0, unitsVLen = mData.units.length(); unitsVI < unitsVLen; ++unitsVI)
                {
                    UnitData unitsV = unitsVValues[unitsVI];
                    UnitData unitsU;
                    if (unitsV != null)
                    {
                        unitsU = (UnitData)unitsV.clone();
                    }
                    else
                    {
                        unitsU = null;
                        nullObjError("unitsU");
                    }

                    unitsT.add(unitsU);
                }
            }
        }
        else
        {
            this.units = null;
            nullObjError("units");
        }

        if (mData.roles != null)
        {
            if (this.roles != null)
            {
                this.roles.clear();
                this.roles.ensureCapacity(mData.roles.size());
            }
            else
            {
                this.roles = new LongObjectMap <SceneRoleData>(mData.roles.size());
            }

            LongObjectMap <SceneRoleData> rolesT = this.roles;
            if (!mData.roles.isEmpty())
            {
                SceneRoleData[] rolesVValues = mData.roles.getValues();
                for (int rolesVI = rolesVValues.Length - 1; rolesVI >= 0; --rolesVI)
                {
                    SceneRoleData rolesV = rolesVValues[rolesVI];
                    if (rolesV != null)
                    {
                        SceneRoleData rolesU;
                        if (rolesV != null)
                        {
                            rolesU = (SceneRoleData)rolesV.clone();
                        }
                        else
                        {
                            rolesU = null;
                            nullObjError("rolesU");
                        }

                        rolesT.put(rolesU.playerID, rolesU);
                    }
                }
            }
        }
        else
        {
            this.roles = null;
            nullObjError("roles");
        }

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

            IntObjectMap <FieldItemBagBindData> selfBindFieldItemBagsT = this.selfBindFieldItemBags;
            if (!mData.selfBindFieldItemBags.isEmpty())
            {
                FieldItemBagBindData[] selfBindFieldItemBagsVValues = mData.selfBindFieldItemBags.getValues();
                for (int selfBindFieldItemBagsVI = selfBindFieldItemBagsVValues.Length - 1; selfBindFieldItemBagsVI >= 0; --selfBindFieldItemBagsVI)
                {
                    FieldItemBagBindData selfBindFieldItemBagsV = selfBindFieldItemBagsVValues[selfBindFieldItemBagsVI];
                    if (selfBindFieldItemBagsV != null)
                    {
                        FieldItemBagBindData selfBindFieldItemBagsU;
                        if (selfBindFieldItemBagsV != null)
                        {
                            selfBindFieldItemBagsU = (FieldItemBagBindData)selfBindFieldItemBagsV.clone();
                        }
                        else
                        {
                            selfBindFieldItemBagsU = null;
                        }

                        selfBindFieldItemBagsT.put(selfBindFieldItemBagsU.instanceID, selfBindFieldItemBagsU);
                    }
                }
            }
        }
        else
        {
            this.selfBindFieldItemBags = null;
        }

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

            IntObjectMap <UnitSimpleData> bindVisionUnitsT = this.bindVisionUnits;
            if (!mData.bindVisionUnits.isEmpty())
            {
                int              bindVisionUnitsKFreeValue = mData.bindVisionUnits.getFreeValue();
                int[]            bindVisionUnitsKKeys      = mData.bindVisionUnits.getKeys();
                UnitSimpleData[] bindVisionUnitsVValues    = mData.bindVisionUnits.getValues();
                for (int bindVisionUnitsKI = bindVisionUnitsKKeys.Length - 1; bindVisionUnitsKI >= 0; --bindVisionUnitsKI)
                {
                    int bindVisionUnitsK = bindVisionUnitsKKeys[bindVisionUnitsKI];
                    if (bindVisionUnitsK != bindVisionUnitsKFreeValue)
                    {
                        UnitSimpleData bindVisionUnitsV = bindVisionUnitsVValues[bindVisionUnitsKI];
                        int            bindVisionUnitsW;
                        UnitSimpleData bindVisionUnitsU;
                        bindVisionUnitsW = bindVisionUnitsK;

                        if (bindVisionUnitsV != null)
                        {
                            bindVisionUnitsU = (UnitSimpleData)bindVisionUnitsV.clone();
                        }
                        else
                        {
                            bindVisionUnitsU = null;
                        }

                        bindVisionUnitsT.put(bindVisionUnitsW, bindVisionUnitsU);
                    }
                }
            }
        }
        else
        {
            this.bindVisionUnits = null;
        }

        if (mData.battleData != null)
        {
            this.battleData = (BattleSceneData)mData.battleData.clone();
        }
        else
        {
            this.battleData = null;
        }
    }
Esempio n. 19
0
    //--掉落部分--//

    /** 添加掉落物品包绑定 */
    protected virtual void onAddFieldItemBagBind(FieldItemBagBindData data)
    {
    }