From 6e1372bd894d955300c40d69e5c882e9cc7d7523 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 11 May 2020 21:40:45 +0200 Subject: Add support for statbar “off state” icons (#9462) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds support for optional “off state” icons for statbars. “off state icons” can be used to denote the lack of something, like missing hearts or bubbles. Add "off state" textures to the builtin statbars. Co-authored-by: SmallJoker --- textures/base/pack/bubble_gone.png | Bin 0 -> 68 bytes textures/base/pack/heart_gone.png | Bin 0 -> 68 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 textures/base/pack/bubble_gone.png create mode 100644 textures/base/pack/heart_gone.png (limited to 'textures/base') diff --git a/textures/base/pack/bubble_gone.png b/textures/base/pack/bubble_gone.png new file mode 100644 index 000000000..240ca4f8d Binary files /dev/null and b/textures/base/pack/bubble_gone.png differ diff --git a/textures/base/pack/heart_gone.png b/textures/base/pack/heart_gone.png new file mode 100644 index 000000000..240ca4f8d Binary files /dev/null and b/textures/base/pack/heart_gone.png differ -- cgit v1.2.3 From 9a64a9fd9427fc3b62d4dc9bf1ca7c15477ebc5a Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 29 May 2020 00:52:48 +0100 Subject: Update ContentDB dialog (#9949) --- LICENSE.txt | 6 +++ builtin/mainmenu/dlg_contentstore.lua | 86 +++++++++++++++++++--------------- textures/base/pack/end_icon.png | Bin 0 -> 908 bytes textures/base/pack/next_icon.png | Bin 0 -> 714 bytes textures/base/pack/prev_icon.png | Bin 0 -> 714 bytes textures/base/pack/start_icon.png | Bin 0 -> 912 bytes 6 files changed, 53 insertions(+), 39 deletions(-) create mode 100644 textures/base/pack/end_icon.png create mode 100644 textures/base/pack/next_icon.png create mode 100644 textures/base/pack/prev_icon.png create mode 100644 textures/base/pack/start_icon.png (limited to 'textures/base') diff --git a/LICENSE.txt b/LICENSE.txt index 994e024c9..f5c51833b 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -21,6 +21,12 @@ ShadowNinja: paramat: textures/base/pack/menu_header.png + textures/base/pack/next_icon.png + textures/base/pack/prev_icon.png + +rubenwardy, paramat: + textures/base/pack/start_icon.png + textures/base/pack/end_icon.png erlehmann: misc/minetest-icon-24x24.png diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index 9af16ac86..76c398f5a 100644 --- a/builtin/mainmenu/dlg_contentstore.lua +++ b/builtin/mainmenu/dlg_contentstore.lua @@ -303,34 +303,35 @@ function store.get_formspec(dlgdata) cur_page = 1 end + local W = 15.75 + local H = 9.5 + local formspec if #store.packages_full > 0 then formspec = { - "size[12,7;true]", + "formspec_version[3]", + "size[15.75,9.5]", "position[0.5,0.55]", - "field[0.2,0.1;7.8,1;search_string;;", - core.formspec_escape(search_string), "]", + "container[0.375,0.375]", + "field[0,0;10.225,0.8;search_string;;", core.formspec_escape(search_string), "]", "field_close_on_enter[search_string;false]", - "button[7.7,-0.2;2,1;search;", - fgettext("Search"), "]", - "dropdown[9.7,-0.1;2.4;type;", - table.concat(filter_types_titles, ","), - ";", filter_type, "]", - -- "textlist[0,1;2.4,5.6;a;", - -- table.concat(taglist, ","), "]", + "button[10.225,0;2,0.8;search;", fgettext("Search"), "]", + "dropdown[12.6,0;2.4,0.8;type;", table.concat(filter_types_titles, ","), ";", filter_type, "]", + "container_end[]", -- Page nav buttons - "container[0,", - num_per_page + 1.5, "]", - "button[-0.1,0;3,1;back;", - fgettext("Back to Main Menu"), "]", - "button[7.1,0;1,1;pstart;<<]", - "button[8.1,0;1,1;pback;<]", - "label[9.2,0.2;", - tonumber(cur_page), " / ", - tonumber(dlgdata.pagemax), "]", - "button[10.1,0;1,1;pnext;>]", - "button[11.1,0;1,1;pend;>>]", + "container[0,", H - 0.8 - 0.375, "]", + "button[0.375,0;4,0.8;back;", fgettext("Back to Main Menu"), "]", + + "container[", W - 0.375 - 0.8*4 - 2, ",0]", + "image_button[0,0;0.8,0.8;", defaulttexturedir, "start_icon.png;pstart;]", + "image_button[0.8,0;0.8,0.8;", defaulttexturedir, "prev_icon.png;pback;]", + "style[pagenum;border=false]", + "button[1.6,0;2,0.8;pagenum;", tonumber(cur_page), " / ", tonumber(dlgdata.pagemax), "]", + "image_button[3.6,0;0.8,0.8;", defaulttexturedir, "next_icon.png;pnext;]", + "image_button[4.4,0;0.8,0.8;", defaulttexturedir, "end_icon.png;pend;]", + "container_end[]", + "container_end[]", } @@ -341,75 +342,82 @@ function store.get_formspec(dlgdata) end else formspec = { - "size[12,7;true]", + "size[12,7]", "position[0.5,0.55]", "label[4,3;", fgettext("No packages could be retrieved"), "]", - "button[-0.1,", - num_per_page + 1.5, - ";3,1;back;", - fgettext("Back to Main Menu"), "]", + "container[0,", H - 0.8 - 0.375, "]", + "button[0,0;4,0.8;back;", fgettext("Back to Main Menu"), "]", + "container_end[]", } end local start_idx = (cur_page - 1) * num_per_page + 1 for i=start_idx, math.min(#store.packages, start_idx+num_per_page-1) do local package = store.packages[i] - formspec[#formspec + 1] = "container[0.5," - formspec[#formspec + 1] = (i - start_idx) * 1.1 + 1 + formspec[#formspec + 1] = "container[0.375," + formspec[#formspec + 1] = (i - start_idx) * 1.375 + (2*0.375 + 0.8) formspec[#formspec + 1] = "]" -- image - formspec[#formspec + 1] = "image[-0.4,0;1.5,1;" + formspec[#formspec + 1] = "image[0,0;1.5,1;" formspec[#formspec + 1] = core.formspec_escape(get_screenshot(package)) formspec[#formspec + 1] = "]" -- title - formspec[#formspec + 1] = "label[1,-0.1;" + formspec[#formspec + 1] = "label[1.875,0.1;" formspec[#formspec + 1] = core.formspec_escape( minetest.colorize(mt_color_green, package.title) .. minetest.colorize("#BFBFBF", " by " .. package.author)) formspec[#formspec + 1] = "]" - local description_width = 7.5 + -- buttons + local description_width = W - 0.375*5 - 1 - 2*1.5 + formspec[#formspec + 1] = "container[" + formspec[#formspec + 1] = W - 0.375*2 + formspec[#formspec + 1] = ",0.1]" + if package.downloading then - formspec[#formspec + 1] = "label[8.4,0.2;" + formspec[#formspec + 1] = "style[download;border=false]" + + formspec[#formspec + 1] = "button[-3.5,0;2,0.8;download;" formspec[#formspec + 1] = fgettext("Downloading...") formspec[#formspec + 1] = "]" elseif not package.path then - formspec[#formspec + 1] = "button[8.4,0;1.5,1;install_" + formspec[#formspec + 1] = "button[-3,0;1.5,0.8;install_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("Install") formspec[#formspec + 1] = "]" else if package.installed_release < package.release then - description_width = 6 + description_width = description_width - 1.5 -- The install_ action also handles updating - formspec[#formspec + 1] = "button[6.9,0;1.5,1;install_" + formspec[#formspec + 1] = "button[-4.5,0;1.5,0.8;install_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("Update") formspec[#formspec + 1] = "]" end - formspec[#formspec + 1] = "button[8.4,0;1.5,1;uninstall_" + formspec[#formspec + 1] = "button[-3,0;1.5,0.8;uninstall_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("Uninstall") formspec[#formspec + 1] = "]" end - formspec[#formspec + 1] = "button[9.9,0;1.5,1;view_" + formspec[#formspec + 1] = "button[-1.5,0;1.5,0.8;view_" formspec[#formspec + 1] = tostring(i) formspec[#formspec + 1] = ";" formspec[#formspec + 1] = fgettext("View") formspec[#formspec + 1] = "]" + formspec[#formspec + 1] = "container_end[]" -- description - formspec[#formspec + 1] = "textarea[1.25,0.3;" + formspec[#formspec + 1] = "textarea[1.855,0.3;" formspec[#formspec + 1] = tostring(description_width) - formspec[#formspec + 1] = ",1;;;" + formspec[#formspec + 1] = ",0.8;;;" formspec[#formspec + 1] = core.formspec_escape(package.short_description) formspec[#formspec + 1] = "]" diff --git a/textures/base/pack/end_icon.png b/textures/base/pack/end_icon.png new file mode 100644 index 000000000..4fb4d52a0 Binary files /dev/null and b/textures/base/pack/end_icon.png differ diff --git a/textures/base/pack/next_icon.png b/textures/base/pack/next_icon.png new file mode 100644 index 000000000..03f960917 Binary files /dev/null and b/textures/base/pack/next_icon.png differ diff --git a/textures/base/pack/prev_icon.png b/textures/base/pack/prev_icon.png new file mode 100644 index 000000000..71509e71a Binary files /dev/null and b/textures/base/pack/prev_icon.png differ diff --git a/textures/base/pack/start_icon.png b/textures/base/pack/start_icon.png new file mode 100644 index 000000000..3830fb3ae Binary files /dev/null and b/textures/base/pack/start_icon.png differ -- cgit v1.2.3 From 850af80089b3415265c4b4b744448509f776a52d Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 4 Jun 2020 21:53:26 +0100 Subject: Add buttons to ContentDB in game bar and configure world (#9944) --- builtin/mainmenu/dlg_config_world.lua | 95 ++++++++++++++++++++-------------- builtin/mainmenu/dlg_contentstore.lua | 11 ++++ builtin/mainmenu/tab_local.lua | 12 +++++ textures/base/pack/plus.png | Bin 0 -> 763 bytes 4 files changed, 79 insertions(+), 39 deletions(-) create mode 100644 textures/base/pack/plus.png (limited to 'textures/base') diff --git a/builtin/mainmenu/dlg_config_world.lua b/builtin/mainmenu/dlg_config_world.lua index 97218df9c..2cf70c9c9 100644 --- a/builtin/mainmenu/dlg_config_world.lua +++ b/builtin/mainmenu/dlg_config_world.lua @@ -23,7 +23,49 @@ local function modname_valid(name) return not name:find("[^a-z0-9_]") end +local function init_data(data) + data.list = filterlist.create( + pkgmgr.preparemodlist, + pkgmgr.comparemod, + function(element, uid) + if element.name == uid then + return true + end + end, + function(element, criteria) + if criteria.hide_game and + element.is_game_content then + return false + end + + if criteria.hide_modpackcontents and + element.modpack ~= nil then + return false + end + return true + end, + { + worldpath = data.worldspec.path, + gameid = data.worldspec.gameid + }) + + if data.selected_mod > data.list:size() then + data.selected_mod = 0 + end + + data.list:set_filtercriteria({ + hide_game = data.hide_gamemods, + hide_modpackcontents = data.hide_modpackcontents + }) + data.list:add_sort_mechanism("alphabetic", sort_mod_list) + data.list:set_sortmode("alphabetic") +end + local function get_formspec(data) + if not data.list then + init_data(data) + end + local mod = data.list:get_list()[data.selected_mod] or {name = ""} local retval = @@ -85,11 +127,14 @@ local function get_formspec(data) end end end + retval = retval .. "button[3.25,7;2.5,0.5;btn_config_world_save;" .. fgettext("Save") .. "]" .. "button[5.75,7;2.5,0.5;btn_config_world_cancel;" .. - fgettext("Cancel") .. "]" + fgettext("Cancel") .. "]" .. + "button[9,7;2.5,0.5;btn_config_world_cdb;" .. + fgettext("Find More Mods") .. "]" if mod.name ~= "" and not mod.is_game_content then if mod.is_modpack then @@ -198,6 +243,16 @@ local function handle_buttons(this, fields) return true end + if fields.btn_config_world_cdb then + this.data.list = nil + + local dlg = create_store_dlg("mod") + dlg:set_parent(this) + this:hide() + dlg:show() + return true + end + if fields.btn_enable_all_mods then local list = this.data.list:get_raw_list() @@ -247,43 +302,5 @@ function create_configure_world_dlg(worldidx) return end - dlg.data.list = filterlist.create( - pkgmgr.preparemodlist, - pkgmgr.comparemod, - function(element, uid) - if element.name == uid then - return true - end - end, - function(element, criteria) - if criteria.hide_game and - element.is_game_content then - return false - end - - if criteria.hide_modpackcontents and - element.modpack ~= nil then - return false - end - return true - end, - { - worldpath = dlg.data.worldspec.path, - gameid = dlg.data.worldspec.gameid - } - ) - - - if dlg.data.selected_mod > dlg.data.list:size() then - dlg.data.selected_mod = 0 - end - - dlg.data.list:set_filtercriteria({ - hide_game = dlg.data.hide_gamemods, - hide_modpackcontents = dlg.data.hide_modpackcontents - }) - dlg.data.list:add_sort_mechanism("alphabetic", sort_mod_list) - dlg.data.list:set_sortmode("alphabetic") - return dlg end diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index 76c398f5a..8ac4dba68 100644 --- a/builtin/mainmenu/dlg_contentstore.lua +++ b/builtin/mainmenu/dlg_contentstore.lua @@ -513,6 +513,17 @@ function create_store_dlg(type) search_string = "" cur_page = 1 + + if type then + -- table.indexof does not work on tables that contain `nil` + for i, v in pairs(filter_types_type) do + if v == type then + filter_type = i + break + end + end + end + store.filter_packages(search_string) return dialog_create("store", diff --git a/builtin/mainmenu/tab_local.lua b/builtin/mainmenu/tab_local.lua index cd6cbea46..a21cf12b1 100644 --- a/builtin/mainmenu/tab_local.lua +++ b/builtin/mainmenu/tab_local.lua @@ -35,6 +35,15 @@ if enable_gamebar then end local function game_buttonbar_button_handler(fields) + if fields.game_open_cdb then + local maintab = ui.find_by_name("maintab") + local dlg = create_store_dlg("game") + dlg:set_parent(maintab) + maintab:hide() + dlg:show() + return true + end + for key,value in pairs(fields) do for j=1,#pkgmgr.games,1 do if ("game_btnbar_" .. pkgmgr.games[j].id == key) then @@ -87,6 +96,9 @@ if enable_gamebar then end btnbar:add_button(btn_name, text, image, tooltip) end + + local plus_image = core.formspec_escape(defaulttexturedir .. "plus.png") + btnbar:add_button("game_open_cdb", "", plus_image, fgettext("Install games from ContentDB")) end else function current_game() diff --git a/textures/base/pack/plus.png b/textures/base/pack/plus.png new file mode 100644 index 000000000..64680b569 Binary files /dev/null and b/textures/base/pack/plus.png differ -- cgit v1.2.3