IceDragon200

[VXA]FenixFyreX Widgets

Jun 15th, 2013
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Scene_Main < Scene_Base
  2.   def start
  3.     super
  4.     @menu_bar = Window_MenuBar.new
  5.     @menu_bar.viewport = @viewport
  6.     add_drop_menus
  7.   end
  8.  
  9.   def add_drop_menus
  10.    
  11.     # file
  12.     file = Window_DropMenu.new(@menu_bar, :file) do |w|
  13.       w.add_item("Open...", :open, proc { !MapCon.open? } )
  14.       w.add_item("Close", :close, MapCon.method(:open?))
  15.       w.add_separator
  16.       w.add_item("Exit", :exit)
  17.    
  18.       w.set_handler(:open, method(:on_open))
  19.       w.set_handler(:exit, method(:exit))
  20.     end # add finalize to the end of the initialize method something like: (yield self; finalize) if block_given?
  21.    
  22.     @menu_bar.add_command("File", :file, file)
  23.     @menu_bar.set_handler(:file,  method(:on_click_menu))
  24.    
  25.     #view
  26.     view = Window_DropMenu.new(@menu_bar, :view)
  27.    
  28.     view.add_item("Zoom", :zoom, proc { MapCon.open? && MapCon.map_open? } )
  29.    
  30.     view.set_handler(:zoom, method(:on_zoom))
  31.     view.finalize
  32.    
  33.     @menu_bar.add_command("View", :view, view)
  34.     @menu_bar.set_handler(:view, method(:on_click_menu))
  35.    
  36.     # project
  37.     proj = Window_DropMenu.new(@menu_bar, :project)
  38.    
  39.     proj.add_item("Open Map",  :open,  proc { !MapCon.map_open? } )
  40.     proj.add_item("Close Map", :close, MapCon.method(:map_open?)  )
  41.     proj.add_separator
  42.     proj.add_item("Add Map", :add)
  43.    
  44.     proj.set_handler(:open, method(:on_open_map))
  45.     proj.finalize
  46.  
  47.     @menu_bar.add_command("Project", :project, proj)
  48.     @menu_bar.set_handler(:project, method(:on_click_menu))
  49.    
  50.     # about
  51.     abt  = Window_DropMenu.new(@menu_bar, :about)
  52.    
  53.     abt.add_item("About...", :about)
  54.     abt.add_item("Help", :help)
  55.    
  56.     abt.set_handler(:help, method(:on_help))
  57.     abt.finalize
  58.    
  59.     @menu_bar.add_command("About", :about, abt)
  60.     @menu_bar.set_handler(:about,  method(:on_click_menu))
  61.    
  62.     @menu_bar.finalize
  63.   end
  64.  
  65.   def on_click_menu
  66.     @menu_bar.drop_window(@menu_bar.current_symbol)
  67.   end
  68.  
  69.   def on_open
  70.     file = Fyx.open_file("Game.rvproj2", "rvproj2", "Open your game's project.")
  71.     if File.exist?(file)
  72.       MapCon.open(File.dirname(file))
  73.     end
  74.   end
  75.  
  76.   def on_close
  77. #~     ask_save if MapCon.working?
  78. #~     MapCon.close
  79. #~     @spriteset.clear
  80.   end
  81.  
  82.   def on_open_map
  83.     MapCon.open_map
  84.   end
  85.  
  86.   def on_help
  87.     p "Helping!"
  88.   end
  89.  
  90.   def on_zoom
  91.    
  92.   end
  93. end
Advertisement
Add Comment
Please, Sign In to add comment