[RenPy] 纯文本查看 复制代码 #2.背包界面
screen beibao():
frame:
align(0.5,0.5)
xysize (520,400)
vbox:
hbox:
textbutton "关闭" action Call("sc_sy_jm", jm = "zjm")
$ max_beibao_num = zj.max_beibao_num[0]*zj.max_beibao_num[1]
text "[zj.beibao_num]/[max_beibao_num]"
vpgrid:
cols zj.max_beibao_num[0]
rows zj.max_beibao_num[1]
spacing 5
draggable True
mousewheel True
scrollbars "vertical"
align(0.5,0.5)
for x in list_item:
#use beibao1(i)
textbutton "[x.name]":
xysize (100, 50)
action ShowTransient("item_duibi",wp=x,zj=zj,wuqi=dic_chuan_zhuangbei.get("武器"),toukui=dic_chuan_zhuangbei.get("头盔"),yifu=dic_chuan_zhuangbei.get("衣服"),xiezi=dic_chuan_zhuangbei.get("鞋子"))
上面这个是我自己写的,虽然就是一个框框,但至少能用,里面的数据你要换成自己的数据
用viewport,vpgrid都行https://doc.renpy.cn/zh-CN/screens.html#viewport
如果想做出那种一个个格子的背包,我的想法是先准备一张格子背包图片,格子间距为spacing,再把物品图片做成格子大小,然后用imagebutton显示"[x.image]"物品图片,当鼠标移动到物品上可以用hovered显示物品属性,大概就这么个思路 |