public UIRecipeInfo() { UIPanel craftingPanel = new UIPanel(); craftingPanel.SetPadding(6); craftingPanel.Top.Set(-50, 1f); craftingPanel.Left.Set(180, 0f); craftingPanel.Width.Set(-180 - 2, 1f); //- 50 craftingPanel.Height.Set(50, 0f); craftingPanel.BackgroundColor = Color.CornflowerBlue; Append(craftingPanel); craftingTilesGrid = new UIHorizontalGrid(); craftingTilesGrid.Width.Set(0, 1f); craftingTilesGrid.Height.Set(0, 1f); craftingTilesGrid.ListPadding = 2f; craftingTilesGrid.OnScrollWheel += RecipeBrowserUI.OnScrollWheel_FixHotbarScroll; craftingPanel.Append(craftingTilesGrid); var craftingTilesGridScrollbar = new InvisibleFixedUIHorizontalScrollbar(RecipeBrowserUI.instance.userInterface); craftingTilesGridScrollbar.SetView(100f, 1000f); craftingTilesGridScrollbar.Width.Set(0, 1f); craftingTilesGridScrollbar.Top.Set(-20, 1f); craftingPanel.Append(craftingTilesGridScrollbar); craftingTilesGrid.SetScrollbar(craftingTilesGridScrollbar); //tileList = new List<UITileNoSlot>(); }
private void PopulateSortsAndFiltersPanel() { var availableSorts = new List <Sort>(sorts); availableFilters = new List <Filter>(filters); //sortsAndFiltersPanel.RemoveAllChildren(); if (subCategorySortsFiltersGrid != null) { sortsAndFiltersPanel.RemoveChild(subCategorySortsFiltersGrid); sortsAndFiltersPanel.RemoveChild(lootGridScrollbar2); } bool doTopRow = false; if (categoriesGrid == null) { doTopRow = true; categoriesGrid = new UIHorizontalGrid(); categoriesGrid.Width.Set(0, 1f); categoriesGrid.Height.Set(26, 0f); categoriesGrid.ListPadding = 2f; categoriesGrid.OnScrollWheel += RecipeBrowserUI.OnScrollWheel_FixHotbarScroll; sortsAndFiltersPanel.Append(categoriesGrid); categoriesGrid.drawArrows = true; var lootGridScrollbar = new InvisibleFixedUIHorizontalScrollbar(RecipeBrowserUI.instance.userInterface); lootGridScrollbar.SetView(100f, 1000f); lootGridScrollbar.Width.Set(0, 1f); lootGridScrollbar.Top.Set(0, 0f); sortsAndFiltersPanel.Append(lootGridScrollbar); categoriesGrid.SetScrollbar(lootGridScrollbar); } subCategorySortsFiltersGrid = new UIHorizontalGrid(); subCategorySortsFiltersGrid.Width.Set(0, 1f); subCategorySortsFiltersGrid.Top.Set(26, 0f); subCategorySortsFiltersGrid.Height.Set(26, 0f); subCategorySortsFiltersGrid.ListPadding = 2f; subCategorySortsFiltersGrid.OnScrollWheel += RecipeBrowserUI.OnScrollWheel_FixHotbarScroll; sortsAndFiltersPanel.Append(subCategorySortsFiltersGrid); subCategorySortsFiltersGrid.drawArrows = true; lootGridScrollbar2 = new InvisibleFixedUIHorizontalScrollbar(RecipeBrowserUI.instance.userInterface); lootGridScrollbar2.SetView(100f, 1000f); lootGridScrollbar2.Width.Set(0, 1f); lootGridScrollbar2.Top.Set(28, 0f); sortsAndFiltersPanel.Append(lootGridScrollbar2); subCategorySortsFiltersGrid.SetScrollbar(lootGridScrollbar2); //sortsAndFiltersPanelGrid = new UIGrid(); //sortsAndFiltersPanelGrid.Width.Set(0, 1); //sortsAndFiltersPanelGrid.Height.Set(0, 1); //sortsAndFiltersPanel.Append(sortsAndFiltersPanelGrid); //sortsAndFiltersPanelGrid2 = new UIGrid(); //sortsAndFiltersPanelGrid2.Width.Set(0, 1); //sortsAndFiltersPanelGrid2.Height.Set(0, 1); //sortsAndFiltersPanel.Append(sortsAndFiltersPanelGrid2); int count = 0; var visibleCategories = new List <Category>(); var visibleSubCategories = new List <Category>(); int left = 0; foreach (var category in categories) { category.button.selected = false; visibleCategories.Add(category); bool meOrChildSelected = SelectedCategory == category; foreach (var subcategory in category.subCategories) { subcategory.button.selected = false; meOrChildSelected |= subcategory == SelectedCategory; } if (meOrChildSelected) { visibleSubCategories.AddRange(category.subCategories); category.button.selected = true; } } if (doTopRow) { foreach (var category in visibleCategories) { var container = new UISortableElement(++count); container.Width.Set(24, 0); container.Height.Set(24, 0); //category.button.Left.Pixels = left; //if (category.parent != null) // container.OrderIndex // category.button.Top.Pixels = 12; //sortsAndFiltersPanel.Append(category.button); container.Append(category.button); categoriesGrid.Add(container); left += 26; } } //UISortableElement spacer = new UISortableElement(++count); //spacer.Width.Set(0, 1); //sortsAndFiltersPanelGrid2.Add(spacer); foreach (var category in visibleSubCategories) { var container = new UISortableElement(++count); container.Width.Set(24, 0); container.Height.Set(24, 0); container.Append(category.button); subCategorySortsFiltersGrid.Add(container); left += 26; } if (visibleSubCategories.Count > 0) { var container2 = new UISortableElement(++count); container2.Width.Set(24, 0); container2.Height.Set(24, 0); var image = new UIImage(RecipeBrowser.instance.GetTexture("Images/spacer")); //image.Left.Set(6, 0); image.HAlign = 0.5f; container2.Append(image); subCategorySortsFiltersGrid.Add(container2); } // add to sorts here if (SelectedCategory != null) { SelectedCategory.button.selected = true; SelectedCategory.ParentAddToSorts(availableSorts); } left = 0; foreach (var sort in availableSorts) { sort.button.selected = false; if (SelectedSort == sort) // TODO: SelectedSort no longwe valid { sort.button.selected = true; } //sort.button.Left.Pixels = left; //sort.button.Top.Pixels = 24; //sort.button.Width //grid.Add(sort.button); var container = new UISortableElement(++count); container.Width.Set(24, 0); container.Height.Set(24, 0); container.Append(sort.button); subCategorySortsFiltersGrid.Add(container); //sortsAndFiltersPanel.Append(sort.button); left += 26; } if (!availableSorts.Contains(SelectedSort)) { availableSorts[0].button.selected = true; SelectedSort = availableSorts[0]; updateNeeded = false; } if (filters.Count > 0) { var container2 = new UISortableElement(++count); container2.Width.Set(24, 0); container2.Height.Set(24, 0); var image = new UIImage(RecipeBrowser.instance.GetTexture("Images/spacer")); image.HAlign = 0.5f; container2.Append(image); subCategorySortsFiltersGrid.Add(container2); foreach (var item in filters) { var container = new UISortableElement(++count); container.Width.Set(24, 0); container.Height.Set(24, 0); container.Append(item.button); subCategorySortsFiltersGrid.Add(container); } } }
internal UIElement CreateBestiaryPanel() { mainPanel = new UIPanel(); mainPanel.SetPadding(6); mainPanel.BackgroundColor = color; mainPanel.Top.Set(20, 0f); mainPanel.Height.Set(-20, 1f); mainPanel.Width.Set(0, 1f); UIPanel npcGridPanel = new UIPanel(); npcGridPanel.SetPadding(6); npcGridPanel.Top.Pixels = 46; npcGridPanel.Width.Set(0, 1f); npcGridPanel.Left.Set(0, 0f); npcGridPanel.Height.Set(-52 - 46, 1f); npcGridPanel.BackgroundColor = Color.CornflowerBlue; mainPanel.Append(npcGridPanel); npcGrid = new UIGrid(); npcGrid.Width.Set(-20, 1f); npcGrid.Height.Set(0, 1f); npcGrid.ListPadding = 2f; npcGrid.OnScrollWheel += RecipeBrowserUI.OnScrollWheel_FixHotbarScroll; npcGridPanel.Append(npcGrid); var npcGridScrollbar = new FixedUIScrollbar(RecipeBrowserUI.instance.userInterface); npcGridScrollbar.SetView(100f, 1000f); npcGridScrollbar.Height.Set(0, 1f); npcGridScrollbar.Left.Set(-20, 1f); npcGridPanel.Append(npcGridScrollbar); npcGrid.SetScrollbar(npcGridScrollbar); UIPanel lootPanel = new UIPanel(); lootPanel.SetPadding(6); lootPanel.Top.Set(-50, 1f); lootPanel.Width.Set(0, .5f); lootPanel.Height.Set(50, 0f); lootPanel.BackgroundColor = Color.CornflowerBlue; mainPanel.Append(lootPanel); lootGrid = new UIHorizontalGrid(); lootGrid.Width.Set(0, 1f); lootGrid.Height.Set(0, 1f); lootGrid.ListPadding = 2f; lootGrid.OnScrollWheel += RecipeBrowserUI.OnScrollWheel_FixHotbarScroll; lootPanel.Append(lootGrid); var lootGridScrollbar = new InvisibleFixedUIHorizontalScrollbar(RecipeBrowserUI.instance.userInterface); lootGridScrollbar.SetView(100f, 1000f); lootGridScrollbar.Width.Set(0, 1f); lootGridScrollbar.Top.Set(-20, 1f); lootPanel.Append(lootGridScrollbar); lootGrid.SetScrollbar(lootGridScrollbar); queryItem = new UIBestiaryQueryItemSlot(new Item()); queryItem.emptyHintText = RBText("EmptyQuerySlotHint"); mainPanel.Append(queryItem); npcNameFilter = new NewUITextBox(RBText("FilterByName", "Common")); npcNameFilter.OnTextChanged += () => { ValidateNPCFilter(); updateNeeded = true; }; npcNameFilter.Top.Set(0, 0f); npcNameFilter.Left.Set(-150, 1f); npcNameFilter.Width.Set(150, 0f); npcNameFilter.Height.Set(25, 0f); mainPanel.Append(npcNameFilter); EncounteredRadioButton = new UICheckbox(RBText("Encountered"), RBText("ShowOnlyNPCKilledAlready")); EncounteredRadioButton.Top.Set(-40, 1f); EncounteredRadioButton.Left.Set(6, .5f); EncounteredRadioButton.OnSelectedChanged += (a, b) => updateNeeded = true; mainPanel.Append(EncounteredRadioButton); HasLootRadioButton = new UICheckbox(RBText("HasLoot"), RBText("ShowOnlyNPCWithLoot")); HasLootRadioButton.Top.Set(-20, 1f); HasLootRadioButton.Left.Set(6, .5f); HasLootRadioButton.OnSelectedChanged += (a, b) => updateNeeded = true; mainPanel.Append(HasLootRadioButton); NewLootOnlyRadioButton = new UICheckbox(RBText("NewLoot"), "???"); NewLootOnlyRadioButton.Top.Set(-20, 1f); NewLootOnlyRadioButton.Left.Set(110, .5f); NewLootOnlyRadioButton.OnSelectedChanged += (a, b) => { updateNeeded = true; /*HasLootRadioButton.Selected = true;*/ }; mainPanel.Append(NewLootOnlyRadioButton); if (RecipeBrowser.itemChecklistInstance != null) { NewLootOnlyRadioButton.OnSelectedChanged += ItemChecklistNewLootOnlyFilter_SelectedChanged; NewLootOnlyRadioButton.SetHoverText(RBText("ShowOnlyNPCWithNeverBeforeSeenLoot")); } else { NewLootOnlyRadioButton.SetDisabled(); NewLootOnlyRadioButton.SetHoverText(RBText("InstallItemChecklistToUse", "Common")); } updateNeeded = true; return(mainPanel); }
private void PopulateSortsAndFiltersPanel() { var availableSorts = new List <Sort>(sorts); availableFilters = new List <Filter>(filters); //sortsAndFiltersPanel.RemoveAllChildren(); if (subCategorySortsFiltersGrid != null) { sortsAndFiltersPanel.RemoveChild(subCategorySortsFiltersGrid); sortsAndFiltersPanel.RemoveChild(lootGridScrollbar2); } if (categoriesGrid == null) { categoriesGrid = new UIHorizontalGrid(); categoriesGrid.Width.Set(0, 1f); categoriesGrid.Height.Set(26, 0f); categoriesGrid.ListPadding = 2f; categoriesGrid.OnScrollWheel += RecipeBrowserUI.OnScrollWheel_FixHotbarScroll; sortsAndFiltersPanel.Append(categoriesGrid); categoriesGrid.drawArrows = true; categoriesGridScrollbar = new InvisibleFixedUIHorizontalScrollbar(RecipeBrowserUI.instance.userInterface); categoriesGridScrollbar.SetView(100f, 1000f); categoriesGridScrollbar.Width.Set(0, 1f); categoriesGridScrollbar.Top.Set(0, 0f); sortsAndFiltersPanel.Append(categoriesGridScrollbar); categoriesGrid.SetScrollbar(categoriesGridScrollbar); } subCategorySortsFiltersGrid = new UIHorizontalGrid(); subCategorySortsFiltersGrid.Width.Set(0, 1f); subCategorySortsFiltersGrid.Top.Set(26, 0f); subCategorySortsFiltersGrid.Height.Set(26, 0f); subCategorySortsFiltersGrid.ListPadding = 2f; subCategorySortsFiltersGrid.OnScrollWheel += RecipeBrowserUI.OnScrollWheel_FixHotbarScroll; sortsAndFiltersPanel.Append(subCategorySortsFiltersGrid); subCategorySortsFiltersGrid.drawArrows = true; float oldRow2ViewPosition = lootGridScrollbar2?.ViewPosition ?? 0f; lootGridScrollbar2 = new InvisibleFixedUIHorizontalScrollbar(RecipeBrowserUI.instance.userInterface); lootGridScrollbar2.SetView(100f, 1000f); lootGridScrollbar2.Width.Set(0, 1f); lootGridScrollbar2.Top.Set(28, 0f); sortsAndFiltersPanel.Append(lootGridScrollbar2); subCategorySortsFiltersGrid.SetScrollbar(lootGridScrollbar2); //sortsAndFiltersPanelGrid = new UIGrid(); //sortsAndFiltersPanelGrid.Width.Set(0, 1); //sortsAndFiltersPanelGrid.Height.Set(0, 1); //sortsAndFiltersPanel.Append(sortsAndFiltersPanelGrid); //sortsAndFiltersPanelGrid2 = new UIGrid(); //sortsAndFiltersPanelGrid2.Width.Set(0, 1); //sortsAndFiltersPanelGrid2.Height.Set(0, 1); //sortsAndFiltersPanel.Append(sortsAndFiltersPanelGrid2); int count = 0; var visibleCategories = new List <Category>(); var visibleSubCategories = new List <Category>(); int left = 0; foreach (var category in categories) { category.button.selected = false; visibleCategories.Add(category); bool meOrChildSelected = SelectedCategory == category; foreach (var subcategory in category.subCategories) { subcategory.button.selected = false; meOrChildSelected |= subcategory == SelectedCategory; } if (meOrChildSelected) { visibleSubCategories.AddRange(category.subCategories); category.button.selected = true; } if (RecipeBrowserUI.instance.CurrentPanel == RecipeBrowserUI.RecipeCatalogue && category.name == ArmorSetFeatureHelper.ArmorSetsHoverTest) { visibleCategories.Remove(category); } } float oldTopRowViewPosition = categoriesGridScrollbar?.ViewPosition ?? 0f; categoriesGrid.Clear(); foreach (var category in visibleCategories) { var container = new UISortableElement(++count); container.Width.Set(24, 0); container.Height.Set(24, 0); //category.button.Left.Pixels = left; //if (category.parent != null) // container.OrderIndex // category.button.Top.Pixels = 12; //sortsAndFiltersPanel.Append(category.button); container.Append(category.button); categoriesGrid.Add(container); left += 26; } //UISortableElement spacer = new UISortableElement(++count); //spacer.Width.Set(0, 1); //sortsAndFiltersPanelGrid2.Add(spacer); foreach (var category in visibleSubCategories) { var container = new UISortableElement(++count); container.Width.Set(24, 0); container.Height.Set(24, 0); container.Append(category.button); subCategorySortsFiltersGrid.Add(container); left += 26; } if (visibleSubCategories.Count > 0) { var container2 = new UISortableElement(++count); container2.Width.Set(24, 0); container2.Height.Set(24, 0); var image = new UIImage(RecipeBrowser.instance.GetTexture("Images/spacer")); //image.Left.Set(6, 0); image.HAlign = 0.5f; container2.Append(image); subCategorySortsFiltersGrid.Add(container2); } // add to sorts and filters here if (SelectedCategory != null) { SelectedCategory.button.selected = true; SelectedCategory.ParentAddToSorts(availableSorts); SelectedCategory.ParentAddToFilters(availableFilters); } left = 0; foreach (var sort in availableSorts) { sort.button.selected = false; if (SelectedSort == sort) // TODO: SelectedSort no longwe valid { sort.button.selected = true; } //sort.button.Left.Pixels = left; //sort.button.Top.Pixels = 24; //sort.button.Width //grid.Add(sort.button); var container = new UISortableElement(++count); container.Width.Set(24, 0); container.Height.Set(24, 0); container.Append(sort.button); subCategorySortsFiltersGrid.Add(container); //sortsAndFiltersPanel.Append(sort.button); left += 26; } if (!availableSorts.Contains(SharedUI.instance.SelectedSort)) { availableSorts[0].button.selected = true; SharedUI.instance.SelectedSort = availableSorts[0]; updateNeeded = false; } if (availableFilters.Count > 0) { var container2 = new UISortableElement(++count); container2.Width.Set(24, 0); container2.Height.Set(24, 0); var image = new UIImage(RecipeBrowser.instance.GetTexture("Images/spacer")); image.HAlign = 0.5f; container2.Append(image); subCategorySortsFiltersGrid.Add(container2); foreach (var item in availableFilters) { var container = new UISortableElement(++count); container.Width.Set(24, 0); container.Height.Set(24, 0); container.Append(item.button); subCategorySortsFiltersGrid.Add(container); } } // Restore view position after CycleFilter changes current filters. subCategorySortsFiltersGrid.Recalculate(); lootGridScrollbar2.ViewPosition = oldRow2ViewPosition; categoriesGrid.Recalculate(); //categoriesGridScrollbar.ViewPosition = oldTopRowViewPosition; // And after category disappears, not really needed since only 1 will disappear, unlike 2nd row. Test more if more special categories are added }