1
0
Fork 0

Main menu improvements (#117)

Co-authored-by: Maksym H <Maksym48@pm.me>
merge-requests/1/head
luk3yx 2023-01-12 11:37:26 +13:00 committed by GitHub
parent af36361f42
commit b5b0917f26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 58 additions and 64 deletions

2
.gitignore vendored
View File

@ -55,8 +55,6 @@ build/.cmake/
/clientmods/*
!/clientmods/preview/
/client/mod_storage/
/builtin/mainmenu/hosting/
/textures/base/pack/hosting/
## Configuration/log files
multicraft.conf

View File

@ -9,7 +9,7 @@ MultiCraft Open Source is a free open-source voxel game engine with easy modding
MultiCraft is based on the Minetest project, which is developed by a [number of contributors](https://github.com/minetest/minetest/graphs/contributors).
Copyright © 2014-2022 Maksim Gamarnik [MoNTE48] <Maksym48@pm.me> & MultiCraft Development Team.
Copyright © 2014-2023 Maksim Gamarnik [MoNTE48] <Maksym48@pm.me> & MultiCraft Development Team.
[![License](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://jb.gg/OpenSourceSupport)

View File

@ -25,7 +25,7 @@ function btn_style(field, color)
"style[" .. field .. ";bgimg=" .. button_path .. "gui_button" .. color .. btn_size ..
".png;bgimg_middle=" .. (is_high_dpi() and 48 or 32) .. ";padding=" .. (is_high_dpi() and -36 or -24) .. "]"
if color ~= "_gray" then
if color ~= "_gray" and color:sub(-8) ~= "_pressed" then
retval = retval ..
"style[" .. field .. ":hovered;bgimg=" .. button_path .. "gui_button" .. color .. "_hovered" .. btn_size ..
".png]" ..

View File

@ -248,25 +248,20 @@ local function button_header(self)
for i = 1, #visible_tabs do
local caption = visible_tabs[i].caption
-- local w = btn_widths[i] * coords_per_char
local texture = "upper_buttons_middle"
local side = "middle"
if i == 1 then
texture = "upper_buttons_left"
side = "left"
elseif i == #visible_tabs then
texture = "upper_buttons_right"
side = "right"
end
local btn_name = self.name .. "_" .. i
toadd = toadd ..
"style[" .. btn_name .. ";padding=-10;bgimg=" .. defaulttexturedir_esc ..
DIR_DELIM_esc .. "gui" .. DIR_DELIM_esc .. texture
if i == math.abs(self.last_tab_index) then
toadd = toadd .. "_selected.png;"
else
toadd = toadd .. ".png;bgimg_hovered=" .. defaulttexturedir_esc ..
DIR_DELIM_esc .. "gui" .. DIR_DELIM_esc .. texture .. "_hover.png;"
side = side .. "_pressed"
end
toadd = toadd .. "bgimg_middle=20;content_offset=0]" ..
toadd = toadd ..
btn_style(btn_name, side) ..
"style[" .. btn_name .. ";content_offset=0]" ..
"image_button[" .. x .. ",-1.1;" .. w + 0.22 .. ",0.9;;" ..
btn_name .. ";" .. caption .. ";true;false]"
x = x + w

View File

@ -131,7 +131,7 @@ local function get_formspec(data)
end
retval = retval ..
btn_style("btn_config_world_save") ..
btn_style("btn_config_world_save", "green") ..
"button[5.5,7.1;3,0.5;btn_config_world_save;" ..
fgettext("Save") .. "]" ..
btn_style("btn_config_world_cancel") ..
@ -139,19 +139,21 @@ local function get_formspec(data)
fgettext("Cancel") .. "]" ..
btn_style("btn_config_world_cdb") ..
"button[-0.05,7.1;3.5,0.5;btn_config_world_cdb;" ..
fgettext("Find More Mods") .. "]"
fgettext("Find More Mods") .. "]" ..
"image[0.09,7.05;0.6,0.6;" .. defaulttexturedir_esc .. "gui" ..
DIR_DELIM_esc .. "btn_download.png]"
if mod.name ~= "" and not mod.is_game_content then
if mod.is_modpack then
if pkgmgr.is_modpack_entirely_enabled(data, mod.name) then
retval = retval ..
btn_style("btn_mp_disable") ..
btn_style("btn_mp_disable", "yellow") ..
"button[5.5,0.025;3,0.5;btn_mp_disable;" ..
fgettext("Disable modpack") .. "]"
else
retval = retval ..
btn_style("btn_mp_enable") ..
btn_style("btn_mp_enable", "green") ..
"button[5.5,0.025;3,0.5;btn_mp_enable;" ..
fgettext("Enable modpack") .. "]"
end
@ -163,12 +165,12 @@ local function get_formspec(data)
end
if enabled_all then
retval = retval ..
btn_style("btn_disable_all_mods") ..
btn_style("btn_disable_all_mods", "yellow") ..
"button[8.95,0.025;2.5,0.5;btn_disable_all_mods;" ..
fgettext("Disable all") .. "]"
else
retval = retval ..
btn_style("btn_enable_all_mods") ..
btn_style("btn_enable_all_mods", "green") ..
"button[8.95,0.025;2.5,0.5;btn_enable_all_mods;" ..
fgettext("Enable all") .. "]"
end

View File

@ -70,7 +70,7 @@ tabs.local_default_game = dofile(menupath .. DIR_DELIM .. "tab_local_default.lua
tabs.local_game = dofile(menupath .. DIR_DELIM .. "tab_local.lua")
tabs.play_online = dofile(menupath .. DIR_DELIM .. "tab_online.lua")
local func = loadfile(menupath .. DIR_DELIM .. "hosting" .. DIR_DELIM .. "init.lua")
local func = loadfile(basepath .. DIR_DELIM .. "hosting" .. DIR_DELIM .. "init.lua")
--------------------------------------------------------------------------------
local function main_event_handler(tabview, event)

View File

@ -23,13 +23,14 @@ local multicraft_developers = {
"Alexander Zavrin (Ransom.00) <alexanderzavrin@gmail.com>",
"Luke (luk3yx) <luk3yx@proton.me>",
"Nathan Salapat (NathanS21) <nathan@nathansalapat.com>",
"Vitaliy Lobachevskiy (numberZero) <numzer0@yandex.ru>",
"Abdullaah Iqbal (An0n3m0us) <an0n3m0us@hotmail.com>",
"ElCeejo",
"Dawid Gan (deveee) <deveee@gmail.com>",
"Vitaliy Lobachevskiy (numberZero) <numzer0@yandex.ru>",
"Jean-Patrick Guerrero (kilbith) <jeanpatrick.guerrero@gmail.com>",
"sfan5 <sfan5@live.de>",
"Stuart Jones (stujones11) <stujones111@gmail.com>",
"And other people who helped make the world better!"
"And other people who have helped make the world better!"
}
local core_developers = {
@ -121,7 +122,7 @@ return {
local fs = "image[-0.25,-0.3;2,2;" .. logofile .. "]" ..
"label[1.3,-0.25;" ..
"MultiCraft Open Source, ver. " .. version.string .. "\n" ..
"Copyright (C) 2014-2022 MultiCraft Development Team\n" ..
"Copyright (C) 2014" .. os.date("%Y") .. " MultiCraft Development Team\n" ..
"License: GNU LGPLv3.0+ and CC BY-SA 4.0\n" ..
"Created and Powered by Minetest Engine, ver. 5.4.1]" ..
@ -157,14 +158,14 @@ return {
end,
cbf_button_handler = function(this, fields, name, tabdata)
if fields.homepage then
core.open_url("http://multicraft.world")
core.open_url("https://multicraft.world")
end
if fields.privacy then
core.open_url("http://multicraft.world/privacy")
core.open_url("https://multicraft.world/privacy")
end
if fields.userdata then
--[[if fields.userdata then
core.open_dir(core.get_user_path())
end
end]]
end,
}

View File

@ -120,22 +120,23 @@ local function get_formspec(_, _, tab_data)
local space = small_screen and ("\n"):rep(3) or ("\n"):rep(5)
local retval =
"style[world_delete;fgimg=" .. defaulttexturedir_esc ..
"world_delete.png;fgimg_hovered=" .. defaulttexturedir_esc .. "world_delete_hover.png]" ..
"image_button[-0.1,4.84;3.45,0.92;;world_delete;;true;false]" ..
"tooltip[world_delete;".. fgettext("Delete") .. "]" ..
"style[world_delete,world_create,world_configure;font_size=*" ..
(small_screen and 1.2 or 1.5) .. "]" ..
btn_style("world_delete", "left") ..
"image_button[-0.12,4.85;3.48,0.9;;world_delete;" .. fgettext("Delete") .. ";true;false]" ..
"image[0.1,5;0.5,0.5;" .. defaulttexturedir_esc .. "gui" .. DIR_DELIM_esc .. "world_delete.png]" ..
"style[world_create;fgimg=" .. defaulttexturedir_esc ..
"world_new.png;fgimg_hovered=" .. defaulttexturedir_esc .. "world_new_hover.png]" ..
"image_button[3.15,4.84;3.45,0.92;;world_create;;true;false]" ..
"tooltip[world_create;".. fgettext("New") .. "]"
btn_style("world_create", "right") ..
"image_button[3.14,4.85;3.48,0.9;;world_create;".. fgettext("Create") .. ";true;false]" ..
"image[3.35,5;0.5,0.5;" .. defaulttexturedir_esc .. "gui" .. DIR_DELIM_esc .. "world_create.png]"
local world = menudata.worldlist:get_list()[index]
local game = world and pkgmgr.find_by_gameid(world.gameid)
if game and game.moddable then
retval = retval ..
btn_style("world_configure") ..
"image_button[9,4.84;3,0.92;;world_configure;" .. fgettext("Select Mods") .. ";true;false]"
"image_button[8.1,4.85;4,0.9;;world_configure;" .. fgettext("Select Mods") .. ";true;false]" ..
"image[8.3,5.02;0.5,0.5;" .. defaulttexturedir_esc .. "gui" .. DIR_DELIM_esc .. "world_settings.png]"
end
retval = retval ..
@ -157,8 +158,9 @@ local function get_formspec(_, _, tab_data)
if tab_data.hidden then
retval = retval ..
btn_style("switch_local_default") ..
"style[switch_local_default;fgimg=" .. defaulttexturedir_esc .. "switch_local_default.png;fgimg_hovered=" ..
defaulttexturedir_esc .. "switch_local_default_hover.png]" ..
defaulttexturedir_esc .. "switch_local_default_hover.png;padding=" .. (is_high_dpi() and -42 or -30) .. "]" ..
"image_button[10.6,-0.1;1.5,1.5;;switch_local_default;;true;false]"
end
@ -289,11 +291,17 @@ local function main_button_handler(this, fields, name, tab_data)
end
if fields["world_create"] ~= nil then
local create_world_dlg = create_create_world_dlg(true)
create_world_dlg:set_parent(this)
local dlg
if #pkgmgr.games > 1 or (pkgmgr.games[1] and pkgmgr.games[1].id ~= "default") then
mm_texture.update("singleplayer", current_game())
dlg = create_create_world_dlg(true)
else
dlg = create_store_dlg("game")
end
dlg:set_parent(this)
this:hide()
create_world_dlg:show()
mm_texture.update("singleplayer", current_game())
dlg:show()
return true
end

View File

@ -89,15 +89,15 @@ local function get_formspec(this)
local space = small_screen and ("\n"):rep(3) or ("\n"):rep(5)
local retval =
"style[world_delete;fgimg=" .. defaulttexturedir_esc ..
"world_delete.png;fgimg_hovered=" .. defaulttexturedir_esc .. "world_delete_hover.png]" ..
"image_button[-0.1,4.84;3.45,0.92;;world_delete;;true;false]" ..
"tooltip[world_delete;".. fgettext("Delete") .. "]" ..
"style[world_delete,world_create;font_size=*" ..
(small_screen and 1.2 or 1.5) .. "]" ..
btn_style("world_delete", "left") ..
"image_button[-0.12,4.85;3.48,0.9;;world_delete;" .. fgettext("Delete") .. ";true;false]" ..
"image[0.1,5;0.5,0.5;" .. defaulttexturedir_esc .. "gui" .. DIR_DELIM_esc .. "world_delete.png]" ..
"style[world_create;fgimg=" .. defaulttexturedir_esc ..
"world_new.png;fgimg_hovered=" .. defaulttexturedir_esc .. "world_new_hover.png]" ..
"image_button[3.15,4.84;3.45,0.92;;world_create;;true;false]" ..
"tooltip[world_create;".. fgettext("New") .. "]" ..
btn_style("world_create", "right") ..
"image_button[3.14,4.85;3.48,0.9;;world_create;".. fgettext("Create") .. ";true;false]" ..
"image[3.35,5;0.5,0.5;" .. defaulttexturedir_esc .. "gui" .. DIR_DELIM_esc .. "world_create.png]" ..
btn_style("play") ..
"style[play;font_size=*" .. (small_screen and 2.25 or 3) .. "]" ..
@ -115,17 +115,11 @@ local function get_formspec(this)
"tableoptions[background=#0000;border=false]" ..
"table[0,0;6.28,4.64;sp_worlds;" .. menu_render_worldlist() .. ";" .. index .. "]" ..
btn_style("switch_local") ..
"style[switch_local;fgimg=" .. defaulttexturedir_esc .. "switch_local.png;fgimg_hovered=" ..
defaulttexturedir_esc .. "switch_local_hover.png]" ..
defaulttexturedir_esc .. "switch_local_hover.png;padding=" .. (is_high_dpi() and -42 or -30) .. "]" ..
"image_button[10.6,-0.1;1.5,1.5;;switch_local;;true;false]"
if PLATFORM == "Android" then
retval = retval ..
"image_button[6.6,-0.1;1.5,1.5;" ..
defaulttexturedir_esc .. "gift_btn.png;upgrade;;true;false;" ..
defaulttexturedir_esc .. "gift_btn_pressed.png]"
end
local enable_server = core.settings:get_bool("enable_server")
if enable_server then
retval = retval ..
@ -274,10 +268,6 @@ local function main_button_handler(this, fields, name)
return true
end
if fields["upgrade"] then
core.upgrade("")
end
--[[if fields["world_configure"] ~= nil then
local selected = core.get_table_index("sp_worlds")
if selected ~= nil then

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 866 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 768 B