New Main Menu design (#101)
@ -56,24 +56,34 @@ local function add_tab(self,tab)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function get_bg(tsize, tabname)
|
||||||
|
tabname = tabname or "common"
|
||||||
|
return "background[0,0;" .. tsize.width .. "," .. tsize.height .. ";" ..
|
||||||
|
core.formspec_escape(defaulttexturedir ..
|
||||||
|
"multicraft_" .. tabname .. "_bg.png") .. ";true]"
|
||||||
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
local function get_formspec(self)
|
local function get_formspec(self)
|
||||||
local formspec = ""
|
local formspec = ""
|
||||||
|
local name = self.tablist[self.last_tab_index].name
|
||||||
|
local tabname = name == "local" and name or nil
|
||||||
|
|
||||||
if not self.hidden and (self.parent == nil or not self.parent.hidden) then
|
if not self.hidden and (self.parent == nil or not self.parent.hidden) then
|
||||||
|
|
||||||
if self.parent == nil then
|
if self.parent == nil then
|
||||||
local tsize = self.tablist[self.last_tab_index].tabsize or
|
local tsize = self.tablist[self.last_tab_index].tabsize or
|
||||||
{width=self.width, height=self.height}
|
{width=self.width, height=self.height}
|
||||||
|
|
||||||
formspec = formspec ..
|
formspec = formspec ..
|
||||||
string.format("size[%f,%f,%s]",tsize.width,tsize.height,
|
string.format("size[%f,%f,%s]",tsize.width,tsize.height,
|
||||||
dump(self.fixed_size))
|
dump(self.fixed_size))
|
||||||
|
|
||||||
|
formspec = formspec .. get_bg(tsize, tabname)
|
||||||
end
|
end
|
||||||
formspec = formspec .. self:tab_header()
|
formspec = formspec .. self:tab_header()
|
||||||
formspec = formspec ..
|
formspec = formspec ..
|
||||||
self.tablist[self.last_tab_index].get_formspec(
|
self.tablist[self.last_tab_index].get_formspec(
|
||||||
self,
|
self, name,
|
||||||
self.tablist[self.last_tab_index].name,
|
|
||||||
self.tablist[self.last_tab_index].tabdata,
|
self.tablist[self.last_tab_index].tabdata,
|
||||||
self.tablist[self.last_tab_index].tabsize
|
self.tablist[self.last_tab_index].tabsize
|
||||||
)
|
)
|
||||||
|
@ -31,20 +31,31 @@ local function get_formspec(tabview, name, tabdata)
|
|||||||
)
|
)
|
||||||
|
|
||||||
retval = retval ..
|
retval = retval ..
|
||||||
"button[3.5,4.5;2.6,0.5;world_delete;".. fgettext("Delete") .. "]" ..
|
"image_button[0.45,4.9;2.9,0.8;" ..
|
||||||
"button[6,4.5;2.8,0.5;world_create;".. fgettext("New") .. "]"
|
core.formspec_escape(defaulttexturedir ..
|
||||||
|
"multicraft_local_delete_btn.png") .. ";world_delete;;true;false]" ..
|
||||||
|
"image_button[3.14,4.9;2.9,0.8;" ..
|
||||||
|
core.formspec_escape(defaulttexturedir ..
|
||||||
|
"multicraft_local_new_btn.png") .. ";world_create;;true;false]"
|
||||||
|
|
||||||
|
local creative_mode = core.settings:get_bool("creative_mode")
|
||||||
|
|
||||||
retval = retval ..
|
retval = retval ..
|
||||||
"button[8.7,4.5;3.30,0.5;play;".. fgettext("Play") .. "]" ..
|
"image_button[7,1.5;4.5,1.27;" ..
|
||||||
"checkbox[0.0,4.25;cb_creative_mode;".. fgettext("Creative Mode") .. ";" ..
|
core.formspec_escape(defaulttexturedir ..
|
||||||
dump(core.settings:get_bool("creative_mode")) .. "]"..
|
"multicraft_local_play_btn.png") .. ";play;;true;false]" ..
|
||||||
"textlist[0,0;11.75,3.7;sp_worlds;" ..
|
"image_button[7.25,3.15;4.05,0.8;" ..
|
||||||
|
core.formspec_escape(defaulttexturedir ..
|
||||||
|
"multicraft_local_creative_" ..
|
||||||
|
tostring(creative_mode) .. "_btn.png") ..
|
||||||
|
";cb_creative_mode;;true;false]" ..
|
||||||
|
"textlist[0,0;6.25,4.63;sp_worlds;" ..
|
||||||
menu_render_worldlist() ..
|
menu_render_worldlist() ..
|
||||||
";" .. index .. ";true]"
|
";" .. index .. ";true]"
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
|
||||||
local function main_button_handler(this, fields, name, tabdata)
|
local function main_button_handler(this, fields, name, tabdata)
|
||||||
|
|
||||||
assert(name == "local")
|
assert(name == "local")
|
||||||
|
|
||||||
local world_doubleclick = false
|
local world_doubleclick = false
|
||||||
@ -70,15 +81,11 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields["cb_creative_mode"] then
|
if fields.cb_creative_mode then
|
||||||
core.settings:set("creative_mode", fields["cb_creative_mode"])
|
local creative_mode = core.settings:get_bool("creative_mode")
|
||||||
local bool = fields["cb_creative_mode"]
|
core.settings:set("creative_mode", tostring((not creative_mode)))
|
||||||
if bool == 'true' then
|
core.settings:set("enable_damage", tostring(creative_mode))
|
||||||
bool = 'false'
|
|
||||||
else
|
|
||||||
bool = 'true'
|
|
||||||
end
|
|
||||||
core.settings:set("enable_damage", bool)
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ local function get_formspec(tabview, name, tabdata)
|
|||||||
|
|
||||||
local retval =
|
local retval =
|
||||||
-- Search
|
-- Search
|
||||||
"field[0.15,0.35;6.05,0.27;te_search;;"..core.formspec_escape(tabdata.search_for).."]"..
|
"field[0.15,0.5;6.05,0.27;te_search;;"..core.formspec_escape(tabdata.search_for).."]"..
|
||||||
"button[5.8,0.1;2,0.1;btn_mp_search;" .. fgettext("Search") .. "]" ..
|
"button[5.8,0.25;2,0.1;btn_mp_search;" .. fgettext("Search") .. "]" ..
|
||||||
|
|
||||||
-- Address / Port
|
-- Address / Port
|
||||||
"label[7.75,-0.25;" .. fgettext("Address / Port") .. "]" ..
|
"label[7.75,-0.25;" .. fgettext("Address / Port") .. "]" ..
|
||||||
@ -79,7 +79,7 @@ local function get_formspec(tabview, name, tabdata)
|
|||||||
image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" ..
|
image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" ..
|
||||||
"color,span=1;" ..
|
"color,span=1;" ..
|
||||||
"text,padding=1]" ..
|
"text,padding=1]" ..
|
||||||
"table[-0.15,0.6;7.75,5.15;favourites;"
|
"table[-0.15,0.8;7.75,4.75;favourites;"
|
||||||
|
|
||||||
if menudata.search_result then
|
if menudata.search_result then
|
||||||
for i = 1, #menudata.search_result do
|
for i = 1, #menudata.search_result do
|
||||||
|
@ -166,7 +166,7 @@ void set_default_settings(Settings *settings)
|
|||||||
settings->setDefault("crosshair_alpha", "255");
|
settings->setDefault("crosshair_alpha", "255");
|
||||||
settings->setDefault("hud_scaling", "1.0");
|
settings->setDefault("hud_scaling", "1.0");
|
||||||
settings->setDefault("gui_scaling", "1.0");
|
settings->setDefault("gui_scaling", "1.0");
|
||||||
settings->setDefault("gui_scaling_filter", "false");
|
settings->setDefault("gui_scaling_filter", "true");
|
||||||
settings->setDefault("gui_scaling_filter_txr2img", "true");
|
settings->setDefault("gui_scaling_filter_txr2img", "true");
|
||||||
settings->setDefault("desynchronize_mapblock_texture_animation", "true");
|
settings->setDefault("desynchronize_mapblock_texture_animation", "true");
|
||||||
settings->setDefault("hud_hotbar_max_width", "1.0");
|
settings->setDefault("hud_hotbar_max_width", "1.0");
|
||||||
|
BIN
textures/base/multicraft_common_bg.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
textures/base/multicraft_local_bg.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
textures/base/multicraft_local_creative_false_btn.png
Normal file
After Width: | Height: | Size: 692 B |
BIN
textures/base/multicraft_local_creative_true_btn.png
Normal file
After Width: | Height: | Size: 798 B |
BIN
textures/base/multicraft_local_delete_btn.png
Normal file
After Width: | Height: | Size: 844 B |
BIN
textures/base/multicraft_local_new_btn.png
Normal file
After Width: | Height: | Size: 530 B |
BIN
textures/base/multicraft_local_play_btn.png
Normal file
After Width: | Height: | Size: 780 B |