Better and faster iteration, using foreach
This commit is contained in:
parent
c1ab7f7b85
commit
25f375c88b
@ -330,42 +330,39 @@ screen inventory_menuitem(xx, yy):
|
|||||||
style "empty"
|
style "empty"
|
||||||
pos (24, 113)
|
pos (24, 113)
|
||||||
|
|
||||||
for i in range(current_page*items_shown, (current_page*items_shown)+items_shown):
|
for it_item in menu_items[current_page*items_shown:(current_page+1)*items_shown]:
|
||||||
if i < menu_items_length:
|
frame:
|
||||||
$ row = (i // 9) % 4
|
style "empty"
|
||||||
$ col = i % 9
|
xsize 48
|
||||||
frame:
|
ysize 48
|
||||||
style "empty"
|
add gui.format("interface/achievements/{}/iconbox.webp")
|
||||||
xsize 48
|
|
||||||
ysize 48
|
|
||||||
add gui.format("interface/achievements/{}/iconbox.webp")
|
|
||||||
|
|
||||||
if current_item is not None and current_item.id == menu_items[i].id:
|
if current_item is not None and current_item.id == it_item.id:
|
||||||
add "interface/achievements/glow.webp" align (0.5, 0.5) zoom 0.105 alpha 0.7 at rotate_circular
|
add "interface/achievements/glow.webp" align (0.5, 0.5) zoom 0.105 alpha 0.7 at rotate_circular
|
||||||
|
|
||||||
add crop_image_zoom(menu_items[i].get_image(), 42, 42, menu_items[i].owned <= 0) align (0.5, 0.5)
|
add crop_image_zoom(it_item.get_image(), 42, 42, it_item.owned <= 0) align (0.5, 0.5)
|
||||||
|
|
||||||
button:
|
button:
|
||||||
style gui.theme("overlay_button")
|
style gui.theme("overlay_button")
|
||||||
background "interface/achievements/glass_iconbox.webp"
|
background "interface/achievements/glass_iconbox.webp"
|
||||||
xsize 46 ysize 46
|
xsize 46 ysize 46
|
||||||
action Return(["select", menu_items[i]])
|
action Return(["select", it_item])
|
||||||
tooltip menu_items[i].name
|
tooltip it_item.name
|
||||||
|
|
||||||
if menu_items[i].limit > 1 and menu_items[i].owned > 0:
|
if it_item.limit > 1 and it_item.owned > 0:
|
||||||
if menu_items[i].infinite:
|
if it_item.infinite:
|
||||||
text "{unicode}∞{/unicode}" size 20 align (0.1, 0.1) offset(-1, -9) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ]
|
text "{unicode}∞{/unicode}" size 20 align (0.1, 0.1) offset(-1, -9) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ]
|
||||||
else:
|
else:
|
||||||
text str(menu_items[i].owned) size 10 align (0.1, 0.1) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ]
|
text str(it_item.owned) size 10 align (0.1, 0.1) color "#FFFFFF" outlines [ (1, "#000", 0, 0) ]
|
||||||
elif current_category == "Decorations":
|
elif current_category == "Decorations":
|
||||||
if menu_items[i].in_use:
|
if it_item.in_use:
|
||||||
add "interface/topbar/icon_check.webp" anchor (1.0, 1.0) align (1.0, 1.0) offset (-3, -3) zoom 0.5
|
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"):
|
elif current_category in ("Books", "Quest Items"):
|
||||||
if menu_items[i].used:
|
if it_item.used:
|
||||||
add "interface/topbar/icon_check.webp" anchor (1.0, 1.0) align (1.0, 1.0) offset (-3, -3) zoom 0.5
|
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):
|
if inventory_mode == 1 and (not it_item.givable or not states.active_girl in it_item.usable_on):
|
||||||
add "#b2000040"
|
add "#b2000040"
|
||||||
|
|
||||||
if menu_items_length <= 0:
|
if menu_items_length <= 0:
|
||||||
text "Nothing here yet" align (0.5, 0.5) anchor (0.5, 0.5) size 24
|
text "Nothing here yet" align (0.5, 0.5) anchor (0.5, 0.5) size 24
|
||||||
|
Loading…
Reference in New Issue
Block a user