private static void InitFilterButtons() { if (filterButtons == null) { filterButtons = new UIButtonChoice(new Texture2D[] { MagicStorage.Instance.GetTexture("FilterAll"), MagicStorage.Instance.GetTexture("FilterMelee"), MagicStorage.Instance.GetTexture("FilterPickaxe"), MagicStorage.Instance.GetTexture("FilterArmor"), MagicStorage.Instance.GetTexture("FilterPotion"), MagicStorage.Instance.GetTexture("FilterTile"), MagicStorage.Instance.GetTexture("FilterMisc"), }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.FilterAll"), Language.GetText("Mods.MagicStorage.FilterWeapons"), Language.GetText("Mods.MagicStorage.FilterTools"), Language.GetText("Mods.MagicStorage.FilterEquips"), Language.GetText("Mods.MagicStorage.FilterPotions"), Language.GetText("Mods.MagicStorage.FilterTiles"), Language.GetText("Mods.MagicStorage.FilterMisc") }); } }
private static void InitFilterButtons() { if (filterButtons == null) { filterButtons = new UIButtonChoice(new Texture2D[] { MagicStorage.Instance.GetTexture("FilterAll"), MagicStorage.Instance.GetTexture("FilterMelee"), MagicStorage.Instance.GetTexture("FilterPickaxe"), MagicStorage.Instance.GetTexture("FilterArmor"), MagicStorage.Instance.GetTexture("FilterPotion"), MagicStorage.Instance.GetTexture("FilterTile"), MagicStorage.Instance.GetTexture("FilterMisc"), }, new string[] { "Filter All", "Filter Weapons", "Filter Tools", "Filter Equipment", "Filter Potions", "Filter Placeables", "Filter Misc" }); } }
private static void InitSubFilterButtons() { if (subFilterButtons == null) { subFilterButtons = new UIButtonChoice(new Texture2D[] { MagicStorage.Instance.GetTexture("Icons/FilterAll"), }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.FilterAll"), }); } }
private static void InitSortButtons() { if (sortButtons == null) { sortButtons = new UIButtonChoice(new Texture2D[] { Main.inventorySortTexture[0], MagicStorage.Instance.GetTexture("SortID"), MagicStorage.Instance.GetTexture("SortName"), MagicStorage.Instance.GetTexture("SortNumber") }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.SortDefault"), Language.GetText("Mods.MagicStorage.SortID"), Language.GetText("Mods.MagicStorage.SortName"), Language.GetText("Mods.MagicStorage.SortStack") }); } }
private static void InitSortButtons() { if (sortButtons == null) { sortButtons = new UIButtonChoice(new Texture2D[] { Main.inventorySortTexture[0], MagicStorage.Instance.GetTexture("SortID"), MagicStorage.Instance.GetTexture("SortName"), MagicStorage.Instance.GetTexture("SortNumber") }, new string[] { "Default Sorting", "Sort By ID", "Sort By Name", "Sort By Stacks" }); } }
internal static void Unload() { sortButtons = null; filterButtons = null; }
public override void OnInitialize() { float slotWidth = Main.inventoryBackTexture.Width * inventoryScale; float slotHeight = Main.inventoryBackTexture.Height * inventoryScale; float panelTop = Main.instance.invBottom + 60; float panelLeft = 20f; UIPanel panel = new UIPanel(); float innerPanelLeft = panelLeft + panel.PaddingLeft; float innerPanelWidth = columns * (slotWidth + padding) + 20f + padding; float panelWidth = panel.PaddingLeft + innerPanelWidth + panel.PaddingRight; float panelHeight = Main.screenHeight - panelTop - 40f; panel.Left.Set(panelLeft, 0f); panel.Top.Set(panelTop, 0f); panel.Width.Set(panelWidth, 0f); panel.Height.Set(panelHeight, 0f); panel.Recalculate(); UIElement topBar = new UIElement(); topBar.Width.Set(0f, 1f); topBar.Height.Set(32f, 0f); panel.Append(topBar); sortButtons = new UIButtonChoice(new Texture2D[] { Main.inventorySortTexture[0], MagicStorage.Instance.GetTexture("Assets/SortID"), MagicStorage.Instance.GetTexture("Assets/SortName"), MagicStorage.Instance.GetTexture("Assets/SortNumber") }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.Common.SortDefault"), Language.GetText("Mods.MagicStorage.Common.SortID"), Language.GetText("Mods.MagicStorage.Common.SortName"), Language.GetText("Mods.MagicStorage.Common.SortStack") }); sortButtons.OnClick += (a, b) => { if ((SortMode)sortButtons.choice != sortMode) { sortMode = (SortMode)sortButtons.choice; RefreshItems(); } }; topBar.Append(sortButtons); UITextPanel <LocalizedText> depositButton = new UITextPanel <LocalizedText>(Language.GetText("Mods.MagicStorage.Common.DepositAll"), 1f); depositButton.Left.Set(sortButtons.GetDimensions().Width + 2 * padding, 0f); depositButton.Width.Set(128f, 0f); depositButton.Height.Set(-2 * padding, 1f); depositButton.PaddingTop = 8f; depositButton.PaddingBottom = 8f; depositButton.OnClick += ClickDeposit; depositButton.OnMouseOver += (a, b) => depositButton.BackgroundColor = lightBlue; depositButton.OnMouseOut += (a, b) => depositButton.BackgroundColor = blue; topBar.Append(depositButton); float depositButtonRight = sortButtons.GetDimensions().Width + 2 * padding + depositButton.GetDimensions().Width; searchBar = new UISearchBar(Language.GetText("Mods.MagicStorage.Common.SearchName")); searchBar.Left.Set(depositButtonRight + padding, 0f); searchBar.Width.Set(-depositButtonRight - 2 * padding, 1f); searchBar.Height.Set(0f, 1f); topBar.Append(searchBar); UIElement topBar2 = new UIElement(); topBar2.Width.Set(0f, 1f); topBar2.Height.Set(32f, 0f); topBar2.Top.Set(36f, 0f); panel.Append(topBar2); filterButtons = new UIButtonChoice(new Texture2D[] { MagicStorage.Instance.GetTexture("Assets/FilterAll"), MagicStorage.Instance.GetTexture("Assets/FilterMelee"), MagicStorage.Instance.GetTexture("Assets/FilterPickaxe"), MagicStorage.Instance.GetTexture("Assets/FilterArmor"), MagicStorage.Instance.GetTexture("Assets/FilterPotion"), MagicStorage.Instance.GetTexture("Assets/FilterTile"), MagicStorage.Instance.GetTexture("Assets/FilterMisc"), }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.Common.FilterAll"), Language.GetText("Mods.MagicStorage.Common.FilterWeapons"), Language.GetText("Mods.MagicStorage.Common.FilterTools"), Language.GetText("Mods.MagicStorage.Common.FilterEquips"), Language.GetText("Mods.MagicStorage.Common.FilterPotions"), Language.GetText("Mods.MagicStorage.Common.FilterTiles"), Language.GetText("Mods.MagicStorage.Common.FilterMisc") }); filterButtons.OnClick += (a, b) => { if ((FilterMode)filterButtons.choice != filterMode) { filterMode = (FilterMode)filterButtons.choice; RefreshItems(); } }; topBar2.Append(filterButtons); searchBar2 = new UISearchBar(Language.GetText("Mods.MagicStorage.Common.SearchMod")); searchBar2.Left.Set(depositButtonRight + padding, 0f); searchBar2.Width.Set(-depositButtonRight - 2 * padding, 1f); searchBar2.Height.Set(0f, 1f); topBar2.Append(searchBar2); slotZone = new UISlotZone(GetItem, inventoryScale); slotZone.Width.Set(0f, 1f); slotZone.Top.Set(76f, 0f); slotZone.Height.Set(-116f, 1f); slotZone.OnMouseDown += PressSlotZone; panel.Append(slotZone); UIScrollbar scrollbar = new UIScrollbar(); scrollbar.Left.Set(10, 0); slotZone.SetScrollbar(scrollbar); panel.Append(scrollbar); capacityText = new UIText(string.Empty); capacityText.Top.Set(-32f, 1f); capacityText.Left.Set(6f, 0f); capacityText.Height.Set(32f, 0); panel.Append(capacityText); float slotZoneHeight = capacityText.GetDimensions().Y - (filterButtons.GetDimensions().Y + filterButtons.GetDimensions().Height); slotZone.SetDimensions(columns, (int)(slotZoneHeight / (slotHeight + slotZone.padding))); Append(panel); }
private static void UpdateSubFilterButtons() { //subFilterButtons = null; if (subFilterButtons != null) { switch (filterMode) { case FilterMode.All: subFilterButtons.UpdateButtons(new Texture2D[] { MagicStorage.Instance.GetTexture("Icons/FilterAll"), }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.FilterAll"), }); break; case FilterMode.Weapons: subFilterButtons = new UIButtonChoice(new Texture2D[] { MagicStorage.Instance.GetTexture("Icons/FilterAll"), MagicStorage.Instance.GetTexture("Icons/FilterMelee"), MagicStorage.Instance.GetTexture("Icons/FilterRanged"), MagicStorage.Instance.GetTexture("Icons/FilterMagic"), MagicStorage.Instance.GetTexture("Icons/FilterSummon"), MagicStorage.Instance.GetTexture("Icons/FilterThrowing"), MagicStorage.Instance.GetTexture("Icons/FilterOtherWeapon"), }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.FilterAll"), Language.GetText("Mods.MagicStorage.FilterMelee"), Language.GetText("Mods.MagicStorage.FilterRanged"), Language.GetText("Mods.MagicStorage.FilterMagic"), Language.GetText("Mods.MagicStorage.FilterSummon"), Language.GetText("Mods.MagicStorage.FilterThrowing"), Language.GetText("Mods.MagicStorage.FilterOtherWeapons") }); break; case FilterMode.Tools: subFilterButtons = new UIButtonChoice(new Texture2D[] { MagicStorage.Instance.GetTexture("Icons/FilterAll"), MagicStorage.Instance.GetTexture("Icons/FilterAxe"), MagicStorage.Instance.GetTexture("Icons/FilterHammer"), MagicStorage.Instance.GetTexture("Icons/FilterPickaxe"), }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.FilterAll"), Language.GetText("Mods.MagicStorage.FilterAxe"), Language.GetText("Mods.MagicStorage.FilterHammer"), Language.GetText("Mods.MagicStorage.FilterPickaxe"), }); break; case FilterMode.Equipment: subFilterButtons = new UIButtonChoice(new Texture2D[] { MagicStorage.Instance.GetTexture("Icons/FilterAll"), MagicStorage.Instance.GetTexture("Icons/FilterArmor"), MagicStorage.Instance.GetTexture("Icons/FilterAccessory"), MagicStorage.Instance.GetTexture("Icons/FilterGrapple"), MagicStorage.Instance.GetTexture("Icons/FilterMount"), MagicStorage.Instance.GetTexture("Icons/FilterPet"), MagicStorage.Instance.GetTexture("Icons/FilterDye"), MagicStorage.Instance.GetTexture("Icons/FilterVanity"), }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.FilterAll"), Language.GetText("Mods.MagicStorage.FilterArmor"), Language.GetText("Mods.MagicStorage.FilterAccessory"), Language.GetText("Mods.MagicStorage.FilterGrapple"), Language.GetText("Mods.MagicStorage.FilterMount"), Language.GetText("Mods.MagicStorage.FilterPet"), Language.GetText("Mods.MagicStorage.FilterDye"), Language.GetText("Mods.MagicStorage.FilterVanity"), }); break; case FilterMode.Potions: subFilterButtons = new UIButtonChoice(new Texture2D[] { MagicStorage.Instance.GetTexture("Icons/FilterAll"), MagicStorage.Instance.GetTexture("Icons/FilterRecovery"), MagicStorage.Instance.GetTexture("Icons/FilterFood"), MagicStorage.Instance.GetTexture("Icons/FilterBuff"), MagicStorage.Instance.GetTexture("Icons/FilterOtherPotions"), }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.FilterAll"), Language.GetText("Mods.MagicStorage.FilterRecovery"), Language.GetText("Mods.MagicStorage.FilterFood"), Language.GetText("Mods.MagicStorage.FilterBuff"), Language.GetText("Mods.MagicStorage.FilterOtherPotions"), }); break; case FilterMode.Placeables: subFilterButtons = new UIButtonChoice(new Texture2D[] { MagicStorage.Instance.GetTexture("Icons/FilterAll"), MagicStorage.Instance.GetTexture("Icons/FilterTile"), MagicStorage.Instance.GetTexture("Icons/FilterOre"), MagicStorage.Instance.GetTexture("Icons/FilterRoomNeeds"), MagicStorage.Instance.GetTexture("Icons/FilterStatue"), MagicStorage.Instance.GetTexture("Icons/FilterBanner"), MagicStorage.Instance.GetTexture("Icons/FilterCrate"), MagicStorage.Instance.GetTexture("Icons/FilterMaterial"), MagicStorage.Instance.GetTexture("Icons/FilterOtherPlaceables"), }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.FilterAll"), Language.GetText("Mods.MagicStorage.FilterBlock"), Language.GetText("Mods.MagicStorage.FilterOre"), Language.GetText("Mods.MagicStorage.FilterRoomNeeds"), Language.GetText("Mods.MagicStorage.FilterStatue"), Language.GetText("Mods.MagicStorage.FilterBanner"), Language.GetText("Mods.MagicStorage.FilterCrate"), Language.GetText("Mods.MagicStorage.FilterMaterial"), Language.GetText("Mods.MagicStorage.FilterOtherPlaceables"), }); break; default: subFilterButtons = new UIButtonChoice(new Texture2D[] { MagicStorage.Instance.GetTexture("Icons/FilterAll"), }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.FilterAll"), }); break; } } }
public override void OnInitialize() { float slotWidth = Main.inventoryBackTexture.Width * inventoryScale; float slotHeight = Main.inventoryBackTexture.Height * inventoryScale; float smallSlotWidth = Main.inventoryBackTexture.Width * smallScale; float smallSlotHeight = Main.inventoryBackTexture.Height * smallScale; float panelTop = Main.instance.invBottom + 60; float panelLeft = 20f; UIPanel panel = new UIPanel(); float innerPanelLeft = panelLeft + panel.PaddingLeft; float innerPanelWidth = columns * (slotWidth + padding) + 20f + padding; float panelWidth = panel.PaddingLeft + innerPanelWidth + panel.PaddingRight; float panelHeight = Main.screenHeight - panelTop - 40f; panel.Left.Set(panelLeft, 0f); panel.Top.Set(panelTop, 0f); panel.Width.Set(panelWidth, 0f); panel.Height.Set(panelHeight, 0f); panel.Recalculate(); UIPanel recipePanel = new UIPanel(); float recipeLeft = panelLeft + panelWidth; float recipeWidth = columns2 * (smallSlotWidth + padding); recipeWidth += recipePanel.PaddingLeft + recipePanel.PaddingRight; recipePanel.Top = panel.Top; recipePanel.Left.Set(recipeLeft, 0f); recipePanel.Width.Set(recipeWidth, 0f); UIElement topBar = new UIElement(); topBar.Width.Set(0f, 1f); topBar.Height.Set(32f, 0f); panel.Append(topBar); sortButtons = new UIButtonChoice(new Texture2D[] { Main.inventorySortTexture[0], MagicStorage.Instance.GetTexture("Assets/SortID"), MagicStorage.Instance.GetTexture("Assets/SortName") }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.Common.SortDefault"), Language.GetText("Mods.MagicStorage.Common.SortID"), Language.GetText("Mods.MagicStorage.Common.SortName") }); sortButtons.OnClick += ClickSortButtons; topBar.Append(sortButtons); float sortButtonsRight = sortButtons.GetDimensions().Width + padding; recipeButtons = new UIButtonChoice(new Texture2D[] { MagicStorage.Instance.GetTexture("Assets/RecipeAvailable"), MagicStorage.Instance.GetTexture("Assets/RecipeAll") }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.Common.RecipeAvailable"), Language.GetText("Mods.MagicStorage.Common.RecipeAll") }); recipeButtons.OnClick += ClickRecipeButtons; float recipeButtonsLeft = sortButtonsRight + 32f + 3 * padding; recipeButtons.Left.Set(recipeButtonsLeft, 0f); topBar.Append(recipeButtons); float recipeButtonsRight = recipeButtonsLeft + recipeButtons.GetDimensions().Width + padding; searchBar = new UISearchBar(Language.GetText("Mods.MagicStorage.Common.SearchName")); searchBar.Left.Set(recipeButtonsRight + padding, 0f); searchBar.Width.Set(-recipeButtonsRight - 2 * padding, 1f); searchBar.Height.Set(0f, 1f); topBar.Append(searchBar); UIElement topBar2 = new UIElement(); topBar2.Width.Set(0f, 1f); topBar2.Height.Set(32f, 0f); topBar2.Top.Set(36f, 0f); panel.Append(topBar2); filterButtons = new UIButtonChoice(new Texture2D[] { MagicStorage.Instance.GetTexture("Assets/FilterAll"), MagicStorage.Instance.GetTexture("Assets/FilterMelee"), MagicStorage.Instance.GetTexture("Assets/FilterPickaxe"), MagicStorage.Instance.GetTexture("Assets/FilterArmor"), MagicStorage.Instance.GetTexture("Assets/FilterPotion"), MagicStorage.Instance.GetTexture("Assets/FilterTile"), MagicStorage.Instance.GetTexture("Assets/FilterMisc"), }, new LocalizedText[] { Language.GetText("Mods.MagicStorage.Common.FilterAll"), Language.GetText("Mods.MagicStorage.Common.FilterWeapons"), Language.GetText("Mods.MagicStorage.Common.FilterTools"), Language.GetText("Mods.MagicStorage.Common.FilterEquips"), Language.GetText("Mods.MagicStorage.Common.FilterPotions"), Language.GetText("Mods.MagicStorage.Common.FilterTiles"), Language.GetText("Mods.MagicStorage.Common.FilterMisc") }); filterButtons.OnClick += ClickFilterButtons; topBar2.Append(filterButtons); float filterButtonsRight = filterButtons.GetDimensions().Width + padding; searchBar2 = new UISearchBar(Language.GetText("Mods.MagicStorage.Common.SearchMod")); searchBar2.Left.Set(filterButtonsRight + padding, 0f); searchBar2.Width.Set(-filterButtonsRight - 2 * padding, 1f); searchBar2.Height.Set(0f, 1f); topBar2.Append(searchBar2); UIText stationText = new UIText(Language.GetText("Mods.MagicStorage.Common.CraftingStations")); stationText.Top.Set(76f, 0f); panel.Append(stationText); stationZone = new UISlotZone(GetStation, inventoryScale); stationZone.Top.Set(100f, 0f); stationZone.SetDimensions(columns, 1); stationZone.OnMouseDown += PressStation; panel.Append(stationZone); UIText recipeText = new UIText(Language.GetText("Mods.MagicStorage.Common.Recipes")); recipeText.Top.Set(152f, 0f); panel.Append(recipeText); recipeZone = new UISlotZone(GetRecipe, GetRecipeColor, inventoryScale); recipeZone.Top.Set(176f, 0f); recipeZone.OnMouseDown += PressRecipe; panel.Append(recipeZone); UIScrollbar scrollbar = new UIScrollbar(); scrollbar.Left.Set(10, 0); recipeZone.SetScrollbar(scrollbar); panel.Append(scrollbar); recipeZone.SetDimensions(columns, (int)((panel.Height.Pixels - panel.PaddingBottom - recipeZone.Top.Pixels) / (slotHeight + 2 * recipeZone.padding))); UIText recipePanelHeader = new UIText(Language.GetText("Mods.MagicStorage.Common.SelectedRecipe")); recipePanel.Append(recipePanelHeader); UIText ingredientText = new UIText(Language.GetText("Mods.MagicStorage.Common.Ingredients")); ingredientText.Top.Set(30f, 0f); recipePanel.Append(ingredientText); previewZone = new UISlotZone(GetSelectedItem, inventoryScale); previewZone.Top.Set(0f, 0f); previewZone.Left.Set(-slotWidth, 1f); recipePanel.Append(previewZone); ingredientZone = new UISlotZone(GetIngredient, smallScale); ingredientZone.Top.Set(54f, 0f); ingredientZone.SetDimensions(recipePanelColumns, ingredientRows); ingredientZone.OnMouseDown += PressIngredient; recipePanel.Append(ingredientZone); UIText reqObjText = new UIText(Language.GetText("LegacyInterface.22")); reqObjText.Top.Set(136f, 0f); recipePanel.Append(reqObjText); reqObjText2 = new UIText(String.Empty); reqObjText2.Top.Set(160f, 0f); recipePanel.Append(reqObjText2); UIText storedItemsText = new UIText(Language.GetText("Mods.MagicStorage.Common.StoredItems")); storedItemsText.Top.Set(190f, 0f); recipePanel.Append(storedItemsText); storageZone = new UISlotZone(GetStorage, smallScale); storageZone.Top.Set(214f, 0f); recipePanel.Append(storageZone); craftButton = new UITextPanel <LocalizedText>(Language.GetText("LegacyMisc.72"), 1f); craftButton.Top.Set(-32f, 1f); craftButton.Width.Set(100f, 0f); craftButton.Height.Set(24f, 0f); craftButton.PaddingTop = 8f; craftButton.PaddingBottom = 8f; recipePanel.Append(craftButton); resultZone = new UISlotZone(GetResultItem, inventoryScale); resultZone.Left.Set(-slotWidth, 1f); resultZone.Top.Set(-slotHeight, 1f); resultZone.OnMouseDown += PressResult; recipePanel.Append(resultZone); float recipeHeight = 0; for (int k = storageRows; k > 0; k--) { storageZone.SetDimensions(recipePanelColumns, k); recipeHeight = storageZone.Height.Pixels + ingredientZone.Height.Pixels + 230f; if (recipeHeight < panel.Height.Pixels) { break; } } recipePanel.Height.Set(recipeHeight, 0f); recipePanel.Recalculate(); Append(panel); Append(recipePanel); }