class Window_MenuStatus < Window_Base
attr_reader :index
attr_reader :chr_status
def initialize
@viewport = Viewport.new(0, 0, 640, 480)
@viewport.z = 3001
super(-16, -16, 640+32, 480+32)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.active = false
self.z = 3000
@index = -1
@column_max = 1
@sprites = []
refresh
end
def index=(index)
@index = index
if self.active and @chr_status != nil
update_chr_status
end
update_cursor_rect
refresh
end
def refresh
self.contents.clear
for i in
0...@sprites.size@sprites[i].dispose
end
@sprites = []
@item_max = $game_party.actors.size
for i in 0...@item_max
actor = $game_party.actors[3-i]
@sprites[3-i] = Sprite.new(@viewport)
@sprites[3-i].bitmap = RPG::Cache.picture(actor.name)
@sprites[3-i].x = 560-((i+1)*120)
@sprites[3-i].y = 480-@sprites[3-i].bitmap.height
@sprites[3-i].opacity = 255
@sprites[3-i].z = 3004-i
end
end
def update_cursor_rect
if @index < 0
for i in
0...@sprites.size@sprites[i].opacity = 255
end
else
for i in
0...@sprites.sizeif i == @index
@sprites[i].opacity = 255
@sprites[i].z += 4
else
@sprites[i].opacity = 200
@sprites[i].z = 3001+i
end
end
end
end
def dispose
super
for i in
0...@sprites.size@sprites[i].dispose
end
end
def chr_status=(chr_status)
@chr_status = chr_status
if self.active and @chr_status != nil
update_chr_status
end
end
def update
super
if self.active and @item_max > 0 and @index >= 0
if Input.repeat?(Input::RIGHT)
if Input.trigger?(Input::RIGHT) or @index < @item_max - @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end
if Input.repeat?(Input::LEFT)
if Input.trigger?(Input::LEFT) or @index >= @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
end
if self.active and @chr_status != nil
update_chr_status
elsif @chr_status != nil
@chr_status.refresh(-1)
end
update_cursor_rect
end
def update_chr_status
@chr_status.refresh(@index)
end
end
class Window_Base
def shadow_color
return Color.new(0, 0, 0, 255)
end
def draw_actor_name(actor, x, y)
self.contents.font.color = shadow_color
self.contents.draw_text(x+1, y+1, 120, 32, actor.name)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
end
def draw_actor_level(actor, x, y)
self.contents.font.color = shadow_color
self.contents.draw_text(x+1, y+1, 32, 32, "Lv")
self.contents.draw_text(x + 33, y + 1, 24, 32, actor.level.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
def draw_actor_hp(actor, x, y, width = 144)
self.contents.font.color = shadow_color
self.contents.draw_text(x+1, y+1, 32, 32, $data_system.words.hp)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = shadow_color
self.contents.draw_text(hp_x+1, y+1, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = shadow_color
self.contents.draw_text(hp_x + 49, y+1, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 61, y+1, 48, 32, actor.maxhp.to_s)
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end
def draw_actor_sp(actor, x, y, width = 144)
self.contents.font.color = shadow_color
self.contents.draw_text(x+1, y+1, 32, 32, $data_system.words.sp)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = shadow_color
self.contents.draw_text(sp_x+1, y+1, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = shadow_color
self.contents.draw_text(sp_x + 49, y+1, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 61, y+1, 48, 32, actor.maxsp.to_s)
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
end
end