Advertisement
Zetu

Z01 Menu System

Dec 4th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.92 KB | None | 0 0
  1. #==============================================
  2. # Neo Menu System :: By Zetu (RMVXAce)
  3. #==============================================
  4.  
  5. module Z01
  6.   MENUCOMMANDLIST = [
  7.     #"Vocab", :symbol, "Boolean", script call, if require char selection, method to call
  8.     # For literals in Vocab, use "' '" (Or single quotes wrapped in double quotes)
  9.     # otherwise, it will run as code.
  10.     ["Vocab::item", :item, "main_commands_enabled", false, :command_item],
  11.     ["Vocab::skill",  :skill,  "main_commands_enabled", true, :command_skill],
  12.     ["Vocab::equip",  :equip,  "main_commands_enabled", true, :command_equip],
  13.     ["Vocab::status", :status, "main_commands_enabled", true, :command_status],
  14.     ["Vocab::formation", :formation, "formation_enabled", false, :command_formation],
  15.     ["Vocab::save", :save, "save_enabled", false, :command_formation],
  16.     ["Vocab::game_end", :game_end, "true", false, :command_game_end]
  17.     #["'Sample of Literal'", :symbol, "boolean", requires char selection?, event call symbol]
  18.   ]
  19. end
  20.  
  21. class Window_MenuCommand < Window_Command
  22.  
  23.   def make_command_list
  24.     for command in Z01::MENUCOMMANDLIST
  25.       add_command(eval(command[0]), command[1], eval(command[2]))
  26.     end
  27.   end
  28.  
  29. end
  30.  
  31. class Scene_Menu < Scene_MenuBase
  32.  
  33.   def create_command_window
  34.     @command_window = Window_MenuCommand.new
  35.     for command in Z01::MENUCOMMANDLIST
  36.       if command[3]
  37.         @command_window.set_handler(command[1], method(command[4]))
  38.       else
  39.         @command_window.set_handler(command[1], method(:command_personal))
  40.       end
  41.     end
  42.     @command_window.set_handler(:cancel, method(:return_scene))
  43.   end
  44.  
  45.   def on_personal_ok
  46.     method(Z01[@command_window.index][4]).call
  47.   end
  48.  
  49.   def command_skill
  50.     SceneManager.call(Scene_Skill)
  51.   end
  52.  
  53.   def command_equip
  54.     SceneManager.call(Scene_Equip)
  55.   end
  56.  
  57.   def command_status
  58.     SceneManager.call(Scene_Status)
  59.   end
  60.  
  61. end
  62.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement