コード例 #1
0
        public void Union(ContainerModule container)
        {
            Count++;

            MarkAsSearched(container);

            foreach (Item item in container.AllItems)
            {
                // When added to the union container, same items will not stack.
                // This is necessary to return they to their places if
                // the player will not pick them up before closing the exchange window.
                MergedContainer.AddItem(item, stackItem: false);

                _itemToContainer.Add(item, container);
            }
        }
コード例 #2
0
        private void DistributeItems()
        {
            foreach (var pair in _itemToContainer)
            {
                var item  = pair.Key;
                var owner = pair.Value;

                if (MergedContainer.Contains(item))
                {
                    // Forget about the items left in the container.
                    // They still lie in specific containers.
                    // The number of items on the stack could change - it will change in place.
                    MergedContainer.RemoveItemStack(item, unequip: false);
                }
                else
                {
                    owner.RemoveItemStack(item, unequip: true);
                }
            }

            _itemToContainer.Clear();
        }