87 lines
3.5 KiB
Ruby
87 lines
3.5 KiB
Ruby
|
|
# -*- coding: utf-8 -*-
|
||
|
|
#==============================================================================
|
||
|
|
# ** Window_MenuStatus
|
||
|
|
#------------------------------------------------------------------------------
|
||
|
|
# This window displays party member status on the menu screen.
|
||
|
|
#==============================================================================
|
||
|
|
|
||
|
|
class Window_MenuStatus < Window_Selectable
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
# * Public Instance Variables
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
attr_reader :pending_index # Pending position (for formation)
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
# * Object Initialization
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
def initialize(x, y)
|
||
|
|
super(x, y, window_width, window_height)
|
||
|
|
@pending_index = -1
|
||
|
|
refresh
|
||
|
|
end
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
# * Get Window Width
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
def window_width
|
||
|
|
Graphics.width - 160
|
||
|
|
end
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
# * Get Window Height
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
def window_height
|
||
|
|
Graphics.height
|
||
|
|
end
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
# * Get Number of Items
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
def item_max
|
||
|
|
$game_party.members.size
|
||
|
|
end
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
# * Get Item Height
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
def item_height
|
||
|
|
(height - standard_padding * 2) / 4
|
||
|
|
end
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
# * Draw Item
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
def draw_item(index)
|
||
|
|
actor = $game_party.members[index]
|
||
|
|
enabled = $game_party.battle_members.include?(actor)
|
||
|
|
rect = item_rect(index)
|
||
|
|
draw_item_background(index)
|
||
|
|
draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)
|
||
|
|
draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
|
||
|
|
end
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
# * Draw Background for Item
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
def draw_item_background(index)
|
||
|
|
if index == @pending_index
|
||
|
|
contents.fill_rect(item_rect(index), pending_color)
|
||
|
|
end
|
||
|
|
end
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
# * Processing When OK Button Is Pressed
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
def process_ok
|
||
|
|
super
|
||
|
|
$game_party.menu_actor = $game_party.members[index]
|
||
|
|
end
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
# * Restore Previous Selection Position
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
def select_last
|
||
|
|
select($game_party.menu_actor.index || 0)
|
||
|
|
end
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
# * Set Pending Position (for Formation)
|
||
|
|
#--------------------------------------------------------------------------
|
||
|
|
def pending_index=(index)
|
||
|
|
last_pending_index = @pending_index
|
||
|
|
@pending_index = index
|
||
|
|
redraw_item(@pending_index)
|
||
|
|
redraw_item(last_pending_index)
|
||
|
|
end
|
||
|
|
end
|