Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Scene_Main < Scene_Base
- def start
- super
- @menu_bar = Window_MenuBar.new
- @menu_bar.viewport = @viewport
- add_drop_menus
- end
- def add_drop_menus
- # file
- file = Window_DropMenu.new(@menu_bar, :file) do |w|
- w.add_item("Open...", :open, proc { !MapCon.open? } )
- w.add_item("Close", :close, MapCon.method(:open?))
- w.add_separator
- w.add_item("Exit", :exit)
- w.set_handler(:open, method(:on_open))
- w.set_handler(:exit, method(:exit))
- end # add finalize to the end of the initialize method something like: (yield self; finalize) if block_given?
- @menu_bar.add_command("File", :file, file)
- @menu_bar.set_handler(:file, method(:on_click_menu))
- #view
- view = Window_DropMenu.new(@menu_bar, :view)
- view.add_item("Zoom", :zoom, proc { MapCon.open? && MapCon.map_open? } )
- view.set_handler(:zoom, method(:on_zoom))
- view.finalize
- @menu_bar.add_command("View", :view, view)
- @menu_bar.set_handler(:view, method(:on_click_menu))
- # project
- proj = Window_DropMenu.new(@menu_bar, :project)
- proj.add_item("Open Map", :open, proc { !MapCon.map_open? } )
- proj.add_item("Close Map", :close, MapCon.method(:map_open?) )
- proj.add_separator
- proj.add_item("Add Map", :add)
- proj.set_handler(:open, method(:on_open_map))
- proj.finalize
- @menu_bar.add_command("Project", :project, proj)
- @menu_bar.set_handler(:project, method(:on_click_menu))
- # about
- abt = Window_DropMenu.new(@menu_bar, :about)
- abt.add_item("About...", :about)
- abt.add_item("Help", :help)
- abt.set_handler(:help, method(:on_help))
- abt.finalize
- @menu_bar.add_command("About", :about, abt)
- @menu_bar.set_handler(:about, method(:on_click_menu))
- @menu_bar.finalize
- end
- def on_click_menu
- @menu_bar.drop_window(@menu_bar.current_symbol)
- end
- def on_open
- file = Fyx.open_file("Game.rvproj2", "rvproj2", "Open your game's project.")
- if File.exist?(file)
- MapCon.open(File.dirname(file))
- end
- end
- def on_close
- #~ ask_save if MapCon.working?
- #~ MapCon.close
- #~ @spriteset.clear
- end
- def on_open_map
- MapCon.open_map
- end
- def on_help
- p "Helping!"
- end
- def on_zoom
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment