Possibilità di personalizzare il menù

master
Zughy 2022-04-17 19:29:19 +02:00
parent a70c4b4ab6
commit 9b94f2c4b4
25 changed files with 17 additions and 13 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
skins/
#skins/
locale/skins
textures/menu
textures/skins

View File

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 633 B

View File

Before

Width:  |  Height:  |  Size: 576 B

After

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -14,6 +14,7 @@ local function load_skins()
local modpath = minetest.get_modpath("skins_collectible")
local i18n_dir = modpath .. "/locale/skins"
local txtr_dir = modpath .. "/textures/skins"
local menu_ui_dir = modpath .. "/textures/menu"
-- se la cartella delle skin non esiste/è vuota, copio la cartella base `skins`
-- dentro quella del mondo. Sennò copio /locale e /textures dal mondo alla mod
@ -22,11 +23,13 @@ local function load_skins()
minetest.cpdir(src_dir, dir)
minetest.cpdir(src_dir .. "/locale", i18n_dir)
minetest.cpdir(src_dir .. "/textures", txtr_dir)
minetest.cpdir(src_dir .. "/menu", menu_ui_dir)
os.remove(dir .. "/README.md")
file = minetest.get_dir_list(dir)
else
minetest.cpdir(dir .. "/locale", i18n_dir)
minetest.cpdir(dir .. "/textures", txtr_dir)
minetest.cpdir(dir .. "/menu", menu_ui_dir)
end
for _, f_name in pairs(file) do

View File

@ -24,17 +24,17 @@ function skins_collectible.get_formspec(p_name, page, skin_ID)
-- se la skin è bloccata o meno
if skin_ID == "LOCKED" then
selected_skin = locked_skin
skin_bg = "skinscollectible_gui_bg_locked.png"
skin_preview = "skinscollectible_locked.png"
skin_bg = "skinsc_gui_bg_locked.png"
skin_preview = "skinsc_locked.png"
skin_stars = "blank.png"
minetest.get_player_by_name(p_name):get_meta():set_int("skins_collectible:selected_skin_ID", -1) -- metadato per "Wear" se è bloccata
else
selected_skin = skins_collectible.get_skin(skin_ID)
skin_bg = "skinscollectible_gui_bg_tier" .. selected_skin.tier .. ".png"
skin_bg = "skinsc_gui_bg_tier" .. selected_skin.tier .. ".png"
skin_preview = skins_collectible.get_preview(skin_ID)
skin_stars = "skinscollectible_gui_stars" .. selected_skin.tier .. ".png"
skin_stars = "skinsc_gui_stars" .. selected_skin.tier .. ".png"
minetest.get_player_by_name(p_name):get_meta():set_int("skins_collectible:selected_skin_ID", skin_ID) -- metadato per "Wear" se è sbloccata
end
@ -43,14 +43,14 @@ function skins_collectible.get_formspec(p_name, page, skin_ID)
-- immagini
"image[0,0;16.15,9.24;" .. skin_bg .. "]",
"image[0,0;16.15,9.24;" .. selected_skin.img .. "]",
"image[0,0;16.15,9.24;skinscollectible_gui_overlay.png]",
"image[0,0;16.15,9.24;skinsc_gui_overlay.png]",
-- skin selezionata
"image[1.95,0.85;1.05,0.15;" .. skin_stars .. "]",
"image[1.77,0.92;1.5,2.34;" .. skin_preview .. "]",
-- pulsanti
"image_button[1.87,3.2;1.3,0.3;skinscollectible_gui_button_wear.png;WEAR;" .. S("Wear") .. "]",
"image_button[0.2,6;0.7,1.2;skinscollectible_gui_arrow_left.png;GO_LEFT;]",
"image_button[15.2,6;0.7,1.2;skinscollectible_gui_arrow_right.png;GO_RIGHT;]",
"image_button[1.87,3.2;1.3,0.3;skinsc_gui_button_wear.png;WEAR;" .. S("Wear") .. "]",
"image_button[0.2,6;0.7,1.2;skinsc_gui_arrow_left.png;GO_LEFT;]",
"image_button[15.2,6;0.7,1.2;skinsc_gui_arrow_right.png;GO_RIGHT;]",
-- testo
"hypertext[3.6,0.85;4,1;name; <global size=23 font=mono color=#7a444a><b>" .. selected_skin.name .. "</b>]",
"hypertext[3.6,1.25;3.2,2;desc; <global size=12 font=mono halign=justify color=#a05b53><i>" .. FS(selected_skin.description) .. "</i>]"
@ -82,7 +82,7 @@ function skins_collectible.get_formspec(p_name, page, skin_ID)
if skins_collectible.is_skin_unlocked(p_name, skin_ID) then
table.insert(formspec, skin_ID, "image_button[" .. slot_pos .. slot_size .. skins_collectible.get_preview(skin_ID) .. ";" .. skin_ID .. ";]")
else
table.insert(formspec, skin_ID, "image_button[" .. slot_pos .. slot_size .. "skinscollectible_gui_button.png;LOCKED;]")
table.insert(formspec, skin_ID, "image_button[" .. slot_pos .. slot_size .. "skinsc_gui_button.png;LOCKED;]")
table.insert(formspec, skin_ID +1, "tooltip[" .. slot_pos .. slot_size .. FS(skins_collectible.get_skin(skin_ID).hint) .. " ;#dff6f5;#5a5353]")
end
end
@ -92,7 +92,7 @@ function skins_collectible.get_formspec(p_name, page, skin_ID)
table.insert(formspec, 1, "formspec_version[4]")
table.insert(formspec, 2, "size[16.15,9.24]")
table.insert(formspec, 3, "no_prepend[]")
table.insert(formspec, 4, "background[0,0;16.15,9.24;skinscollectible_gui_bg.png]")
table.insert(formspec, 4, "background[0,0;16.15,9.24;skinsc_gui_bg.png]")
table.insert(formspec, 5, "style_type[image_button;border=false]")
table.insert(formspec, 6, "style[wear;font=mono;textcolor=#dff6f5]")
table.insert(formspec, 7, "bgcolor[;true]")
@ -132,7 +132,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
--TODO: suono + effetto particellare
-- sennò riproduco un suono d'errore
else
minetest.sound_play("skinscollectible_deny", {to_player = p_name})
minetest.sound_play("skinsc_deny", {to_player = p_name})
end
-- se provo a cambiar pagina

View File

@ -3,7 +3,7 @@ local S = minetest.get_translator("skins_collectible")
minetest.register_tool("skins_collectible:wardrobe", {
description = S("Wardrobe"),
inventory_image = "skinscollectible_wardrobe.png",
inventory_image = "skinsc_wardrobe.png",
groups = {oddly_breakable_by_hand = "2"},
on_place = function() end,
on_drop = function() end,

View File

Before

Width:  |  Height:  |  Size: 140 B

After

Width:  |  Height:  |  Size: 140 B

View File

Before

Width:  |  Height:  |  Size: 141 B

After

Width:  |  Height:  |  Size: 141 B

View File

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 180 B

View File

Before

Width:  |  Height:  |  Size: 101 B

After

Width:  |  Height:  |  Size: 101 B

View File

Before

Width:  |  Height:  |  Size: 685 B

After

Width:  |  Height:  |  Size: 685 B

View File

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 282 B

View File

Before

Width:  |  Height:  |  Size: 86 B

After

Width:  |  Height:  |  Size: 86 B

View File

Before

Width:  |  Height:  |  Size: 88 B

After

Width:  |  Height:  |  Size: 88 B

View File

Before

Width:  |  Height:  |  Size: 86 B

After

Width:  |  Height:  |  Size: 86 B

View File

Before

Width:  |  Height:  |  Size: 87 B

After

Width:  |  Height:  |  Size: 87 B

View File

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 147 B

View File

Before

Width:  |  Height:  |  Size: 171 B

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B