Home > RGSS Script Reference > Window_EquipLeft
Window_EquipLeft
Inherits from: Window_Base
Description: This window shows the stat changes associated with equipping or removing a weapon as they are highlighted on the item window below this window.
class Window_EquipLeft < Window_Base
# ------------------------------------
def initialize(actor)
super(0, 64, 272, 192)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
# ------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 4, 32)
draw_actor_parameter(@actor, 4, 64, 0)
draw_actor_parameter(@actor, 4, 96, 1)
draw_actor_parameter(@actor, 4, 128, 2)
if @new_atk != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 64, 40, 32, "", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 96, 40, 32, "", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 128, 40, 32, "", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
end
end
# ------------------------------------
def set_new_parameters(new_atk, new_pdef, new_mdef)
if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
refresh
end
end
end
|
Actor: The actor whose equipment is being changed.
New_Atk: The actor's new attack power if the currently selected item is equipped.
New_Pdef: The actor's new physical defense if the currently selected item is equipped.
New_Mdef: The actor's new magic defense if the currently selected item is equipped.
Initialize
Arguments:
Actor: The actor whose equipment is being changed.
Local Variables: None
How it Works: This method initializes the window. First, the window's x coordinate is initialized to 0, the y coordinate is initialized to 64, the width to 272, and the height to 192. Then, the @actor variables is set to the actor whose equipment is being changed. The window is then populated with data by the refresh method.
Refresh
Arguments: None
Local Variables: None
How it Works: This method draws the window's contents. First, the window's contents are cleared. First, the actor's name, level, current attack power, current physical defense, and current magical defense, all at x coordinate 4 and the y coordinate starts at 0, increasing by 32 with each stat. The second part of the method draws the new stats the actor would have if it equipped the item currently selected in the item window below this window. In all three cases, an arrow character is drawn in the system color on the same line as the current stat of that type, to the right of that stat and to the left of the new stat. The new stats are drawn at x coordinate 200. The y coordinate is 64 for the new attack power, 96, for the new physical defense, and 128 for the new magical defense. Note that these values are drawn right-aligned because of the optional argument "2" in the self.contents.draw_text statement.
Set_New_Parameters
Arguments:
New_Atk: The new attack power to display
New_Pdef: The new physical defense to display
New_Mdef: The new magic defense to display
Local Variables: None
How it Works: This method simply sets the @new_atk, @new_pdef, and @new_mdef instance variables to the values passed to this method and updates the window contents to reflect this.
|
|