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

Project1

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

[转载发布] RPG MAKER基本鼠标脚本插件,支持VX ACE ——作者:Vlue

[复制链接]

Lv2.观梦者

梦石
0
星屑
439
在线时间
31 小时
注册时间
2020-6-4
帖子
52
跳转到指定楼层
1
发表于 2023-10-1 16:51:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
RPG MAKER编辑器创建新脚本,以下代码放进去保存即可

允许VX ACE鼠标点击走路、右击事件等操作

出处:https://www.rpgmakercentral.com/ ... ouse-system-addons/

RUBY 代码复制
  1. #Basic Mouse System v2.7h
  2. #----------#
  3. #Features: Provides a series of functions to find the current x, y position of
  4. #           the mouse and whether it is being clicked or not (left or right click)
  5. #
  6. #Usage:   Script calls:
  7. #           Mouse.pos?   - returns the x, y position as an array
  8. #           Mouse.lclick?(repeat) - returns if left click is achieved
  9. #                                   repeat = true for repeated checks
  10. #           Mouse.rclick?(repeat) - same as above for right click
  11. #           Mouse.within?(rect) - passes a Rect through to check if cursor
  12. #                                 is within it, returns true if so
  13. #
  14. #         Events:
  15. #          The following are placed in the name of an event:
  16. #          &&  -  event can be triggered from afar by mouse click
  17. #          I:# -  where # is the icon_index to change the cursor on hover
  18. #  
  19. #         Example: I:262
  20. #
  21. #----------#
  22. #-- Script by: V.M of D.T
  23. #
  24. #- Questions or comments can be:
  25. #    posted on the thread for the script
  26. #    given by email: [email protected]
  27. #    provided on facebook: [url]http://www.facebook.com/DaimoniousTailsGames[/url]
  28. #
  29. #--- Free to use in any project, commercial or non-commercial, with credit given
  30. # - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)
  31.  
  32. CPOS = Win32API.new 'user32', 'GetCursorPos', ['p'], 'v'
  33. WINX = Win32API.new 'user32', 'FindWindowEx', ['l','l','p','p'], 'i'
  34. ASKS = Win32API.new 'user32', 'GetAsyncKeyState', ['p'], 'i'
  35. SMET = Win32API.new 'user32', 'GetSystemMetrics', ['i'], 'i'
  36. WREC = Win32API.new 'user32', 'GetWindowRect', ['l','p'], 'v'
  37.  
  38. #MOUSE_ICON, set to the index of the icon to use as a cursor
  39. $mouse_icon = 147
  40. CURSOR_OFFSET_X = 0
  41. CURSOR_OFFSET_Y = 0
  42.  
  43. #Keeps cursor sprite within the game window
  44. MOUSE_KEEP_WINDOW = true
  45.  
  46. #Whether clicking requires cursor to be within window or not
  47. MOUSE_CLICK_WITHIN = false
  48.  
  49. #Whether to use 8 directional movement or not
  50. MOUSE_DIR8 = false
  51.  
  52. #Use the Mouse Button Overlay:
  53. USE_MOUSE_BUTTONS = true
  54. #And here is where you set up your buttons! Simple overlay:
  55. #(Picture files are to be stored in System)
  56. #
  57. # [ x , y, "filename", "script call when left clicked" ]
  58. MOUSE_BUTTONS = [
  59.             [0,416-32,"Shadow.png","SceneManager.call(Scene_Equip)"],
  60.             [32,416-32,"Shadow.png","SceneManager.call(Scene_Item)"], ]
  61.  
  62. SHOWMOUS = Win32API.new 'user32', 'ShowCursor', 'i', 'i'
  63. SHOWMOUS.call(0)
  64.  
  65. #Switch option to enable/disable the script
  66. USE_MOUSE_SWITCH = true
  67. MOUSE_SWITCH = 1
  68.  
  69. module Mouse
  70.   def self.setup
  71.     @enabled = true
  72.     @delay = 0
  73.     bwap = true if SMET.call(23) != 0
  74.     bwap ? @lmb = 0x02 : @lmb = 0x01
  75.     bwap ? @rmb = 0x01 : @rmb = 0x02
  76.   end
  77.   def self.update
  78.     return false unless @enabled
  79.     return false if USE_MOUSE_SWITCH && $game_switches[MOUSE_SWITCH]
  80.     self.setup if @lmb.nil?
  81.     @delay -= 1
  82.     @window_loc = WINX.call(0,0,"RGSS PLAYER",0)
  83.     if ASKS.call(@lmb) == 0 then @l_clicked = false end
  84.     if ASKS.call(@rmb) == 0 then @r_clicked = false end
  85.     rect = '0000000000000000'
  86.     cursor_pos = '00000000'
  87.     WREC.call(@window_loc, rect)
  88.     side, top = rect.unpack("ll")
  89.     CPOS.call(cursor_pos)
  90.     @m_x, @m_y = cursor_pos.unpack("ll")
  91.     w_x = side + SMET.call(5) + SMET.call(45)
  92.     w_y = top + SMET.call(6) + SMET.call(46) + SMET.call(4)
  93.     @m_x -= w_x; @m_y -= w_y
  94.     if MOUSE_KEEP_WINDOW
  95.       @m_x = [[@m_x, 0].max,Graphics.width-5].min
  96.       @m_y = [[@m_y, 0].max,Graphics.height-5].min
  97.     end
  98.     return true
  99.   end
  100.   def self.pos?
  101.     return[-50,-50] unless self.update
  102.     return [@m_x, @m_y]
  103.   end
  104.   def self.lclick?(repeat = false)
  105.     return unless self.update
  106.     return false if @l_clicked
  107.     if ASKS.call(@lmb) != 0 then
  108.       @l_clicked = true if !repeat
  109.       return true end
  110.   end
  111.   def self.rclick?(repeat = false)
  112.     return unless self.update
  113.     return false if @r_clicked
  114.     if ASKS.call(@rmb) != 0 then
  115.       @r_clicked = true if !repeat
  116.       return true end
  117.   end
  118.   def self.slowpeat
  119.     return unless self.update
  120.     return false if @delay > 0
  121.     @delay = 120
  122.     return true
  123.   end
  124.   def self.within?(rect)
  125.     return unless self.update
  126.     return false if @m_x < rect.x or @m_y < rect.y
  127.     bound_x = rect.x + rect.width; bound_y = rect.y + rect.height
  128.     return true if @m_x < bound_x and @m_y < bound_y
  129.     return false
  130.   end
  131.   def self.disable
  132.     @enabled = false
  133.     SHOWMOUS.call(1)
  134.   end
  135.   def self.enable
  136.     @enabled = true
  137.     SHOWMOUS.call(0)
  138.   end
  139. end
  140.  
  141. Mouse.setup
  142.  
  143. module DataManager
  144.   class << self
  145.     alias mouse_init init
  146.   end
  147.   def self.init
  148.     mouse_init
  149.     $cursor = Mouse_Cursor.new
  150.   end
  151. end
  152.  
  153. class Scene_Base
  154.   alias cursor_update update_basic
  155.   def update_basic
  156.     cursor_update
  157.     mouse_cursor
  158.   end
  159.   def mouse_cursor
  160.     pos = Mouse.pos?
  161.     $cursor.x = pos[0] + CURSOR_OFFSET_X
  162.     $cursor.y = pos[1] + CURSOR_OFFSET_Y
  163.   end
  164. end
  165.  
  166. class Mouse_Cursor < Sprite_Base
  167.   def initialize
  168.     super
  169.     @icon = $mouse_icon
  170.     self.bitmap = Bitmap.new(24,24)
  171.     draw_cursor
  172.     self.z = 255
  173.   end
  174.   def set_icon(icon)
  175.     return if @icon == icon
  176.     @icon = icon
  177.     draw_cursor
  178.   end
  179.   def draw_cursor
  180.     self.bitmap.clear
  181.     icon_bitmap = Cache.system("Iconset")
  182.     rect = Rect.new(@icon % 16 * 24, @icon / 16 * 24, 24, 24)
  183.     self.bitmap.blt(0, 0, icon_bitmap, rect)
  184.   end
  185. end
  186.  
  187. class Window_Selectable
  188.   alias mouse_update update
  189.   alias mouse_init initialize
  190.   def initialize(x,y,w,h)
  191.     mouse_init(x,y,w,h)
  192.     @mouse_all_rects = []
  193.     @timer = 0
  194.   end
  195.   def update
  196.     mouse_update
  197.     update_mouse if self.active
  198.   end
  199.   def update_mouse
  200.     @timer -= 1
  201.     @mouse_all_rects = []
  202.     item_max.times {|i|
  203.       rect = item_rect(i)
  204.       rect.x += self.x + standard_padding - self.ox
  205.       rect.y += self.y + standard_padding - self.oy
  206.       if !self.viewport.nil?
  207.         rect.x += self.viewport.rect.x - self.viewport.ox
  208.         rect.y += self.viewport.rect.y - self.viewport.oy
  209.       end
  210.       @mouse_all_rects.push(rect) }
  211.     item_max.times {|i|
  212.       next if @timer > 0
  213.       next unless Mouse.within?(@mouse_all_rects[i])
  214.       @timer = 10 if i > top_row * 2 + page_item_max - 1
  215.       @timer = 10 if i < top_row * 2
  216.       self.index = i }
  217.     process_cancel if Mouse.rclick? && cancel_enabled?
  218.     return if MOUSE_CLICK_WITHIN && !within_index
  219.     process_ok if Mouse.lclick? && ok_enabled?
  220.   end
  221.   def within_index
  222.     item_max.times {|i|
  223.       return true if Mouse.within?(@mouse_all_rects[i]) }
  224.     return false
  225.   end
  226. end
  227.  
  228. class Window_NameInput
  229.   alias mouse_process_handling process_handling
  230.   def process_handling
  231.     mouse_process_handling
  232.     process_back if Mouse.rclick?
  233.   end
  234.   def item_max
  235.     return 90
  236.   end
  237. end
  238.  
  239. class Window_Message < Window_Base
  240.   def input_pause
  241.     self.pause = true
  242.     wait(10)
  243.     Fiber.yield until Input.trigger?(:B) || Input.trigger?(:C) || Mouse.lclick? #if !SceneManager.scene_is?(Scene_Map))
  244.     Input.update
  245.     self.pause = false
  246.   end
  247. end
  248.  
  249. class Scene_File < Scene_MenuBase
  250.   alias mouse_update update
  251.   def update
  252.     mouse_update
  253.     mouse_input
  254.   end
  255.   def mouse_input
  256.     xx = 0
  257.     yy = 56
  258.     width = Graphics.width
  259.     rectcm1 = Rect.new(xx, yy, width, savefile_height)
  260.     rectcm2 = Rect.new(xx, yy + rectcm1.height, width, savefile_height)
  261.     rectcm3 = Rect.new(xx, yy + rectcm1.height * 2, width, savefile_height)
  262.     rectcm4 = Rect.new(xx, yy + rectcm1.height * 3, width, savefile_height)
  263.     rectttl = Rect.new(xx, yy, width, rectcm1.height * 4)
  264.     rectcmA = Rect.new(0, yy - 12, Graphics.width, 24)
  265.     rectcmB = Rect.new(0, Graphics.height - 12, Graphics.width, 24)
  266.     @scroll = self.top_index
  267.     last_index = @index
  268.     @index = (0 + @scroll) if Mouse.within?(rectcm1)
  269.     @index = (1 + @scroll) if Mouse.within?(rectcm2)
  270.     @index = (2 + @scroll) if Mouse.within?(rectcm3)
  271.     @index = (3 + @scroll) if Mouse.within?(rectcm4)
  272.     cursor_down(false) if Mouse.within?(rectcmB) and Mouse.slowpeat
  273.     cursor_up(false) if Mouse.within?(rectcmA) and Mouse.slowpeat
  274.     if @index != last_index
  275.       Sound.play_cursor
  276.       @savefile_windows[last_index].selected = false
  277.       @savefile_windows[@index].selected = true
  278.     end
  279.     on_savefile_ok if Mouse.lclick? and Mouse.within?(rectttl)
  280.     on_savefile_cancel if Mouse.rclick? and Mouse.within?(rectttl)
  281.   end
  282. end
  283.  
  284. class Scene_Gameover
  285.   alias mouse_update update
  286.   def update
  287.     mouse_update
  288.     goto_title if Mouse.lclick? or Mouse.rclick?
  289.   end
  290. end
  291.  
  292. class Game_Player < Game_Character
  293.   alias mouse_move_update update
  294.   def update
  295.     mouse_move_update
  296.     mouse_input
  297.   end
  298.   def mouse_input
  299.     begin      
  300.     return if USE_MOUSE_BUTTONS && SceneManager.scene.mouse_overlay.update
  301.     rescue
  302.     return
  303.     end
  304.     return if !movable? || $game_map.interpreter.running?
  305.     if !Mouse.lclick?(true) then return end
  306.     if moving? then return end
  307.     Graphics.width / 32 % 2 == 0 ? xxx = 16 : xxx = 0
  308.     Graphics.height / 32 % 2 == 0 ? yyy = 16 : yyy = 0
  309.     x = $game_map.display_x + (Mouse.pos?[0] + xxx) / 32
  310.     y = $game_map.display_y + (Mouse.pos?[1] + yyy) / 32
  311.     x -= 0.5 if Graphics.width / 32 % 2 == 0
  312.     y -= 0.5 if Graphics.height / 32 % 2 == 0
  313.     return if start_map_event_mouse(x, y, [0,1,2], false)
  314.     if MOUSE_DIR8
  315.       x = $game_map.display_x * 32 + Mouse.pos?[0]
  316.       y = $game_map.display_y * 32 + Mouse.pos?[1]
  317.       x -= @x * 32 + 16
  318.       y -= @y * 32 + 16
  319.       angle = Math.atan(x.abs/y.abs) * (180 / Math::PI)
  320.       angle = (90 - angle) + 90 if x > 0 && y > 0
  321.       angle += 180 if x < 0 && y > 0
  322.       angle = 90 - angle + 180 + 90 if x < 0 && y < 0
  323.       move_straight(8) if angle >= 337 || angle < 22
  324.       move_diagonal(6,8) if angle >= 22 && angle < 67
  325.       move_straight(6) if angle >= 67 && angle < 112
  326.       move_diagonal(6,2) if angle >= 112 && angle < 157
  327.       move_straight(2) if angle >= 157 && angle < 202
  328.       move_diagonal(4,2) if angle >= 202 && angle < 247
  329.       move_straight(4) if angle >= 247 && angle < 292
  330.       move_diagonal(4,8) if angle >= 292 && angle < 337
  331.     else
  332.       x = $game_map.display_x + Mouse.pos?[0] / 32
  333.       y = $game_map.display_y + Mouse.pos?[1] / 32
  334.       sx = distance_x_from(x)
  335.       sy = distance_y_from(y)
  336.       if sx.abs > sy.abs
  337.         move_straight(sx > 0 ? 4 : 6)
  338.         move_straight(sy > 0 ? 8 : 2) if !@move_succeed && sy != 0
  339.       elsif sy != 0
  340.         move_straight(sy > 0 ? 8 : 2)
  341.         move_straight(sx > 0 ? 4 : 6) if !@move_succeed && sx != 0
  342.       end
  343.     end
  344.   end
  345.   def start_map_event_mouse(x, y, triggers, normal)
  346.     return false if $game_map.interpreter.running?
  347.     $game_map.events_xy(x, y).each do |event|
  348.       next unless event.trigger_from_afar
  349.       if event.trigger_in?(triggers)
  350.         event.start
  351.         return true
  352.       end
  353.     end
  354.     return false
  355.   end
  356. end
  357.  
  358. class Game_Event
  359.   def trigger_from_afar
  360.     return @event.name.include?("&&")
  361.   end
  362.   def mouse_icon?
  363.     @event.name =~ /I:(\d+)/ ? $1.to_i : false
  364.   end
  365. end
  366.  
  367. class Scene_Map
  368.   attr_accessor   :mouse_overlay
  369.   alias mouse_update update
  370.   alias mouse_overlay_init start
  371.   alias mouse_pre_battle pre_battle_scene
  372.   def start(*args)
  373.     mouse_overlay_init(*args)
  374.     @mouse_overlay = Mouse_Overlay.new if USE_MOUSE_BUTTONS
  375.     @last_mouse_x = -1
  376.     @last_mouse_y = -1
  377.   end
  378.   def update
  379.     mouse_update
  380.     mouse_input_events
  381.     update_mouse_icon
  382.   end
  383.   def mouse_input_events
  384.     xx = $game_player.screen_x
  385.     yy = $game_player.screen_y
  386.     xx -= 16;
  387.     recttop = Rect.new(xx - 6, yy - 80, 44, 48)
  388.     rectrit = Rect.new(xx + 32, yy - 36, 48, 44)
  389.     rectbot = Rect.new(xx - 6, yy, 44, 48)
  390.     rectleft = Rect.new(xx - 48, yy - 38, 48, 44)
  391.     mouse_action(8) if Mouse.within?(recttop)
  392.     mouse_action(6) if Mouse.within?(rectrit)
  393.     mouse_action(2) if Mouse.within?(rectbot)
  394.     mouse_action(4) if Mouse.within?(rectleft)
  395.     call_menu if Mouse.rclick? and !$game_map.interpreter.running?
  396.   end
  397.   def update_mouse_icon
  398.     Graphics.width / 32 % 2 == 0 ? xxx = 16 : xxx = 0
  399.     Graphics.height / 32 % 2 == 0 ? yyy = 16 : yyy = 0
  400.     x = $game_map.display_x + (Mouse.pos?[0] + xxx) / 32
  401.     y = $game_map.display_y + (Mouse.pos?[1] + yyy) / 32
  402.     x -= 0.5 if Graphics.width / 32 % 2 == 0
  403.     y -= 0.5 if Graphics.height / 32 % 2 == 0
  404.     return if x == @last_mouse_x && y == @last_mouse_y
  405.     @last_mouse_x = x
  406.     @last_mouse_y = y
  407.     events = $game_map.events_xy(x,y)
  408.     icon = $mouse_icon
  409.     events.each do |event|
  410.       icon = event.mouse_icon? if event.mouse_icon?
  411.     end
  412.     $cursor.set_icon(icon)
  413.   end
  414.   def mouse_action(d)
  415.     return if !Mouse.rclick?(true) || $game_map.interpreter.running?
  416.     $game_player.set_direction(d)
  417.     $game_player.check_action_event
  418.   end
  419.   def pre_battle_scene
  420.     mouse_pre_battle
  421.     @mouse_overlay.dispose
  422.   end
  423. end
  424.  
  425. class Window_NumberInput
  426.   OFS = 12
  427.   WLH = 24
  428.   alias mouse_update update
  429.   def update
  430.     mouse_update
  431.     mouse_input if SceneManager.scene_is?(Scene_Map) and self.active
  432.   end
  433.   def mouse_input
  434.     hold_rect = []
  435.     xx = self.x + OFS
  436.     yy = self.y + OFS
  437.     width = 20
  438.     rectttl = Rect.new(xx, yy, self.contents.width, WLH)
  439.     for i in Range.new(0, @digits_max - 1)
  440.       hold_rect.push(Rect.new(xx, yy, width, WLH))
  441.       xx += width
  442.     end
  443.     for i in Range.new(0, @digits_max - 1)
  444.       @index = i if Mouse.within?(hold_rect[i])
  445.     end
  446.     rectok = Rect.new(xx, yy, 34, 24)
  447.     rectnum = Rect.new(self.x + OFS, yy, @digits_max * 20, WLH)
  448.     self.process_ok if Mouse.within?(rectok) and Mouse.lclick?
  449.     process_mouse_change if Mouse.within?(rectnum)
  450.   end
  451.   def refresh
  452.     contents.clear
  453.     change_color(normal_color)
  454.     s = sprintf("%0*d", @digits_max, @number)
  455.     @digits_max.times do |i|
  456.       rect = item_rect(i)
  457.       rect.x += 1
  458.       draw_text(rect, s[i,1], 1)
  459.     end
  460.     draw_text(self.contents.width - 24, 0, 34, WLH, "OK")
  461.   end
  462.   def update_placement
  463.     self.width = @digits_max * 20 + padding * 2 + 34
  464.     self.height = fitting_height(1)
  465.     self.x = (Graphics.width - width) / 2
  466.     if @message_window.y >= Graphics.height / 2
  467.       self.y = @message_window.y - height - 8
  468.     else
  469.       self.y = @message_window.y + @message_window.height + 8
  470.     end
  471.   end
  472.   def process_mouse_change
  473.     return unless active
  474.     place = 10 ** (@digits_max - 1 - @index)
  475.     n = @number / place % 10
  476.     @number -= n * place
  477.     if Mouse.lclick?
  478.       n = (n + 1) % 10
  479.       Sound.play_cursor
  480.     end
  481.     if Mouse.rclick?
  482.       n = (n + 9) % 10
  483.       Sound.play_cursor
  484.     end
  485.     @number += n * place
  486.     refresh
  487.   end
  488. end
  489.  
  490. class Mouse_Overlay
  491.   def initialize
  492.     @mouse_buttons = []
  493.     MOUSE_BUTTONS.size.times do |i|
  494.       @mouse_buttons[i] = Mouse_Button.new
  495.       @mouse_buttons[i].x = MOUSE_BUTTONS[i][0]
  496.       @mouse_buttons[i].y = MOUSE_BUTTONS[i][1]
  497.       @mouse_buttons[i].bitmap = Bitmap.new("Graphics/System/" + MOUSE_BUTTONS[i][2])
  498.       @mouse_buttons[i].on_lclick = MOUSE_BUTTONS[i][3]
  499.     end
  500.   end
  501.   def update
  502.     @mouse_buttons.size.times do |i| @mouse_buttons[i].update end
  503.     if Mouse.lclick?(true)
  504.       @mouse_buttons.size.times do |i|
  505.         if Mouse.within?(@mouse_buttons[i].current_rect?)
  506.           @mouse_buttons[i].on_lclick_eval
  507.           return true
  508.         end
  509.       end
  510.     end
  511.     return false
  512.   end
  513.   def dispose
  514.     @mouse_buttons.each do |sprite|
  515.       sprite.dispose
  516.     end
  517.   end
  518. end
  519.  
  520. class Mouse_Button < Sprite_Base
  521.   attr_accessor   :on_lclick
  522.   def current_rect?
  523.     Rect.new(x,y,width,height)
  524.   end
  525.   def on_lclick_eval
  526.     eval(on_lclick)
  527.   end
  528. end
  529.  
  530. class Window_Base
  531.   def rect
  532.     Rect.new(self.x,self.y,self.width,self.height)
  533.   end
  534. end
  535.  
  536. class Scene_Options < Scene_MenuBase
  537.   alias mouse_update update
  538.   def update
  539.     mouse_update
  540.     update_mouse
  541.   end
  542.   def update_mouse
  543.     create_rects unless @rects
  544.     @rects.size.times do |i|
  545.       @index = i if Mouse.within?(@rects[i])
  546.     end
  547.     if Mouse.lclick?
  548.       if audio_index(@index)
  549.         x = Mouse.pos?[0]
  550.         return if x < 48+4
  551.         return if x > 48+4+400
  552.         value = (x - 48).to_f / 400
  553.         $game_options.preset_volume(:master, value) if @window_index[@index] == :master
  554.         $game_options.preset_volume(:bgm, value) if @window_index[@index] == :bgm
  555.         $game_options.preset_volume(:se, value) if @window_index[@index] == :se
  556.         @window_masterbar.refresh($game_options.master_volume)
  557.         @window_bgmbar.refresh($game_options.bgm_volume)
  558.         @window_sebar.refresh($game_options.se_volume)
  559.         Sound.play_cursor
  560.         $game_map.autoplay if $game_map && $game_map.map_id > 0
  561.       end
  562.     end
  563.   end
  564.   def create_rects
  565.     @rects = []
  566.     WINDOW_ORDER.each do |sym|
  567.       @rects.push(@window_masterbar.rect) if sym == :master
  568.       @rects.push(@window_bgmbar.rect) if sym == :bgm
  569.       @rects.push(@window_sebar.rect) if sym == :se
  570.       @rects.push(@window_resolution.rect) if sym == :resolution
  571.       @rects.push(@window_message.rect) if sym == :message_se
  572.       @rects.push(@window_switch.rect) if sym == :switch
  573.     end
  574.     @rects.push(@window_command.rect)
  575.   end
  576. end
  577.  
  578. class Window_RecipeConfirm < Window_Selectable
  579.   alias mouse_rec_update update
  580.   def update
  581.     mouse_rec_update
  582.     update_mouse if self.active
  583.   end
  584.   def update_mouse
  585.     @timer -= 1
  586.     @mouse_all_rects = []
  587.     @mouse_all_rects.push(Rect.new(self.x,self.y,self.contents.width*0.85,self.height))
  588.     @mouse_all_rects.push(Rect.new(self.x + self.contents.width*0.85,self.y,self.contents.width*0.25,self.height))
  589.     if Mouse.rclick?
  590.       if Mouse.within?(@mouse_all_rects[1])
  591.         change_amount(-1)
  592.       else
  593.         process_cancel if cancel_enabled?
  594.       end
  595.     elsif Mouse.lclick?
  596.       process_ok if ok_enabled? && Mouse.within?(@mouse_all_rects[0])
  597.       change_amount(1) if Mouse.within?(@mouse_all_rects[1])
  598.     end
  599.   end
  600.   def within_index
  601.     item_max.times {|i|
  602.       return true if Mouse.within?(@mouse_all_rects[i]) }
  603.     return false
  604.   end
  605. end
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-11-22 02:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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