neonblack

For Rello Equip Sprite

May 25th, 2014
220
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class EquipHeader_Sprite < Sprite
  2.   Position = [265, 270]
  3.   BitmapHash ={
  4.     0 => "XYZ",
  5.     1 => "XYZ",
  6.     2 => "XYZ",
  7.   }
  8.  
  9.  
  10.   def initialize(item_window)
  11.     super(nil)
  12.     @item_window = item_window
  13.     self.x, self.y = *Position
  14.     refresh
  15.   end
  16.  
  17.   def update
  18.     super
  19.     self.visible = @item_window.visible
  20.     refresh unless @equip_type == @item_window.equip_id_from_actor
  21.   end
  22.  
  23.   def refresh
  24.     @equip_type = @item_window.equip_id_from_actor
  25.     self.bitmap = get_equip_bitmap
  26.   end
  27.  
  28.   def get_equip_bitmap
  29.     if BitmapHash.include?(@equip_type)
  30.       return Cache.picture(BitmapHash[@equip_type])
  31.     end
  32.     return Bitmap.new(32, 32)
  33.   end
  34. end
  35.  
  36.  
  37. class Window_EquipItem < Window_ItemList
  38.   def equip_id_from_actor
  39.     @actor.equip_slots[@slot_id]
  40.   end
  41. end
  42.  
  43.  
  44. class Scene_Equip < Scene_MenuBase
  45.   alias cp_create_item_window_edit_for_rello create_item_window
  46.   def create_item_window(*args)
  47.     cp_create_item_window_edit_for_rello(*args)
  48.     @header_sprite = EquipHeader_Sprite.new(@item_window)
  49.   end
  50.  
  51.   def update
  52.     super
  53.     @header_sprite.update
  54.   end
  55.  
  56.   def terminate
  57.     @header_sprite.dispose
  58.     super
  59.   end
  60. end
RAW Paste Data