All & none category icons updated; mineral image changed; filter squashed to one line and moved below categories
This commit is contained in:
parent
f253eb74e5
commit
8586d6fc3a
|
@ -8,13 +8,13 @@ function update_category_list()
|
|||
table.insert(category_list, {
|
||||
name = "all",
|
||||
label = "All",
|
||||
symbol = "ui_reset_icon.png",
|
||||
symbol = "ui_category_all.png",
|
||||
index = -2,
|
||||
})
|
||||
table.insert(category_list, {
|
||||
name = "uncategorized",
|
||||
label = "Misc.",
|
||||
symbol = "ui_no.png",
|
||||
symbol = "ui_category_none.png",
|
||||
index = -1,
|
||||
})
|
||||
for category, def in pairs(unified_inventory.registered_categories) do
|
||||
|
|
|
@ -12,7 +12,7 @@ unified_inventory.register_category('tools', {
|
|||
label = "Tools"
|
||||
})
|
||||
unified_inventory.register_category('minerals', {
|
||||
symbol = "default:mese_crystal",
|
||||
symbol = "default:iron_lump",
|
||||
label = "Minerals and Metals"
|
||||
})
|
||||
unified_inventory.register_category('environment', {
|
||||
|
|
37
internal.lua
37
internal.lua
|
@ -125,32 +125,36 @@ function ui.get_formspec(player, page)
|
|||
end
|
||||
|
||||
-- Category filters
|
||||
local categories_pos = { ui_peruser.page_x, ui_peruser.page_y-ui_peruser.btn_spc }
|
||||
local categories_pos = { ui_peruser.page_x, ui_peruser.page_y-ui_peruser.btn_spc-0.7 }
|
||||
local categories_scroll_pos = { ui_peruser.page_x, ui_peruser.page_y-(ui_peruser.btn_spc*0.15)-0.7 }
|
||||
|
||||
local scroll_offset = 0
|
||||
local category_count = #unified_inventory.category_list
|
||||
if category_count > ui_peruser.pagecols then
|
||||
scroll_offset = unified_inventory.current_category_scroll[player_name]
|
||||
end
|
||||
|
||||
for index, category in ipairs(unified_inventory.category_list) do
|
||||
local column = index - scroll_offset
|
||||
if column > 0 and column <= ui_peruser.pagecols then
|
||||
if category_count > ui_peruser.pagecols and scroll_offset > 0 and column == 1 then
|
||||
-- prev
|
||||
formspec[n] = formspec_button(ui_peruser, "prev_category", "ui_left_icon.png", categories_pos, {0, 0}, 0.9, "Prev")
|
||||
elseif category_count > ui_peruser.pagecols and column == ui_peruser.pagecols and category_count - scroll_offset > ui_peruser.pagecols then
|
||||
-- next
|
||||
formspec[n] = formspec_button(ui_peruser, "next_category", "ui_right_icon.png", categories_pos, {ui_peruser.pagecols - 1, 0}, 0.9, "Next")
|
||||
else
|
||||
local scale = 0.8
|
||||
if unified_inventory.current_category[player_name] == category.name then
|
||||
scale = 1
|
||||
end
|
||||
formspec[n] = formspec_button(ui_peruser, "category_"..category.name, category.symbol, categories_pos, {column-1, 0}, scale, category.label)
|
||||
local scale = 0.8
|
||||
if unified_inventory.current_category[player_name] == category.name then
|
||||
scale = 1
|
||||
end
|
||||
formspec[n] = formspec_button(ui_peruser, "category_"..category.name, category.symbol, categories_pos, {column-1, 0}, scale, category.label)
|
||||
n = n + 1
|
||||
end
|
||||
end
|
||||
if category_count > ui_peruser.pagecols and scroll_offset > 0 then
|
||||
-- prev
|
||||
formspec[n] = formspec_button(ui_peruser, "prev_category", "ui_left_icon.png", categories_scroll_pos, {ui_peruser.pagecols - 2, 0}, 0.8, "Prev")
|
||||
n = n + 1
|
||||
end
|
||||
if category_count > ui_peruser.pagecols and category_count - scroll_offset > ui_peruser.pagecols then
|
||||
-- next
|
||||
formspec[n] = formspec_button(ui_peruser, "next_category", "ui_right_icon.png", categories_scroll_pos, {ui_peruser.pagecols - 1, 0}, 0.8, "Next")
|
||||
n = n + 1
|
||||
end
|
||||
|
||||
-- Search box
|
||||
formspec[n] = "field_close_on_enter[searchbox;false]"
|
||||
|
@ -256,10 +260,9 @@ function ui.get_formspec(player, page)
|
|||
n= n+1
|
||||
|
||||
if ui.activefilter[player_name] ~= "" then
|
||||
formspec[n] = string.format("label[%f,%f;%s:]",
|
||||
ui_peruser.page_x, ui_peruser.page_y - 0.65 - ui_peruser.btn_spc, F(S("Filter")))
|
||||
formspec[n+1] = string.format("label[%f,%f;%s]",
|
||||
ui_peruser.page_x, ui_peruser.page_y - 0.25 - ui_peruser.btn_spc, F(ui.activefilter[player_name]))
|
||||
formspec[n] = string.format("label[%f,%f;%s: %s]",
|
||||
ui_peruser.page_x, ui_peruser.page_y - 0.4,
|
||||
F(S("Filter")), F(ui.activefilter[player_name]))
|
||||
end
|
||||
return table.concat(formspec, "")
|
||||
end
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
Loading…
Reference in New Issue