本帖最后由 魔法丶小肉包 于 2017-5-14 14:35 编辑
设定File,文件夹路径,后面的*号不要改,将会读取此文件夹下的所有文件
读取之后,会作为Scene_Menu1的选项,
具体要干嘛,你可以在command_a方法里自己写
module MFXRB File = "Audio/BGM/*" end class Scene_Menu1 < Scene_MenuBase def start super c_w end def c_w @mw = Window_Menu1.new @mw.set_handler(:a, method(:command_a)) @mw.set_handler(:cancel, method(:return_scene)) end def command_a end end class Window_Menu1 < Window_Command include MFXRB def initialize super(0,0) end def window_width return 544 end def visible_line_number item_max end def make_command_list file_name = Dir[File] file_name.each {|i| add_command(i, :a) } end end
module MFXRB
File = "Audio/BGM/*"
end
class Scene_Menu1 < Scene_MenuBase
def start
super
c_w
end
def c_w
@mw = Window_Menu1.new
@mw.set_handler(:a, method(:command_a))
@mw.set_handler(:cancel, method(:return_scene))
end
def command_a
end
end
class Window_Menu1 < Window_Command
include MFXRB
def initialize
super(0,0)
end
def window_width
return 544
end
def visible_line_number
item_max
end
def make_command_list
file_name = Dir[File]
file_name.each {|i|
add_command(i, :a)
}
end
end
|