#encoding:utf-8
#==============================================================================
# ■ Window_ItemList
#------------------------------------------------------------------------------
# 物品画面中,显示持有物品的窗口。
#==============================================================================
class Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
alias old_initialize initialize
def initialize(x, y, width, height)
old_initialize(x, y, width, height)
@cursor_w=[]
@len=0
end
#--------------------------------------------------------------------------
# ● 绘制项目
#--------------------------------------------------------------------------
alias old_draw_item draw_item
def draw_item(index)
item = @data[index]
if item
rect = item_rect(index)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enable?(item))
draw_item_number(rect, item)
@len=28+text_size(item.name).width+text_size(sprintf(":%2d", $game_party.item_number(item))).width
@cursor_w.insert(index,@len)
end
end
#--------------------------------------------------------------------------
# ● 绘制物品个数
#--------------------------------------------------------------------------
alias old_draw_item_number draw_item_number
def draw_item_number(rect, item)
draw_text_ex(rect.x+24+text_size(item.name).width,rect.y,sprintf(":%2d", $game_party.item_number(item)))
end
#--------------------------------------------------------------------------
# ● 更新光标
#--------------------------------------------------------------------------
def update_cursor
if @cursor_all
cursor_rect.set(0, 0, contents.width, row_max * item_height)
self.top_row = 0
elsif [url=home.php?mod=space&uid=370741]@Index[/url] < 0
cursor_rect.empty
else
ensure_cursor_visible
rect = item_rect(index)
cursor_rect.set(rect.x,rect.y,@cursor_w[index],rect.height)
end
end
end