Project1
标题:
主菜单人物显示能改成左右翻列吗?
[打印本页]
作者:
jhhuang
时间:
2011-6-5 14:59
标题:
主菜单人物显示能改成左右翻列吗?
本帖最后由 jhhuang 于 2011-6-7 21:24 编辑
主菜单的人物是上下排列4个,如果是8个,上下翻行.
不过我的菜单人物是左右排列的....4个人物就占640,8个人物光标就移到屏幕外面去了...
有办法选到第5人物就开始翻列吗?
1111.png
(305.02 KB, 下载次数: 2)
下载附件
保存到相册
2011-6-5 16:34 上传
#==============================================================================
# ■ Window_MenuStatus
#------------------------------------------------------------------------------
# 显示菜单画面和同伴状态的窗口。
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化目标
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
@column_max = 8
self.contents = Bitmap.new(width*2 - 64, height - 32)
self.opacity = 255
self.z = 99999
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
#x = 64
#y = i * 116
x = i*150
y = 64
actor = $game_party.actors[i]
draw_actor_hp_meter_line(actor, x+35,y+240,101,12)
draw_actor_sp_meter_line(actor, x+35,y+270,101,12)
draw_actor_face(actor, x+2, y)
EXP(actor, x+36,y+300)
self.contents.font.size=16
draw_actor_hp(actor, x + 8, y +230)
draw_actor_sp(actor, x + 8, y +260)
#draw_actor_graphic(actor, x + 60, y + 80)
#draw_actor_graphic(actor, x - 40, y + 80)
draw_actor_name(actor, x + 8, y + 148)
draw_actor_class(actor, x + 8, y + 180)
#draw_actor_level(actor, x, y + 32)
draw_actor_level(actor, x + 8, y + 205)
draw_actor_state(actor, x + 8, y + 340)
draw_actor_exp(actor, x + 8, y + 310)
end
end
#--------------------------------------------------------------------------
# ● 左右换行
#--------------------------------------------------------------------------
def row_max
return @item_max
end
#--------------------------------------------------------------------------
# ● 刷新光标矩形
#--------------------------------------------------------------------------
#def update_cursor_rect
# if @index < 0
# self.cursor_rect.empty
# else
# #self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
# self.cursor_rect.set(@index * 150, 64, 150, 385)
# end
#end
def update_cursor_rect
# 光标位置不满 0 的情况下
if @index < 0
self.cursor_rect.empty
return
end
# 获取当前的行
row = @index / @column_max
# 当前行被显示开头行前面的情况下
if row < self.top_row
# 从当前行向开头行滚动
self.top_row = row
end
# 当前行被显示末尾行之后的情况下
if row > self.top_row + (self.page_row_max - 1)
# 从当前行向末尾滚动
self.top_row = row - (self.page_row_max - 1)
end
# 计算光标的宽
cursor_width = 150
# 计算光标坐标
x = @index * 150
y = 0
# 更新国标矩形
self.cursor_rect.set(@index * 150, 64, 150, 385)
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1