public BundleBagMenu(ItemBagMenu IBM, BundleBag Bag, int Columns, int SlotSize, bool ShowLockedSlots, int Padding)
        {
            this.IBM               = IBM;
            this.BundleBag         = Bag;
            this.IsJojaMember      = CommunityCenterBundles.Instance.IsJojaMember;
            Bag.OnContentsChanged += Bag_ContentsChanged;

            this.Padding = Padding;

            this.ColumnCount      = Columns;
            this.OriginalSlotSize = SlotSize;
            this.SlotSize         = SlotSize;
            this.ShowLockedSlots  = ShowLockedSlots;

            this.ItemPlaceholders = new Dictionary <BundleItem, Object>();
            CommunityCenterBundles.Instance.IterateAllBundleItems(x =>
            {
                if (!BundleBag.InvalidRooms[BundleBag.Size].Contains(x.Task.Room.Name))
                {
                    if (!x.IsCompleted)
                    {
                        ItemPlaceholders.Add(x, x.ToObject());
                    }
                }
            });

            UpdateQuantities();
            SetTopLeft(Point.Zero, false);
            InitializeLayout(1);
        }
示例#2
0
 /// <param name="Source">Typically this is <see cref="Game1.player.Items"/> if this menu should display the player's inventory.</param>
 /// <param name="ActualCapacity">If non-null, allows you to override the maximum # of items that can be stored in the Source list</param>
 /// <param name="InventoryColumns">The number of columns to use when rendering the user's inventory at the bottom-half of the menu. Recommended = 12 to mimic the default inventory of the main GameMenu</param>
 /// <param name="InventorySlotSize">The size, in pixels, to use when rendering each slot of the user's inventory at the bottom-half of the menu. Recommended = <see cref="DefaultInventoryIconSize"/></param>
 public BagInventoryMenu(ItemBagMenu IBM, ItemBag Bag, IList <Item> Source, int?ActualCapacity, int InventoryColumns, int InventorySlotSize = DefaultInventoryIconSize)
 {
     this.IBM               = IBM;
     this.Bag               = Bag;
     this.Source            = Source;
     this.ActualCapacity    = ActualCapacity.HasValue ? Math.Max(ActualCapacity.Value, Source.Count) : Source.Count;
     this.InventoryColumns  = InventoryColumns;
     this.InventorySlotSize = InventorySlotSize;
     SetTopLeft(Point.Zero, false);
     InitializeLayout(1);
 }
示例#3
0
        /// <param name="PreviewableCopy">A copy of Parameter=<paramref name="Bag"/>. Changes will be made to this copy while the user is previewing different icons.</param>
        public CustomizeIconMenu(ItemBagMenu BagMenu, ItemBag Bag, ItemBag PreviewableCopy, int Padding)
        {
            this.Texture = Game1.objectSpriteSheet;

            this.IBM = BagMenu;
            this.Bag = Bag;

            this.Padding = Padding;

            this.PreviewBag      = PreviewableCopy;
            this.PreviewBag.Icon = this.Texture;
            this.PreviewBag.IconTexturePosition = Bag.IconTexturePosition;

            InitializeLayout(1);
        }
示例#4
0
        public RucksackMenu(ItemBagMenu IBM, Rucksack Bag, int Columns, int SlotSize, bool ShowLockedSlots, int Padding)
        {
            this.IBM               = IBM;
            this.Rucksack          = Bag;
            Bag.OnContentsChanged += Bag_ContentsChanged;
            this.Padding           = Padding;

            this.ColumnCount      = Math.Min(Rucksack.NumSlots, Columns);
            this.OriginalSlotSize = SlotSize;
            this.SlotSize         = SlotSize;
            this.ShowLockedSlots  = ShowLockedSlots;

            this.IsRightSidebarVisible = true;

            InitializePlaceholders();
            SetTopLeft(Point.Zero, false);
            InitializeLayout(1);
        }
示例#5
0
        public OmniBagMenu(ItemBagMenu IBM, OmniBag Bag, int Columns, int SlotSize, bool ShowLockedSlots, int Padding)
        {
            this.IBM               = IBM;
            this.OmniBag           = Bag;
            Bag.OnContentsChanged += Bag_ContentsChanged;

            this.Padding = Padding;

            this.ColumnCount      = Columns;
            this.OriginalSlotSize = SlotSize;
            this.SlotSize         = SlotSize;
            this.ShowLockedSlots  = ShowLockedSlots;

            //  Create a placeholder item for every kind of bag the OmniBag can store
            List <ItemBag> Temp = new List <ItemBag>();

            if (BundleBag.ValidSizes.Any(x => x <= this.Bag.Size))
            {
                ContainerSize PlaceholderSize = BundleBag.ValidSizes.OrderByDescending(x => x).First(x => x <= this.Bag.Size);
                Temp.Add(new BundleBag(PlaceholderSize, false));
            }
            Temp.Add(new Rucksack(Bag.Size, false));
            foreach (BagType BagType in ItemBagsMod.BagConfig.BagTypes)
            {
                if (BagType.SizeSettings.Any(x => x.Size <= this.Bag.Size))
                {
                    ContainerSize PlaceholderSize = BagType.SizeSettings.Select(x => x.Size).OrderByDescending(x => x).First(x => x <= this.Bag.Size);
                    Temp.Add(new BoundedBag(BagType, PlaceholderSize, false));
                }
            }
            this.Placeholders = new ReadOnlyCollection <ItemBag>(Temp);

            this.ActualContents = new List <ItemBag>();
            for (int i = 0; i < Temp.Count; i++)
            {
                ActualContents.Add(null);
            }
            UpdateActualContents();

            SetTopLeft(Point.Zero, false);
            InitializeLayout(1);
        }
示例#6
0
        public BoundedBagMenu(ItemBagMenu IBM, BoundedBag Bag, bool GroupContentsByQuality, GroupedLayoutOptions GroupedLayout, UngroupedLayoutOptions UngroupedLayout, int Padding)
        {
            this.IBM        = IBM;
            this.BoundedBag = Bag;
            this.Padding    = Padding;

            this.GroupByQuality = GroupContentsByQuality;
            this.GroupedOptions = GroupedLayout;
            this.GroupedOptions.SetParent(this);
            this.GroupedOptions.OnItemSlotRendered += OnItemSlotRendered;
            this.UngroupedOptions = UngroupedLayout;
            this.UngroupedOptions.SetParent(this);
            this.UngroupedOptions.OnItemSlotRendered += OnItemSlotRendered;

            if (!GroupedOptions.IsEmptyMenu && !UngroupedOptions.IsEmptyMenu)
            {
                GroupedOptions.MenuNeighbors[NavigationDirection.Down] = UngroupedOptions;
                UngroupedOptions.MenuNeighbors[NavigationDirection.Up] = GroupedOptions;
            }

            SetTopLeft(Point.Zero, false);
            InitializeLayout(1);
        }
示例#7
0
 public BoundedBagMenu(ItemBagMenu IBM, BoundedBag Bag, BagMenuOptions Opts, int Padding)
     : this(IBM, Bag, Opts.GroupByQuality, new GroupedLayoutOptions(Opts.GroupedLayoutOptions), new UngroupedLayoutOptions(Opts.UngroupedLayoutOptions), Padding)
 {
 }