赞 | 90 |
VIP | 350 |
好人卡 | 311 |
积分 | 101 |
经验 | 150139 |
最后登录 | 2024-7-17 |
在线时间 | 5020 小时 |
Lv4.逐梦者 (版主) 无限の剣制
- 梦石
- 0
- 星屑
- 10074
- 在线时间
- 5020 小时
- 注册时间
- 2013-2-28
- 帖子
- 5030
|
本帖最后由 VIPArcher 于 2015-4-12 01:19 编辑
这个是老版本论坛代码解析带来的错误。
估计正确的是这样的
class Window_NewMenuStatus < Window_Command #---------------------------------------------------------------------------- # * 初始化 #---------------------------------------------------------------------------- def initialize super(160, 0) end #---------------------------------------------------------------------------- # * 获取窗口的宽度 #---------------------------------------------------------------------------- def window_width return 384 end #---------------------------------------------------------------------------- # * 获取窗口的高度 #---------------------------------------------------------------------------- def window_height return 416 end #---------------------------------------------------------------------------- # * 更新内容 #---------------------------------------------------------------------------- def refresh super draw_actor_status end #---------------------------------------------------------------------------- # * 生成指令列表 #---------------------------------------------------------------------------- def make_command_list for actor in $game_party.members s = "a[#{actor.id}]" add_command(actor.name, s.to_sym, !actor.death_state?, actor.id) end end #---------------------------------------------------------------------------- # * 描绘选项 #---------------------------------------------------------------------------- def draw_item(index) rect = item_rect_for_text(index) b = Bitmap.new(rect.width, rect.height) cn = $game_actors[@list[index][:ext]].character_name ci = $game_actors[@list[index][:ext]].character_index cb = Cache.character(cn) if cn[0] == "$" cr = Rect.new cr.x = cb.width / 3 cr.width = cb.width / 3 cr.height = cb.height / 4 else cr = Rect.new cr.x = ci % 4 * (cb.width / 4) + cb.width / 12 cr.y = ci / 4 * (cb.height / 2) cr.width = cb.width / 12 cr.height = cb.height / 8 end b.blt((b.width - cr.width) / 2, (b.height - cr.height) / 2, cb, cr) unless command_enabled?(index) for y in 0...b.height for x in 0...b.width next if b.get_pixel(x, y).alpha == 0 c = b.get_pixel(x, y) m = (c.red + c.green + c.blue) / 3 b.set_pixel(x, y, Color.new(m, m, m, c.alpha)) end end end self.contents.blt(rect.x, rect.y, b, b.rect) b.dispose cb.dispose end #---------------------------------------------------------------------------- # * 获取项目的绘制矩形 #---------------------------------------------------------------------------- def item_rect(index) rect = Rect.new rect.width = self.contents.width / 4 rect.height = 48 rect.x = (index < 4 ? index * rect.width : (index - 4) * rect.width) rect.y = (index < 4 ? 0 : self.contents.height - rect.height) return rect end #---------------------------------------------------------------------------- # * 描绘角色的状态 #---------------------------------------------------------------------------- def draw_actor_status actor = $game_actors[@list[@index][:ext]] y = item_rect_for_text(0).height + 5 h = self.contents.height - 2 * (item_rect_for_text(0).height + 5) self.contents.clear_rect(Rect.new(0, y, self.contents.width, h)) draw_actor_face(actor, 0, y) draw_actor_name(actor, 0, y) draw_actor_level(actor, 96, y) draw_actor_nickname(actor, 168, y) draw_actor_hp(actor, 96, y + line_height, self.contents.width - 96) draw_actor_mp(actor, 96, y + 2 * line_height, self.contents.width - 96) draw_actor_icons(actor, 96, y + 3 * line_height) for i in 0...6 draw_actor_param(actor, 0, y + (4 + i) * line_height, i) end for i in 0...5 draw_item_name(actor.equips[i], self.contents.width / 2, y + (4 + i) * line_height) if actor.equips[i] != nil end end #---------------------------------------------------------------------------- # * 选择项目 #---------------------------------------------------------------------------- def select(index) super draw_actor_status end end
class Window_NewMenuStatus < Window_Command
#----------------------------------------------------------------------------
# * 初始化
#----------------------------------------------------------------------------
def initialize
super(160, 0)
end
#----------------------------------------------------------------------------
# * 获取窗口的宽度
#----------------------------------------------------------------------------
def window_width
return 384
end
#----------------------------------------------------------------------------
# * 获取窗口的高度
#----------------------------------------------------------------------------
def window_height
return 416
end
#----------------------------------------------------------------------------
# * 更新内容
#----------------------------------------------------------------------------
def refresh
super
draw_actor_status
end
#----------------------------------------------------------------------------
# * 生成指令列表
#----------------------------------------------------------------------------
def make_command_list
for actor in $game_party.members
s = "a[#{actor.id}]"
add_command(actor.name, s.to_sym, !actor.death_state?, actor.id)
end
end
#----------------------------------------------------------------------------
# * 描绘选项
#----------------------------------------------------------------------------
def draw_item(index)
rect = item_rect_for_text(index)
b = Bitmap.new(rect.width, rect.height)
cn = $game_actors[@list[index][:ext]].character_name
ci = $game_actors[@list[index][:ext]].character_index
cb = Cache.character(cn)
if cn[0] == "$"
cr = Rect.new
cr.x = cb.width / 3
cr.width = cb.width / 3
cr.height = cb.height / 4
else
cr = Rect.new
cr.x = ci % 4 * (cb.width / 4) + cb.width / 12
cr.y = ci / 4 * (cb.height / 2)
cr.width = cb.width / 12
cr.height = cb.height / 8
end
b.blt((b.width - cr.width) / 2, (b.height - cr.height) / 2, cb, cr)
unless command_enabled?(index)
for y in 0...b.height
for x in 0...b.width
next if b.get_pixel(x, y).alpha == 0
c = b.get_pixel(x, y)
m = (c.red + c.green + c.blue) / 3
b.set_pixel(x, y, Color.new(m, m, m, c.alpha))
end
end
end
self.contents.blt(rect.x, rect.y, b, b.rect)
b.dispose
cb.dispose
end
#----------------------------------------------------------------------------
# * 获取项目的绘制矩形
#----------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = self.contents.width / 4
rect.height = 48
rect.x = (index < 4 ? index * rect.width : (index - 4) * rect.width)
rect.y = (index < 4 ? 0 : self.contents.height - rect.height)
return rect
end
#----------------------------------------------------------------------------
# * 描绘角色的状态
#----------------------------------------------------------------------------
def draw_actor_status
actor = $game_actors[@list[@index][:ext]]
y = item_rect_for_text(0).height + 5
h = self.contents.height - 2 * (item_rect_for_text(0).height + 5)
self.contents.clear_rect(Rect.new(0, y, self.contents.width, h))
draw_actor_face(actor, 0, y)
draw_actor_name(actor, 0, y)
draw_actor_level(actor, 96, y)
draw_actor_nickname(actor, 168, y)
draw_actor_hp(actor, 96, y + line_height, self.contents.width - 96)
draw_actor_mp(actor, 96, y + 2 * line_height, self.contents.width - 96)
draw_actor_icons(actor, 96, y + 3 * line_height)
for i in 0...6
draw_actor_param(actor, 0, y + (4 + i) * line_height, i)
end
for i in 0...5
draw_item_name(actor.equips[i], self.contents.width / 2, y + (4 + i) * line_height) if actor.equips[i] != nil
end
end
#----------------------------------------------------------------------------
# * 选择项目
#----------------------------------------------------------------------------
def select(index)
super
draw_actor_status
end
end
未测试 |
评分
-
查看全部评分
|