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

Project1

 找回密码
 注册会员
搜索
查看: 2899|回复: 4

[RMVA发布] 【自来水搬运工】鼠标脚本控制

[复制链接]

Lv1.梦旅人

梦石
0
星屑
20
在线时间
106 小时
注册时间
2016-6-7
帖子
10
发表于 2017-3-25 10:51:40 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 kk1248659626 于 2018-12-20 12:03 编辑



http://www.ytmp3.cn/down/34902.mp3







0181220115851.png

鼠标控制.zip

1.6 MB, 下载次数: 259

233

评分

参与人数 1+1 收起 理由
游戏解说小汪 + 1 塞糖

查看全部评分

Lv1.梦旅人

梦石
0
星屑
20
在线时间
106 小时
注册时间
2016-6-7
帖子
10
 楼主| 发表于 2017-3-25 10:54:56 | 显示全部楼层
本帖最后由 kk1248659626 于 2018-12-20 12:01 编辑

{:2_258:} 【二楼打表处】

修改图标位置:

1

1



2

2


回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
20
在线时间
106 小时
注册时间
2016-6-7
帖子
10
 楼主| 发表于 2017-3-25 11:08:39 | 显示全部楼层
本帖最后由 kk1248659626 于 2018-12-20 12:01 编辑

{:2_279:}【三楼卖萌处】

【红点鼠标图标】

MouseCursor.png

赠送

赠送
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
20
在线时间
106 小时
注册时间
2016-6-7
帖子
10
 楼主| 发表于 2017-12-8 00:11:25 | 显示全部楼层
本帖最后由 kk1248659626 于 2018-12-20 12:02 编辑

RUBY 代码复制
  1. [attach]325593[/attach]
  2. -------------------------------------------------------------------
  3. #encoding:utf-8
  4. # 基础鼠标模组 v3.02  (2014/2/15)
  5. # ·需· SiNova_Input v1.00+
  6.  
  7. # v3.02 添加方法,以便兼容以前写的脚本
  8.  
  9. # 鼠标指针图片 MouseCursor.png 放入 Graphics\System 文件夹
  10.  
  11.  
  12.  
  13.  
  14.  
  15. module Mouse end
  16. class << Mouse
  17. DK_Frame = 15 # 判断双击间隔帧数
  18. attr_reader\
  19. :dk_count
  20.  
  21.   GetMousePos = API_.new 'SiNova|GetMousePos|p|v'
  22.   SetMousePos = API_.new 'SiNova|SetMousePos|II|v'
  23.   MouseZ      = API_.new 'SiNova|MouseZ|v|i'
  24.   MouseZReset = API_.new 'SiNova|MouseZReset|v|v'
  25.  
  26.  
  27.   def activate(vp = nil)
  28.     @buf = [0, 0].pack("ii")
  29.     @ck_count = 0
  30.     @dk_count = 0
  31.     hide_system_cursor
  32.     create_cursor(vp)
  33.   end
  34.   def update
  35.     update_cursor
  36.     update_mouse_lock
  37.     update_mouse_scroll
  38.     update_double_click
  39.   end
  40.   def deactivate
  41.     show_system_cursor
  42.     dispose_cursor
  43.   end
  44.  
  45.  
  46.   def create_cursor(vp)
  47.     dispose_cursor if @sprite
  48.     @sprite = Sprite.new(vp)
  49.     @sprite.z = 9999
  50.     if File.exist?('Graphics/System/MouseCursor.png')
  51.       @sprite.bitmap = Cache.system('MouseCursor')
  52.     else
  53.       @sprite.bitmap = Bitmap.new(24, 24)
  54.       @sprite.bitmap.blt(0, 0, Cache.system('Iconset'),
  55.         Rect.new(5 * 24, 24 * 24, 24, 24))
  56.     end
  57.     update_cursor
  58.   end
  59.   def dispose_cursor
  60.     return if @sprite.disposed?
  61.     @sprite.bitmap.dispose
  62.     @sprite.dispose
  63.     update
  64.   end
  65.  
  66.   #
  67.   def x
  68.     @sprite.x
  69.   end
  70.   def y
  71.     @sprite.y
  72.   end
  73.   def z
  74.     MouseZ.call
  75.   end
  76.   def reset_z
  77.     MouseZReset.call
  78.   end
  79.  
  80.   # 3.01 new --
  81.   def press?(sym)
  82.     case sym
  83.     when :L; Input.key_press? 0x01
  84.     when :R; Input.key_press? 0x02
  85.     when :M; Input.key_press? 0x05
  86.     end
  87.   end
  88.   def trigger?(sym)
  89.     case sym
  90.     when :L; Input.key_trigger? 0x01
  91.     when :R; Input.key_trigger? 0x02
  92.     when :M; Input.key_trigger? 0x05
  93.     end
  94.   end
  95.   def repeat?(sym)
  96.     case sym
  97.     when :L; Input.key_repeat? 0x01
  98.     when :R; Input.key_repeat? 0x02
  99.     when :M; Input.key_repeat? 0x05
  100.     end
  101.   end
  102.   #--
  103.  
  104.   def update_cursor
  105.     GetMousePos.call @buf
  106.     @sprite.x, @sprite.y = *@buf.unpack("ii")
  107.   end
  108.   def update_mouse_scroll
  109.     @mouseZ
  110.   end
  111.   #
  112.   def update_double_click
  113.     if Input.key_trigger?(0x01)
  114.       if @dk_count <= DK_Frame
  115.         @dk_count = DK_Frame
  116.         @double_click = true
  117.       else # 非双击,重置 dk_count
  118.         @dk_count = 0
  119.         @double_click = false
  120.       end
  121.     else
  122.       @double_click = false
  123.     end
  124.     @dk_count += 1
  125.   end
  126.   def double_click?
  127.     @double_click
  128.   end
  129.   #
  130.   def update_mouse_lock # press Alt + L 锁定 Alt + O 解除锁定
  131.     if Input.key_press?(0x12)
  132.       return lock   if Input.key_trigger?(0x4C)
  133.       return unlock if Input.key_trigger?(0x4F)
  134.     end
  135.   end
  136.   #
  137.   def lock
  138.     API_.call 'SiNova|MouseLock|v|v'
  139.   end
  140.   def unlock
  141.     API_.call 'SiNova|MouseUnLock|v|v'
  142.   end
  143.   def show_system_cursor
  144.     api_sc = API_.new 'User32|ShowCursor|p|l'
  145.     begin state = api_sc.call(1) end while state < 0
  146.   end
  147.   def hide_system_cursor
  148.     api_sc = API_.new 'User32|ShowCursor|p|l'
  149.     begin state = api_sc.call(0) end while state >= 0
  150.   end
  151.   def set_pos(x, y)
  152.     SetMousePos.call(x, y)
  153.   end
  154. end
  155.  
  156. if $SINOVA #验证组件完整性
  157.   if $SINOVA[:input]
  158.     if $SINOVA[:input] >= 1.00   #所需组件版本
  159.       $SINOVA[:mouseBase] = 3.02 #当前组件版本
  160.     else
  161.       msgbox "SiNova_Input 版本过低,需 1.00 以上"
  162.       exit
  163.     end
  164.   else
  165.     msgbox "Nova_TypeIn 需置于 SiNova_Input 脚本之下"
  166.     exit
  167.   end
  168. else
  169.   msgbox "Nova_TypeIn 需置于 NovaBase 脚本之下"
  170.   exit
  171. end
  172.  
  173. ----------------------------------------------------------------------------------



回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
647
在线时间
7 小时
注册时间
2014-7-24
帖子
6
发表于 2020-2-25 20:57:51 | 显示全部楼层
不能响应事件
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-28 21:25

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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