#==============================================================================
# Window_SwitchParty class definition
#------------------------------------------------------------------------------
# A window that displays all 4 character slots in the party, and offers a
# cursor to modify it.
#
# By exseiken, October 04, 2004
#==============================================================================
class Window_SwitchParty 0
@index = @new_party.index(@new_party.first )
else
@index = 0
end
# draw the window's contents
refresh
# update the cursor rectangle
update_cursor_rect
end
#----------------------------------------------------------------------------
# Return the actor currently selected.
#----------------------------------------------------------------------------
def actor
# return the selected actor, or nil if none
@new_party[@index]
end
#----------------------------------------------------------------------------
# Update the contents of the window: clear the contents bitmap, then rebuild
# it.
#----------------------------------------------------------------------------
def refresh
# clear the contents of the bitmap
self.contents.clear
# draw each non-null party member
for i in
0..@new_party.size - 1
# get the actor
actor = @new_party
# if the actor is valid, draw it on the screen
if actor != nil
# calculate the y coordinate
y = 116 * i
# draw the actor's graphic
draw_actor_graphic(actor, 24, y + 80)
# draw the actor's name
draw_actor_name(actor, 64, y + 32)
# if the actor is not available, write in red "can't select"
if actor.mandatory
self.contents.font.color = Color.new(255, 0, 0, 255)
self.contents.draw_text(0, y, 224, 32, "Mandatory", 1)
end
end
end
end
#----------------------------------------------------------------------------
# Update the position rectangle of the cursor.
#----------------------------------------------------------------------------
def update_cursor_rect
# reset the cursor rectangle
self.cursor_rect.set(0, 116 * @index, width - 32, 96)
end
#----------------------------------------------------------------------------
# Change the actor selected for another, then redraw the entire window.
#
# Parameters:
# actors: The actor that will replace the selected one
#----------------------------------------------------------------------------
def change_selection(actor)
# change the actor (can be nil to remove it)
@new_party[@index] = actor
# redraw the window
refresh
end
#----------------------------------------------------------------------------
# Update the help window. (Here, the help window is really the actor status
# window.)
#----------------------------------------------------------------------------
def update_help
# draw the selected actor's name, level, status conditions and stats
@help_window.draw_actor_status(@new_party[@index])
end
end
--------------------------------------------------------------------------------