class PokegearButton < SpriteWrapper
attr_reader :index
attr_reader :name
attr_accessor :selected
def initialize(x,y,name="",index=0,viewport=nil)
super(viewport)
@index=index
@name=name
@selected=false
fembutton=pbResolveBitmap(sprintf("Graphics/Pictures/pokegearButtonf"))
if $Trainer.isFemale? && fembutton
@button=AnimatedBitmap.new("Graphics/Pictures/pokegearButtonf")
else
@button=AnimatedBitmap.new("Graphics/Pictures/pokegearButton")
end
@contents=BitmapWrapper.new(@button.width,@button.height)
self.bitmap=@contents
self.x=x
self.y=y
refresh
update
end
def dispose
@button.dispose
@contents.dispose
super
end
def refresh
self.bitmap.clear
self.bitmap.blt(0,0,@button.bitmap,Rect.new(0,0,@button.width,@button.height))
pbSetSystemFont(self.bitmap)
textpos=[ # Name is written on both unselected and selected buttons
[@name,self.bitmap.width/2,10,2,Color.new(248,248,248),Color.new(40,40,40)],
[@name,self.bitmap.width/2,62,2,Color.new(248,248,248),Color.new(40,40,40)]
]
pbDrawTextPositions(self.bitmap,textpos)
icon=sprintf("Graphics/Pictures/pokegear"+@name)
imagepos=[ # Icon is put on both unselected and selected buttons
[icon,18,10,0,0,-1,-1],
[icon,18,62,0,0,-1,-1]
]
pbDrawImagePositions(self.bitmap,imagepos)
end
def update
if self.selected
self.src_rect.set(0,self.bitmap.height/2,self.bitmap.width,self.bitmap.height/2)
else
self.src_rect.set(0,0,self.bitmap.width,self.bitmap.height/2)
end
super
end
end
#===============================================================================
# - Scene_Pokegear
#-------------------------------------------------------------------------------
# Modified By Harshboy
# Modified by Peter O.
# Also Modified By OblivionMew
# Overhauled by Maruno
#===============================================================================
class Scene_Pokegear
#-----------------------------------------------------------------------------
# initialize
#-----------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#-----------------------------------------------------------------------------
# main
#-----------------------------------------------------------------------------
def main
commands=[]
# OPTIONS - If you change these, you should also change update_command below.
@CMDMap=-1
@CMDPhone=-1
@CMDJukebox=-1
commands
@CMDMap=commands.length]=_INTL("Mapa") if $game_switches[99]
commands
@CMDPhone=commands.length]=_INTL("Celular") if $PokemonGlobal.phoneNumbers &&
$PokemonGlobal.phoneNumbers.length>0
commands
@CMDJukebox=commands.length]=_INTL("Radio")
commands
@CMDPcchecker=commands.length]=_INTL("PC Pokemon")
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@button=AnimatedBitmap.new("Graphics/Pictures/pokegearButton")
@Sprites={}
@Sprites["background"] = IconSprite.new(0,0)
femback=pbResolveBitmap(sprintf("Graphics/Pictures/pokegearbgf"))
if $Trainer.isFemale? && femback
@Sprites["background"].setBitmap("Graphics/Pictures/pokegearbgf")
else
@Sprites["background"].setBitmap("Graphics/Pictures/pokegearbg")
end
@Sprites["command_window"] = Window_CommandPokemon.new(commands,160)
@Sprites["command_window"].visible = false
@Sprites["command_window"].index = @menu_index
for i in 0...commands.length
x=118
y=196 - (commands.length*24) + (i*48)
@Sprites["button#{i}"]=PokegearButton.new(x,y,commands
,i,@viewport)
@Sprites["button#{i}"].selected=(i= @Sprites["command_window"].index)
@Sprites["button#{i}"].update
end
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
pbDisposeSpriteHash @Sprites)
end
#-----------------------------------------------------------------------------
# update the scene
#-----------------------------------------------------------------------------
def update
for i in 0.. @Sprites["command_window"].commands.length
sprite @Sprites["button#{i}"]
sprite.selected=(i= @Sprites["command_window"].index) ? true : false
end
pbUpdateSpriteHash @Sprites)
#update command window and the info if it's active
if @Sprites["command_window"].active
update_command
return
end
end
#-----------------------------------------------------------------------------
# update the command window
#-----------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
pbPlayCancelSE()
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if @CMDMap>=0 && @Sprites["command_window"].index= @CMDMap
pbPlayDecisionSE()
pbShowMap(-1,false)
end
if @CMDPhone>=0 && @Sprites["command_window"].index= @CMDPhone
pbPlayDecisionSE()
pbFadeOutIn(99999) {
PokemonPhoneScene.new.start
}
end
if @CMDJukebox>=0 && @Sprites["command_window"].index= @CMDJukebox
pbPlayDecisionSE()
$scene = Scene_Jukebox.new
end
if @CMDPcchecker>=0 && @Sprites["command_window"].index= @CMDPcchecker
pbPlayDecisionSE()
scene=PokemonStorageScene.new
screen=PokemonStorageScreen.new(scene,$PokemonStorage)
screen.pbStartScreen(2)
end
return
end
end
end