Use a grid for the inventory

This commit is contained in:
Gouvernathor 2023-11-16 18:01:43 +01:00
parent 837d6b378e
commit c1ab7f7b85

View File

@ -326,43 +326,46 @@ screen inventory_menuitem(xx, yy):
action Return("inc")
# Add items
for i in range(current_page*items_shown, (current_page*items_shown)+items_shown):
if i < menu_items_length:
$ row = (i // 9) % 4
$ col = i % 9
frame:
style "empty"
xsize 48
ysize 48
pos (24+58*(col), 113+58*(row))
add gui.format("interface/achievements/{}/iconbox.webp")
grid 9 4:
style "empty"
pos (24, 113)
if current_item is not None and current_item.id == menu_items[i].id:
add "interface/achievements/glow.webp" align (0.5, 0.5) zoom 0.105 alpha 0.7 at rotate_circular
for i in range(current_page*items_shown, (current_page*items_shown)+items_shown):
if i < menu_items_length:
$ row = (i // 9) % 4
$ col = i % 9
frame:
style "empty"
xsize 48
ysize 48
add gui.format("interface/achievements/{}/iconbox.webp")
add crop_image_zoom(menu_items[i].get_image(), 42, 42, menu_items[i].owned <= 0) align (0.5, 0.5)
if current_item is not None and current_item.id == menu_items[i].id:
add "interface/achievements/glow.webp" align (0.5, 0.5) zoom 0.105 alpha 0.7 at rotate_circular
button:
style gui.theme("overlay_button")
background "interface/achievements/glass_iconbox.webp"
xsize 46 ysize 46
action Return(["select", menu_items[i]])
tooltip menu_items[i].name
add crop_image_zoom(menu_items[i].get_image(), 42, 42, menu_items[i].owned <= 0) align (0.5, 0.5)
if menu_items[i].limit > 1 and menu_items[i].owned > 0:
if menu_items[i].infinite:
text "{unicode}∞{/unicode}" size 20 align (0.1, 0.1) offset(-1, -9) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ]
else:
text str(menu_items[i].owned) size 10 align (0.1, 0.1) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ]
elif current_category == "Decorations":
if menu_items[i].in_use:
add "interface/topbar/icon_check.webp" anchor (1.0, 1.0) align (1.0, 1.0) offset (-3, -3) zoom 0.5
elif current_category in ("Books", "Quest Items"):
if menu_items[i].used:
add "interface/topbar/icon_check.webp" anchor (1.0, 1.0) align (1.0, 1.0) offset (-3, -3) zoom 0.5
button:
style gui.theme("overlay_button")
background "interface/achievements/glass_iconbox.webp"
xsize 46 ysize 46
action Return(["select", menu_items[i]])
tooltip menu_items[i].name
if inventory_mode == 1 and (not menu_items[i].givable or not states.active_girl in menu_items[i].usable_on):
add "#b2000040"
if menu_items[i].limit > 1 and menu_items[i].owned > 0:
if menu_items[i].infinite:
text "{unicode}∞{/unicode}" size 20 align (0.1, 0.1) offset(-1, -9) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ]
else:
text str(menu_items[i].owned) size 10 align (0.1, 0.1) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ]
elif current_category == "Decorations":
if menu_items[i].in_use:
add "interface/topbar/icon_check.webp" anchor (1.0, 1.0) align (1.0, 1.0) offset (-3, -3) zoom 0.5
elif current_category in ("Books", "Quest Items"):
if menu_items[i].used:
add "interface/topbar/icon_check.webp" anchor (1.0, 1.0) align (1.0, 1.0) offset (-3, -3) zoom 0.5
if inventory_mode == 1 and (not menu_items[i].givable or not states.active_girl in menu_items[i].usable_on):
add "#b2000040"
if menu_items_length <= 0:
text "Nothing here yet" align (0.5, 0.5) anchor (0.5, 0.5) size 24