public static ItemContainerData Create(GameObject from)
    {
        var data = new ItemContainerData();

        data.Save(from);

        return(data);
    }
Beispiel #2
0
    protected override void toSetData(FuncToolData data)
    {
        base.toSetData(data);
        _data = (ItemContainerData)data;

        _list    = _data.items;
        _gridNum = _data.gridNum;
    }
        public void UpdateProjectItem(ProjectItem projectItem)
        {
            VirtualizingTreeViewItem treeViewItem  = m_treeView.GetTreeViewItem(projectItem);
            ItemContainerData        containerData = m_treeView.GetItemContainerData(projectItem);

            if (treeViewItem != null && containerData != null)
            {
                m_treeView.DataBindItem(projectItem, containerData, treeViewItem);
            }
        }
Beispiel #4
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        base.toCopy(data);

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

        ItemContainerData mData = (ItemContainerData)data;

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

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

        this.gridNum = mData.gridNum;
    }
Beispiel #5
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        base.toShadowCopy(data);

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

        ItemContainerData mData = (ItemContainerData)data;

        this.items   = mData.items;
        this.gridNum = mData.gridNum;
    }
Beispiel #6
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        if (!base.toDataEquals(data))
        {
            return(false);
        }

        ItemContainerData mData = (ItemContainerData)data;

        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.gridNum != mData.gridNum)
        {
            return(false);
        }

        return(true);
    }