Example #1
0
        public bool MoveToBag(ItemBag Bag, bool PlaySoundEffect, IList <Item> Source, bool NotifyIfContentsChanged)
        {
            if (!IsValidBag(Bag) || NestedBags.Any(x => x.GetTypeId() == Bag.GetTypeId()) || !Source.Contains(Bag))
            {
                if (PlaySoundEffect)
                {
                    Game1.playSound(MoveContentsFailedSound);
                }
                return(false);
            }
            else
            {
                NestedBags.Add(Bag);
                Source[Source.IndexOf(Bag)] = null;

                if (NotifyIfContentsChanged)
                {
                    OnContentsChanged?.Invoke(this, EventArgs.Empty);
                }
                Resync();
                if (PlaySoundEffect)
                {
                    Game1.playSound(MoveContentsSuccessSound);
                }
                return(true);
            }
        }