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

Project1

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

[已经过期] 求一个鼠标点击事件的脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
96 小时
注册时间
2012-12-28
帖子
74
跳转到指定楼层
1
发表于 2013-1-9 17:50:20 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 qingfengjian 于 2013-1-9 17:53 编辑

搜索了全站,只有鼠标脚步,但是没有鼠标点击事件的脚本,悬赏5vip求高手给一个,本人QQ:278586640,加好友的时候注明“脚本”,谢谢!
要求:全程鼠标操作,最好是鼠标点击事件图片的同时有音效

Lv1.梦旅人

梦石
0
星屑
50
在线时间
616 小时
注册时间
2010-10-29
帖子
463
2
发表于 2013-1-11 05:12:01 | 只看该作者
http://www.rpgmakervxace.net/top ... -buttons-update-15/
我会尽量发电子邮件给你,弹指一挥间。
我命令你给我点下面的东西!

LBQ Works
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
38 小时
注册时间
2010-9-4
帖子
43
3
发表于 2013-1-11 14:17:00 | 只看该作者
点击事件吗...你说的是不是可以点击和NPC对话之类的吗?.我发你邮箱你看看是不是吧- -
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
96 小时
注册时间
2012-12-28
帖子
74
4
 楼主| 发表于 2013-1-11 18:44:40 | 只看该作者
srg123 发表于 2013-1-11 14:17
点击事件吗...你说的是不是可以点击和NPC对话之类的吗?.我发你邮箱你看看是不是吧- -  ...

我要做的是事件按钮,点击后,可以是和npc对话,也可以是跳转场景之类的,能加我QQ吗?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
119 小时
注册时间
2012-10-19
帖子
144
5
发表于 2013-1-11 21:22:35 | 只看该作者
本帖最后由 664299301 于 2013-1-11 21:23 编辑

RUBY 代码复制
  1. #下面可修改([]中为通常的样子):
  2. 合成方式 = 0  
  3. #@blend_tepe【1  】:0~2
  4. 透明速度 = 10
  5. #[url=home.php?mod=space&uid=316553]@opacity[/url]   【10 】:0~255
  6. 下降速度 = 1  
  7. #@jy        【1  】:0~50
  8. X放大率  = 0.1
  9. #@zoom_x    【0.1 or -0.03】:-1~1
  10. Y放大率  = 0.1
  11. #@zoom_y    【0.1 or -0.03】:-1~1
  12. 残影     = true
  13. #shadow 【true / false】
  14. 残光     = false
  15. #show_light 【true / false】
  16. 旋转     = false
  17. #angle   【true、false】
  18. 动态     = true#true
  19. #anima   【true、false】
  20. #由于残光会建立94个图像,内存低就把show_light 给false掉吧~~
  21. #加入鼠标转向专利一个~~我是仿windows显示时间屏保的鼠标制作的~~
  22. #是关于Math的算法,不是只有8方向,而是360个= =!!~
  23. #把【85】行去掉“#”就会掉many FPS 不过很华丽~~(注:先开启旋转,残光功能!)
  24. #-----------------------------------分割线--------------------------------------
  25. #如果需要在游戏中调用修改鼠标各项设置:见204行处的方法调用,不需要改变的量用nil
  26. #表示!
  27. #==============================================================================
  28. module Mouse  
  29.   attr_accessor :count                     #变换动画计数
  30. attr_accessor :npc                       #指向NPC
  31. attr_accessor :wait                      #指针变成角色正在移动
  32. attr_accessor :enemy                     #指针指向敌人
  33. attr_accessor :coach                     #coach icons switch
  34. #======================================================
  35. #change icon!
  36. #======================================================
  37.   def self.npc
  38.     if [url=home.php?mod=space&uid=113826]@NPC[/url] != true
  39.     @count = 10
  40.     [url=home.php?mod=space&uid=113826]@NPC[/url] = true
  41.     end
  42.   end
  43.   def self.wait
  44.     if [url=home.php?mod=space&uid=36110]@Wait[/url] != true
  45.     @count = 10
  46.     [url=home.php?mod=space&uid=36110]@Wait[/url] = true
  47.     end
  48.   end
  49.   def self.enemy
  50.     if @enemy != true
  51.     @count = 10
  52.     @enemy = true
  53.     end
  54.   end
  55.   def self.coach
  56.     if [url=home.php?mod=space&uid=288325]@COACH[/url] != true
  57.       @count = 10
  58.       [url=home.php?mod=space&uid=288325]@COACH[/url] = true
  59.     end
  60.   end
  61. #======================================================
  62. #end
  63. #======================================================
  64.   def self.text
  65.  
  66.   end
  67.   def self.into_menu
  68.     Sound.play_ok
  69.     SceneManager.call(Scene_Menu)
  70.     Window_MenuCommand::init_command_position
  71.   end
  72.   def self.init2
  73.     #Directions
  74.     @dir = 0
  75.     @old_x, @old_y = 0, 0
  76.     #Animations
  77.     @light_id = 1
  78.     @mouse_sprite1 = Sprite.new;
  79.     @mouse_sprite1.z = 9999;
  80.     @mouse_sprite1.bitmap = Bitmap.new("Graphics/Icons/#{@light_id}");
  81.     @light_id = 1
  82.     @canyin = []
  83.     @rmenu = nil#右键菜单
  84.     @rightmenu = false
  85.     @mouse_touch = false
  86.     @count = 0
  87.     @npc,@wait,@coach = false
  88.   end
  89.   def self.setbb(a,b,c,d,e,f,g,h,i)
  90.     @blend_tepe = a if a != nil
  91.     @opacity    = b if b != nil   
  92.     @jy         = c if c != nil        
  93.     @zoom_x     = d if d != nil   
  94.     @zoom_y     = e if e != nil   
  95.     [url=home.php?mod=space&uid=22469]@light[/url]      = f if f != nil     
  96.     [url=home.php?mod=space&uid=31758]@Shadow[/url]     = g if g != nil   
  97.     [url=home.php?mod=space&uid=124954]@Angle[/url]      = h if h != nil     
  98.     @anima      = i if i != nil     
  99.   end
  100.   def self.show_light(mx, my)
  101.     @canyin.each{|s|s.opacity <= 0 ? (s.visible = false ; @canyin.delete(s)) : s.opacity -= 25}
  102.     if @light
  103.     @light_id < 94 ? @light_id += 1 : @light_id = 1
  104.     i = @light_id
  105.     eval("@mouse_sprite#{i} = Sprite.new")
  106.     eval("@mouse_sprite#{i}.x = #{mx}")
  107.     eval("@mouse_sprite#{i}").y = my
  108.     eval("@mouse_sprite#{i}").blend_type = @blend_tepe
  109.     eval("@mouse_sprite#{i}").z = 9999;
  110.    #eval("@mouse_sprite#{i}").angle = @mouse_sprite.angle
  111.     eval("@mouse_sprite#{i}").bitmap = Bitmap.new("Graphics/Icons/#{@light_id}")
  112.     for i in 1..94
  113.       begin
  114.       eval("@mouse_sprite#{i}").opacity -= @opacity #10
  115.       eval("@mouse_sprite#{i}").y += @jy#1
  116.       eval("@mouse_sprite#{i}").zoom_x += @zoom_x#0.105
  117.       eval("@mouse_sprite#{i}").zoom_y += @zoom_y#0.105
  118.       eval("@mouse_sprite#{i}").dispose if eval("@mouse_sprite#{i}").opacity <= 0
  119.       rescue
  120.       end
  121.     end
  122.     if @plight == true
  123.       self.update_light
  124.     end
  125.     end
  126.     return if !@angle
  127.     a = 0
  128.     #被废掉的朝向
  129.     hu = [(@old_x - mx), (@old_y - my)]
  130.  
  131.     return if hu[0] == 0 or hu[1] == 0
  132.     math = 135 - self.atoa(Math.atan(hu[1]/hu[0]))
  133.     if hu[0] > 0
  134.       @mouse_sprite.angle = math - 90
  135.     else
  136.       @mouse_sprite.angle = math + 90
  137.     end
  138.     #p math
  139.     @old_x, @old_y = mx, my
  140.  
  141.  
  142.   end
  143.   def self.plight
  144.     return unless @light
  145.     @l = Sprite.new
  146.     @l.z = 999999
  147.     @pcount = 30
  148.     @l.blend_type = 1
  149.     @l.bitmap = Bitmap.new("Graphics/Icons/#{@pcount}");
  150.     @l.ox = @l.bitmap.width / 2
  151.     @l.oy = @l.bitmap.height / 2
  152.     @l.x, @l.y = @mouse_sprite.x, @mouse_sprite.y
  153.     @plight = true
  154.  
  155.   end
  156.   def self.update_light
  157.     @pcount += 1
  158.     @l.bitmap = Bitmap.new("Graphics/Icons/#{@pcount}")
  159.     @l.zoom_x += 0.1
  160.     @l.zoom_y += 0.1
  161.     @l.opacity -= 10
  162.     if @pcount >= 70
  163.       @l.dispose
  164.       @pcount = 0
  165.       @plight = false
  166.     end
  167.   end
  168.   def self.atoa(hu)#弧度转角度
  169.     return (hu * 180) / Math::PI
  170.     #
  171.   end
  172. #==============================================================================
  173. #New Part!
  174. #==============================================================================
  175.   def self.moving(x,y)
  176.     return if ![url=home.php?mod=space&uid=31758]@Shadow[/url] == true
  177.     sprite = Sprite.new
  178.     sprite.z = 999
  179.     sprite.bitmap = @mouse_sprite.bitmap if !@mouse_sprite.disposed?#Bitmap.new("Graphics/Mouse/1.png")
  180.     sprite.x = x
  181.     sprite.y = y
  182.     sprite.opacity = 200
  183.     sprite.angle = @mouse_sprite.angle
  184.     @canyin.push sprite
  185.   end
  186.   def self.canyin
  187.     return @canyin.size
  188.   end
  189.   def self.right_menu(x,y)
  190.  
  191.     @rmenu.dispose if @rmenu != nil
  192.     @rmenu = Sprite.new
  193.     @rmenu.z = 1000
  194.  
  195. #    @rmenu.bitmap.fill_rect(0, 0, 150, 32*n, Color.new(255,255,255))
  196. #    @rmenu.bitmap.font.color = Color.new(68,34,255)
  197. #    n.times{|i|
  198. #    @rmenu.bitmap.fill_rect(0, i*32, 150, 1, Color.new(0,0,0))
  199. #    @rmenu.bitmap.draw_text(0, i*32, 150, 32,text[i][0])
  200.  
  201. #    }
  202.     @rmenu.x,@rmenu.y = x,y
  203.     @rmenu.opacity = 200
  204.     @rightmenu = true
  205.   end
  206.   def self.mouse_touch=(bar)
  207.     @mouse_touch = bar
  208.   end
  209.   def self.mouse_touch
  210.     return @mouse_touch
  211.   end
  212.   def self.check
  213.     if Mouse.trigger?(Mouse::LEFT)
  214.     if @rightmenu
  215.       mx,my = Mouse.get_mouse_pos
  216.       lx = @rmenu.x - @rmenu.ox
  217.       rx = lx + @rmenu.bitmap.width
  218.       ty = @rmenu.y - @rmenu.oy
  219.       by = ty + @rmenu.bitmap.height
  220.       if mx < lx or mx > rx or my < ty or my > by or
  221.         @rmenu.bitmap.get_pixel(mx-lx,my-ty).alpha == 0
  222.  
  223.       else
  224.         a = []
  225.         text.size.times{|t|a << [t*32 , ([email]my-@rmenu.y[/email]).abs].min}
  226.         eval(text[(a.max/32).to_i][1])
  227.       end
  228.       @rightmenu = false
  229.       @rmenu.dispose
  230.         @rmenu = nil
  231.         return
  232.     end
  233.     end
  234.   end      
  235. end
  236. Mouse.init2
  237. Mouse.setbb(合成方式,
  238. 透明速度,
  239. 下降速度,
  240. X放大率,
  241. Y放大率,残光,残影,旋转,动态)

目测那个脚本在VA貌似没什么问题。
毕竟原创不是我,加上个素材加在Graphics/Mouse/...
望采纳。 (原创的链接:http://rpg.blue/forum.php?mod=viewthread&tid=247817

Mouse.7z

41.14 KB, 下载次数: 45

加上去吧,不加不知道能不能用。

点击下面的文字
论坛
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
96 小时
注册时间
2012-12-28
帖子
74
6
 楼主| 发表于 2013-1-11 21:26:22 | 只看该作者
664299301 发表于 2013-1-11 21:22
#下面可修改([]中为通常的样子):
合成方式 = 0  
#@blend_tepe【1  】:0~2

现在用的就是这个,比这个更完整,但是毛病多多,所以就不采用了,谢谢你的好心,呵呵

点评

哦,那我就没办法了。(唔,5VIP没拿到  发表于 2013-1-11 21:31
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
70
在线时间
80 小时
注册时间
2014-4-12
帖子
167
7
发表于 2014-4-26 14:37:29 | 只看该作者
是这样吗
http://www.rpgmakervxace.net/top ... -buttons-25-update/
嗯,人家那个好像下不了,幸好我收藏了一堆脚本,你看看行不行
RUBY 代码复制
  1. #encoding:utf-8
  2. # 鼠标指针变换功能 v2.2 (2014.1.24)
  3. # ·需· 鼠标系统(SionMouseSystem)v2.1+
  4. # 说明:
  5. #    鼠标指针图片参考 Grpahics\System\VariableCursor.png
  6. #    单个指针图片大小默认是64x64,图片的中心为鼠标坐标
  7. #
  8. #    事件中添加注释: 鼠标指针i
  9. #        鼠标移动到此事件上时鼠标指针自动切换到对应图片
  10. #    可以参考范例里的事件注释
  11. #
  12. #
  13. class << Mouse
  14. CursorSize = 64 #单个图标大小
  15.   def create_cursor(vp)
  16.     dispose_cursor if @sprite
  17.     [url=home.php?mod=space&uid=114926]@sprite[/url] = Sprite.new(vp)
  18.     @sprite.z = 9999
  19.     if File.exist?('Graphics/System/VariableCursor.png')
  20.       @sprite.bitmap = Cache.system('VariableCursor')
  21.     else
  22.       msgbox("Graphics/System/VariableCursor.png 缺失")
  23.       exit
  24.     end
  25.     @sprite.src_rect.set(0, 0, CursorSize, CursorSize)
  26.     @sprite.ox = CursorSize / 2
  27.     @sprite.oy = CursorSize / 2
  28.     update_cursor
  29.   end
  30.   def change_cursor(i)
  31.     @sprite.src_rect.x = i * CursorSize
  32.   end
  33. end
  34.  
  35. class Scene_Map
  36.   alias_method :change_cursor_update_mouse_action, :update_mouse_action
  37.   def update_mouse_action
  38.     Mouse.change_cursor(0)
  39.     $game_map.events_xy($game_map.mouse_map_x, \
  40.     $game_map.mouse_map_y).each {|event|
  41.       if event.mouse_start?
  42.         break Mouse.change_cursor(1)
  43.       elsif event.cursor_index
  44.         break Mouse.change_cursor(event.cursor_index)
  45.       end
  46.     }
  47.     change_cursor_update_mouse_action
  48.   end
  49.   alias_method :change_cursor_sion_mouse_call_menu, :call_menu
  50.   def call_menu
  51.     Mouse.change_cursor(0)
  52.     change_cursor_sion_mouse_call_menu
  53.   end
  54. end
  55.  
  56. class Game_Event
  57.   attr_reader :locked, :cursor_index
  58.   alias_method :change_cursor_lock, :lock
  59.   def lock
  60.     Mouse.change_cursor(0)
  61.     change_cursor_lock
  62.   end
  63.   alias_method :change_cursor_sion_mouse_start, :sion_mouse_start
  64.   def sion_mouse_start
  65.     Mouse.change_cursor(0)
  66.     change_cursor_sion_mouse_start
  67.   end
  68.   def sion_mouse_read_event_notes
  69.     @mouse_start = false
  70.     @cursor_index = nil
  71.     @list.each {|cmd| break if sion_mouse_scan_list(cmd)} unless empty?
  72.   end
  73.   def sion_mouse_scan_list(cmd) # 覆盖
  74.     return false unless cmd.code == 108 || cmd.code == 408
  75.     text = cmd.parameters[0]
  76.     if text.include?("鼠标启动")
  77.       @mouse_start = true
  78.       @cursor_index = 1 #设置鼠标启动对应的鼠标指针索引
  79.     elsif /鼠标指针(\d+)/ =~ text
  80.       @cursor_index = $1.to_i
  81.     end
  82.     return @cursor_index
  83.   end
  84. end
  85.  
  86. class Game_Player < Game_Character
  87.   alias_method :change_cursor_make_encounter_count, :make_encounter_count
  88.   def make_encounter_count
  89.     Mouse.change_cursor(0)
  90.     change_cursor_make_encounter_count
  91.   end
  92. end

RUBY 代码复制
  1. #encoding:utf-8
  2. # Sion 鼠标系统(SionMouseSystem)v3.02  (2014/2/20)
  3. # ·需· Sion_MouseBase v3.00+
  4.  
  5. # v3.02(2014/2/20) 事件执行过程中,卷动地图后不会自动跳转到玩家位置了。
  6.  
  7.  
  8. =begin 说明  
  9.  
  10.   主要功能
  11.  
  12.     1,自动寻路,按住 D 键可以扩大寻路的范围
  13.     2,变量输入框改良
  14.     3,鼠标启动事件:
  15.       在事件中加入“注释”:鼠标启动
  16.       该事件将无法用其它方式启动,只能用鼠标左键点击启动
  17.       
  18.     3.00 新增鼠标滚轮支持,菜单可以直接用鼠标滚轮翻页了
  19.          现在在光标矩形外按鼠标不会响应了,必须移动到对应的选项上按才行。
  20.          还改进了一些个蛋挞的问题。
  21.          
  22.       
  23.   鼠标指针图片 MouseCursor.png 放入 Graphics\System 文件夹
  24.   路径点指示图片 $Arrow.png 放入 Graphics\Characters 文件夹
  25.   如果未放入会使用RM自带图片代替缺失文件
  26.  
  27. =end
  28.  
  29.  
  30.  
  31. #==============================================================================
  32. # ■ 常数设置
  33. #==============================================================================
  34. module KsOfSion
  35.   Clip_Cursor    = true    # 鼠标锁定在游戏窗口内,需要关闭设置为false
  36.   Dbclick_Frame  = 15      # 双击的最大间隔帧数。在地图画面双击进行奔跑
  37.   New_Scroll     = true    # 更改地图卷动方式,需要关闭设置为false
  38.   Map_Scroll_Spd = 1.0     # 卷动速度
  39.   Menu_Set_Pos   = true    # 打开菜单时将鼠标移动到光标处
  40.   Break_Steps    = 30      # 鼠标寻路最大步数,防止路径太长导致卡帧
  41. #                             “30” 是默认显示格子数 长(17) + 宽(13)
  42.   Find_Path_Key  = 0x44    # 扩大寻路范围至全地图按键 0x44 对应 D键
  43.                            # 查阅 NovaBase 中的键盘表修改,设为 0 禁用此功能
  44. end
  45.  
  46. #
  47. class Move_Sign < Game_Character # ■ 用来显示路径点的类
  48. attr_accessor :direction
  49.   def init_public_members
  50.     @character_name  = '!$Arrow'# 路径点箭头,置于.\Graphics\Characters文件夹
  51.     @character_index = 0        # 图片索引。$开头的行走图设为0
  52.     @move_speed      = 5        # 踏步速度
  53.     @step_anime      = true     # 踏步动画(如果想使用静态图标就关闭这个)
  54.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # 不透明度
  55.     @blend_type      = 0        # 图片合成方式,默认为0(正常)
  56.     @direction       = 2        # 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列
  57.     @priority_type   = 1        # 优先级(默认与人物同级:1)
  58.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
  59.  
  60. #============================= 参数设置完毕 ===================================
  61.     unless File.exist?('Graphics/Characters/' + @character_name + '.png')
  62.       @character_name  = '!Flame'
  63.       @character_index = 6
  64.     end
  65.     @direction_fix = false
  66.     @move_frequency = 6
  67.     @walk_anime = true
  68.     @pattern = 1
  69.     @through = true
  70.     @bush_depth = 0
  71.     @animation_id = 0
  72.     @balloon_id = 0
  73.     @transparent = true
  74.     @id = 0
  75.     @x = 0
  76.     @y = 0
  77.     @real_x = 0
  78.     @real_y = 0
  79.     @tile_id = 0
  80.   end
  81. end
  82. #==============================================================================
  83. # ■ SceneManager
  84. #==============================================================================
  85. class << SceneManager
  86. alias_method :sion_mouse_run, :run
  87. alias_method :sion_mouse_call, :call
  88. alias_method :sion_mouse_return, :return
  89.  
  90.   def run
  91.     Mouse.activate
  92.     sion_mouse_run
  93.   end
  94.   def call(scene_class, *args)
  95.     $game_map.prepare_reset_mouse_pos if @scene.instance_of?(Scene_Map)
  96.     sion_mouse_call(scene_class, *args)
  97.   end
  98.   def return
  99.     sion_mouse_return
  100.     $game_map.reset_mouse_pos if KsOfSion::Menu_Set_Pos &&
  101.       @scene.instance_of?(Scene_Map)
  102.   end
  103. end
  104. class << Mouse
  105.   attr_reader :sprite
  106. end
  107. class << Input
  108. alias_method :sion_mouse_press?,   :press?
  109. alias_method :sion_mouse_trigger?, :trigger?
  110. alias_method :sion_mouse_repeat?,  :repeat?
  111. alias_method :sion_mouse_update,   :update
  112.  
  113.   def update
  114.     Mouse.update
  115.     sion_mouse_update
  116.   end
  117.   def press?(key)
  118.     return true if sion_mouse_press?(key)
  119.     return Input.key_press?(0x01) if key == :C
  120.     return Input.key_press?(0x02) if key == :B
  121.     return false
  122.   end
  123.   def trigger?(key)
  124.     return true if sion_mouse_trigger?(key)
  125.     return Input.key_trigger?(0x01) if key == :C
  126.     return Input.key_trigger?(0x02) if key == :B
  127.     return false
  128.   end
  129.   def repeat?(key)
  130.     return true if sion_mouse_repeat?(key)
  131.     return Input.key_repeat?(0x01) if key == :C
  132.     return Input.key_repeat?(0x02) if key == :B
  133.     return false
  134.   end
  135. end
  136.  
  137.  
  138. #==============================================================================
  139. # ■ Window_Selectable
  140. #------------------------------------------------------------------------------
  141. #  拥有光标移动、滚动功能的窗口
  142. #==============================================================================
  143. class Window_Selectable
  144.   #--------------------------------------------------------------------------
  145.   # ● 初始化
  146.   #--------------------------------------------------------------------------
  147.   alias sion_mouse_initialize initialize
  148.   def initialize(x, y, width, height)
  149.     sion_mouse_initialize(x, y, width, height)
  150.     @move_state = 0
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 更新
  154.   #--------------------------------------------------------------------------
  155.   alias sion_mouse_update update
  156.   def update
  157.     sion_mouse_update
  158.     update_mouse_cursor
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ● 按下确定键的处理
  162.   #--------------------------------------------------------------------------
  163.   alias sion_mouse_process_ok process_ok
  164.   def process_ok
  165.     return if Input.key_trigger?(0x01) && mouse_out_rect?
  166.     sion_mouse_process_ok
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● 判断鼠标是位于光标矩形处
  170.   #--------------------------------------------------------------------------
  171.   def mouse_out_rect?
  172.     if viewport.nil?
  173.       vp_x, vp_y = 0, 0
  174.     else
  175.       vp_x = viewport.rect.x - viewport.ox
  176.       vp_y = viewport.rect.y - viewport.oy
  177.     end
  178.     mouse_rx = ox + Mouse.x - (x + vp_x + standard_padding )
  179.     mouse_ry = oy + Mouse.y - (y + vp_y + standard_padding )
  180.     return cursor_rect.x > mouse_rx ||
  181.            cursor_rect.y > mouse_ry ||
  182.            cursor_rect.x + cursor_rect.width < mouse_rx ||
  183.            cursor_rect.y + cursor_rect.height< mouse_ry
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● 启动后设置鼠标到index位置 / 重置鼠标滚轮状态
  187.   #--------------------------------------------------------------------------
  188.   def activate
  189.     @need_set_pos = true if KsOfSion::Menu_Set_Pos
  190.     Mouse.reset_z
  191.     super
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # ● 更新鼠标和光标的位置
  195.   #--------------------------------------------------------------------------
  196.   def update_mouse_cursor
  197.     if active
  198.       if @need_set_pos
  199.         @need_set_pos = false
  200.         set_mouse_pos
  201.       elsif cursor_movable?
  202.         Input.dir4.zero? ? set_cursor : set_mouse_pos
  203.       end
  204.     end
  205.   end
  206.   #--------------------------------------------------------------------------
  207.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能
  208.   #--------------------------------------------------------------------------
  209.   def set_cursor
  210.     mouse_row, mouse_col = mouse_window_area
  211.     if    mouse_row == -1
  212.       @move_state += 1 if need_scroll?
  213.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand?
  214.     elsif mouse_row == -2
  215.       @move_state += 1 if need_scroll?
  216.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand?
  217.     elsif mouse_col == -1
  218.       @move_state += 1 if need_scroll?
  219.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand?
  220.     elsif mouse_col == -2
  221.       @move_state += 1 if need_scroll?
  222.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand?
  223.     else
  224.       @move_state = 0
  225.       new_index = (top_row + mouse_row) * col_max + mouse_col
  226.       select(new_index) if new_index < item_max && new_index != @index
  227.     end
  228.     update_mouse_scroll
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ● 判断鼠标位于菜单的第几行、第几列
  232.   #--------------------------------------------------------------------------
  233.   def mouse_window_area
  234.     if viewport.nil? # necessary!
  235.       vp_x, vp_y = 0, 0
  236.     else
  237.       vp_x = viewport.rect.x - viewport.ox
  238.       vp_y = viewport.rect.y - viewport.oy
  239.     end
  240.     mouse_x = Mouse.x
  241.     mouse_y = Mouse.y
  242.     item_x1 = vp_x + x + standard_padding
  243.     item_y1 = vp_y + y + standard_padding
  244.     item_x2 = vp_x + x - standard_padding + width
  245.     item_y2 = vp_y + y - standard_padding + height
  246.     if mouse_x < item_x1
  247.       mouse_col = -1
  248.     elsif mouse_x > item_x2
  249.       mouse_col = -2
  250.     else
  251.       mouse_col = col_max * (mouse_x - item_x1) / (item_x2 - item_x1)
  252.     end
  253.     if mouse_y < item_y1
  254.       mouse_row = -1
  255.     elsif mouse_y > item_y2
  256.       mouse_row = -2
  257.     else
  258.       mouse_row = page_row_max * (mouse_y - item_y1 - 1) / (item_y2 - item_y1)
  259.     end
  260.     return mouse_row, mouse_col
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● 更新鼠标滚轮
  264.   #--------------------------------------------------------------------------
  265.   def update_mouse_scroll
  266.     z = Mouse.z
  267.     return if z == 0
  268.     if need_scroll?
  269.       if z < 0
  270.         cursor_pagedown
  271.       else
  272.         cursor_pageup
  273.       end
  274.     end
  275.     Mouse.reset_z
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  279.   #--------------------------------------------------------------------------
  280.   def set_mouse_pos
  281.     if viewport.nil? # necessary!
  282.       vp_x, vp_y = 0, 0
  283.     else
  284.       vp_x = viewport.rect.x - viewport.ox
  285.       vp_y = viewport.rect.y - viewport.oy
  286.     end
  287.     item_x1 = vp_x + x + standard_padding
  288.     item_y1 = vp_y + y + standard_padding
  289.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url] < 0 ? 0 : @index
  290.     row = get_index / col_max - top_row
  291.     col = get_index % col_max
  292.     new_x = item_x1 + item_width * (col + 0.5)
  293.     new_y = item_y1 + item_height * (row + 0.5)
  294.     Mouse.set_pos(new_x, new_y)
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # ● 判断菜单是否需要卷动
  298.   #--------------------------------------------------------------------------
  299.   def need_scroll?
  300.     item_max > col_max * page_row_max
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # ● 判断是否为水平卷动菜单
  304.   #--------------------------------------------------------------------------
  305.   def is_horzcommand?
  306.     return false
  307.   end
  308. end
  309.  
  310. class Window_HorzCommand
  311.   #--------------------------------------------------------------------------
  312.   # ● 判断是否为水平卷动菜单
  313.   #--------------------------------------------------------------------------
  314.   def is_horzcommand?
  315.     return true
  316.   end
  317. end
  318.  
  319. #==============================================================================
  320. # ■ Window_NameInput
  321. #------------------------------------------------------------------------------
  322. #  名字输入画面中,选择文字的窗口。
  323. #==============================================================================
  324. class Window_NameInput
  325.   #--------------------------------------------------------------------------
  326.   # ● 设置列数
  327.   #--------------------------------------------------------------------------
  328.   def col_max
  329.     return 10
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # ● 设置填充的Item个数
  333.   #--------------------------------------------------------------------------
  334.   def item_max
  335.     return 90
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # ● 设置填充的Item个数
  339.   #--------------------------------------------------------------------------
  340.   def item_width
  341.     return 32
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ● 判断鼠标位于菜单的第几行、第几列
  345.   #--------------------------------------------------------------------------
  346.   def mouse_window_area
  347.     if viewport.nil?
  348.       vp_x, vp_y = 0, 0
  349.     else
  350.       vp_x = viewport.rect.x - viewport.ox
  351.       vp_y = viewport.rect.y - viewport.oy
  352.     end
  353.     mouse_x = Mouse.x
  354.     mouse_y = Mouse.y
  355.     item_x1 = vp_x + x + standard_padding
  356.     item_y1 = vp_y + y + standard_padding
  357.     item_x2 = vp_x + x - standard_padding + width
  358.     item_y2 = vp_y + y - standard_padding + height
  359.     if mouse_x < item_x1
  360.       mouse_col = -1
  361.     elsif mouse_x > item_x2
  362.       mouse_col = -2
  363.     elsif mouse_x < item_x1 + 160
  364.       mouse_col = (mouse_x - item_x1)/32
  365.     elsif mouse_x > item_x2 - 160
  366.       mouse_col = 9 - (item_x2 - mouse_x)/32
  367.     else
  368.       mouse_col = mouse_x > x + width/2 ? 5 : 4
  369.     end
  370.     if mouse_y < item_y1
  371.       mouse_row = -1
  372.     elsif mouse_y > item_y2
  373.       mouse_row = -2
  374.     else
  375.       mouse_row = page_row_max * (mouse_y - item_y1 - 1)/(item_y2 - item_y1)
  376.     end
  377.     return mouse_row, mouse_col
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  381.   #--------------------------------------------------------------------------
  382.   def set_mouse_pos
  383.     if viewport.nil? # necessary!
  384.       vp_x, vp_y = 0, 0
  385.     else
  386.       vp_x = viewport.rect.x - viewport.ox
  387.       vp_y = viewport.rect.y - viewport.oy
  388.     end
  389.     item_x1 = vp_x + x + standard_padding
  390.     item_y1 = vp_y + y + standard_padding
  391.     get_index = @index < 0 ? 0 : @index
  392.     row = get_index / col_max - top_row
  393.     col = get_index % col_max
  394.     new_x = item_x1 + item_width * (col + 0.5)
  395.     new_y = item_y1 + item_height * (row + 0.5)
  396.     new_x += 14 if col > 4
  397.     Mouse.set_pos(new_x, new_y)
  398.   end
  399. end
  400.  
  401. #==============================================================================
  402. # ■ Window_NumberInput
  403. #------------------------------------------------------------------------------
  404. #  重写了数值输入的方法以适应鼠标
  405. #==============================================================================
  406. class Window_NumberInput < Window_Base
  407.   #--------------------------------------------------------------------------
  408.   # ● 定义实例变量
  409.   #--------------------------------------------------------------------------
  410.   attr_reader :extra_window
  411.   #--------------------------------------------------------------------------
  412.   # ● 初始化
  413.   #--------------------------------------------------------------------------
  414.   alias sion_mouse_initialize initialize
  415.   def initialize(arg)
  416.     sion_mouse_initialize(arg)
  417.     create_extra_window
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # ● 启动
  421.   #--------------------------------------------------------------------------
  422.   alias sion_mouse_start start
  423.   def start
  424.     sion_mouse_start
  425.     deactivate
  426.     extra_start
  427.   end
  428.   #--------------------------------------------------------------------------
  429.   # ● 创建新的数值输入窗口
  430.   #--------------------------------------------------------------------------
  431.   def create_extra_window
  432.     @extra_window = Window_NumberInput_Ex.new
  433.     @extra_window.x = (Graphics.width - @extra_window.width) / 2
  434.     @extra_window.number_proc  = Proc.new {|n| [url=home.php?mod=space&uid=27178]@Number[/url] = n }
  435.     @extra_window.index_proc   = Proc.new {|n| @index = n }
  436.     @extra_window.close_proc   = Proc.new { close }
  437.     @extra_window.refresh_proc = Proc.new { refresh }
  438.   end
  439.   #--------------------------------------------------------------------------
  440.   # ● 激活新窗口
  441.   #--------------------------------------------------------------------------
  442.   def extra_start
  443.     case $game_message.position
  444.       when 0; @extra_window.y = y + height + 4
  445.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
  446.       when 2; @extra_window.y = y - @extra_window.height - 4
  447.       else  ; @extra_window.y = 8
  448.     end
  449.     @extra_window.variable_id = $game_message.num_input_variable_id
  450.     @extra_window.digits_max  = @digits_max
  451.     @extra_window.number      = @number
  452.     @extra_window.open
  453.     @extra_window.activate
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   # ● 更新
  457.   #--------------------------------------------------------------------------
  458.   def update
  459.     super
  460.     @extra_window.update
  461.     update_cursor
  462.   end
  463.   #--------------------------------------------------------------------------
  464.   # ● 关闭窗口
  465.   #--------------------------------------------------------------------------
  466.   def close
  467.     super
  468.     @extra_window.close
  469.     @extra_window.deactivate
  470.   end
  471. end
  472.  
  473. #==============================================================================
  474. # ■ Window_NumberInput_Ex
  475. #------------------------------------------------------------------------------
  476. #  新的数值输入窗口(NewClass)
  477. #==============================================================================
  478. class Window_NumberInput_Ex < Window_Selectable
  479.   #--------------------------------------------------------------------------
  480.   # ● 定义实例变量
  481.   #--------------------------------------------------------------------------
  482.   attr_accessor :number_proc
  483.   attr_accessor :index_proc
  484.   attr_accessor :close_proc
  485.   attr_accessor :refresh_proc
  486.   attr_accessor :number
  487.   attr_accessor :digits_max
  488.   attr_accessor :variable_id
  489.   #--------------------------------------------------------------------------
  490.   # ● 数字表
  491.   #--------------------------------------------------------------------------
  492.   TABLE = [  7,  8,  9,
  493.              4,  5,  6,
  494.              1,  2,  3,
  495.             '←',0,'确定',]
  496.   #--------------------------------------------------------------------------
  497.   # ● 初始化对象
  498.   #--------------------------------------------------------------------------
  499.   def initialize
  500.     super(0, 0, 120, fitting_height(4))
  501.     self.openness = 0
  502.     @index = 0
  503.     @number = 0
  504.     @old_window_index = 0
  505.     @digits_max = 0
  506.     12.times {|i| draw_text(item_rect(i), TABLE[i], 1) }
  507.   end
  508.   #--------------------------------------------------------------------------
  509.   # ● 获取项目的绘制矩形
  510.   #--------------------------------------------------------------------------
  511.   def item_rect(index)
  512.     rect = Rect.new
  513.     rect.x = index % 3 * 32
  514.     rect.y = index / 3 * line_height
  515.     rect.width = 32
  516.     rect.height = line_height
  517.     return rect
  518.   end
  519.   #--------------------------------------------------------------------------
  520.   # ● 将光标设置到鼠标所在的位置
  521.   #--------------------------------------------------------------------------
  522.   def set_cursor
  523.     mouse_row, mouse_col = mouse_window_area
  524.     if mouse_row >= 0 && mouse_col >= 0
  525.       new_index = mouse_row * 3 + mouse_col
  526.       select(new_index) if new_index <= 11
  527.     end
  528.   end
  529.   #--------------------------------------------------------------------------
  530.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列
  531.   #--------------------------------------------------------------------------
  532.   def mouse_window_area
  533.     if viewport.nil?
  534.       vp_x, vp_y = 0, 0
  535.     else
  536.       vp_x = viewport.rect.x - viewport.ox
  537.       vp_y = viewport.rect.y - viewport.oy
  538.     end
  539.     mouse_x = Mouse.x
  540.     mouse_y = Mouse.y
  541.     item_x1 = vp_x + x + standard_padding
  542.     item_y1 = vp_y + y + standard_padding
  543.     item_x2 = vp_x + x - standard_padding + width
  544.     item_y2 = vp_y + y - standard_padding + height
  545.     if mouse_x < item_x1
  546.       mouse_col = -1
  547.     elsif mouse_x > item_x2
  548.       mouse_col = -2
  549.     else
  550.       mouse_col = (mouse_x - item_x1) / 32
  551.     end
  552.     if mouse_y < item_y1
  553.       mouse_row = -1
  554.     elsif mouse_y > item_y2
  555.       mouse_row = -2
  556.     else
  557.       mouse_row = 4 * (mouse_y - item_y1 - 1) / (item_y2 - item_y1)
  558.     end
  559.     return mouse_row, mouse_col
  560.   end
  561.   #--------------------------------------------------------------------------
  562.   # ● 获取文字
  563.   #--------------------------------------------------------------------------
  564.   def get_number
  565.     return false if @index == 9 || @index == 11
  566.     return TABLE[@index]
  567.   end
  568.   #--------------------------------------------------------------------------
  569.   # ● 判定光标位置是否在“退格”上
  570.   #--------------------------------------------------------------------------
  571.   def is_delete?
  572.     @index == 9
  573.   end
  574.   #--------------------------------------------------------------------------
  575.   # ● 判定光标位置是否在“确定”上
  576.   #--------------------------------------------------------------------------
  577.   def is_ok?
  578.     @index == 11
  579.   end
  580.   #--------------------------------------------------------------------------
  581.   # ● 更新光标
  582.   #--------------------------------------------------------------------------
  583.   def update_cursor
  584.     cursor_rect.set(item_rect(@index))
  585.   end
  586.   #--------------------------------------------------------------------------
  587.   # ● 判定光标是否可以移动
  588.   #--------------------------------------------------------------------------
  589.   def cursor_movable?
  590.     active
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # ● 光标向下移动
  594.   #     wrap : 允许循环
  595.   #--------------------------------------------------------------------------
  596.   def cursor_down(wrap)
  597.     if @index < 9 or wrap
  598.       @index = (index + 3) % 12
  599.     end
  600.   end
  601.   #--------------------------------------------------------------------------
  602.   # ● 光标向上移动
  603.   #     wrap : 允许循环
  604.   #--------------------------------------------------------------------------
  605.   def cursor_up(wrap)
  606.     if @index >= 3 or wrap
  607.       @index = (index + 9) % 12
  608.     end
  609.   end
  610.   #--------------------------------------------------------------------------
  611.   # ● 光标向右移动
  612.   #     wrap : 允许循环
  613.   #--------------------------------------------------------------------------
  614.   def cursor_right(wrap)
  615.     if @index % 3 < 2
  616.       @index += 1
  617.     elsif wrap
  618.       @index -= 2
  619.     end
  620.   end
  621.   #--------------------------------------------------------------------------
  622.   # ● 光标向左移动
  623.   #     wrap : 允许循环
  624.   #--------------------------------------------------------------------------
  625.   def cursor_left(wrap)
  626.     if @index % 3 > 0
  627.       @index -= 1
  628.     elsif wrap
  629.       @index += 2
  630.     end
  631.   end
  632.   #--------------------------------------------------------------------------
  633.   # ● 处理光标的移动
  634.   #--------------------------------------------------------------------------
  635.   def process_cursor_move
  636.     super
  637.     update_cursor
  638.   end
  639.   #--------------------------------------------------------------------------
  640.   # ● “确定”、“删除字符”和“取消输入”的处理
  641.   #--------------------------------------------------------------------------
  642.   def process_handling
  643.     return unless open? && active
  644.     process_jump if Input.trigger?(:A)
  645.     process_back if Input.repeat?(:B)
  646.     process_ok   if Input.trigger?(:C)
  647.   end
  648.   #--------------------------------------------------------------------------
  649.   # ● 跳转“确定”
  650.   #--------------------------------------------------------------------------
  651.   def process_jump
  652.     if @index != 11
  653.       @index = 11
  654.       Sound.play_cursor
  655.     end
  656.   end
  657.   #--------------------------------------------------------------------------
  658.   # ● 后退一个字符
  659.   #--------------------------------------------------------------------------
  660.   def process_back
  661.     Sound.play_cancel
  662.     place = 10 ** (@digits_max - 1 - @old_window_index)
  663.     n = (@number / place) % 10
  664.     @number -= n * place
  665.     @number_proc.call(@number)
  666.     @old_window_index -= 1 if @old_window_index > 0
  667.     @index_proc.call(@old_window_index)
  668.     @refresh_proc.call
  669.   end
  670.   #--------------------------------------------------------------------------
  671.   # ● 按下确定键时的处理
  672.   #--------------------------------------------------------------------------
  673.   def process_ok
  674.     return if Input.key_trigger?(0x01) && mouse_out_rect?
  675.     if get_number
  676.       Sound.play_cursor
  677.       place = 10 ** (@digits_max - 1 - @old_window_index)
  678.       n = get_number - (@number / place) % 10
  679.       @number += n * place
  680.       @number_proc.call(@number)
  681.       @old_window_index += 1 if @old_window_index < @digits_max - 1
  682.       @index_proc.call(@old_window_index)
  683.       @refresh_proc.call
  684.     elsif is_delete?
  685.       process_back
  686.     elsif is_ok?
  687.       on_input_ok
  688.     end
  689.   end
  690.   #--------------------------------------------------------------------------
  691.   # ● 确定
  692.   #--------------------------------------------------------------------------
  693.   def on_input_ok
  694.     @index = 0
  695.     @old_window_index = 0
  696.     $game_variables[@variable_id] = @number
  697.     Sound.play_ok
  698.     @close_proc.call
  699.   end
  700.   #--------------------------------------------------------------------------
  701.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  702.   #--------------------------------------------------------------------------
  703.   def set_mouse_pos
  704.     if viewport.nil? # necessary!
  705.       vp_x, vp_y = 0, 0
  706.     else
  707.       vp_x = viewport.rect.x - viewport.ox
  708.       vp_y = viewport.rect.y - viewport.oy
  709.     end
  710.     item_x1 = vp_x + x + standard_padding
  711.     item_y1 = vp_y + y + standard_padding
  712.     get_index = @index < 0 ? 0 : @index
  713.     new_x = item_x1 + 32 * (get_index % 3 + 0.5)
  714.     new_y = item_y1 + 24 * (get_index / 3 + 0.5)
  715.     Mouse.set_pos(new_x, new_y)
  716.   end
  717. end
  718.  
  719. #==============================================================================
  720. # ■ Window_Message
  721. #------------------------------------------------------------------------------
  722. #  显示文字信息的窗口。
  723. #==============================================================================
  724. class Window_Message < Window_Base
  725.   #--------------------------------------------------------------------------
  726.   # ● 处理数值的输入(覆盖原方法)
  727.   #--------------------------------------------------------------------------
  728.   def input_number
  729.     @number_window.start
  730.     Fiber.yield while @number_window.extra_window.active
  731.   end
  732. end
  733.  
  734. #==============================================================================
  735. # ■ Window_PartyCommand
  736. #------------------------------------------------------------------------------
  737. #  战斗画面中,选择“战斗/撤退”的窗口。
  738. #==============================================================================
  739. class Window_PartyCommand < Window_Command
  740.   #--------------------------------------------------------------------------
  741.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  742.   #--------------------------------------------------------------------------
  743.   def set_mouse_pos
  744.     if viewport.nil?
  745.       vp_x, vp_y = 0, 0
  746.     else
  747.       #vp_x = viewport.rect.x - viewport.ox
  748.       vp_y = viewport.rect.y - viewport.oy
  749.     end
  750.     item_x1 = x + standard_padding
  751.     item_y1 = vp_y + y + standard_padding
  752.     get_index = @index < 0 ? 0 : @index
  753.     row = get_index / col_max - top_row
  754.     col = get_index % col_max
  755.     new_x = item_x1 + item_width * (col + 0.5)
  756.     new_y = item_y1 + item_height * (row + 0.5)
  757.     Mouse.set_pos(new_x, new_y)
  758.   end
  759. end
  760.  
  761. #==============================================================================
  762. # ■ Window_ActorCommand
  763. #------------------------------------------------------------------------------
  764. #  战斗画面中,选择角色行动的窗口。
  765. #==============================================================================
  766. class Window_ActorCommand < Window_Command
  767.   #--------------------------------------------------------------------------
  768.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  769.   #--------------------------------------------------------------------------
  770.   def set_mouse_pos
  771.     if viewport.nil?
  772.       vp_x, vp_y = 0, 0
  773.     else
  774.       #vp_x = viewport.rect.x - viewport.ox
  775.       vp_y = viewport.rect.y - viewport.oy
  776.     end
  777.     item_x1 = Graphics.width - width + standard_padding
  778.     item_y1 = vp_y + y + standard_padding
  779.     get_index = @index < 0 ? 0 : @index
  780.     row = get_index / col_max - top_row
  781.     col = get_index % col_max
  782.     new_x = item_x1 + item_width * (col + 0.5)
  783.     new_y = item_y1 + item_height * (row + 0.5)
  784.     Mouse.set_pos(new_x, new_y)
  785.   end
  786. end
  787.  
  788. #==============================================================================
  789. # ■ Game_Player
  790. #------------------------------------------------------------------------------
  791. #  处理玩家人物的类。拥有事件启动的判定、地图的卷动等功能。
  792. #   本类的实例请参考 $game_player 。
  793. #==============================================================================
  794. class Game_Player < Game_Character
  795.   #--------------------------------------------------------------------------
  796.   # ● 由方向移动(覆盖原方法)
  797.   #--------------------------------------------------------------------------
  798.   def move_by_input
  799.     return if !movable? || $game_map.interpreter.running?
  800.     if Input.dir4 > 0
  801.       move_straight(Input.dir4)
  802.       reset_move_path
  803.     else
  804.       move_by_mouse
  805.     end
  806.   end
  807.   #--------------------------------------------------------------------------
  808.   # ● 非移动中的处理(覆盖原方法)
  809.   #     last_moving : 此前是否正在移动
  810.   #--------------------------------------------------------------------------
  811.   def update_nonmoving(last_moving)
  812.     return if $game_map.interpreter.running?
  813.     if last_moving
  814.       $game_party.on_player_walk
  815.       return if check_touch_event
  816.     end
  817.     if movable? && Input.trigger?(:C)
  818.       # 防止按下鼠标左键绘制路径时触发事件或载具切换
  819.       return if Input.key_press?(0x01)
  820.       return if get_on_off_vehicle
  821.       return if check_action_event
  822.     end
  823.     update_encounter if last_moving
  824.   end
  825.   #--------------------------------------------------------------------------
  826.   # ● 判定是否跑步状态(覆盖原方法)
  827.   #--------------------------------------------------------------------------
  828.   def dash?
  829.     return false if @move_route_forcing
  830.     return false if $game_map.disable_dash?
  831.     return false if vehicle
  832.     return Input.press?(:A) || @mouse_dash
  833.   end
  834.   #--------------------------------------------------------------------------
  835.   # ● 初始化
  836.   #--------------------------------------------------------------------------
  837.   alias sion_mouse_initialize initialize
  838.   def initialize
  839.     sion_mouse_initialize
  840.     reset_move_path
  841.     @moveto_x = 0
  842.     @moveto_y = 0
  843.   end
  844.   #--------------------------------------------------------------------------
  845.   # ● 移动到指定位置
  846.   #--------------------------------------------------------------------------
  847.   alias sion_mouse_moveto moveto
  848.   def moveto(x, y)
  849.     sion_mouse_moveto(x, y)
  850.     $mouse_move_sign.moveto( x, y )
  851.   end
  852.   #--------------------------------------------------------------------------
  853.   # ● 更新
  854.   #--------------------------------------------------------------------------
  855.   alias sion_mouse_update update
  856.   def update
  857.     sion_mouse_update
  858.     clear_unreachable_sign
  859.   end
  860.   #--------------------------------------------------------------------------
  861.   # ● 处理卷动
  862.   #--------------------------------------------------------------------------
  863.   alias sion_mouse_update_scroll update_scroll
  864.   def update_scroll(last_real_x, last_real_y)
  865.     return if $game_map.scrolling?
  866.     KsOfSion::New_Scroll ? new_update_scroll :
  867.       sion_mouse_update_scroll(last_real_x, last_real_y)
  868.   end
  869.   #--------------------------------------------------------------------------
  870.   # ● 重置移动路径相关信息
  871.   #--------------------------------------------------------------------------
  872.   def reset_move_path
  873.     @mouse_dash = false
  874.     @mouse_move_path = []
  875.     $mouse_move_sign.transparent = true
  876.   end
  877.   #--------------------------------------------------------------------------
  878.   # ● 新的卷动地图方法
  879.   #--------------------------------------------------------------------------
  880.   def new_update_scroll
  881.     return if $game_message.busy? || $game_message.visible
  882.     horz_speed = 2 ** @move_speed * KsOfSion::Map_Scroll_Spd / Graphics.width
  883.     vert_speed = 2 ** @move_speed * KsOfSion::Map_Scroll_Spd / Graphics.height
  884.     ax = $game_map.adjust_x( @real_x )
  885.     ay = $game_map.adjust_y( @real_y )
  886.     if    ay>center_y; $game_map.new_scroll_down (vert_speed * (ay - center_y))
  887.     elsif ay<center_y; $game_map.new_scroll_up   (vert_speed * (center_y - ay))
  888.     end
  889.     if    ax>center_x; $game_map.new_scroll_right(horz_speed * (ax - center_x))
  890.     elsif ax<center_x; $game_map.new_scroll_left (horz_speed * (center_x - ax))
  891.     end
  892.   end
  893.   #--------------------------------------------------------------------------
  894.   # ● 消除不能抵达图标
  895.   #--------------------------------------------------------------------------
  896.   def clear_unreachable_sign
  897.     return if Input.key_press?(0x01)
  898.     if $mouse_move_sign.direction == 4 && Mouse.dk_count % 20 == 1
  899.       $mouse_move_sign.transparent = true
  900.       $mouse_move_sign.direction = 2
  901.     end
  902.   end
  903.   #--------------------------------------------------------------------------
  904.   # ● 由鼠标移动
  905.   #--------------------------------------------------------------------------
  906.   def move_by_mouse
  907.     unless @mouse_move_path.empty? # 移动路线数组不为空则执行移动
  908.       dir = @mouse_move_path.shift
  909.       if passable?(x, y, dir) && !@mouse_move_path.empty?
  910.         move_straight(dir)
  911.       elsif @mouse_move_path.empty? # 判断是否是最后一步
  912.         x2 = $game_map.round_x_with_direction(x, dir)
  913.         y2 = $game_map.round_y_with_direction(y, dir)
  914.         move_straight(dir) unless dir.zero?
  915.         unless @x == x2 && @y == y2 # 如果移动失败,检查是否启动前方事件
  916.           check_event_trigger_there([0,1,2])
  917.           get_on_off_vehicle unless $game_map.setup_starting_event
  918.         end
  919.         $mouse_move_sign.transparent = true if $mouse_move_sign.direction == 2
  920.         @mouse_dash = false
  921.       elsif @mouse_move_path[0].zero? # 目标点无法抵达,调整朝向→目标点
  922.         @mouse_move_path.shift
  923.         @direction = dir
  924.         @mouse_dash = false
  925.       else
  926.         draw_move_path
  927.       end
  928.     end
  929.   end
  930.   #--------------------------------------------------------------------------
  931.   # ● 地图界面按下鼠标左键的处理
  932.   #--------------------------------------------------------------------------
  933.   def left_button_action
  934.     @moveto_x = $game_map.mouse_map_x
  935.     @moveto_y = $game_map.mouse_map_y
  936.     return mouse_same_pos_action if @moveto_x == @x && @moveto_y == @y
  937.     return if mouse_trigger_event?
  938.     return unless drawable?
  939.     draw_player_move_path
  940.   end
  941.   #--------------------------------------------------------------------------
  942.   # ● 绘制玩家移动路径
  943.   #--------------------------------------------------------------------------
  944.   def draw_player_move_path
  945.     @mouse_dash = true if Mouse.double_click?# 双击冲刺
  946.     if Input.key_states[1] % 10 == 1 #按住鼠标左键10帧绘制1次路径
  947.       $mouse_move_sign.moveto(@moveto_x, @moveto_y) # 移动路径点指示图
  948.       for i in 1..4 # 判断目标点是否为角色周围四点
  949.         if @x == $game_map.round_x_with_direction(@moveto_x, i * 2) &&
  950.            @y == $game_map.round_y_with_direction(@moveto_y, i * 2)
  951.           $mouse_move_sign.transparent = true
  952.           @mouse_move_path = [10 - i * 2]
  953.           return
  954.         end
  955.       end
  956.       draw_move_path
  957.     end
  958.   end
  959.   #--------------------------------------------------------------------------
  960.   # ● 鼠标位置与玩家一致的处理
  961.   #--------------------------------------------------------------------------
  962.   def mouse_same_pos_action
  963.     unless moving? || (vehicle && !vehicle.movable?)
  964.       check_event_trigger_here([0]) # 判断是否触发重合点事件
  965.       get_on_off_vehicle if !$game_map.setup_starting_event &&
  966.         $game_map.airship.pos?(@x, @y)  # 判断是否要上、下飞艇
  967.     end
  968.   end
  969.   #--------------------------------------------------------------------------
  970.   # ● trigger 鼠标左键的处理
  971.   #--------------------------------------------------------------------------
  972.   def mouse_trigger_event?
  973.     if Input.key_trigger?(0x01)
  974.       $game_map.events_xy(@moveto_x, @moveto_y).each {|event|
  975.         if event.mouse_start?
  976.           event.start
  977.           return true
  978.         end
  979.       }
  980.     end
  981.     return false
  982.   end
  983.   #--------------------------------------------------------------------------
  984.   # ● 绘制移动路径 @array[move_directions...]
  985.   #--------------------------------------------------------------------------
  986.   def draw_move_path
  987.     @mouse_move_path =
  988.     case @vehicle_type
  989.     when :walk; draw_walk_path
  990.     when :boat; draw_boat_path
  991.     when :ship; draw_ship_path
  992.     when :airship; draw_air_path
  993.     end
  994.   end
  995.   #--------------------------------------------------------------------------
  996.   # ● 判定是否可以绘制移动路径
  997.   #--------------------------------------------------------------------------
  998.   def drawable?
  999.     return false if @move_route_forcing || @followers.gathering?
  1000.     return false if @vehicle_getting_on || @vehicle_getting_off
  1001.     return true
  1002.   end
  1003.   #--------------------------------------------------------------------------
  1004.   # ● 绘制行走路径 @array[move_directions...]
  1005.   #--------------------------------------------------------------------------
  1006.   def draw_walk_path
  1007.     # 准备绘制路径表格
  1008.     sheet = Table.new($game_map.width, $game_map.height)
  1009.     reversed_chase_path  = []; chase_path  = []
  1010.     reversed_chase_point = []; chase_point = []
  1011.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]
  1012.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2
  1013.     reach_point = false
  1014.     step = 3
  1015.     loop do #loop1 开始填充表格
  1016.      draw_path = false
  1017.      check_points = new_start_points
  1018.      new_start_points = []
  1019.       loop do #loop2 从起点开始正向填充
  1020.         point_x = check_points.shift
  1021.         break if point_x == nil
  1022.         point_y = check_points.shift
  1023.         left_x  = $game_map.round_x(point_x - 1)
  1024.         right_x = $game_map.round_x(point_x + 1)
  1025.         up_y    = $game_map.round_y(point_y - 1)
  1026.         down_y  = $game_map.round_y(point_y + 1)
  1027.                     # 判断路径是否连通
  1028.         path_step = step - 1
  1029.         if sheet[left_x, point_y] == path_step     &&
  1030.            $game_map.passable?(left_x, point_y, 6) &&
  1031.            $game_map.passable?(point_x, point_y, 4)
  1032.           chase_path.push(4)
  1033.           chase_point = [left_x, point_y]
  1034.           reversed_chase_point = [point_x, point_y]
  1035.           reach_point = true; break
  1036.         elsif sheet[right_x, point_y] == path_step     &&
  1037.               $game_map.passable?(right_x, point_y, 4) &&
  1038.               $game_map.passable?(point_x, point_y, 6)
  1039.             chase_path.push(6)
  1040.             chase_point = [right_x, point_y]
  1041.             reversed_chase_point = [point_x, point_y]
  1042.             reach_point = true; break
  1043.         elsif sheet[point_x, up_y] == path_step     &&
  1044.               $game_map.passable?(point_x, up_y, 2) &&
  1045.               $game_map.passable?(point_x, point_y, 8)
  1046.             chase_path.push(8)
  1047.             chase_point = [point_x, up_y]
  1048.             reversed_chase_point = [point_x, point_y]
  1049.             reach_point = true; break
  1050.         elsif sheet[point_x, down_y] == path_step     &&
  1051.               $game_map.passable?(point_x, down_y, 8) &&
  1052.               $game_map.passable?(point_x, point_y, 2)
  1053.             chase_path.push(2)
  1054.             chase_point = [point_x, down_y]
  1055.             reversed_chase_point = [point_x, point_y]
  1056.             reach_point = true; break
  1057.         end
  1058.         # 以需要抵达该点的步数填充路径表格 #
  1059.         if sheet[left_x, point_y] == 0              &&
  1060.            $game_map.passable?(left_x, point_y, 6)  &&
  1061.            !collide_with_events?(left_x, point_y)   &&
  1062.            $game_map.passable?(point_x, point_y, 4) &&
  1063.            !collide_with_vehicles?(left_x, point_y) #judge_end
  1064.           sheet[left_x, point_y] = step
  1065.           draw_path = true
  1066.           new_start_points.push(left_x, point_y)
  1067.         end
  1068.         if sheet[right_x, point_y] == 0             &&
  1069.            $game_map.passable?(right_x, point_y, 4) &&
  1070.            !collide_with_events?(right_x, point_y)  &&
  1071.            $game_map.passable?(point_x, point_y, 6) &&
  1072.            !collide_with_vehicles?(right_x, point_y)#judge_end
  1073.           sheet[right_x, point_y] = step
  1074.           draw_path = true
  1075.           new_start_points.push(right_x, point_y)
  1076.         end
  1077.         if sheet[point_x, up_y] == 0                &&
  1078.            $game_map.passable?(point_x, up_y, 2)    &&
  1079.            !collide_with_events?(point_x, up_y)     &&
  1080.            $game_map.passable?(point_x, point_y, 8) &&
  1081.            !collide_with_vehicles?(point_x, up_y)   #judge_end
  1082.           sheet[point_x, up_y] = step
  1083.           draw_path = true
  1084.           new_start_points.push(point_x, up_y)
  1085.         end
  1086.         if sheet[point_x, down_y] == 0              &&
  1087.            $game_map.passable?(point_x, down_y, 8)  &&
  1088.            !collide_with_events?(point_x, down_y)   &&
  1089.            $game_map.passable?(point_x, point_y, 2) &&
  1090.            !collide_with_vehicles?(point_x, down_y) #judge_end
  1091.           sheet[point_x, down_y] = step
  1092.           draw_path = true
  1093.           new_start_points.push(point_x, down_y)
  1094.         end
  1095.       end#endOfLoop2
  1096.       break if !draw_path || reach_point
  1097.       draw_path = false
  1098.       check_points = new_end_points
  1099.       new_end_points = []
  1100.       step += 1
  1101.       break if step > KsOfSion::Break_Steps &&
  1102.                !Input.key_press?(KsOfSion::Find_Path_Key)
  1103.       loop do #loop3 从终点开始反向填充
  1104.         point_x = check_points.shift
  1105.         break if point_x == nil
  1106.         point_y = check_points.shift
  1107.         left_x  = $game_map.round_x(point_x - 1)
  1108.         right_x = $game_map.round_x(point_x + 1)
  1109.         up_y    = $game_map.round_y(point_y - 1)
  1110.         down_y  = $game_map.round_y(point_y + 1)
  1111.         # 判断路径是否连通
  1112.         path_step = step - 1
  1113.         if sheet[left_x, point_y] == path_step     &&
  1114.            $game_map.passable?(left_x, point_y, 6) &&
  1115.            $game_map.passable?(point_x, point_y, 4)
  1116.           chase_path.push(6)
  1117.           chase_point = [point_x, point_y]
  1118.           reversed_chase_point = [left_x, point_y]
  1119.           reach_point = true; break
  1120.         elsif sheet[right_x, point_y] == path_step     &&
  1121.               $game_map.passable?(right_x, point_y, 4) &&
  1122.               $game_map.passable?(point_x, point_y, 6)
  1123.             chase_path.push(4)
  1124.             chase_point = [point_x, point_y]
  1125.             reversed_chase_point = [right_x, point_y]
  1126.             reach_point = true; break
  1127.         elsif sheet[point_x, up_y] == path_step     &&
  1128.               $game_map.passable?(point_x, up_y, 2) &&
  1129.               $game_map.passable?(point_x, point_y, 8)
  1130.             chase_path.push(2)
  1131.             chase_point = [point_x, point_y]
  1132.             reversed_chase_point = [point_x, up_y]
  1133.             reach_point = true; break
  1134.         elsif sheet[point_x, down_y] == path_step     &&
  1135.               $game_map.passable?(point_x, down_y, 8) &&
  1136.               $game_map.passable?(point_x, point_y, 2)
  1137.             chase_path.push(8)
  1138.             chase_point = [point_x, point_y]
  1139.             reversed_chase_point = [point_x, down_y]
  1140.             reach_point = true; break
  1141.         end
  1142.         # 以需要抵达该点的步数填充路径表格 #
  1143.         if sheet[left_x, point_y] == 0              &&
  1144.            $game_map.passable?(left_x, point_y, 6)  &&
  1145.            !collide_with_events?(left_x, point_y)   &&
  1146.            $game_map.passable?(point_x, point_y, 4) &&
  1147.            !collide_with_vehicles?(left_x, point_y) #judge_end
  1148.           sheet[left_x, point_y] = step
  1149.           draw_path = true
  1150.           new_end_points.push(left_x, point_y)
  1151.         end
  1152.         if sheet[right_x, point_y] == 0             &&
  1153.            $game_map.passable?(right_x, point_y, 4) &&
  1154.            !collide_with_events?(right_x, point_y)  &&
  1155.            $game_map.passable?(point_x, point_y, 6) &&
  1156.            !collide_with_vehicles?(right_x, point_y)#judge_end
  1157.           sheet[right_x, point_y] = step
  1158.           draw_path = true
  1159.           new_end_points.push(right_x, point_y)
  1160.         end
  1161.         if sheet[point_x, up_y] == 0                &&
  1162.            $game_map.passable?(point_x, up_y, 2)    &&
  1163.            !collide_with_events?(point_x, up_y)     &&
  1164.            $game_map.passable?(point_x, point_y, 8) &&
  1165.            !collide_with_vehicles?(point_x, up_y)   #judge_end
  1166.           sheet[point_x, up_y] = step
  1167.           draw_path = true
  1168.           new_end_points.push(point_x, up_y)
  1169.         end
  1170.         if sheet[point_x, down_y] == 0              &&
  1171.            $game_map.passable?(point_x, down_y, 8)  &&
  1172.            !collide_with_events?(point_x, down_y)   &&
  1173.            $game_map.passable?(point_x, point_y, 2) &&
  1174.            !collide_with_vehicles?(point_x, down_y) #judge_end
  1175.           sheet[point_x, down_y] = step
  1176.           draw_path = true
  1177.           new_end_points.push(point_x, down_y)
  1178.         end
  1179.       end#endOfLoop3
  1180.       break if !draw_path || reach_point
  1181.       step += 1
  1182.     end #endOfLoop1 路径表格填充完毕
  1183.     $mouse_move_sign.transparent = false
  1184.     # 判断指定地点能否抵达
  1185.     if reach_point
  1186.       $mouse_move_sign.direction = 2
  1187.     else
  1188.       return not_reach_point
  1189.     end
  1190.     # 根据路径表格绘制最短移动路径(反向)
  1191.     steps = step / 2 * 2 + 1
  1192.     loop_times = step / 2
  1193.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]
  1194.     for i in 1..loop_times # forLoop
  1195.     steps -= 2
  1196.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1197.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
  1198.             $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
  1199.             $game_map.passable?(point_x, point_y, 4)                #judge_end
  1200.         reversed_chase_path.push(6)
  1201.         point_x = $game_map.round_x(point_x - 1)
  1202.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
  1203.             $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
  1204.             $game_map.passable?(point_x, point_y, 6)                #judge_end
  1205.         reversed_chase_path.push(4)
  1206.         point_x = $game_map.round_x(point_x + 1)
  1207.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
  1208.             $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
  1209.             $game_map.passable?(point_x, point_y, 2)                #judge_end
  1210.         reversed_chase_path.push(8)
  1211.         point_y = $game_map.round_y(point_y + 1)
  1212.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
  1213.             $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
  1214.             $game_map.passable?(point_x, point_y, 8)                #judge_end
  1215.         reversed_chase_path.push(2)
  1216.         point_y = $game_map.round_y(point_y - 1)
  1217.       end
  1218.     else
  1219.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
  1220.             $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
  1221.             $game_map.passable?(point_x, point_y, 2)                #judge_end
  1222.         reversed_chase_path.push(8)
  1223.         point_y = $game_map.round_y(point_y + 1)
  1224.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
  1225.             $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
  1226.             $game_map.passable?(point_x, point_y, 8)                #judge_end
  1227.         reversed_chase_path.push(2)
  1228.         point_y = $game_map.round_y(point_y - 1)
  1229.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
  1230.             $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
  1231.             $game_map.passable?(point_x, point_y, 4)                #judge_end
  1232.         reversed_chase_path.push(6)
  1233.         point_x = $game_map.round_x(point_x - 1)
  1234.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
  1235.             $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
  1236.             $game_map.passable?(point_x, point_y, 6)                #judge_end
  1237.         reversed_chase_path.push(4)
  1238.         point_x = $game_map.round_x(point_x + 1)
  1239.       end
  1240.     end
  1241.     end #endOfForLoop
  1242.     # 根据路径表格绘制最短移动路径(正向)
  1243.     steps = step / 2 * 2
  1244.     loop_times = step / 2
  1245.     point_x, point_y = chase_point[0], chase_point[1]
  1246.     for i in 2..loop_times # forLoop
  1247.     steps -= 2
  1248.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1249.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
  1250.             $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
  1251.             $game_map.passable?(point_x, point_y, 2)                #judge_end
  1252.         chase_path.push(2)
  1253.         point_y = $game_map.round_y(point_y + 1)
  1254.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
  1255.             $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
  1256.             $game_map.passable?(point_x, point_y, 8)                #judge_end
  1257.         chase_path.push(8)
  1258.         point_y = $game_map.round_y(point_y - 1)
  1259.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
  1260.             $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
  1261.             $game_map.passable?(point_x, point_y, 4)                #judge_end
  1262.         chase_path.push(4)
  1263.         point_x = $game_map.round_x(point_x - 1)
  1264.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
  1265.             $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
  1266.             $game_map.passable?(point_x, point_y, 6)                #judge_end
  1267.         chase_path.push(6)
  1268.         point_x = $game_map.round_x(point_x + 1)
  1269.       end
  1270.     else
  1271.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
  1272.             $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) &&
  1273.             $game_map.passable?(point_x, point_y, 4)                #judge_end
  1274.         chase_path.push(4)
  1275.         point_x = $game_map.round_x(point_x - 1)
  1276.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
  1277.             $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) &&
  1278.             $game_map.passable?(point_x, point_y, 6)                #judge_end
  1279.         chase_path.push(6)
  1280.         point_x = $game_map.round_x(point_x + 1)
  1281.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
  1282.             $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) &&
  1283.             $game_map.passable?(point_x, point_y, 2)                #judge_end
  1284.         chase_path.push(2)
  1285.         point_y = $game_map.round_y(point_y + 1)
  1286.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
  1287.             $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) &&
  1288.             $game_map.passable?(point_x, point_y, 8)                #judge_end
  1289.         chase_path.push(8)
  1290.         point_y = $game_map.round_y(point_y - 1)
  1291.       end
  1292.     end
  1293.     end #endOfForLoop
  1294.     reversed_chase_path.reverse + chase_path
  1295.   end#walk
  1296.   ##
  1297.   def not_reach_point
  1298.     $mouse_move_sign.direction = 4
  1299.     dx = 0; dy = 0; dir = 0
  1300.     if @moveto_x - x > 0
  1301.       if @moveto_x - x > $game_map.width - @moveto_x + x &&
  1302.           $game_map.loop_vertical?
  1303.         dx = $game_map.width - @moveto_x + x; dir = 4
  1304.       else
  1305.         dx = @moveto_x - x; dir = 6
  1306.       end
  1307.     else
  1308.       if x - @moveto_x > $game_map.width - x + @moveto_x &&
  1309.           $game_map.loop_vertical?
  1310.         dx = $game_map.width - x + @moveto_x; dir = 6
  1311.       else
  1312.         dx = x - @moveto_x; dir = 4
  1313.       end
  1314.     end
  1315.     if @moveto_y - y > 0
  1316.       if @moveto_y - y > $game_map.height - @moveto_y + y &&
  1317.           $game_map.loop_horizontal?
  1318.         dy = $game_map.height - @moveto_y + y
  1319.         dir = 8 if dy > dx
  1320.       else
  1321.         dy = @moveto_y - y
  1322.         dir = 2 if dy > dx
  1323.       end
  1324.     else
  1325.       if y - @moveto_y > $game_map.height - y + @moveto_y &&
  1326.           $game_map.loop_horizontal?
  1327.         dy = $game_map.height - y + @moveto_y
  1328.         dir = 2 if dy > dx
  1329.       else
  1330.         dy = y - @moveto_y
  1331.         dir = 8 if dy > dx
  1332.       end
  1333.     end
  1334.     return [dir, 0] # 0方向用于防止移动过程中触发事件
  1335.   end
  1336.   #--------------------------------------------------------------------------
  1337.   # ● 绘制boat的移动路径 @array[move_directions...]
  1338.   #--------------------------------------------------------------------------
  1339.   def draw_boat_path
  1340.     # 准备绘制路径表格
  1341.     sheet = Table.new($game_map.width, $game_map.height)
  1342.     reversed_chase_path  = []; chase_path  = []
  1343.     reversed_chase_point = []; chase_point = []
  1344.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]
  1345.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2
  1346.     reach_point = false
  1347.     step = 3
  1348.     loop do #loop1 开始填充表格
  1349.      draw_path = false
  1350.      check_points = new_start_points
  1351.      new_start_points = []
  1352.       loop do #loop2 从起点开始正向填充
  1353.         point_x = check_points.shift
  1354.         break if point_x == nil
  1355.         point_y = check_points.shift
  1356.         left_x  = $game_map.round_x(point_x - 1)
  1357.         right_x = $game_map.round_x(point_x + 1)
  1358.         up_y    = $game_map.round_y(point_y - 1)
  1359.         down_y  = $game_map.round_y(point_y + 1)
  1360.                     # 判断路径是否连通
  1361.         path_step = step - 1
  1362.         if sheet[left_x, point_y] == path_step
  1363.           chase_path.push(4)
  1364.           chase_point = [left_x, point_y]
  1365.           reversed_chase_point = [point_x, point_y]
  1366.           reach_point = true; break
  1367.         elsif sheet[right_x, point_y] == path_step
  1368.             chase_path.push(6)
  1369.             chase_point = [right_x, point_y]
  1370.             reversed_chase_point = [point_x, point_y]
  1371.             reach_point = true; break
  1372.         elsif sheet[point_x, up_y] == path_step
  1373.             chase_path.push(8)
  1374.             chase_point = [point_x, up_y]
  1375.             reversed_chase_point = [point_x, point_y]
  1376.             reach_point = true; break
  1377.         elsif sheet[point_x, down_y] == path_step
  1378.             chase_path.push(2)
  1379.             chase_point = [point_x, down_y]
  1380.             reversed_chase_point = [point_x, point_y]
  1381.             reach_point = true; break
  1382.         end
  1383.         # 以需要抵达该点的步数填充路径表格 #
  1384.         if sheet[left_x, point_y] == 0                &&
  1385.            $game_map.boat_passable?(left_x, point_y)  &&
  1386.            !collide_with_events?(left_x, point_y)     &&
  1387.            !collide_with_vehicles?(left_x, point_y)   #judge_end
  1388.           sheet[left_x, point_y] = step
  1389.           draw_path = true
  1390.           new_start_points.push(left_x, point_y)
  1391.         end
  1392.         if sheet[right_x, point_y] == 0               &&
  1393.            $game_map.boat_passable?(right_x, point_y) &&
  1394.            !collide_with_events?(right_x, point_y)    &&
  1395.            !collide_with_vehicles?(right_x, point_y)  #judge_end
  1396.           sheet[right_x, point_y] = step
  1397.           draw_path = true
  1398.           new_start_points.push(right_x, point_y)
  1399.         end
  1400.         if sheet[point_x, up_y] == 0                  &&
  1401.            $game_map.boat_passable?(point_x, up_y)    &&
  1402.            !collide_with_events?(point_x, up_y)       &&
  1403.            !collide_with_vehicles?(point_x, up_y)     #judge_end
  1404.           sheet[point_x, up_y] = step
  1405.           draw_path = true
  1406.           new_start_points.push(point_x, up_y)
  1407.         end
  1408.         if sheet[point_x, down_y] == 0                &&
  1409.            $game_map.boat_passable?(point_x, down_y)  &&
  1410.            !collide_with_events?(point_x, down_y)     &&
  1411.            !collide_with_vehicles?(point_x, down_y)   #judge_end
  1412.           sheet[point_x, down_y] = step
  1413.           draw_path = true
  1414.           new_start_points.push(point_x, down_y)
  1415.         end
  1416.       end#endOfLoop2
  1417.       break if !draw_path || reach_point
  1418.       draw_path = false
  1419.       check_points = new_end_points
  1420.       new_end_points = []
  1421.       step += 1
  1422.       break if step > KsOfSion::Break_Steps &&
  1423.                !Input.key_press?(KsOfSion::Find_Path_Key)
  1424.       loop do #loop3 从终点开始反向填充
  1425.         point_x = check_points.shift
  1426.         break if point_x == nil
  1427.         point_y = check_points.shift
  1428.         left_x  = $game_map.round_x(point_x - 1)
  1429.         right_x = $game_map.round_x(point_x + 1)
  1430.         up_y    = $game_map.round_y(point_y - 1)
  1431.         down_y  = $game_map.round_y(point_y + 1)
  1432.         # 判断路径是否连通
  1433.         path_step = step - 1
  1434.         if sheet[left_x, point_y] == path_step
  1435.           chase_path.push(6)
  1436.           chase_point = [point_x, point_y]
  1437.           reversed_chase_point = [left_x, point_y]
  1438.           reach_point = true; break
  1439.         elsif sheet[right_x, point_y] == path_step
  1440.             chase_path.push(4)
  1441.             chase_point = [point_x, point_y]
  1442.             reversed_chase_point = [right_x, point_y]
  1443.             reach_point = true; break
  1444.         elsif sheet[point_x, up_y] == path_step
  1445.             chase_path.push(2)
  1446.             chase_point = [point_x, point_y]
  1447.             reversed_chase_point = [point_x, up_y]
  1448.             reach_point = true; break
  1449.         elsif sheet[point_x, down_y] == path_step
  1450.             chase_path.push(8)
  1451.             chase_point = [point_x, point_y]
  1452.             reversed_chase_point = [point_x, down_y]
  1453.             reach_point = true; break
  1454.         end
  1455.         # 以需要抵达该点的步数填充路径表格 #
  1456.         if sheet[left_x, point_y] == 0                &&
  1457.            $game_map.boat_passable?(left_x, point_y)  &&
  1458.            !collide_with_events?(left_x, point_y)     &&
  1459.            !collide_with_vehicles?(left_x, point_y)   #judge_end
  1460.           sheet[left_x, point_y] = step
  1461.           draw_path = true
  1462.           new_end_points.push(left_x, point_y)
  1463.         end
  1464.         if sheet[right_x, point_y] == 0               &&
  1465.            $game_map.boat_passable?(right_x, point_y) &&
  1466.            !collide_with_events?(right_x, point_y)    &&
  1467.            !collide_with_vehicles?(right_x, point_y)  #judge_end
  1468.           sheet[right_x, point_y] = step
  1469.           draw_path = true
  1470.           new_end_points.push(right_x, point_y)
  1471.         end
  1472.         if sheet[point_x, up_y] == 0                  &&
  1473.            $game_map.boat_passable?(point_x, up_y)    &&
  1474.            !collide_with_events?(point_x, up_y)       &&
  1475.            !collide_with_vehicles?(point_x, up_y)     #judge_end
  1476.           sheet[point_x, up_y] = step
  1477.           draw_path = true
  1478.           new_end_points.push(point_x, up_y)
  1479.         end
  1480.         if sheet[point_x, down_y] == 0                &&
  1481.            $game_map.boat_passable?(point_x, down_y)  &&
  1482.            !collide_with_events?(point_x, down_y)     &&
  1483.            !collide_with_vehicles?(point_x, down_y)   #judge_end
  1484.           sheet[point_x, down_y] = step
  1485.           draw_path = true
  1486.           new_end_points.push(point_x, down_y)
  1487.         end
  1488.       end#endOfLoop3
  1489.       break if !draw_path || reach_point
  1490.       step += 1
  1491.     end #endOfLoop1 路径表格填充完毕
  1492.     $mouse_move_sign.transparent = false
  1493.     # 判断指定地点能否抵达
  1494.     reach_point ? $mouse_move_sign.direction = 2 : (return not_reach_point)
  1495.     # 根据路径表格绘制最短移动路径(正向)
  1496.     steps = step / 2 * 2
  1497.     loop_times = step / 2
  1498.     point_x, point_y = chase_point[0], chase_point[1]
  1499.     for i in 2..loop_times # forLoop
  1500.     steps -= 2
  1501.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1502.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1503.         chase_path.push(2)
  1504.         point_y = $game_map.round_y(point_y + 1)
  1505.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1506.         chase_path.push(8)
  1507.         point_y = $game_map.round_y(point_y - 1)
  1508.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1509.         chase_path.push(4)
  1510.         point_x = $game_map.round_x(point_x - 1)
  1511.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1512.         chase_path.push(6)
  1513.         point_x = $game_map.round_x(point_x + 1)
  1514.       end
  1515.     else
  1516.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1517.         chase_path.push(4)
  1518.         point_x = $game_map.round_x(point_x - 1)
  1519.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1520.         chase_path.push(6)
  1521.         point_x = $game_map.round_x(point_x + 1)
  1522.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1523.         chase_path.push(2)
  1524.         point_y = $game_map.round_y(point_y + 1)
  1525.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1526.         chase_path.push(8)
  1527.         point_y = $game_map.round_y(point_y - 1)
  1528.       end
  1529.     end
  1530.     end #endOfForLoop
  1531.     # 如果指定点无法抵达或者登陆
  1532.     return not_reach_point unless landable?(@moveto_x, @moveto_y, chase_path)
  1533.     # 根据路径表格绘制最短移动路径(反向)
  1534.     steps = step / 2 * 2 + 1
  1535.     loop_times = step / 2
  1536.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]
  1537.     for i in 1..loop_times # forLoop
  1538.     steps -= 2
  1539.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1540.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1541.         reversed_chase_path.push(6)
  1542.         point_x = $game_map.round_x(point_x - 1)
  1543.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1544.         reversed_chase_path.push(4)
  1545.         point_x = $game_map.round_x(point_x + 1)
  1546.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1547.         reversed_chase_path.push(8)
  1548.         point_y = $game_map.round_y(point_y + 1)
  1549.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1550.         reversed_chase_path.push(2)
  1551.         point_y = $game_map.round_y(point_y - 1)
  1552.       end
  1553.     else
  1554.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1555.         reversed_chase_path.push(8)
  1556.         point_y = $game_map.round_y(point_y + 1)
  1557.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1558.         reversed_chase_path.push(2)
  1559.         point_y = $game_map.round_y(point_y - 1)
  1560.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1561.         reversed_chase_path.push(6)
  1562.         point_x = $game_map.round_x(point_x - 1)
  1563.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1564.         reversed_chase_path.push(4)
  1565.         point_x = $game_map.round_x(point_x + 1)
  1566.       end
  1567.     end
  1568.     end #endOfForLoop
  1569.     return reversed_chase_path.reverse + chase_path
  1570.   end#boat
  1571.   #--------------------------------------------------------------------------
  1572.   # ● 绘制ship的移动路径 @array[move_directions...]
  1573.   #--------------------------------------------------------------------------
  1574.   def draw_ship_path
  1575.     # 准备绘制路径表格
  1576.     sheet = Table.new($game_map.width, $game_map.height)
  1577.     reversed_chase_path  = []; chase_path  = []
  1578.     reversed_chase_point = []; chase_point = []
  1579.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]
  1580.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2
  1581.     reach_point = false
  1582.     step = 3
  1583.     loop do #loop1 开始填充表格
  1584.      draw_path = false
  1585.      check_points = new_start_points
  1586.      new_start_points = []
  1587.       loop do #loop2 从起点开始正向填充
  1588.         point_x = check_points.shift
  1589.         break if point_x == nil
  1590.         point_y = check_points.shift
  1591.         left_x  = $game_map.round_x(point_x - 1)
  1592.         right_x = $game_map.round_x(point_x + 1)
  1593.         up_y    = $game_map.round_y(point_y - 1)
  1594.         down_y  = $game_map.round_y(point_y + 1)
  1595.                     # 判断路径是否连通
  1596.         path_step = step - 1
  1597.         if sheet[left_x, point_y] == path_step
  1598.           chase_path.push(4)
  1599.           chase_point = [left_x, point_y]
  1600.           reversed_chase_point = [point_x, point_y]
  1601.           reach_point = true; break
  1602.         elsif sheet[right_x, point_y] == path_step
  1603.             chase_path.push(6)
  1604.             chase_point = [right_x, point_y]
  1605.             reversed_chase_point = [point_x, point_y]
  1606.             reach_point = true; break
  1607.         elsif sheet[point_x, up_y] == path_step
  1608.             chase_path.push(8)
  1609.             chase_point = [point_x, up_y]
  1610.             reversed_chase_point = [point_x, point_y]
  1611.             reach_point = true; break
  1612.         elsif sheet[point_x, down_y] == path_step
  1613.             chase_path.push(2)
  1614.             chase_point = [point_x, down_y]
  1615.             reversed_chase_point = [point_x, point_y]
  1616.             reach_point = true; break
  1617.         end
  1618.         # 以需要抵达该点的步数填充路径表格 #
  1619.         if sheet[left_x, point_y] == 0                &&
  1620.            $game_map.ship_passable?(left_x, point_y)  &&
  1621.            !collide_with_events?(left_x, point_y)     &&
  1622.            !collide_with_vehicles?(left_x, point_y)   #judge_end
  1623.           sheet[left_x, point_y] = step
  1624.           draw_path = true
  1625.           new_start_points.push(left_x, point_y)
  1626.         end
  1627.         if sheet[right_x, point_y] == 0               &&
  1628.            $game_map.ship_passable?(right_x, point_y) &&
  1629.            !collide_with_events?(right_x, point_y)    &&
  1630.            !collide_with_vehicles?(right_x, point_y)  #judge_end
  1631.           sheet[right_x, point_y] = step
  1632.           draw_path = true
  1633.           new_start_points.push(right_x, point_y)
  1634.         end
  1635.         if sheet[point_x, up_y] == 0                  &&
  1636.            $game_map.ship_passable?(point_x, up_y)    &&
  1637.            !collide_with_events?(point_x, up_y)       &&
  1638.            !collide_with_vehicles?(point_x, up_y)     #judge_end
  1639.           sheet[point_x, up_y] = step
  1640.           draw_path = true
  1641.           new_start_points.push(point_x, up_y)
  1642.         end
  1643.         if sheet[point_x, down_y] == 0                &&
  1644.            $game_map.ship_passable?(point_x, down_y)  &&
  1645.            !collide_with_events?(point_x, down_y)     &&
  1646.            !collide_with_vehicles?(point_x, down_y)   #judge_end
  1647.           sheet[point_x, down_y] = step
  1648.           draw_path = true
  1649.           new_start_points.push(point_x, down_y)
  1650.         end
  1651.       end#endOfLoop2
  1652.       break if !draw_path || reach_point
  1653.       draw_path = false
  1654.       check_points = new_end_points
  1655.       new_end_points = []
  1656.       step += 1
  1657.       break if step > KsOfSion::Break_Steps &&
  1658.                !Input.key_press?(KsOfSion::Find_Path_Key)
  1659.       loop do #loop3 从终点开始反向填充
  1660.         point_x = check_points.shift
  1661.         break if point_x == nil
  1662.         point_y = check_points.shift
  1663.         left_x  = $game_map.round_x(point_x - 1)
  1664.         right_x = $game_map.round_x(point_x + 1)
  1665.         up_y    = $game_map.round_y(point_y - 1)
  1666.         down_y  = $game_map.round_y(point_y + 1)
  1667.         # 判断路径是否连通
  1668.         path_step = step - 1
  1669.         if sheet[left_x, point_y] == path_step
  1670.           chase_path.push(6)
  1671.           chase_point = [point_x, point_y]
  1672.           reversed_chase_point = [left_x, point_y]
  1673.           reach_point = true; break
  1674.         elsif sheet[right_x, point_y] == path_step
  1675.             chase_path.push(4)
  1676.             chase_point = [point_x, point_y]
  1677.             reversed_chase_point = [right_x, point_y]
  1678.             reach_point = true; break
  1679.         elsif sheet[point_x, up_y] == path_step
  1680.             chase_path.push(2)
  1681.             chase_point = [point_x, point_y]
  1682.             reversed_chase_point = [point_x, up_y]
  1683.             reach_point = true; break
  1684.         elsif sheet[point_x, down_y] == path_step
  1685.             chase_path.push(8)
  1686.             chase_point = [point_x, point_y]
  1687.             reversed_chase_point = [point_x, down_y]
  1688.             reach_point = true; break
  1689.         end
  1690.         # 以需要抵达该点的步数填充路径表格 #
  1691.         if sheet[left_x, point_y] == 0                &&
  1692.            $game_map.ship_passable?(left_x, point_y)  &&
  1693.            !collide_with_events?(left_x, point_y)     &&
  1694.            !collide_with_vehicles?(left_x, point_y)   #judge_end
  1695.           sheet[left_x, point_y] = step
  1696.           draw_path = true
  1697.           new_end_points.push(left_x, point_y)
  1698.         end
  1699.         if sheet[right_x, point_y] == 0               &&
  1700.            $game_map.ship_passable?(right_x, point_y) &&
  1701.            !collide_with_events?(right_x, point_y)    &&
  1702.            !collide_with_vehicles?(right_x, point_y)  #judge_end
  1703.           sheet[right_x, point_y] = step
  1704.           draw_path = true
  1705.           new_end_points.push(right_x, point_y)
  1706.         end
  1707.         if sheet[point_x, up_y] == 0                  &&
  1708.            $game_map.ship_passable?(point_x, up_y)    &&
  1709.            !collide_with_events?(point_x, up_y)       &&
  1710.            !collide_with_vehicles?(point_x, up_y)     #judge_end
  1711.           sheet[point_x, up_y] = step
  1712.           draw_path = true
  1713.           new_end_points.push(point_x, up_y)
  1714.         end
  1715.         if sheet[point_x, down_y] == 0                &&
  1716.            $game_map.ship_passable?(point_x, down_y)  &&
  1717.            !collide_with_events?(point_x, down_y)     &&
  1718.            !collide_with_vehicles?(point_x, down_y)   #judge_end
  1719.           sheet[point_x, down_y] = step
  1720.           draw_path = true
  1721.           new_end_points.push(point_x, down_y)
  1722.         end
  1723.       end#endOfLoop3
  1724.       break if !draw_path || reach_point
  1725.       step += 1
  1726.     end #endOfLoop1 路径表格填充完毕
  1727.     $mouse_move_sign.transparent = false
  1728.     # 判断指定地点能否抵达
  1729.     reach_point ? $mouse_move_sign.direction = 2 : (return not_reach_point)
  1730.     # 根据路径表格绘制最短移动路径(正向)
  1731.     steps = step / 2 * 2
  1732.     loop_times = step / 2
  1733.     point_x, point_y = chase_point[0], chase_point[1]
  1734.     for i in 2..loop_times # forLoop
  1735.     steps -= 2
  1736.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1737.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1738.         chase_path.push(2)
  1739.         point_y = $game_map.round_y(point_y + 1)
  1740.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1741.         chase_path.push(8)
  1742.         point_y = $game_map.round_y(point_y - 1)
  1743.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1744.         chase_path.push(4)
  1745.         point_x = $game_map.round_x(point_x - 1)
  1746.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1747.         chase_path.push(6)
  1748.         point_x = $game_map.round_x(point_x + 1)
  1749.       end
  1750.     else
  1751.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1752.         chase_path.push(4)
  1753.         point_x = $game_map.round_x(point_x - 1)
  1754.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1755.         chase_path.push(6)
  1756.         point_x = $game_map.round_x(point_x + 1)
  1757.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1758.         chase_path.push(2)
  1759.         point_y = $game_map.round_y(point_y + 1)
  1760.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1761.         chase_path.push(8)
  1762.         point_y = $game_map.round_y(point_y - 1)
  1763.       end
  1764.     end
  1765.     end #endOfForLoop
  1766.     # 如果指定点无法抵达或者登陆
  1767.     return not_reach_point unless landable?(@moveto_x, @moveto_y, chase_path)
  1768.     # 根据路径表格绘制最短移动路径(反向)
  1769.     steps = step / 2 * 2 + 1
  1770.     loop_times = step / 2
  1771.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]
  1772.     for i in 1..loop_times # forLoop
  1773.     steps -= 2
  1774.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1775.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1776.         reversed_chase_path.push(6)
  1777.         point_x = $game_map.round_x(point_x - 1)
  1778.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1779.         reversed_chase_path.push(4)
  1780.         point_x = $game_map.round_x(point_x + 1)
  1781.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1782.         reversed_chase_path.push(8)
  1783.         point_y = $game_map.round_y(point_y + 1)
  1784.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1785.         reversed_chase_path.push(2)
  1786.         point_y = $game_map.round_y(point_y - 1)
  1787.       end
  1788.     else
  1789.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
  1790.         reversed_chase_path.push(8)
  1791.         point_y = $game_map.round_y(point_y + 1)
  1792.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
  1793.         reversed_chase_path.push(2)
  1794.         point_y = $game_map.round_y(point_y - 1)
  1795.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
  1796.         reversed_chase_path.push(6)
  1797.         point_x = $game_map.round_x(point_x - 1)
  1798.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
  1799.         reversed_chase_path.push(4)
  1800.         point_x = $game_map.round_x(point_x + 1)
  1801.       end
  1802.     end
  1803.     end #endOfForLoop
  1804.     return reversed_chase_path.reverse + chase_path
  1805.   end#ship
  1806.   #--------------------------------------------------------------------------
  1807.   # ● 绘制airship的移动路径 @array[move_directions...]
  1808.   #--------------------------------------------------------------------------
  1809.   def draw_air_path
  1810.     $mouse_move_sign.transparent = false
  1811.     # 准备绘制路径表格
  1812.     sheet = Table.new($game_map.width, $game_map.height)
  1813.     new_check_point = [x, y]; sheet[x, y] = 1
  1814.     reach_point = false;      step = 2
  1815.     loop do #loop1
  1816.      check_point = new_check_point
  1817.      new_check_point = []
  1818.       loop do #loop2
  1819.         point_x = check_point.shift
  1820.         break if point_x == nil
  1821.         point_y = check_point.shift
  1822.         if point_x == @moveto_x && point_y == @moveto_y
  1823.           reach_point = true; break
  1824.         end
  1825.         left_x  = $game_map.round_x(point_x - 1)
  1826.         right_x = $game_map.round_x(point_x + 1)
  1827.         up_y    = $game_map.round_y(point_y - 1)
  1828.         down_y  = $game_map.round_y(point_y + 1)
  1829.         # 以需要抵达该点的步数填充路径表格 #
  1830.         if sheet[left_x, point_y] == 0
  1831.           sheet[left_x, point_y] = step
  1832.           new_check_point.push(left_x, point_y)
  1833.         end
  1834.         if sheet[right_x, point_y] == 0
  1835.           sheet[right_x, point_y] = step
  1836.           new_check_point.push(right_x, point_y)
  1837.         end
  1838.         if sheet[point_x, up_y] == 0
  1839.           sheet[point_x, up_y] = step
  1840.           new_check_point.push(point_x, up_y)
  1841.         end
  1842.         if sheet[point_x, down_y] == 0
  1843.           sheet[point_x, down_y] = step
  1844.           new_check_point.push(point_x, down_y)
  1845.         end
  1846.       end#endOfLoop2
  1847.       break if reach_point
  1848.       step += 1
  1849.     end #endOfLoop1
  1850.     # 根据路径表格绘制最短移动路径 #
  1851.     reversed_chase_path = []; step -= 1
  1852.     point_x, point_y = @moveto_x, @moveto_y
  1853.     for i in 2..step
  1854.     step -= 1
  1855.     if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs
  1856.       if    sheet[$game_map.round_x(point_x - 1), point_y] == step
  1857.         reversed_chase_path.push(6)
  1858.         point_x = $game_map.round_x(point_x - 1)
  1859.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == step
  1860.         reversed_chase_path.push(4)
  1861.         point_x = $game_map.round_x(point_x + 1)
  1862.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == step
  1863.         reversed_chase_path.push(8)
  1864.         point_y = $game_map.round_y(point_y + 1)
  1865.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step
  1866.         reversed_chase_path.push(2)
  1867.         point_y = $game_map.round_y(point_y - 1)
  1868.       end
  1869.     else
  1870.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == step
  1871.         reversed_chase_path.push(8)
  1872.         point_y = $game_map.round_y(point_y + 1)
  1873.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step
  1874.         reversed_chase_path.push(2)
  1875.         point_y = $game_map.round_y(point_y - 1)
  1876.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == step
  1877.         reversed_chase_path.push(6)
  1878.         point_x = $game_map.round_x(point_x - 1)
  1879.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == step
  1880.         reversed_chase_path.push(4)
  1881.         point_x = $game_map.round_x(point_x + 1)
  1882.       end
  1883.     end
  1884.     end #endOfForLoop
  1885.     return reversed_chase_path.reverse
  1886.   end#airship
  1887.   #--------------------------------------------------------------------------
  1888.   # ● 判断目标点是否能抵达、登陆,用于船只路径绘制
  1889.   #--------------------------------------------------------------------------
  1890.   def landable?(x, y, path)
  1891.     case @vehicle_type
  1892.       when :ship; return $game_map.ship_passable?(x, y) ||
  1893.         $game_map.passable?(x, y, 10 - path[-1])
  1894.       when :boat; return $game_map.boat_passable?(x, y) ||
  1895.         $game_map.passable?(x, y, 10 - path[-1])
  1896.     end
  1897.   end
  1898. end
  1899.  
  1900. #==============================================================================
  1901. # ■ Game_Map
  1902. #------------------------------------------------------------------------------
  1903. #  管理地图的类。拥有卷动地图以及判断通行度的功能。
  1904. #   本类的实例请参考 $game_map 。
  1905. #==============================================================================
  1906. class Game_Map
  1907.   #--------------------------------------------------------------------------
  1908.   # ● 初始化对象
  1909.   #--------------------------------------------------------------------------
  1910.   alias sion_mouse_initialize initialize
  1911.   def initialize
  1912.     sion_mouse_initialize
  1913.     creat_move_sign  ###
  1914.     set_constants
  1915.   end
  1916.   #--------------------------------------------------------------------------
  1917.   # ● 更新画面
  1918.   #     main : 事件解释器更新的标志
  1919.   #--------------------------------------------------------------------------
  1920.   alias sion_mouse_update update
  1921.   def update(main = false)
  1922.     sion_mouse_update(main)
  1923.     update_move_sign
  1924.   end
  1925.   #--------------------------------------------------------------------------
  1926.   # ● 设置显示位置
  1927.   #--------------------------------------------------------------------------
  1928.   alias sion_mouse_set_display_pos set_display_pos
  1929.   def set_display_pos(x, y)
  1930.     sion_mouse_set_display_pos(x, y)
  1931.     @_display_y_ = @display_y
  1932.     @_display_x_ = @display_x
  1933.   end
  1934.   #--------------------------------------------------------------------------
  1935.   # ● 创建显示路径点的事件
  1936.   #--------------------------------------------------------------------------
  1937.   def creat_move_sign
  1938.     $mouse_move_sign = Move_Sign.new
  1939.   end
  1940.   #--------------------------------------------------------------------------
  1941.   # ● 更新显示路径点的事件
  1942.   #--------------------------------------------------------------------------
  1943.   def set_constants
  1944.     @mouse_pos_setted = true
  1945.     @set_pos_prepared = false
  1946.     @mouse_old_x = 0
  1947.     @mouse_old_y = 0
  1948.   end
  1949.   #--------------------------------------------------------------------------
  1950.   # ● 更新显示路径点的事件
  1951.   #--------------------------------------------------------------------------
  1952.   def update_move_sign
  1953.     $mouse_move_sign.update
  1954.   end
  1955.   #--------------------------------------------------------------------------
  1956.   # ● 获取鼠标位于的地图块的x、y坐标
  1957.   #--------------------------------------------------------------------------
  1958.   def mouse_map_x
  1959.     round_x((@display_x + Mouse.x / 32.0).to_i)
  1960.   end
  1961.   def mouse_map_y
  1962.     round_y((@display_y + Mouse.y / 32.0).to_i)
  1963.   end
  1964.   #--------------------------------------------------------------------------
  1965.   # ● 返回地图画面时重设鼠标坐标
  1966.   #--------------------------------------------------------------------------
  1967.   def reset_mouse_pos
  1968.     return if @mouse_pos_setted
  1969.     Mouse.set_pos(@mouse_old_x, @mouse_old_y)
  1970.     @mouse_pos_setted = true
  1971.     @set_pos_prepared = false
  1972.   end
  1973.   #--------------------------------------------------------------------------
  1974.   # ● 重设鼠标的坐标
  1975.   #--------------------------------------------------------------------------
  1976.   def prepare_reset_mouse_pos
  1977.     return if @set_pos_prepared
  1978.     @mouse_pos_setted = false
  1979.     @mouse_old_x = Mouse.x
  1980.     @mouse_old_y = Mouse.y
  1981.     @set_pos_prepared = true
  1982.   end
  1983.   #--------------------------------------------------------------------------
  1984.   # ● 向下卷动
  1985.   #--------------------------------------------------------------------------
  1986.   def new_scroll_down(distance)
  1987.     if loop_vertical?
  1988.       @_display_y_ += distance
  1989.       @_display_y_ %= @map.height
  1990.       @parallax_y += distance if @parallax_loop_y
  1991.     else
  1992.       last_y = @_display_y_
  1993.       @_display_y_ = [@_display_y_ + distance, height - screen_tile_y].min
  1994.       @parallax_y += @_display_y_ - last_y
  1995.     end
  1996.     @display_y = (@_display_y_ * 32).round / 32.0
  1997.   end
  1998.   #--------------------------------------------------------------------------
  1999.   # ● 向左卷动
  2000.   #--------------------------------------------------------------------------
  2001.   def new_scroll_left(distance)
  2002.     if loop_horizontal?
  2003.       @_display_x_ += @map.width - distance
  2004.       @_display_x_ %= @map.width
  2005.       @parallax_x -= distance if @parallax_loop_x
  2006.     else
  2007.       last_x = @_display_x_
  2008.       @_display_x_ = [@_display_x_ - distance, 0].max
  2009.       @parallax_x += @_display_x_ - last_x
  2010.     end
  2011.     @display_x = (@_display_x_ * 32).round / 32.0
  2012.   end
  2013.   #--------------------------------------------------------------------------
  2014.   # ● 向右卷动
  2015.   #--------------------------------------------------------------------------
  2016.   def new_scroll_right(distance)
  2017.     if loop_horizontal?
  2018.       @_display_x_ += distance
  2019.       @_display_x_ %= @map.width
  2020.       @parallax_x += distance if @parallax_loop_x
  2021.     else
  2022.       last_x = @_display_x_
  2023.       @_display_x_ = [@_display_x_ + distance, (width - screen_tile_x)].min
  2024.       @parallax_x += @_display_x_ - last_x
  2025.     end
  2026.     @display_x = (@_display_x_ * 32).round / 32.0
  2027.   end
  2028.   #--------------------------------------------------------------------------
  2029.   # ● 向上卷动
  2030.   #--------------------------------------------------------------------------
  2031.   def new_scroll_up(distance)
  2032.     if loop_vertical?
  2033.       @_display_y_ += @map.height - distance
  2034.       @_display_y_ %= @map.height
  2035.       @parallax_y -= distance if @parallax_loop_y
  2036.     else
  2037.       last_y = @_display_y_
  2038.       @_display_y_ = [@_display_y_ - distance, 0].max
  2039.       @parallax_y += @_display_y_ - last_y
  2040.     end
  2041.     @display_y = (@_display_y_ * 32).round / 32.0
  2042.   end
  2043. end
  2044.  
  2045. #==============================================================================
  2046. # ■ Spriteset_Map
  2047. #------------------------------------------------------------------------------
  2048. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。
  2049. #==============================================================================
  2050. class Spriteset_Map
  2051.   #--------------------------------------------------------------------------
  2052.   # ● 生成路径点精灵
  2053.   #--------------------------------------------------------------------------
  2054.   alias sion_mouse_create_characters create_characters
  2055.   def create_characters
  2056.     sion_mouse_create_characters
  2057.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))
  2058.   end
  2059. end
  2060.  
  2061. #==============================================================================
  2062. # ■ SceneManager
  2063. #==============================================================================
  2064. class << SceneManager
  2065.   alias sion_mouse_snapshot_for_background snapshot_for_background
  2066.   def snapshot_for_background
  2067.     Mouse.sprite.visible = false
  2068.     sion_mouse_snapshot_for_background
  2069.     Mouse.sprite.visible = true
  2070.   end
  2071. end
  2072. #==============================================================================
  2073. # ■ Scene_Map
  2074. #------------------------------------------------------------------------------
  2075. #  地图画面
  2076. #==============================================================================
  2077. class Scene_Map
  2078.   #--------------------------------------------------------------------------
  2079.   # ● 画面更新
  2080.   #--------------------------------------------------------------------------
  2081.   alias sion_mouse_update_scene update_scene
  2082.   def update_scene
  2083.     sion_mouse_update_scene
  2084.     update_mouse_action unless scene_changing? || $game_map.interpreter.running?
  2085.   end
  2086.   #--------------------------------------------------------------------------
  2087.   # ● 场所移动前的处理
  2088.   #--------------------------------------------------------------------------
  2089.   alias sion_mouse_pre_transfer pre_transfer
  2090.   def pre_transfer
  2091.     $game_player.reset_move_path
  2092.     sion_mouse_pre_transfer
  2093.   end
  2094.   #--------------------------------------------------------------------------
  2095.   # ● 监听鼠标左键的按下
  2096.   #--------------------------------------------------------------------------
  2097.   def update_mouse_action
  2098.     $game_player.left_button_action if Input.key_press?(0x01)
  2099.   end
  2100. end
  2101.  
  2102. #==============================================================================
  2103. # ■ Scene_File
  2104. #------------------------------------------------------------------------------
  2105. #  存档画面和读档画面共同的父类
  2106. #==============================================================================
  2107. class Scene_File < Scene_MenuBase
  2108.   #--------------------------------------------------------------------------
  2109.   # ● 开始处理
  2110.   #--------------------------------------------------------------------------
  2111.   alias sion_mouse_start start
  2112.   def start
  2113.     sion_mouse_start
  2114.     @move_state = 0
  2115.     set_mouse_pos
  2116.   end
  2117.   #--------------------------------------------------------------------------
  2118.   # ● 更新画面
  2119.   #--------------------------------------------------------------------------
  2120.   alias sion_mouse_update update
  2121.   def update
  2122.     sion_mouse_update
  2123.     Input.dir4.zero? ? set_cursor : set_mouse_pos
  2124.   end
  2125.   #--------------------------------------------------------------------------
  2126.   # ● 更新光标
  2127.   #--------------------------------------------------------------------------
  2128.   def set_cursor
  2129.     @move_state += 1
  2130.     last_index = @index
  2131.     if mouse_which_window == -2
  2132.       if (@move_state - 1) % 6 == 0
  2133.         @index = (@index + 1) % item_max if @index < item_max - 1
  2134.       end
  2135.     elsif mouse_which_window == -1
  2136.       if (@move_state - 1) % 6 == 0
  2137.         @index = (@index - 1 + item_max) % item_max if @index > 0
  2138.       end
  2139.     else
  2140.       @move_state = 0
  2141.       @index = top_index + mouse_which_window
  2142.     end
  2143.     ensure_cursor_visible
  2144.     if @index != last_index
  2145.       @savefile_windows[last_index].selected = false
  2146.       @savefile_windows[@index].selected = true
  2147.     end
  2148.   end
  2149.   #--------------------------------------------------------------------------
  2150.   # ● 判断鼠标位于哪个窗口
  2151.   #--------------------------------------------------------------------------
  2152.   def mouse_which_window
  2153.     mouse_x = Mouse.x
  2154.     mouse_y = Mouse.y
  2155.     if mouse_y < @help_window.height + 14
  2156.       mouse_row = -1
  2157.     elsif mouse_y > Graphics.height - 14
  2158.       mouse_row = -2
  2159.     else
  2160.       mouse_row = 4 * (mouse_y - @help_window.height) /
  2161.         (Graphics.height - @help_window.height)
  2162.     end
  2163.     return mouse_row
  2164.   end
  2165.   #--------------------------------------------------------------------------
  2166.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
  2167.   #--------------------------------------------------------------------------
  2168.   def set_mouse_pos
  2169.     new_x = 40
  2170.     new_y = @help_window.height + savefile_height * (@index - top_index) + 24
  2171.     Mouse.set_pos(new_x, new_y)
  2172.   end
  2173. end
  2174.  
  2175. #==============================================================================
  2176. # ■ Game_Event
  2177. #------------------------------------------------------------------------------
  2178. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
  2179. #   在 Game_Map 类的内部使用。
  2180. #==============================================================================
  2181. class Game_Event < Game_Character
  2182.   alias_method :sion_mouse_start, :start
  2183.   alias_method :sion_mouse_setup_page, :setup_page
  2184.   def start
  2185.     return if mouse_start? && !Input.key_press?(0x01)
  2186.     sion_mouse_start
  2187.   end
  2188.   def mouse_start?
  2189.     @mouse_start
  2190.   end
  2191.   def setup_page(p)
  2192.     sion_mouse_setup_page(p)
  2193.     sion_mouse_read_event_notes
  2194.   end
  2195.   def sion_mouse_read_event_notes
  2196.     @mouse_start = false
  2197.     @list.each {|cmd| break if sion_mouse_scan_list(cmd)} unless empty?
  2198.   end
  2199.   def sion_mouse_scan_list(cmd)
  2200.     return false unless cmd.code == 108 || cmd.code == 408
  2201.     return @mouse_start = cmd.parameters[0].include?("鼠标启动")
  2202.   end
  2203. end
  2204.  
  2205. #encoding:utf-8
  2206. #==============================================================================
  2207. # ■ BattleManager
  2208. #------------------------------------------------------------------------------
  2209. #  战斗过程的管理器。
  2210. #==============================================================================
  2211. class << BattleManager
  2212.   alias_method :sion_mouse_on_encounter, :on_encounter
  2213.   # 遇敌后重置移动路径
  2214.   def on_encounter
  2215.     $game_player.reset_move_path
  2216.     sion_mouse_on_encounter
  2217.   end
  2218. end
  2219.  
  2220.  
  2221.  
  2222. if $SINOVA #验证组件完整性
  2223.   if $SINOVA[:mouseBase]
  2224.     if $SINOVA[:mouseBase] >= 3.00     #所需组件版本
  2225.       $SINOVA[:mouseBaseSystem] = 3.01 #当前组件版本
  2226.     else
  2227.       msgbox "Sion_MouseBase 版本过低,需 3.00 以上"
  2228.       exit
  2229.     end
  2230.   else
  2231.     msgbox "Nova_TypeIn 需置于 Sion_MouseBase 脚本之下"
  2232.     exit
  2233.   end
  2234. else
  2235.   msgbox "Nova_TypeIn 需置于 NovaBase 脚本之下"
  2236.   exit
  2237. end


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


RUBY 代码复制
  1. #encoding:utf-8
  2. # 输入窗口范例 v1.00 (2014/2/15)
  3. # ·需· SiNova_Input v1.00+
  4.  
  5. # v1.01 优化了转码方式
  6.  
  7. # 事件中调用输入窗:
  8. # typein_active(1) 使用1号变量获取输入字符,其余参数参考下面
  9.  
  10. class Game_Interpreter # ===========================
  11. TypeIn_W = 200 # 默认输入窗宽
  12. TypeIn_H = 30  # 默认输入窗高
  13.  
  14.   def typein_active(   # 参数说明:
  15.  
  16.       var_id ,                       # 接收输入文本的变量号
  17.       w= TypeIn_W,                   # 宽
  18.       h= TypeIn_H,                   # 高
  19.       x= (Graphics.width  - w) / 2 , # x 坐标,默认为居中
  20.       y= (Graphics.height - h) / 2 , # y 坐标,默认为居中
  21.       text= ""                       # 输入窗默认字符
  22.  
  23.     )  # 参数 end
  24.     wait_for_message
  25.     @typeIn_port = TypeIn_Port.new( x, y, w, h, text )
  26.     while @typeIn_port.active # 按下回车跳出循环
  27.       @typeIn_port.update
  28.       Fiber.yield
  29.     end
  30.     $game_variables[var_id] = @typeIn_port.text
  31.     @typeIn_port.dispose
  32.   end
  33.  
  34. end
  35.  
  36. # 输入窗类 ===========================================
  37. class TypeIn_Port < Viewport
  38. attr_reader\
  39. :active,
  40. :text
  41.  
  42.   def padding; 3 end #设置边距
  43.   def backColor; Color.new(0, 0, 0, 150) end #背景颜色
  44.   def cursorColor; Color.new(255, 255, 255) end #光标颜色
  45.  
  46.   def initialize(x, y, w, h, text="")
  47.     super(x, y, w, h)
  48.     setup_sprites(w, h)
  49.     init_members(text)
  50.     refresh_cursor
  51.     update
  52.   end
  53.   #
  54.   def init_members(text)
  55.     @active = true
  56.     @text = text
  57.     setup_apis
  58.   end
  59.   def setup_apis
  60.     API_.call 'SiNova|TypeInActivate|v|l'
  61.     @api_GetTypeInText = API_.new 'SiNova|GetTypeInText|v|p'
  62.     @api_SetTypeInPos  = API_.new 'SiNova|SetTypeInPos|ii|v'
  63.   end
  64.   def setup_sprites(w, h)
  65.     create_back_ground(w, h)
  66.     create_text_field(w, h)
  67.     create_cursor(h)
  68.   end
  69.   #
  70.   def dispose
  71.     API_.call 'SiNova|TypeInDeactivate|v|v'
  72.     dispose_back_ground
  73.     dispose_text_field
  74.     dispose_cursor
  75.     super
  76.   end
  77.   #
  78.  
  79.   # 背景
  80.   def create_back_ground(w, h)
  81.     @back_ground = Sprite.new
  82.     bitmap = Bitmap.new(w, h)
  83.     bitmap.fill_rect( bitmap.rect, backColor )
  84.     @back_ground.bitmap = bitmap
  85.     @back_ground.viewport = self
  86.   end
  87.   def dispose_back_ground
  88.     @back_ground.bitmap.dispose
  89.     @back_ground.dispose
  90.   end
  91.  
  92.  
  93.   # 字符输入区域
  94.   def create_text_field(w, h)
  95.     @text_field = Sprite.new
  96.     @text_field.x = padding
  97.     @text_field.y = padding
  98.     pd = padding * 2
  99.     w -= pd
  100.     h -= pd
  101.     bitmap = Bitmap.new( w, h )
  102.     bitmap.font.size = h
  103.     @text_field.bitmap = bitmap
  104.     @text_field.viewport = self
  105.   end
  106.   def update_text_field #更新输入文字
  107.     t = @api_GetTypeInText.call.clone.force_encoding "utf-8"
  108.     return if t.empty?
  109.     wl = self.rect.width - text_width(@text) - padding
  110.     wn = text_width(t)
  111.     while wn > wl #判断可否加入新文字
  112.       t.chop!
  113.       return if t.empty?
  114.       wn = text_width(t)
  115.     end
  116.     @text.insert(@cursor_i, t)
  117.     redraw_texts
  118.     # 更新光标索引
  119.     @cursor_i += t.length
  120.     @cursor.x += wn
  121.     refresh_cursor
  122.   end
  123.   def dispose_text_field
  124.     @text_field.bitmap.dispose
  125.     @text_field.dispose
  126.   end
  127.  
  128.   # 光标
  129.   def create_cursor(h)
  130.     @cursor = Sprite.new
  131.     @cursor.ox = -4
  132.     @cursor.oy = -padding
  133.     bitmap = Bitmap.new(1, h - padding * 2)
  134.     bitmap.fill_rect( bitmap.rect, cursorColor )
  135.     @cursor.bitmap = bitmap
  136.     @cursor_i = 0
  137.     @cursor.viewport = self
  138.   end
  139.   def update_cursor
  140.     @cursor_c += 1
  141.     if @cursor_c >= 40
  142.       @cursor.visible = !@cursor.visible
  143.       @cursor_c = 0
  144.     end
  145.   end
  146.   def dispose_cursor
  147.     @cursor.bitmap.dispose
  148.     @cursor.dispose
  149.   end
  150.   #
  151.  
  152.   def update
  153.     update_text_field
  154.     update_cursor
  155.     update_input
  156.   end
  157.   def update_input
  158.     if Input.key_repeat? 0x08
  159.       process_backspace
  160.     elsif Input.key_repeat? 0x25
  161.       process_left_arrow
  162.     elsif Input.key_repeat? 0x27
  163.       process_right_arrow
  164.     elsif Input.key_trigger? 0x0D
  165.       process_enter
  166.     elsif Input.key_trigger? 0x1B
  167.       process_esc
  168.     end
  169.   end
  170.  
  171.  
  172.   # 按下回车键的处理
  173.   def process_enter
  174.     @active = false
  175.   end
  176.   # 按下Esc键的处理
  177.   def process_esc
  178.   end
  179.  
  180.   #
  181.   # 删除一个字符
  182.   def process_backspace
  183.     if @cursor_i == 0
  184.       @text = @text[1, @text.length - 1] unless @text.empty?
  185.     else
  186.       @cursor.x -= text_width @text[@cursor_i - 1]
  187.       @text = @text[0, @cursor_i-1] + @text[@cursor_i, @text.length-@cursor_i]
  188.       @cursor_i -= 1
  189.     end
  190.     redraw_texts
  191.     refresh_cursor
  192.   end
  193.  
  194.   #
  195.   def process_left_arrow
  196.     return if @cursor_i == 0
  197.     @cursor.x -= text_width @text[@cursor_i - 1]
  198.     @cursor_i -= 1
  199.     refresh_cursor
  200.   end
  201.   def process_right_arrow
  202.     return if @cursor_i == @text.length
  203.     @cursor.x += text_width @text[@cursor_i]
  204.     @cursor_i += 1
  205.     refresh_cursor
  206.   end
  207.  
  208.   #
  209.   def refresh_cursor
  210.     @cursor.visible = true
  211.     @cursor_c = 0
  212.     @api_SetTypeInPos.call(rect.x + @cursor.x + 2, rect.y + 8)
  213.   end
  214.   #
  215.   def redraw_texts
  216.     @text_field.bitmap.clear
  217.     rect = @text_field.bitmap.rect
  218.     rect.width += 10
  219.     @text_field.bitmap.draw_text( rect, @text )
  220.   end
  221.  
  222. #~   def redraw_texts(nt, nt_w)
  223. #~     x = text_width @text[0, @cursor_i]
  224. #~     w = @text_field.bitmap.width
  225. #~     h = @text_field.bitmap.height
  226. #~     bitmap = Bitmap.new( w, h )
  227. #~     srcR = Rect.new( x, 0, w - x, h )
  228. #~     bitmap.blt( x, 0, @text_field.bitmap, srcR)
  229. #~     @text_field.bitmap.clear_rect( srcR )
  230. #~     @text_field.bitmap.draw_text( srcR, nt )
  231. #~     @text_field.bitmap.blt( x + nt_w, 0, bitmap, srcR )
  232. #~     bitmap.dispose
  233. #~     @text.insert( @cursor_i, nt )
  234. #~   end
  235.  
  236.   def text_width(text)
  237.     @text_field.bitmap.text_size(text).width
  238.   end
  239. end
  240.  
  241. if $SINOVA #验证组件完整性
  242.   if $SINOVA[:input]
  243.     if $SINOVA[:input] >= 1.00 #所需组件版本
  244.       $SINOVA[:typeIn] = 1.01  #当前组件版本
  245.     else
  246.       msgbox "SiNova_Input 版本过低,需 1.00 以上"
  247.       exit
  248.     end
  249.   else
  250.     msgbox "Nova_TypeIn 需置于 SiNova_Input 脚本之下"
  251.     exit
  252.   end
  253. else
  254.   msgbox "Nova_TypeIn 需置于 NovaBase 脚本之下"
  255.   exit
  256. end


RUBY 代码复制
  1. #encoding:utf-8
  2. # SiNova_Input v1.03  (2014/2/15)
  3. # ·需· NovaBase v10000+
  4. # 使用此模块,F1 的按键设置将无用
  5.  
  6. # 1.03 修改一个方法命名
  7. # 1.02 修复脚本内按键判断
  8. # 1.01 可设置按键改为 12 个
  9.  
  10. # 系统保留按键 F5 ~ F9 SHIFT ALT 功能恢复,消除了可能的冲突
  11.  
  12.  
  13. class << Input
  14. attr_reader\
  15. :dir4,
  16. :dir8,
  17. :key_states
  18.  
  19.   def init
  20.     # 在这里查表修改对应按键 0 代表无设置
  21.     # 你可以通过脚本在游戏中调整这些按键,做出在游戏中让玩家设置按键的效果
  22.     # 按键对应 ASCII 值请查看键盘表
  23.     # 例如把“左”设置为 0x41 按下 A 键就可以往左移动了。
  24.     #  WASD 的值都写在下面了,自己填到左边试试。
  25.  
  26.     keys = [#键盘 -> Symbol
  27.  
  28.       0,    #     ->  :A
  29.       0x58, #  X  ->  :B
  30.       0x5A, #  Z  ->  :C
  31.       0,    #     ->  :X
  32.       0,    #     ->  :Y
  33.       0,    #     ->  :Z
  34.       0x51, #  Q  ->  :L
  35.       0x45, #  E  ->  :R
  36.       0,    #     ->  :LEFT  左 A键 0x41
  37.       0,    #     ->  :UP    上 W键 0x57
  38.       0,    #     ->  :RIGHT 右 D键 0x44
  39.       0     #     ->  :DOWN  下 S键 0x53
  40.  
  41.     ] # 设置时注意后面的逗号不要弄丢了
  42.       # 然后调用方法 Input.setup_keys(keys) 把你设置的 keys 应用到 DLL 里
  43.  
  44.     setup_keys(keys) # 应用上面设置的键位
  45.                      # PS:在 Input 模块内调用就不必加 "Input." 了
  46.     #
  47.     @dkey_map = {
  48.     # 注释为对应的默认按键
  49.     # 例如 Input.press?( :A ) 就是判断 Shift 键是否按下
  50.     # 这些按键无法更改
  51.       A:     0, # L&R Shift
  52.       B:     1, # Esc
  53.       C:     2, # Enter Space
  54.       X:     3, #
  55.       Y:     4, #
  56.       Z:     5, #
  57.       L:     6, # PageUp
  58.       R:     7, # PageDown
  59.       LEFT:  8, # 左
  60.       UP:    9, # 下
  61.       RIGHT: 10,# 右
  62.       DOWN:  11,# 上 Arrow Key
  63.       F5:    12,# F5
  64.       F6:    13,# F6
  65.       F7:    14,# F7
  66.       F8:    15,# F8
  67.       F9:    16,# F9   Debug 菜单
  68.       CTRL:  17,# Ctrl Debug 穿透
  69.       ALT:   18,# Alt
  70.       SHIFT: 0, # 等同于 :A
  71.       # Interpreters Key Judge
  72.       2 => 11,
  73.       4 => 8,
  74.       6 => 10,
  75.       8 => 9
  76.     }
  77.     8.times {|i| @dkey_map[i + 11] = i}
  78.     #
  79.     init_keys
  80.     init_apis
  81.   end
  82.  
  83.   #
  84.   def init_keys
  85.     key_max = 190
  86.     key_num = 19
  87.     @key_buf  = Array.new(key_max) {0}.pack("I*")
  88.     @dkey_buf = Array.new(key_num) {0}.pack("I*")
  89.     @key_states  = Array.new(key_max) {0}
  90.     @dkey_states = Array.new(key_num) {0}
  91.     @dir4 = 0
  92.     @dir8 = 0
  93.     @dir_state = 0
  94.   end
  95.   def init_apis
  96.     @api_UpdateKeys = API_.new 'SiNova|UpdateKeys|v|v'
  97.     API_.call 'SiNova|LoadKeyBuf|pp|v', @key_buf, @dkey_buf
  98.   end
  99.   def setup_keys(keys)
  100.     API_.call 'SiNova|LoadDKeySet|p|i', keys.pack("I*")
  101.   end
  102.  
  103.  
  104.   def update
  105.     @api_UpdateKeys.call
  106.     @key_states = @key_buf.unpack("I*")
  107.     @dkey_states = @dkey_buf.unpack("I*")
  108.     update_dir_state
  109.   end
  110.   # arrow keys
  111.   def update_dir_state
  112.     if press?(:DOWN)
  113.       if    press?(:LEFT);  @dir8 = 1
  114.       elsif press?(:RIGHT); @dir8 = 3
  115.       else  @dir8 = 2
  116.       end
  117.       @dir4 = 2
  118.       @dir_state += 1
  119.     elsif press?(:LEFT)
  120.       @dir8 = press?(:UP) ? 7 : 4
  121.       @dir4 = 4
  122.       @dir_state += 1
  123.     elsif press?(:RIGHT)
  124.       @dir8 = press?(:UP) ? 9 : 6
  125.       @dir4 = 6
  126.       @dir_state += 1
  127.     elsif press?(:UP)
  128.       @dir8 = 8
  129.       @dir4 = 8
  130.       @dir_state += 1
  131.     else
  132.       @dir8 = 0
  133.       @dir4 = 0
  134.       @dir_state = 0
  135.     end
  136.   end
  137.  
  138.   def press?(btn)
  139.     @dkey_states[@dkey_map[btn]] != 0 rescue p btn
  140.   end
  141.   def trigger?(btn)
  142.     @dkey_states[@dkey_map[btn]] == 1
  143.   end
  144.   def repeat?(btn)
  145.     s = @dkey_states[@dkey_map[btn]]
  146.     s == 1 || s > 19 && s % 5 == 1
  147.   end
  148.   #
  149.   def key_press?(k)
  150.     @key_states[k] != 0
  151.   end
  152.   def key_trigger?(k)
  153.     @key_states[k] == 1
  154.   end
  155.   def key_repeat?(k)
  156.     s = @key_states[k]
  157.     s == 1 || s > 19 && s % 5 == 1
  158.   end
  159.   #
  160.   def dir_trigger?
  161.     @dir_state == 1
  162.   end
  163.   def dir_repeat?
  164.     dir_trigger? || @dir_state > 19 && @dir_state % 5 == 1
  165.   end
  166.   #
  167.   def any_key_press?
  168.     @key_states.any? {|s| s != 0}
  169.   end
  170.   def any_key_trigger?
  171.     @key_states.any? {|s| s == 1}
  172.   end
  173. end
  174.  
  175. class << SceneManager
  176.   alias_method :siNova_input_run, :run
  177.   def run
  178.     Input.init
  179.     siNova_input_run
  180.   end
  181. end
  182.  
  183. if $SINOVA  #验证组件完整性
  184.   if $SINOVA[:version] >= 10001 #所需组件版本
  185.     $SINOVA[:input] = 1.03      #当前组件版本
  186.   else
  187.     msgbox "NovaBase 版本过低,至少需 10001 以上"
  188.     exit
  189.   end
  190. else
  191.   msgbox "SiNova_Input 需置于 NovaBase 脚本之下"
  192.   exit
  193. end


RUBY 代码复制
  1. #encoding:utf-8
  2. # 游戏结束时的额外处理,这里显示一张图片演示功能。
  3.  
  4. API_.call 'SiNova|ProcessEndEx|v|v'
  5. #API_.call 'SiNova|ProcessEndEx|i|v', 0 #关闭
  6.  
  7.  
  8. class << Graphics
  9.   attr_writer :game_exit
  10.   # 在这里添加游戏结束时进行的处理
  11.   def process_endEx
  12.     s = Sprite.new
  13.     s.bitmap = Bitmap.new("gameEnd")
  14.     s.z = 11111
  15.     Graphics.wait(120)
  16.   end
  17.   alias_method :siNovaEndEx_update, :update
  18.   def update
  19.     siNovaEndEx_update
  20.     if @game_exit
  21.       process_endEx
  22.       exit
  23.     end
  24.   end
  25. end
  26. #
  27. class << SceneManager
  28.   def exit
  29.     Graphics.game_exit = true
  30.   end
  31. end
  32. class Scene_Title
  33.   def command_shutdown
  34.     Graphics.game_exit = true
  35.   end
  36. end
  37. class Scene_End
  38.   def command_shutdown
  39.     Graphics.game_exit = true
  40.   end
  41. end
  42.  
  43.  
  44. if $SINOVA  #验证组件完整性
  45.   if $SINOVA[:version] >= 10013 #所需组件版本
  46.     $SINOVA[:endEx] = 1.00      #当前组件版本
  47.   else
  48.     msgbox "NovaBase 版本过低,至少需 10013 以上"
  49.     exit
  50.   end
  51. else
  52.   msgbox "SiNova_Input 需置于 NovaBase 脚本之下"
  53.   exit
  54. end


RUBY 代码复制
  1. #encoding:utf-8
  2. # ·需· NovaBase v10000+
  3. API_.call 'SiNova|BackGroundRun|i|v', 1


RUBY 代码复制
  1. #encoding:utf-8
  2. #这个范例是普通功能的演示,Debug 窗使用方法请参考另一个工程。
  3. #因为有鼠标脚本隐藏了系统鼠标,不便于 Debug 窗功能的演示 - -b
  4.  
  5.  
  6. =begin
  7. SiNova.dll RM 功能扩展 v.10013 (2014/3/14)
  8.  
  9.  
  10. update log:
  11.  
  12.   10013(2014/3/14) -- 加入游戏结束处理。可以在玩家 x 掉游戏时做一些代码处理
  13.                       参考 SiNova_EndEx
  14.   10012(2014/2/21) -- DEBUG:  tab 键将置换为2个空格。
  15.   10010(2014/2/15) -- 加入 DEBUG 功能
  16.  
  17.  
  18.  
  19.  
  20.  
  21. 使用说明:
  22.  
  23.   需在游戏目录下加入 SiNova.dll,它为 RM 添加了以下功能:
  24.  
  25.  
  26.  
  27.  
  28.     1. F3 放大缩小屏幕
  29.        F4 切换鼠标是否锁定在窗口内部
  30.        
  31.        系统会自动记录这些信息,应用在下次启动时
  32.        可以在下方自己设置这两个按键
  33.        
  34.        
  35.        
  36.        
  37.     2. 重写 Input 模块
  38.     
  39.        ·全键盘接口
  40.        
  41.          Input.key_press?(key)   判断某个按键是否按下
  42.          Input.key_trigger?(key) 判断某个按键是否刚被按下
  43.          Input.key_repeat?(key)  持续按住按键会间隔返回 true
  44.          
  45.          key 为按键对应的 ASCII 值,查看键盘表获取
  46.          例如要判断 A 键是否按下就是 Input.key_press?( 0x41 )
  47.          
  48.          
  49.        ·按键设置接口
  50.          提供 12 个可设置的按键。
  51.          
  52.          参考 SiNova_Input v1.01 设置按键,可以在游戏中随时修改。
  53.          
  54.          
  55.          
  56.          
  57.     3. 后台运行功能
  58.        
  59.         开启: API_.call 'SiNova|BackGroundRun|i|v', 1
  60.         关闭: API_.call 'SiNova|BackGroundRun|i|v', 0
  61.        
  62.        
  63.        
  64.        
  65.        
  66.     4. 输入法接口
  67.     
  68.       ·DLL 函数          参数  返回值       说明
  69.       
  70.         TypeInActivate     v      l   创建输入窗,焦点转到该窗口;返回窗口句柄
  71.         TypeInDeactivate   v      v   销毁输入窗口,焦点返回主窗口
  72.         GetTypeInText      v      p   获取输入窗口内文字,并清空该窗口
  73.         SetTypeInPos       ii     v   设置输入法出现的位置
  74.        
  75.       输入窗口激活时:
  76.       
  77.         焦点总在输入窗口
  78.         Input模块只响应功能键
  79.        
  80.        
  81.        
  82.        
  83.        
  84.     5. 完整鼠标接口
  85.     
  86.       ·DLL 函数      参数    返回值       说明
  87.       
  88.         GetMousePos   p(II)    v       获取鼠标坐标
  89.         MouseZ         v       i       鼠标滚轮状态,上滚此值 +1,下滚 -1
  90.         MouseZReset    v       v       重置鼠标滚轮状态为 0
  91.         MouseLock      v       v       锁定鼠标在游戏窗口内
  92.         MouseUnLock    v       v       解除锁定
  93.         MouseSetPos    ii      v       把鼠标设置到 x, y 处
  94.  
  95.        
  96.     6. Debug 窗口功能
  97.     
  98.     
  99.     
  100.     
  101.     
  102. =end
  103.  
  104.  
  105. #~ if File.exist? "PubNova.dll"
  106. #~   File.delete "SiNova.dll" if File.exist? "SiNova.dll"
  107. #~   File.rename( "PubNova.dll", "SiNova.dll" )
  108. #~ end
  109.  
  110.  
  111.  
  112. unless $SINOVA
  113.  
  114.   # 2个系统键,查阅<键盘表>改成你需要的键。如果不想使用此功能就设置为0
  115.  
  116.   key1 = 0x72 # F3键 缩放屏幕
  117.   key2 = 0x73 # F4键 切换鼠标锁定
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.   # ========== 以下非设置部分 ============
  126.   $SINOVA = {}
  127.   $SINOVA[:version] = 10013 # 当前版本
  128.   $SINOVA[:lib] = 'SiNova'
  129.   # 文件确认
  130.   unless File.exist?("#{$SINOVA[:lib]}.dll")
  131.     msgbox "未找到 #{$SINOVA[:lib]}.dll"
  132.     exit
  133.   end
  134.   module API_ #  ============================
  135.     def self.new(str); Win32API.new(*str.split('|')) end
  136.     def self.call(str, *args); new(str).call(*args)  end
  137.   end
  138.   # DLL版本验证
  139.   if $SINOVA[:version] > API_.call('SiNova|NovaVersion|v|l')
  140.     msgbox "#{$SINOVA[:lib]}.dll 版本过低,请前往发布页面更新。"
  141.     exit
  142.   end
  143.   # 尝试加载
  144.   $SINOVA[:main] = API_.new "#{$SINOVA[:lib]}|Hook|v|l"
  145.   case $SINOVA[:main].call
  146.   when 0
  147.     msgbox "加载 #{$SINOVA[:lib]}.dll 失败"
  148.     exit
  149.   when -1
  150.     msgbox "游戏已运行"
  151.     exit
  152.   end
  153.   # 读取2个系统键
  154.   API_.call 'SiNova|LoadSysKeySet|ii|v', key1, key2
  155.   class Numeric #  ============================
  156.     def max(v); self > v ? self : v end # 取最大值
  157.     def min(v); self < v ? self : v end # 取最小值
  158.   end
  159. end


嗯,再加一个扩展脚本
RUBY 代码复制
  1. #==============================================================================
  2. # ■ VXAce_SP1
  3. #------------------------------------------------------------------------------
  4. #  プリセットスクリプトの不具合を修正します。ユーザー定義のスクリプト素材は、
  5. # 原則としてこのセクションより下に配置してください。
  6. #==============================================================================
  7.  
  8. #------------------------------------------------------------------------------
  9. # 【修正内容】
  10. #------------------------------------------------------------------------------
  11. # ●イベントコマンド[ステートの変更]にて、同じステートの付加と解除を同時に実
  12. #   行した際、二回目以降の付加が失敗する不具合を修正しました。
  13. # ●イベントコマンド[アニメーションの表示]にて、表示中のアニメーションがマッ
  14. #   プのスクロールに同期しない不具合を修正しました。
  15. # ●自動戦闘の行動が正常に選択されない不具合を修正しました。
  16. # ●装備できなくなった装備品が外れたことにより、さらに別の装備品が装備できなく
  17. #   なったとき、その装備品が増殖してしまう不具合を修正しました。
  18. # ●イベントコマンド[ピクチャの消去]を実行した後に余分な負荷がかかる不具合を
  19. #   修正しました。
  20. # ●移動ルートのオプション[移動できない場合は飛ばす]にチェックを入れた状態で
  21. #   トリガー[プレイヤーから接触]のイベントに接触すると、イベントが実行中であ
  22. #   っても起動予約がされてしまう不具合を修正しました。
  23. # ●魔法反射されたスキルに対してステート有効度が反映されない不具合を修正しまし
  24. #  た。
  25. # ●フォントのデフォルト設定にて太字または斜体を有効にしていても、ステータス画
  26. #   面を切り替えたとき等に無効な状態に戻ってしまう不具合を修正しました。
  27. #------------------------------------------------------------------------------
  28. class Game_Battler
  29.   attr_accessor :magic_reflection
  30.   #--------------------------------------------------------------------------
  31.   # ● 敵対関係の判定
  32.   #--------------------------------------------------------------------------
  33.   alias vxace_sp1_opposite? opposite?
  34.   def opposite?(battler)
  35.     vxace_sp1_opposite?(battler) || battler.magic_reflection
  36.   end
  37. end
  38. #------------------------------------------------------------------------------
  39. class Game_Actor
  40.   #--------------------------------------------------------------------------
  41.   # ● 装備できない装備品を外す
  42.   #     item_gain : 外した装備品をパーティに戻す
  43.   #--------------------------------------------------------------------------
  44.   alias vxace_sp1_release_unequippable_items release_unequippable_items
  45.   def release_unequippable_items(item_gain = true)
  46.     loop do
  47.       last_equips = equips.dup
  48.       vxace_sp1_release_unequippable_items(item_gain)
  49.       return if equips == last_equips
  50.     end
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ● 自動戦闘時の戦闘行動を作成
  54.   #--------------------------------------------------------------------------
  55.   def make_auto_battle_actions
  56.     @actions.size.times do |i|
  57.       @actions[i] = make_action_list.max_by {|action| action.value }
  58.     end
  59.   end
  60. end
  61. #------------------------------------------------------------------------------
  62. class Game_Player
  63.   #--------------------------------------------------------------------------
  64.   # ● マップイベントの起動
  65.   #     triggers : トリガーの配列
  66.   #     normal   : プライオリティ[通常キャラと同じ]かそれ以外か
  67.   #--------------------------------------------------------------------------
  68.   alias vxace_sp1_start_map_event start_map_event
  69.   def start_map_event(x, y, triggers, normal)
  70.     return if $game_map.interpreter.running?
  71.     vxace_sp1_start_map_event(x, y, triggers, normal)
  72.   end
  73. end
  74. #------------------------------------------------------------------------------
  75. class Game_Picture
  76.   #--------------------------------------------------------------------------
  77.   # ● ピクチャの消去
  78.   #--------------------------------------------------------------------------
  79.   alias vxace_sp1_erase erase
  80.   def erase
  81.     vxace_sp1_erase
  82.     @origin = 0
  83.   end
  84. end
  85. #------------------------------------------------------------------------------
  86. class Game_Interpreter
  87.   #--------------------------------------------------------------------------
  88.   # ● ステートの変更
  89.   #--------------------------------------------------------------------------
  90.   alias vxace_sp1_command_313 command_313
  91.   def command_313
  92.     vxace_sp1_command_313
  93.     $game_party.clear_results
  94.   end
  95. end
  96. #------------------------------------------------------------------------------
  97. class Sprite_Character
  98.   #--------------------------------------------------------------------------
  99.   # ● 位置の更新
  100.   #--------------------------------------------------------------------------
  101.   alias vxace_sp1_update_position update_position
  102.   def update_position
  103.     move_animation(@character.screen_x - x, @character.screen_y - y)
  104.     vxace_sp1_update_position
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● アニメーションの移動
  108.   #--------------------------------------------------------------------------
  109.   def move_animation(dx, dy)
  110.     if @animation && @animation.position != 3
  111.       @ani_ox += dx
  112.       @ani_oy += dy
  113.       @ani_sprites.each do |sprite|
  114.         sprite.x += dx
  115.         sprite.y += dy
  116.       end
  117.     end
  118.   end
  119. end
  120. #------------------------------------------------------------------------------
  121. class Sprite_Picture
  122.   #--------------------------------------------------------------------------
  123.   # ● 転送元ビットマップの更新
  124.   #--------------------------------------------------------------------------
  125.   alias vxace_sp1_update_bitmap update_bitmap
  126.   def update_bitmap
  127.     if @picture.name.empty?
  128.       self.bitmap = nil
  129.     else
  130.       vxace_sp1_update_bitmap
  131.     end
  132.   end
  133. end
  134. #------------------------------------------------------------------------------
  135. class Window_Base
  136.   #--------------------------------------------------------------------------
  137.   # ● フォント設定のリセット
  138.   #--------------------------------------------------------------------------
  139.   alias vxace_sp1_reset_font_settings reset_font_settings
  140.   def reset_font_settings
  141.     vxace_sp1_reset_font_settings
  142.     contents.font.bold = Font.default_bold
  143.     contents.font.italic = Font.default_italic
  144.   end
  145. end
  146. #------------------------------------------------------------------------------
  147. class Scene_Battle
  148.   #--------------------------------------------------------------------------
  149.   # ● 魔法反射の発動
  150.   #--------------------------------------------------------------------------
  151.   alias vxace_sp1_invoke_magic_reflection invoke_magic_reflection
  152.   def invoke_magic_reflection(target, item)
  153.     @subject.magic_reflection = true
  154.     vxace_sp1_invoke_magic_reflection(target, item)
  155.     @subject.magic_reflection = false
  156.   end
  157. end
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-25 07:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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