查看: 2643|回复: 1

[已经过期] 如何实现按下F12暂停?

[复制链接]

送快递的水表员

梦石
10
星屑
5259
在线时间
3304 小时
注册时间
2012-6-27
回帖
7028

开拓者贵宾

发表于 2015-3-29 15:29:23 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
这样……因为游戏全程无菜单,所以希望能实现F12键暂停游戏同时显示一张图片的功能。
目前F12因为用了容错脚本所以会报错。

容错脚本:
[pre lang="ruby"]#==============================================================================
# ■ 容错脚本第3版                                              BY 轮回者
#------------------------------------------------------------------------------
#  本脚本基于星大叔的容错脚本第2版,区别只是“下手”的地方不同而已。
#  说明请参看星大叔的容错脚本第2版。
#==============================================================================

$need_file_bitmap = []
if FileTest.exist?("log_bitmap.txt")
f = File.open("./log_bitmap.txt","r")
$need_file_bitmap = f.read.split(/\n/)
f.close
end

module Graphics
@transition = method("transition")
def self.transition(*arg)
   begin
     @transition.call(*arg)
   rescue Errno::ENOENT
     ary=[*arg]
     filename=ary[1]
     unless $need_file_bitmap.include?(filename)
       $need_file_bitmap.push(filename)
       f = File.open("./log_bitmap.txt","a")
       f.write(filename + "\n")
       f.close
     end
     @transition.call(ary[0])
   end
end
end

class Bitmap < Object
alias ini initialize
def initialize(*arg)
   begin
     ini(*arg)
   rescue Errno::ENOENT
     filename=[*arg][0]
     unless $need_file_bitmap.include?(filename)
       $need_file_bitmap.push(filename)
       f = File.open("./log_bitmap.txt","a")
       f.write(filename + "\n")
       f.close
     end
     ini(32,32)
   end
end
end

$need_file_audio = []
if FileTest.exist?("log_audio.txt")
f = File.open("./log_audio.txt","r")
$need_file_audio = f.read.split(/\n/)
f.close
end

module Audio
@me_play = method("me_play")
def self.me_play(*arg)
   begin
     @me_play.call(*arg)
   rescue Errno::ENOENT
     filename=[*arg][0]
     unless $need_file_audio.include?(filename)
       $need_file_audio.push(filename)
       f = File.open("./log_audio.txt","a")
       f.write(filename + "\n")
       f.close
     end
     me_stop
   end
end
@bgm_play = method("bgm_play")
def self.bgm_play(*arg)
   begin
     @bgm_play.call(*arg)
   rescue Errno::ENOENT
     filename=[*arg][0]
     unless $need_file_audio.include?(filename)
       $need_file_audio.push(filename)
       f = File.open("./log_audio.txt","a")
       f.write(filename + "\n")
       f.close
     end
     bgm_stop
   end
end
@se_play = method("se_play")
def self.se_play(*arg)
   begin
     @se_play.call(*arg)
   rescue Errno::ENOENT
     filename=[*arg][0]
     unless $need_file_audio.include?(filename)
       $need_file_audio.push(filename)
       f = File.open("./log_audio.txt","a")
       f.write(filename + "\n")
       f.close
     end
     se_stop
   end
end
@bgs_play = method("bgs_play")
def self.bgs_play(*arg)
   begin
     @bgs_play.call(*arg)
   rescue Errno::ENOENT
     filename=[*arg][0]
     unless $need_file_audio.include?(filename)
       $need_file_audio.push(filename)
       f = File.open("./log_audio.txt","a")
       f.write(filename + "\n")
       f.close
     end
     bgs_stop
   end
end
end[/pre]

精灵族の天使<

梦石
0
星屑
1712
在线时间
3039 小时
注册时间
2007-3-16
回帖
33092

开拓者贵宾

发表于 2015-3-31 16:49:56 | 显示全部楼层
容错脚本是测试的时候检查用的,正式发布的时候就可以直接注释了。
F12暂停这个你可以注释掉,正式的时候再启用
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部