class Window_Pokedex < SpriteWindow_Selectable
attr_reader :baseColor
attr_reader :shadowColor
def initialize(x,y,width,height)
@starting=true
super(x,y,width,height)
@selarrow=BitmapCache.load_bitmap("Graphics/Pictures/selarrow.png")
@pokeball=BitmapCache.load_bitmap("Graphics/Pictures/pokeball.png")
@baseColor=Color.new(9<<3,9<<3,9<<3)
@shadowColor=Color.new(26<<3,26<<3,26<<3)
self.index=0
@commands=[]
@item_max=0
@starting=false
refresh
end
def commands=(value)
@commands=value
refresh
end
def dispose
@selarrow.dispose
@pokeball.dispose
super
end
def species
return @commands.length==0 ? 0 : @commands[self.index][0]
end
def refresh
return if @starting
@
[email protected]
dheight=self.height-32
dwidth=self.width-32
if !self.contents || self.contents.disposed? ||
self.contents.height<dheight || self.contents.width<dwidth
self.contents.dispose if self.contents
self.contents=Bitmap.new([1,dwidth].max,[1,dheight].max)
pbSetSystemFont(self.contents)
end
self.contents.clear
contentsWidth=self.contents.width
ypos=0
for i in 0...@item_max
if i<self.top_row || i>self.top_row+self.page_row_max
next
end
pbCopyBitmap(self.contents,@selarrow,0,ypos) if self.index==i
species=@commands
[0]
if $Trainer.seen[species]
j=self.top_row
if $Trainer.owned[species]
pbCopyBitmap(self.contents,@pokeball,210,(i-j)*32)
end
text=_ISPRINTF("No.{1:03d} {2:s}",@commands[0],@commands[1])
else
text=_ISPRINTF("No.{1:03d} ----------",@commands[0])
end
self.contents.font.color=@shadowColor
pbDrawShadow(self.contents,16,ypos,self.contents.width-16,32,text)
self.contents.font.color=@baseColor
self.contents.draw_text(16,ypos,self.contents.width-16,32,text)
ypos+=32
end
end
def update
dorefresh=false
oldindex=self.index
super
dorefresh=(self.index!=oldindex)
refresh if dorefresh
end
end