本帖最后由 taroxd 于 2014-3-29 16:07 编辑
勉强解决了一下,缺点是按小键盘的2468时,默认的Input模块的方法都会false,也就是按住2468时方向键也会失灵
这个缺点是可以修复的,只是会更麻烦一点。这里我懒得修复了=。=
以下脚本未经测试
class << Input def numpad_press? [0x62, 0x64, 0x66, 0x68].any? {|key| Kboard.keyb(key) } end alias press_with_numpad? press? def press?(sym) !numpad_press? && press_with_numpad?(sym) end alias trigger_with_numpad? trigger? def trigger?(sym) !numpad_press? && trigger_with_numpad?(sym) end alias repeat_with_numpad? repeat? def repeat?(sym) !numpad_press? && repeat_with_numpad?(sym) end alias dir4_with_numpad dir4 def dir4 numpad_press? ? 0 : dir4_with_numpad end alias dir8_with_numpad dir8 def dir8 numpad_press? ? 0 : dir8_with_numpad end end
class << Input
def numpad_press?
[0x62, 0x64, 0x66, 0x68].any? {|key| Kboard.keyb(key) }
end
alias press_with_numpad? press?
def press?(sym)
!numpad_press? && press_with_numpad?(sym)
end
alias trigger_with_numpad? trigger?
def trigger?(sym)
!numpad_press? && trigger_with_numpad?(sym)
end
alias repeat_with_numpad? repeat?
def repeat?(sym)
!numpad_press? && repeat_with_numpad?(sym)
end
alias dir4_with_numpad dir4
def dir4
numpad_press? ? 0 : dir4_with_numpad
end
alias dir8_with_numpad dir8
def dir8
numpad_press? ? 0 : dir8_with_numpad
end
end
|