daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Jun 23rd, 2018 135 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Menu
  2.  
  3.   def pbStartScene
  4.     @done=false
  5.     @index=0
  6.     @oldindex=0
  7.     @commands=[]
  8.    
  9.     @helptext=
  10.     [
  11.       "See all the Pokémon you \nhave seen and captured.",
  12.       "Check your Pokémon party \n and view their summary.",
  13.       "View your collection of items that you have collected on your journey.",
  14.       "Inspect your Trainer Card, see how many badges you have and more.",
  15.       "Save the progress of your journey.",
  16.       "Edit your options and decide on your preferences.",
  17.       "Exit the menu.",
  18.       "Debug isn't here in the main game."
  19.     ]
  20.  
  21.     @sprites={}
  22.        
  23.     @sprites["overlay"]=Sprite.new
  24.     @sprites["overlay"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/Overlay image")
  25.  
  26.     @sprites["bg"]=Sprite.new
  27.     @sprites["bg"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/textBG")
  28.    
  29.     @sprites["cursor"]=Sprite.new
  30.     @sprites["cursor"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/Selected Option")
  31.     @sprites["cursor"].x=67
  32.     @sprites["cursor"].y=76
  33.     @sprites["cursor"].z=1
  34.    
  35.     @sprites["text"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
  36.     pbSetSystemFont(@sprites["text"].bitmap)
  37.     @sprites["text"].bitmap.font.size=28
  38.     @sprites["text"].z=2
  39.    
  40.     @sprites["helptext"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
  41.     pbSetSystemFont(@sprites["helptext"].bitmap)
  42.    
  43.     if $Trainer.pokedex
  44.       @commands.push("PokeDex")
  45.     else
  46.       @commands.push("")
  47.     end
  48.    
  49.     if $Trainer.party.length>0
  50.       @commands.push("Pokemon")
  51.     else
  52.       @commands.push("")
  53.     end
  54.    
  55.     @commands.push("Bag")
  56.     @commands.push("I.D.")
  57.     @commands.push("Save")
  58.     @commands.push("Config")
  59.     @commands.push("Exit")
  60.    
  61.     if $DEBUG
  62.       @commands.push("Debug")
  63.    
  64.     end
  65.    
  66.     for i in 0...@commands.length
  67.       pbDrawShadowText(@sprites["text"].bitmap,80,76+34*i,100,30,@commands[i],Color.new(0,0,0),Color.new(190,190,170))
  68.     end
  69.    
  70.     pbDrawShadowText(@sprites["helptext"].bitmap,200,315,275,100,@helptext[@index],Color.new(31*8,31*8,31*8),Color.new(0,0,0))
  71.  
  72.     #pbFadeInAndShow(@sprites){update}
  73.   end
  74.    
  75.   def pbScene
  76.     loop do
  77.       @oldindex=@index
  78.       Graphics.update
  79.       Input.update
  80.       update
  81.       if Input.trigger?(Input::B) || @done
  82.         break
  83.       end
  84.     end
  85.   end
  86.  
  87.   def update
  88.     if Input.trigger?(Input::UP)
  89.       @index > 0 ? @index-=1 : @index=@commands.length-1
  90.       @sprites["cursor"].y=76+@index*34
  91.       @sprites["helptext"].bitmap.clear
  92.       pbDrawShadowText(@sprites["helptext"].bitmap,200,215,275,100,@helptext[@index],Color.new(31*8,31*8,31*8),Color.new(0,0,0))
  93.     elsif Input.trigger?(Input::DOWN)
  94.       @index < @commands.length-1 ? @index+=1 : @index=0
  95.       @sprites["cursor"].y=76+@index*34
  96.       @sprites["helptext"].bitmap.clear
  97.       pbDrawShadowText(@sprites["helptext"].bitmap,200,215,275,100,@helptext[@index],Color.new(31*8,31*8,31*8),Color.new(0,0,0))
  98.     elsif Input.trigger?(Input::C)
  99.       pbSEPlay("Select")
  100.       case @commands[@index]
  101.       when "PokeDex"
  102.         pbFadeOutIn(99999) {
  103.            scene=PokemonPokedexScene.new
  104.            screen=PokemonPokedex.new(scene)
  105.            screen.pbStartScreen
  106.         }
  107.       when "Pokemon"
  108.         sscene=PokemonScreen_Scene.new
  109.         sscreen=PokemonScreen.new(sscene,$Trainer.party)
  110.         hiddenmove=nil
  111.         pbFadeOutIn(99999) {
  112.            hiddenmove=sscreen.pbPokemonScreen
  113.            if hiddenmove
  114.              @scene.pbEndScene
  115.            end
  116.         }
  117.         if hiddenmove
  118.           Kernel.pbUseHiddenMove(hiddenmove[0],hiddenmove[1])
  119.           return
  120.         end
  121.       when "Bag"
  122.         item=0
  123.         scene=PokemonBag_Scene.new
  124.         screen=PokemonBagScreen.new(scene,$PokemonBag)
  125.         pbFadeOutIn(99999) {
  126.            item=screen.pbStartScreen
  127.            if item>0
  128.              @scene.pbEndScene
  129.            end
  130.         }
  131.         if item>0
  132.           Kernel.pbUseKeyItemInField(item)
  133.           return
  134.         end
  135.       when "I.D."
  136.         scene=PokemonTrainerCardScene.new
  137.         screen=PokemonTrainerCard.new(scene)
  138.         pbFadeOutIn(99999) {
  139.           screen.pbStartScreen
  140.         }
  141.       when "Save"
  142.         #hide all sprites
  143.         for sprite in @sprites
  144.           #[0] is the sprite name, [1] is the image
  145.           sprite[1].opacity=0
  146.         end
  147.         scene=PokemonSaveScene.new
  148.         screen=PokemonSave.new(scene)
  149.         if screen.pbSaveScreen
  150.           @done=true
  151.         else
  152.           #make all sprites visible again
  153.           for sprite in @sprites
  154.             sprite[1].opacity=255
  155.           end
  156.         end
  157.       when "Config"
  158.         scene=PokemonOptionScene.new
  159.         screen=PokemonOption.new(scene)
  160.         pbFadeOutIn(99999) {
  161.            screen.pbStartScreen
  162.            pbUpdateSceneMap
  163.         }
  164.       when "Debug"
  165.         pbFadeOutIn(99999) {
  166.            pbDebugMenu
  167.         }
  168.       when "Exit"
  169.         @done=true
  170.       end
  171.     end
  172.     pbUpdateSpriteHash(@sprites)
  173.   end
  174.  
  175.   def pbEndScene
  176.     #pbFadeOutAndHide(@sprites){update}
  177.     pbDisposeSpriteHash(@sprites)
  178.   end
  179.  
  180. end#class end
  181.  
  182. class MenuScreen
  183.  
  184.   def initialize(scene)
  185.     @scene=scene
  186.   end
  187.  
  188.   def pbStartScreen
  189.     @scene.pbStartScene
  190.     @scene.pbScene
  191.     @scene.pbEndScene
  192.   end
  193.  
  194.   end#class end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top