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

Project1

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

存放腳本

[复制链接]

梦石
0
星屑
347
在线时间
1291 小时
注册时间
2013-1-12
帖子
3590

贵宾

跳转到指定楼层
1
发表于 2013-8-29 09:01:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================+ l5 U4 L" P1 {
  2. + m3 b; _, U/ q+ {) I6 A
  3.   Sion Mouse System v1.3e
    ' k  v  _) K+ `/ @5 w+ |1 |6 \
  4.   
    # t4 Z4 ?, l6 n$ _/ f
  5.   Changlog* X! X; p* Y# O8 [* e
  6.   
    " I0 N9 Y% m" V, e9 q) T
  7.   2013.4.21 v1.3f5 K; N: k1 c8 K, L
  8.    
    ' Y! q, L  Z9 Y
  9.     1.3f 卷动地图 bug 修正  o8 K- b# W/ o4 G* @
  10.    
    / U1 t+ K6 k, R  p2 T2 q: X3 t5 H
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口$ V; H$ [$ ?2 n: |% n9 y- l
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内
    % l) ]2 P2 }) L
  13.                               Mouse.unlock_mouse_in_screen 解除锁定$ ~0 {; Y8 q- |# k
  14. 2 r6 A4 S% c  r, Q' e# e% q- O1 m
  15.     1.3f bug修正
    # p2 U* p) H/ W5 N
  16.   , h. `8 U1 s/ u4 s
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及( t/ h; k, h$ Y& q2 I1 E
  18.           关闭菜单时,鼠标是否移动到原来的位置。
    & e- f) J" s) c- Z; a+ a) _
  19. * c  m9 H5 g, Y4 O
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处. A2 y7 V* @% q$ l# V; r+ n: z

  21. 1 E7 y; t% a; L$ Q  H2 ?% e
  22.     1.3b 修正一些罕见的bug;" D! I/ a4 c5 X5 {1 ^5 ?
  23. # s1 `) g: V9 `4 _% k# f
  24.     1.3a 代码小修改;
    0 `. v0 {- P' f
  25.           加入了鼠标点击启动事件的功能,
    . x3 B! C, x' L
  26.           在事件中加入“注释”: 鼠标启动  ,1 }8 Q) N8 R) J# d
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。+ |; E3 ?9 k) ^) p9 q! H- o7 B# w
  28.   
    : K9 @, J- u( p# _7 k; a, v
  29.   2013.2.12 v1.2
    ' ^+ F/ `% J$ d; X; z$ L
  30. 4 ^5 Z4 w4 E  n1 ~$ A) O. k
  31.     寻路逻辑优化;; d, s' S5 Q" i7 L( D; S( C- d
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;
    6 ^+ f0 u, U& I& j
  33.     现在支持用鼠标来操作载具了。# P) Y) u+ ^, }7 a5 v+ L

  34. 9 X( s! Q' f8 g$ _& T
  35.   2013.2.8 v1.1- M( A, g! T0 I; N* s
  36. 9 e2 V7 v1 }  E5 m& X8 H, h! K$ U
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    7 R* {& u+ m) v% v% H% M
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;
      H3 L* ^/ V1 }) E
  39.     移动时,路径指示点的绘制更加稳定;
    9 U. X" P- E4 ~9 x
  40.     现在支持默认存档画面的鼠标操作了。
      [/ w+ [! z3 F$ o; n; k8 {- S
  41. % h" `0 f" w) M
  42. $ B. K4 O8 K4 I0 E8 i) L3 B
  43.   OrigenVersion
    3 Y7 U7 h, h; o0 ?3 Z
  44.   
    , c2 \5 O, T, T# r. I0 G* W8 I# _. I
  45.     2013.2.7 v1.0
    7 X" A; u  q4 g% a
  46. 0 c: U: t# Z/ s, S( v
  47.   主要功能* e' t$ H: m  z! }! V& F1 X

  48. ( j. V' O3 T& n1 u1 s
  49.       使用鼠标进行各种操作..." m4 s; w" o) R+ Z$ N% y
  50.       将鼠标锁定在游戏窗口内0 d% U. ]; c6 i
  51.       自动寻路,按住 D 键可以扩大寻路的范围  W: ^; h' r2 W/ a
  52.       双击鼠标进行冲刺
    8 n! O1 ~5 Y& P& A, [1 V
  53.       更改地图卷动方式以适应鼠标移动
    ' K& }0 X4 F9 ?5 R
  54.       变量输入框改良) a3 ~+ m( Y5 x% C7 c
  55. / `+ A+ s6 o# H6 X
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹
    7 y7 X2 j! I; p

  57. ; c# ^- Z1 X0 Q
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹( }3 u& }) v1 l. X! d

  59. - a! O; a7 }/ y" ~( K" x
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    7 o' }; f% E% S1 e
  61. $ B% @2 \0 G! o9 f9 P" ~+ p" W

  62. & x, ~3 Z- b( o5 D
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★2 t6 P( v9 D* m

  64. : Y2 R2 f3 Q3 |4 E7 T, G

  65. + }* I; S7 k/ L
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示; s" ^, @7 z6 f

  67. & I; A) G, y: {7 A  p# y
  68. #==============================================================================6 n4 [4 @9 P1 q% d, r) X6 P
  69. # ■ 常数设置
      B& J6 q, L5 i- q; c" [$ |/ [4 _
  70. #==============================================================================4 I, Z" i" d3 b+ m$ I5 r
  71. module KsOfSion
    8 w0 Y- T+ I' _6 z( K" c: t) Z( C
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false7 e( N: ^9 \# y4 [9 w0 X
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑& i: E9 z) }2 a' R! O) n
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    : B) Z. ^' i) p# d- y  M
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量
    6 |3 _5 q& H% |/ R; m9 i3 K& _+ m
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    8 n. H5 m: O. h' A
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧
    , m8 S- W' h5 }+ A8 g4 D6 T/ e
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)- ~% `8 @: ^/ ?5 v$ X
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键
    : y6 s; N- P0 x% Z: v
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)/ j; {4 d8 Y* ]  @- E
  81. end& x; q8 y5 N5 P# Q/ O

  82. : ^' Q) e* T  }! u* ~) m! r. F
  83. #==============================================================================- t! T7 h4 J7 {* j# r- ^
  84. # ■ 用来显示路径点的类+ q" o) E9 _  E* t  A! F2 x2 d, c
  85. #==============================================================================
    $ l' y# @: n5 c/ ^; a/ H
  86. class Move_Sign  Game_Character# u5 B/ F8 S8 l
  87.   #--------------------------------------------------------------------------
    ! ~6 @- @2 }7 r* m  }- e
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图
    % v/ q) ^0 ~9 \/ V
  89.   #--------------------------------------------------------------------------
    2 o2 Y2 D3 l2 b8 C5 [9 G# V# a9 j
  90.   def init_public_members; `4 s0 O" H% i8 i# j' ?; I
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹  f" H8 z% i: G2 ?
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0% X$ P& ?0 O% r( o" w9 R
  93.     @move_speed      = 5        # ★ 踏步速度
    / O2 L. k3 r2 Z6 j3 T5 T
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    . T+ T+ r: o& Q
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度
    # Q9 c. O  j, H; b# u
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)# z( h' u2 G, j5 `, F; E' w/ K  s
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列  }0 Z/ v# }# ]3 ?
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)
    % b) v  {; ^6 Q. `
  99. + m8 N% V; G* ]: d& l6 w
  100. / e9 p2 X+ ^8 A
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★+ L$ N$ _7 N9 R, V, H

  102. & a3 @8 r' |, t

  103. % @+ h) e/ t- ]. @) o
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图2 G! f% L/ P: N/ R9 U( y
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    & Q; c- ]- D2 [! N5 s% U

  106. 8 _: w& f6 O* \2 o/ X
  107.       if $no_arrowpic_warn
    7 \& g$ r9 C; O
  108.         MouseShow_Cursor.call(1)
    3 r7 Y  W3 G7 R9 i. q5 ~  {, U) ]
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png4 [8 d& f, k6 N( O: D
  110. ( o2 }4 `6 i1 J/ I, r4 I
  111. “路径指示点”将使用游戏自带图片* g' W9 v" A) k3 T% c3 p+ S! c9 d
  112. ' o: U) V& m5 z8 O$ H
  113. 该提示可以在脚本内关闭')7 [6 Y" t& A5 {( L4 d" |- C  W
  114.         MouseShow_Cursor.call(0)' K. t  E# \( I0 D/ L0 s& ^8 n
  115.         $no_arrowpic_warn = false; \6 v/ m( u) w( U: }, O' |2 {
  116.       end
    ! j: ~0 k3 Y& P5 g) C
  117.       @character_name  = '!Flame'
    . |) @9 H0 O5 ]: Z
  118.       @character_index = 6
    ; D( q3 [: U  C" T! @
  119. # E0 O' ]$ [+ G. V0 x
  120.     end
    " l! o# X8 r( C+ H+ Z# a8 C
  121.     @direction_fix = false  # 固定朝向. B- K2 T$ \* p1 L" ~# H1 q& {2 v
  122.     @move_frequency = 6     # 移动频率' ^2 |8 n6 @7 _
  123.     @walk_anime = true      # 步行动画
    4 J( q- C, k( t7 _7 O* K
  124.     @pattern = 1            # 图案- [% X1 [/ `  k
  125.     @through = true         # 穿透; o( Q" j9 @0 x1 ], u
  126.     @bush_depth = 0         # 草木深度5 e3 P/ S  }) |0 C0 R6 `, Y
  127.     @animation_id = 0       # 动画 ID
    ( O, D$ [3 ^9 _! r% Y6 X8 K2 Z
  128.     @balloon_id = 0         # 心情 ID
    + g! @! f( N" H1 l
  129.     @transparent = true     # 透明. l; v7 o" u" b7 J$ \
  130.     @id = 0
    7 Z6 D4 g' g3 K
  131.     @x = 0" _2 @# a5 D3 ^" d. ?& G
  132.     @y = 0
    % O; [* k2 W# X( P0 E
  133.     @real_x = 0& w; v. `% c3 P! [* m3 z( o* T
  134.     @real_y = 0/ W1 p+ g! f& ~0 [( d- |+ `
  135.     @tile_id = 0$ n; M+ N. |- E
  136.   end
    " _- l) g0 \1 z* T: W4 @+ Z
  137.   #--------------------------------------------------------------------------$ A- j$ y, C, E# y5 J
  138.   # ● 定义实例变量
    ' j" G6 b) A& s6 k( F" q
  139.   #--------------------------------------------------------------------------/ \4 ?: h6 [1 E6 F1 @
  140.   attr_accessor direction
    " w; B- ~% \, k: q1 N" \# q
  141. end6 z8 X* A2 _+ ?: b

  142. / b. Z9 r7 m: W  ~# D+ F$ Y
  143. #==============================================================================
    : a! w3 @2 u+ e, s
  144. # ■ Module Mouse
    " u) I! S/ Y/ x1 Z0 T9 G
  145. #==============================================================================
    4 M0 A# L3 Y, j' K
  146. module Mouse
    - C: T% P# B' B7 P8 u- S) ~
  147.   #--------------------------------------------------------------------------
    + A6 e' P' o+ o
  148.   # ● API
    1 b, R# a. }- l* Q
  149.   #--------------------------------------------------------------------------
    ; O; H; [2 R- y! o4 Z) S
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
    4 J; u  I  _) g; r1 _
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i'), n+ o& o: t: x5 c3 |3 {
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l'). K' o  ]6 @  N9 R/ x0 `; A4 H  z
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i'), |$ {% O4 k! a/ A# A# j& A
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')9 H' T# ~4 l4 j6 a& P' W
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l'), K6 I: f$ A8 x) G
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')
    6 l1 g( r9 R, ~) u( x# }5 y$ ^) E
  157.   Window_Hwnd       = Get_Active_Window.call
    $ D. H+ |/ i7 N  l0 ~' A
  158. ! d% }7 J. g3 h) t
  159. class  self: u0 Y; n( R6 s$ ?. w" Y2 `2 q
  160.   #--------------------------------------------------------------------------! O% F% }; O3 F. O9 g9 _
  161.   # ● 初始化( Y. b* g; Q( T( h
  162.   #--------------------------------------------------------------------------" d% y$ `: H- D: ?8 z3 v7 x' O+ E
  163.   def init$ }( u: V, f& k4 b$ c& g
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor1 C+ ]+ y- h  k2 [  l
  165.     @left_state = 0/ Z% J6 Z2 g9 @/ U
  166.     @right_state = 0. \9 r- |* s6 @
  167.     @ck_count = 0 # 帧数计,单击以后从0开始
    ( A& n# K; E! M. {! @  m
  168.     @dk_count = 0 # 用于双击的判定
    % Z% U; t, L/ U( x8 h3 s* q. w
  169.     @clicked = false
    ! F' J# z: ]" p
  170.     creat_mouse_sprite# n. O! m4 H) I2 k2 |
  171.     update. t' P9 n/ q6 Z
  172.   end6 W% L; l, i3 x) ^' G
  173.   #--------------------------------------------------------------------------. S* I8 w: Q( d
  174.   # ● 鼠标指针精灵* B# h: [0 S1 r$ |3 A
  175.   #--------------------------------------------------------------------------
    1 u- P1 p+ h* U: z% J/ ]
  176. #~   def creat_mouse_sprite
    6 L+ N% ]1 B) t/ O; Z. M. X5 m# p3 k
  177. #~     * Y5 x* v$ C1 D
  178. #~       @mouse_sprite = Sprite.new
    9 i+ D, |  Z3 M$ A& W4 R& l( z, ?
  179. #~       panda = 2#rand(2)+1
    ! f+ W* P* p! h1 k8 W

  180. 6 k& Q8 n2 t& ?* W
  181. #~      if panda = 1  @; p8 I' |7 o% F. l
  182. #~        if File.exist('GraphicsSystemCursor2.png')3 n$ Q% v  j7 ^. \0 y* G
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    7 U( i3 T8 r# I, U$ }# T' r
  184. #~        end#with if File.exist, S& m! u5 y, x6 l
  185. #~    # L# ?. ]' k( z) A. U
  186. #~     else if panda = 2 #with if panda=19 b2 [4 |* G3 @0 {8 _' V5 V
  187. #~      
    5 b" {3 ~  y! m
  188. #~      if File.exist('GraphicsSystemCursor2.png')
    , k* u, E' O  D+ g2 N
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    , m; \. R" @- _3 `2 y( v8 z
  190. #~      end#with if File.exist
    * }) D# n% _. j" q
  191. #~         g% e' E4 S& ~" |3 Y; P
  192. #~     else #with if panda=1
    7 ~7 f, V3 _2 i3 Z: e: D0 h
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    2 R3 U) |7 Q/ k8 E
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),
    3 [/ g' Z6 V9 s/ ?
  195. #~       Rect.new(5  24, 24  24, 24, 24))  D$ [% Z5 F/ @
  196. #~     end#with if panda=1/ y3 R$ O* `% L! i
  197. #~     
    1 _& S1 |! ^! j$ |/ f$ }
  198. #~     #with def) ^3 O' K1 @0 u5 S6 I
  199. #~   end
    ! i$ P+ }$ v. a6 ^, @
  200. def creat_mouse_sprite$ p4 n- J# l$ o  C  H+ V+ T1 i" h9 y
  201.     @mouse_sprite = Sprite.new- u& D6 B' I4 [( `" n
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})$ U5 w! `! h5 c( J# C" e. Y' j
  203.     @mouse_sprite.z = 9999
    & G& P: J( V  W0 [* w
  204.     Show_Cursor.call(0)7 Q" B2 r8 A. U* m
  205. end
    ) N* h$ G. j) D: N4 Y/ h3 M

  206. 4 A7 s" \. u) E8 e' w  g' M
  207.   #--------------------------------------------------------------------------( B, h/ O3 m0 f) m# c5 o
  208.   # ● 更新
    4 U& Y/ o4 E: u4 k9 ?- ]4 H/ A
  209.   #--------------------------------------------------------------------------! ~. Y& c- O* V, n! _1 q
  210.   def update
    9 R. w3 H( p, Q8 @. z
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos4 s: }9 c5 K- J( v; o' p9 C* p
  212.     left_state  = Get_Key_State.call(0x01)
    + K: m6 Q, ?' `
  213.     left_state[7] == 1  @left_state +=1  @left_state = 00 X5 {7 O# R$ x
  214.     right_state = Get_Key_State.call(0x02)
    * K# z5 {4 F7 ]$ |+ P
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0  f; G: a8 d9 u/ B) B
  216.     update_double_click
    $ P3 Q% U) f1 A4 _8 E
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1
      j7 {4 X8 Y: u
  218.   end( u) R9 D% m' r# b
  219.   #--------------------------------------------------------------------------* ?& h( l6 C0 W0 Y% L" U# C
  220.   # ● 获取鼠标坐标9 h# Q3 @5 J! n1 t0 ?
  221.   #--------------------------------------------------------------------------! @( ]5 G4 J. r1 t- e
  222.   def get_mouse_pos0 {* W4 r( [+ ^; y2 [3 |  D
  223.     arg = [0, 0].pack('ll')
    4 Z7 D( k/ _( |
  224.     Get_Cursor_Pos.call(arg)
    / R  \. J/ J1 C& Z7 `7 c3 A4 ~
  225.     Screen_To_Client.call(Window_Hwnd, arg)( L; ^3 Z6 k, U2 C3 v# T9 i/ o
  226.     x, y = arg.unpack('ll')1 h/ Y* t0 h: q% ~9 N( V, m
  227.     return x, y
    2 B. Y9 l  s; q1 p
  228.   end# h; t8 V. m& d" z8 I6 m0 Y
  229.   #--------------------------------------------------------------------------( T, I5 g' ]5 |" n
  230.   # ● 将鼠标固定在屏幕内
    # d: i7 N  A4 ]9 d- z. K
  231.   #--------------------------------------------------------------------------0 R- Q6 g' k0 x" P' \* }: y
  232.   def lock_mouse_in_screen( ?6 V) O+ h; \- T
  233.     arg = [0, 0].pack('ll')
    : [2 v) k1 G6 Y) a
  234.     Screen_To_Client.call(Window_Hwnd, arg)2 y  e* o1 E1 j3 L7 m: x
  235.     x, y  = arg.unpack('ll')
    ) f5 G+ ^2 y. O0 z
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))
    + u/ o, p  |6 v6 S' c/ d: a
  237.   end1 z% L6 U; N2 C: I* U
  238.   #--------------------------------------------------------------------------0 r! n% ]' d$ O; h1 n
  239.   # ● 解除鼠标固定# K9 [8 ~4 m5 c8 `/ g
  240.   #--------------------------------------------------------------------------4 R/ M; X9 f" H+ L
  241.   def unlock_mouse_in_screen
    , N) m! p% c, `% \. r' N; R" H1 X
  242.     Clip_Cursor.call(0)
    5 g" }9 z. D2 o
  243.   end
    % j. v* h. ]2 ^
  244.   #--------------------------------------------------------------------------" ?: z1 n( d3 L2 }5 U; s
  245.   # ● 鼠标双击判定" m- N+ z& \1 h6 A, t
  246.   #--------------------------------------------------------------------------( S# g- M8 }5 K" l3 |" {
  247.   def update_double_click4 T( K+ y, \+ w. O
  248.     @clicked = true if @left_state == 1
    5 x2 k, x+ ?6 r+ n2 h
  249.     if @dk_count  0 && @left_state == 1) }1 r7 }2 w! G+ k. B* _
  250.       @dk_count = 0; @clicked = false: o5 J4 o( N0 u0 r8 C: d9 \* {
  251.       return @double_click = true
    7 O% h( A" i/ \5 q7 {8 M
  252.     elsif @clicked
    3 p! s6 I% w5 I, g! d* N
  253.       if @dk_count  KsOfSionDbclick_Frame' E/ x8 Y5 Q* J8 R# l& s
  254.         @dk_count += 14 X1 X; g& ~2 ~+ K* q, |) j+ b
  255.       else  ^2 Q% ?4 M; T; m0 ]. M$ y9 [
  256.         @dk_count = 0; @clicked = false
    6 J' P( e" F/ |" [# v5 T5 {
  257.       end
    0 R2 I9 [) L% |8 Y
  258.     end
    3 Y4 O% m0 V4 c0 S* a
  259.     @double_click = false, T1 S8 \, B/ z& O
  260.   end
    & U$ r" C; g8 W# w
  261.   #--------------------------------------------------------------------------' R: _# z* G$ J# w& @
  262.   # ● 按键被按下就返回true
    7 d: i/ `: `! l1 D# b% t, I$ ?* k* I
  263.   #--------------------------------------------------------------------------8 d5 V9 i$ L3 P% L
  264.   def press(button)3 v3 s" O% e6 q" J; Y
  265.     case button
    * N' H, }% f; P% ]5 J
  266.       when 0x01; return !@left_state.zero
    & h' a1 u; v2 Z4 v9 g
  267.       when 0x02; return !@right_state.zero
    % ~+ J7 N8 x" v- {, q- R1 o
  268.     end
    * r& g# ^0 \- X; c
  269.     return false$ g' J# a" F! x8 @: N: B! ?0 t6 Q
  270.   end
    8 z: T; _) K$ ?/ Z) k3 q
  271.   #--------------------------------------------------------------------------
    ' q- }. d3 t* G2 j8 u( w3 v9 U# l/ o; ~
  272.   # ● 按键刚被按下则返回true6 f) r0 ]' I9 g( A$ R
  273.   #--------------------------------------------------------------------------
    2 D. }2 f' j( T! W1 i3 b
  274.   def trigger(button). B1 l3 Y8 A8 f- ?
  275.     case button
    % f9 |( k! D. j& I6 V0 \7 }$ v
  276.       when 0x01; return @left_state == 1
    7 m8 g/ d; ~2 ~) P
  277.       when 0x02; return @right_state == 1
    . g# q' O: h8 C/ ~
  278.     end/ S' H- {$ k0 `# H' _7 @, s
  279.     return false: S, v* a, b! T5 ]# d
  280.   end% N% d. x) c3 E9 G5 ]4 z) e
  281.   #--------------------------------------------------------------------------+ y$ W: t2 i: x6 d
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true# F4 Y5 |1 B) o! o: x! N. r; N
  283.   #--------------------------------------------------------------------------
    # y8 [5 _* N4 T2 w: q! a4 V
  284.   def repeat(button)
    3 l( R3 {4 t. I0 o
  285.     case button
    . _" U6 J/ F6 T
  286.       when 0x01; return @left_state == 1 7 t  \8 h7 L( _! C
  287.         (@left_state  22 && (@left_state % 6).zero); J2 L- K! a; R% [% f
  288.       when 0x02; return @right_state == 1 5 B2 G! n/ p1 l
  289.         (@right_state  22 && (@right_state % 6).zero)' C5 F: L* T& N  i
  290.     end
    9 `3 b) b* e: y: ?+ M8 |
  291.     return false
    $ g1 x# Z" a. A
  292.   end/ z. r3 |/ k3 k8 U' t" j
  293.   #--------------------------------------------------------------------------
    ) S" b" H, X8 t: _# [/ h  y9 `
  294.   # ● 判断是否双击鼠标
    1 H8 \. i/ W6 C$ Q8 ~6 z
  295.   #--------------------------------------------------------------------------
    4 O% N$ t  {: V) R
  296.   def double_click% q; i1 x; F1 d3 Q1 H! o; y3 a
  297.     @double_click" A: J; m+ q/ z' e+ D1 G
  298.   end. {: i8 J) X  \( ^, [* l
  299.   #--------------------------------------------------------------------------
    6 ^( q2 o! P/ z
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)
    + C8 Q8 S5 }- o9 @: f
  301.   #--------------------------------------------------------------------------
    " P5 M* v( w5 R4 q+ J
  302.   def click_count0 E$ `+ @1 `5 r2 R- i. p6 A9 M
  303.     @ck_count
    / F, M' V0 {: z( Z
  304.   end, r1 ]7 @" C3 D
  305.   #--------------------------------------------------------------------------
    % S# l4 b1 A7 K7 k7 H; x0 {* ~) k
  306.   # ● 获取@left_state(按住左键每一帧+=1)
    ; F# u( W! s  v' ?/ o
  307.   #--------------------------------------------------------------------------
    7 v/ d. q; ~# k! M4 }
  308.   def left_state4 A9 }4 M  ?7 f$ t2 y* G* n0 L, k, ?
  309.     @left_state
    9 P, _1 U9 Y1 ]! |$ L: ?$ v6 I
  310.   end
    " W' D. e- m7 b, a7 }2 ?
  311.   #--------------------------------------------------------------------------
    % v2 ~$ T, Z/ @. _: n6 i. {9 r
  312.   # ● 获取鼠标的x坐标, |, g9 {1 [9 q6 W5 |( x" N
  313.   #--------------------------------------------------------------------------! a' u6 k. N4 d2 M7 H6 g! Y) v' [
  314.   def mouse_x
    $ a( k. N& ~. @( G
  315.     @mouse_sprite.x
    / V2 y' V! C4 m& o! `6 Q
  316.   end
    $ m" d! o' o, `+ @
  317.   #--------------------------------------------------------------------------
    : ~6 x3 |; [+ s5 F2 y! c6 _: c
  318.   # ● 获取鼠标的y坐标! m( `  t9 Y% u, v' y! T
  319.   #--------------------------------------------------------------------------
    $ c: w% L6 C- X; u. F' S6 ~* M
  320.   def mouse_y* k$ ]# P, K: @; Z4 ?6 W
  321.     @mouse_sprite.y# l/ R! Z  ~3 W: X8 I8 t4 _3 N
  322.   end
    # X% n0 N* l+ C9 }3 X3 l3 t
  323.   #--------------------------------------------------------------------------
    , y6 R6 a! b9 O! |: K
  324.   # ● 设置鼠标坐标' D8 y) M) t. D- k
  325.   #--------------------------------------------------------------------------
    ) d/ L8 C& O- y1 p  O1 P' i# G
  326.   def set_mouse_pos(new_x, new_y)  x& @$ p5 K3 T5 r# Q5 M* E
  327.     arg = [0, 0].pack('ll')
    8 E# O# |& s2 _5 [4 H) ]+ a
  328.     Screen_To_Client.call(Window_Hwnd, arg)
    + i% j; z, ~" J2 R5 x  S9 e3 t
  329.     x, y  = arg.unpack('ll'). |* C- R* C8 `
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    6 r7 e4 F) r4 b8 L7 y- Y
  331.   end
    ) j2 w* k* C3 S/ z  u
  332. end #end of class  self 7 {3 L& \- @' B2 ^; T% h
  333. + T" O0 v1 Y7 c0 T" n3 w* {
  334. end- G& s/ b8 k- P" a% e' z
  335. % N+ {: G/ L( b* w* ?+ g0 G
  336. #==============================================================================, z& m! i0 [+ ^* U) W5 o( Q
  337. # ■ SceneManager7 x  }8 n  F! T* U4 x4 [4 @
  338. #==============================================================================2 c; p/ Q0 y( a2 X, y) p& c; A
  339. class  SceneManager; l. \. n  k# _- J* t5 W' }0 w
  340.   #--------------------------------------------------------------------------9 F+ C5 z+ i6 Q% ?$ w! G" d
  341.   # ● alias
    - M& k& ?. w# ~" W
  342.   #--------------------------------------------------------------------------" H$ L9 V* y2 @6 q
  343.   unless self.method_defined(sion_mouse_run)( h, A/ g! t! B* @  V+ |
  344.     alias_method sion_mouse_run, run
    ( I, d. E9 N) x* L$ g
  345.     alias_method sion_mouse_call, call# }& P# L, N- q' X
  346.     alias_method sion_mouse_return, return; Z" {7 L& U* z. A& u
  347.   end5 p1 |# c4 n- n& |, ?0 C" B
  348.   #--------------------------------------------------------------------------
    ! {) P" D  U1 B$ }
  349.   # ● 运行
    8 S" u. S* L, k2 @
  350.   #--------------------------------------------------------------------------# b% z& V6 B* K0 V
  351.   def run
    ( }" u$ y2 a$ e  R
  352.     Mouse.init
    0 B5 y9 o- W% f! d) k$ u
  353.     sion_mouse_run2 t' B. Z7 }$ f6 j
  354.   end8 v# s- n3 R. f
  355.   #--------------------------------------------------------------------------& J5 ?. E" i- X! U+ m1 L
  356.   # ● 切换, m* h9 w" R9 O5 k* f1 Y( X0 @
  357.   #--------------------------------------------------------------------------
    3 b( V6 C1 @0 e- r: \  C
  358.   def call(scene_class)$ r/ \; s; r/ q$ H% M' E, Y- W
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)
    1 N6 T8 c( d. G% O3 U" V- U
  360.     sion_mouse_call(scene_class)
    / H% z5 T* L/ ]- u* ~" o; p( ?
  361.   end, N; Q9 S* S2 d' d! h* ~* e
  362.   #--------------------------------------------------------------------------
    8 G1 A- G6 D3 i6 k% y. D5 F! e
  363.   # ● 返回到上一个场景
      B/ v6 I. y8 O) q& A5 l
  364.   #--------------------------------------------------------------------------
    ) V; W) G! s+ q* C* g
  365.   def return
    + I1 G( f# E: y: v
  366.     sion_mouse_return
    8 A5 }3 C+ w! G( e% j
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&$ y) i9 ]3 F3 j) Y2 M& K  K
  368.       @scene.instance_of(Scene_Map). E3 t* x" }, {  b' L! j
  369.   end6 @$ `5 X' F; t1 [  C, M
  370. end/ q3 x; t' P8 F- c2 n" W( H

  371. ; i1 f: n6 h% L6 ]
  372. #==============================================================================- s9 l. Y' \9 R9 H& [! W
  373. # ■ Module Input
    ; {$ Q# t7 v$ X  B- g2 J
  374. #==============================================================================+ k8 m2 x6 ]8 ?0 h
  375. class  Input
    - P1 H6 O/ @5 [+ i+ k$ f) E
  376.   #--------------------------------------------------------------------------
    # K' V! d6 J5 \* N$ R' X2 ~2 ~
  377.   # ● alias
    ) E4 H* B  P0 [* y4 v
  378.   #--------------------------------------------------------------------------
    $ J; H% v0 `7 p7 o
  379.   unless self.method_defined(sion_mouse_update)
    4 Z8 }* k- _, o* |, v( Z2 ^
  380.     alias_method sion_mouse_update,   update
    9 N- Z/ U9 g. @6 n  `
  381.     alias_method sion_mouse_press,   press
    . ~3 f7 E( J, [# P
  382.     alias_method sion_mouse_trigger, trigger
    . Y; G  w& X* S
  383.     alias_method sion_mouse_repeat,  repeat
    ( ]8 p  a% C4 Z5 N% Y% Z
  384.   end
    " E$ T6 ^# Y" l0 \3 C5 g9 n4 c3 _
  385.   #--------------------------------------------------------------------------
    ! t4 t2 B* s  {
  386.   # ● 更新鼠标
    9 U6 f2 z& n% Q- ^% ~  z0 S, n9 Q8 {
  387.   #--------------------------------------------------------------------------
    3 d/ Y0 P! f, a' @+ t( P% E$ t7 h: b
  388.   def update
    2 P3 U$ \1 D4 @8 a6 N9 |1 C
  389.     Mouse.update
    & g. ?! I# D. M0 w# {8 J
  390.     sion_mouse_update9 [* p" z% e1 {1 r$ X* f
  391.   end
    : k* Q" M6 n  e+ S
  392.   #--------------------------------------------------------------------------3 U' C, k) l* f, W9 ^  Y/ X9 g' c
  393.   # ● 按键被按下就返回true/ u0 |8 J) m8 [) d
  394.   #--------------------------------------------------------------------------
    % K3 I1 I8 f3 j# h! Y
  395.   def press(key)
    % q% ?; b% o: q# d# z' X2 u
  396.     return true if sion_mouse_press(key)# R8 f& a7 O9 d5 @) g
  397.     return Mouse.press(0x01) if key == C# ?% {! E" {# g- E
  398.     return Mouse.press(0x02) if key == B
    3 |5 u9 Y5 r7 W+ Y8 K+ U
  399.     return false
    ) x( B( w% `$ M0 o3 N+ h
  400.   end
    7 T) h9 z; [8 s( d* L) a* h2 H
  401.   #--------------------------------------------------------------------------. z' c1 j& e* \5 h0 b  G& l
  402.   # ● 按键刚被按下则返回true2 i' R# t+ I& K9 A7 p) K
  403.   #--------------------------------------------------------------------------9 ^1 Y  Y  H5 O$ M# `9 ~
  404.   def trigger(key)
    / N4 r1 `9 C9 m, T5 Z
  405.     return true if sion_mouse_trigger(key)8 X" v2 t* Y& P
  406.     return Mouse.trigger(0x01) if key == C
    0 |+ _3 N0 `+ P3 V
  407.     return Mouse.trigger(0x02) if key == B
    % V9 Q+ d" @! l% T1 v
  408.     return false& K5 U1 Y& Q8 d" ^
  409.   end* K0 Y" A5 z6 N, t
  410.   #--------------------------------------------------------------------------6 u$ v% X! L9 u* r9 q
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true' G% n( \3 b9 R( A6 v; z
  412.   #--------------------------------------------------------------------------
    + ?4 T3 C7 ~( `  u
  413.   def repeat(key)
    $ ]0 x' `- m% k' U/ r
  414.     return true if sion_mouse_repeat(key)
    9 F5 p4 ?  n" r1 b
  415.     return Mouse.repeat(0x01) if key == C$ {1 _9 ^! c/ u5 P4 E. W
  416.     return Mouse.repeat(0x02) if key == B
    9 T% U3 N. N: Z  x" i
  417.     return false) z. h, e3 A% I- L; `& u1 W
  418.   end
    $ E/ A# {* ~. r& L1 \- j' r
  419. end
    % W) [  H* x4 c! m; x3 O5 G
  420. 7 ]  p% H4 s, o2 i& }
  421. , \  E/ k' t& H; `# L
  422. #==============================================================================* r8 F1 x1 v2 Z& c8 ~5 i# f; F
  423. # ■ Window_Selectable0 t$ S8 u4 F9 Z; N
  424. #------------------------------------------------------------------------------
    $ f) \7 i$ z; D: Z, p
  425. #  拥有光标移动、滚动功能的窗口
    % G6 T  y$ f9 l* u% u3 z2 e8 P
  426. #==============================================================================
    , l0 u& u& T$ V
  427. class Window_Selectable
    2 T4 X7 W7 {! k% e9 W. L
  428.   #--------------------------------------------------------------------------
    " w5 E' J  b! d
  429.   # ● 初始化
    , @2 g; J0 @/ C' k
  430.   #--------------------------------------------------------------------------3 F& d7 t& O4 `
  431.   alias sion_mouse_initialize initialize, P5 l' g) v# r4 w" \, g
  432.   def initialize(x, y, width, height); j' Q$ |& A" |! S
  433.     sion_mouse_initialize(x, y, width, height)7 o- W. }. ]+ m9 C8 @- @3 R
  434.     @move_state = 0
    4 x. |# F2 C) J, e3 P
  435.   end
    3 @* n: H( D# h7 e! v; E
  436.   #--------------------------------------------------------------------------
      V) p: H4 R, g$ S6 b4 R. E- G
  437.   # ● 更新/ S; E0 ?+ r  w, m$ N$ G
  438.   #--------------------------------------------------------------------------& \5 M! q' }$ [! k$ D: d9 }; t
  439.   alias sion_mouse_update update
    8 K+ Y$ n2 k) p& E% `% _* K
  440.   def update3 {: G; N7 a5 N4 @# _% Z! c$ s
  441.     sion_mouse_update
    8 ]. `7 x, _+ \% W" A0 L
  442.     update_mouse_cursor* ]& o3 @- t+ w% u+ ~' K7 F
  443.   end
    8 |2 V% q' H# n7 s8 t) q8 G/ P
  444.   #--------------------------------------------------------------------------
    5 O7 M$ k. j/ F
  445.   # ● 启动后设置鼠标到index位置' L) Z" m7 ?" K8 Z
  446.   #--------------------------------------------------------------------------) F6 k9 y0 u& q
  447.   def activate
    ) I1 H9 k7 j6 r  E0 Y( b! x
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    3 Q* n& `" A7 ?8 r' t7 q( z" v) k2 ^$ H
  449.     super
    2 ?2 M  C- S  d1 v, x# O- j
  450.   end; v* Y+ |9 {( X. x; C
  451.   #--------------------------------------------------------------------------
    # r& O6 j( r9 L2 u4 q! P
  452.   # ● 更新鼠标和光标的位置7 t4 F) g% s6 h9 }$ U5 e4 l0 n
  453.   #--------------------------------------------------------------------------3 e" m% Z, d( D# R' w  M4 ?
  454.   def update_mouse_cursor
    7 k* n5 {% ^0 G
  455.     if active, e, v' a, c* L! B! r. S
  456.       if @need_set_pos) G0 Q2 \. m7 v/ z4 A
  457.         @need_set_pos = nil
    - }* F; b. [: p+ }  V
  458.         set_mouse_pos! ]* `1 t( k& v" N4 ^
  459.       elsif cursor_movable
    ! s+ z7 g3 R- l0 e# R6 U: X
  460.         Input.dir4.zero  set_cursor  set_mouse_pos( l, o  v9 w7 P' b: `
  461.       end* ?: i% \/ U8 \( K' `
  462.     end$ \' A' e- `- |$ w+ d
  463.   end
    . R) G  i: T' W
  464.   #--------------------------------------------------------------------------/ F: h1 Z* |- }& \* |( J$ A
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能8 k2 a# C" @7 P+ y
  466.   #--------------------------------------------------------------------------: l" r- f; m, l3 D% S# v2 U7 a8 F
  467.   def set_cursor9 |" E5 i9 z# V
  468.     mouse_row, mouse_col = mouse_window_area
    ! K2 C! [0 Y- v- q6 K
  469.     if    mouse_row == -1  Q8 _3 l; _2 F, G
  470.       @move_state += 1 if need_scroll' T& ~( K( M# @
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand
    1 \4 N- q: L# _3 W  G* G8 b
  472.     elsif mouse_row == -24 }8 Q, Q1 P! ~4 e
  473.       @move_state += 1 if need_scroll
    . {. [7 z. p+ D- c) _' _
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand7 g& q8 z+ [: g
  475.     elsif mouse_col == -1
    6 s4 x, C  K3 ~, a
  476.       @move_state += 1 if need_scroll# M3 s; Q; z1 r
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand: |  P) ?; l8 t2 B
  478.     elsif mouse_col == -2
    7 B& z' @2 Q8 C  e  b  }
  479.       @move_state += 1 if need_scroll5 _9 w; D# A/ b6 t- a
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
    1 g5 t7 v/ N4 ?
  481.     else
    / f) |& t# B) }& W
  482.       @move_state = 0
    / Y+ ~8 ]0 i, z, f: r" J
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col
    8 l; _0 o9 A! y
  484.       select(new_index) if new_index  item_max && new_index != @index1 [" N  N% C- E& G+ c& r4 j. n6 P; x
  485.     end4 w& W2 S+ q  D! }2 ]' |" B
  486.   end% Y. c; I& \" q; `8 u: C) q
  487.   #--------------------------------------------------------------------------
    " o4 q7 D; I. J6 e
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    - T/ z+ e1 n; B, k. u
  489.   #--------------------------------------------------------------------------* S8 f- c3 j/ }' K0 d. [+ ^
  490.   def mouse_window_area/ _- B, h. X! g$ {8 Y
  491.     if viewport.nil # necessary!
    % L( m& ]# w8 a0 Y% n
  492.       vp_x, vp_y = 0, 0
    # A4 c1 {# D' T
  493.     else0 n( o. v+ m- a2 t$ Z& K& K0 {
  494.       vp_x = viewport.rect.x - viewport.ox
    6 D8 c3 }+ j+ L" w2 c8 P
  495.       vp_y = viewport.rect.y - viewport.oy
    ( E0 H0 S3 x7 p" G  ]
  496.     end3 _! b) x3 F1 {( r6 }1 r
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y. ~& {6 U& k$ \
  498.     item_x1 = vp_x + x + standard_padding ' E, ~* \$ }! K- U" h
  499.     item_y1 = vp_y + y + standard_padding! a" z7 {, e1 C( N1 J
  500.     item_x2 = vp_x + x - standard_padding + width! `, r) Z1 j0 n; q7 i
  501.     item_y2 = vp_y + y - standard_padding + height
    2 n& `/ ]! P+ S9 r4 U$ {
  502.     if mouse_x  item_x1! Y, ]1 G$ R) K1 [4 n' U2 H
  503.       mouse_col = -15 S0 @3 ?* q/ g8 I) t
  504.     elsif mouse_x  item_x2. F* I* Y+ n! ?/ o9 n
  505.       mouse_col = -2
    : T$ ?0 t! r% i: C. C/ k. q
  506.     else
    . ^+ E0 b8 m# F) B/ Z
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)& ]8 D  p, d7 V% ~
  508.     end
    # p" n: q  n) s. D1 u2 H
  509.     if mouse_y  item_y1! ^2 J) o; h9 u) S+ Y# t. u6 g, n) c
  510.       mouse_row = -14 H, x. ^. T7 u9 b7 o+ Z, U% ?
  511.     elsif mouse_y  item_y2
    / l6 ~2 s+ W2 N5 o- a
  512.       mouse_row = -2
    4 r3 {, j# h! |# C# {
  513.     else
    9 C1 y$ t- Z) U- d0 ]" p2 V) b
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)2 n1 d* f; e9 S% u  w
  515.     end
    4 N2 s3 l+ R" U/ V2 M& {
  516.     return mouse_row, mouse_col
    ! I" z+ M2 {7 {8 f* e1 A
  517.   end# E3 ^2 q+ ]3 F1 p2 m2 G6 v/ P
  518.   #--------------------------------------------------------------------------! d1 \" O# N+ v3 V" |
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    # w  e8 e$ x+ c* z
  520.   #--------------------------------------------------------------------------
    : [$ G( |1 l) S9 Q: `* U1 n
  521.   def set_mouse_pos; o, l- U  `# F0 n
  522.     if viewport.nil # necessary!
    0 X- l/ w7 y, z* W* U
  523.       vp_x, vp_y = 0, 0
    4 ~# Q+ o, e2 v7 J  F0 }% b
  524.     else2 X+ P/ g; _; M
  525.       vp_x = viewport.rect.x - viewport.ox8 w4 Y; c) Q7 t' T. o* A$ o" d
  526.       vp_y = viewport.rect.y - viewport.oy4 N/ z. t5 ?  h% {/ C
  527.     end( H: ?) o0 R0 f1 y
  528.     item_x1 = vp_x + x + standard_padding
    : ^) A0 r3 g+ L
  529.     item_y1 = vp_y + y + standard_padding% P+ }; C8 ^) b7 t# S* a6 r$ P) F
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
      F4 o; g% z" T: R- [4 ^
  531.     row = get_index  col_max - top_row
    5 q/ U3 R* H! C3 n9 X
  532.     col = get_index % col_max! o6 s$ ]# |& X& L
  533.     new_x = item_x1 + item_width  (col + 0.5)
    7 c* f3 c$ n+ y! ~9 k$ o
  534.     new_y = item_y1 + item_height  (row + 0.5)
    5 j  G: `# J% z4 z; I! ^
  535.     Mouse.set_mouse_pos(new_x, new_y)
    , X8 u, X  X2 A2 n! b8 |
  536.   end7 b3 }+ S" Z' O/ Y; H: x7 W# B
  537.   #--------------------------------------------------------------------------
    ! n6 n( @( S, `5 x, Y! R: R
  538.   # ● 判断菜单是否需要卷动' p% z( {4 N" Q8 ^" a' |
  539.   #--------------------------------------------------------------------------
      Y5 i+ ]4 E0 A" C3 a
  540.   def need_scroll& j  }9 Z( k! v5 f) M
  541.     item_max  col_max  page_row_max
    * `8 l& z/ u" p8 M4 h3 i
  542.   end
    0 F) l! p% ~/ n2 B5 ~1 }1 d
  543.   #--------------------------------------------------------------------------$ U4 N1 n. J( u' d* h3 v0 e7 O
  544.   # ● 判断是否为水平卷动菜单
    + F% Z) P! i: t
  545.   #--------------------------------------------------------------------------0 g0 r1 P: P. Q2 u( D4 q
  546.   def is_horzcommand
    8 s1 H# e2 m. L6 t' O
  547.     return false
    : e' C" H0 S* w4 q; U$ @' @  Q
  548.   end, u: N3 ?) y3 p- Q
  549. end# S+ [7 ?: G% s

  550. % c- p7 y1 ~5 ~4 A  w; L9 v
  551. class Window_HorzCommand
    7 H! Z. @- J' r" N
  552.   #--------------------------------------------------------------------------9 c9 {1 g9 S& M, N
  553.   # ● 判断是否为水平卷动菜单7 e4 O% _% T  K1 |6 p7 }" [
  554.   #--------------------------------------------------------------------------
    4 L( O4 M# \' A1 m( P( O
  555.   def is_horzcommand2 w: r7 S, l* j. G
  556.     return true$ g0 z- u+ e' ~& Z1 M& Q- x& {' N
  557.   end0 B7 A' d5 c3 |! I- C* ^; F
  558. end+ i/ r" l7 Y* O, t
  559. - G7 Z: M; x5 Q2 k
  560. #==============================================================================
    ! _) P6 z9 d# m  u
  561. # ■ Window_NameInput
      w" v: S4 b9 w+ `
  562. #------------------------------------------------------------------------------+ k$ k- _  m. @4 i1 b0 [* `
  563. #  名字输入画面中,选择文字的窗口。, h1 Z2 g$ \4 A9 S
  564. #==============================================================================0 c& \7 N; e$ r- A3 U$ M( s
  565. class Window_NameInput
    4 l: [3 Y% m( I4 u2 k
  566.   #--------------------------------------------------------------------------
    7 M- i! C4 @( X1 ]9 [2 a. j, D7 g
  567.   # ● 设置列数  o: e; ~9 j- H
  568.   #--------------------------------------------------------------------------
    " ~0 @7 v, n+ ^
  569.   def col_max7 ^( _! B& l; e$ E" @$ y
  570.     return 10( o" q" p: I5 R9 T! M
  571.   end
    3 ~' L* W! @" p, V( `& O0 V
  572.   #--------------------------------------------------------------------------
    : v8 l4 Z9 u# j( l
  573.   # ● 设置填充的Item个数
    " {" Q" U8 r$ b- o: K& V
  574.   #--------------------------------------------------------------------------
    9 n& Q8 w+ Q: J6 O. p
  575.   def item_max0 @% k9 Z. c$ a3 ^
  576.     return 90# b/ w, r% u* F3 `
  577.   end
    ) ?! i" q( C# T6 ~! y
  578.   #--------------------------------------------------------------------------
    $ ^( D" }& K4 x2 |* V9 Y+ T
  579.   # ● 设置填充的Item个数) j/ @3 h0 `1 g, l$ G
  580.   #--------------------------------------------------------------------------
    4 k6 y' K4 \% Z" Q  e
  581.   def item_width
    - p8 }8 G, B% v' e
  582.     return 32
      ^) N8 B( W4 h+ L" e
  583.   end
    9 A3 I- W  g( L' Q* Z5 C: d
  584.   #--------------------------------------------------------------------------
    , B* @: K  Y; n6 e: m
  585.   # ● 判断鼠标位于菜单的第几行、第几列$ C% K! z3 p9 X/ k) @
  586.   #--------------------------------------------------------------------------
    5 [4 b: ?" H4 j9 n
  587.   def mouse_window_area
    ( k/ `) M/ V3 J# U
  588.     if viewport.nil$ }. P9 h7 F+ d* a# f8 x2 o9 k
  589.       vp_x, vp_y = 0, 03 X5 D" d% z2 p* B1 z6 }! f3 s
  590.     else
    ! c. S5 S9 E4 H& v) f" `1 J1 O
  591.       vp_x = viewport.rect.x - viewport.ox: X% V) M4 H* k
  592.       vp_y = viewport.rect.y - viewport.oy
    + M3 u* T7 H) g) x" N7 h& c
  593.     end
    1 l$ g1 w: T8 S# V/ _
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y' |& y2 M, j' n0 D( ~
  595.     item_x1 = vp_x + x + standard_padding
    ; Z1 ~1 Q; F$ N
  596.     item_y1 = vp_y + y + standard_padding
    ; H& {( @1 i' w) e9 k, s2 H# Z' _
  597.     item_x2 = vp_x + x - standard_padding + width: y* c7 @) r0 d* M
  598.     item_y2 = vp_y + y - standard_padding + height
    ' s. B/ v8 ]( a4 _/ }
  599.     if mouse_x  item_x1# @% r% s4 J9 a0 v4 n0 [) x& c
  600.       mouse_col = -1
    9 c' y( g7 \! R$ e% r
  601.     elsif mouse_x  item_x28 N: s, [- k! @7 i) f6 S
  602.       mouse_col = -2
    / b& R) S4 X1 W: p7 H. }
  603.     elsif mouse_x  item_x1 + 1603 M5 f2 S5 J0 k% v
  604.       mouse_col = (mouse_x - item_x1)325 O- I* {. S: t+ j
  605.     elsif mouse_x  item_x2 - 160
    + B, z% X: q; q/ k
  606.       mouse_col = 9 - (item_x2 - mouse_x)326 ?$ N% A4 V1 t" p$ Z/ i0 D& B
  607.     else# W$ M' R, U  ^; B9 N* Z
  608.       mouse_col = mouse_x  x + width2  5  4! p! V: w0 v' S: F) P
  609.     end
    $ Z3 [# x  D! K7 {+ s
  610.     if mouse_y  item_y17 |7 l' Q" Z( B; o! n6 B7 E
  611.       mouse_row = -1
    & W4 B7 b6 j- Y7 P) B' @
  612.     elsif mouse_y  item_y22 U5 J+ ~9 H. _9 d/ \! G8 k
  613.       mouse_row = -2
    ; Y( e, V9 E, A% Q0 Q
  614.     else
    ; L  ^+ F0 g$ _0 R+ i+ k- G8 k
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)
    9 F% l2 ^: r! m/ I7 K' A3 V5 G
  616.     end
    . i) K( u( @( C( S& \4 e
  617.     return mouse_row, mouse_col
    / V3 b( `* M' ^; T6 e9 Y' h# J0 p
  618.   end8 v2 Q. _, Z! `* ^4 I$ r: L8 p4 ^
  619.   #--------------------------------------------------------------------------# o+ a. @" A; g( z. m4 X4 t/ I  ~7 g2 j
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    ! ~4 X9 ^- b3 j: g0 {0 T
  621.   #--------------------------------------------------------------------------
    1 R, D: P( t! Y
  622.   def set_mouse_pos
    / p$ U  D! a2 D, n& K1 Y
  623.     if viewport.nil # necessary!5 j! ~6 V* v$ d4 {: s8 U' P
  624.       vp_x, vp_y = 0, 06 o( @7 H# t* C, R, \% {$ g" f
  625.     else
    8 l2 @0 U. y/ l. c1 O) x5 k
  626.       vp_x = viewport.rect.x - viewport.ox2 f" ~+ f1 G! E. z6 G/ y# r0 W
  627.       vp_y = viewport.rect.y - viewport.oy4 Q8 q& t# X2 I" m
  628.     end4 e# R+ z, o  J. y5 X
  629.     item_x1 = vp_x + x + standard_padding ! F8 z/ P0 N$ f' S
  630.     item_y1 = vp_y + y + standard_padding
    4 O. g+ H$ |- T$ n, o7 H/ s
  631.     get_index = @index  0  0  @index
    0 \% O. M9 n( u" M7 A
  632.     row = get_index  col_max - top_row
    : X. d3 E  ~1 _
  633.     col = get_index % col_max& z' z2 x$ a4 a7 Y+ Q2 ^0 d
  634.     new_x = item_x1 + item_width  (col + 0.5)
    2 B6 `2 ^  F! m) b( Y
  635.     new_y = item_y1 + item_height  (row + 0.5)6 Y( J# T3 b8 |0 Z* x3 f
  636.     new_x += 14 if col  43 `9 K. T: t( ]$ f2 u2 C
  637.     Mouse.set_mouse_pos(new_x, new_y)
    3 {4 N! N5 a* j/ }  A4 m. L
  638.   end
    ; p7 P, p" \0 K5 Z
  639. end* U0 E5 C6 U5 ~
  640. + v" g( f3 D: y; Q
  641. #==============================================================================/ {; p/ \6 g# I* z- x$ ]+ {
  642. # ■ Window_NumberInput
    7 g: [9 L$ \2 ?0 }$ P; u
  643. #------------------------------------------------------------------------------( P& @; B% I! r) h- W3 f
  644. #  重写了数值输入的方法以适应鼠标9 W3 O7 H$ Z. h2 p+ A$ P( Z5 L
  645. #==============================================================================. a) r  Q$ h. q: E' X# W3 _5 X: |
  646. class Window_NumberInput  Window_Base' [6 r% ]; F8 _) C' B1 V# g  a
  647.   #--------------------------------------------------------------------------$ I! v2 U; ]4 v
  648.   # ● 定义实例变量1 c# D# Z7 B- N
  649.   #--------------------------------------------------------------------------; t  l0 Z4 l/ D/ d" ]
  650.   attr_reader extra_window
    0 {! L3 n5 |8 d. O
  651.   #--------------------------------------------------------------------------
    7 I1 [3 y& m- N  q$ J. \
  652.   # ● 初始化+ B9 C2 P; g" T$ ]
  653.   #--------------------------------------------------------------------------
    & M0 U3 d. Q& N  a
  654.   alias sion_mouse_initialize initialize
    " M6 q+ t1 d$ j+ M
  655.   def initialize(arg)
    % ~1 F/ s/ g* M0 X
  656.     sion_mouse_initialize(arg)% Q1 s- n( y% E  X$ k  M
  657.     create_extra_window  d. J7 E) E, Z0 B1 x' [
  658.   end3 A9 X4 X) D# u6 u8 f- i- T
  659.   #--------------------------------------------------------------------------& E) D* d$ w. ?* d/ q
  660.   # ● 启动
    9 Z. ^" ?9 x: N9 L- o
  661.   #--------------------------------------------------------------------------1 J% _( Z  o. ^% V4 ]- `
  662.   alias sion_mouse_start start1 m  s: T& t6 `! ]# N5 o8 h# v
  663.   def start$ a7 J3 p  |8 B/ b1 H
  664.     sion_mouse_start
      Y& }: D& s( ^3 K
  665.     deactivate; n% s, M# |6 G+ \) x) Y
  666.     extra_start
    ; r& ~, I/ i/ }
  667.   end5 l/ G0 y( K/ f
  668.   #--------------------------------------------------------------------------
    6 I7 }" U: E; n$ ~# f
  669.   # ● 创建新的数值输入窗口
    & G; j6 b- D2 W/ |8 w7 \6 a
  670.   #--------------------------------------------------------------------------
    - V+ ?) \% t8 j% ^4 w; _3 p
  671.   def create_extra_window
    8 G* y/ p4 |# u! z6 s% z
  672.     @extra_window = Window_NumberInput_Ex.new
    * J2 W5 i+ R: r5 [; [% @# B6 i
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2
    0 R2 @0 B. S7 ~+ s/ ]6 `/ t+ t- z6 j
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }. j+ ^6 X' R" v% _1 b2 q# p
  675.     @extra_window.index_proc   = Proc.new {n @index = n }& a& H2 `8 C5 h) m; Q" u* b
  676.     @extra_window.close_proc   = Proc.new { close }' l' F2 v8 N8 j6 _+ J" U
  677.     @extra_window.refresh_proc = Proc.new { refresh }, f- F+ M$ Q) n, v# X
  678.   end
    7 T, J4 p) m) u7 q: n( c
  679.   #--------------------------------------------------------------------------
    , ?9 b' z% L5 F+ i0 x5 D
  680.   # ● 激活新窗口  C) c6 s7 n6 O( q8 e5 H
  681.   #--------------------------------------------------------------------------- u" d* d: ?5 b7 d) q; V  ?# T; W
  682.   def extra_start9 e2 Q4 }  n. m4 M; R1 J7 Y4 |  k
  683.     case $game_message.position
    6 g1 S" U- ]- f; C8 u# C
  684.       when 0; @extra_window.y = y + height + 4  c* h' q) z: @. H  A; m) P
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
    , C) Q7 T3 G, k6 S( B
  686.       when 2; @extra_window.y = y - @extra_window.height - 4+ t3 w6 @, X3 X# c
  687.       else  ; @extra_window.y = 8
    # G+ c. h9 @) X  u8 G6 L' d: S
  688.     end
    7 L5 p9 |; ~/ p5 y9 Q! P" v4 y
  689.     @extra_window.variable_id = $game_message.num_input_variable_id
    1 E, G  S, w2 c- v$ C
  690.     @extra_window.digits_max  = @digits_max# f: W- }! l0 a+ s
  691.     @extra_window.number      = @number
    " Q# |3 R4 o* m( h3 l
  692.     @extra_window.open! m3 M2 }7 H6 m! {2 m
  693.     @extra_window.activate
    * y/ d- R+ r) r7 A* F7 u+ e/ E
  694.   end
    9 w+ T' q! t7 x$ M, g2 @1 f6 V: V
  695.   #--------------------------------------------------------------------------2 U) q  ~2 ?* B
  696.   # ● 更新, G2 v; z% z& `: J% y; d
  697.   #--------------------------------------------------------------------------4 n( r! }" y% |
  698.   def update3 s  P. i: u" R! |4 v
  699.     super* |  K1 N" s+ T* |- _
  700.     @extra_window.update
    - k9 U9 n4 D( Z0 J" C
  701.     update_cursor
    3 O1 d; l1 a: m# c8 S! Q
  702.   end
    . b9 K; ~% L. m4 x4 d8 c0 B6 ?6 H
  703.   #--------------------------------------------------------------------------
    5 H* p" O3 \3 U- N
  704.   # ● 关闭窗口) m! t4 r3 v3 X( D5 N
  705.   #--------------------------------------------------------------------------9 l. H8 j5 f! q6 a. A! N
  706.   def close
    3 d( l2 i6 F$ C, T* f0 F; e+ }% F
  707.     super
    3 s( E% Z$ O+ E
  708.     @extra_window.close+ P: n/ z" P6 k) `9 W
  709.     @extra_window.deactivate( A8 ~: u, ~( l: b: N9 z* ]
  710.   end
    * `) ?! p& O1 e7 P
  711. end+ y. H4 g2 P/ Z0 \! l4 I
  712. $ @3 E. t0 c. p
  713. #==============================================================================! O2 R$ v4 b! ^
  714. # ■ Window_NumberInput_Ex
    ! V1 R5 W& F/ {8 n* ]/ {/ Y7 J
  715. #------------------------------------------------------------------------------
    : y$ u7 q" ?1 i4 S" A6 S; J; t) n
  716. #  新的数值输入窗口(NewClass)7 Y" ^  K2 k1 Z' y! |% X( |# X0 w
  717. #==============================================================================/ f7 e5 H$ I( E1 a/ r. {
  718. class Window_NumberInput_Ex  Window_Selectable
    # P, b, W) ^2 L1 m. K
  719.   #--------------------------------------------------------------------------3 h9 v0 y/ z0 b1 `+ p, x
  720.   # ● 定义实例变量
    / ]' o2 N' e& c  W
  721.   #--------------------------------------------------------------------------' w8 o' u: ^6 Z: e' F1 I' I
  722.   attr_accessor number_proc
    ' b4 n" s1 z0 H. \1 u* p9 K
  723.   attr_accessor index_proc
    6 f6 m  s% ^3 T
  724.   attr_accessor close_proc
    % D, `9 F. R3 N1 C$ ^
  725.   attr_accessor refresh_proc9 }' Q- t3 U( W0 i- O2 y8 u( S
  726.   attr_accessor number9 Y$ O# E6 e( v/ X' r7 z
  727.   attr_accessor digits_max- O! V. u4 P7 s3 Z: P3 t- h- d) b
  728.   attr_accessor variable_id& m, f- U. f4 M9 m- f% R
  729.   #--------------------------------------------------------------------------
    6 q% c9 B3 `% o! C- Q1 q2 a  M& [
  730.   # ● 数字表
    7 L  h# ?( N7 b4 G9 ]
  731.   #--------------------------------------------------------------------------
    , z4 x1 M9 O& d6 l  ]1 r
  732.   TABLE = [  7,  8,  9,
      x' `7 y( B/ M# g# q0 V; o/ F
  733.              4,  5,  6,  w' S# U# v3 O* x$ K
  734.              1,  2,  3,
    : s- ?/ P8 \1 K. H
  735.             '←',0,'确定',]
    9 E& K: H. |) Y& d- B7 k
  736.   #--------------------------------------------------------------------------
    0 S) F0 Q+ e8 P9 q+ E) B! S
  737.   # ● 初始化对象
    ; X& @5 E6 m0 P5 V3 k0 E
  738.   #--------------------------------------------------------------------------: _& H! P! w- J3 M6 f5 [
  739.   def initialize1 r+ x2 Q' x# h* r0 x- D1 L" s; ^( n- B
  740.     super(0, 0, 120, fitting_height(4))" Q- i" I2 f7 u
  741.     self.openness = 0
    , \7 Y% b+ |* [. A" f: }
  742.     @index = 0) @2 _5 ?7 S" ]7 c7 K
  743.     @number = 0
    4 D& X" J: ?1 A* C* S) O0 `2 [
  744.     @old_window_index = 0) m; i# n1 w" Z  _# D1 U/ Q, ?8 ^
  745.     @digits_max = 0! E% z( ~/ h$ n5 e. ?5 B
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }
    ; d" p& p9 ~; x2 z0 g
  747.   end$ s: f9 c, L3 x5 c3 F
  748.   #--------------------------------------------------------------------------0 m. p) s! G$ O) D! p! Q5 ?& S' d
  749.   # ● 获取项目的绘制矩形
    , S9 V/ N1 h4 P. o
  750.   #--------------------------------------------------------------------------- n6 `; L6 b+ m: f6 \
  751.   def item_rect(index)
    : }- D0 k4 L1 y+ d
  752.     rect = Rect.new) G8 Q: b' q1 r! m5 J4 M9 @
  753.     rect.x = index % 3  32
    * r: I* t/ u/ |- e1 v) d. c" l; d( c+ [
  754.     rect.y = index  3  line_height
    1 p  O$ v6 m) c; P# `: O
  755.     rect.width = 32
    + t% K5 v0 o7 l- `+ y
  756.     rect.height = line_height0 @: `* p/ d9 ^- F* g2 j7 h
  757.     return rect
    / B& x/ y1 x+ \  ]( v& m, X
  758.   end
    3 l3 }) [4 ]# s4 R' h
  759.   #--------------------------------------------------------------------------
    * J3 T' t, C6 I4 z, ~1 |, I1 Z8 V
  760.   # ● 将光标设置到鼠标所在的位置0 C6 P  i5 q7 c  b
  761.   #--------------------------------------------------------------------------
    ; u7 t. e7 P2 q8 ]1 \4 p2 |
  762.   def set_cursor: H: Y" y, A" N, }. h/ u
  763.     mouse_row, mouse_col = mouse_window_area
    3 j, P6 U; ~6 l. R
  764.     if mouse_row = 0 && mouse_col = 06 O# O8 ~# |& Q$ M
  765.       new_index = mouse_row  3 + mouse_col6 p5 M* d- h* |+ y
  766.       select(new_index) if new_index = 111 A9 t' R  {4 s4 ?
  767.     end4 j' y, E& e$ R% J$ v6 ~2 [
  768.   end
    1 i# A) C  O7 V( M
  769.   #--------------------------------------------------------------------------9 C- q. ^5 }1 P+ _$ \
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列
    , |* a) m, e. C& f
  771.   #--------------------------------------------------------------------------
    % Y8 ^9 B1 R1 H0 d5 I
  772.   def mouse_window_area
    ( @7 ~8 {& }6 P
  773.     if viewport.nil
    : a; v6 j$ f( ^4 j
  774.       vp_x, vp_y = 0, 09 T: O7 [4 C( k( ]0 `+ j: f
  775.     else
    , G4 Q  g$ R7 ]" Q% a9 `" [: a
  776.       vp_x = viewport.rect.x - viewport.ox
    ; A0 m% o$ H* D7 p
  777.       vp_y = viewport.rect.y - viewport.oy
    0 K2 ^6 n- c4 k) _/ H
  778.     end
    $ I7 F+ x" ~7 ^
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y6 o0 M4 `: \$ z8 [* ?! N
  780.     item_x1 = vp_x + x + standard_padding 0 ?) B& }& o9 p3 W
  781.     item_y1 = vp_y + y + standard_padding
    + S) ?" M! r, p( I% u; n2 p- q
  782.     item_x2 = vp_x + x - standard_padding + width# u5 L- f& a" j! N
  783.     item_y2 = vp_y + y - standard_padding + height
    % a' R, J. u# n$ r
  784.     if mouse_x  item_x1
    ) t% p8 p2 h! q- x
  785.       mouse_col = -1
    * h, ?7 B# o' `. W. M9 q
  786.     elsif mouse_x  item_x2
    6 ?" Z9 _% K) j! v4 t
  787.       mouse_col = -27 B0 `, ?% _- S. X7 _5 ]3 A( R
  788.     else  G& D3 z6 U" b/ M
  789.       mouse_col = (mouse_x - item_x1)  327 a8 a% g: a+ R
  790.     end* U( m% H6 C) \1 U$ E- }
  791.     if mouse_y  item_y1! Y9 Q: K$ F) b9 g( z4 Y; t
  792.       mouse_row = -1: p, r# h$ H3 w
  793.     elsif mouse_y  item_y2
    - c- U- h" s- p, |
  794.       mouse_row = -28 \# _1 H2 r! b3 E* H+ j
  795.     else
    9 W  s- \+ Q5 H* Y1 c6 S3 U5 ^
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    ' {, [* S4 B2 o5 m' S7 W8 R  O
  797.     end
    % m7 r; Y$ E% k& \6 ~$ v
  798.     return mouse_row, mouse_col
    # |+ |* _) L! A; E
  799.   end
    / K. s3 x9 F" c5 Z2 g) X4 e
  800.   #--------------------------------------------------------------------------5 J+ \+ M/ b" O( l: r4 {1 ?% f/ r
  801.   # ● 获取文字
    4 W9 A1 o( ~/ F! F- l: ]+ t
  802.   #--------------------------------------------------------------------------
    - L( F- x1 [. X) Z
  803.   def get_number+ S' Q9 U' i; x0 ~
  804.     return false if @index == 9  @index == 11
    , L( ~  f$ _+ e5 g
  805.     return TABLE[@index]8 s' I, t% E% ]: Z1 @1 K3 f! ^
  806.   end6 t) m% g/ G; z* p
  807.   #--------------------------------------------------------------------------
    2 t: x$ B& {% i8 j( l6 K8 n6 n; ^. p
  808.   # ● 判定光标位置是否在“退格”上
    7 z6 `6 }& J( F1 f
  809.   #--------------------------------------------------------------------------
    * e6 |# Z  x' `+ Z
  810.   def is_delete  E1 u0 H; w7 J  b
  811.     @index == 9
    4 n; L! l+ L1 W# k! h3 [
  812.   end) P; H2 t" m$ l% l! x# a: W2 a
  813.   #--------------------------------------------------------------------------
    2 F2 ^+ X8 N! C1 |# n, }! N0 Y
  814.   # ● 判定光标位置是否在“确定”上; o, G/ w: J1 x9 ^% C
  815.   #--------------------------------------------------------------------------& H  k0 C% A% G0 i3 ?
  816.   def is_ok! n6 [6 M, ]% U9 x; C3 m; M8 q; @
  817.     @index == 11  _: E! T' `8 X% ?+ i
  818.   end% J. [, A/ K# [) g# x' z! G
  819.   #--------------------------------------------------------------------------
    . w+ T) C6 n2 S7 {7 N% [. F- L
  820.   # ● 更新光标$ G( D+ }# G8 c; q. m! Y( c
  821.   #--------------------------------------------------------------------------
    7 k! L0 d' ^( V9 A0 z# C$ i. z6 e
  822.   def update_cursor1 ]. @+ b) c; D5 C3 K) l
  823.     cursor_rect.set(item_rect(@index))2 s4 r2 M) u+ h4 o- i/ r/ U! u
  824.   end4 z- Z- F7 g1 [5 D  }+ Y
  825.   #--------------------------------------------------------------------------
    ! R$ ?2 z& D. I8 a) Q1 i
  826.   # ● 判定光标是否可以移动9 N1 n7 Y$ L1 ^6 w* ?; P
  827.   #--------------------------------------------------------------------------: v& ^" w9 f5 s5 B
  828.   def cursor_movable
    + h- \" z, F: k/ A5 I
  829.     active
    ; M6 S5 H) O/ j7 [
  830.   end
    9 J; e) h* |) {& F8 x! h" F3 O
  831.   #--------------------------------------------------------------------------, R# _- m& S; o! \0 K# V
  832.   # ● 光标向下移动
    $ s! q1 y' i, j& l
  833.   #     wrap  允许循环
      ?: b! e9 a# V: Y+ n+ o; g: k
  834.   #--------------------------------------------------------------------------
    / u# {6 D# b+ ?* ]2 Y" D0 X/ q
  835.   def cursor_down(wrap)
    % Q$ J; T1 v6 i6 l* V; s/ Q/ B& }
  836.     if @index  9 or wrap
    2 `8 H( K+ }8 s7 h; c
  837.       @index = (index + 3) % 12
    , z$ ?. }5 z& n7 H% {
  838.     end
    & j( [* o7 i/ G8 ^. A
  839.   end
    ) \" Y+ ?4 }& D6 |
  840.   #--------------------------------------------------------------------------4 P  x/ [1 v+ F5 h, C) U
  841.   # ● 光标向上移动
    5 Z: a0 e+ ]. Y8 v5 l/ o' T) G
  842.   #     wrap  允许循环9 Y3 y7 j- C. P! j
  843.   #--------------------------------------------------------------------------
    3 C' o  [& F( X0 V+ J2 M5 s7 f  q
  844.   def cursor_up(wrap)
    $ R& w* d6 T2 ~- o  R7 \
  845.     if @index = 3 or wrap8 C% m1 V- M0 V% D: m" f
  846.       @index = (index + 9) % 120 X8 m1 p2 Z3 P; M
  847.     end
    , z% E$ p$ o9 e0 k5 V* ~
  848.   end
    . j2 b+ z. J0 ?* _- n& Y$ Z0 N
  849.   #--------------------------------------------------------------------------6 `+ U! w5 O; t' w+ N
  850.   # ● 光标向右移动( |& p7 W/ d% ~4 a( c( C
  851.   #     wrap  允许循环8 N" C8 I# }7 J/ ?
  852.   #--------------------------------------------------------------------------
    2 r& u; f7 L. h" \; G- Q' [: n
  853.   def cursor_right(wrap)6 ?$ S+ G& s+ M6 ^  p
  854.     if @index % 3  28 d+ t8 L2 k$ b. w
  855.       @index += 1' \. [8 I; e: t+ l9 t
  856.     elsif wrap
    6 p- L2 p& \1 @9 {# p' x
  857.       @index -= 2, U4 G$ e6 L! ]6 D" B. @
  858.     end
    ( P4 H* s% [2 z7 c
  859.   end5 c  J- i) }" y" {4 G
  860.   #--------------------------------------------------------------------------) U8 k3 X. J0 d& G7 [- p
  861.   # ● 光标向左移动
      n" O, Y1 R1 t2 p
  862.   #     wrap  允许循环
    ) A7 T9 p: f4 ^$ P0 q
  863.   #--------------------------------------------------------------------------
    ) ?8 o% J0 m7 P: A% G' y- [
  864.   def cursor_left(wrap)) q4 L! w' J, ?$ d& G' g
  865.     if @index % 3  0
    $ V9 K" l/ n% h* n9 X! d
  866.       @index -= 1
    7 o4 M* z" q* X8 i
  867.     elsif wrap1 c' ?% L9 |: u$ m
  868.       @index += 2
    # ~( P8 p& \9 _' J3 a0 I: Z1 `
  869.     end
    0 J1 X3 x3 D  d4 ^8 P0 Q) H
  870.   end6 @; ~# n; y$ g' s/ G3 r
  871.   #--------------------------------------------------------------------------! \. i0 e* S* v- F5 c& Z
  872.   # ● 处理光标的移动/ Q9 W" _  v% n1 S, l1 H: a- m
  873.   #--------------------------------------------------------------------------3 p  J% d7 C2 P$ e) t% V5 Q
  874.   def process_cursor_move6 i, h* a) N- ?6 N
  875.     super- s9 K0 g6 k8 ]8 T! i- `( J
  876.     update_cursor
    ; K' A  ]' T/ C, Z: V- P+ ?
  877.   end2 Z$ j! G4 K- t! v
  878.   #--------------------------------------------------------------------------( u5 b- t* w# ^- [8 k4 W- Q* o
  879.   # ● “确定”、“删除字符”和“取消输入”的处理/ W9 ?' I) W. s+ [
  880.   #--------------------------------------------------------------------------
    ) f0 j/ l3 q/ z: ^- X
  881.   def process_handling& N1 f# \% a% H- U7 M
  882.     return unless open && active6 a% E4 E" v; h9 G- T5 Y
  883.     process_jump if Input.trigger(A)
    - n, g( I' z% f
  884.     process_back if Input.repeat(B): h' v3 }2 q" ?% w; o$ ^
  885.     process_ok   if Input.trigger(C)
    8 d% f0 X5 O9 E' f7 B
  886.   end' d2 V8 `+ u, `% A9 Y* D$ Y: V
  887.   #--------------------------------------------------------------------------9 h% W0 ]- H& x, J/ {
  888.   # ● 跳转“确定”2 d' F2 f; u, \2 S6 @3 ^
  889.   #--------------------------------------------------------------------------- s" [5 {; C. ]  Y! C1 r
  890.   def process_jump
    2 e1 x2 \# a/ Y0 d
  891.     if @index != 11. z% ~6 u2 n# H6 l. ?, G: V
  892.       @index = 11
    . O5 f# |6 U) L& H3 V
  893.       Sound.play_cursor# g- [6 R. t3 H" u. k/ r8 H1 F
  894.     end5 i6 d8 @7 _6 E8 e. J
  895.   end) S7 t: h8 L( y3 L5 X9 g7 K2 p
  896.   #--------------------------------------------------------------------------! H: L# q. I5 F4 g6 A+ O2 {+ n
  897.   # ● 后退一个字符
    ! f' E3 W* h- B' `
  898.   #--------------------------------------------------------------------------' t8 k7 K5 y9 I: x4 V3 ^
  899.   def process_back
    - v1 j) D, q) v/ l
  900.     Sound.play_cancel2 F- t* l; B# _* f
  901.     place = 10  (@digits_max - 1 - @old_window_index)2 K9 f: Q4 U; C% D/ r
  902.     n = (@number  place) % 10
    0 k; Y" `( n/ m( M
  903.     @number -= n  place  X" E( V6 W& W& c; b* O, `
  904.     @number_proc.call(@number)0 r% q' f; F4 K6 H! g) a9 ~
  905.     @old_window_index -= 1 if @old_window_index  0
    7 _- I. q7 ^" Q! l8 {: w& ]2 ]6 G1 _" [
  906.     @index_proc.call(@old_window_index)
    3 E- n2 _4 B6 t) g+ b  r
  907.     @refresh_proc.call9 ~& _# ^7 e0 p( b
  908.   end+ O4 _% N4 v8 K% V5 M
  909.   #--------------------------------------------------------------------------
    ; v! x3 s3 h4 z
  910.   # ● 按下确定键时的处理
    # I  T2 D* g4 K5 O: C/ Z
  911.   #--------------------------------------------------------------------------
    ; W$ m1 l& `- y
  912.   def process_ok
    , K$ G, H9 E8 x+ F2 V3 Z
  913.     if get_number8 K: C+ w8 v4 G6 |
  914.       Sound.play_cursor
    1 j4 z4 K0 U3 m, X
  915.       place = 10  (@digits_max - 1 - @old_window_index)% c% z2 n4 R  ?
  916.       n = get_number - (@number  place) % 10
    # y) {8 Z* P( d, N3 z; a3 _: u
  917.       @number += n  place/ b  I3 H9 v! Q1 {% d& O3 Z! Q! b
  918.       @number_proc.call(@number)
    / E) n, \! t% z- ?8 T2 g$ E8 E
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1$ P( V4 D5 y& Z) N2 O; K
  920.       @index_proc.call(@old_window_index)
    # i3 w: R4 y' ]& d+ {6 k
  921.       @refresh_proc.call
    ) P. L3 ]" t) X* n9 z
  922.     elsif is_delete
    1 b# Z0 B/ a8 g) O9 V0 i0 Y
  923.       process_back8 O; _# y0 q7 J+ ^
  924.     elsif is_ok
    : U2 r" u4 M: V- M+ L2 @9 r9 e! v
  925.       on_input_ok
    ' O, E+ K5 _( T/ Q9 H0 z
  926.     end
    % G& @3 E% O0 F# T7 l. T" p" q" _! K
  927.   end
    4 `# J! e- O" v
  928.   #--------------------------------------------------------------------------* Q: S; E$ j2 S( W7 U$ N. ?
  929.   # ● 确定
    4 W0 g6 f7 Z$ `- w. z) ]  ]
  930.   #--------------------------------------------------------------------------
    6 a8 h8 ?  R6 x8 e
  931.   def on_input_ok; O1 m# b4 |" e5 Z: p
  932.     @index = 0$ w! Z# Q" S7 B: B. z
  933.     @old_window_index = 0. p9 j* X& E# V% Y+ S3 ~
  934.     $game_variables[@variable_id] = @number
    9 n4 ]% A2 l: _- c! ]1 P+ m
  935.     Sound.play_ok
    ( o: K% r8 g4 d# C4 m
  936.     @close_proc.call
    " N" ^+ |3 m/ s8 L" B! ^+ o) X
  937.   end0 f: U  r  P' ^# K' n( l' c2 T, P
  938.   #--------------------------------------------------------------------------) |; j( i. i1 h: W% e" e. P
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置% q: D. W9 ~0 {" D- ^0 F4 @
  940.   #--------------------------------------------------------------------------
    ! `. \* n9 X% y8 v! T; t* Z4 M
  941.   def set_mouse_pos8 J" N) y( E& m/ A+ g+ d
  942.     if viewport.nil # necessary!& G8 T$ ^: r2 U4 N; o
  943.       vp_x, vp_y = 0, 0, k& g# J' j0 t. u  U- b" d
  944.     else; c# k: O( i1 v7 e1 O
  945.       vp_x = viewport.rect.x - viewport.ox
    + R4 e( _1 S& o
  946.       vp_y = viewport.rect.y - viewport.oy
    / u0 o; a  _0 H+ i- E& o* Q/ b2 j
  947.     end
      S. Q* [0 Y* e/ _5 l/ Y' O. P
  948.     item_x1 = vp_x + x + standard_padding
    & Y* p" S9 `* Z7 O2 ]3 b- v8 A0 Y
  949.     item_y1 = vp_y + y + standard_padding8 u7 w- t. m8 m" s$ e" k$ b- }
  950.     get_index = @index  0  0  @index ! P! S' I: ^7 a+ W" z* t
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)
    7 D  ?: W6 @4 B' @! g
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)
    9 x/ R0 J6 e5 ]+ w% A/ ^0 B0 ?1 U
  953.     Mouse.set_mouse_pos(new_x, new_y)" `# l# `1 ~6 l2 Y; K& c4 w4 Z& B
  954.   end. G8 B! }. f' {2 R( D
  955. end) A3 _& z* ^  A$ H2 Q' S

  956. - @" o* d9 U7 G% Q9 f) y
  957. #==============================================================================& h" E. S% B" k. [9 \
  958. # ■ Window_Message) a- @' r" K. ^
  959. #------------------------------------------------------------------------------' _6 t5 m0 H: y2 {
  960. #  显示文字信息的窗口。
    - _* X) }/ f3 V  n9 {
  961. #==============================================================================
    / y" }/ s5 }+ x7 a& w# c0 v
  962. class Window_Message  Window_Base
    + D1 ~& ~2 ]* N# S
  963.   #--------------------------------------------------------------------------
    3 [1 c, ~) V4 A3 d
  964.   # ● 处理数值的输入(覆盖原方法)
    / c! p* ]4 Z+ v' Q
  965.   #--------------------------------------------------------------------------
    " B3 s0 x* i5 r: O0 ~( c
  966.   def input_number8 d3 \6 k! O6 U6 ?: h# c
  967.     @number_window.start: J8 q- q$ ~# V  @. |
  968.     Fiber.yield while @number_window.extra_window.active, o9 r4 R, j: Y$ `& Z/ _5 Y# s
  969.   end
    : M3 w! F; m. E6 u) w5 A# d) J/ J9 B
  970. end) m5 `. u! C0 M3 @% X& q! {: R

  971. 8 n8 G6 z; K6 V) |1 K* ~
  972. #==============================================================================, k( l$ K& E% t$ o
  973. # ■ Window_PartyCommand$ E$ h2 k, f9 Z/ j& K! s: u
  974. #------------------------------------------------------------------------------
    . A) B' h$ Z% m# a5 m- d
  975. #  战斗画面中,选择“战斗/撤退”的窗口。3 I2 M% x6 G7 z3 j/ n4 M
  976. #==============================================================================) G' p; t) T$ ~/ n4 G: W- t! K
  977. class Window_PartyCommand  Window_Command
    , r5 w% n( e' G+ x- F, F
  978.   #--------------------------------------------------------------------------
    9 _- W% c* [% e" H3 T! C# V
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    ' d4 x* ]6 d' B% T. p
  980.   #--------------------------------------------------------------------------2 U* A0 q6 D' Q
  981.   def set_mouse_pos) y1 W& s" H' B$ s7 W" k* e( {
  982.     if viewport.nil
    1 l5 v/ N' i/ R4 s
  983.       vp_x, vp_y = 0, 0
    , ]/ a6 z8 d" I2 G6 }  m8 ]
  984.     else- T) u5 K& a  c) R
  985.       #vp_x = viewport.rect.x - viewport.ox/ B3 u5 Z+ e# D. {5 M& v! E
  986.       vp_y = viewport.rect.y - viewport.oy& k" Q0 N5 l+ ]
  987.     end
    : y( G7 f2 O: a3 y9 G5 N5 x
  988.     item_x1 = x + standard_padding
    , m$ Y$ f4 b; D3 P* l1 {
  989.     item_y1 = vp_y + y + standard_padding" y' M  K) q1 e' b; W# q
  990.     get_index = @index  0  0  @index
    # o, L% s) {8 g/ d! X
  991.     row = get_index  col_max - top_row- h) Y1 ?& v4 `# l' C
  992.     col = get_index % col_max/ b( U. y+ J. @! o  k
  993.     new_x = item_x1 + item_width  (col + 0.5)
    * J- N1 N0 u) r, t# n
  994.     new_y = item_y1 + item_height  (row + 0.5)
    0 w( h8 i/ C) D/ {& l
  995.     Mouse.set_mouse_pos(new_x, new_y); y% C- C8 e3 ]6 r; ~
  996.   end
    , h$ A" l8 o9 ?. r1 u6 O' e3 w1 b
  997. end8 v8 F$ E( g- C. M( W

  998. ; ]$ p3 U  q& _. q2 _% Z. p. _
  999. #==============================================================================+ p# h9 O) R) {) f9 M% p. I
  1000. # ■ Window_ActorCommand
    $ v3 f' {* W- O1 `# s( D
  1001. #------------------------------------------------------------------------------! W, T4 \- N( g9 n* R9 b/ f/ h3 \9 U7 m
  1002. #  战斗画面中,选择角色行动的窗口。' o$ ]6 ~, R! F% t2 e7 z; S
  1003. #==============================================================================0 b( w* F: s& l9 m4 m+ E  b) e0 }
  1004. class Window_ActorCommand  Window_Command
    ) p/ b% z. O& Q8 a+ m0 P
  1005.   #--------------------------------------------------------------------------
    . p, _! p- I/ R- L# o$ Z. C% f
  1006.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    7 g; F( s7 m* W! M4 v
  1007.   #--------------------------------------------------------------------------) {1 s4 I5 O' T" m  Y! j
  1008.   def set_mouse_pos
    + n* n, d; B4 @) B/ \- E3 d
  1009.     if viewport.nil
    - c0 V# W! P& v. a
  1010.       vp_x, vp_y = 0, 0- N( l2 e0 o; ^3 b
  1011.     else  X$ k( K( s4 p  V6 t4 g) L
  1012.       #vp_x = viewport.rect.x - viewport.ox. `* u7 h- j$ \$ W. U. _2 s
  1013.       vp_y = viewport.rect.y - viewport.oy
    : a' S3 V6 C4 \! D$ Z7 v+ ~3 j
  1014.     end0 t, {) h6 X) k3 Z* T
  1015.     item_x1 = Graphics.width - width + standard_padding
    5 m2 v4 j5 m! k0 b3 q
  1016.     item_y1 = vp_y + y + standard_padding) M3 c5 }( k5 t& `4 n+ s
  1017.     get_index = @index  0  0  @index - w3 L1 P8 U. P2 E
  1018.     row = get_index  col_max - top_row3 G4 o' _7 Y3 l; Y
  1019.     col = get_index % col_max: G& {$ R# h1 t$ T! z
  1020.     new_x = item_x1 + item_width  (col + 0.5)
    ) v3 Y1 N3 ~' b' Z8 F4 O9 X: y
  1021.     new_y = item_y1 + item_height  (row + 0.5)
    ; I* l! `4 q5 h& f* m% n' m% t
  1022.     Mouse.set_mouse_pos(new_x, new_y)# o+ a! U+ U7 L5 K& q. p9 Y% R
  1023.   end2 i& g" c7 D0 f- P2 U
  1024. end
    6 h" Z! q4 f! ~! r
  1025. % d7 C* C8 U- F( J
  1026. #==============================================================================
    4 {, p6 F. n1 |  l
  1027. # ■ Game_Player
    8 i3 n1 v+ l" r, m( C! M
  1028. #------------------------------------------------------------------------------/ a3 p. q& s6 H7 i3 F) J, _
  1029. #  处理玩家人物的类。拥有事件启动的判定、地图的卷动等功能。* D- O1 u- e/ \. q4 E6 S# b
  1030. #   本类的实例请参考 $game_player 。& a0 P* X- [+ N/ |
  1031. #==============================================================================" v4 ~9 c# p& z
  1032. class Game_Player  Game_Character, N( e) o4 q! r& y2 z) p2 T4 z7 k* s
  1033.   #--------------------------------------------------------------------------$ o- T" l1 ?6 S2 k9 l
  1034.   # ● 由方向移动(覆盖原方法)" O" Z' S# w8 [4 P+ K0 P
  1035.   #--------------------------------------------------------------------------
    2 o  s$ Z' [7 `7 J
  1036.   def move_by_input
    ' f$ O1 [# L. A4 p/ w/ v4 _
  1037.     return if !movable  $game_map.interpreter.running
    , {  ?5 e& U6 ~' d) `) @: ~
  1038.     if Input.dir4  0+ R9 v; `! |! i
  1039.       move_straight(Input.dir4) / y5 U  P8 H9 f/ H6 s
  1040.       reset_move_path
    ! Q0 B3 [: C, ]2 s0 c
  1041.     else; |& j) `/ L( M) K6 g. m% s
  1042.       move_by_mouse& k3 `: M/ [4 f0 ]
  1043.     end
    " [7 E. C! I- F5 V
  1044.   end, U. v. v& l5 S( \" P6 G. r5 y
  1045.   #--------------------------------------------------------------------------
      R& A* N( g0 \0 I$ u$ S* |9 r
  1046.   # ● 非移动中的处理(覆盖原方法)' P$ y# p5 x% H2 x
  1047.   #     last_moving  此前是否正在移动0 C( [: \' A& @; N
  1048.   #--------------------------------------------------------------------------
    ) Q  Q" a" J, z% c  K
  1049.   def update_nonmoving(last_moving)6 Z3 R" _3 v& a; r0 x' v  q
  1050.     return if $game_map.interpreter.running
    - z+ O/ c1 U3 D4 R3 `2 o
  1051.     if last_moving1 M  |7 |/ j8 |9 S: \* [
  1052.       $game_party.on_player_walk" D4 u8 r" L9 Q
  1053.       return if check_touch_event# |. z* z/ G" Z
  1054.     end. ]; [2 y8 h# ~, O
  1055.     if movable && Input.trigger(C)4 q! n& V6 N; _& T6 H
  1056.       return if Mouse.press(0x01) # 防止按下鼠标左键绘制路径时触发事件或载具切换0 Q/ ?6 y- P1 x, n' O& I
  1057.       return if get_on_off_vehicle0 G8 b8 W+ J" A
  1058.       return if check_action_event
    0 u# K, p' z6 Z1 T% T, B. l
  1059.     end
    ) c. J4 z: w& o) ?+ d7 T" u9 I
  1060.     update_encounter if last_moving0 e: E- Q8 E! q8 a
  1061.   end2 }5 r3 ^8 B* U. l7 K, B
  1062.   #--------------------------------------------------------------------------
    * A5 F1 F( E) P. T, n9 g
  1063.   # ● 判定是否跑步状态(覆盖原方法)
    7 b; I5 k# V$ W" [, t
  1064.   #--------------------------------------------------------------------------
    " m3 A6 q" g2 u  }6 B
  1065.   def dash( b% c8 i2 A6 m
  1066.     return false if @move_route_forcing
      L6 i) p$ s! |
  1067.     return false if $game_map.disable_dash+ d  S" p- N; g: I
  1068.     return false if vehicle
    ! Q7 o8 g8 A' `$ y* |) t2 d
  1069.     return Input.press(A)  @mouse_dash
    ( d3 v- V' h' O; R5 L6 B
  1070.   end
    - ]: e2 A. A3 t2 L4 a
  1071.   #--------------------------------------------------------------------------
    0 T7 W0 W7 d7 n& O+ t
  1072.   # ● 初始化
    ( R* Q  Y. ?6 P3 G! m+ \8 a9 D1 o
  1073.   #--------------------------------------------------------------------------
    - s6 D! F& j; Q  c- G# i% J
  1074.   alias sion_mouse_initialize initialize/ v  Y. [- l! M% A& g) X8 y
  1075.   def initialize* l! J) Y0 k  e1 I( l
  1076.     sion_mouse_initialize8 x$ ?2 Z8 `8 S/ J9 s
  1077.     reset_move_path
    7 t; }  u0 }; v: a
  1078.     @moveto_x = 0. \+ _  ^6 J8 }4 _
  1079.     @moveto_y = 0
    7 \; {1 Q0 O) D2 y* J
  1080.   end0 ^- |; t+ {* n
  1081.   #--------------------------------------------------------------------------. i7 A  a/ u3 f7 o3 @! a
  1082.   # ● 更新
    : U7 A- l9 S5 }$ h2 ]
  1083.   #--------------------------------------------------------------------------3 f. _5 H) F  @* E; x
  1084.   alias sion_mouse_update update
    5 S; k& G+ o. ^8 ~3 e
  1085.   def update. ^! B# C4 j  A. M% ?$ i* {4 I8 t
  1086.     sion_mouse_update+ C! d$ o4 K: j
  1087.     clear_unreachable_sign
    1 T! u/ G2 y: P! a/ L) ~
  1088.   end
    - F  c0 Z7 x: n7 n. x
  1089.   #--------------------------------------------------------------------------* M+ A" i8 V8 p/ O. X8 U: _
  1090.   # ● 处理卷动( f8 [$ L! \7 d9 N2 `2 x- V5 S" f
  1091.   #--------------------------------------------------------------------------8 ^( W3 N- u- A! g4 S8 m7 @
  1092.   alias sion_mouse_update_scroll update_scroll1 U  I9 b: A- E/ z
  1093.   def update_scroll(last_real_x, last_real_y)8 |& o9 f0 a  |0 w
  1094.     return if $game_map.scrolling
    3 E) _  c+ k+ [- {: k
  1095.     KsOfSionNew_Scroll  new_update_scroll : }9 V# A5 o8 W" @4 g7 |2 [: S
  1096.       sion_mouse_update_scroll(last_real_x, last_real_y)
    8 V" p) i: o, j7 D* Q
  1097.   end
    4 x+ {  t3 f* v
  1098.   #--------------------------------------------------------------------------" x$ I8 }' A; H' s# `
  1099.   # ● 重置移动路径相关信息
    6 j3 j, d5 B2 y) _4 _
  1100.   #--------------------------------------------------------------------------
    5 S1 n8 @% U& P( E" D, }
  1101.   def reset_move_path
    9 }: d* D' A) E+ i
  1102.     @mouse_dash = false' z* z: f: q4 z! m
  1103.     @mouse_move_path = []
    - d- [- j  |9 B8 v3 ?# @
  1104.     $mouse_move_sign.transparent = true
    ; K# S( k! E+ o1 \# n7 R
  1105.   end3 Z, X' ~; W/ u+ g/ y& \
  1106.   #--------------------------------------------------------------------------
    3 O' u1 R. E1 w- O: h# N7 Q* ]
  1107.   # ● 新的卷动地图方法
    7 y2 G3 ]: ~, w4 r
  1108.   #--------------------------------------------------------------------------) K' Q- @6 e6 b, }
  1109.   def new_update_scroll
    $ a8 _1 ~, E+ u. I% b
  1110.     horz_speed = 2  @move_speed  KsOfSionMap_Scroll_Spd  Graphics.width0 a  I% N0 ~7 m. q4 }2 O2 r) R
  1111.     vert_speed = 2  @move_speed  KsOfSionMap_Scroll_Spd  Graphics.height
    0 E9 C! m( D( F( [
  1112.     ax = $game_map.adjust_x(@real_x)
    6 N2 L: q" k0 q. B  g) y4 `" @  \& A
  1113.     ay = $game_map.adjust_y(@real_y)1 n4 D& ~) A- Y
  1114.     $game_map.scroll_down (vert_speed  (ay - center_y)) if ay  center_y" ]/ R! M4 J4 P6 c
  1115.     $game_map.scroll_left (horz_speed  (center_x - ax)) if ax  center_x
    ! V# ]0 Y1 K+ R3 Z5 r* ?5 G
  1116.     $game_map.scroll_right(horz_speed  (ax - center_x)) if ax  center_x
    % p) r; v2 R" g
  1117.     $game_map.scroll_up   (vert_speed  (center_y - ay)) if ay  center_y
    # f4 t" E$ Q9 q8 A
  1118.   end
    / h6 [) g- j& i! F" i1 @$ f
  1119.   #--------------------------------------------------------------------------
    % p& S) l8 u( F5 t" _: [* H; i
  1120.   # ● 消除不能抵达图标; I* \( R1 Y* O, I3 l9 c4 z$ U
  1121.   #--------------------------------------------------------------------------( p, f0 I: T; h/ g2 [) x* M
  1122.   def clear_unreachable_sign
    5 l# M: o7 h3 s! N" Y
  1123.     return if Mouse.press(0x01)
    ' V9 F4 h% E1 g; |5 I
  1124.     if $mouse_move_sign.direction == 4 && Mouse.click_count % 20 == 0
    1 \4 N+ V$ I+ R" K" `3 Z, k$ W
  1125.       $mouse_move_sign.transparent = true2 ?3 V% j: O7 j% B/ {/ {6 w: J
  1126.       $mouse_move_sign.direction = 2
    1 K6 }7 J& p, x- P. `0 D9 j
  1127.     end* v2 c! W2 q0 H4 P! G1 m* H5 c0 q
  1128.   end, C. U6 V/ Y. z, B2 R, U5 }* b
  1129.   #--------------------------------------------------------------------------, A$ }) o" `. h  F2 c1 o
  1130.   # ● 由鼠标移动) Z; ~) ]1 }5 Y
  1131.   #--------------------------------------------------------------------------3 ^' e, Y  R, f4 V+ Y) _* `2 g! }
  1132.   def move_by_mouse
    0 w2 n. k0 v$ S. ?5 G) y
  1133.     unless @mouse_move_path.empty # 移动路线数组不为空则执行移动
    5 G/ {# d& i" _+ `" Y# F
  1134.       dir = @mouse_move_path.shift, q8 [0 |& U6 m) t
  1135.       if passable(x, y, dir) && !@mouse_move_path.empty
    ; P! u5 b, o% D% N
  1136.         move_straight(dir); R% c8 ?$ n: U+ f7 t+ G$ }
  1137.       elsif @mouse_move_path.empty # 判断是否是最后一步" g) |  O/ I3 A; r6 n, O
  1138.         x2 = $game_map.round_x_with_direction(x, dir)4 [9 F$ ]: g; P7 j2 n; G" a
  1139.         y2 = $game_map.round_y_with_direction(y, dir)
    + Y/ H/ G+ E) F+ |/ w
  1140.         move_straight(dir) unless dir.zero
    , L) z# e* s' }0 x6 g
  1141.         unless x == x2 && y == y2 # 如果移动失败,检查是否启动前方事件、上下载具% o. R- u4 v9 {1 g/ K$ _- Q
  1142.           check_event_trigger_there([0,1,2])! }7 g, Q" w$ A$ u: C
  1143.           get_on_off_vehicle unless $game_map.setup_starting_event' X' q: K1 e& L0 h1 K
  1144.         end
    + A- X/ [# T( y: B+ V# S
  1145.         $mouse_move_sign.transparent = true if $mouse_move_sign.direction == 2
    ! B9 [) y2 L9 Z3 \  |
  1146.         @mouse_dash = false6 y$ x- l8 m& g: u9 ?+ L
  1147.       elsif @mouse_move_path[0].zero # 目标点无法抵达,调整朝向→目标点! X1 A3 f6 K5 r. Y4 U
  1148.         @mouse_move_path.shift
    / j+ Q) o9 {- l8 A5 X
  1149.         @direction = dir
    * t9 _  ~% }7 d+ \  n
  1150.         @mouse_dash = false
    * N- g" ]9 t7 I" W7 \) I$ o
  1151.       else
    2 g9 Y5 a9 {: ?3 p7 x
  1152.         draw_move_path
    6 c- V3 b' t5 ]  C$ I( B
  1153.       end
    1 r/ b! m6 j% H3 i# `4 S
  1154.     end
    7 @$ u5 g- m* a  j- R* S# p
  1155.   end
    * N5 @1 v9 V% F' L
  1156.   #--------------------------------------------------------------------------
    8 y) J+ N% m$ `" ?5 I0 U# A
  1157.   # ● 地图界面按下鼠标左键的处理
    2 n: j/ m. ~2 |
  1158.   #--------------------------------------------------------------------------
    4 I/ Y: }% R' ~  Q. b: e
  1159.   def left_button_action& m$ i3 ]1 x" w; s
  1160.     return if !drawable  $game_map.interpreter.running
    - h5 C( V1 d! R1 @* _6 d( y) p
  1161.     get_mouse_pos
    8 I/ w( F/ d# p7 g9 ?
  1162.     $mouse_move_sign.moveto(@moveto_x, @moveto_y) # 移动路径点指示图
    # y9 z* v) L" J4 _$ p( w
  1163.     if @shift_event
    % \( w2 X2 Q' T8 b
  1164.       if Mouse.trigger(0x01)
    ( O2 s5 `7 p" ?; a
  1165.         @shift_event.jump(@moveto_x - @shift_event.x,4 S, i1 z% _; T5 o6 k
  1166.           @moveto_y - @shift_event.y)7 J/ i8 h. ^' v2 {; h
  1167.         @shift_event = nil$ _! f- e/ E4 N" o6 i
  1168.       end: u1 w! n4 X* p' ?& g
  1169.       return8 q: P4 m, k0 X& {' Z& Z
  1170.     end+ l( @( S. w) C) M0 A9 I8 i
  1171.     if @moveto_x == x && @moveto_y == y # 判断目标点是否与角色重合
    2 _$ N7 r8 H0 ?4 j4 c9 l, G
  1172.       return if moving  (vehicle && !vehicle.movable)
    6 k, ^! l" x# V
  1173.       check_event_trigger_here([0]) # 判断是否触发重合点事件
    ) K0 r5 y; U! h
  1174.       get_on_off_vehicle if !$game_map.setup_starting_event &&
    7 `- a4 u4 y: _- [! Q3 ?
  1175.         $game_map.airship.pos(x, y)  # 判断是否要上、下飞艇( Y6 F. P; S: B- Q! p6 y# [
  1176.       return
    $ M9 U9 B( S; f- A
  1177.     end: ~& ^# `1 R+ R/ A2 r7 {5 S3 t0 F" A
  1178.     # 判断是否用鼠标启动事件7 D( E" ?3 ?( l( F, a
  1179.     $game_map.events_xy(@moveto_x, @moveto_y).each do event1 e' c7 n( b% ^
  1180.       if event.mouse_start
    3 ^- D* O; F0 }" d1 \1 g7 `
  1181.         reset_move_path
    9 X$ l0 o) e8 A% _+ w
  1182.         event.start if Mouse.trigger(0x01)
    5 `4 @# H: w/ L* \& j$ b1 {! W4 Z
  1183.         return
    " P. X- d' X0 U: r- c
  1184.       end
    5 V: L) E' v5 T7 S. |
  1185.     end
    6 Q8 Z2 h6 l2 A; X4 z  u
  1186.     @mouse_dash = true if Mouse.double_click # 双击冲刺
    7 D6 o; G- S. r! @0 w# U8 ?' [
  1187.     return if Mouse.left_state % 10 != 1 # 按住鼠标左键10帧绘制1次路径
    $ q% j! F$ ?/ s& v
  1188.     for i in 1..4 # 判断目标点是否为角色周围四点0 {( X  u% B* N
  1189.       if x == $game_map.round_x_with_direction(@moveto_x, i  2) &&: D) F/ U$ E4 @2 d8 d% o" P
  1190.          y == $game_map.round_y_with_direction(@moveto_y, i  2)
    ; A  `5 ]6 M9 S& G, ^
  1191.       $mouse_move_sign.transparent = true
    . L0 Q; [" R/ t  i! @
  1192.       @mouse_move_path = [10 - i  2] if Mouse.trigger(0x01)
    3 ~9 l( j! e: N' y5 K9 ^, V8 j  M
  1193.       return; end0 C' X2 O! L' Y- r+ H
  1194.     end& a5 k: |: s$ ~9 ?
  1195.     draw_move_path* n, \$ N& F0 c6 ~3 }
  1196.   end3 ~; X; `6 U  I! Q( Z0 e" ^
  1197.   #--------------------------------------------------------------------------  F5 `, M0 b3 \1 U8 X: P
  1198.   # ● 取得鼠标处对应地图坐标点
    / Q) z1 _: i, F+ Z! J3 p/ @. Y5 P* `( s
  1199.   #--------------------------------------------------------------------------* F# P2 `1 ?% R6 p6 {. f) s
  1200.   def get_mouse_pos
    3 F: ?& q# u2 e
  1201.     $game_map.get_mouse_map_xy: t$ y! g6 A/ O
  1202.     @moveto_x = $game_map.mouse_map_x
    - s* V' k2 J5 _! r4 }
  1203.     @moveto_y = $game_map.mouse_map_y
    + N3 u3 m. T4 E4 N- k) J  |
  1204.     #mouse_x, mouse_y = Mouse.get_mouse_pos
    - ?3 O0 m5 O3 K. i) g/ K! M
  1205.     #@moveto_x = $game_map.round_x(x + (mouse_x -
    9 F4 O! F4 q7 B- P& d% ]
  1206.     #  ($game_map.adjust_x(x)  32 + 16).to_i + 16)  32)
    5 K2 F4 e; j; x
  1207.     #@moveto_y = $game_map.round_y(y + 1 + (mouse_y -
    + f$ `3 V* R; O3 d8 h
  1208.     #  ($game_map.adjust_y(y)  32 + 16).to_i - 16)  32)4 _7 t+ u& c# g8 w2 D
  1209.   end* H4 @, |4 ]4 I% U6 S
  1210.   #--------------------------------------------------------------------------
    + M- d8 r/ e3 p7 k6 }/ t4 {5 x1 n
  1211.   # ● 绘制移动路径 @array[move_directions...]
    $ p+ Y# U* o( w) L* e
  1212.   #--------------------------------------------------------------------------( p1 g6 a9 d5 Z5 f: i* i
  1213.   def draw_move_path
    ( i' n- o% z, w
  1214.     #temp = Time.now9 X7 J4 B  H  ?' n% k7 b
  1215.     case @vehicle_type
    / m# {) G0 Y0 r2 I" v: E+ w
  1216.     when walk9 D' t, y" k/ |6 i/ O2 r
  1217.       draw_walk_path- L0 l' J/ {  A: _4 r
  1218.     when boat. D0 ~* q& _& O  N0 _1 U
  1219.       draw_boat_path
    8 m- ~; j0 U- z/ f5 D% R
  1220.     when ship
      N# X8 p+ s% p  R4 Y, a! l% r$ E
  1221.       draw_ship_path
    + X8 }9 C# N8 |$ A
  1222.     when airship+ D3 f7 D7 q2 K6 H' C' q
  1223.       draw_air_path
    5 w/ C; D7 Y: M, u9 r! O5 z
  1224.     end
    - Z) w! [& Z/ S1 Y' j/ P
  1225.     #p (Time.now.to_f - temp.to_f) # 测试效率
    6 P+ ]9 }5 c; V& \/ m
  1226.   end4 `/ a: n. O. [" x- X
  1227.   #--------------------------------------------------------------------------
    % E& q) f! }8 ~1 T
  1228.   # ● 判定是否可以绘制移动路径
    ' d) I, J$ Y+ b( `3 {) {9 T
  1229.   #--------------------------------------------------------------------------7 P' k& a5 y2 Q# S  B2 S
  1230.   def drawable
      H$ [5 m+ y: U* B$ x+ |3 Z  ?
  1231.     return false if @move_route_forcing  @followers.gathering
    9 ~4 t+ R! q+ R% G: M, ^
  1232.     return false if @vehicle_getting_on  @vehicle_getting_off
    0 j: {! Y& n" w" O  @8 `( W, w
  1233.     return false if $game_message.busy  $game_message.visible- H' x: j1 c& z* }# s7 w! P
  1234.     return true
    ; _: L; e  L7 J, b: o
  1235.   end0 o. w- u$ s1 U$ l$ Z
  1236.   #--------------------------------------------------------------------------9 m  O* x) c* T2 ~3 ^4 u. m
  1237.   # ● 绘制walk移动路径 @array[move_directions...]1 N3 F, y  _1 |& T
  1238.   #--------------------------------------------------------------------------! H' f0 J7 S' S# g! A% F
  1239.   def draw_walk_path- v! m3 _1 @  U, s5 C
  1240.     # 准备绘制路径表格* s: a* K: y6 m5 C/ E- E/ j" P* x
  1241.     sheet = Table.new($game_map.width, $game_map.height)
    ! {0 I- B5 u# Z4 P
  1242.     reversed_chase_path  = []; chase_path  = []1 I, C6 [* c; [$ E
  1243.     reversed_chase_point = []; chase_point = []6 H* ~( P2 N) b
  1244.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]
    $ o4 l# x, e/ L/ i0 k' j
  1245.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2# t6 ?$ s9 F4 m1 n6 X
  1246.     reach_point = false% D/ E3 @4 f% J6 k5 F( w& N
  1247.     step = 3
    % N8 z+ b! d! H1 E3 o" l
  1248.     loop do #loop1 开始填充表格* G# [6 b+ b. [" M
  1249.      draw_path = false3 a: k: W0 T  p$ M4 B: Q& n
  1250.      check_points = new_start_points
    . `" L  E, x9 K9 |2 e% y. S
  1251.      new_start_points = []- H, v* K$ [7 a4 c! ?- u
  1252.       loop do #loop2 从起点开始正向填充3 R0 S8 n& n# m- s' c- S" N' q
  1253.         point_x = check_points.shift
    ( M/ y/ p. l' {9 m* V; E  @4 N
  1254.         break if point_x == nil
    " A5 j9 |6 t1 i6 ]% d! f3 Y9 ^8 C
  1255.         point_y = check_points.shift
    8 R# b  a. J5 Q1 S. Y# _+ ~3 M" l
  1256.         left_x  = $game_map.round_x(point_x - 1)' c* i1 W  O5 |$ I$ B' G7 m
  1257.         right_x = $game_map.round_x(point_x + 1)# s8 m- _7 q" @6 y! q. ^( Y8 Z
  1258.         up_y    = $game_map.round_y(point_y - 1)
    % S# G" w% ?& @9 ]: a
  1259.         down_y  = $game_map.round_y(point_y + 1)
    ; d9 p. e+ U$ T
  1260.                     # 判断路径是否连通! P7 O: I$ S2 u) l6 _
  1261.         path_step = step - 10 T6 ?+ w0 Y. p3 T$ N$ o5 [
  1262.         if sheet[left_x, point_y] == path_step     &&) N* f( v/ @4 H! V- s! n
  1263.            $game_map.passable(left_x, point_y, 6) &&
    " u6 H, w, y2 {  ~. ~
  1264.            $game_map.passable(point_x, point_y, 4)5 m8 I" h  @% P% J! ?
  1265.           chase_path.push(4)
    4 q" ]* S9 F) H3 C. W
  1266.           chase_point = [left_x, point_y]
    3 L3 q3 d2 `- a: S7 e" h
  1267.           reversed_chase_point = [point_x, point_y]. K0 V, f- C0 u
  1268.           reach_point = true; break
    ) @/ d/ m/ B1 P8 I  t2 A
  1269.         elsif sheet[right_x, point_y] == path_step     &&
    2 c( X6 {4 \6 Q2 d( y; Q
  1270.               $game_map.passable(right_x, point_y, 4) &&
    ) D1 E) S! z+ S9 S; L1 L
  1271.               $game_map.passable(point_x, point_y, 6)  Z  ~# H6 {1 ^- N
  1272.             chase_path.push(6)
    / j& M" A2 V2 D5 e( l4 b
  1273.             chase_point = [right_x, point_y]. G: O0 w, W8 ]) i' ]
  1274.             reversed_chase_point = [point_x, point_y]6 A( l9 G5 M4 l! Y8 T
  1275.             reach_point = true; break* \! q; w" y4 }1 K$ X# ]
  1276.         elsif sheet[point_x, up_y] == path_step     &&* r& p. O; c+ S
  1277.               $game_map.passable(point_x, up_y, 2) &&
    - V) h) i8 I2 D/ O- V1 \& _& [$ U9 k
  1278.               $game_map.passable(point_x, point_y, 8)
    1 g, ?$ F. A& s" g' g% N
  1279.             chase_path.push(8)
    # Q9 w2 S! ?& ^; S
  1280.             chase_point = [point_x, up_y]
    & i1 `  {) n3 ]& e; e+ ]
  1281.             reversed_chase_point = [point_x, point_y]' `$ {$ ^& k3 q
  1282.             reach_point = true; break" g% I# Y+ u) [4 i
  1283.         elsif sheet[point_x, down_y] == path_step     &&+ j2 A5 \; c- h! K
  1284.               $game_map.passable(point_x, down_y, 8) &&
    3 \3 z; o. {$ c$ U: h7 ^
  1285.               $game_map.passable(point_x, point_y, 2). h( \" u! p4 u4 e7 ?; L7 \! B
  1286.             chase_path.push(2)
    & ~: A2 Y1 b: ?# x& u* m1 h2 I
  1287.             chase_point = [point_x, down_y]
    & k$ m9 n6 B+ s' e9 f- K$ ^
  1288.             reversed_chase_point = [point_x, point_y]1 \# L9 k2 s- D7 t8 i
  1289.             reach_point = true; break$ N8 I2 t) m- n$ |+ J3 Z
  1290.         end5 }' {% k! Q" r: c
  1291.         # 以需要抵达该点的步数填充路径表格 #
    " a( I1 q# M! M2 f
  1292.         if sheet[left_x, point_y] == 0              &&& ^, ~3 b2 _* V0 w, o2 {# l* E
  1293.            $game_map.passable(left_x, point_y, 6)  &&
    ! E& R; A' [! U" x
  1294.            !collide_with_events(left_x, point_y)   &&; @" _) I3 Z$ o# [1 [  J* ]* h& ?
  1295.            $game_map.passable(point_x, point_y, 4) &&0 w& C2 q, g0 _- G, L0 m
  1296.            !collide_with_vehicles(left_x, point_y) #judge_end
    ) T- o% I$ q! o& E0 A5 n0 Q
  1297.           sheet[left_x, point_y] = step
    3 B; N4 l  q1 t  L2 g& [
  1298.           draw_path = true
    ( m  l9 |/ ]( I9 U' }: f  j
  1299.           new_start_points.push(left_x, point_y)
    + ^" M6 n: b: c8 j% m+ d; b6 @
  1300.         end* z, }! p3 a: Q. @  T3 G
  1301.         if sheet[right_x, point_y] == 0             &&
    8 e1 L2 j! n; @4 m
  1302.            $game_map.passable(right_x, point_y, 4) &&
    2 N+ a. f! t" D1 t; B! t: J
  1303.            !collide_with_events(right_x, point_y)  &&
    / d6 Y1 a# r5 S) r# G/ i# T
  1304.            $game_map.passable(point_x, point_y, 6) &&
    . a1 ?! b" s- ?* G
  1305.            !collide_with_vehicles(right_x, point_y)#judge_end5 p' Z' `/ |5 v
  1306.           sheet[right_x, point_y] = step1 Q. F& m3 Y* _7 w4 L
  1307.           draw_path = true
    ( S7 C9 A) m8 s: v: Q, r
  1308.           new_start_points.push(right_x, point_y)
    3 b3 U3 U. g" f+ _" x& f, u
  1309.         end
    & m7 m$ |9 _' b0 e2 W  o7 C& e# H+ z
  1310.         if sheet[point_x, up_y] == 0                &&7 O- @7 t8 Z$ p
  1311.            $game_map.passable(point_x, up_y, 2)    &&+ m+ |6 O' U+ ?6 Z% k
  1312.            !collide_with_events(point_x, up_y)     &&
    8 b* [+ f/ ]8 _6 t
  1313.            $game_map.passable(point_x, point_y, 8) &&1 K8 N4 b7 J# M& g% B! u
  1314.            !collide_with_vehicles(point_x, up_y)   #judge_end
    8 Z' z. j! D: k1 c+ \& N
  1315.           sheet[point_x, up_y] = step
    0 o& [/ H# B1 D1 j2 z+ i
  1316.           draw_path = true/ Z9 n3 {1 y7 |0 t. e, G; J. I% S
  1317.           new_start_points.push(point_x, up_y)* j' W# k: {2 P8 v1 o; q
  1318.         end
    0 A+ t  ^6 i6 S& X+ v# I8 \
  1319.         if sheet[point_x, down_y] == 0              &&
    " ?+ G! \- F- N6 C. I
  1320.            $game_map.passable(point_x, down_y, 8)  &&( R  O- k8 f$ m# A5 D! {- M& P
  1321.            !collide_with_events(point_x, down_y)   &&
    # a  K% i/ C7 X3 ^
  1322.            $game_map.passable(point_x, point_y, 2) &&
    ( g9 Q, C! [+ [
  1323.            !collide_with_vehicles(point_x, down_y) #judge_end
    & c  T+ C) Q' U' l, s3 n
  1324.           sheet[point_x, down_y] = step
    ! ~, A9 |2 I2 d9 P8 a; Q( [1 u8 y! {
  1325.           draw_path = true
    5 h8 O: V' M0 _# ?; D$ N
  1326.           new_start_points.push(point_x, down_y)$ Y& i' Q: F8 `$ y: X8 ~- [
  1327.         end; I$ c3 v  D" P" s+ E# {9 ?
  1328.       end#endOfLoop24 W4 ~# ]% x; M5 a8 F4 _$ x
  1329.       break if !draw_path  reach_point
    : }, ]! A2 X" x, I( N, J) s, M
  1330.       draw_path = false
    4 |, Q) K1 Q" `4 _
  1331.       check_points = new_end_points6 T) ~1 P; Q7 \: K% q4 A7 G4 ^
  1332.       new_end_points = []4 f- p" A3 w& T9 F2 D
  1333.       step += 1
    4 V! K, M' E) |4 ]" ]# v
  1334.       break if step  KsOfSionBreak_Steps &&3 ]1 l. c" p. |' G
  1335.                !Input.press(KsOfSionFind_Path_Key)  g( Z5 l$ ~; X) r; F8 s2 ?
  1336.       loop do #loop3 从终点开始反向填充
    * O3 Y  q2 V# L' T
  1337.         point_x = check_points.shift
    ( M& T5 d$ a$ J& \) D
  1338.         break if point_x == nil) y" ?" ^/ c2 O
  1339.         point_y = check_points.shift
    : F  k% W- A5 [. J( W% U( d
  1340.         left_x  = $game_map.round_x(point_x - 1)6 E) C6 [/ W6 y, ~0 S
  1341.         right_x = $game_map.round_x(point_x + 1)
    - x6 }5 O" |! C  h
  1342.         up_y    = $game_map.round_y(point_y - 1)# t9 t! v( Z/ U, D4 B4 \+ ^
  1343.         down_y  = $game_map.round_y(point_y + 1)
    1 `1 P0 a- ?8 v4 @* _, M
  1344.         # 判断路径是否连通* V4 v% G4 C2 @7 a( W% U
  1345.         path_step = step - 1  f' ?# M/ K" q, @0 H
  1346.         if sheet[left_x, point_y] == path_step     &&2 o$ I7 W- w3 c% J% d3 O0 C
  1347.            $game_map.passable(left_x, point_y, 6) &&, V- _6 j5 F  u7 W
  1348.            $game_map.passable(point_x, point_y, 4)
    : C; U% G. g, j1 C& e
  1349.           chase_path.push(6)  x, W/ ?$ m8 B/ F$ u
  1350.           chase_point = [point_x, point_y]
    , P& H- S! q: n/ _4 d
  1351.           reversed_chase_point = [left_x, point_y]6 A4 z- R# R. S) H5 i
  1352.           reach_point = true; break
    6 Y: p4 W! H6 X3 c
  1353.         elsif sheet[right_x, point_y] == path_step     &&
    / u( W) b4 R0 Z0 ]; K9 l1 r, o
  1354.               $game_map.passable(right_x, point_y, 4) &&
    3 A9 d, V1 w( {; M$ n
  1355.               $game_map.passable(point_x, point_y, 6)! z8 E) @* K3 a9 Q
  1356.             chase_path.push(4)9 S5 C! {8 n4 I5 l+ V: ~4 U
  1357.             chase_point = [point_x, point_y]. d6 E1 k) |0 ~1 h5 U2 ?) w$ y
  1358.             reversed_chase_point = [right_x, point_y]
    9 t5 _5 m! z1 |
  1359.             reach_point = true; break7 y" X, P3 C6 h6 K
  1360.         elsif sheet[point_x, up_y] == path_step     &&9 b0 S9 p1 ^( X' Q" y! ^
  1361.               $game_map.passable(point_x, up_y, 2) &&
    1 @2 D1 C  O' A
  1362.               $game_map.passable(point_x, point_y, 8)$ D+ X( _& k  ?" E- K4 ]0 f. [
  1363.             chase_path.push(2)
    2 S9 i! m) O9 o7 A+ Z6 r
  1364.             chase_point = [point_x, point_y]
    0 K5 h+ W0 z4 R9 W6 I
  1365.             reversed_chase_point = [point_x, up_y]
    ' }& ~" p6 G; @8 C5 {' i
  1366.             reach_point = true; break
    " O5 v4 \; K. K1 c7 L
  1367.         elsif sheet[point_x, down_y] == path_step     &&: V+ r) [% G# r
  1368.               $game_map.passable(point_x, down_y, 8) &&* ~- H& x3 Z% D- R/ w
  1369.               $game_map.passable(point_x, point_y, 2)
    ! o* {# J. j5 m8 _+ i
  1370.             chase_path.push(8)7 k* D! v* P2 e$ A2 g6 \# `. q
  1371.             chase_point = [point_x, point_y]
    & g! q/ z9 G6 t% e* P! d# j0 [
  1372.             reversed_chase_point = [point_x, down_y]
    - a, S) |1 ?+ b6 z/ c! g. [
  1373.             reach_point = true; break
    , I3 z% n8 Z, z2 w- m% I
  1374.         end. e: I& U, n6 w
  1375.         # 以需要抵达该点的步数填充路径表格 #7 D* R. t5 S. e( s4 U
  1376.         if sheet[left_x, point_y] == 0              &&
    . y1 S2 Q$ |  N; N7 N% k
  1377.            $game_map.passable(left_x, point_y, 6)  &&
    , z( W# M/ F7 D) a# C
  1378.            !collide_with_events(left_x, point_y)   &&
    ( ~) K4 S/ j  \
  1379.            $game_map.passable(point_x, point_y, 4) &&
      C, z7 f$ i/ b
  1380.            !collide_with_vehicles(left_x, point_y) #judge_end
    ' X& D* U7 L4 f) U( G0 R  W
  1381.           sheet[left_x, point_y] = step
    7 ?& B  D/ R2 ~
  1382.           draw_path = true
    * H% h6 x, h5 \5 o
  1383.           new_end_points.push(left_x, point_y)6 ~0 ?  x0 g( H5 T% X, C' o
  1384.         end
    , K0 t0 g1 x! ~3 s' `8 t
  1385.         if sheet[right_x, point_y] == 0             &&
    8 W: B/ B3 i& r4 {/ c) f/ U: k
  1386.            $game_map.passable(right_x, point_y, 4) &&, [* g$ ^0 F+ z2 ]
  1387.            !collide_with_events(right_x, point_y)  &&# k2 o& _* b3 d/ w$ Z4 e" c
  1388.            $game_map.passable(point_x, point_y, 6) &&
    / Z$ V1 [# \6 [. T  _
  1389.            !collide_with_vehicles(right_x, point_y)#judge_end
    4 `& e" F; n% E7 ]% Z
  1390.           sheet[right_x, point_y] = step; Y& ]8 @3 |( k' X( K. U5 V9 ]9 c$ L
  1391.           draw_path = true/ ]" l! C# y0 f
  1392.           new_end_points.push(right_x, point_y)
    7 x2 x9 O) U% b7 p* A. Y
  1393.         end+ s' S. {8 t% h  b. d
  1394.         if sheet[point_x, up_y] == 0                &&
    ) O1 s" V. T, D  Z9 b6 u  Z/ e
  1395.            $game_map.passable(point_x, up_y, 2)    &&
    4 G# ?; g3 d0 g3 i1 p  {
  1396.            !collide_with_events(point_x, up_y)     &&% ]' x& h+ i' T- j: F( \* a# [
  1397.            $game_map.passable(point_x, point_y, 8) &&8 c5 n6 y+ f; E# W7 s
  1398.            !collide_with_vehicles(point_x, up_y)   #judge_end
    1 \& t8 a# t# x) E; ]
  1399.           sheet[point_x, up_y] = step
    / ~' i/ L9 w/ j- x
  1400.           draw_path = true, z  U) W1 }+ F/ w; Z
  1401.           new_end_points.push(point_x, up_y)
    ) T% q0 o. n: [) b
  1402.         end
    ) c1 t5 V6 H4 r0 ^# m" `
  1403.         if sheet[point_x, down_y] == 0              &&
    6 S# b4 Y) }8 _. L
  1404.            $game_map.passable(point_x, down_y, 8)  &&
    & g3 v6 r: u; x, p- W
  1405.            !collide_with_events(point_x, down_y)   &&6 R5 b9 ]. j% s2 F' @
  1406.            $game_map.passable(point_x, point_y, 2) &&
    ( _4 l% f4 T+ s; P" j
  1407.            !collide_with_vehicles(point_x, down_y) #judge_end. S5 O1 @7 O. a# J& |
  1408.           sheet[point_x, down_y] = step
      b/ ?2 p! a( {# S9 Z
  1409.           draw_path = true& l9 o2 R# ~& A$ [/ E
  1410.           new_end_points.push(point_x, down_y)
    0 O" P" n6 N  t1 [# ?" f
  1411.         end
    # B2 p# a: @+ k3 b# u
  1412.       end#endOfLoop3: m( e4 E1 c' A0 j7 h
  1413.       break if !draw_path  reach_point% P" v: [# |8 j$ ^. f
  1414.       step += 1. M, X; K2 C+ ?* Y! c( }
  1415.     end #endOfLoop1 路径表格填充完毕
    . R. X: s; q. D3 T9 e% S
  1416.     $mouse_move_sign.transparent = false( R0 v9 A) |1 L, [
  1417.     # 判断指定地点能否抵达# ~# p8 Z$ M# T- a+ m; T$ {! l
  1418.     if reach_point
    . \+ f  I- F  Y, p
  1419.       $mouse_move_sign.direction = 2+ q. G! A% R& d6 s, n1 p0 D0 `8 H
  1420.     else' I$ f  m( i  K8 `& i
  1421.       not_reach_point
    9 l6 z6 l% u# t: }+ F% n3 \
  1422.       return/ i8 w/ F; w) Z( j: [  q- n' o4 d
  1423.     end; `% s( t7 N2 Z; o- Q
  1424.     # 根据路径表格绘制最短移动路径(反向)
    / X  C- r: T5 J9 n- A, p" e. F
  1425.     steps = step  2  2 + 1$ ^; ~- M2 P; M; p/ F. [
  1426.     loop_times = step  2
    # V% |! q- e( o. P
  1427.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]1 W3 q" R: D! j) d: h) d
  1428.     for i in 1..loop_times # forLoop
    ! S3 W; o( Q" i
  1429.     steps -= 2- q  K. G$ k3 G; U! I& G
  1430.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs #反过来?蛋疼了……# \; a  ~5 c' |
  1431.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&4 M& v  J9 y) W0 f4 @
  1432.             $game_map.passable($game_map.round_x(point_x - 1), point_y, 6) &&2 T9 k5 N  q  I  K: |! n
  1433.             $game_map.passable(point_x, point_y, 4)                #judge_end; B4 w9 w& i* g' N3 l7 q9 x& [
  1434.         reversed_chase_path.push(6)7 V: D, P7 N( z1 `7 ~9 g+ P
  1435.         point_x = $game_map.round_x(point_x - 1)
    $ @5 d' D  d5 N- ~4 {9 Z0 l- r
  1436.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&( E. z2 S+ h5 {; J
  1437.             $game_map.passable($game_map.round_x(point_x + 1), point_y, 4) &&1 q6 F  \3 i* l5 v$ J5 i
  1438.             $game_map.passable(point_x, point_y, 6)                #judge_end
    . g3 `7 |7 r+ F' j0 \4 C
  1439.         reversed_chase_path.push(4)
    8 X0 x7 V. y. I& t: n4 p/ Z* {
  1440.         point_x = $game_map.round_x(point_x + 1)) `0 G7 T& Y' g* n
  1441.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&/ |# m9 L, q) L2 u0 }
  1442.             $game_map.passable(point_x, $game_map.round_y(point_y + 1), 8) &&3 u/ T; U& b: L8 M  i' @
  1443.             $game_map.passable(point_x, point_y, 2)                #judge_end+ b! G2 w  s0 V7 E+ W+ V; _$ Q2 }
  1444.         reversed_chase_path.push(8)
    7 U! U) e. }1 K7 f  S5 Z; K
  1445.         point_y = $game_map.round_y(point_y + 1)
    , y2 _9 N# H( {, [
  1446.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&; N1 S* C$ X- C- G3 Z
  1447.             $game_map.passable(point_x, $game_map.round_y(point_y - 1), 2) &&
    4 K8 V( y& L6 D* G; x
  1448.             $game_map.passable(point_x, point_y, 8)                #judge_end
    . l" t3 C. ]$ ?7 Z7 N/ `! t
  1449.         reversed_chase_path.push(2)+ n% ~& `8 k9 J/ j
  1450.         point_y = $game_map.round_y(point_y - 1)
    * z( b; l6 x0 O! @. o
  1451.       end
    ) H( V; v) A; g4 ~' d5 R
  1452.     else
    4 j5 b" Y9 z2 B. B( D  `4 d
  1453.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
    5 j6 n5 ?7 T, f) |7 x* V
  1454.             $game_map.passable(point_x, $game_map.round_y(point_y + 1), 8) &&
    3 W; E  ^0 d' N) G
  1455.             $game_map.passable(point_x, point_y, 2)                #judge_end
    3 m8 n- N5 \2 R2 ~
  1456.         reversed_chase_path.push(8)1 A$ b1 v. g& y! u
  1457.         point_y = $game_map.round_y(point_y + 1)! l0 R2 W# W* H7 l/ ]
  1458.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&5 |/ I7 G1 `# s) P0 a9 Y) V
  1459.             $game_map.passable(point_x, $game_map.round_y(point_y - 1), 2) &&" g* v, t/ `( x3 Y' h1 d) u& l" m
  1460.             $game_map.passable(point_x, point_y, 8)                #judge_end8 R0 ]2 e9 J' j1 a2 u" b
  1461.         reversed_chase_path.push(2)
    ; q" Q# B- j5 w. y) v  l
  1462.         point_y = $game_map.round_y(point_y - 1)" L5 c; N8 l, ~5 E; S9 n& w
  1463.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&2 j5 g1 H) S. b9 Q! d
  1464.             $game_map.passable($game_map.round_x(point_x - 1), point_y, 6) &&
      r  o, o5 N& R8 d
  1465.             $game_map.passable(point_x, point_y, 4)                #judge_end
    : b/ H5 w. D, i1 b
  1466.         reversed_chase_path.push(6)8 q* J5 D) l7 X5 i' K; p
  1467.         point_x = $game_map.round_x(point_x - 1)! W+ H# P/ X! n; G7 j9 ]* c  F
  1468.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&) \9 x4 K( Y, F5 [2 p; y
  1469.             $game_map.passable($game_map.round_x(point_x + 1), point_y, 4) &&2 q) o, f8 Z6 w' J
  1470.             $game_map.passable(point_x, point_y, 6)                #judge_end- i  y, F) Y* K9 X% G
  1471.         reversed_chase_path.push(4)
    $ f; K2 I) d# m
  1472.         point_x = $game_map.round_x(point_x + 1)
    / H  h+ L8 ~# e, N
  1473.       end
    ( |" p9 n: B+ q. k& j7 E1 B6 K3 A% Y
  1474.     end( e, m( j; m1 V
  1475.     end #endOfForLoop
    * N4 s2 m$ K9 R; M& O, q* N
  1476.     # 根据路径表格绘制最短移动路径(正向)
    0 ?0 z3 D& W' D6 }
  1477.     steps = step  2  2
    + l2 i, W- c+ b& U! b
  1478.     loop_times = step  2
    % s. M) U4 ?2 o* _$ i- U; P
  1479.     point_x, point_y = chase_point[0], chase_point[1]
    8 A  t) p: H, o3 Y
  1480.     for i in 2..loop_times # forLoop
    & [( D, b" p" o( ^8 t
  1481.     steps -= 2# X1 v7 {! x/ O5 v4 Z$ E
  1482.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs3 _7 ?& X0 f% ]# b. r6 ~" m
  1483.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
    4 x4 r0 v2 u  y* S5 q
  1484.             $game_map.passable(point_x, $game_map.round_y(point_y + 1), 8) &&
    4 J  x2 k% R# D
  1485.             $game_map.passable(point_x, point_y, 2)                #judge_end, f1 z; ]$ L. p2 y: k+ w) l) c; c! n
  1486.         chase_path.push(2)( r  O9 h3 M( w  Z# T- [
  1487.         point_y = $game_map.round_y(point_y + 1)
      N3 P4 {2 b0 p; X+ \/ l, P# M' c
  1488.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
    + m7 [1 V! x1 y2 j) M! C
  1489.             $game_map.passable(point_x, $game_map.round_y(point_y - 1), 2) &&
    : u& `% h7 b5 }
  1490.             $game_map.passable(point_x, point_y, 8)                #judge_end9 H7 c, ?* i. A# d
  1491.         chase_path.push(8)" j8 u/ h) n9 V& ]
  1492.         point_y = $game_map.round_y(point_y - 1)
    9 A3 _7 T* v( a  ^3 b) i
  1493.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&! S- B4 X9 y( E( D
  1494.             $game_map.passable($game_map.round_x(point_x - 1), point_y, 6) &&
    0 b/ [/ j) V, x2 n# F& C* o
  1495.             $game_map.passable(point_x, point_y, 4)                #judge_end; J7 r/ z) X7 e% V6 R
  1496.         chase_path.push(4)9 |8 [" {+ G* ^8 q% b' [- k
  1497.         point_x = $game_map.round_x(point_x - 1)/ m7 j% O) b0 x" X* L5 K* X
  1498.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
    " F  J5 w* n( a
  1499.             $game_map.passable($game_map.round_x(point_x + 1), point_y, 4) &&* ]! g! h! v7 x' q
  1500.             $game_map.passable(point_x, point_y, 6)                #judge_end
    1 g4 I% S( r6 F5 |) P
  1501.         chase_path.push(6). d% {2 o, t: v9 d- Q
  1502.         point_x = $game_map.round_x(point_x + 1)
    9 S% A/ w% K5 Z* P, s  ]3 e# J9 _
  1503.       end# K* E) q' }# t" s
  1504.     else
    8 ~1 f5 d: M: F4 n
  1505.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&7 x) Z& V7 r& P, D) P
  1506.             $game_map.passable($game_map.round_x(point_x - 1), point_y, 6) &&' _3 q, N  g: |0 a# E
  1507.             $game_map.passable(point_x, point_y, 4)                #judge_end& t4 t$ j: ?* z* _& d1 ^8 j
  1508.         chase_path.push(4): B4 J# X% m8 x' ?9 x
  1509.         point_x = $game_map.round_x(point_x - 1)- @3 [( I- L2 L0 l/ r' [
  1510.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&2 Z0 X7 k4 u2 L8 m0 [, c3 s
  1511.             $game_map.passable($game_map.round_x(point_x + 1), point_y, 4) &&+ s) a! D$ Y/ U' ]0 z2 n3 ]
  1512.             $game_map.passable(point_x, point_y, 6)                #judge_end
    ! H8 |. i9 `- x( @8 z1 Y
  1513.         chase_path.push(6)2 d  r& }9 `/ h: N/ d
  1514.         point_x = $game_map.round_x(point_x + 1)
    5 J% n4 Q, O4 b) N" \9 O
  1515.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&5 {( O+ o7 Q. _, z1 Q
  1516.             $game_map.passable(point_x, $game_map.round_y(point_y + 1), 8) &&
    5 w$ j) t6 b1 Y: f" |3 C7 N2 j
  1517.             $game_map.passable(point_x, point_y, 2)                #judge_end! X4 j* s& e! c% L4 v
  1518.         chase_path.push(2)
    + ~/ t3 S8 Q8 {$ u( Y
  1519.         point_y = $game_map.round_y(point_y + 1)$ p9 ?* X- k" ^, n) a5 G# [4 b
  1520.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
    % W9 o3 N" A1 t! B! r: q1 S7 h
  1521.             $game_map.passable(point_x, $game_map.round_y(point_y - 1), 2) &&
    ( e' v9 \3 R, I2 w: Q4 |# q
  1522.             $game_map.passable(point_x, point_y, 8)                #judge_end
    : _2 b- B4 Y" H2 C- [! d
  1523.         chase_path.push(8): H$ J2 B  J6 @2 @
  1524.         point_y = $game_map.round_y(point_y - 1)
    2 ?4 R! R3 Q1 z  m/ c, `
  1525.       end
    ! ]! O0 H# L' ~' A1 j
  1526.     end
    ) k% v% X% M7 A& ^5 h) ^  }
  1527.     end #endOfForLoop
    " g& e& q5 n/ y
  1528.     @mouse_move_path = reversed_chase_path.reverse + chase_path" r  T: D( n7 r, n) h2 {
  1529.   end#walk
    : O, i4 F$ b+ d) m5 m8 l( n; x) t
  1530.   #--------------------------------------------------------------------------
    ( }+ x3 C3 V* j8 Q9 q! F
  1531.   # ● 绘制boat的移动路径 @array[move_directions...]
    , m3 t. Y0 U: r. F! L1 P' T
  1532.   #--------------------------------------------------------------------------
    ' G, E) B# }+ d* a& G% y
  1533.   def draw_boat_path
      V% p) `4 `& o2 m4 o% E2 X
  1534.     # 准备绘制路径表格
    ( a" h0 A4 |  H; I" r' ~0 B
  1535.     sheet = Table.new($game_map.width, $game_map.height)
    ( v  t: |/ a# O+ [8 D
  1536.     reversed_chase_path  = []; chase_path  = []
    - C6 D5 A* D7 y; h# j) S1 a
  1537.     reversed_chase_point = []; chase_point = []! @4 r3 k- I! |6 {! y0 u1 M
  1538.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]* N1 f; Q3 n! T
  1539.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 28 A7 n) w/ V, V( {0 O
  1540.     reach_point = false* B6 e% H1 _0 c3 K  c# ^4 u. i8 G
  1541.     step = 3
    2 D" X* z% Q' i" o: q0 S4 i  h
  1542.     loop do #loop1 开始填充表格
    + G8 p0 s. E6 X' W9 Z9 F0 E" D: j
  1543.      draw_path = false
    3 q( e; [. ]+ C, Y
  1544.      check_points = new_start_points/ K2 ~, a: @: y$ t& o. S
  1545.      new_start_points = []
    : q( q4 c. T, l1 b! p2 W' P; R
  1546.       loop do #loop2 从起点开始正向填充% G; Y) n& `) ^/ Y! s4 `
  1547.         point_x = check_points.shift
    / I: v/ g" Q) y# v! ?
  1548.         break if point_x == nil- f) f- E! {- `3 L1 P" a2 R$ y
  1549.         point_y = check_points.shift
    3 p, X/ S& v2 t* `4 k
  1550.         left_x  = $game_map.round_x(point_x - 1)
    $ q7 A( n7 E: z( D, ^4 M0 p! ?& u
  1551.         right_x = $game_map.round_x(point_x + 1)
    - v) _* z/ \: s# w5 T* e) |, j) l5 B
  1552.         up_y    = $game_map.round_y(point_y - 1)3 G8 E% T9 [; P0 P% _
  1553.         down_y  = $game_map.round_y(point_y + 1), D3 d. s& {/ y1 Z7 P
  1554.                     # 判断路径是否连通. b3 Y- U3 I8 u+ t6 {: n' {
  1555.         path_step = step - 1. @! r( d& w) s# Y8 H
  1556.         if sheet[left_x, point_y] == path_step
    4 G- ~* K7 g  z
  1557.           chase_path.push(4)
    . l% Q8 }/ V1 \1 d- @8 j
  1558.           chase_point = [left_x, point_y]! |- U/ I2 c$ k' }7 e
  1559.           reversed_chase_point = [point_x, point_y], a6 [" A; ~0 l; w0 s% _2 y$ T
  1560.           reach_point = true; break
    & G# |! y& \3 }, t, f/ A& J
  1561.         elsif sheet[right_x, point_y] == path_step
    9 j0 X* j( b6 n  D
  1562.             chase_path.push(6)& R/ u, k/ D9 X/ \( z
  1563.             chase_point = [right_x, point_y]
    4 j  G# G# }, W) q% T
  1564.             reversed_chase_point = [point_x, point_y]
    6 u2 `' f* c! [0 k9 Q5 r6 |4 B
  1565.             reach_point = true; break4 Z: `4 |# M9 H6 r9 d5 G  s. O
  1566.         elsif sheet[point_x, up_y] == path_step
      N, w# t6 _/ X. b6 C! y, y+ u
  1567.             chase_path.push(8)8 t! @3 J9 L' r$ o0 n7 k
  1568.             chase_point = [point_x, up_y]$ x$ o% O  D% `5 s. N
  1569.             reversed_chase_point = [point_x, point_y]) T2 O, q+ g# W. @
  1570.             reach_point = true; break* o& X( J6 {3 c, i4 a/ [
  1571.         elsif sheet[point_x, down_y] == path_step
    , e/ o# c, X+ [  ~  ^  \9 |
  1572.             chase_path.push(2)% s8 l) `% f" _3 W
  1573.             chase_point = [point_x, down_y]
    2 a" f+ r7 S  r6 `' E
  1574.             reversed_chase_point = [point_x, point_y]; n& O5 _! _, ?# P; G5 w5 `
  1575.             reach_point = true; break
    / G0 H2 e. \$ j1 |5 t1 C2 W. A5 h
  1576.         end
    : @9 k- U% C! D2 ]$ o! D6 b
  1577.         # 以需要抵达该点的步数填充路径表格 #
    4 F2 o: X7 t! h0 ]$ s' l0 `7 n! U
  1578.         if sheet[left_x, point_y] == 0                &&! e. P" G4 L, W, [* M0 L
  1579.            $game_map.boat_passable(left_x, point_y)  &&
    - \2 P3 [6 Y6 j: f
  1580.            !collide_with_events(left_x, point_y)     &&
    + j+ a# w+ m+ l0 J; u* U, D
  1581.            !collide_with_vehicles(left_x, point_y)   #judge_end
    7 Q! Y* y2 M  z: c' ?& O
  1582.           sheet[left_x, point_y] = step8 D0 S# S5 m1 c7 v
  1583.           draw_path = true2 D$ A3 J6 r4 W% I1 ?- @
  1584.           new_start_points.push(left_x, point_y)
    # F2 m" J4 o- @& @7 A
  1585.         end" v. S% X. ~7 G
  1586.         if sheet[right_x, point_y] == 0               &&, |# p0 h# M- n# v8 P( R
  1587.            $game_map.boat_passable(right_x, point_y) &&
    ' {, w  S( k' U
  1588.            !collide_with_events(right_x, point_y)    &&! J1 Z; Z1 I9 |# S
  1589.            !collide_with_vehicles(right_x, point_y)  #judge_end
    , G4 Z6 w: r4 f8 U" ^( e
  1590.           sheet[right_x, point_y] = step2 I# u5 L" h- T0 u$ w0 I
  1591.           draw_path = true5 j: c0 V& q5 L9 a- B! Q
  1592.           new_start_points.push(right_x, point_y)
    7 W' ?% \. e+ D" D- t
  1593.         end
    ) z# h! a, h3 j
  1594.         if sheet[point_x, up_y] == 0                  &&
    ' o3 R6 x( w: m; \1 ]
  1595.            $game_map.boat_passable(point_x, up_y)    &&8 V# n/ E, C5 d6 _0 n
  1596.            !collide_with_events(point_x, up_y)       &&$ C- G6 V  M2 M/ f
  1597.            !collide_with_vehicles(point_x, up_y)     #judge_end
    # i! Y! Q- @6 B0 x% a
  1598.           sheet[point_x, up_y] = step& K# a. T: ?7 A  ~
  1599.           draw_path = true
    1 Y+ Y+ j9 c$ @
  1600.           new_start_points.push(point_x, up_y)3 i, J  j# W' \
  1601.         end( q4 E! T* b/ O2 _  D
  1602.         if sheet[point_x, down_y] == 0                &&
    % A  `6 w. B7 `6 r9 C% s7 ]
  1603.            $game_map.boat_passable(point_x, down_y)  &&/ m9 `  T8 s% a. }  s
  1604.            !collide_with_events(point_x, down_y)     &&# {: o& F4 R. @; @# R6 j) s5 j
  1605.            !collide_with_vehicles(point_x, down_y)   #judge_end8 X/ w0 @5 Z' t% d( u
  1606.           sheet[point_x, down_y] = step
    + w# r) W" D% l0 a* F4 X- h5 O3 r- w0 W" W
  1607.           draw_path = true$ i8 v' ]7 E2 G! x: G
  1608.           new_start_points.push(point_x, down_y)
    # v% e; [- {' }3 b) r( d) M
  1609.         end7 ~: _* M8 D5 R( q8 r
  1610.       end#endOfLoop21 ~( d( \  N+ J9 `
  1611.       break if !draw_path  reach_point  K3 U+ A8 F' B, A
  1612.       draw_path = false
    0 u# E2 @; k( p: P" t
  1613.       check_points = new_end_points
    : h; U9 P5 |3 A5 q
  1614.       new_end_points = []" G  z' G1 r+ r+ {1 H1 l
  1615.       step += 1
    - l" C; d, H9 x2 G/ L" G0 V
  1616.       break if step  KsOfSionBreak_Steps &&
    : t) z0 n" q9 F6 {$ h
  1617.                !Input.press(KsOfSionFind_Path_Key)
    ( B6 [, o/ C7 q$ u4 O: S3 |
  1618.       loop do #loop3 从终点开始反向填充
    , Y" ]7 t3 M2 B8 x8 V# t
  1619.         point_x = check_points.shift
    + Q+ A. n+ s3 z
  1620.         break if point_x == nil
    . o9 S; C9 h, L' N# ?) o' B, S
  1621.         point_y = check_points.shift$ G2 R! t, e1 R: w. j  ^
  1622.         left_x  = $game_map.round_x(point_x - 1)5 j, a$ @; S0 K0 A! F
  1623.         right_x = $game_map.round_x(point_x + 1)+ @) p% o3 P  J. K# H1 Y) a. R: a
  1624.         up_y    = $game_map.round_y(point_y - 1)' D0 L* U4 X; s
  1625.         down_y  = $game_map.round_y(point_y + 1)
    * Q7 E& p$ y3 m6 c# D
  1626.         # 判断路径是否连通2 {! N; r2 d3 P" D3 f* x
  1627.         path_step = step - 1
    . c7 F% t  T; L4 p; O; K
  1628.         if sheet[left_x, point_y] == path_step5 q* C- u- ]( R
  1629.           chase_path.push(6)8 ~: q( O& b6 I9 D+ P3 N6 w, s# Q, d
  1630.           chase_point = [point_x, point_y]
    ' k7 ]+ D9 k5 i$ o) n7 g& A8 F2 O5 W1 s
  1631.           reversed_chase_point = [left_x, point_y]4 ?' N; F+ q' X% x9 S( p
  1632.           reach_point = true; break; ?! D) o; e( V  d; \2 p! a
  1633.         elsif sheet[right_x, point_y] == path_step
    ' B& v- V$ T9 w4 Z% ^1 u+ [
  1634.             chase_path.push(4)
    0 Z4 k+ m: m. x. ^* T2 R* R7 T
  1635.             chase_point = [point_x, point_y]
    ; `+ h0 p. G5 {& p% v) |# R; ^) d
  1636.             reversed_chase_point = [right_x, point_y]
    ! a% O9 w# J0 j" R  M) ]- z
  1637.             reach_point = true; break
    5 J# M+ @( R/ I8 U; s- {9 b
  1638.         elsif sheet[point_x, up_y] == path_step
    3 Z( |3 I# f0 a2 j
  1639.             chase_path.push(2)* C7 B% `' K9 o; X0 H- J. s: w
  1640.             chase_point = [point_x, point_y]
    1 d0 f, v/ t- f  w: u  ]$ F% w; ]
  1641.             reversed_chase_point = [point_x, up_y], ]# p; m& a: |3 N4 G% H
  1642.             reach_point = true; break$ f- J& j9 H8 ?  L/ }1 \5 a( m$ |5 u
  1643.         elsif sheet[point_x, down_y] == path_step
    / `3 j7 W1 q) q* X
  1644.             chase_path.push(8)
    & P. z! L4 x- D' ^- m- N
  1645.             chase_point = [point_x, point_y]
    . ~! v5 J3 d  g% g5 |
  1646.             reversed_chase_point = [point_x, down_y]
    ; G/ U4 g/ p6 u8 ~7 ?
  1647.             reach_point = true; break2 j1 x- [, G2 U1 F7 b2 ?
  1648.         end
    8 f  W* S- y7 L2 w. _+ v
  1649.         # 以需要抵达该点的步数填充路径表格 #% \4 |6 i7 N) F& D7 o. H
  1650.         if sheet[left_x, point_y] == 0                &&' I) p2 L9 G7 j! w. B5 }% \
  1651.            $game_map.boat_passable(left_x, point_y)  &&
    : j9 B4 i! j, X) P' q
  1652.            !collide_with_events(left_x, point_y)     &&/ f' P+ c- S0 y! H$ I' h
  1653.            !collide_with_vehicles(left_x, point_y)   #judge_end: Y  s3 |( h- o" x
  1654.           sheet[left_x, point_y] = step3 P7 _1 E. A* X3 g8 O/ Z
  1655.           draw_path = true
      L4 I% }: E3 U9 s; S
  1656.           new_end_points.push(left_x, point_y)
    : V* W, e" J$ U8 L
  1657.         end
    4 o- @$ }9 W# t- _! g1 @: R4 O
  1658.         if sheet[right_x, point_y] == 0               &&
    6 G4 c' K& H4 G) Y5 |9 v' r# E
  1659.            $game_map.boat_passable(right_x, point_y) &&
    % [9 f( T) @- ^9 i1 a
  1660.            !collide_with_events(right_x, point_y)    &&
    4 }3 e/ t* K; c" w( U' C/ U" X
  1661.            !collide_with_vehicles(right_x, point_y)  #judge_end
    + A8 t$ M4 [4 u# l& }
  1662.           sheet[right_x, point_y] = step
    . I: T1 n8 w+ {" v6 F; J
  1663.           draw_path = true7 _: j/ P$ P2 c( G9 V
  1664.           new_end_points.push(right_x, point_y)9 A% `% k0 }) x& C5 I
  1665.         end
    / g1 z# m) _) \$ q) Q( C
  1666.         if sheet[point_x, up_y] == 0                  &&
    % X, V( W/ |7 V2 Q7 o2 Q( @/ s9 k7 A
  1667.            $game_map.boat_passable(point_x, up_y)    &&. M: P% t/ j7 P% S+ \1 \
  1668.            !collide_with_events(point_x, up_y)       &&
    4 g  W5 V- O- I& N
  1669.            !collide_with_vehicles(point_x, up_y)     #judge_end" }# o  R$ l0 r0 G6 Y1 t) P% ^9 O
  1670.           sheet[point_x, up_y] = step
    3 w- P# ?& l& T$ b5 m
  1671.           draw_path = true7 H  N% U+ j4 Z! o7 g
  1672.           new_end_points.push(point_x, up_y)7 D9 j* Y/ ?" O
  1673.         end
    + |2 m7 k7 i) `$ z) L6 U
  1674.         if sheet[point_x, down_y] == 0                &&' i1 p! V/ g% A) s# T- i
  1675.            $game_map.boat_passable(point_x, down_y)  &&
    / {" B2 V( o  E/ p) `* b% S' H
  1676.            !collide_with_events(point_x, down_y)     &&
    7 p1 l# F5 a" K/ S
  1677.            !collide_with_vehicles(point_x, down_y)   #judge_end, w+ H/ }( u* L
  1678.           sheet[point_x, down_y] = step
    7 p$ g% x# H9 M# g
  1679.           draw_path = true
    1 I3 U8 J8 ^$ P; v7 X: M
  1680.           new_end_points.push(point_x, down_y). b0 K8 `8 A% A- K
  1681.         end
    ! N2 n4 U- e( k( x
  1682.       end#endOfLoop3
    , F0 P5 [- H6 F- B2 ~3 ]
  1683.       break if !draw_path  reach_point
    % n3 T! s3 x$ \% |
  1684.       step += 1" U9 M7 Z7 ^! E1 y: [/ D/ r5 v
  1685.     end #endOfLoop1 路径表格填充完毕' ~% L9 Y' n* V5 h1 f) D
  1686.     $mouse_move_sign.transparent = false* H; H2 ?/ m$ Z( A, O
  1687.     # 判断指定地点能否抵达2 P9 Z1 k9 o* D
  1688.     if reach_point1 V$ }3 R8 Z& b4 ?( U: w: d
  1689.       $mouse_move_sign.direction = 2( A: K0 N7 j) @# {+ \% O
  1690.     else
    8 j  d) U8 u0 E2 g( S+ i) K
  1691.       not_reach_point. I6 l/ Q% X9 h- W; E: O
  1692.       return
    * S  ]" q2 [# X( k$ `0 x' T* G# Y
  1693.     end; R" D, K9 _: f& g& ^3 q! C
  1694.     # 根据路径表格绘制最短移动路径(正向)
    ! s% G$ l( y3 A! m
  1695.     steps = step  2  2+ s6 |% N! A" [3 w# O
  1696.     loop_times = step  2
    & a: L1 s) V0 l0 l6 z8 h
  1697.     point_x, point_y = chase_point[0], chase_point[1]8 q# W. M3 K5 d- ^: b) m
  1698.     for i in 2..loop_times # forLoop
    , f* w2 j% N$ ?% q3 P) b& l/ \
  1699.     steps -= 2
    9 g1 k) O4 q3 d1 P# _3 G9 P9 N
  1700.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs, |) R- J5 |* ]) i7 a( c
  1701.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
    4 w" C( Y. q1 D7 ~
  1702.         chase_path.push(2)
    4 Q; p6 r/ k) x# z0 R
  1703.         point_y = $game_map.round_y(point_y + 1)- Y% U" ]0 V1 T6 z8 H  ^
  1704.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps4 s9 j; Z7 r+ F, `9 Z3 P6 d9 `' X
  1705.         chase_path.push(8)- V  F' ]6 g( @; w7 A/ _
  1706.         point_y = $game_map.round_y(point_y - 1)
    7 Z3 Y" B8 V, P6 X
  1707.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
    % |1 |$ @, W& H" r0 H
  1708.         chase_path.push(4)
    9 O$ }7 [4 l9 E  A4 q7 v
  1709.         point_x = $game_map.round_x(point_x - 1); I$ p' [6 G! W' O% U
  1710.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps: n7 |0 m9 K( q
  1711.         chase_path.push(6): c% m7 R3 @7 ^8 _; K
  1712.         point_x = $game_map.round_x(point_x + 1)4 X6 N* e) \& O+ \2 `; I, P
  1713.       end# C& U0 U3 \; v& }% A' H
  1714.     else
    ! y+ g7 M( M5 ~3 o9 n) v
  1715.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps  b4 N2 {/ v; y* L( n& e! H
  1716.         chase_path.push(4)
    7 @; o' x+ w  P0 K3 @& L* Q/ [
  1717.         point_x = $game_map.round_x(point_x - 1)* R9 W( Y, [1 k" G5 k1 h/ N
  1718.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps8 O# W$ ~; c9 d! j: y* L
  1719.         chase_path.push(6)! F0 P* i. ~: ]) u1 U5 D
  1720.         point_x = $game_map.round_x(point_x + 1)
    5 N5 O0 N2 w& N5 @7 e1 h# |
  1721.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps5 r9 L7 Y7 Q, {: P! N
  1722.         chase_path.push(2)
      D4 t& U! |% y$ k9 M3 }
  1723.         point_y = $game_map.round_y(point_y + 1)
    / w8 K* P, n& A
  1724.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps" E6 d& N+ O% l  j9 k; l. M; F" _4 \
  1725.         chase_path.push(8)4 ~5 G. `9 x5 Y' q
  1726.         point_y = $game_map.round_y(point_y - 1)
    4 w' N) I  w) u/ }  I$ g+ j
  1727.       end* J  U* {% s8 u
  1728.     end8 o2 ~" F. Y2 P  _
  1729.     end #endOfForLoop
    ) I; O# \8 @& T) X# m* q& Y
  1730.     # 如果指定点无法抵达或者登陆
    4 N3 C! n- ^* G# K1 w! V
  1731.     return not_reach_point unless landable(@moveto_x, @moveto_y, chase_path); U. s9 O+ D  h" ^4 e2 g
  1732.     # 根据路径表格绘制最短移动路径(反向); W2 a# M  R& T5 Z( s
  1733.     steps = step  2  2 + 1
    * q" M$ }3 U8 [! h: U$ R: N
  1734.     loop_times = step  2# k% k' F, Y( g3 a' Z
  1735.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]8 L8 l& b- z+ i% _- f( `7 P+ x9 E
  1736.     for i in 1..loop_times # forLoop
    " c* @' [. o! P, `/ q
  1737.     steps -= 2$ D1 p' O( C+ Z2 q& T6 P$ c
  1738.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs' L! F: G( i% r9 c4 g
  1739.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
    6 u# n0 V& W3 g
  1740.         reversed_chase_path.push(6)8 B/ u( G# V5 ?8 Z" L3 h
  1741.         point_x = $game_map.round_x(point_x - 1)
    0 Z; q, V5 {/ L/ G; h
  1742.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
    & r! O) Q8 D, ^" f$ }6 j
  1743.         reversed_chase_path.push(4)) r/ e5 t1 Q# l% s; [
  1744.         point_x = $game_map.round_x(point_x + 1)
    $ D" z( y0 u, v2 T# C+ h
  1745.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps/ }/ n& e- s. C2 a7 v& ?6 n* W  @
  1746.         reversed_chase_path.push(8)6 Y7 z: i9 k- T" A! j
  1747.         point_y = $game_map.round_y(point_y + 1)
      v  ?/ P9 I# V' W+ B4 G. _' D0 J
  1748.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
    / h. p# ?6 |: V% M8 F- H, p
  1749.         reversed_chase_path.push(2)
    8 s2 m# v# K) E0 \5 {" t
  1750.         point_y = $game_map.round_y(point_y - 1)) O+ @- g1 Y; }# ?
  1751.       end
    # `8 y% T( s' J4 W3 p. w$ ^
  1752.     else! Z1 ]+ k# {/ J
  1753.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
    " H7 p7 F6 l- j$ L5 A$ @" L
  1754.         reversed_chase_path.push(8); T4 P. t; b- F0 b. O
  1755.         point_y = $game_map.round_y(point_y + 1). ^: Z% z, T3 j0 d3 F
  1756.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps) Z, `$ Y3 Q- J  a1 o- |
  1757.         reversed_chase_path.push(2)
    & Z9 e+ M( @  T% ^' c: c4 X
  1758.         point_y = $game_map.round_y(point_y - 1)/ _1 H5 V6 @* B6 h- S# t, G+ @; }
  1759.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
    ' i% x7 f5 @& A+ x. R0 @
  1760.         reversed_chase_path.push(6)
    $ l4 b! H  f4 w1 ~1 |: r0 G3 z
  1761.         point_x = $game_map.round_x(point_x - 1)6 p" ]+ l; i* i- v6 h
  1762.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps4 l; h7 d% m( u: t1 `5 T+ w2 r
  1763.         reversed_chase_path.push(4)
    0 C3 q8 w1 n+ l: G
  1764.         point_x = $game_map.round_x(point_x + 1)
    6 u# c6 Y4 c: A' _- X
  1765.       end. G( O" u4 R9 Z" s& m2 x
  1766.     end8 |% m5 J/ q; g. m3 \, _3 E
  1767.     end #endOfForLoop6 q; R, n8 J7 n. P5 k, {
  1768.     @mouse_move_path = reversed_chase_path.reverse + chase_path1 w. \4 V& g$ C8 g% ^
  1769.   end#boat6 W+ @8 ~0 e' s# e
  1770.   #--------------------------------------------------------------------------) O( j; h7 ^. B9 N" z
  1771.   # ● 绘制ship的移动路径 @array[move_directions...]
    * L) |7 U4 b( ^# X, I  |  Q
  1772.   #--------------------------------------------------------------------------% W. J& `3 M4 M% l; X: ~; y
  1773.   def draw_ship_path
    / Z2 B6 l# @" f* U8 V5 ]4 x
  1774.     # 准备绘制路径表格! M: S% d" b/ p8 L" I  y) P. q3 @! }% _
  1775.     sheet = Table.new($game_map.width, $game_map.height)( [4 d' \4 ~& V# h
  1776.     reversed_chase_path  = []; chase_path  = []
    $ u; I1 j( e( W! U, ?0 x9 w( d
  1777.     reversed_chase_point = []; chase_point = []1 z7 [+ C% t8 B+ l
  1778.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]
    5 u5 j4 l' r) M
  1779.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2  q4 E# Z) \+ c  w, R/ v7 G
  1780.     reach_point = false
    3 j7 ?; f+ a  E
  1781.     step = 38 F) u' w8 B/ y: l) p
  1782.     loop do #loop1 开始填充表格9 E( {9 L/ a, G9 K: _/ y( Y
  1783.      draw_path = false) C: S8 z: Z, \# q
  1784.      check_points = new_start_points: f# Y6 ]2 z! h7 c- i
  1785.      new_start_points = []
    7 M: Q; @# R# c/ E: }* v
  1786.       loop do #loop2 从起点开始正向填充
    * J; N' Q, t6 f2 C
  1787.         point_x = check_points.shift# Z1 Z# @; s+ V; E
  1788.         break if point_x == nil
    5 ^; Y$ H3 W) m% ?) ?
  1789.         point_y = check_points.shift
    * N8 e% u& k9 I4 W( Z
  1790.         left_x  = $game_map.round_x(point_x - 1)0 a; }2 R: e" I( b! G
  1791.         right_x = $game_map.round_x(point_x + 1)* G0 d" h4 S: g- j( @: b2 o
  1792.         up_y    = $game_map.round_y(point_y - 1)' R* N1 l) |! C9 f" B0 P5 H
  1793.         down_y  = $game_map.round_y(point_y + 1)5 l! M5 c3 _/ |  r7 I8 O  Q9 k
  1794.                     # 判断路径是否连通7 P! N% i# S9 [$ z2 t
  1795.         path_step = step - 1
    / p% O, _4 g9 t9 V( O" A# V& L+ k
  1796.         if sheet[left_x, point_y] == path_step
    6 J0 t# ?, Y- o5 I( C! H
  1797.           chase_path.push(4)
    ; S" K% d' n+ P- m$ b$ g+ V
  1798.           chase_point = [left_x, point_y]2 _; g' L% g6 U- h
  1799.           reversed_chase_point = [point_x, point_y]9 ?8 s3 _( o6 D2 m& K8 ?6 w
  1800.           reach_point = true; break" ~" D% w1 T7 X- V
  1801.         elsif sheet[right_x, point_y] == path_step
    4 {2 |8 o3 R: g( A5 r  i
  1802.             chase_path.push(6)
    ; @: G7 `! t- {' G, O0 k
  1803.             chase_point = [right_x, point_y]
    ) t( m) \! g3 V7 ^6 g. a
  1804.             reversed_chase_point = [point_x, point_y]0 v, ^1 G. ]2 N/ B2 `
  1805.             reach_point = true; break
    2 |" p: _! [) N8 f' P
  1806.         elsif sheet[point_x, up_y] == path_step0 s& t+ v4 s0 p5 c9 t
  1807.             chase_path.push(8)
    ' k3 K6 m1 t4 G2 N3 T
  1808.             chase_point = [point_x, up_y]
    ) ~$ ~6 L/ Z8 }+ G0 i
  1809.             reversed_chase_point = [point_x, point_y]% E5 f+ l# g6 Y5 t) j
  1810.             reach_point = true; break  n, N6 c; f% ]" E
  1811.         elsif sheet[point_x, down_y] == path_step
    # J# g" C2 v- U& ]8 g7 o3 [* ^: z
  1812.             chase_path.push(2)
    , t, h) p. s. g( ~+ ~  k
  1813.             chase_point = [point_x, down_y]- V5 T# w0 n0 u3 i* ?& _
  1814.             reversed_chase_point = [point_x, point_y]: u! ?! a' ^" v- D8 w
  1815.             reach_point = true; break
    ( r( t1 d' n" d: a
  1816.         end
    " C4 ^$ w" ]: ~( G/ X
  1817.         # 以需要抵达该点的步数填充路径表格 #2 w. I% c  U8 L7 X; O5 ^
  1818.         if sheet[left_x, point_y] == 0                &&9 `% ^0 b" q# f" o" \7 M
  1819.            $game_map.ship_passable(left_x, point_y)  &&
    ! v1 K- F0 D7 O4 A$ |# _9 Y
  1820.            !collide_with_events(left_x, point_y)     &&
    - _" \  n5 U4 R3 Z0 `$ H5 ]( C8 N
  1821.            !collide_with_vehicles(left_x, point_y)   #judge_end
    ' J' r+ T0 g$ Q% g+ o
  1822.           sheet[left_x, point_y] = step
    , y- y& Z, }" @. p
  1823.           draw_path = true6 n8 p' Q/ }- ^( L' S- ^
  1824.           new_start_points.push(left_x, point_y)
    : I6 n6 e% `6 u1 j
  1825.         end
    # H5 v2 s4 v( m+ M6 L
  1826.         if sheet[right_x, point_y] == 0               &&& |/ j( n7 q0 @% }3 B( c3 a
  1827.            $game_map.ship_passable(right_x, point_y) &&  N; Z& g0 E3 B8 d. r
  1828.            !collide_with_events(right_x, point_y)    &&
    4 X! b% N/ Z. x& Q
  1829.            !collide_with_vehicles(right_x, point_y)  #judge_end
    ) |8 Q2 E- Z. z+ t( ]7 J* x
  1830.           sheet[right_x, point_y] = step( C( T' k, S: x( E. {
  1831.           draw_path = true6 ]& m( ~7 g( N" C, D  c3 e
  1832.           new_start_points.push(right_x, point_y)! @4 m; D/ S( D$ i" [$ m- T
  1833.         end: v: J* q( m& d% I
  1834.         if sheet[point_x, up_y] == 0                  &&. C6 P; A, G  @4 j: P# i( ]3 t
  1835.            $game_map.ship_passable(point_x, up_y)    &&
    , j% ^- L8 u, q; V7 |
  1836.            !collide_with_events(point_x, up_y)       &&
    - v0 S+ W0 `( Z2 G9 ~, r$ [
  1837.            !collide_with_vehicles(point_x, up_y)     #judge_end  w; j& K" u7 |+ j
  1838.           sheet[point_x, up_y] = step
    : ~7 ?5 ~$ W7 A( ~0 p1 o) X" H
  1839.           draw_path = true
    6 P! M/ ^9 ?3 o9 g- G# h
  1840.           new_start_points.push(point_x, up_y)  M4 u0 X9 X6 y- y8 m& s
  1841.         end
    2 v; @; |/ i' M% R7 b4 o
  1842.         if sheet[point_x, down_y] == 0                &&
    % U. B/ U' @* n, l# v0 I
  1843.            $game_map.ship_passable(point_x, down_y)  &&
    ' M4 ~% k0 f; b# d) ]$ z4 _
  1844.            !collide_with_events(point_x, down_y)     &&
    * G, d+ {1 @1 E1 o! |6 j7 N. Y( T
  1845.            !collide_with_vehicles(point_x, down_y)   #judge_end, ]2 d% g; [5 E7 i# q
  1846.           sheet[point_x, down_y] = step# d$ M+ K$ z& z4 K% ]7 x
  1847.           draw_path = true
    - Y% d: l  R0 Z, A8 B
  1848.           new_start_points.push(point_x, down_y)
    + e1 J  R( c% \" n) y+ ]+ Q
  1849.         end" k, H" Q" l, |( H$ D0 _7 S- ?
  1850.       end#endOfLoop2+ B- l  x) v/ \* ]( l& D) H% o
  1851.       break if !draw_path  reach_point
    8 O9 ~0 G6 r: ]  ]) J
  1852.       draw_path = false
    ' d$ ^1 a8 L# s% q" Z% N  V4 C
  1853.       check_points = new_end_points
    % }6 v5 v2 m4 i
  1854.       new_end_points = []/ l9 V! {1 w- E6 m& h  e
  1855.       step += 1
    ) K# m1 A; U6 `  t3 s& ~
  1856.       break if step  KsOfSionBreak_Steps &&
    ' b( v: n7 c7 G$ `4 K! }1 ]' I
  1857.                !Input.press(KsOfSionFind_Path_Key)) [4 ]( g* a* A) W- l" e7 m  B
  1858.       loop do #loop3 从终点开始反向填充
    1 S8 h! x4 s  ]2 t
  1859.         point_x = check_points.shift4 V) m' r( [  ^  l. y+ N5 Z
  1860.         break if point_x == nil
    : q1 Y2 d( p5 t$ Q6 B
  1861.         point_y = check_points.shift
      y: b# D, o: V. w4 `7 B
  1862.         left_x  = $game_map.round_x(point_x - 1). F5 [9 H/ q; l" G$ S: g( I; |" S
  1863.         right_x = $game_map.round_x(point_x + 1)# w- G* Y, D9 O( \. t7 y9 @* ]
  1864.         up_y    = $game_map.round_y(point_y - 1)' T1 U2 O! P/ g: ^0 @) [
  1865.         down_y  = $game_map.round_y(point_y + 1): n& L' S8 G# b( o3 ^- M8 ?
  1866.         # 判断路径是否连通+ `& o# D% X& e
  1867.         path_step = step - 14 {) _6 c( I  g* e& j, e2 r& V
  1868.         if sheet[left_x, point_y] == path_step
    ) j5 C) ]- O3 g4 z9 L
  1869.           chase_path.push(6)
    / R' @( ^) y& x5 A5 W+ v4 a
  1870.           chase_point = [point_x, point_y]3 H$ _3 [5 q$ h
  1871.           reversed_chase_point = [left_x, point_y], R' w; y7 c9 Q9 {+ j! Y0 v
  1872.           reach_point = true; break. z* ]" g% @; n" e
  1873.         elsif sheet[right_x, point_y] == path_step2 f! j: g: Z$ y. u! r" w% j5 S0 \# H0 ^3 A
  1874.             chase_path.push(4)( S4 ^5 |* Y5 F7 ]" f$ {
  1875.             chase_point = [point_x, point_y]
    & q% u6 G5 K# M* v/ I0 V7 Z/ c
  1876.             reversed_chase_point = [right_x, point_y]
    * J$ p/ z$ r2 R* e1 I9 Q5 B( h
  1877.             reach_point = true; break
    , E3 S: D7 a. j
  1878.         elsif sheet[point_x, up_y] == path_step2 e, t0 M% F& \( z. e/ A3 l# }" q
  1879.             chase_path.push(2)! V! y9 W) e3 Z& s4 U; l' `
  1880.             chase_point = [point_x, point_y]9 d7 Y- _$ o2 V7 N
  1881.             reversed_chase_point = [point_x, up_y]& Q! }! _2 T* F& l% c; I7 m
  1882.             reach_point = true; break4 |/ w: q7 Z  W
  1883.         elsif sheet[point_x, down_y] == path_step# x2 G( M/ D" ^/ q& N( A9 @/ D
  1884.             chase_path.push(8)
    . X$ T' ?( f2 R  e" q0 N' |
  1885.             chase_point = [point_x, point_y]
    ' G$ ~7 D1 O5 o& k& b' ^
  1886.             reversed_chase_point = [point_x, down_y]* P7 I+ K/ H7 }1 b) v1 `
  1887.             reach_point = true; break
    ' \; G3 {7 d: F0 x) d1 k
  1888.         end% }$ V) C& h6 {) ^; [
  1889.         # 以需要抵达该点的步数填充路径表格 #) h6 }: |+ g4 `" h
  1890.         if sheet[left_x, point_y] == 0                &&
    : z3 ~$ E. `0 q# H3 g! B7 |' i$ j
  1891.            $game_map.ship_passable(left_x, point_y)  &&! P/ @2 t7 ]% b8 G3 q* y
  1892.            !collide_with_events(left_x, point_y)     &&, y. `; `6 W) C2 p8 s
  1893.            !collide_with_vehicles(left_x, point_y)   #judge_end
    6 d; G3 R5 B5 D  d( C/ A
  1894.           sheet[left_x, point_y] = step4 ~$ o" F# x( j7 D3 u0 T6 H7 q
  1895.           draw_path = true& N4 |: y; t* \$ a; ]
  1896.           new_end_points.push(left_x, point_y)
    ( r1 p+ ~& |  U
  1897.         end
    ; }* Q8 l8 ?1 ~/ J/ ]" Q# d+ i! Z
  1898.         if sheet[right_x, point_y] == 0               &&
    ' a! l) r3 Z) G
  1899.            $game_map.ship_passable(right_x, point_y) &&
    0 q. f: w( r* i9 R) z, z5 ]+ ?
  1900.            !collide_with_events(right_x, point_y)    &&) \/ ]- c2 `  k/ Z6 a
  1901.            !collide_with_vehicles(right_x, point_y)  #judge_end
      C1 W6 D! R* L2 Q; c
  1902.           sheet[right_x, point_y] = step
    % X% N  A& X5 o  ]" c
  1903.           draw_path = true4 Z  s. F# o/ p% D1 w" d
  1904.           new_end_points.push(right_x, point_y)- ^- P' l1 c4 [* C" }) L/ w4 |
  1905.         end) M. y( G: S" [/ w9 @  }
  1906.         if sheet[point_x, up_y] == 0                  &&
    ( P0 e$ h/ ]2 n8 V# M2 B
  1907.            $game_map.ship_passable(point_x, up_y)    &&
    % @$ C) {) g) E, h5 w2 V
  1908.            !collide_with_events(point_x, up_y)       &&# P4 ~: r3 L$ I1 X1 b& [0 U
  1909.            !collide_with_vehicles(point_x, up_y)     #judge_end! g) e2 k% ~, }$ T: m$ N
  1910.           sheet[point_x, up_y] = step
    , N* v, D# d4 _; R  }( W6 h+ ^$ Y: l
  1911.           draw_path = true, C$ b" n: h+ Y1 T8 C& R  ?7 g
  1912.           new_end_points.push(point_x, up_y)0 O; ?0 R6 {! A/ K6 V# j$ s
  1913.         end
    ; u! Z6 H5 e# V& A/ a+ ?& z  W2 _
  1914.         if sheet[point_x, down_y] == 0                &&
    ) F) y8 |* m/ U5 e# R+ \- j
  1915.            $game_map.ship_passable(point_x, down_y)  &&) I, T* n- @+ v9 ]+ C) D
  1916.            !collide_with_events(point_x, down_y)     &&
    , U. d& A4 P9 I# H
  1917.            !collide_with_vehicles(point_x, down_y)   #judge_end- g; N. \& R/ C+ O5 N* g# K* w
  1918.           sheet[point_x, down_y] = step
    8 r/ f5 m/ e6 h# N5 G$ I
  1919.           draw_path = true
    6 ]2 n) {' |( _1 u
  1920.           new_end_points.push(point_x, down_y)
    ) ?* C9 u4 J. v
  1921.         end: d$ B% {. Q/ d6 h5 ?$ ?
  1922.       end#endOfLoop3
    , C+ K: b& {# A
  1923.       break if !draw_path  reach_point
    ( }1 h3 r/ i4 \0 B0 _  E
  1924.       step += 1+ Z% ~( s3 m3 b; p
  1925.     end #endOfLoop1 路径表格填充完毕: v" G4 X% v' K2 M- ~1 w0 i
  1926.     $mouse_move_sign.transparent = false
    . X9 @1 g, t1 c: o* M+ ^2 C
  1927.     # 判断指定地点能否抵达
    * l& g/ a$ c  m* Z1 x, `; j
  1928.     if reach_point9 i( k3 d- @/ P5 _
  1929.       $mouse_move_sign.direction = 2
    7 S  S; W0 Z% e: n7 K
  1930.     else
    : ~9 t# N1 j5 S1 L, g* o
  1931.       not_reach_point9 Z* g( k( R3 u3 G( X+ ]" }
  1932.       return) V$ n6 s5 r1 G) Y! \& a6 l* D
  1933.     end
    % F& F% c4 A3 r+ |) t
  1934.     # 根据路径表格绘制最短移动路径(正向)
    7 ^; ?0 J0 A% `. `) b- I: P
  1935.     steps = step  2  2
    7 E3 d$ t8 v. U$ L
  1936.     loop_times = step  2& t. H; U7 q; Y  B) x
  1937.     point_x, point_y = chase_point[0], chase_point[1]
    3 f2 ?. P. Y6 U0 Z# B, n8 u- d
  1938.     for i in 2..loop_times # forLoop
    . C& j: c" l* N. k! ]
  1939.     steps -= 2
    3 M( n9 m$ G& ]
  1940.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs2 y# L" ~8 P% p
  1941.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps  G5 @& K6 E' U' V# u9 D- w
  1942.         chase_path.push(2)+ C8 s  s/ t# D/ W, s) H
  1943.         point_y = $game_map.round_y(point_y + 1)" {% ?& O+ C) o4 I6 u
  1944.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
    & k1 J( G; Y7 {/ @
  1945.         chase_path.push(8)
    3 e) l! F  Z$ X3 n4 V# x; s  K
  1946.         point_y = $game_map.round_y(point_y - 1)
    & W  `2 H% A9 R
  1947.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
    % k2 }; \! I  ]9 w) |- Z  i
  1948.         chase_path.push(4)$ g7 t" i% P! \* U8 H9 K1 q
  1949.         point_x = $game_map.round_x(point_x - 1): d  Z8 u/ e& v9 L3 ~
  1950.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
    / w: G( |# q. t- |6 ?+ v1 E
  1951.         chase_path.push(6)
    ! V7 y5 V+ a" c
  1952.         point_x = $game_map.round_x(point_x + 1)! n4 u" m: J6 W
  1953.       end
    ( \& M: L3 x4 l: u/ j# F+ Z
  1954.     else
    6 b; X/ V# j+ V
  1955.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps9 h4 w( u3 p# x! @* ^8 P* q
  1956.         chase_path.push(4)
    7 ]9 |9 x- D; ?
  1957.         point_x = $game_map.round_x(point_x - 1)# O# W, L- u, V6 K4 P& C/ b
  1958.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps9 w" A0 W$ V8 u) f+ p
  1959.         chase_path.push(6)
    + \2 ^) v+ o# n/ J! s- n* ^
  1960.         point_x = $game_map.round_x(point_x + 1); _8 @: J' t$ b7 t, L& R
  1961.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
    6 p4 _2 \" Z# R: A: k+ `1 k$ G- o/ G
  1962.         chase_path.push(2)
    - v' R( g/ a6 X2 e0 W
  1963.         point_y = $game_map.round_y(point_y + 1)
    5 P' f7 J2 O+ R% i2 l# @
  1964.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps' w" T) N9 o: ]+ P
  1965.         chase_path.push(8)! L6 b% J" N+ M( C6 _' d9 j
  1966.         point_y = $game_map.round_y(point_y - 1)
    6 c+ L- i" f0 _# O, p5 x
  1967.       end
    + i6 v) {0 ~( k5 H3 S
  1968.     end
    ; n( }2 T+ M, [. }6 ~: t, |9 I
  1969.     end #endOfForLoop8 }8 u' J5 c* X# b9 S- @  B
  1970.     # 如果指定点无法抵达或者登陆; {6 v$ v+ w. E! W
  1971.     return not_reach_point unless landable(@moveto_x, @moveto_y, chase_path)
    + S+ p6 g6 @* `. A
  1972.     # 根据路径表格绘制最短移动路径(反向)2 B( e5 Y# B+ `
  1973.     steps = step  2  2 + 16 F' _: J6 W& I" z" r
  1974.     loop_times = step  2) v' g$ {: k6 H/ o/ X' J# X; E/ |
  1975.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]' l/ M, D) s! u  \6 i: x6 U
  1976.     for i in 1..loop_times # forLoop
    0 k8 t3 Z& K# O5 x5 K3 S
  1977.     steps -= 24 p6 r$ u1 X3 Q4 A9 B
  1978.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs# Z/ d# W" A: r5 b$ s. v0 w" J
  1979.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps) J# A" p; P, S& j. R6 W
  1980.         reversed_chase_path.push(6)4 h8 A: c( G$ N
  1981.         point_x = $game_map.round_x(point_x - 1), W# a1 }" Q* l: _+ a
  1982.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps3 I5 x7 A2 g+ N2 z2 B8 z
  1983.         reversed_chase_path.push(4)0 |) V1 o+ _0 K: C5 J0 Z; w0 ~. a
  1984.         point_x = $game_map.round_x(point_x + 1): O! s; |+ _2 v9 p/ ^! v( N; [
  1985.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps" B& @" f. [$ |; ~& g1 J
  1986.         reversed_chase_path.push(8)
      g6 M; S9 [7 K) l+ w& f8 a
  1987.         point_y = $game_map.round_y(point_y + 1)
    % V9 n. H' k% M" |( ~# y) J
  1988.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
    % h# |# M0 L. u( d$ U; f
  1989.         reversed_chase_path.push(2)! h8 D% w, L7 w4 q1 Q
  1990.         point_y = $game_map.round_y(point_y - 1)
    ' d% T1 [" `* f8 s: \
  1991.       end
    ( D( s# V8 b3 F  F% u) z; }
  1992.     else
    " [0 Z0 h* i+ f/ K8 K- k
  1993.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
    + [9 T$ q( S% U
  1994.         reversed_chase_path.push(8)) j; H3 R2 N0 V7 Y
  1995.         point_y = $game_map.round_y(point_y + 1)0 d* K6 {9 ]0 h' W4 [! _: d* @6 M
  1996.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps1 h* b) n* U1 Y+ u- ?: n# I- {
  1997.         reversed_chase_path.push(2)2 |) A) T) A* O: t$ p( }6 Z  L
  1998.         point_y = $game_map.round_y(point_y - 1)$ A. Q  r2 m) w0 O/ P' {* |6 i
  1999.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps- B7 N1 c' k! {* f& c- k, |
  2000.         reversed_chase_path.push(6)
    ( |* |; w8 M. e) Q1 H
  2001.         point_x = $game_map.round_x(point_x - 1)
    9 Y8 r1 m! \; p! S
  2002.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps- D( p5 R; S" u* e9 v  z. E$ y
  2003.         reversed_chase_path.push(4): Y: @! ~( X: b' ~5 W. b1 S- N
  2004.         point_x = $game_map.round_x(point_x + 1)0 R2 M- k' l+ e" t7 L/ M# A4 T" z
  2005.       end
    ) B4 {) t5 {( S% j5 o+ E  z
  2006.     end7 J; R$ W( w4 _8 C5 L9 D) Q5 r
  2007.     end #endOfForLoop2 Z* z, w% l( U
  2008.     @mouse_move_path = reversed_chase_path.reverse + chase_path
    0 R/ o( H* k4 l7 D
  2009.   end#ship
    % K$ m" `, V/ u, Y1 \# M4 V/ a
  2010.   #--------------------------------------------------------------------------
    - _4 B, X1 X4 P
  2011.   # ● 绘制airship的移动路径 @array[move_directions...]" h7 [" S' q/ B$ F6 i) o
  2012.   #--------------------------------------------------------------------------0 N: x( `/ f6 j; s: A
  2013.   def draw_air_path, [+ p0 N) b. Z* j1 a/ B7 q  }' H
  2014.     $mouse_move_sign.transparent = false# T6 h. `5 x: E9 ~5 |' q% P0 l$ C
  2015.     # 准备绘制路径表格. S9 G# C- ]9 P2 _
  2016.     sheet = Table.new($game_map.width, $game_map.height)+ K! {/ J7 j. `, }1 O/ `
  2017.     new_check_point = [x, y]; sheet[x, y] = 1
    ' W+ E( Y8 b' |" p3 W
  2018.     reach_point = false;      step = 26 P0 n$ `0 u* ^+ A: K9 D) x, f
  2019.     loop do #loop10 D1 `9 o3 g/ q, H5 d2 {/ I- q. X
  2020.      check_point = new_check_point+ A: S7 D5 z. m+ k+ V% F
  2021.      new_check_point = []! j, ~) @* w. Z
  2022.       loop do #loop2: n$ G& l. F) v
  2023.         point_x = check_point.shift
    / u' Q1 B; b6 o7 }! @/ D
  2024.         break if point_x == nil
    4 p2 I1 a3 B2 M. k
  2025.         point_y = check_point.shift
    ; e7 g/ M5 k) y9 G
  2026.         if point_x == @moveto_x && point_y == @moveto_y- b7 C+ w9 t" H  ^9 ]
  2027.           reach_point = true; break
    + d: Q+ @# H$ U9 {) X9 M
  2028.         end! K' L9 N1 T) i/ l, J% n
  2029.         left_x  = $game_map.round_x(point_x - 1)
    , ^( ~& i* g/ I
  2030.         right_x = $game_map.round_x(point_x + 1)
    / y3 r: G  n8 |: v! s8 T
  2031.         up_y    = $game_map.round_y(point_y - 1)
    6 C0 b% H( t- @. Y3 C1 t
  2032.         down_y  = $game_map.round_y(point_y + 1)
    - k! }& N* i5 u' F" }. u
  2033.         # 以需要抵达该点的步数填充路径表格 #
    ' _7 c0 N! ~, R; a9 y
  2034.         if sheet[left_x, point_y] == 0- a* `" W! c5 h
  2035.           sheet[left_x, point_y] = step! F  e- C) t2 ^6 e' x8 m
  2036.           new_check_point.push(left_x, point_y)9 O( `0 Q( V- W5 x1 ?
  2037.         end
      T: l" {  r5 G) U7 L
  2038.         if sheet[right_x, point_y] == 0+ g. B+ n5 K- C0 T; F+ ]
  2039.           sheet[right_x, point_y] = step0 }% X8 E( x' U
  2040.           new_check_point.push(right_x, point_y)
    & Q# ]1 E- D5 ^" M
  2041.         end
    & m  }, d2 d0 r; P4 d6 W
  2042.         if sheet[point_x, up_y] == 0% g" t- z4 W& r" D$ a, {* }2 `; s
  2043.           sheet[point_x, up_y] = step1 y% {$ O5 p, E$ f
  2044.           new_check_point.push(point_x, up_y)2 H* p& d3 M! ^: O
  2045.         end
      e5 \& q% D& o: H+ m
  2046.         if sheet[point_x, down_y] == 09 l" b- c* {6 T$ h  F: A
  2047.           sheet[point_x, down_y] = step
    $ k6 }# \) H2 X1 b
  2048.           new_check_point.push(point_x, down_y)
    # o* }* {5 S$ S+ x; s# i  V
  2049.         end0 d) H' I  y" m
  2050.       end#endOfLoop2
    5 v/ Q8 I- Y" n, y
  2051.       break if reach_point/ R# {0 y" A9 F7 Z; g) x- U' r* Z: j
  2052.       step += 1/ O, T0 R- G: a2 M% M5 l  I* K
  2053.     end #endOfLoop1
    ( ^  X) ?/ u. i" M- B% z
  2054.     # 根据路径表格绘制最短移动路径 #5 p& g. V# F$ C. G
  2055.     reversed_chase_path = []; step -= 1
    ( L: _) G  X3 \" O& Q' k$ P$ o" {
  2056.     point_x, point_y = @moveto_x, @moveto_y! Z& r. C8 S* |- \2 F4 z
  2057.     for i in 2..step# l! x# O, W% f5 J9 w3 l5 R0 r: f( Z
  2058.     step -= 1
    , s, Q4 W3 {. s- o8 m" ~
  2059.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs% I* s- R6 S. b# _. q
  2060.       if    sheet[$game_map.round_x(point_x - 1), point_y] == step; P! g9 B& L* ?1 V: w# [& @) X
  2061.         reversed_chase_path.push(6)
    : F) j3 S! K5 V6 s8 _
  2062.         point_x = $game_map.round_x(point_x - 1)
    * K! g( G9 r1 ~' p
  2063.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == step
    3 v+ C, h1 t. w7 [1 z* z' o) N
  2064.         reversed_chase_path.push(4)9 {  J: V+ Y$ Y) `* l- X
  2065.         point_x = $game_map.round_x(point_x + 1)2 w2 W4 R4 e: l0 E
  2066.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == step  u# c* ?: ^- F5 }
  2067.         reversed_chase_path.push(8)
    4 q/ L+ |% q0 U1 @8 Y' F9 y9 @9 Q
  2068.         point_y = $game_map.round_y(point_y + 1)$ Q) y( j2 {% Z- I# X9 C1 p2 p
  2069.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step2 f6 B1 J, ~8 e$ ?7 W, Z/ ?
  2070.         reversed_chase_path.push(2)
    2 L% n3 [% G: J  z1 j
  2071.         point_y = $game_map.round_y(point_y - 1)
    8 W( S: E( b2 [0 T, ^0 N  c1 j, i
  2072.       end+ ]; C" E+ h) \; t
  2073.     else7 E! ?! l: H0 E2 U; x) E
  2074.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == step
    + |) E3 I  j5 P
  2075.         reversed_chase_path.push(8)
    2 F+ a3 V% t+ ]  E! T. F
  2076.         point_y = $game_map.round_y(point_y + 1)
    ! w0 T8 A( _( }) o) h* @: s
  2077.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step% i! y4 C6 }6 f- u: s3 f2 X6 T
  2078.         reversed_chase_path.push(2)
    * @+ F( X' w- z3 A
  2079.         point_y = $game_map.round_y(point_y - 1)
    1 r. f4 `8 J8 s% m+ ?
  2080.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == step5 \4 v' `! W( s& Y. a% a; }
  2081.         reversed_chase_path.push(6)
    $ e4 q6 M" N7 v# a9 M
  2082.         point_x = $game_map.round_x(point_x - 1)
    # U/ J/ s& f! i. {; T! G
  2083.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == step" a' N: v% R. [2 T( B
  2084.         reversed_chase_path.push(4)9 i/ k% l/ X' l- s5 c# q# R! W
  2085.         point_x = $game_map.round_x(point_x + 1)! L' {" l% N0 V; k
  2086.       end
    1 x  f, V; |2 W/ y3 [
  2087.     end4 p3 x+ z- ~; b8 T7 X7 N
  2088.     end #endOfForLoop 5 f/ }+ `; B# K& ^( ]
  2089.     @mouse_move_path = reversed_chase_path.reverse
    / Q) |, L) O+ U6 m
  2090.   end#airship
    & r' R, v# M- {- _& [/ k- c3 Y
  2091.   #--------------------------------------------------------------------------
    ; ?6 q( B  a! Y" c9 B- Y
  2092.   # ● 目标点无法抵达时的处理,用于各路径绘制方法内部; K6 _8 t7 A. O' A& M! \5 I5 @
  2093.   #--------------------------------------------------------------------------0 ~0 ?  p3 b+ F& x) m: v" b
  2094.   def not_reach_point
    1 X  j+ u" w2 ^6 ~0 r1 D8 u
  2095.     $mouse_move_sign.direction = 4
    ) M1 c$ d2 B0 a0 y
  2096.     dx = 0; dy = 0; dir = 0
    4 P  M% P5 U2 c, ]: M
  2097.     if @moveto_x - x  0
    ' h0 t8 b. J' r2 b& m
  2098.       if @moveto_x - x  $game_map.width - @moveto_x + x &&
    & U9 `( C" ?) k8 [& k' f8 F
  2099.           $game_map.loop_vertical  G. `# ?3 E8 I3 Q! j/ a( e
  2100.         dx = $game_map.width - @moveto_x + x; dir = 4
    1 z( V6 r) ^! X; m( z. Z
  2101.       else
    / H$ z2 L8 V' b7 [% V& P2 B
  2102.         dx = @moveto_x - x; dir = 6
    7 a4 s5 G, z) h1 w* P- U
  2103.       end
    ( v! Q& r6 Z/ m4 H- R1 ^# n
  2104.     else
    9 D+ `: N6 E% d( e9 j* l5 ~6 [
  2105.       if x - @moveto_x  $game_map.width - x + @moveto_x &&+ x2 z! ^0 s, y. k5 v8 r" O7 i
  2106.           $game_map.loop_vertical
    ) ?5 C6 f- s: ~6 d5 s. f/ l
  2107.         dx = $game_map.width - x + @moveto_x; dir = 6
    8 e+ y$ X2 w* j" z& D6 f" q: j
  2108.       else% I& S' [  k! \4 h" n# M& E6 [
  2109.         dx = x - @moveto_x; dir = 4
    * M& J! D) L4 i8 V
  2110.       end+ K3 Q( a/ [; n* Y
  2111.     end
    " Q5 R0 y. D/ d2 |4 M( O
  2112.     if @moveto_y - y  0
    ! z/ l+ Z. l2 W3 A. \4 l: Q
  2113.       if @moveto_y - y  $game_map.height - @moveto_y + y &&
    ) a! r$ j! C# |: d- Y
  2114.           $game_map.loop_horizontal/ b% [0 y. b4 \, ^+ a5 q
  2115.         dy = $game_map.height - @moveto_y + y. T* Y. e  p5 O9 ^( `3 s
  2116.         dir = 8 if dy  dx) K) C& o+ b' f
  2117.       else
    * I% F' F7 h' M0 d7 c5 w# e/ h
  2118.         dy = @moveto_y - y
    2 t( q8 [$ v- A3 ^; p4 R
  2119.         dir = 2 if dy  dx
    : h7 F1 G2 {8 {: V( a( P; `( |( U
  2120.       end
      B. A  `  h; [# o4 Y/ q4 w% i" @
  2121.     else
    4 ]) l1 g! ^, \; X. L
  2122.       if y - @moveto_y  $game_map.height - y + @moveto_y &&
    % U# Q; t" e7 _6 I1 x
  2123.           $game_map.loop_horizontal
    1 D2 [- f, s  E
  2124.         dy = $game_map.height - y + @moveto_y
    3 o5 P( |8 _" l; C/ ~3 {; s) {! b
  2125.         dir = 2 if dy  dx * u5 r% f) \4 t$ f7 }; _5 z3 ~
  2126.       else6 }" o3 t# p- p
  2127.         dy = y - @moveto_y$ k( w, r; B% }* v% Q" H$ j
  2128.         dir = 8 if dy  dx
    8 I! \3 g1 ^  f) \
  2129.       end
    9 Z# E% d- b+ D' M& n, e* v
  2130.     end/ Z8 F/ K0 V1 }6 t
  2131.     @mouse_move_path = [dir, 0] # 0方向用于防止移动过程中触发事件
    1 W% L" {5 l& Q4 P# c1 H
  2132.   end
    . A7 G0 ~* h+ Q; E0 b* `, o
  2133.   #--------------------------------------------------------------------------- a% w  P8 f1 V  \
  2134.   # ● 判断目标点是否能抵达、登陆,用于船只路径绘制' E  Z9 `) f' }. T$ k# E
  2135.   #--------------------------------------------------------------------------
    1 G2 o0 e3 `3 s& q) C9 C& _
  2136.   def landable(x, y, path)6 x' K/ O! @/ _2 G0 f
  2137.     case @vehicle_type
    $ ]# ]% P: h$ z/ x7 {; G$ r# ~
  2138.       when ship; return $game_map.ship_passable(x, y) ) V) m( K. ~6 F  s" I4 K, ^" P: k) m
  2139.         $game_map.passable(x, y, 10 - path[-1])
    ( C1 D$ j  ?; ]" V8 ^- \# S
  2140.       when boat; return $game_map.boat_passable(x, y)
    % O5 Z' t$ E  m. e! ?
  2141.         $game_map.passable(x, y, 10 - path[-1])
    & l( v. \! F/ K8 x- ~
  2142.     end
    1 z& C/ y+ j+ i- n, D
  2143.   end/ l: |' Y6 z( [: _9 R/ o' a
  2144. end
    $ V& h; k( b4 V
  2145. 9 W4 P  b9 u3 r& g+ @# N& i5 g
  2146. #==============================================================================; o4 ]+ g5 b# k5 D/ B
  2147. # ■ Game_Map. Q, w0 i) |+ s  k' d3 D; a
  2148. #------------------------------------------------------------------------------% ]; M* q7 v3 A& m& z) [
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。2 }. e7 Q9 D! m5 D* h1 Z+ B
  2150. #   本类的实例请参考 $game_map 。
      P$ Q. t. @) G9 Z# \8 \
  2151. #==============================================================================$ T( d, L# A6 S1 r6 l4 K/ z
  2152. class Game_Map" S. H; M7 c; ^5 I9 l# b8 d; n
  2153.   #--------------------------------------------------------------------------
    ! h9 i% {" C/ T! A
  2154.   # ● 定义实例变量/ R3 R9 z6 _8 m$ x1 O9 T
  2155.   #--------------------------------------------------------------------------
    . y; h/ n! D3 ?$ i9 |
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据
    9 c) u9 _3 l" W" t
  2157.   attr_reader mouse_map_y # 同上6 Q+ d4 h9 ^8 G
  2158.   #--------------------------------------------------------------------------- [  Z0 T: ?7 A4 B+ e
  2159.   # ● 初始化对象5 y: G4 O# S% G" g1 K& J- _
  2160.   #--------------------------------------------------------------------------+ {- }  h, e% \2 a
  2161.   alias sion_mouse_initialize initialize- M) }# Q: r$ a6 C
  2162.   def initialize4 u  e- p3 R* |# D
  2163.     sion_mouse_initialize
    8 M1 l" V4 @* z# z; V
  2164.     creat_move_sign  ###+ r( }0 W5 D2 b7 i# N5 u9 l
  2165.     set_constants7 W  |) S- ?/ P2 B8 ]- Z8 g1 R
  2166.   end' w7 y0 J# v( @# r! y
  2167.   #--------------------------------------------------------------------------" H$ x1 w0 T- B( N) D4 P# J6 a0 E+ J
  2168.   # ● 更新画面
    5 ]* k) t# b3 l* P9 j9 r
  2169.   #     main  事件解释器更新的标志
    ( B$ P: K5 |1 Y2 k' `  i
  2170.   #--------------------------------------------------------------------------" K! b& _4 `/ O/ ^# J
  2171.   alias sion_mouse_update update
    - y  \* ~# b; f. S  e7 D# i
  2172.   def update(main = false)
    * m9 c; k$ Q1 U+ \, T5 r9 i! K
  2173.     sion_mouse_update(main)
    4 J- \) x+ d2 K3 S
  2174.     update_move_sign
    - @7 G8 J) m' I' H4 U# F6 w' \9 {
  2175.   end
    , E1 L4 a7 i& v& O, L* ~6 I5 S  O' x
  2176.   #--------------------------------------------------------------------------$ m' W) Y% g3 F/ g
  2177.   # ● 创建显示路径点的事件/ \5 h! J+ r7 o) I% N. `# J; K
  2178.   #--------------------------------------------------------------------------
    2 }# n6 c- k2 {& c
  2179.   def creat_move_sign
    / o# j' B. f1 ^2 ~4 q0 N6 }& O9 F5 H
  2180.     $mouse_move_sign = Move_Sign.new8 }9 C$ h- j9 P4 g1 Z6 Q( K$ w
  2181.   end5 s' i* o! w2 i& U$ G
  2182.   #--------------------------------------------------------------------------
    % @* w) F8 C0 ]& S' Y& q
  2183.   # ● 更新显示路径点的事件/ o- a6 M% E" A* u' I& j
  2184.   #--------------------------------------------------------------------------
    $ i. l- l+ V6 Z. E0 Z1 i
  2185.   def set_constants) l. H% K9 Y' ]& P
  2186.     @mouse_pos_setted = true
    ( D: \9 y/ |, ]7 ?, r5 I9 w
  2187.     @set_pos_prepared = false! H8 g/ S5 |! @: e
  2188.     @mouse_old_x = 0- R5 S0 f7 h' o* o, r! \& u3 M
  2189.     @mouse_old_y = 0% k/ Z. U, o* K6 f0 s' b
  2190.   end- C+ T8 x+ L. t) D4 [
  2191.   #--------------------------------------------------------------------------
    5 {3 d( h3 `& ^$ w, ~
  2192.   # ● 更新显示路径点的事件' ~* P. g. }; `! U% e1 W7 F
  2193.   #--------------------------------------------------------------------------, ^$ k* c% w9 n5 e* z; P+ r
  2194.   def update_move_sign
    6 k/ N8 a& h! T. _
  2195.     $mouse_move_sign.update
    7 \- T, f) s- }1 b
  2196.   end- C- B% b& b+ ^6 g9 O, \
  2197.   #--------------------------------------------------------------------------
    6 |# X  r0 P- _+ S* L; S
  2198.   # ● 获取鼠标位于的地图块的x、y坐标
    1 a  j4 g1 `( O/ ]
  2199.   #--------------------------------------------------------------------------6 e& C# ~0 B4 s  c+ h/ X
  2200.   def get_mouse_map_xy
    5 ?3 `- O% _7 [9 a4 e8 x- s
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    6 ]# f- }1 X. d# {3 B3 J0 N
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i)
    $ a" J  ?4 e) Z" C
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i): i  P& u% k' m
  2204.   end( y! C+ A5 Y% J" J+ x
  2205.   #--------------------------------------------------------------------------$ L/ \: b; n* \. ]9 S3 ?) B8 j
  2206.   # ● 返回地图画面时重设鼠标坐标
    . r& Q) K$ `& a% Z( s0 w- P, H# |
  2207.   #--------------------------------------------------------------------------
    " ?7 ^" g- m2 A& i: D* @
  2208.   def reset_mouse_pos
    / s1 W" m  g& m/ ^" l
  2209.     return if @mouse_pos_setted' k* J! g5 i' n) W, m& u3 t
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y)
    , i* H, L9 r/ A! T3 S/ f
  2211.     @mouse_pos_setted = true
    + a9 a. o% t6 V! G
  2212.     @set_pos_prepared = false2 B6 o3 k- n7 d# |3 Z# y6 s. _
  2213.   end
    * O* I8 E$ @' f1 j# `  a' k
  2214.   #--------------------------------------------------------------------------* _: J; K6 T- z1 t
  2215.   # ● 重设鼠标的坐标
    ) H2 I' e! V# k1 S1 N
  2216.   #--------------------------------------------------------------------------
    3 j( X5 ]) ?3 z. z0 k& e
  2217.   def prepare_reset_mouse_pos
    ) X9 W: }2 u1 f
  2218.     return if @set_pos_prepared6 o$ j& {9 T. c2 y' [: D1 M
  2219.     @mouse_pos_setted = false
    / C# p  K& `- \( T* n% O& z& d& @
  2220.     @mouse_old_x = Mouse.mouse_x6 E& z; n2 _  b  ~; c7 u: q
  2221.     @mouse_old_y = Mouse.mouse_y4 ^- Y1 p7 ]) q) v$ l0 v$ M7 o2 k4 ^
  2222.     @set_pos_prepared = true/ @. @, i0 z3 ?; n$ {: f& ?
  2223.   end
    2 M& Q$ d9 b/ @
  2224. end8 e8 X) h: V, p# N. b& t( a$ R" C; o0 P
  2225. ' x* C+ |5 z' N: Y# ]. p( L: C/ X: h. f
  2226. #==============================================================================) `: F3 T5 N. s2 v) U( v/ P
  2227. # ■ Spriteset_Map3 r7 ~' i+ ]# g
  2228. #------------------------------------------------------------------------------- C* Z- J5 J* a! {/ s  G: w  D
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。; `0 p# \3 a8 K# A- a/ e
  2230. #==============================================================================4 _; M: `" I- O+ x6 T; w
  2231. class Spriteset_Map9 D  }  F% y* f1 O: N1 @0 ?
  2232.   #--------------------------------------------------------------------------
    ; X. S1 a1 J: [3 G; Z
  2233.   # ● 生成路径点精灵
    3 V# u" y% U1 n- J0 [
  2234.   #--------------------------------------------------------------------------
    ' Q) b* i$ L# ?, v0 ^$ C) d
  2235.   alias sion_mouse_create_characters create_characters
    * O8 a2 Q3 N; I' m" M% p4 Q$ k
  2236.   def create_characters
    ( B: ^7 u* a2 x, {$ X- x  y" F) ^9 }
  2237.     sion_mouse_create_characters5 x: D: b6 H, G* L& \: u7 k% `
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))" ^& o# }0 C. `/ S
  2239.   end
    ; R+ p. E' S' E- V' R1 |
  2240. end) M9 ~) `; Y/ w# b" M
  2241. , {0 j/ y! {% U, c5 `: ]" ^" @, u7 u
  2242. #==============================================================================$ h. L" t3 [$ K& K/ \8 \
  2243. # ■ Scene_Map9 n; r% d8 f) _4 V/ m& F1 ]7 d9 W
  2244. #------------------------------------------------------------------------------
    4 `0 {" C. p$ b/ m, T
  2245. #  地图画面4 G( m% {# A2 y# d- G
  2246. #==============================================================================0 [" X# I+ D4 P1 V! f% J
  2247. class Scene_Map  Scene_Base
    6 r( {: @- x: D4 S" \8 N2 @, D
  2248.   #--------------------------------------------------------------------------
    1 K# [. f4 u1 Q1 h- C4 ~
  2249.   # ● 画面更新3 n- i$ P, |5 [3 J/ q4 x
  2250.   #--------------------------------------------------------------------------6 U8 \  y4 J- J$ [. @$ J
  2251.   alias sion_mouse_update_scene update_scene
    / d$ y; I$ X- q. t
  2252.   def update_scene
    7 \1 w7 O+ X/ Q  c! _+ p8 b
  2253.     sion_mouse_update_scene) F7 I& \$ [9 Z6 o
  2254.     update_mouse_action unless scene_changing
    9 I, X4 W! I, z+ L% r  v0 E8 q" _
  2255.   end& T! V: V# B! u+ e
  2256.   #--------------------------------------------------------------------------
    + T/ r3 Z! M0 ~
  2257.   # ● 场所移动前的处理
    ! ]5 x+ l! `9 a0 R
  2258.   #--------------------------------------------------------------------------9 |2 G7 e4 Y$ W7 f( ~
  2259.   alias sion_mouse_pre_transfer pre_transfer) {4 T$ V9 {& T3 L
  2260.   def pre_transfer
    & a' P7 _4 n4 d
  2261.     $game_player.reset_move_path. K& A) `& _8 W0 A) ?$ x
  2262.     sion_mouse_pre_transfer) O' P$ v5 k$ M) H1 E4 j4 \9 _' @
  2263.   end
    4 _$ S; @* O' O3 I" g1 E4 o
  2264.   #--------------------------------------------------------------------------7 B. e/ @* Z, N3 S
  2265.   # ● 监听鼠标左键的按下
    . h' R# t6 ~6 T0 K
  2266.   #--------------------------------------------------------------------------
    ( q- M/ d* d3 W$ _, Q- Y
  2267.   def update_mouse_action
    ( w( I9 N+ v$ x6 h0 U- q* n5 A$ `
  2268.     $game_player.left_button_action if Mouse.press(0x01)
    + ~6 ?$ g' M; V
  2269.   end+ C1 i' F' M4 ^3 G
  2270. end# `6 O  `; R: \9 u

  2271. 3 L- q3 l! A* w* ^
  2272. #==============================================================================3 Q* Y) f% E( i9 ]8 q# Z6 G
  2273. # ■ Scene_File
    6 p, q1 q9 |$ F; b2 D
  2274. #------------------------------------------------------------------------------
    ( O  @+ U' G$ i- @9 [! \2 G) {2 O
  2275. #  存档画面和读档画面共同的父类, L# Z. R7 v3 z" E0 I. m8 p
  2276. #==============================================================================
    5 F$ [4 e( Y0 n: c6 U
  2277. class Scene_File  Scene_MenuBase
    . R1 b! W! |' k* B7 u6 z7 k3 |) E
  2278.   #--------------------------------------------------------------------------
    ( a/ f, s: A- @% ^* u) l
  2279.   # ● 开始处理( N* q) P7 p4 g' E9 W5 B9 H8 R
  2280.   #--------------------------------------------------------------------------+ W0 l: a$ d/ Q& W
  2281.   alias sion_mouse_start start. m, N: ~$ W( ~, K
  2282.   def start
    2 R+ }/ Q; ^+ m7 D
  2283.     sion_mouse_start1 P0 ^8 _, ?  U/ q
  2284.     @move_state = 0
    4 w: ^6 p. I' f; a1 c2 t
  2285.     set_mouse_pos* s; X2 U. Q* W8 S3 L% r* u9 h4 V! \
  2286.   end6 z; f3 E( y5 I, {( ~' ~
  2287.   #--------------------------------------------------------------------------, }% x3 v' }3 J$ {. K, u) r
  2288.   # ● 更新画面' n! j! @& R1 A( Z1 w
  2289.   #--------------------------------------------------------------------------! R4 q5 k7 Z& N: ~3 M1 X* J
  2290.   alias sion_mouse_update update
    # n( S! R, Z  m9 ^1 s$ F! a' \
  2291.   def update! e9 ]2 E, `+ k) s1 r: W# ?5 ~' G- C
  2292.     sion_mouse_update
    2 L! P8 f  O3 V% Y
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos! g% Y! {( @2 |& i
  2294.   end
    9 u/ `( s& E; W1 |# [6 X+ s
  2295.   #--------------------------------------------------------------------------
    & P9 W. ^  Z% o8 U- I3 ^/ A. H3 d
  2296.   # ● 更新光标9 a! ]4 X  p& {3 Q: t
  2297.   #--------------------------------------------------------------------------- C8 }$ H( [8 Q  P8 Y( N8 j" s. [
  2298.   def set_cursor. n8 P9 ?5 N' Y+ Q8 q
  2299.     @move_state += 1
    8 j8 q# W! G8 `& _( L
  2300.     last_index = @index! ?7 v9 a/ h' k. }9 n
  2301.     if mouse_which_window == -2# {; T2 B$ v4 d/ l) I  ^/ N% a
  2302.       if (@move_state - 1) % 6 == 0
    . F" E% f* J+ `  A1 X5 f
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1% n: \; Y& U9 ~/ J
  2304.       end5 M. g$ Q+ R, \! Z6 z
  2305.     elsif mouse_which_window == -1
    " k6 {+ }. \# }& d4 s/ h, z9 _2 B
  2306.       if (@move_state - 1) % 6 == 00 P) ]3 n; s$ H  [7 e/ S/ X
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0  ]& A* E/ U5 [1 P7 ^6 {
  2308.       end
    7 b9 w. O4 N1 n7 P, f
  2309.     else, y1 [" H( f' x( z2 g) Q' d' C- M
  2310.       @move_state = 0$ ~, k( h3 X/ x; G
  2311.       @index = top_index + mouse_which_window
    $ l- |3 W5 M6 A& v" ]
  2312.     end5 O' h  Y9 Y3 A8 s' ]) I' Y, b
  2313.     ensure_cursor_visible
    * @4 M1 B- `" S4 ^3 x9 \/ ^8 p
  2314.     if @index != last_index
    : [' C$ ]  Z" i7 y  H5 H
  2315.       @savefile_windows[last_index].selected = false
    2 U& K8 H# n# {1 H, D
  2316.       @savefile_windows[@index].selected = true+ ~. _( D- Z. ^7 t& a5 T* l" _* N$ w
  2317.     end
    & m6 Q! p0 P% `
  2318.   end
    & S' N/ [% {+ j) d1 L
  2319.   #--------------------------------------------------------------------------/ P4 b' k1 i/ r
  2320.   # ● 判断鼠标位于哪个窗口
    2 v! q$ z0 k! r$ W
  2321.   #--------------------------------------------------------------------------2 M4 ]8 ?) `$ D+ Y! h) u% M
  2322.   def mouse_which_window
    8 l# r% n4 v8 O# t. ~  B/ z1 q
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y. B" u( a$ N4 r" W9 I
  2324.     if mouse_y  @help_window.height + 14
      ~% r+ `, r( ?) g. c7 n
  2325.       mouse_row = -1
    8 H6 y) h, _$ Q0 |+ [# K5 h; L+ y
  2326.     elsif mouse_y  Graphics.height - 14( j& ~: G- s' k4 c$ r% i
  2327.       mouse_row = -2& Z4 e( N7 }1 J( R, A2 r8 a
  2328.     else$ E7 a2 q1 O/ n7 |; Z
  2329.       mouse_row = 4  (mouse_y - @help_window.height) - ^4 }5 s5 k  C: F
  2330.         (Graphics.height - @help_window.height)
    % h" ?; g+ r) i: Z
  2331.     end6 G: S9 c8 W$ }9 F1 ?9 l( S* D
  2332.     return mouse_row
    / @6 A% }: ~6 t/ R* J
  2333.   end
    / C8 n! U" @( E7 t, t' H8 K
  2334.   #--------------------------------------------------------------------------  h" [, b  ?- f# @* h" n
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置. W% N4 @: _- l# \. \) J7 X
  2336.   #--------------------------------------------------------------------------
    : Y( O7 @! }$ ~2 ?; G  L
  2337.   def set_mouse_pos2 Q6 }9 ^) [4 L' X5 Z- z& J1 p, m
  2338.     new_x = 40- e/ i- ^, G" Y2 J- r- _9 W6 _% V
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    3 S5 ~/ m$ {5 k* h- f0 g
  2340.     Mouse.set_mouse_pos(new_x, new_y)
    4 y4 _9 n% Y- L2 p$ \
  2341.   end
    . |' W; ]2 x; n7 G5 ]: [
  2342. end1 u% g* H( a8 |

  2343. ( K. @  F9 a/ x
  2344. #==============================================================================
    ) z7 P2 I: M2 z
  2345. # ■ Game_Event
      t6 [. ]7 T& {8 ^
  2346. #------------------------------------------------------------------------------5 J. w( T- Y* k, ^  t. k) |& g
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。: j# B  B5 J3 X& F8 M( u( T% F7 p8 M
  2348. #   在 Game_Map 类的内部使用。: r# n3 c0 s, E
  2349. #==============================================================================8 g7 l3 Y; A* p/ q% W( n) W
  2350. class Game_Event  Game_Character
    : @' G! f3 u  L
  2351.   #--------------------------------------------------------------------------. j8 V: K: Z2 s) g7 f, h) {2 k/ I
  2352.   # ● 事件启动
    + v5 A( l  D! R5 E6 A& F8 ^# ]
  2353.   #--------------------------------------------------------------------------( A3 d$ X. p/ V$ {/ @
  2354.   alias sion_mouse_start start
    + L( G% R$ G4 E# {$ M2 |: k" H
  2355.   def start0 l: d3 N6 _( w+ D
  2356.     return if mouse_start && !Mouse.press(0x01)
    : g# i2 g- @9 f% e
  2357.     sion_mouse_start
    + |1 R; N1 p( Q. B
  2358.   end; Q, T, C+ s7 E( f
  2359.   #--------------------------------------------------------------------------
      X6 X( r& B3 i6 i8 Q" P
  2360.   # ● 判断事件是否由鼠标启动7 {" E: g2 g3 ^/ Q( g; ~9 ?, R# l
  2361.   #--------------------------------------------------------------------------* w( i7 M$ |& Q( r
  2362.   def mouse_start- W( a8 v% B$ u) A
  2363.     return false if empty% t$ x+ D7 G4 T& T
  2364.     @list.each do index; i7 l8 h. y1 n! s$ k- T
  2365.       return true if (index.code == 108  index.code == 408) &&
    # P, q; z  s; f6 @' G
  2366.         index.parameters[0].include('鼠标启动')
    9 f# F' p& H& I  C9 h
  2367.     end
    1 p' w, |1 V2 ^( ^- A
  2368.     return false5 E3 _* P; o+ E+ h
  2369.   end
    - i! L8 h% H; R  j
  2370. end
    + E! t) X  o; J; }& d, Z

  2371. + \7 _3 L* |: S( H/ M
  2372. ####泥煤的height6 O. I0 o) H5 {, v. Z; t0 |
  2373. # @height = height
      I- y" C' `/ b8 ~/ W9 k

  2374. : ?8 M) o$ w! u4 t+ X! N* F
  2375. class Area_Response
    & P5 c0 l' @1 ?# M* F
  2376.   attr_accessor type
    % q% u% n! n% k1 x$ \8 }" U" _- q, O) e
  2377.   attr_reader ox
    1 r9 A( G1 ~) O# ~$ T6 ?
  2378.   attr_reader oy1 {# S; l. ]' d& q9 `& [
  2379.   attr_reader width
    " [: j8 [7 r7 @- w
  2380.   attr_reader height
    5 M1 s! H( n$ f5 v' O
  2381.   attr_reader switch_id
      L2 w- i( V: k- z6 f
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)" z  M, b9 e# A+ H' |
  2383.     @type = type3 r4 i1 M4 q0 S
  2384.     @ox = ox7 T) R! v9 X' t; ]/ {: G
  2385.     @oy = oy0 `; U1 P+ }% \2 s
  2386.     @width = width6 O) m: [3 T. o8 o. H* R
  2387.     @height = height7 g2 a; b" a) f. l% U0 V
  2388.     @switch_id = switch_id- H7 [7 s, H: s& H
  2389.   end
    ! R1 ~, t' Q. I
  2390. end
    ' E* ^) M" I$ }( \- W# D/ H( c
  2391. . b! y! r2 T. k9 I
  2392. $area_responses = []/ [. C% S+ G  L
  2393. 5 w: w/ z) W6 H/ o6 n; ]% f
  2394. class Scene_Map
    ; s* y5 c4 h1 `* H; Y1 L1 X% ~& s3 H
  2395.   alias update_mouse_2013421 update_mouse_action8 c. o( v" b3 G$ x! R$ V) L9 _
  2396.   def update_mouse_action3 e. g( \( J( I/ y+ q
  2397.     update_area_response
    8 w+ Z; Y1 ]# \' _0 p) m, d" A* @" r  ^
  2398.     update_mouse_2013421. W6 Q% M6 j* s6 O: \% K, P, ~8 f( d$ g% ^
  2399.   end
    6 r- M5 o4 K6 A9 O$ d
  2400.   def update_area_response
    9 l& c2 n9 `6 s% j$ ^
  2401.     responses = $area_responses$ U% E7 _* v! F* ~$ E
  2402.     responses.each {response4 u: r, u) i6 d) n! N
  2403.       ox = response.ox/ M3 B  ~& R3 J, ?6 o3 Z! j
  2404.       oy = response.oy+ B0 i% U0 n- `
  2405.       width = response.width
    7 y+ @- k. [# f
  2406.       height = response.height+ u+ [+ K/ l* P
  2407.       switch_id = response.switch_id
    ; N  i- j. `' O5 q
  2408.       case response.type0 n) ]) u# u# }! s) d# `; x& ]
  2409.       when 0  |) L/ O$ D, C+ ?7 h5 ]
  2410.         if mouse_in_area(ox, oy, width, height)
    - T& w+ P' i+ o  O
  2411.           $game_switches[switch_id] = true8 s3 [0 a# U4 ~% w" o- r9 T. M! F
  2412.           $area_responses.delete(response); w( n8 v8 v% v* p% |
  2413.         end
    / w& p0 Q6 W' z1 M
  2414.       when 16 Y' N* [: u. Z9 s# s) v
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)8 S6 D$ p$ k; l2 @. ?/ E* a6 q
  2416.           $game_switches[switch_id] = true
    0 a1 L8 ]* H: @( @
  2417.           $area_responses.delete(response)
    - K. @$ N! n* {* T( R
  2418.         end
    & @6 T; [* I+ I% H
  2419.       when 28 N) Y" W/ C1 X' S' v0 c( E
  2420.         if mouse_in_area(ox, oy, width, height)
    ) H) R3 l5 ]  P+ s
  2421.           $game_switches[switch_id] = true
    ( I! f4 l) K( h. g$ x0 y
  2422.         else* q* D; ?0 i2 E9 o$ T3 k5 f$ `
  2423.           $game_switches[switch_id] = false0 d; P( z2 `' A1 }8 T  N7 L
  2424.         end
    ) r5 d, S# T' {* y
  2425.       when 3
    - J2 z# A2 ?. @( p+ ^8 ]6 o4 k0 l
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,
    1 A2 U3 K, ?7 ~" N  G' q3 X  f
  2427.             (oy - $game_map.display_y)  32, width, height)' t4 R# a) E& M6 R( F+ Y
  2428.           $game_map.events_xy(ox, oy).each {event9 f. m, Y, a1 o. ~6 T1 j
  2429.           event.start
    7 V$ W+ M/ v) b
  2430.           $area_responses.delete(response)" A" B" @; `0 ~& t6 Q
  2431.           return$ S: R- `$ j" W" H% n4 ^! J
  2432.           }
    5 A% s$ F5 Q# N5 E* @
  2433.         end
    : u4 X; O9 W9 U' |( L# z/ }; q
  2434.       when 4
    & [2 c$ l/ w3 ?  c
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,* C2 Y  Y3 Q1 @  ^/ _5 L
  2436.             (oy - $game_map.display_y)  32, width, height)
      d( I3 j+ b" V( L' b4 y# K5 G
  2437.           $game_map.events_xy(ox, oy).each {event0 l5 J9 T  r: A; h
  2438.             event.start
    ) }4 \4 _8 d" h7 Q0 E
  2439.             return
    - G* R6 l. f, A! u
  2440.           } . J# v6 F$ X8 z5 e& ?! A( X: J
  2441.         end% [6 j8 I0 E" {- I/ p( U; ^) }! f
  2442.       end
    0 o5 o; K$ ?* p9 h- G
  2443.     }
    6 t" h: z) i4 a* Z6 A  A
  2444.   end+ N- \7 x8 c! N; h+ k( @& O0 a
  2445.   def mouse_in_area(ox, oy, width, height)6 o- K  W( |- N  M. U
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&
    ; r% N% L6 X' o' z: z) {2 y
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height5 N4 B5 S5 j# A3 u" h( O
  2448.   end
    # D1 V' v) ~- s; p8 I1 M
  2449. end$ e. v& p/ q, g5 Y! t! V
  2450. class Game_Interpreter
    $ \7 B) ]' Z5 H
  2451.   def area_response(arg)) k' {  v2 ?0 p7 D) E: J: V( N
  2452.     $area_responses.push(Area_Response.new(arg))4 i5 B$ M- Q9 h
  2453.   end0 v* @9 M% E" g! w7 O  U
  2454. end6 a0 S$ f. Q' W; D
复制代码

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

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

GMT+8, 2025-5-11 22:59

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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