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

Project1

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

[已经过期] 问问SionMouseSystem能不能关闭

[复制链接]

Lv1.梦旅人

梦石
0
星屑
85
在线时间
87 小时
注册时间
2013-1-13
帖子
66
跳转到指定楼层
1
发表于 2015-5-9 23:33:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 zxc123a4s5d6 于 2015-5-9 23:34 编辑

好像不能发代码框,那我就贴出前几行




这个鼠标脚本能不能自己设置一个开关关闭/打开它,我想游戏一开始选择键盘操作或鼠标操作,中间还要换操作方式。。有大神吗?


可以发代码框了。。。。。怎么回事

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

本版积分规则

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

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

GMT+8, 2024-11-16 01:39

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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