Advertisement
YesImAaron

YIA Simple Menu

Jun 16th, 2012
1,262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.54 KB | None | 0 0
  1. #===============================================================================
  2. # YIA Simple Menu (requested by GreyInvidia)
  3. # By YesImAaron
  4. #
  5. # IF USED MUST CREDIT
  6. # YesImAaron
  7. #===============================================================================
  8. # This script set's up a simple menu at the bottom center of the screen
  9. # The only commands in the menu are Items Save and Exit.
  10. #===============================================================================
  11. #===============================================================================
  12. module YIA
  13.  
  14. #===============================================================================
  15. # XPOS = x position of the menu
  16. # YPOS = y position of the menu
  17. # WIDTH = width of the menu
  18. #===============================================================================
  19. XPOS = 130
  20. YPOS = 350
  21. WIDTH = 300
  22.  
  23. end
  24. #===============================================================================
  25. # EDIT PAST HERE AT YOUR OWN RISK
  26. #==============================================================================
  27. # ** Window_YIA_Menu
  28. #------------------------------------------------------------------------------
  29. # This set's up the command window
  30. #==============================================================================
  31.  
  32. class Window_YIA_Menu < Window_HorzCommand
  33.   #--------------------------------------------------------------------------
  34.   # * Object Initialization
  35.   #--------------------------------------------------------------------------
  36.   def initialize(x, y, width)
  37.     @window_width = width
  38.     super(x, y)
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # * Get Window Width
  42.   #--------------------------------------------------------------------------
  43.   def window_width
  44.     @window_width
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # * Get Digit Count
  48.   #--------------------------------------------------------------------------
  49.   def col_max
  50.     return 3
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # * Create Command List
  54.   #--------------------------------------------------------------------------
  55.   def make_command_list
  56.     add_command(Vocab::item,   :item)
  57.     add_command(Vocab::save, :save)
  58.     add_command(Vocab::game_end,    :game_end)
  59.   end
  60. end
  61.  
  62.  
  63. class Scene_Map < Scene_Base
  64.   #--------------------------------------------------------------------------
  65.   # * Call Menu Screen
  66.   #--------------------------------------------------------------------------
  67.   alias :yia_call_menu call_menu
  68.   def call_menu
  69.     yia_call_menu
  70.     Sound.play_ok
  71.     SceneManager.call(Scene_YIA_Menu)
  72.     Window_MenuCommand::init_command_position
  73.   end  
  74.   end
  75.  
  76. class Scene_YIA_Menu < Scene_MenuBase
  77.   #--------------------------------------------------------------------------
  78.   # * Start Processing
  79.   #--------------------------------------------------------------------------
  80.   def start
  81.     super
  82.     create_command_window
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # * Create Command Window
  86.   #--------------------------------------------------------------------------
  87.   def create_command_window
  88.     @command_window = Window_YIA_Menu.new(YIA::XPOS,YIA::YPOS,YIA::WIDTH)
  89.     @command_window.set_handler(:item,      method(:command_item))
  90.     @command_window.set_handler(:save,      method(:command_save))
  91.     @command_window.set_handler(:game_end,  method(:command_game_end))
  92.     @command_window.set_handler(:cancel,    method(:return_scene))
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # * [Item] Command
  96.   #--------------------------------------------------------------------------
  97.   def command_item
  98.     SceneManager.call(Scene_Item)
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # * [Save] Command
  102.   #--------------------------------------------------------------------------
  103.   def command_save
  104.     SceneManager.call(Scene_Save)
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # * [Exit Game] Command
  108.   #--------------------------------------------------------------------------
  109.   def command_game_end
  110.     SceneManager.call(Scene_End)
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # * Return to Calling Scene
  114.   #--------------------------------------------------------------------------
  115.   def return_scene
  116.     SceneManager.call(Scene_Map)
  117.   end
  118. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement