赞 | 5 |
VIP | 464 |
好人卡 | 4 |
积分 | 4 |
经验 | 14189 |
最后登录 | 2020-6-13 |
在线时间 | 972 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 408
- 在线时间
- 972 小时
- 注册时间
- 2007-12-31
- 帖子
- 2137
|
容错脚本第2版- #==============================================================================
- # ■ 容错脚本第2版 BY 亿万星辰
- #------------------------------------------------------------------------------
- # 道理很简单,缺什么就不用什么……全缺的话会比较恐怖,比如默认的范例就是……
- # 不过这里要声明的一点,这个只针对素材的缺失,如果data文件夹下的数据缺失的话,
- # 这样再用容错似乎没什么意义…… (数据库都没了还容什么错……)
- #
- # 下一版本考虑增加一些替代用的素材。
- #
- # 默认范例为新建工程时生成的默认地图……只是RTP没选而已。
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # ● 演奏 BGM
- # bgm : 演奏的 BGM
- #--------------------------------------------------------------------------
- def bgm_play(bgm)
- @playing_bgm = bgm
- begin
- if bgm != nil and bgm.name != ""
- Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch)
- else
- Audio.bgm_stop
- end
- rescue Errno::ENOENT
- Audio.bgm_stop
- unless $need_file.include?("Audio/BGM/#{bgm.name}")
- $need_file.push("Audio/BGM/#{bgm.name}")
- f = File.open("./log.txt","a")
- f.write("Audio/BGM/#{bgm.name}" + "\n")
- f.close
- end
- end
- Graphics.frame_reset
- end
- #--------------------------------------------------------------------------
- # ● 演奏 BGS
- # bgs : 演奏的 BGS
- #--------------------------------------------------------------------------
- def bgs_play(bgs)
- @playing_bgs = bgs
- begin
- if bgs != nil and bgs.name != ""
- Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume, bgs.pitch)
- else
- Audio.bgs_stop
- end
- rescue Errno::ENOENT
- Audio.bgs_stop
- unless $need_file.include?("Audio/BGM/#{bgs.name}")
- $need_file.push("Audio/BGM/#{bgs.name}")
- f = File.open("./log.txt","a")
- f.write("Audio/BGM/#{bgs.name}" + "\n")
- f.close
- end
- end
- Graphics.frame_reset
- end
- #--------------------------------------------------------------------------
- # ● ME 的演奏
- # me : 演奏的 ME
- #--------------------------------------------------------------------------
- def me_play(me)
- begin
- if me != nil and me.name != ""
- Audio.me_play("Audio/ME/" + me.name, me.volume, me.pitch)
- else
- Audio.me_stop
- end
- rescue Errno::ENOENT
- Audio.me_stop
- unless $need_file.include?("Audio/BGM/#{me.name}")
- $need_file.push("Audio/BGM/#{me.name}")
- f = File.open("./log.txt","a")
- f.write("Audio/BGM/#{me.name}" + "\n")
- f.close
- end
- end
- Graphics.frame_reset
- end
- #--------------------------------------------------------------------------
- # ● SE 的演奏
- # se : 演奏的 SE
- #--------------------------------------------------------------------------
- def se_play(se)
- begin
- if se != nil and se.name != ""
- Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
- end
- rescue Errno::ENOENT
- Audio.se_stop
- unless $need_file.include?("Audio/BGM/#{se.name}")
- $need_file.push("Audio/BGM/#{se.name}")
- f = File.open("./log.txt","a")
- f.write("Audio/BGM/#{se.name}" + "\n")
- f.close
- end
- end
- end
- end
- module RPG
- module Cache
- def self.load_bitmap(folder_name, filename, hue = 0)
- begin
- path = folder_name + filename
- if not @cache.include?(path) or @cache[path].disposed?
- if filename != ""
- @cache[path] = Bitmap.new(path)
- else
- @cache[path] = Bitmap.new(32, 32)
- end
- end
- if hue == 0
- @cache[path]
- else
- key = [path, hue]
- if not @cache.include?(key) or @cache[key].disposed?
- @cache[key] = @cache[path].clone
- @cache[key].hue_change(hue)
- end
- @cache[key]
- end
- rescue Errno::ENOENT
- unless $need_file.include?("#{folder_name}#{filename}")
- $need_file.push("#{folder_name}#{filename}")
- f = File.open("./log.txt","a")
- f.write("#{folder_name}#{filename}" + "\n")
- f.close
- end
- self.load_bitmap(folder_name, "", hue)
- end
- end
- end
- end
复制代码 容错脚本第3版 |
评分
-
查看全部评分
|