=begin
说明:
<span style="background-color: rgb(255, 255, 255); ">这个脚本可以在运行时根据需要将文件复制到工程目录下,如果文件找不到还可以忽略文件(缺少图片的话自动变成32*32的空白位图,音效直接变为没有)</span>
<span style="background-color: rgb(255, 255, 255); ">只要把游戏从头到尾彻底测试一遍就可以了呢</span>
2013年2月1日 from 幻想天空 [url]www.rpgsky.net[/url] 作者:克莉丝
=end
#这里填写复制来源(Graphics是这个目录的子目录,注意不能用"\"来表示子目录要用"/"
RES = 'D:/Program Files (x86)/RPG Maker VX Ace/RTP/' #●●●●●●●●●●●●●●●●
#这里填写工程的目录(Graphics是这个目录的子目录
TO = '请自己填写你的工程目录哦,例子子在上面'
#●●●●●●●●●●●●●●●●
FS = ["","jpeg",".jpg",".png",".bmp",".wav",".mp3",".ogg","mid","wma","mov"]#这里填写需要查找的格式
#==============================================================================
# ■ String
#------------------------------------------------------------------------------
# String 类追加定义。
#==============================================================================
class String
#----------------------------------------------------------------------------
# ● API
#----------------------------------------------------------------------------
@@MultiByteToWideChar = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
@@WideCharToMultiByte = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
#----------------------------------------------------------------------------
# ● UTF-8 转系统编码
#----------------------------------------------------------------------------
def u2s
i = @@MultiByteToWideChar.call(65001, 0 , self, -1, nil,0)
buffer = "\0" * (i*2)
@@MultiByteToWideChar.call(65001, 0 , self, -1, buffer, i)
i = @@WideCharToMultiByte.call(0, 0, buffer, -1, nil, 0, nil, nil)
result = "\0" * i
@@WideCharToMultiByte.call(0, 0, buffer, -1, result, i, nil, nil)
result.chop!
return result
end
end
COPYFILE = Win32API.new("kernel32","CopyFile","ppl","l")
def copyfile(from,to)
from = from.u2s
to = to.u2s
a = 1
if not File.exist?(to)
a = COPYFILE.call(from,to,1)
end
return a
end
class Bitmap
alias saku_init initialize
def initialize*a
if a[0].is_a?(String)
from = RES + a[0]
to = TO+a[0]
l = []
for af in FS
copyfile(from+af,to+af)
l.push(File.exist?((a[0]+af).u2s))
end
a = [32,32] if not l.include?(true)
end
saku_init *a
end
end
module Audio
for word in ["se","me","bgm","bgs"]
eval(
"@saku_#{word} = method('#{word}_play')
def self.#{word}_play*a
from = RES + a[0]
to = TO+a[0]
l = []
for af in FS
copyfile(from+af,to+af)
l.push(File.exist?((a[0]+af).u2s))
end
a = [""] if not l.include?(true)
@saku_#{word}.call *a
end
")
end
end
=begin
说明:
<span style="background-color: rgb(255, 255, 255); ">这个脚本可以在运行时根据需要将文件复制到工程目录下,如果文件找不到还可以忽略文件(缺少图片的话自动变成32*32的空白位图,音效直接变为没有)</span>
<span style="background-color: rgb(255, 255, 255); ">只要把游戏从头到尾彻底测试一遍就可以了呢</span>
2013年2月1日 from 幻想天空 [url]www.rpgsky.net[/url] 作者:克莉丝
=end
#这里填写复制来源(Graphics是这个目录的子目录,注意不能用"\"来表示子目录要用"/"
RES = 'D:/Program Files (x86)/RPG Maker VX Ace/RTP/' #●●●●●●●●●●●●●●●●
#这里填写工程的目录(Graphics是这个目录的子目录
TO = '请自己填写你的工程目录哦,例子子在上面'
#●●●●●●●●●●●●●●●●
FS = ["","jpeg",".jpg",".png",".bmp",".wav",".mp3",".ogg","mid","wma","mov"]#这里填写需要查找的格式
#==============================================================================
# ■ String
#------------------------------------------------------------------------------
# String 类追加定义。
#==============================================================================
class String
#----------------------------------------------------------------------------
# ● API
#----------------------------------------------------------------------------
@@MultiByteToWideChar = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
@@WideCharToMultiByte = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
#----------------------------------------------------------------------------
# ● UTF-8 转系统编码
#----------------------------------------------------------------------------
def u2s
i = @@MultiByteToWideChar.call(65001, 0 , self, -1, nil,0)
buffer = "\0" * (i*2)
@@MultiByteToWideChar.call(65001, 0 , self, -1, buffer, i)
i = @@WideCharToMultiByte.call(0, 0, buffer, -1, nil, 0, nil, nil)
result = "\0" * i
@@WideCharToMultiByte.call(0, 0, buffer, -1, result, i, nil, nil)
result.chop!
return result
end
end
COPYFILE = Win32API.new("kernel32","CopyFile","ppl","l")
def copyfile(from,to)
from = from.u2s
to = to.u2s
a = 1
if not File.exist?(to)
a = COPYFILE.call(from,to,1)
end
return a
end
class Bitmap
alias saku_init initialize
def initialize*a
if a[0].is_a?(String)
from = RES + a[0]
to = TO+a[0]
l = []
for af in FS
copyfile(from+af,to+af)
l.push(File.exist?((a[0]+af).u2s))
end
a = [32,32] if not l.include?(true)
end
saku_init *a
end
end
module Audio
for word in ["se","me","bgm","bgs"]
eval(
"@saku_#{word} = method('#{word}_play')
def self.#{word}_play*a
from = RES + a[0]
to = TO+a[0]
l = []
for af in FS
copyfile(from+af,to+af)
l.push(File.exist?((a[0]+af).u2s))
end
a = [""] if not l.include?(true)
@saku_#{word}.call *a
end
")
end
end