Hide pagenum when only one page of skins
This commit is contained in:
parent
e9b8085fde
commit
518ed971ca
13
src/gui.lua
13
src/gui.lua
|
@ -494,8 +494,11 @@ local function get_container(fs, data, player, yoffset, ctn_len, award_list, awa
|
||||||
|
|
||||||
local _skins = skins.get_skinlist_for_player(name)
|
local _skins = skins.get_skinlist_for_player(name)
|
||||||
local skin_name = skins.get_player_skin(player).name
|
local skin_name = skins.get_player_skin(player).name
|
||||||
|
local spp, add_y = 24, 0
|
||||||
|
|
||||||
|
if #_skins > spp then
|
||||||
local btn_y = yextra + 0.75
|
local btn_y = yextra + 0.75
|
||||||
local spp = 24
|
add_y += 0.6
|
||||||
|
|
||||||
data.skin_pagemax = max(1, ceil(#_skins / spp))
|
data.skin_pagemax = max(1, ceil(#_skins / spp))
|
||||||
|
|
||||||
|
@ -505,6 +508,7 @@ local function get_container(fs, data, player, yoffset, ctn_len, award_list, awa
|
||||||
fs"style[skin_page;font=bold;font_size=18]"
|
fs"style[skin_page;font=bold;font_size=18]"
|
||||||
fs("button", 1.85, btn_y - 0.23, 2, 0.8, "skin_page",
|
fs("button", 1.85, btn_y - 0.23, 2, 0.8, "skin_page",
|
||||||
fmt("%s / %u", clr(colors.yellow, data.skin_pagenum), data.skin_pagemax))
|
fmt("%s / %u", clr(colors.yellow, data.skin_pagenum), data.skin_pagemax))
|
||||||
|
end
|
||||||
|
|
||||||
local first = (data.skin_pagenum - 1) * spp
|
local first = (data.skin_pagenum - 1) * spp
|
||||||
local last = first + spp - 1
|
local last = first + spp - 1
|
||||||
|
@ -523,7 +527,7 @@ local function get_container(fs, data, player, yoffset, ctn_len, award_list, awa
|
||||||
local X = (i % 3) * 1.93
|
local X = (i % 3) * 1.93
|
||||||
|
|
||||||
local Y = ceil((i % spp - X) / 3 + 1)
|
local Y = ceil((i % spp - X) / 3 + 1)
|
||||||
Y += (Y * 2.45) + yextra - 2.15
|
Y += (Y * 2.45) + yextra - 2.75 + add_y
|
||||||
|
|
||||||
fs("image_button", X, Y, 1.86, 3.4, "", btn_name, "")
|
fs("image_button", X, Y, 1.86, 3.4, "", btn_name, "")
|
||||||
fs(fmt("tooltip[%s;%s]", btn_name, ESC(skin.name)))
|
fs(fmt("tooltip[%s;%s]", btn_name, ESC(skin.name)))
|
||||||
|
@ -688,9 +692,10 @@ local function get_inventory_fs(player, data, fs)
|
||||||
elseif i3.modules.skins and data.subcat == 3 then
|
elseif i3.modules.skins and data.subcat == 3 then
|
||||||
local spp = 24
|
local spp = 24
|
||||||
local _skins = skins.get_skinlist_for_player(data.player_name)
|
local _skins = skins.get_skinlist_for_player(data.player_name)
|
||||||
local num = max(1, min(spp, #_skins - ((data.skin_pagenum - 1) * spp)))
|
local nb = #_skins
|
||||||
|
local num = max(1, min(spp, nb - ((data.skin_pagenum - 1) * spp)))
|
||||||
|
|
||||||
max_val += ceil(num / 3) * 34
|
max_val += ceil(num / 3) * (nb > spp and 34 or 31)
|
||||||
|
|
||||||
elseif i3.modules.awards and data.subcat == 4 then
|
elseif i3.modules.awards and data.subcat == 4 then
|
||||||
award_list = awards.get_award_states(data.player_name)
|
award_list = awards.get_award_states(data.player_name)
|
||||||
|
|
Ŝarĝante…
Reference in New Issue