示例#1
0
        private void HandlePrimaryAction()
        {
            if ((IsLeftSidebarVisible || IsRightSidebarVisible) && HoveredButton.HasValue)
            {
                if (IsLeftSidebarVisible && HoveredButton.Value == SidebarButton.DepositAll)
                {
                    List <Object> ToDeposit = InventorySource.Where(x => x != null && x is Object Obj && Bag.IsValidBagObject(Obj)).Cast <Object>().ToList();
                    Bag.MoveToBag(ToDeposit, ToDeposit.Select(x => x.Stack).ToList(), out int TotalMovedQty, true, InventorySource);
                }
                else if (IsLeftSidebarVisible && HoveredButton.Value == SidebarButton.WithdrawAll)
                {
                    List <Object> ToWithdraw = Bag.Contents.Where(x => x != null).ToList();
                    Bag.MoveFromBag(ToWithdraw, ToWithdraw.Select(x => x.Stack).ToList(), out int TotalMovedQty, true, InventorySource, ActualInventoryCapacity);
                }
                else if (IsLeftSidebarVisible && HoveredButton.Value == SidebarButton.Autoloot)
                {
                    if (Bag is BoundedBag BB)
                    {
                        BB.Autofill = !BB.Autofill;
                    }
                    else if (Bag is Rucksack RS)
                    {
                        RS.CycleAutofill();
                    }
                }
                else if (IsRightSidebarVisible && HoveredButton.Value == SidebarButton.HelpInfo)
                {
                }
                else if (IsRightSidebarVisible && HoveredButton.Value == SidebarButton.CustomizeIcon && Bag.CanCustomizeIcon())
                {
                    ItemBag Copy;
                    if (Bag is BoundedBag BB)
                    {
                        if (BB is BundleBag)
                        {
                            Copy = new BundleBag(Bag.Size, false);
                        }
                        else
                        {
                            Copy = new BoundedBag(BB.TypeInfo, Bag.Size, false);
                        }
                    }
                    else if (Bag is Rucksack RS)
                    {
                        Copy = new Rucksack(Bag.Size, false);
                    }
                    else if (Bag is OmniBag OB)
                    {
                        Copy = new OmniBag(Bag.Size);
                    }
                    else
                    {
                        throw new NotImplementedException(string.Format("Unexpected Bag Type while creating CustomizeIconMenu: {0}", Bag.GetType().ToString()));
                    }

                    CustomizeIconMenu = new CustomizeIconMenu(this, this.Bag, Copy, 24);
                }
            }
        }