Пример #1
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        base.toShadowCopy(data);

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

        PlayerAuctionToolData mData = (PlayerAuctionToolData)data;

        this.sellItems    = mData.sellItems;
        this.preSellItems = mData.preSellItems;
        this.preBuyItems  = mData.preBuyItems;
    }
Пример #2
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        if (!base.toDataEquals(data))
        {
            return(false);
        }

        PlayerAuctionToolData mData = (PlayerAuctionToolData)data;

        if (mData.sellItems != null)
        {
            if (this.sellItems == null)
            {
                return(false);
            }
            if (this.sellItems.size() != mData.sellItems.size())
            {
                return(false);
            }
            LongObjectMap <AuctionItemData> sellItemsR = mData.sellItems;
            if (!this.sellItems.isEmpty())
            {
                long              sellItemsKFreeValue = this.sellItems.getFreeValue();
                long[]            sellItemsKKeys      = this.sellItems.getKeys();
                AuctionItemData[] sellItemsVValues    = this.sellItems.getValues();
                for (int sellItemsKI = sellItemsKKeys.Length - 1; sellItemsKI >= 0; --sellItemsKI)
                {
                    long sellItemsK = sellItemsKKeys[sellItemsKI];
                    if (sellItemsK != sellItemsKFreeValue)
                    {
                        AuctionItemData sellItemsV = sellItemsVValues[sellItemsKI];
                        AuctionItemData sellItemsU = sellItemsR.get(sellItemsK);
                        if (sellItemsU != null)
                        {
                            if (sellItemsV == null)
                            {
                                return(false);
                            }
                            if (!sellItemsV.dataEquals(sellItemsU))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (sellItemsV != null)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (this.sellItems != null)
            {
                return(false);
            }
        }

        if (mData.preSellItems != null)
        {
            if (this.preSellItems == null)
            {
                return(false);
            }
            if (this.preSellItems.size() != mData.preSellItems.size())
            {
                return(false);
            }
            LongObjectMap <AuctionItemData> preSellItemsR = mData.preSellItems;
            if (!this.preSellItems.isEmpty())
            {
                long              preSellItemsKFreeValue = this.preSellItems.getFreeValue();
                long[]            preSellItemsKKeys      = this.preSellItems.getKeys();
                AuctionItemData[] preSellItemsVValues    = this.preSellItems.getValues();
                for (int preSellItemsKI = preSellItemsKKeys.Length - 1; preSellItemsKI >= 0; --preSellItemsKI)
                {
                    long preSellItemsK = preSellItemsKKeys[preSellItemsKI];
                    if (preSellItemsK != preSellItemsKFreeValue)
                    {
                        AuctionItemData preSellItemsV = preSellItemsVValues[preSellItemsKI];
                        AuctionItemData preSellItemsU = preSellItemsR.get(preSellItemsK);
                        if (preSellItemsU != null)
                        {
                            if (preSellItemsV == null)
                            {
                                return(false);
                            }
                            if (!preSellItemsV.dataEquals(preSellItemsU))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (preSellItemsV != null)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (this.preSellItems != null)
            {
                return(false);
            }
        }

        if (mData.preBuyItems != null)
        {
            if (this.preBuyItems == null)
            {
                return(false);
            }
            if (this.preBuyItems.size() != mData.preBuyItems.size())
            {
                return(false);
            }
            LongObjectMap <AuctionBuyItemData> preBuyItemsR = mData.preBuyItems;
            if (!this.preBuyItems.isEmpty())
            {
                long   preBuyItemsKFreeValue            = this.preBuyItems.getFreeValue();
                long[] preBuyItemsKKeys                 = this.preBuyItems.getKeys();
                AuctionBuyItemData[] preBuyItemsVValues = this.preBuyItems.getValues();
                for (int preBuyItemsKI = preBuyItemsKKeys.Length - 1; preBuyItemsKI >= 0; --preBuyItemsKI)
                {
                    long preBuyItemsK = preBuyItemsKKeys[preBuyItemsKI];
                    if (preBuyItemsK != preBuyItemsKFreeValue)
                    {
                        AuctionBuyItemData preBuyItemsV = preBuyItemsVValues[preBuyItemsKI];
                        AuctionBuyItemData preBuyItemsU = preBuyItemsR.get(preBuyItemsK);
                        if (preBuyItemsU != null)
                        {
                            if (preBuyItemsV == null)
                            {
                                return(false);
                            }
                            if (!preBuyItemsV.dataEquals(preBuyItemsU))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (preBuyItemsV != null)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (this.preBuyItems != null)
            {
                return(false);
            }
        }

        return(true);
    }
Пример #3
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        base.toCopy(data);

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

        PlayerAuctionToolData mData = (PlayerAuctionToolData)data;

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

            LongObjectMap <AuctionItemData> sellItemsT = this.sellItems;
            if (!mData.sellItems.isEmpty())
            {
                AuctionItemData[] sellItemsVValues = mData.sellItems.getValues();
                for (int sellItemsVI = sellItemsVValues.Length - 1; sellItemsVI >= 0; --sellItemsVI)
                {
                    AuctionItemData sellItemsV = sellItemsVValues[sellItemsVI];
                    if (sellItemsV != null)
                    {
                        AuctionItemData sellItemsU;
                        if (sellItemsV != null)
                        {
                            sellItemsU = (AuctionItemData)sellItemsV.clone();
                        }
                        else
                        {
                            sellItemsU = null;
                            nullObjError("sellItemsU");
                        }

                        sellItemsT.put(sellItemsU.instanceID, sellItemsU);
                    }
                }
            }
        }
        else
        {
            this.sellItems = null;
            nullObjError("sellItems");
        }

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

            LongObjectMap <AuctionItemData> preSellItemsT = this.preSellItems;
            if (!mData.preSellItems.isEmpty())
            {
                AuctionItemData[] preSellItemsVValues = mData.preSellItems.getValues();
                for (int preSellItemsVI = preSellItemsVValues.Length - 1; preSellItemsVI >= 0; --preSellItemsVI)
                {
                    AuctionItemData preSellItemsV = preSellItemsVValues[preSellItemsVI];
                    if (preSellItemsV != null)
                    {
                        AuctionItemData preSellItemsU;
                        if (preSellItemsV != null)
                        {
                            preSellItemsU = (AuctionItemData)preSellItemsV.clone();
                        }
                        else
                        {
                            preSellItemsU = null;
                            nullObjError("preSellItemsU");
                        }

                        preSellItemsT.put(preSellItemsU.instanceID, preSellItemsU);
                    }
                }
            }
        }
        else
        {
            this.preSellItems = null;
            nullObjError("preSellItems");
        }

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

            LongObjectMap <AuctionBuyItemData> preBuyItemsT = this.preBuyItems;
            if (!mData.preBuyItems.isEmpty())
            {
                AuctionBuyItemData[] preBuyItemsVValues = mData.preBuyItems.getValues();
                for (int preBuyItemsVI = preBuyItemsVValues.Length - 1; preBuyItemsVI >= 0; --preBuyItemsVI)
                {
                    AuctionBuyItemData preBuyItemsV = preBuyItemsVValues[preBuyItemsVI];
                    if (preBuyItemsV != null)
                    {
                        AuctionBuyItemData preBuyItemsU;
                        if (preBuyItemsV != null)
                        {
                            preBuyItemsU = (AuctionBuyItemData)preBuyItemsV.clone();
                        }
                        else
                        {
                            preBuyItemsU = null;
                            nullObjError("preBuyItemsU");
                        }

                        preBuyItemsT.put(preBuyItemsU.instanceID, preBuyItemsU);
                    }
                }
            }
        }
        else
        {
            this.preBuyItems = null;
            nullObjError("preBuyItems");
        }
    }