设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2104|回复: 1
打印 上一主题 下一主题

[已经解决] 全键盘密码锁脚本,想ban掉几个键怎么弄

[复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
84 小时
注册时间
2009-1-30
帖子
175
跳转到指定楼层
1
发表于 2014-9-6 22:48:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
想ban掉上下左右键,求大大看看我哪里姿势不对
RUBY 代码复制
  1. #===============================================================================
  2. # +++ MOG - Chain Commands (v1.4) +++
  3. #===============================================================================
  4. # By Moghunter
  5. # [url]http://www.atelier-rgss.com[/url]
  6. #===============================================================================
  7. # 拓展 By 火灰
  8. # (位于 [url]https://rpg.blue[/url])
  9. # 添加了全键盘的支持
  10. #===============================================================================
  11. # Sistema de sequência de botões para ativar switchs.
  12. #
  13. # Serão necessárias as seguintes imagens. (Graphics/System)
  14. #
  15. # Chain_Cursor.png
  16. # Chain_Command.png
  17. # Chain_Layout.png
  18. # Chain_Timer_Layout.png
  19. # Chain_Timer_Meter.png
  20. #
  21. #===============================================================================
  22. #
  23. # Para ativar o script use o comando abaixo.  (*Call Script)
  24. #
  25. # chain_commands(ID)
  26. #
  27. # ID - Id da switch.
  28. #
  29. #===============================================================================
  30. #==============================================================================
  31. # ● Histórico (Version History)
  32. #==============================================================================
  33. # v 1.4 - Correção do crash aleatório.
  34. # v 1.3 - Melhoria no sistema de dispose
  35. # v 1.2 - Melhoria na codificação e correção de alguns glitches.
  36. # v 1.1 - Animação de fade ao sair da cena de chain.
  37. #       - Opção de definir a prioridade da hud na tela.
  38. #==============================================================================
  39. module MOG_CHAIN_COMMANDS
  40.   #============================================================================
  41.   # CHAIN_COMMAND = { SWITCH_ID => [COMMAND] }
  42.   #
  43.   # SWITCH_ID = ID da switch
  44.   # COMMANDS = Defina aqui a sequência de botões.
  45.   #            (Para fazer a sequência use os comandos abaixo)
  46.   #
  47.   # "Down" ,"Up" ,"Left" ,"Right" ,"Shift" ,以及所有其他的英文字母键
  48.   #
  49.   # Exemplo de utilização
  50.   #
  51.   # CHAIN_SWITCH_COMMAND = {
  52.   # 25=>["Down","D","S","Right"],
  53.   # 59=>["Down","Up","Left","Right","Shift","D","S","A","Z","X","Q","W"],
  54.   # 80=>["Shift","D"]
  55.   # }
  56.   #============================================================================
  57.   CHAIN_SWITCH_COMMAND = {
  58.     1 => ["D","O","O","R"],
  59.     12 => ("A".."Z").to_a + %w{Shift Right Left Down Up},
  60.     5  => ["X","Right","Left","Z","Z"],
  61.     7  => ["X","X","X","X","X"],
  62.     6  => ["Left","Right","Left","Right","Left","Right","Q","Z","Up","A","S",
  63.            "Down","D","Z","Right","Up","Up","Z","W","Left","Down","D","A","W"],
  64.     8  => ["Up","Down","Left","Right","Z"],
  65.     9  => ["L","E","F","T"],
  66.     10 => ["R","I","G","H","T"]
  67.                                           #11 => ["L","E","F","T"]
  68.  
  69.   }
  70.   #Duração para colocar os comandos. (A duração é multiplicado pela quantidade
  71.   #de comandos) *60 = 1 sec
  72.   #上面的连击链代表成功输入这些按键后会开启相应的开关
  73.   CHAIN_INPUT_DURATION = 80
  74.   #Som ao acertar.
  75.   CHAIN_RIGHT_SE = "Chime1"
  76.   #Som ao errar.
  77.   CHAIN_WRONG_SE = "Buzzer1"
  78.   #Switch que ativa o modo automático.
  79.   CHAIN_AUTOMATIC_MODE_SWITCH_ID = 20
  80.   #Definição da prioridade da hud na tela
  81.   CHAIN_HUD_Z = 300
  82.   KEYS = {}
  83.   ("A".."Z").each_with_index{|k, i| KEYS[k] = i + 0x41}
  84.   KEYS["SHIFT"] = 0x10; KEYS["LEFT"]  = 0x25; KEYS["RIGHT"] = 0x27
  85.   KEYS["DOWN"]  = 0x28; KEYS["UP"]    = 0x26
  86. end
  87. #===============================================================================
  88. # ■ Chain Commands
  89. #===============================================================================
  90. class Chain_Commands
  91.   include MOG_CHAIN_COMMANDS
  92.   #--------------------------------------------------------------------------
  93.   # ● Initialize
  94.   #--------------------------------------------------------------------------
  95.   def initialize
  96.     @action_id = $game_temp.chain_switch_id
  97.     @chain_command = CHAIN_SWITCH_COMMAND[@action_id]
  98.     @chain_command = ["?"] if @chain_command == nil
  99.     duration = [[CHAIN_INPUT_DURATION, 1].max, 9999].min
  100.     @timer_max = duration * @chain_command.size
  101.     @timer = @timer_max
  102.     @slide_time = [[60 / duration, 10].max, 60].min
  103.     @change_time = 0
  104.     @auto = $game_switches[CHAIN_AUTOMATIC_MODE_SWITCH_ID]
  105.     @com
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● Main
  109.   #--------------------------------------------------------------------------
  110.   def main
  111.     dispose
  112.     @background_sprite = Sprite.new
  113.     @background_sprite.bitmap = SceneManager.background_bitmap2
  114.     create_chain_command
  115.     create_cusrsor
  116.     create_layout
  117.     create_meter
  118.     create_text
  119.     create_number
  120.     Graphics.transition
  121.     loop do
  122.       Graphics.update
  123.       Input.update
  124.       update
  125.       break if SceneManager.scene != self
  126.     end
  127.     dispose
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # ● Create Cursor
  131.   #--------------------------------------------------------------------------
  132.   def create_cusrsor
  133.     @fy_time = 0
  134.     @fy = 0
  135.     @com_index = 0
  136.     @cursor = Sprite.new
  137.     @cursor.bitmap = Cache.system("Chain_Cursor")
  138.     @cursor.z = 4 + CHAIN_HUD_Z
  139.     @cursor_space = ((@bitmap_cw + 5) * @chain_command.size) / 2
  140.     if @chain_command.size <= 20
  141.       @cursor.x = (544 / 2) - @cursor_space + @cursor_space * @com_index
  142.     else
  143.       @cursor.x = (544 / 2)
  144.     end
  145.     @cursor.y = (416 / 2) + 30
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● Create Chain Command
  149.   #--------------------------------------------------------------------------
  150.   def create_chain_command
  151.     @image = Cache.system("Chain_Command")
  152.     width_max = ((@image.width / 32) + 5) * @chain_command.size
  153.     @bitmap = Bitmap.new(width_max,@image.height * 2)
  154.     @bitmap_cw = @image.width / 32
  155.     @bitmap_ch = @image.height
  156.     index = 0
  157.     for i in @chain_command
  158.       command_list_check(i)
  159.       bitmap_src_rect = Rect.new([url=home.php?mod=space&uid=10462]@Com[/url] * @bitmap_cw, 0, @bitmap_cw, @bitmap_ch)
  160.       if index == 0
  161.         @bitmap.blt(index * (@bitmap_cw + 5) , 0, @image, bitmap_src_rect)
  162.       else
  163.         @bitmap.blt(index * (@bitmap_cw + 5) , @bitmap_ch, @image,
  164.         bitmap_src_rect)
  165.       end
  166.       index += 1
  167.     end
  168.     @sprite = Sprite.new
  169.     @sprite.bitmap = @bitmap
  170.     if @chain_command.size <= 15
  171.       @sprite.x = (544 / 2) - ((@bitmap_cw + 5) * @chain_command.size) / 2
  172.       @new_x = 0
  173.     else
  174.       @sprite.x = (544 / 2)
  175.       @new_x = @sprite.x
  176.     end
  177.     @sprite.y = (416 / 2) + 30  - @bitmap_ch  - 15
  178.     @sprite.z = 3 + CHAIN_HUD_Z
  179.     @sprite.zoom_x = 1.5
  180.     @sprite.zoom_y = 1.5
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # * create_layout
  184.   #--------------------------------------------------------------------------
  185.   def create_layout
  186.     @back = Plane.new
  187.     @back.bitmap = Cache.system("Chain_Layout")
  188.     @back.z = 0
  189.     @layout = Sprite.new
  190.     @layout.bitmap = Cache.system("Chain_Timer_Layout")
  191.     @layout.z = 1 + CHAIN_HUD_Z
  192.     @layout.x = 160
  193.     @layout.y = 150
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # * create_meter
  197.   #--------------------------------------------------------------------------
  198.   def create_meter
  199.     @meter_flow = 0
  200.     @meter_image = Cache.system("Chain_Timer_Meter")
  201.     @meter_bitmap = Bitmap.new(@meter_image.width,@meter_image.height)
  202.     @meter_range = @meter_image.width / 3
  203.     @meter_width = @meter_range * @timer / @timer_max
  204.     @meter_height = @meter_image.height
  205.     @meter_src_rect = Rect.new(@meter_range, 0, @meter_width, @meter_height)
  206.     @meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
  207.     @meter_sprite = Sprite.new
  208.     @meter_sprite.bitmap = @meter_bitmap
  209.     @meter_sprite.z = 2 + CHAIN_HUD_Z
  210.     @meter_sprite.x = 220
  211.     @meter_sprite.y = 159
  212.     update_flow
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ● Create Text
  216.   #--------------------------------------------------------------------------
  217.   def create_text
  218.     @text = Sprite.new
  219.     @text.bitmap = Bitmap.new(200,32)
  220.     @text.z = 2 + CHAIN_HUD_Z
  221.     @text.bitmap.font.name = "Georgia"
  222.     @text.bitmap.font.size = 25
  223.     @text.bitmap.font.bold = true
  224.     @text.bitmap.font.italic = true
  225.     @text.bitmap.font.color.set(255, 255, 255,220)
  226.     @text.x = 230
  227.     @text.y = 100
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● Create Number
  231.   #--------------------------------------------------------------------------
  232.   def create_number
  233.     @combo = 0
  234.     @number = Sprite.new
  235.     @number.bitmap = Bitmap.new(200,64)
  236.     @number.z = 2 + CHAIN_HUD_Z
  237.     @number.bitmap.font.name = "Arial"
  238.     @number.bitmap.font.size = 24
  239.     @number.bitmap.font.bold = true
  240.     @number.bitmap.font.color.set(0, 255, 255,200)
  241.     @number.bitmap.draw_text(0, 0, 200, 32, "Ready",1)
  242.     @number.x = 30
  243.     @number.y = 100
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● Pre Dispose
  247.   #--------------------------------------------------------------------------
  248.   def exit
  249.     loop do
  250.       Graphics.update
  251.       @sprite.x += 5
  252.       @layout.x -= 5
  253.       @meter_sprite.x -= 5
  254.       @text.x -= 2
  255.       @text.opacity -= 5
  256.       @sprite.opacity -= 5
  257.       @layout.opacity -= 5
  258.       @meter_sprite.opacity -= 5
  259.       @number.opacity -= 5
  260.       @back.opacity -= 5
  261.       @cursor.visible = false
  262.       break if @sprite.opacity == 0
  263.     end
  264.     SceneManager.call(Scene_Map)
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # ● Dispose
  268.   #--------------------------------------------------------------------------
  269.   def dispose
  270.     return if @layout == nil
  271.     Graphics.freeze
  272.     @background_sprite.bitmap.dispose
  273.     @background_sprite.dispose
  274.     @bitmap.dispose
  275.     @sprite.bitmap.dispose
  276.     @sprite.dispose
  277.     @cursor.bitmap.dispose
  278.     @cursor.dispose
  279.     @meter_image.dispose
  280.     @meter_bitmap.dispose
  281.     @meter_sprite.bitmap.dispose
  282.     @meter_sprite.dispose
  283.     @layout.bitmap.dispose
  284.     @layout.dispose
  285.     @layout = nil
  286.     @back.bitmap.dispose
  287.     @back.dispose
  288.     @text.bitmap.dispose
  289.     @text.dispose
  290.     @number.bitmap.dispose
  291.     @number.dispose
  292.     @image.dispose
  293.   end
  294.   #--------------------------------------------------------------------------
  295.   # ● Update
  296.   #--------------------------------------------------------------------------
  297.   def update
  298.     update_command
  299.     update_cursor_slide
  300.     update_flow
  301.     update_change_time
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ● Change_Time
  305.   #--------------------------------------------------------------------------
  306.   def update_change_time
  307.     return unless @auto
  308.     @change_time += 1
  309.     check_command(-1) if @change_time >= CHAIN_INPUT_DURATION - 1
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ● Update Flow
  313.   #--------------------------------------------------------------------------
  314.   def update_flow
  315.     @timer -= 1
  316.     @meter_sprite.bitmap.clear
  317.     @meter_width = @meter_range * @timer / @timer_max
  318.     @meter_src_rect = Rect.new(@meter_flow, 0, @meter_width, @meter_height)
  319.     @meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
  320.     @meter_flow += 20
  321.     @meter_flow = 0 if @meter_flow >= @meter_image.width - @meter_range
  322.     wrong_command if @timer == 0 and @auto == false
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ● Update Command
  326.   #--------------------------------------------------------------------------
  327.   def update_command
  328.     return if @auto
  329.     KEYS.each{|key,value| check_command(key) if Kboard.trigger?(value)}
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # ● command_list_check
  333.   #--------------------------------------------------------------------------
  334.   def command_list_check(command)
  335.     command.upcase!
  336.     @com = ("A".."Z").to_a.index(command)
  337.     @com ||= 26 + (_ = %w{SHIFT RIGHT LEFT DOWN UP}.index(command)) ? _ : 5
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ● check_command
  341.   #--------------------------------------------------------------------------
  342.   def check_command(com)
  343.     index = 0
  344.     if com != -1
  345.       right_input = false
  346.       for i in @chain_command
  347.         if index == @com_index
  348.           right_input = true if @chain_command[index] == com
  349.         end
  350.         index += 1
  351.       end
  352.     else
  353.       @change_time = 0
  354.       right_input = true
  355.     end
  356.     if right_input
  357.       refresh_number
  358.       next_command
  359.     else
  360.       wrong_command
  361.     end
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ● Next Command
  365.   #--------------------------------------------------------------------------
  366.   def next_command
  367.     @com_index += 1
  368.     Audio.se_play("Audio/SE/" + CHAIN_RIGHT_SE, 100, 100)
  369.     if @com_index == @chain_command.size
  370.       $game_switches[@action_id] = true
  371.       exit
  372.       $game_map.need_refresh = true
  373.     end
  374.     refresh_command
  375.     refresh_text(0)
  376.   end
  377.   #--------------------------------------------------------------------------
  378.   # ● wrong_command
  379.   #--------------------------------------------------------------------------
  380.   def wrong_command
  381.     Audio.se_play("Audio/SE/" + CHAIN_WRONG_SE, 100, 100)
  382.     refresh_text(1)
  383.     exit
  384.     $game_player.jump(0,0)
  385.   end
  386.   #--------------------------------------------------------------------------
  387.   # ● Refresh Command
  388.   #--------------------------------------------------------------------------
  389.   def refresh_command
  390.     @sprite.bitmap.clear
  391.     index = 0
  392.     for i in @chain_command
  393.       command_list_check(i)
  394.       bitmap_src_rect = Rect.new(@com * @bitmap_cw, 0, @bitmap_cw, @bitmap_ch)
  395.       if @com_index == index
  396.         @bitmap.blt(index * (@bitmap_cw + 5) , 0, @image, bitmap_src_rect)
  397.       else
  398.         @bitmap.blt(index * (@bitmap_cw + 5) , @bitmap_ch,
  399.         @image, bitmap_src_rect)
  400.       end
  401.       index += 1
  402.     end
  403.     if @chain_command.size > 15
  404.       @new_x = (544 / 2) - ((@bitmap_cw + 5) * @com_index)
  405.     else
  406.       @cursor.x = (544 / 2) - @cursor_space + ((@bitmap_cw + 5) * @com_index)
  407.     end
  408.   end
  409.   #--------------------------------------------------------------------------
  410.   # ● Refresh Text
  411.   #--------------------------------------------------------------------------
  412.   def refresh_text(type)
  413.     @text.bitmap.clear
  414.     if type == 0
  415.       if @com_index == @chain_command.size
  416.         @text.bitmap.font.color.set(55, 255, 55,220)
  417.         @text.bitmap.draw_text(0, 0, 200, 32, "Perfect!",1)
  418.       else
  419.         @text.bitmap.font.color.set(55, 155, 255,220)
  420.         @text.bitmap.draw_text(0, 0, 200, 32, "Success!",1)
  421.       end
  422.     else
  423.       @text.bitmap.font.color.set(255, 155, 55,220)
  424.       if @timer == 0
  425.         @text.bitmap.draw_text(0, 0, 200, 32, "Time Limit!",1)
  426.       else
  427.         @text.bitmap.draw_text(0, 0, 200, 32, "Fail!",1)
  428.       end
  429.     end
  430.     @text.x = 230
  431.     @text.opacity = 255
  432.   end
  433.   #--------------------------------------------------------------------------
  434.   # ● Refresh Number
  435.   #--------------------------------------------------------------------------
  436.   def refresh_number
  437.     @combo += 1
  438.     @number.bitmap.clear
  439.     @number.bitmap.font.size = 34
  440.     @number.bitmap.draw_text(0, 0, 200, 32, @combo.to_s,1)
  441.     @number.opacity = 255
  442.     @number.zoom_x = 2
  443.     @number.zoom_y = 2
  444.   end
  445.   #--------------------------------------------------------------------------
  446.   # ● Update Cursor Slide
  447.   #--------------------------------------------------------------------------
  448.   def update_cursor_slide
  449.     @sprite.zoom_x -= 0.1 if @sprite.zoom_x > 1
  450.     @sprite.zoom_y -= 0.1 if @sprite.zoom_y > 1
  451.     @text.x -= 2 if @text.x > 210
  452.     @text.opacity -= 5 if @text.opacity > 0
  453.     @sprite.x -= @slide_time if @sprite.x > @new_x and @chain_command.size > 15
  454.     if @number.zoom_x > 1
  455.       @number.zoom_x -= 0.1
  456.       @number.zoom_y -= 0.1
  457.     end
  458.     if @fy_time > 15
  459.       @fy += 1
  460.     elsif @fy_time > 0
  461.       @fy -= 1
  462.     else
  463.       @fy = 0
  464.       @fy_time = 30
  465.     end
  466.     @fy_time -= 1
  467.     @cursor.oy = @fy
  468.   end
  469. end
  470. #==============================================================================
  471. # ■ Game Temp
  472. #==============================================================================
  473. class Game_Temp
  474.   attr_accessor :chain_switch_id
  475.   #--------------------------------------------------------------------------
  476.   # ● Initialize
  477.   #--------------------------------------------------------------------------
  478.   alias mog_chain_commands_initialize initialize
  479.   def initialize
  480.     @chain_switch_id = 0
  481.     mog_chain_commands_initialize
  482.   end
  483. end
  484. #==============================================================================
  485. # ■ Game_Interpreter
  486. #==============================================================================
  487. class Game_Interpreter
  488.   #--------------------------------------------------------------------------
  489.   # ● Chain Commands
  490.   #--------------------------------------------------------------------------
  491.   def chain_commands(switch_id = 0)
  492.     return if switch_id <= 0
  493.     $game_temp.chain_switch_id = switch_id
  494.     SceneManager.call(Chain_Commands)
  495.     wait(1)
  496.   end
  497. end
  498. #===============================================================================
  499. # ■ SceneManager
  500. #===============================================================================
  501. class << SceneManager
  502.   @background_bitmap2 = nil
  503.   #--------------------------------------------------------------------------
  504.   # ● Snapshot For Background2
  505.   #--------------------------------------------------------------------------
  506.   def snapshot_for_background2
  507.     @background_bitmap2.dispose if @background_bitmap2
  508.     @background_bitmap2 = Graphics.snap_to_bitmap
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # ● Background Bitmap2
  512.   #--------------------------------------------------------------------------
  513.   def background_bitmap2
  514.     @background_bitmap2
  515.   end
  516. end
  517. #===============================================================================
  518. # ■ Scene Map
  519. #===============================================================================
  520. class Scene_Map < Scene_Base
  521.   #--------------------------------------------------------------------------
  522.   # ● Terminate
  523.   #--------------------------------------------------------------------------
  524.   alias mog_chain_commands_terminate terminate
  525.   def terminate
  526.     SceneManager.snapshot_for_background2
  527.     mog_chain_commands_terminate
  528.   end
  529. end
  530. $mog_rgss3_chain_commands = true
  531. #============================================================================
  532. # ■ Keyboard Script
  533. #----------------------------------------------------------------------------
  534. #    By: 灼眼的夏娜
  535. #  整理: 火灰
  536. #----------------------------------------------------------------------------
  537. # 本脚本来自 rm.66RPG.com,使用和转载请保留此信息
  538. #==============================================================================
  539. module Kboard
  540.   module_function
  541.   @R_Key_Hash = {}
  542.   @R_Key_Repeat = {}
  543.   GetKeyState = Win32API.new("user32","GetAsyncKeyState",['I'],'I')
  544.   def press?(rkey)
  545.     return GetKeyState.call(rkey) != 0
  546.   end
  547.   def repeat?(rkey)
  548.     result = GetKeyState.call(rkey)
  549.     if result != 0
  550.       if @R_Key_Repeat[rkey].nil?
  551.         @R_Key_Repeat[rkey] = 0
  552.         return true
  553.       end
  554.       @R_Key_Repeat[rkey] += 1
  555.     else
  556.       @R_Key_Repeat[rkey] = nil
  557.       @R_Key_Hash[rkey] = 0
  558.     end
  559.     if !@R_Key_Repeat[rkey].nil? and @R_Key_Repeat[rkey] > 4
  560.       @R_Key_Repeat[rkey] = 0
  561.       return true
  562.     else
  563.       return false
  564.     end
  565.   end
  566.     def trigger?(rkey)
  567.     result = GetKeyState.call(rkey)
  568.     if rkey == 90 and not Input.repeat?(:C)
  569.       @R_Key_Hash[rkey] = 0
  570.       return false
  571.     end
  572.     if rkey == 37 and not Input.repeat?(:LEFT)
  573.       @R_Key_Hash[rkey] = 0
  574.       return false
  575.     end
  576.     if rkey == 38 and not Input.repeat?(:UP)
  577.       @R_Key_Hash[rkey] = 0
  578.       return false
  579.     end
  580.     if rkey == 39 and not Input.repeat?(:RIGHT)
  581.       @R_Key_Hash[rkey] = 0
  582.     end
  583.     if rkey == 40 and not Input.repeat?(:DOWN)
  584.       @R_Key_Hash[rkey] = 0
  585.     end
  586.     if @R_Key_Hash[rkey] == 1 and result != 0
  587.       return false
  588.     end
  589.     if result != 0
  590.       @R_Key_Hash[rkey] = 1
  591.       return true
  592.     else
  593.       @R_Key_Hash[rkey] = 0
  594.       return false
  595.     end
  596.    end
  597. end

Lv1.梦旅人

梦石
0
星屑
55
在线时间
84 小时
注册时间
2009-1-30
帖子
175
2
 楼主| 发表于 2014-9-6 23:40:07 | 只看该作者
好吧我后来自己解决了。。。抱歉哦。。。最后一段替换如下即可
def trigger?(rkey)
    result = GetKeyState.call(rkey)
    if rkey == 90 and not Input.repeat?(:C)
      @R_Key_Hash[rkey] = 0
      return false
  
    elsif rkey == 37 and not Input.repeat?(:LEFT)
      @R_Key_Hash[rkey] = 0
      return false
   
    elsif rkey == 38 and not Input.repeat?(:UP)
      @R_Key_Hash[rkey] = 0
      return false
   
    elsif rkey == 39 and not Input.repeat?(:RIGHT)
      @R_Key_Hash[rkey] = 0
      return false
    elsif rkey == 40 and not Input.repeat?(:DOWN)
      @R_Key_Hash[rkey] = 0
      return false
    end
    if @R_Key_Hash[rkey] == 1 and result != 0
      return false
    end
    if result != 0
      @R_Key_Hash[rkey] = 1
      return true
    else
      @R_Key_Hash[rkey] = 0
      return false
    end
   end
end

点评

你说得对,我应该等待一下  发表于 2014-9-7 08:22
那得把所有玩家可能会用键给ban掉才行,而且万一手残按到其它任何有效按键,在进行密码输入的时候还是会判断错误……我觉得这不是解决办法  发表于 2014-9-7 00:48
我之前就在怀疑是不是因为这个才导致的……话说我有看一些类似QTE系统里都有提到要做一定等待之类来避免这样的错误。  发表于 2014-9-7 00:23
嗯,就是ban掉了z,上下左右,这几个会在触发事件时也被判定为输入字母。。。那就必错了(除非第一个字母是Z)  发表于 2014-9-7 00:20
话说关于第一次必错的问题你解决了么。  发表于 2014-9-6 23:59
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-2-22 02:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表