private void Clear() { gridFilterItem.Clear(); gridFilterChestType.Clear(); gridChest.Clear(); panelMain.DragTargetClear(); chestTypeExist = new bool[Chest.chestTypeToIcon.Length]; dresserTypeExist = new bool[Chest.dresserTypeToIcon.Length]; panelSplitter.Recalculate(); }
internal void UpdateGrid() { if (!updateNeeded) { return; } updateNeeded = false; chestGrid.Clear(); mainPanel.DragTargetClear(); mainPanel.AddDragTarget(inlaidPanel); mainPanel.AddDragTarget(chestGrid); Clear(); var rect = ChestBrowserUtils.GetSearchRangeRectangle(); foreach (var chest in Main.chest.Where(x => x != null && (ModContent.GetInstance <ChestBrowserConfig>().isInfinityRange ? true : rect.Contains(x.x, x.y)))) { int itemType = -1; bool isDresser = chest.isDresser(); int iconIndex = chest.getIconIndex(); if (isDresser && !FilterItemTypeUI.dresserTypeExist[iconIndex]) { FilterItemTypeUI.dresserTypeExist[iconIndex] = true; itemType = Chest.dresserTypeToIcon[iconIndex]; } else if (!isDresser && !FilterItemTypeUI.chestTypeExist[iconIndex]) { FilterItemTypeUI.chestTypeExist[iconIndex] = true; itemType = Chest.chestTypeToIcon[iconIndex]; } if (0 <= itemType) { var box = new UIFilterChestSlot(isDresser, iconIndex, chest.ToItem()); chestGrid._items.Add(box); chestGrid._innerList.Append(box); mainPanel.AddDragTarget(box); } } chestGrid.UpdateOrder(); chestGrid._innerList.Recalculate(); mainPanel.caption = caption.Replace("??", $"{chestGrid.Count}"); }