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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    , K- _& J' H, L, W

  2. , r. N  v" V* H9 k5 [6 n5 k
  3.   Sion Mouse System v1.3e6 ?8 @; ^4 v0 n: L5 W& p, j
  4.   # A7 G' V- E3 L- F1 X
  5.   Changlog
    9 O. h$ U6 E# U) N
  6.   
    1 R# D: @& T, Z! C. u' ]- W
  7.   2013.4.21 v1.3f
    * C8 i/ R  f) c
  8.    
    5 @' v. ?3 z% z4 ?6 h/ z
  9.     1.3f 卷动地图 bug 修正: v% E. k# e/ P' \
  10.       W, a5 s, I3 p# N1 r
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口% u- c, Z: }  [0 }) p0 A
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内
    , \8 y+ r& n9 M+ |5 _/ D& _
  13.                               Mouse.unlock_mouse_in_screen 解除锁定& b+ h  j9 w  v0 q
  14. ! a2 v* Q, {; ~$ z
  15.     1.3f bug修正* W5 f3 Z# B7 T# h3 V
  16.   4 e1 r6 R  K4 V2 o
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及
    9 O3 X) a5 V$ [# F7 S, _: t/ z
  18.           关闭菜单时,鼠标是否移动到原来的位置。* m; p' A% i. V/ ]! }
  19. ! ~( w6 f$ g1 H# x6 V: I$ O& J
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处) l% q7 ]2 e6 y3 }& l; s

  21. 2 Y! U  E7 S0 R- i1 z5 i  S: j
  22.     1.3b 修正一些罕见的bug;
    ) N. t: r6 c& r! f. x* L1 f; S

  23. - v# ~: f0 _$ W/ v' }) b
  24.     1.3a 代码小修改;. w( ?4 _( g8 w) ]7 n
  25.           加入了鼠标点击启动事件的功能,
    , Z- B& r; o* H8 X7 d1 H" @
  26.           在事件中加入“注释”: 鼠标启动  ,
    , s3 @, H) A9 B. v. L# p+ X. f
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    , s" l  b# w1 J2 S
  28.   . N. Q( F6 R0 B4 }7 O% L5 L$ Y7 y  @
  29.   2013.2.12 v1.2; s: T) \4 \8 k' A8 G

  30. ' c" F% f2 R+ H% X( N! e! E& J( P
  31.     寻路逻辑优化;5 x4 X4 i: L( d1 {8 ]9 y; H% _! s
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;
    % ^/ r% e. S  K; S
  33.     现在支持用鼠标来操作载具了。6 a6 {( y' c( w: ~+ j' @
  34. 4 V) M/ ]' x% \8 d# A' ^2 S: f
  35.   2013.2.8 v1.18 o; F+ t$ p% i7 B+ d
  36. ) X, S% w7 U$ t9 T  E
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;7 W, ]& w3 Q0 M* J. w4 U  }1 s0 o
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;, ]2 J1 J; S/ J- [$ W
  39.     移动时,路径指示点的绘制更加稳定;" G) U+ D& Z& }4 y& A& F( T$ A
  40.     现在支持默认存档画面的鼠标操作了。
    - y6 l* F7 D) F0 ~% F

  41. 6 w: G, A. u% G" D! x
  42. 6 k- k* b8 W1 |9 B- ]
  43.   OrigenVersion
    " A0 X. R' J# F) p) ~. F- N. t# i1 n
  44.   , O" x+ W# c/ i, Z
  45.     2013.2.7 v1.0
    ! o7 V0 _, r/ B. z- k# K6 b+ _
  46. + l* U7 e3 @5 p4 ?+ d! e
  47.   主要功能8 p5 l* K* E% S) j' W" y  e

  48. / k, j2 e# n3 G* ]4 y" ^
  49.       使用鼠标进行各种操作...
    ' Z5 m& m' h" `4 ?! |
  50.       将鼠标锁定在游戏窗口内
    5 ~0 L) L: G/ _: R0 e/ \
  51.       自动寻路,按住 D 键可以扩大寻路的范围
    2 S  ?6 F4 j  b  I0 c4 P+ o
  52.       双击鼠标进行冲刺/ J8 B+ I3 g; P6 @5 S8 [
  53.       更改地图卷动方式以适应鼠标移动
    * Y! [, b0 @' K* e+ j6 _  g: Z0 h
  54.       变量输入框改良. }* z" H2 Q3 L# B2 r0 m2 z

  55. 6 e, U* M' ^' f9 }* {8 X6 e! q
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹' w# U" m  k& W0 X6 P3 j

  57. 9 [5 ~2 q/ ~. J! q6 ~- ~( _/ A; X  K
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹
    8 i2 ~( f4 n8 k
  59. 4 `& S2 C+ X) E4 u+ x: }5 c
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭1 b- s2 o& r& Y' k/ [) n
  61. ( @5 q1 s4 Y  ^7 x& R
  62. ( R2 A4 k4 W+ ~& X9 Y0 m3 L
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★
    ' m2 ~! ?! U$ [* @- i" v
  64. 2 ]- M* v( L- `* ~# v" `, H% k

  65.   r! p$ e" Y; w
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示
    8 z, w; F$ j. f& @" X( T# u* w8 b
  67. * F- `- G$ U7 ?# X+ o0 F. `( v' Z
  68. #==============================================================================0 r1 ?3 S1 @  O6 }
  69. # ■ 常数设置
    , G/ b- \" B  z6 \$ D6 A6 c  W
  70. #==============================================================================3 I) g. M# w7 Y# V3 O9 H5 S
  71. module KsOfSion; }3 `( W  ~7 l5 Y0 C9 S
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false$ o8 E8 |7 {8 P, z1 f5 ]" d# f: T
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑
    / D; ?1 A5 F7 f. V' S/ }
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false* P' d; C; q1 x) v  D. Q
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量" i" Q. M" {. B- J. `
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    9 H: Y- ^3 {# d
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧
    " b) [+ ~0 H, j7 ~8 K
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)
    ( p4 w* g( b6 @# @6 N
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键
    3 j( o1 F  }# |
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)
    9 n: F: I& H  M- T) I3 c# t
  81. end
    ; b1 e# j3 _7 b; p. p. e

  82. 4 M9 Y: N& X1 _( C" `  {
  83. #==============================================================================$ O$ K  S' l) i$ l& \
  84. # ■ 用来显示路径点的类0 B3 l% A' z- _% \
  85. #==============================================================================- V8 \% \: Y' L% A0 R3 v
  86. class Move_Sign  Game_Character" C  `6 L  r- e: Z
  87.   #--------------------------------------------------------------------------
    ) q& v" o* q" v6 ]8 t
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图
    9 W, Y* w% y: n; [% q
  89.   #--------------------------------------------------------------------------
    / b# P* I7 g( B; Z
  90.   def init_public_members
    ' [$ f. m( p/ V$ s3 c
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹
    9 [3 A% n4 f4 e. a
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    + _5 H7 P2 |/ ?
  93.     @move_speed      = 5        # ★ 踏步速度/ S% r) d2 h5 b, R' o  q
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    . N# I* L2 P: j- d0 \1 V
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度
    ! F7 ?) l0 x  i+ Y; P  ]
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常); h. x6 `$ ]& t, j3 P4 q6 N1 @
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列6 b- E! |' M+ A7 V
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1). ?9 a& }; \  `5 p, h2 W
  99.   i6 ~( p$ w5 T( e8 \

  100. ) B- x/ b, {: D) k& `
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    6 n: j/ b; J4 `2 N  C: Q

  102. 7 v8 F* O( w1 v! T1 Q3 k

  103. 2 I/ X, U& @' U
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图5 Y) P2 y) `; z. x4 r# r. a
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')3 N, z0 w8 N+ m# b) b

  106. 8 i$ T; N7 ~1 h" h# y) _6 y7 ]
  107.       if $no_arrowpic_warn- ]% m: O$ w1 w: q
  108.         MouseShow_Cursor.call(1), t( G$ X7 Z( H; Q
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png
    2 W7 ~" }! T8 Z

  110. - d4 \/ }4 G, i5 V/ _% G
  111. “路径指示点”将使用游戏自带图片
    * y, g2 C9 X3 i" J+ Y. u8 ?' ^& y
  112. , S, D4 F7 c' x, w/ c- O5 U
  113. 该提示可以在脚本内关闭')
    ; g- s. V* K! o  X8 U
  114.         MouseShow_Cursor.call(0)6 |$ Z$ \8 z9 d# a5 _
  115.         $no_arrowpic_warn = false7 y* }8 c" y) g, m7 Y0 a
  116.       end, e9 {* |3 a+ W; w7 _" E
  117.       @character_name  = '!Flame'
      {& a: c4 k. ]! j
  118.       @character_index = 6# Q" P9 _% E8 E5 W& i4 L3 ^/ _: g

  119. % d$ U% h0 E" w4 t) V
  120.     end
    ' v* X* p% P/ a% |0 Z! x6 k/ ~+ N
  121.     @direction_fix = false  # 固定朝向" d" \9 b1 w2 K4 r, ~0 R. R
  122.     @move_frequency = 6     # 移动频率) U" g, [, W% o
  123.     @walk_anime = true      # 步行动画  C/ E5 ]2 X! x" W: o* @' h
  124.     @pattern = 1            # 图案5 `# ?# u' H) s3 J0 a8 i* a
  125.     @through = true         # 穿透4 n) P" C+ d1 N; x
  126.     @bush_depth = 0         # 草木深度
    - l  x  C' H) ~
  127.     @animation_id = 0       # 动画 ID. C% I% g9 X% S% i+ B/ K" P
  128.     @balloon_id = 0         # 心情 ID4 p6 a4 f- N3 ?' t
  129.     @transparent = true     # 透明
    ; ^* i3 B$ c% l9 E: W9 {4 }/ {
  130.     @id = 0  H; y& t3 u7 J$ e
  131.     @x = 01 {$ a4 [+ f9 H: V( n- |& T$ `- D
  132.     @y = 0
    - }; y5 i6 |. R! G, ^
  133.     @real_x = 00 n) u4 r& y4 {* q
  134.     @real_y = 0% z# N1 [' f! C" W. Z
  135.     @tile_id = 0) P9 F% O1 t  y3 G
  136.   end
    ( K- m8 ?. V! S# ~. w2 ?
  137.   #--------------------------------------------------------------------------
    * d9 Z. l2 m! u4 p/ u
  138.   # ● 定义实例变量+ ]1 m6 Z; q- G2 n6 X1 v& p) y5 y
  139.   #--------------------------------------------------------------------------- ]! h% G5 _3 H1 F3 g6 Z
  140.   attr_accessor direction
    : i5 u$ U/ m+ J1 v2 G, U) T: T
  141. end& z: v, c8 l" ]

  142. 2 y% K' g5 U% G$ H- z
  143. #==============================================================================
    + J, K) y; u4 I$ N! H6 {
  144. # ■ Module Mouse
    0 t* u2 U( ~' C4 e0 b
  145. #==============================================================================2 p: x8 ]6 ~, E8 _8 x
  146. module Mouse$ V* p( c9 M* K* G9 T9 X
  147.   #--------------------------------------------------------------------------  c$ P0 Y' J# Z. Z6 F+ X' h1 v+ D. j
  148.   # ● API
    ( O# c9 F* K5 Z# b" g" R/ ?
  149.   #--------------------------------------------------------------------------
    0 |* Y3 }+ ~' n8 K% l
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')9 ?0 Q  A9 S  h* o0 [7 x- L
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
    # u9 v# q: s/ O. L; @$ X8 |& y
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')
    6 ?# _. p3 _" V& d) d. @5 D
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')  C+ R& u6 n. k) i
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    6 X1 Y/ E1 b* W* s
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')- V3 W- g+ ^: Q4 }5 T
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')6 V2 \, R& X3 v. _& n  O$ v* o, G4 g
  157.   Window_Hwnd       = Get_Active_Window.call4 F- ^; D. c6 |  ~& E* s) @
  158. . e* G' K: _/ H/ N4 |% f0 a$ g
  159. class  self
    ; B) d3 u& Z1 {
  160.   #--------------------------------------------------------------------------
    2 j7 F: n3 [: @" `
  161.   # ● 初始化
    4 m% C# S+ c5 R0 |
  162.   #--------------------------------------------------------------------------  C, s  `0 O" f! _: k1 ~
  163.   def init1 R0 [5 h& y- i0 j' T! `. i8 R% }
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor
    ( I- V: ^3 R2 f- |& Z+ B& E
  165.     @left_state = 0
    & A) K5 w% j8 I8 k; ]7 b
  166.     @right_state = 0. D( z/ a7 W7 R( J2 y
  167.     @ck_count = 0 # 帧数计,单击以后从0开始
    ( S& v: S' D4 L8 p8 D5 L9 L
  168.     @dk_count = 0 # 用于双击的判定
    . M6 r; v$ v' C. L4 j
  169.     @clicked = false
    $ d. R4 K8 y: J* q( F; Q& |
  170.     creat_mouse_sprite" M+ }3 ~  k! V  E+ o. w+ F, [
  171.     update( L$ E& z3 d" f6 p' g9 D
  172.   end$ L* s( F: U% A
  173.   #--------------------------------------------------------------------------$ Y! T0 W% n' [& C
  174.   # ● 鼠标指针精灵
    * ]0 e+ o! q1 \8 M: Y
  175.   #--------------------------------------------------------------------------
    8 g# N9 O9 M! ]+ b6 J' K+ n
  176. #~   def creat_mouse_sprite5 ?" b9 C" i( g# Q4 ~
  177. #~     
    ) W3 i" d2 R! @8 D3 y1 }
  178. #~       @mouse_sprite = Sprite.new  S8 X# o! r( g5 D/ c( w
  179. #~       panda = 2#rand(2)+1
    + x9 T+ x" ~+ y( |1 Z( y& h

  180. . G9 [- B8 b) C  @/ I0 \
  181. #~      if panda = 1; g3 y4 `  O- p8 X2 o( c- @8 t. y
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    5 S$ X) n9 V$ R2 a6 B. ?
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    " X1 h/ ?& A! A* W
  184. #~        end#with if File.exist4 M2 g  _: K6 L) D
  185. #~   
    $ H! b+ Q6 R& m3 p: e
  186. #~     else if panda = 2 #with if panda=1- B( V# M, d6 ^* T9 N
  187. #~      
      S0 d: b4 E. ^
  188. #~      if File.exist('GraphicsSystemCursor2.png')
    . j% u/ j1 M6 [
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    . w0 l. u) C" Z: P8 q2 p
  190. #~      end#with if File.exist
    - _6 q( ~, F4 T' M* ?
  191. #~      
    6 B! V! M; u+ t" Q. d+ |6 L) a! ]
  192. #~     else #with if panda=13 q( i* Z- s1 b. d
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)% a. F( C! S4 V- C
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),
    + t0 I! q$ |. h5 z$ s+ @6 S
  195. #~       Rect.new(5  24, 24  24, 24, 24))
    1 I# l' n& g6 X* M- K$ W
  196. #~     end#with if panda=13 F" w9 J- j6 _! l: n1 ]$ U
  197. #~     
    ' r8 c. [, Z# F
  198. #~     #with def' R% k! B' V9 l9 U) R9 v
  199. #~   end7 {( v' E# D6 Q" A" l
  200. def creat_mouse_sprite
    + E) G2 w0 j" Q* s/ v- Z0 H  t# R$ j
  201.     @mouse_sprite = Sprite.new
    ( X6 H) T  R0 _8 a* s0 y, r: R
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})
    / n- i3 G1 n6 j' x- ]
  203.     @mouse_sprite.z = 9999
    , o' ?1 @/ F" p% P; z
  204.     Show_Cursor.call(0)
    0 P) R4 M% Q3 j* U8 z8 R+ e4 F
  205. end
    / v. P* i1 p$ k. J6 P
  206. ! G. ?5 @+ A# S7 z. Y  z& ^
  207.   #--------------------------------------------------------------------------
    - Y8 }5 V  O/ Y! m
  208.   # ● 更新. s+ |% E- `/ K- a: T* z9 O; L
  209.   #--------------------------------------------------------------------------
    ; ]" O' d& ^. \. B1 a
  210.   def update0 B7 z. y6 E* Q
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos
    - ^, _# g3 q& J% H& ]6 R* L( R! f
  212.     left_state  = Get_Key_State.call(0x01)
    ! ^+ i0 H( T1 A2 V
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0. b; }! R& Y. S  x" I
  214.     right_state = Get_Key_State.call(0x02)) u( {' y& E" i. u; V. v1 t
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0
    2 ]/ N. l5 H( l8 Q
  216.     update_double_click7 A5 C/ j& t* m* `! ^% ~
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1$ f2 v/ H2 _$ e& U
  218.   end8 ?$ m" ], @9 J% _( W9 E9 X( V+ i% x
  219.   #--------------------------------------------------------------------------
    $ A1 ?! y; D- U8 n2 b1 q
  220.   # ● 获取鼠标坐标0 ?( h; V  \2 ^5 j. D* O- i: j
  221.   #--------------------------------------------------------------------------
    ! U. ^" G! o5 W, ]
  222.   def get_mouse_pos
    $ i7 Q% k0 J% z5 f- T$ h  _  Q" S* }
  223.     arg = [0, 0].pack('ll')$ Y. f6 u  g$ o; I
  224.     Get_Cursor_Pos.call(arg)9 J; B# |' j& B7 j5 h$ t
  225.     Screen_To_Client.call(Window_Hwnd, arg)
    . D. E- Y( }! m5 V
  226.     x, y = arg.unpack('ll')
    $ X* |, i+ S/ {9 j: W! b* X
  227.     return x, y) o9 G  D0 [- k3 S+ H- X3 v
  228.   end- d* R1 Q: a% Z- d9 i( k9 l+ U5 c5 v9 `
  229.   #--------------------------------------------------------------------------
    0 `2 K) ]  e  M, D  B2 j7 _
  230.   # ● 将鼠标固定在屏幕内' J+ T) c. G+ e* k- q0 M! @
  231.   #--------------------------------------------------------------------------
    ' d: `# Z. l% E1 R6 I4 F7 @
  232.   def lock_mouse_in_screen. x! Y" _& c; _' J
  233.     arg = [0, 0].pack('ll')
    # W6 D5 g- K: G) ~
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    9 X1 n9 n) q* ~" B/ ^0 b
  235.     x, y  = arg.unpack('ll')
    4 `( X, W3 u5 F0 B# [2 U  N
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))
    : S. k: S8 g$ o# m) I  p
  237.   end
    * ]' x+ |& j7 i7 A. K0 E
  238.   #--------------------------------------------------------------------------- }" v$ o- ^9 r& c
  239.   # ● 解除鼠标固定
    / o. V/ `; [" X
  240.   #--------------------------------------------------------------------------- d8 Q* r  [" D( u  T, _) u8 d# T4 q
  241.   def unlock_mouse_in_screen) I$ Y5 r4 M6 h6 }: p! F
  242.     Clip_Cursor.call(0)
    ( @& R4 g) I* C
  243.   end( G% a2 E3 W, A+ j' @
  244.   #--------------------------------------------------------------------------
    % F5 m/ a& t8 Z, f/ C3 [
  245.   # ● 鼠标双击判定& P) M9 B% A) Y5 h+ z
  246.   #--------------------------------------------------------------------------
    / a' c7 I! M* g- D
  247.   def update_double_click
    / F- X- l% q# M3 t- h4 N! i4 Z5 a3 n
  248.     @clicked = true if @left_state == 15 C* }. o- R+ M) j( B* Q
  249.     if @dk_count  0 && @left_state == 1
    1 }- g/ Y0 p% ]: t
  250.       @dk_count = 0; @clicked = false9 Y2 f: j) ^* g$ w2 d! p) l; t2 j
  251.       return @double_click = true
    ) s5 a" B! J# ]5 Q- I
  252.     elsif @clicked( ^! Y6 y" e& [( R7 ]
  253.       if @dk_count  KsOfSionDbclick_Frame3 z) a/ u) h3 K* H1 d% q8 u
  254.         @dk_count += 1
    0 [* j6 \: z2 `  r0 m$ P
  255.       else+ V7 q( U4 s! f* s
  256.         @dk_count = 0; @clicked = false: K. h0 v  _. t' s" w
  257.       end
    - g: M* z+ f" I: a
  258.     end& @: E3 W2 [0 k& ?8 L5 ~- C
  259.     @double_click = false. c" q& D9 J* S* e* u
  260.   end
      n# I% C, F* K& V5 M4 D+ |: M
  261.   #--------------------------------------------------------------------------: f* p; k9 y, `: ^( v2 y! E$ p
  262.   # ● 按键被按下就返回true$ w, B7 B! v/ ^; a3 G
  263.   #--------------------------------------------------------------------------
    & i1 K! Q: k% Y& v& z
  264.   def press(button)$ \/ z; a1 d- J( A6 k
  265.     case button
    9 n) A. K* Z, a+ d4 i: @
  266.       when 0x01; return !@left_state.zero. f% S& G9 Y+ F6 @9 [5 i
  267.       when 0x02; return !@right_state.zero$ B, B4 G# ~/ R) D
  268.     end) `- Y) b/ w6 H; [& ?7 ?% h# e
  269.     return false+ q8 A; u7 U, ~
  270.   end3 \% f- ]! n; w! H4 m
  271.   #--------------------------------------------------------------------------1 L: g$ W+ I" p& s. |" l% }; v
  272.   # ● 按键刚被按下则返回true4 M% ]1 o! o. A! Y6 }
  273.   #--------------------------------------------------------------------------; k; H4 l1 v$ V- }' a: k
  274.   def trigger(button)' j: |: `7 y. ?7 s( `: F; k- s: f
  275.     case button7 b0 j! U! z  i: H
  276.       when 0x01; return @left_state == 1
    ' s) Q; {  o4 n6 t1 g! ?7 L
  277.       when 0x02; return @right_state == 1* R9 ^" b) P; Q
  278.     end
    / i/ v) t* R! L9 |; j
  279.     return false
    ' C/ T& R! I* F
  280.   end" \( q& W! x" N) Q, H
  281.   #--------------------------------------------------------------------------; G( S0 I- h, A4 v
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    - W/ U2 f$ T# j6 W" a
  283.   #--------------------------------------------------------------------------1 P+ @+ C& _& r2 N# e
  284.   def repeat(button)
    3 V, ]# P8 d/ o; S
  285.     case button1 E2 E$ z, y% e  S' O% A1 p( E7 Q
  286.       when 0x01; return @left_state == 1 2 i9 J& H6 I/ m" F$ \% \" c
  287.         (@left_state  22 && (@left_state % 6).zero)& f" [& G# u4 b( k5 w3 K
  288.       when 0x02; return @right_state == 1
    # M+ `0 p; R/ P& b4 @
  289.         (@right_state  22 && (@right_state % 6).zero)9 q: b" N  `5 Q9 B( c* L
  290.     end- y+ M9 O7 ?" r6 Z
  291.     return false
    # q( s/ G# L( U$ O1 f
  292.   end
    # V2 N5 \  U, Z& O' {7 I# U/ _
  293.   #--------------------------------------------------------------------------
    , x4 @6 U  c, y4 G+ a
  294.   # ● 判断是否双击鼠标; H4 D4 F" u- ~  v
  295.   #--------------------------------------------------------------------------
    $ `' R" T: u3 f: Z) \0 G' _
  296.   def double_click3 k0 x: N; o1 l1 m3 X' i
  297.     @double_click
    " c/ |2 M! D* J. o$ z# v
  298.   end
    4 O  k& E6 X, Y% F; y4 T
  299.   #--------------------------------------------------------------------------
    # R$ s/ K+ c$ q; {3 U
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)
    6 q! ~$ T2 b- y: D7 t8 i+ O
  301.   #--------------------------------------------------------------------------, ^+ [% X3 h/ R3 t- s: Q: Z0 B& w& R
  302.   def click_count6 M2 Y4 w! J! _5 |
  303.     @ck_count
      k) d! C4 m( ^! {
  304.   end
    " c& ^$ B4 n# R9 f; S* d1 ~1 m0 J
  305.   #--------------------------------------------------------------------------
    ' a3 _; o: u* ~) S0 y
  306.   # ● 获取@left_state(按住左键每一帧+=1)) f9 j0 [: v5 R8 r
  307.   #--------------------------------------------------------------------------, O1 M, c$ {  j( d, F9 R: e& K% C
  308.   def left_state
    8 B4 M: I$ E; h# w
  309.     @left_state5 ?2 u2 }4 o1 s
  310.   end
    + f, U% Q+ e% ~1 o/ ]! f
  311.   #--------------------------------------------------------------------------% N& U% C- t) w) Q
  312.   # ● 获取鼠标的x坐标
    7 K0 ^$ \6 @9 n  T5 ~# L
  313.   #--------------------------------------------------------------------------0 x5 N2 x+ G4 Q$ P7 h
  314.   def mouse_x
    " y3 K8 \4 F- G4 _" l, ~
  315.     @mouse_sprite.x( Q0 v, k0 K7 s" k7 a) A9 d9 F
  316.   end% ]; V% ]4 y/ ?* r
  317.   #--------------------------------------------------------------------------
    6 W7 C8 H  q$ j
  318.   # ● 获取鼠标的y坐标, I2 `" a/ h; ^; K$ x
  319.   #--------------------------------------------------------------------------6 i! [5 w0 C5 i; P( ^5 J( x
  320.   def mouse_y% V9 E$ M: g4 E$ o! Y
  321.     @mouse_sprite.y8 `% o- U) [8 ~) F
  322.   end* f; S2 u2 X0 l* f, b( o
  323.   #--------------------------------------------------------------------------! v& J* v' G8 L- A5 v+ `% h
  324.   # ● 设置鼠标坐标
    $ ~' m" j' A1 f+ Y! ?
  325.   #--------------------------------------------------------------------------
    ) D5 g& @% |1 S# T
  326.   def set_mouse_pos(new_x, new_y)
    9 ?. ~6 `" ?( |/ t
  327.     arg = [0, 0].pack('ll')6 D' I6 g9 ?! {: S3 [
  328.     Screen_To_Client.call(Window_Hwnd, arg)$ x0 n  S/ w* N2 ]# P; a7 \6 \! T- p+ h
  329.     x, y  = arg.unpack('ll')* }0 w' I1 A1 h
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    % @% _% }; p/ y; j( k
  331.   end* D+ Y5 d2 S- D6 m: u
  332. end #end of class  self
    5 i. C' K0 P- A
  333. 3 G8 h/ d6 m) Q2 }: ~7 a  z
  334. end5 I. X! Z8 `8 ~, I4 E  K. w1 j, n

  335. / _0 n6 Y( S' x: j) s
  336. #==============================================================================3 G' T3 J" \/ h. L
  337. # ■ SceneManager
    " p3 F, j1 l$ x/ k/ C+ d/ V& n
  338. #==============================================================================4 R% H2 @4 V1 C" y( b- f4 }& z
  339. class  SceneManager" Y" H1 L( F) U# r
  340.   #--------------------------------------------------------------------------+ \. e/ C' g. b- P' D/ a
  341.   # ● alias" A7 M6 |3 y- q1 ]
  342.   #--------------------------------------------------------------------------
    ( S; h, @0 X$ G5 w( M
  343.   unless self.method_defined(sion_mouse_run)
    5 D4 V" s) q8 a) Z( E
  344.     alias_method sion_mouse_run, run  Q1 c* m; p# j
  345.     alias_method sion_mouse_call, call
    7 W+ g4 Y4 l+ r2 g3 m2 B% {
  346.     alias_method sion_mouse_return, return
    ! W0 _$ h9 b' w8 V' T  R
  347.   end7 c/ H! ?( x; e0 ]6 H
  348.   #--------------------------------------------------------------------------4 g8 a4 d( Z  `7 w9 r: [3 S7 f& a' i
  349.   # ● 运行/ M3 R2 ^5 {, L1 C
  350.   #--------------------------------------------------------------------------
    , I# m# H, S: ?/ c5 T  t" W  @
  351.   def run
    , Z* N* H& g2 U& I' [5 A7 B2 {- b
  352.     Mouse.init
    + ^3 {, t- l% a3 h) g
  353.     sion_mouse_run: U3 C& |  [. g
  354.   end5 A0 S; g4 b/ U- ]
  355.   #--------------------------------------------------------------------------
    + [' F0 G& |7 |* F
  356.   # ● 切换  a, X& c3 ?! O/ y# N; H0 y
  357.   #--------------------------------------------------------------------------0 ~4 e% r! P: |# i  t' a1 e4 T* W, d
  358.   def call(scene_class); {6 u/ T1 T* _1 J
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)" y& ^4 J2 s2 _/ t1 X8 C7 _" d
  360.     sion_mouse_call(scene_class)6 y% `- X; O8 b2 \0 C* Y, {
  361.   end
    8 r& A6 {/ v) p, C- E
  362.   #--------------------------------------------------------------------------/ O6 {4 {; t0 F0 _+ o
  363.   # ● 返回到上一个场景
    5 r" Z7 z7 R6 H1 K! s
  364.   #--------------------------------------------------------------------------
    " A7 g8 C% |- [. |
  365.   def return, m4 q- }* p: L7 V; _; n
  366.     sion_mouse_return  O- [# y" f2 x  i. t  A
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&
    ; W$ p# S; m/ M) T) }
  368.       @scene.instance_of(Scene_Map)3 z. U! M. w0 z9 ?& G' W4 z/ k
  369.   end( d* J2 J  `8 L* i3 l
  370. end
    1 l( x/ S# r! h5 e5 p0 t; V6 ?
  371. , u8 T# F* M$ X5 F
  372. #==============================================================================1 @, v4 O% A- A. z
  373. # ■ Module Input9 D/ v6 _4 O& T4 T% J4 C' ~7 r/ r) S' U
  374. #==============================================================================
    ' P  x$ x- R, {& K. b% W. I
  375. class  Input9 z# {2 \% B5 c% ~) h+ ]1 e
  376.   #--------------------------------------------------------------------------& }0 `, B# g- Z7 N0 c. I
  377.   # ● alias
    % G# {% `" |$ h4 D; e7 S
  378.   #--------------------------------------------------------------------------9 I, k' [: u5 a
  379.   unless self.method_defined(sion_mouse_update)
    * Y5 o* D: `- k- K5 K0 B5 C
  380.     alias_method sion_mouse_update,   update0 ~4 T# [* `7 m' i* f
  381.     alias_method sion_mouse_press,   press
    8 d% v3 O" b+ k8 U0 I. W7 E: d
  382.     alias_method sion_mouse_trigger, trigger* O( r) R, |6 Z( x1 I
  383.     alias_method sion_mouse_repeat,  repeat: l3 n9 Z2 z. N& N. z
  384.   end5 ~0 _. \! e% W8 `4 B
  385.   #--------------------------------------------------------------------------" R8 f: T0 I) m
  386.   # ● 更新鼠标
    4 n- u# @" Y2 p
  387.   #--------------------------------------------------------------------------* f# B  z( |1 z9 y- C
  388.   def update' q9 r9 h7 t* k9 s2 S  d" F6 k
  389.     Mouse.update5 u5 s3 h( G  ~9 Q) y1 L
  390.     sion_mouse_update4 C; x; ]' B5 X1 H/ s: _
  391.   end
    & v8 d4 _  p8 ^5 D8 B
  392.   #--------------------------------------------------------------------------) i$ K1 ~# @+ l& J' {
  393.   # ● 按键被按下就返回true- h( A. Z& Z% A% Z* C
  394.   #--------------------------------------------------------------------------
    ( h; b! W0 u( l% a# K, e2 T2 B
  395.   def press(key)# v4 Q) V: [1 {! z: w1 V- K" A# N, c2 _
  396.     return true if sion_mouse_press(key)
    ' [1 a7 i- v. Z. I) ^2 _
  397.     return Mouse.press(0x01) if key == C4 D+ x  N* B4 m' c
  398.     return Mouse.press(0x02) if key == B& K& Q. L1 e, \; C* r' L9 v2 i
  399.     return false
    : |0 _2 t2 u0 x9 L6 `
  400.   end8 \  w( ~1 F% P; B# o& `
  401.   #--------------------------------------------------------------------------5 ^3 o2 J' ]% J- y7 ^7 a- A
  402.   # ● 按键刚被按下则返回true
    % j" d1 n! r! [$ \# P# q$ ?
  403.   #--------------------------------------------------------------------------
    $ |; k* U4 P' F2 |, S
  404.   def trigger(key), {; e0 J) {  W: Z: x3 o
  405.     return true if sion_mouse_trigger(key)
    ) T/ v. [( o8 a( p( V+ E! j
  406.     return Mouse.trigger(0x01) if key == C- h1 r! E7 [$ p* b
  407.     return Mouse.trigger(0x02) if key == B
    ' I4 E  J: P0 w) H: ^$ m
  408.     return false
    ; ]  ^! U) c. r: _3 S2 B; i" [' n
  409.   end+ ~" }6 \/ F7 A$ a2 O
  410.   #--------------------------------------------------------------------------. ~7 J, D5 E2 }" X( Z
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    0 W! X" c$ d+ ~, U* s
  412.   #--------------------------------------------------------------------------
    " D  h: j% f' \( u& X2 r4 r. I
  413.   def repeat(key)
    8 y7 C7 S5 t5 d2 O6 i# F0 J4 @
  414.     return true if sion_mouse_repeat(key)
    . q# N9 W  H) ]# X
  415.     return Mouse.repeat(0x01) if key == C* B% d$ {' q) S' O/ R: {2 I
  416.     return Mouse.repeat(0x02) if key == B
    0 ^; L/ z' s& |5 Z) Y* n6 r3 |
  417.     return false: H* T# W' n( Q6 m7 }8 V7 ~
  418.   end: H( F+ m" H4 U) k
  419. end( _3 J$ ^  w. v' W1 @; H
  420. . M& A( I! d% a  L

  421. - e% W( I  J& [
  422. #==============================================================================" r; B4 l& e% G( |( n5 P) g
  423. # ■ Window_Selectable, u. E; d+ i' z
  424. #------------------------------------------------------------------------------
    : s( p3 I0 {1 S
  425. #  拥有光标移动、滚动功能的窗口* ~; l* k; [0 g
  426. #==============================================================================
    % c: u& [8 D7 \# h
  427. class Window_Selectable
    . @- ?, Q" _$ _1 `/ g$ h9 U5 }
  428.   #--------------------------------------------------------------------------: J0 U) e( R- c9 h+ n  x- O% }9 e
  429.   # ● 初始化
    6 E. t8 r5 e# e* j& u
  430.   #--------------------------------------------------------------------------
    - f1 f5 r6 p- f) v# ?
  431.   alias sion_mouse_initialize initialize
    $ c$ ~( f' a# Y1 ~3 S, g! y5 [
  432.   def initialize(x, y, width, height)' R) N; M" O0 I" G# D
  433.     sion_mouse_initialize(x, y, width, height)
    3 |& _& z1 f- h/ J6 a- F6 q9 x
  434.     @move_state = 0
    ; p) t; \! p# n
  435.   end  Y% a. f1 ^# V' v
  436.   #--------------------------------------------------------------------------# o1 e( S1 u( ?  p. v- `0 o8 O7 n
  437.   # ● 更新1 s! l& J  }2 ~4 T' W0 w2 ]
  438.   #--------------------------------------------------------------------------
    * e0 C4 h3 H$ G7 C0 ]% E
  439.   alias sion_mouse_update update" p2 _6 f1 A  S; C: r: T, i# C$ M
  440.   def update
    2 V$ E! Z7 Q% J6 F5 N4 r) {: {' Q
  441.     sion_mouse_update
    ) k  u  N: i3 d$ l+ ^) \( ~
  442.     update_mouse_cursor3 \/ F0 g9 J4 |" a2 k
  443.   end
    : p2 H1 T- g4 R3 U
  444.   #--------------------------------------------------------------------------
      N  a* W4 u9 j+ n
  445.   # ● 启动后设置鼠标到index位置% ^. A5 s; f8 ^; O7 Q
  446.   #--------------------------------------------------------------------------7 w2 [( w8 S) V9 Y5 S
  447.   def activate) S$ `! G1 w" [& _( P
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos6 ~, t; C6 g3 h0 G! Q( T: h+ E
  449.     super; r  h( c2 l' x1 S7 O; j7 z
  450.   end
    & u0 v4 b) m. u
  451.   #--------------------------------------------------------------------------
    4 S/ P/ w# k4 J( u9 Y* ?
  452.   # ● 更新鼠标和光标的位置
    # P- I7 e; \+ `
  453.   #--------------------------------------------------------------------------
    & n" o( X# L3 v' a. s: l
  454.   def update_mouse_cursor
    9 J9 }! N" L1 G, {+ [. p
  455.     if active6 a( t( X3 F' I/ [; A  b
  456.       if @need_set_pos' _5 v" e: @9 \3 q  v; p' x3 m2 P' R
  457.         @need_set_pos = nil" a- g& m; p) ]- F7 v3 ]$ @' I# n* y
  458.         set_mouse_pos# v$ i, o7 [" s
  459.       elsif cursor_movable2 F: C: C; `; L' ~  |
  460.         Input.dir4.zero  set_cursor  set_mouse_pos  `: U# |9 \4 q2 E1 X. c4 w9 U
  461.       end' c4 H: p( E% b6 {- I
  462.     end
    7 G6 l3 E7 J# F. c( w5 o0 v0 Y
  463.   end
    : h2 \& f9 t6 I; m
  464.   #--------------------------------------------------------------------------- I8 q0 ]7 L. I& h' |  L+ u% F
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能
      c; G4 q7 H+ c7 D; ]4 d4 w
  466.   #--------------------------------------------------------------------------5 X- }1 S! r. X( q
  467.   def set_cursor2 X1 i& E$ ~  l% A! L" |
  468.     mouse_row, mouse_col = mouse_window_area
    + O; L" b( q0 ~5 P
  469.     if    mouse_row == -1
    ) ^1 f! l5 M4 g
  470.       @move_state += 1 if need_scroll
    + c) A7 q; a8 n/ B% X
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand
    * p# D+ `( g3 ]3 S4 M
  472.     elsif mouse_row == -2
    ' E- d% \; M2 G9 u5 t
  473.       @move_state += 1 if need_scroll- i& x9 D9 `2 C& @3 J4 p
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand8 p6 `+ _9 @* f9 N
  475.     elsif mouse_col == -1- m8 z- k  p% g/ o$ P
  476.       @move_state += 1 if need_scroll
    ) X2 I" x" ]* {3 Y
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    & G5 T( n* W! E; }% {+ B1 D
  478.     elsif mouse_col == -27 H2 C' |" ~# s& |
  479.       @move_state += 1 if need_scroll
    : z5 A+ U) O; o1 N
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
    3 V1 [8 M2 a$ Z9 o
  481.     else
    8 E( X: q+ u* M: Y0 V
  482.       @move_state = 0
    7 J: F1 t6 t- |7 J
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col
    - K, C7 D7 m2 t: V) }+ r) I7 V
  484.       select(new_index) if new_index  item_max && new_index != @index. U) n7 h/ }" U8 v
  485.     end! O0 H! Z6 o! X" b% s
  486.   end. H: o" E% x; G0 x' v# r
  487.   #--------------------------------------------------------------------------4 ]" a8 g; ]5 p: ]  p
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    4 `( T! x" {! m% ]* \) V
  489.   #--------------------------------------------------------------------------
    8 a% H0 N& g5 W6 h
  490.   def mouse_window_area- v! l( U, n8 t! ]7 d* a
  491.     if viewport.nil # necessary!
    5 k! V/ l3 S3 i9 \
  492.       vp_x, vp_y = 0, 0
    1 x0 H# G& Q, z, Y! y; p' i; ]
  493.     else! `$ c& \4 u+ s
  494.       vp_x = viewport.rect.x - viewport.ox- M( l- W; r( Q0 V3 F
  495.       vp_y = viewport.rect.y - viewport.oy
    ! d: s8 P' Y5 Z* `1 @6 T
  496.     end3 R6 d5 L  d; V1 X# z6 R
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    1 y1 b" e, f: z
  498.     item_x1 = vp_x + x + standard_padding
    6 z4 Q/ M$ N7 k' [' S) H. u9 s
  499.     item_y1 = vp_y + y + standard_padding' I) ~% z5 L8 Y- L: K/ Y
  500.     item_x2 = vp_x + x - standard_padding + width
    # @9 l' _7 \6 ~4 _! L
  501.     item_y2 = vp_y + y - standard_padding + height
    + W& P& ^9 r" |6 Z9 M5 R$ B- o4 x1 u* W
  502.     if mouse_x  item_x1; D& d& _+ @9 \# j+ p8 h, I
  503.       mouse_col = -1" \' X3 o/ ?- W" F% N
  504.     elsif mouse_x  item_x21 ]3 x/ Q$ l; d) m# Z
  505.       mouse_col = -2
    1 t) g7 d7 \" M4 Z. F2 L
  506.     else
    3 |( Q* Y9 f$ e+ G
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)
    0 C3 W' W% y9 E) {
  508.     end9 [& c9 i+ i; |) Z5 D
  509.     if mouse_y  item_y12 Y- a, ]( f6 n8 p$ U1 @  B* z
  510.       mouse_row = -1: {3 p5 F* j2 O* [
  511.     elsif mouse_y  item_y2
    $ |* y" h$ Q$ P, U7 K
  512.       mouse_row = -2
    1 h5 h! M. X% s3 i4 z& J
  513.     else+ o3 K7 N, K& O& i
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    + G; i! L, s% `. G* V
  515.     end
    , z! Y, N; M: ~/ l# S9 E& N
  516.     return mouse_row, mouse_col
    ; E( ~% Y% d$ g2 w
  517.   end
    0 |, b% o/ u" j- Q. c" V  U# ~- i9 e
  518.   #--------------------------------------------------------------------------
    9 ]0 N" I1 L1 v( e+ a  t
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    " z3 ?6 p. M. Q& _" t
  520.   #--------------------------------------------------------------------------
    5 d$ f6 L* J* X3 s
  521.   def set_mouse_pos6 V. \1 c/ ?0 e& @, M
  522.     if viewport.nil # necessary!
    2 F% B; O( n( U4 H' a! T* f- U
  523.       vp_x, vp_y = 0, 0
    * o3 C3 K1 J, @' {, q1 {& H, B* @% K9 g3 p$ _
  524.     else- C. h& h6 y& E8 [: ]9 g; J6 z
  525.       vp_x = viewport.rect.x - viewport.ox' C* J4 U5 ~  L, a
  526.       vp_y = viewport.rect.y - viewport.oy
    # I4 k' ^2 p  d. x$ Z% r2 d5 ^
  527.     end: B5 i* R; I& L; o  Y
  528.     item_x1 = vp_x + x + standard_padding
    ; w4 `6 T) m. G0 V
  529.     item_y1 = vp_y + y + standard_padding
    4 Y2 u6 L' @2 I
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index 0 |2 g4 n1 s$ Y* W  t" A8 |* I
  531.     row = get_index  col_max - top_row
    " y5 f% R& S; s' n
  532.     col = get_index % col_max
    7 i) k% r' J# ?" E% |  m9 h
  533.     new_x = item_x1 + item_width  (col + 0.5)
    : K6 P$ d$ N! }, B- j6 u
  534.     new_y = item_y1 + item_height  (row + 0.5)  Y5 L) I8 \* b) f, I! t. p
  535.     Mouse.set_mouse_pos(new_x, new_y)9 n" s5 P4 O. t/ ^7 c! R  d, Z
  536.   end/ g6 i9 t0 m) H9 N
  537.   #--------------------------------------------------------------------------
    3 V: d- ?# d! h) |" {7 N
  538.   # ● 判断菜单是否需要卷动
    + T1 s7 D) [6 D) P1 f4 ~
  539.   #--------------------------------------------------------------------------" F! E" D0 z5 m& V* c& {* t
  540.   def need_scroll1 L2 g0 f& L/ R) Z0 E+ m% G4 S8 |
  541.     item_max  col_max  page_row_max6 D& D! m: g- c- H( j
  542.   end
    8 w8 a/ `$ _  N
  543.   #--------------------------------------------------------------------------
    % ~2 L' i) y/ z2 X- I% O& o
  544.   # ● 判断是否为水平卷动菜单/ a  V9 n7 \! p
  545.   #--------------------------------------------------------------------------
    4 B0 p+ t# K. g
  546.   def is_horzcommand3 _' M" W0 p; {+ y2 Y. P7 C
  547.     return false9 m+ p1 ]; q7 H, Q( G, H! P
  548.   end
    ; C9 V5 }# Q" f2 Y# o# J
  549. end
    6 [8 Y# C: P8 V0 W) Q" P- c
  550. * ]3 R; [" e. o# y, }
  551. class Window_HorzCommand2 f' ?' v+ w! j/ P) Y. u
  552.   #--------------------------------------------------------------------------# ~/ _0 ~' u# ^+ z& ~& m
  553.   # ● 判断是否为水平卷动菜单8 [- F9 D" }! F# r8 w/ W: s! q! ?3 O
  554.   #--------------------------------------------------------------------------
    + H1 r/ w4 l9 m. t& H1 ^
  555.   def is_horzcommand9 c9 y& ]$ a! g
  556.     return true9 s' |' W2 i2 @% u% y* d! l& }' ~2 L
  557.   end) n: E: Z$ g/ G0 S, ]# K* u4 H
  558. end* S& u# ?" e4 O; M/ e) {# C

  559. / y& P  e  [% v3 N
  560. #==============================================================================( o9 K, H  U9 A0 E% I/ h$ E
  561. # ■ Window_NameInput
    4 ^+ _6 K* t4 Q8 Q$ ?3 t
  562. #------------------------------------------------------------------------------
      F1 F/ M1 p: k. X& T4 A( R
  563. #  名字输入画面中,选择文字的窗口。8 S: C$ h5 W* g4 |# j8 o4 L5 a
  564. #==============================================================================
    , R, u1 {8 b7 }
  565. class Window_NameInput
    8 r4 N/ M0 Q* K& d" r
  566.   #--------------------------------------------------------------------------0 {4 w# j& S4 }3 i1 s9 B' g
  567.   # ● 设置列数
    3 g  E' t' A4 Y- D
  568.   #--------------------------------------------------------------------------
    , A4 N8 B  }% G, O3 `. Z
  569.   def col_max; I' g: q2 r! Y5 c" Z
  570.     return 10
    4 e3 y0 N3 G' J* t
  571.   end5 r, j. j8 o/ }: L( L
  572.   #--------------------------------------------------------------------------5 k/ `$ Y% [9 F. Q- e) S
  573.   # ● 设置填充的Item个数
    4 z7 `0 }2 s# D
  574.   #--------------------------------------------------------------------------2 x& Q" L4 b! |$ ]* G' R2 g9 R
  575.   def item_max
    , }7 j# o0 L5 `' w
  576.     return 90
    % G; v6 i, [' k/ u3 g! o2 L
  577.   end! i7 O* ~( Y3 G4 l4 k* c! Y
  578.   #--------------------------------------------------------------------------. N9 F2 [$ d- W; ~+ H3 r
  579.   # ● 设置填充的Item个数
    , [6 {" x; e+ C6 e0 {
  580.   #--------------------------------------------------------------------------7 ^" I" J2 U% L4 ~
  581.   def item_width5 y: Q, P5 @. ?; d% R8 B4 r( n: |$ \) w
  582.     return 328 U) N9 M5 Q+ {5 k5 s3 l3 G
  583.   end: |0 C+ H9 s. `. j
  584.   #--------------------------------------------------------------------------
    / A0 k  M) q# }2 t
  585.   # ● 判断鼠标位于菜单的第几行、第几列
    4 p9 X0 w. n9 G
  586.   #--------------------------------------------------------------------------$ O% H, s( V+ C. P3 z
  587.   def mouse_window_area$ M, I) W7 H; |8 W
  588.     if viewport.nil5 }( {+ L9 D$ Z
  589.       vp_x, vp_y = 0, 0, a5 ]+ T1 H' F/ }
  590.     else
    0 a) U) i1 r, Q1 |% B$ r
  591.       vp_x = viewport.rect.x - viewport.ox' O$ C% Q' f6 r6 x
  592.       vp_y = viewport.rect.y - viewport.oy
    0 C9 `- F& Z( c  N% T  U
  593.     end
    ; j# E- m  b7 p8 u$ C  q
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    1 B7 P  a( U& N& {; y
  595.     item_x1 = vp_x + x + standard_padding ; b) l+ |5 L- ?( k9 @6 X1 X* f
  596.     item_y1 = vp_y + y + standard_padding
    ; A# }. r6 l& E: y( p: r
  597.     item_x2 = vp_x + x - standard_padding + width
    / l0 w2 D) ^' x6 j% R1 t
  598.     item_y2 = vp_y + y - standard_padding + height5 Q" D2 E/ m# H/ C+ y: G9 u
  599.     if mouse_x  item_x12 _7 S$ s1 I( j1 Z; ^
  600.       mouse_col = -1
    / N8 T5 D! ~+ p1 N4 t
  601.     elsif mouse_x  item_x2: }( R( R8 X" o: m) H
  602.       mouse_col = -2
    4 M5 A  i& E3 j9 [
  603.     elsif mouse_x  item_x1 + 160' M' P: C' F- U; b: k0 w6 }3 V
  604.       mouse_col = (mouse_x - item_x1)32& g! @" h4 E7 w) W9 g( U2 G/ a! y
  605.     elsif mouse_x  item_x2 - 160  u# y' q6 c0 H0 F0 \. q8 _
  606.       mouse_col = 9 - (item_x2 - mouse_x)32: O+ A9 Q) l$ i( n6 t5 q/ I5 q
  607.     else
    4 `# e& @* t9 f2 b; _
  608.       mouse_col = mouse_x  x + width2  5  46 W1 @: q2 a% c9 \  K
  609.     end. C3 x- e# t4 v, C
  610.     if mouse_y  item_y1
    6 V) B- z. W0 l$ `5 Z+ \
  611.       mouse_row = -1/ D0 U( K4 v9 i  w8 {: {
  612.     elsif mouse_y  item_y29 p4 d0 c0 e& y* m
  613.       mouse_row = -2- H3 K  e& g# f
  614.     else; {* v. h7 m8 P: r
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)9 S0 P$ ^* a! a$ _2 {9 v
  616.     end/ ]( R0 u; c/ Q% Q6 _; I$ L  ~" c2 X
  617.     return mouse_row, mouse_col
    : u; g, U! G: w, g+ g
  618.   end
    * U! w+ i5 |/ v: h' N; d* X
  619.   #--------------------------------------------------------------------------. n2 a% |& O, L- t
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置' c6 L. D6 {: u- |9 p
  621.   #--------------------------------------------------------------------------
    " j+ r- q& Q  A$ x
  622.   def set_mouse_pos  d! I  [7 D/ k4 A
  623.     if viewport.nil # necessary!, D4 |/ L4 j% W  w8 \$ @+ o
  624.       vp_x, vp_y = 0, 0+ a8 W% b; ]7 x  B/ F. g- G
  625.     else1 @' g$ z* f. \9 S4 b
  626.       vp_x = viewport.rect.x - viewport.ox  r" x& g7 r/ X
  627.       vp_y = viewport.rect.y - viewport.oy; X9 M+ K7 j% \9 [4 g2 M+ V
  628.     end
    6 ^$ I% _: o+ @3 @
  629.     item_x1 = vp_x + x + standard_padding   R# q! s0 \0 d# `2 G2 M& u: i
  630.     item_y1 = vp_y + y + standard_padding
    3 i" [3 P0 ]: H. c
  631.     get_index = @index  0  0  @index ; D" Z0 M/ [* G: O+ W$ {$ M
  632.     row = get_index  col_max - top_row! `. b7 C) t: a
  633.     col = get_index % col_max2 X5 c3 l* V3 @* s+ N8 @8 e
  634.     new_x = item_x1 + item_width  (col + 0.5)
    / n: y" ~2 ?* I# h/ [0 o% M. F
  635.     new_y = item_y1 + item_height  (row + 0.5)7 T  r  V0 H9 B3 M4 B
  636.     new_x += 14 if col  4: w8 C2 G* n. e9 X. X2 v
  637.     Mouse.set_mouse_pos(new_x, new_y)$ j# I: h6 y8 Y1 O: R) o: }
  638.   end
    ! O, z! R5 G4 |* H4 H- H
  639. end& K2 G1 i" d+ x: _% u) X  J& u

  640. ) [' Y% h* K. s$ H$ }
  641. #==============================================================================) R0 K% |0 i# |( y; f
  642. # ■ Window_NumberInput
    9 r) y* l6 {1 L) ~+ W% J
  643. #------------------------------------------------------------------------------+ c" J  \/ u! |9 z1 u1 N( y
  644. #  重写了数值输入的方法以适应鼠标. O6 Q3 Q7 e% k% ~3 h$ |$ w
  645. #==============================================================================( ^; F. M2 M( \; u& \- B
  646. class Window_NumberInput  Window_Base7 a. C! d# c+ a% t/ ~3 B
  647.   #--------------------------------------------------------------------------& F1 g& i1 h$ {" J+ W) `& q' `; F
  648.   # ● 定义实例变量8 g2 Y  r  D  [6 l& }4 Z  p( Z6 O7 N8 h
  649.   #--------------------------------------------------------------------------/ U- C. _# T6 R1 @* X
  650.   attr_reader extra_window
    . |: i: r1 V/ v* W& g( _: O0 P
  651.   #--------------------------------------------------------------------------
    6 @. x# \6 h, \! L! _- \( i
  652.   # ● 初始化
    ' r7 U+ p9 b' O
  653.   #--------------------------------------------------------------------------( S' R% c8 K1 F
  654.   alias sion_mouse_initialize initialize9 S, S$ g5 v+ _6 H# W4 t" D$ ^
  655.   def initialize(arg)( T4 L" ~. F* R; L3 r6 S- i
  656.     sion_mouse_initialize(arg)
    ( @7 T0 d5 x0 H) K9 V' y
  657.     create_extra_window2 d6 c4 Q* E( Y/ t0 ^! }
  658.   end: B0 A" a! b6 ]; T, s7 P* f( U
  659.   #--------------------------------------------------------------------------9 l! y" U) A! @" O
  660.   # ● 启动
    % [  ~, e, d& X7 i% `: ^3 [$ Q! T
  661.   #--------------------------------------------------------------------------% |( G5 S: n* U8 }1 g; p- E
  662.   alias sion_mouse_start start
    " [/ B4 m- q3 ]$ ~  E
  663.   def start
    . i9 [/ i+ L% n
  664.     sion_mouse_start
    ! H$ L4 H! P& c, y5 K7 G7 h
  665.     deactivate  ~) `% ?2 h8 E- J5 V6 q; l
  666.     extra_start
      |/ ]8 l% Z7 x- o+ C# p
  667.   end( F, n2 i7 s% o$ F* e
  668.   #--------------------------------------------------------------------------2 X; C5 \( _; ]/ k9 n
  669.   # ● 创建新的数值输入窗口) C- j+ a4 \. |
  670.   #--------------------------------------------------------------------------
    ; `$ Q: p- e  E) p- @( Q
  671.   def create_extra_window! |" U/ J1 X/ }! x- L
  672.     @extra_window = Window_NumberInput_Ex.new1 {/ F" [. q7 B* k$ q6 X( ?2 m
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2
    # L/ V. u8 n1 r* ^, h# o- s( R
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }  t3 w& `3 E" y# L1 ]
  675.     @extra_window.index_proc   = Proc.new {n @index = n }) Y# p0 N4 N; F# ]: J
  676.     @extra_window.close_proc   = Proc.new { close }
    7 [" i; u# X! M/ n
  677.     @extra_window.refresh_proc = Proc.new { refresh }
    4 F; Y& }0 F' f
  678.   end$ |& A/ @1 J3 w7 C, Y/ D
  679.   #--------------------------------------------------------------------------
    3 L- J# [2 c$ Q$ z! d: d) \
  680.   # ● 激活新窗口+ C# K/ m2 E& B  Q5 B
  681.   #--------------------------------------------------------------------------2 o6 S, _$ m2 @, j( h) J1 N
  682.   def extra_start
    7 G5 H, K6 C; z$ R# c0 X; p
  683.     case $game_message.position
    2 E& \  C9 H# E6 k9 w/ S' D3 V
  684.       when 0; @extra_window.y = y + height + 4, l* L& f! l  c" F( r4 m, Q8 G
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
    ( n, j' g6 A' K2 V8 |
  686.       when 2; @extra_window.y = y - @extra_window.height - 47 X" H& V7 i+ v  C
  687.       else  ; @extra_window.y = 8: I8 Z, e/ e# r; [
  688.     end
    , c! X) D* `5 s; j- ?
  689.     @extra_window.variable_id = $game_message.num_input_variable_id+ {8 _1 Q" R0 }) x. e" E9 I* n7 D
  690.     @extra_window.digits_max  = @digits_max
    $ u# e  y% U# \7 @5 `  `) b% n
  691.     @extra_window.number      = @number7 m3 z+ n3 n$ c9 M1 J3 m
  692.     @extra_window.open* `) L6 Y1 X9 B1 B
  693.     @extra_window.activate
    / j' n5 W; g- J( G& L9 I* s
  694.   end
    2 x9 q; T5 e! c* O+ y1 }
  695.   #--------------------------------------------------------------------------& B$ R( z. T8 V# l7 L
  696.   # ● 更新! y( P3 [  M- n8 i8 e
  697.   #--------------------------------------------------------------------------
    % U: r& K+ `" R% O$ V5 |" y& r
  698.   def update6 _4 X! j' c) E2 q4 d* f- C- B
  699.     super  Y! p" Z7 i* Z4 o! t6 K
  700.     @extra_window.update9 F- v# p/ z0 [
  701.     update_cursor3 I7 |$ y0 h, p
  702.   end$ \0 }* G1 x& G% O/ C. x! {$ \. l# _
  703.   #--------------------------------------------------------------------------6 ?8 j0 C1 y/ x1 o+ t: y
  704.   # ● 关闭窗口+ V' Z6 g5 e% ?) x. q
  705.   #--------------------------------------------------------------------------
    * P9 u- l" v, x6 _1 O! S/ i
  706.   def close) a1 S+ A# t# F* p+ M
  707.     super9 x* V+ R$ q! h5 Q' g) ~) O
  708.     @extra_window.close2 H5 g- |$ K" K: U7 X
  709.     @extra_window.deactivate! ^9 R  Z3 d4 M5 k) P+ z+ q
  710.   end8 L9 R% a* s* D% ?, I' J" C
  711. end$ t9 a  X" G6 l( N8 U7 B
  712. ) ~! D- o$ c  `
  713. #==============================================================================) w! k5 T! O& L! s* ?; X6 E' {9 a$ P& |
  714. # ■ Window_NumberInput_Ex
    , D+ E! y: R7 n" }3 G" @; o1 h
  715. #------------------------------------------------------------------------------: I8 J* r2 j/ m* b
  716. #  新的数值输入窗口(NewClass)2 X& Y8 o8 @& g/ I0 W
  717. #==============================================================================
    ; o2 _2 X# ^) X# i
  718. class Window_NumberInput_Ex  Window_Selectable* O$ f( b, R9 @" a6 c) a! ~: c
  719.   #--------------------------------------------------------------------------5 y( M1 a( U; I  q+ k
  720.   # ● 定义实例变量
    ; g8 C9 b! T8 d( z  x1 E
  721.   #--------------------------------------------------------------------------
    ! ]  L# g7 z" Q& j8 a& T
  722.   attr_accessor number_proc6 |1 a4 H4 F6 V3 s4 u
  723.   attr_accessor index_proc
    8 J& w6 R* c! R
  724.   attr_accessor close_proc' L( B' q  d/ L' |5 L( `3 l* A; q+ m
  725.   attr_accessor refresh_proc9 v* ~) b2 d$ ^: o3 J  T
  726.   attr_accessor number/ C3 p* i( a1 N- R
  727.   attr_accessor digits_max: I: B% w2 I) l! h; s4 j! |$ F( N3 o
  728.   attr_accessor variable_id- R0 X0 R' G& N4 F$ J
  729.   #--------------------------------------------------------------------------
    6 [2 I/ R' J  B
  730.   # ● 数字表. D3 v7 f2 P/ G1 u) t3 k
  731.   #--------------------------------------------------------------------------
    ; v7 I* ]& X& l) _4 C
  732.   TABLE = [  7,  8,  9,) A- V6 W  j' {# O9 r: b
  733.              4,  5,  6,
    ( `- V5 E4 W) K4 W9 ~% {
  734.              1,  2,  3,& t2 M3 ~. Z1 v: k; D
  735.             '←',0,'确定',]
    3 u+ U3 w, x2 B. _& @
  736.   #--------------------------------------------------------------------------
    # d% @9 \, |) r& ^5 A
  737.   # ● 初始化对象) f2 M' G  U' d, ~' X5 |9 w
  738.   #--------------------------------------------------------------------------; y( `  h0 ?% A" ~  B7 P
  739.   def initialize
      \- h) l3 z9 h( b0 w
  740.     super(0, 0, 120, fitting_height(4))7 o$ q3 ~$ U! b& D8 K. O
  741.     self.openness = 0, k- N8 o8 M8 n! y9 _
  742.     @index = 05 [' u  n! X0 b, N
  743.     @number = 0
    ) n$ S& k- _8 t
  744.     @old_window_index = 0
    ( t" h) x" y/ f3 }
  745.     @digits_max = 02 i, q8 b& [& R' ~
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }1 d( ?2 A  c* s* Y& H% j
  747.   end
    4 {2 y5 U! ]( [, H
  748.   #--------------------------------------------------------------------------' C% \1 F  \1 h8 m2 Y# ^5 ?: k; v1 M
  749.   # ● 获取项目的绘制矩形: W' c- b/ J! r! W/ ~6 E
  750.   #--------------------------------------------------------------------------
    + [4 D& y3 m  o
  751.   def item_rect(index)7 ?  M% e6 _) p/ B8 g) b4 ]0 J
  752.     rect = Rect.new
    7 \4 J) p$ {( O0 Y
  753.     rect.x = index % 3  32
    + V/ Y5 {& _- I. e9 |9 T& I
  754.     rect.y = index  3  line_height
    + j% A+ T6 h+ i$ Y2 x4 [& U
  755.     rect.width = 32' z( F, a8 z+ D5 a  X4 o+ r* p. N
  756.     rect.height = line_height2 i4 y. q# L) g! e1 Y
  757.     return rect& ~- u# n+ f+ E) A
  758.   end# C, Y$ H0 ~: ]6 m- ]" O
  759.   #--------------------------------------------------------------------------9 s5 Z' H2 u2 X/ e$ Q
  760.   # ● 将光标设置到鼠标所在的位置
    1 P( g( l0 B. O3 ^
  761.   #--------------------------------------------------------------------------" Q. p! i: d: J9 |
  762.   def set_cursor5 F/ e& r9 S* ~* A
  763.     mouse_row, mouse_col = mouse_window_area9 ]3 Z; E3 E- [: {' r. |# u) C
  764.     if mouse_row = 0 && mouse_col = 09 @  W! Y. {0 g  D& a2 l) \
  765.       new_index = mouse_row  3 + mouse_col) W2 N$ D* _4 a; _
  766.       select(new_index) if new_index = 11  n: Z2 Q. A  o# Q3 @0 H- w( ]: [
  767.     end7 L& Z6 x' M. a& V  Q+ y$ R
  768.   end8 W8 F- T2 f9 B
  769.   #--------------------------------------------------------------------------3 U; Y9 I: M3 A
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列
    0 u, F& h& n5 _' \2 }5 F, I1 N
  771.   #--------------------------------------------------------------------------: I# t3 f/ ?0 z- C6 P# _- ~
  772.   def mouse_window_area
    : s+ i# @7 D' L8 r) [1 s0 {. }8 \
  773.     if viewport.nil
    0 u: E- g. _! ]) \, V/ t. q
  774.       vp_x, vp_y = 0, 0
    # n9 C  t# d; r4 }( A2 b; ~
  775.     else
    $ Z' I9 [5 Z/ v4 ?" \& z
  776.       vp_x = viewport.rect.x - viewport.ox
    . G3 q. }) B8 j6 g; x7 q
  777.       vp_y = viewport.rect.y - viewport.oy% _, k# i7 L+ [5 x! S
  778.     end
    / ]6 W' d* h' I# ^
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y% l+ W6 ^& R% ^6 K( o. k
  780.     item_x1 = vp_x + x + standard_padding 8 J' u0 \1 R: |; ?& {" ^
  781.     item_y1 = vp_y + y + standard_padding
    ' u* ^6 d2 l( e$ k8 k; G' I
  782.     item_x2 = vp_x + x - standard_padding + width
    ) I  B9 w: k3 B& m5 a( i  B
  783.     item_y2 = vp_y + y - standard_padding + height- u8 x1 l6 |3 [6 _& Z' m* \8 V
  784.     if mouse_x  item_x1
    4 z5 q. ~2 U$ f5 a/ Z. \0 h* b
  785.       mouse_col = -1' |5 C5 ^1 p) t. c* p
  786.     elsif mouse_x  item_x2
    ! Z! c6 O. r# T9 j4 d3 M
  787.       mouse_col = -20 a4 t2 q5 p3 V/ _' D3 W; w1 k
  788.     else" l& b/ b, W4 V* Q9 s$ r# U8 Q
  789.       mouse_col = (mouse_x - item_x1)  32" p; z( C" p1 o4 }; M& ^
  790.     end
    , f) H. N( B  X3 q
  791.     if mouse_y  item_y1# ~2 F! L" T: u' H
  792.       mouse_row = -1
      W/ |$ w2 e) V* t7 W: K6 I
  793.     elsif mouse_y  item_y2. X8 X( b7 l! {9 l
  794.       mouse_row = -22 |6 Y- _% T2 U& d
  795.     else' {1 ~* I9 S2 n1 ?/ Y/ k
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)( O, y7 H3 u) T
  797.     end
    + Q8 L' w" m# v" j$ C7 G2 \+ L5 L
  798.     return mouse_row, mouse_col
    8 n% B% R% r) D0 A3 R
  799.   end
    . o% g$ ~' \" C/ Y: B& d5 f
  800.   #--------------------------------------------------------------------------
    - a) x: L, \" a+ q$ e$ t' k+ F/ V
  801.   # ● 获取文字+ g. c1 {6 q6 y
  802.   #--------------------------------------------------------------------------+ P" z2 Y$ c3 a, n- @
  803.   def get_number( ^: V$ i; w# ^/ u
  804.     return false if @index == 9  @index == 11! l. Z* U; I7 ^, f' J: D
  805.     return TABLE[@index]
    - n  V, ^( `& W* N% F& D
  806.   end
    / D6 [- Y4 o2 w. Y3 ~( |8 t
  807.   #--------------------------------------------------------------------------
    ' S3 N; q' z& o9 U4 a# o, h# z) ]
  808.   # ● 判定光标位置是否在“退格”上4 z  }4 i9 f$ d% t- L, g+ }/ H/ g
  809.   #--------------------------------------------------------------------------
    4 F8 k2 C- B" o. x/ ]8 _2 v$ m3 G( W
  810.   def is_delete
    ' Y' B3 {. L+ M9 Z. D$ O
  811.     @index == 9
      s( }( U7 A" |0 K
  812.   end
    " x/ {# x$ y" z6 r! p! Y1 m/ {
  813.   #--------------------------------------------------------------------------
    ) ^1 l, {" g( x) ]; v& i/ ?
  814.   # ● 判定光标位置是否在“确定”上
    ! ]  o5 G; e0 v6 f5 o
  815.   #--------------------------------------------------------------------------
    : B0 \- `! o! z+ A
  816.   def is_ok
    : `' o7 q, n3 e6 j, W( T
  817.     @index == 11) Z) `* ]4 |# i2 f7 ]+ O: R- ?
  818.   end
    . u) T# ]% F% q9 R9 f+ M, V
  819.   #--------------------------------------------------------------------------! v' e2 w6 _- `; \* a0 u- R" J+ @
  820.   # ● 更新光标
    , Q. w% U; D" d+ k2 F+ q+ [) ?
  821.   #--------------------------------------------------------------------------
    ' c; s: C8 F  Z: t5 h1 e$ R
  822.   def update_cursor2 W; V+ c+ I% S# M9 R# q
  823.     cursor_rect.set(item_rect(@index))# ]/ V" K" ^9 I4 r- T
  824.   end1 d( u, g$ F* ^' l
  825.   #--------------------------------------------------------------------------7 T& n0 |% s1 R+ u2 t8 ]
  826.   # ● 判定光标是否可以移动
    , N+ a* s! V; O3 E# J0 r
  827.   #--------------------------------------------------------------------------& e7 V4 R5 M" L9 F; ?
  828.   def cursor_movable
    # z! O3 o+ ^6 F+ P9 U
  829.     active2 N* [  s! o! U4 F0 q
  830.   end
    - I( s1 i5 T7 J$ s8 P7 v/ B
  831.   #--------------------------------------------------------------------------( S8 s& p) {$ U& {' U
  832.   # ● 光标向下移动1 a- K/ w/ {* L$ `0 `: _6 j) p
  833.   #     wrap  允许循环1 v& o  C3 A! Y1 T: M) z$ q: j
  834.   #--------------------------------------------------------------------------* L1 g8 ^4 R2 `. f" F4 i3 h
  835.   def cursor_down(wrap), k' I3 h+ p) n" p' M" p' i
  836.     if @index  9 or wrap
    4 z  K" ~5 t+ i# Z' K' P& D
  837.       @index = (index + 3) % 12; w" f% z9 f0 u2 O
  838.     end
    ! A3 g$ l6 u0 C/ N0 M7 e8 h" t, u$ ~
  839.   end
    + z; F" w9 R. b. p! M: T% P9 E) Y' t
  840.   #--------------------------------------------------------------------------
    ; ~! S* S( X; r5 E% Z( l2 o! l) u
  841.   # ● 光标向上移动. W0 R5 k" N/ |" _' X
  842.   #     wrap  允许循环
    ! Q- A; O/ h$ w% [& @3 I7 U
  843.   #--------------------------------------------------------------------------
    ) J$ T" A6 q% w- O+ a
  844.   def cursor_up(wrap)" [- b+ S* e" ?  ~* S1 `
  845.     if @index = 3 or wrap( g& I6 M( M) c( Q7 o
  846.       @index = (index + 9) % 12
    & T0 S: @) K. s: |
  847.     end
    & ~9 Y: a9 k5 i+ C3 C
  848.   end
    ) t) ~2 u' w! n& _1 M
  849.   #--------------------------------------------------------------------------! T9 w" T& a+ L/ v$ i( f# m0 R4 k
  850.   # ● 光标向右移动1 S& @8 M1 H3 R7 M6 v
  851.   #     wrap  允许循环8 i& C3 ~: p. P! B, l8 }
  852.   #--------------------------------------------------------------------------
    - o1 P* Z6 Z3 v# R
  853.   def cursor_right(wrap)
    ! W% m5 ?% [" I  \
  854.     if @index % 3  2! n% u% M5 Z5 O* k' ?- \
  855.       @index += 1
    % u0 A6 p* A6 l
  856.     elsif wrap
    ( m0 J& }, ]! x% C' {3 G( ~2 I* i
  857.       @index -= 2
    $ z2 i, O& x" P: I! s! v4 _
  858.     end
    , g) x9 O5 `' L7 d
  859.   end
    . R, e( Q! k6 w" _- U
  860.   #--------------------------------------------------------------------------* ^& A2 A3 ^5 U8 q: O& `0 q- n/ B
  861.   # ● 光标向左移动! N" W. N1 M4 t' R& S
  862.   #     wrap  允许循环2 d" o" T2 S1 B+ A/ ]/ ~! Q
  863.   #--------------------------------------------------------------------------# G  V9 V# j6 F
  864.   def cursor_left(wrap)
    1 M# Z- n- n& x; y' T/ s, {
  865.     if @index % 3  0
    8 V: N/ ^" ?& p; G
  866.       @index -= 12 B; \% M; P! o  P3 X' ?
  867.     elsif wrap
      w4 [+ P' i1 U4 C
  868.       @index += 2
    % M& n8 b- ~8 y0 q
  869.     end8 ~! v; e. O( s5 y
  870.   end
    & [- @" H5 F5 {! R( j0 r
  871.   #--------------------------------------------------------------------------
    ) o/ u7 A0 U0 ?4 ]' Q- f
  872.   # ● 处理光标的移动
    : I% a7 l- ~( _# e" `1 f& D
  873.   #--------------------------------------------------------------------------
    " {7 \9 E, o+ _/ e' }0 c! u
  874.   def process_cursor_move( z: N5 X: n% `; ^4 I8 c7 k) I
  875.     super( f; z$ r. I7 Y
  876.     update_cursor
    , ^4 o% s2 `- O9 H, C
  877.   end
    7 n" c, G2 e. Z" e
  878.   #--------------------------------------------------------------------------
    ' f; ]: X' W6 }% F2 E! _" a! R
  879.   # ● “确定”、“删除字符”和“取消输入”的处理- g, B6 v7 I$ P$ F" {$ w
  880.   #--------------------------------------------------------------------------9 \7 Q/ V) i2 i( C
  881.   def process_handling5 P! _- v" B( r% Z) M
  882.     return unless open && active
    " D# ^" B* i& _" G; z
  883.     process_jump if Input.trigger(A)
    4 u' A. r3 j9 @6 g1 f9 k* I. @
  884.     process_back if Input.repeat(B)! B+ Q9 W! ?. E$ ~  O# d
  885.     process_ok   if Input.trigger(C)- L4 ^6 v: I' N5 @( U2 H/ o
  886.   end0 D, {5 d9 R& x- V+ g' C8 O4 }
  887.   #--------------------------------------------------------------------------
    + t- G' ~$ j+ E& A5 C3 Y
  888.   # ● 跳转“确定”
    1 r0 h; q! J. H$ f. V
  889.   #--------------------------------------------------------------------------1 \- `6 R3 l. T' u7 L: h
  890.   def process_jump4 k% W' c9 [) w; [, T! a6 V1 I2 W
  891.     if @index != 115 h- Y- L! o$ d. E  i
  892.       @index = 11
    " V& [2 l4 N; T- j
  893.       Sound.play_cursor
    ! n3 T# ^$ N6 Y" E
  894.     end; B" N/ S5 V' g
  895.   end
    ( b$ [+ t( F# b9 Q) u
  896.   #--------------------------------------------------------------------------! a: f: O1 ~; u8 F/ i$ j3 t
  897.   # ● 后退一个字符
    ! t% A, [8 `5 O5 ?3 U! Z' m' I% J' A
  898.   #--------------------------------------------------------------------------2 R6 W, S3 N, ?  g7 Y" t+ o% A
  899.   def process_back
    . ~& M1 h& `$ z. p. z
  900.     Sound.play_cancel( a/ f& M: ]! o3 p6 z5 I
  901.     place = 10  (@digits_max - 1 - @old_window_index)
    , j4 {) z/ [7 X! u! D/ g' z# U
  902.     n = (@number  place) % 106 y6 H, Z8 L+ U
  903.     @number -= n  place
    $ |' Z/ ?. K# s9 U- F
  904.     @number_proc.call(@number)# o4 j2 ?1 C  }, p' B/ ^
  905.     @old_window_index -= 1 if @old_window_index  0: t, ]3 S# }  }) w$ o* S3 c  |
  906.     @index_proc.call(@old_window_index)
    * v' v* e4 u4 ?  }$ r  n, u
  907.     @refresh_proc.call! n3 O9 t! K/ n' V5 }! O- g- x
  908.   end
    3 e4 H  R* {% O: q( Q. p
  909.   #--------------------------------------------------------------------------/ s2 k1 y7 h4 J4 ]! k
  910.   # ● 按下确定键时的处理! M) p- {6 B' Q0 k/ [1 w
  911.   #--------------------------------------------------------------------------8 |* `# f% }' Z1 z3 f; ]
  912.   def process_ok* @- A- b7 S, X0 g
  913.     if get_number
    * u! g3 Y( H4 n5 i
  914.       Sound.play_cursor6 y+ T7 k4 L' k+ \
  915.       place = 10  (@digits_max - 1 - @old_window_index)/ u5 \, `( O$ u/ ]( M1 g; F
  916.       n = get_number - (@number  place) % 106 W) B) j" |8 @) c$ Q, |* m
  917.       @number += n  place* m  u! Q* w- G6 q2 s  t7 O" y7 K$ n
  918.       @number_proc.call(@number)
    , ]3 }/ n9 x% T' R. r
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    % u; W9 c' [+ k4 \) e
  920.       @index_proc.call(@old_window_index)
    ! ?6 S% y% G1 A5 x
  921.       @refresh_proc.call# w/ T) |2 v+ y/ w5 Y- {
  922.     elsif is_delete- E* L. G1 B. h- |* u
  923.       process_back
      J* y" l8 E0 i5 x( N# A' K( C
  924.     elsif is_ok
    9 V7 Q% z& u& o% a
  925.       on_input_ok
    2 j" T" Z" ^# \- l+ D
  926.     end
    / `8 l1 e% W' l0 j2 h/ L
  927.   end8 m6 z' Q0 p& x+ G. |3 e8 W
  928.   #--------------------------------------------------------------------------! n7 t- a5 [1 A2 [
  929.   # ● 确定
    & M2 F4 P3 }- D) m0 n
  930.   #--------------------------------------------------------------------------; R- K5 ]+ A/ G/ v! P
  931.   def on_input_ok) a# E' ^' z) ^# m" T2 f2 U' L/ {
  932.     @index = 0& _; t  a  m8 N, J5 u
  933.     @old_window_index = 0
    # V2 M  x) }9 M/ o7 \& K! f3 J% x
  934.     $game_variables[@variable_id] = @number
    * B/ B: M& h! Z7 R" c/ [
  935.     Sound.play_ok
    ) w. t9 ]7 ]1 G# j3 i
  936.     @close_proc.call
    / _1 M8 G6 \  R4 s
  937.   end. Y: C6 ]4 V* w6 y
  938.   #--------------------------------------------------------------------------
    / I! F  N$ H8 M5 N7 d5 M
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置( @, z& j7 o+ p( q/ o, _+ K
  940.   #--------------------------------------------------------------------------- n) M* D- z$ H; R4 N+ i
  941.   def set_mouse_pos9 }* J  [5 o3 Q0 `0 d! f
  942.     if viewport.nil # necessary!
    , A' W  H- B# G3 ]4 Z
  943.       vp_x, vp_y = 0, 0
    3 ^6 ^- x2 Z3 |2 Y( \2 j, M9 t
  944.     else
    ) r; Z8 g% V# A: Y! X1 O
  945.       vp_x = viewport.rect.x - viewport.ox) P5 I( P3 I5 W) X/ i
  946.       vp_y = viewport.rect.y - viewport.oy
    2 J; I9 Y8 h# A* z
  947.     end- T) F. B5 o4 e
  948.     item_x1 = vp_x + x + standard_padding 6 c9 I1 W7 E! D
  949.     item_y1 = vp_y + y + standard_padding
    6 C9 W. l+ M0 i6 u$ i" `2 ~
  950.     get_index = @index  0  0  @index . }3 W  _' A6 w# @+ p; _; D
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)# L- A, n$ }$ j2 M! f
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)
    ! T3 Q$ ^! i0 |$ U. f' a
  953.     Mouse.set_mouse_pos(new_x, new_y)
    ! a2 G, m+ T& D' E" K! N
  954.   end; x! Q( L; P+ B! b) }9 [6 ^) x
  955. end2 j) @, q+ M* l$ J" e
  956. 0 J7 ]* A: {" R. w
  957. #==============================================================================0 ]+ n5 f$ c8 P. Y( \
  958. # ■ Window_Message
    2 r% I" v7 q+ W4 ]+ F/ u8 ]
  959. #------------------------------------------------------------------------------4 B0 j- x. k- c) p! b
  960. #  显示文字信息的窗口。! n! c4 W$ E: b6 f$ \7 T% |5 j4 W
  961. #==============================================================================
    , G( H( i7 G- q: ?& P. }- U
  962. class Window_Message  Window_Base
    4 J  g( u6 ?3 w/ W0 J
  963.   #--------------------------------------------------------------------------
    ; Y5 c2 w% w8 t2 C
  964.   # ● 处理数值的输入(覆盖原方法)
    ' T8 L4 y. F# j& \
  965.   #--------------------------------------------------------------------------
    8 e0 r) [7 \: `( M% v% }3 Y
  966.   def input_number
    : ^  W8 K1 v, E) |- g- ]4 ?
  967.     @number_window.start
    6 X" y0 c: x$ t; i' K; I. y; q
  968.     Fiber.yield while @number_window.extra_window.active
    $ i1 {2 Q2 G$ y$ _; }
  969.   end
    * s3 Z: S& \8 h0 e9 ~
  970. end
    1 t0 \+ \7 c" x; Q) C4 S
  971. $ i6 i* y3 t& V) A: [
  972. #==============================================================================  D* P" _$ r7 p1 g, K  T' V
  973. # ■ Window_PartyCommand
    + [: g% I+ t  H$ V: Z
  974. #------------------------------------------------------------------------------
    % A) d! r& [1 k! H$ Y
  975. #  战斗画面中,选择“战斗/撤退”的窗口。/ o9 g2 C. \3 e+ o3 @" S2 Y& W
  976. #==============================================================================2 f# d; t  j6 a
  977. class Window_PartyCommand  Window_Command
    9 F' g9 O4 P5 B1 H  L' M
  978.   #--------------------------------------------------------------------------
    # o+ r* x6 c7 U" r) t# E2 W" [
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置) Y$ K% I1 [: c4 E" u  P
  980.   #--------------------------------------------------------------------------
    % s7 l/ Q3 V1 P0 ~% j1 T6 @) D4 I
  981.   def set_mouse_pos. J* E6 k: \+ \
  982.     if viewport.nil5 l& Z0 Q1 l0 \2 ~7 q7 ]
  983.       vp_x, vp_y = 0, 0
    ' v- u3 s5 E! U
  984.     else5 s5 N6 ^8 K+ z" _
  985.       #vp_x = viewport.rect.x - viewport.ox5 `9 I; z  g' R$ n! d% G9 u
  986.       vp_y = viewport.rect.y - viewport.oy
    % a1 {* G' t, y4 ^4 [
  987.     end
    5 E+ W' \; U7 L2 P! ^% F9 K% d
  988.     item_x1 = x + standard_padding
    / A; l9 n% R" H7 V2 h
  989.     item_y1 = vp_y + y + standard_padding2 T1 T& I. L* q* G
  990.     get_index = @index  0  0  @index
      Q2 `- B( j- E. b4 x9 c$ _
  991.     row = get_index  col_max - top_row
    " ^7 a) x6 ]7 v  E
  992.     col = get_index % col_max" X% k/ O% a/ t" m' y5 N) U
  993.     new_x = item_x1 + item_width  (col + 0.5)# s1 F: t& v+ f" R5 N, V
  994.     new_y = item_y1 + item_height  (row + 0.5)
      m: K5 m, E0 E5 I/ W
  995.     Mouse.set_mouse_pos(new_x, new_y)
    - d( W$ E) l7 U( q; b
  996.   end
    . l- u+ Z1 b/ V
  997. end
    1 z, d4 z: c( @
  998. 5 x# i: \" u( ]5 [
  999. #==============================================================================: z# P. a6 A8 |% b
  1000. # ■ Window_ActorCommand
    1 a+ O) t+ F- f& D
  1001. #------------------------------------------------------------------------------
    # g4 }* r6 ?5 \( `
  1002. #  战斗画面中,选择角色行动的窗口。
    # [3 k# d* r1 x/ R; P- L
  1003. #==============================================================================
    2 S. u; I/ f& }$ C& @. E
  1004. class Window_ActorCommand  Window_Command
    & l6 O( E9 [  L% M/ v( Z2 X2 t
  1005.   #--------------------------------------------------------------------------
    + L; s: p) Q" z6 h% g, K
  1006.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    , P! Q8 A; I: e
  1007.   #--------------------------------------------------------------------------7 `6 S0 Q$ v0 ^
  1008.   def set_mouse_pos7 w! B% }/ v; o0 K4 f1 G9 P
  1009.     if viewport.nil  L6 g/ |, n8 h/ W
  1010.       vp_x, vp_y = 0, 0* u/ |9 M: `8 y  Z- `; V7 F
  1011.     else
    , ]6 V- \( Z" {/ Y) p, u$ x
  1012.       #vp_x = viewport.rect.x - viewport.ox
    * l; ?8 `; y5 W0 D* m, w8 r
  1013.       vp_y = viewport.rect.y - viewport.oy
    , g' c& X7 k# n1 }5 v9 h
  1014.     end
    7 D2 T3 ]9 ~  d, @
  1015.     item_x1 = Graphics.width - width + standard_padding
      s4 e7 K6 Q4 v4 Z7 |7 b* c
  1016.     item_y1 = vp_y + y + standard_padding2 Q% W8 s, b1 x+ U
  1017.     get_index = @index  0  0  @index % s0 q9 B3 t$ v8 _  l4 a( E/ Q$ H0 ~
  1018.     row = get_index  col_max - top_row
    % y9 j* v7 ~% X7 v
  1019.     col = get_index % col_max4 T+ g8 p0 p2 O! ?
  1020.     new_x = item_x1 + item_width  (col + 0.5)) V/ x% x, n  P1 O* k- A
  1021.     new_y = item_y1 + item_height  (row + 0.5)
    % b& h, z$ D1 u2 }4 b
  1022.     Mouse.set_mouse_pos(new_x, new_y)
    4 d: f4 m" C. U" l8 ^
  1023.   end
    9 h$ t$ \, z$ [! O
  1024. end
    & t' b% U6 h# i5 f5 \

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

  2225. : z, \# v( r3 }/ o# w! r
  2226. #==============================================================================
    , e$ y% a0 n- ]( N1 c7 c
  2227. # ■ Spriteset_Map, {( r  V; f2 N
  2228. #------------------------------------------------------------------------------- _- A% @6 r( o5 w+ v
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。% [' Q  O) f: w0 C
  2230. #==============================================================================
    7 S3 R# ?' ?. _6 H
  2231. class Spriteset_Map2 W# ?* b  t3 M# q3 L- j* V8 X- A
  2232.   #--------------------------------------------------------------------------
    ' R" p9 Z# W* r# \5 w( V
  2233.   # ● 生成路径点精灵& a) v! e3 u7 C
  2234.   #--------------------------------------------------------------------------
    ! H7 \4 s# p! |1 m! x
  2235.   alias sion_mouse_create_characters create_characters
    4 F7 Z2 K. M2 L9 _# c
  2236.   def create_characters  e1 j% r! r0 }- W9 z
  2237.     sion_mouse_create_characters  N: o' V2 `9 ~3 O, J2 i
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))
    6 Y$ Q% O5 K8 v
  2239.   end  D6 |* U+ g1 \7 H# a5 E
  2240. end& H7 R& c; Y1 y! q' s
  2241. $ I& }7 t+ @! X) F* {8 |; N
  2242. #==============================================================================
    + q7 k! W$ `3 O1 l  Z$ _
  2243. # ■ Scene_Map
    ! o& H2 Y5 {- k! t3 ^' q* d
  2244. #------------------------------------------------------------------------------
    : A& o/ i1 v5 e
  2245. #  地图画面
    + F8 t  M6 A, X4 M, d5 g+ X' F
  2246. #==============================================================================
    6 l3 L4 b1 o+ R+ `4 w% j* h# S1 K4 z
  2247. class Scene_Map  Scene_Base* `. N( w; {! h  C! [3 ^# t8 [
  2248.   #--------------------------------------------------------------------------6 R, C3 u  O, i
  2249.   # ● 画面更新
    ) E% X( d* _8 g$ F) g& P( I+ J
  2250.   #--------------------------------------------------------------------------
    1 G. ?, t- O5 c1 n  [
  2251.   alias sion_mouse_update_scene update_scene
    + ]9 q1 ]: |( s3 |5 i* v  i0 Y
  2252.   def update_scene6 ]; _8 Y; Q( E7 T" q1 k
  2253.     sion_mouse_update_scene
    $ ?% G( U% ?7 T
  2254.     update_mouse_action unless scene_changing
    ; A9 j- X- R. ^# p
  2255.   end* @( S6 o; P' E+ ^+ `; _" B+ i
  2256.   #--------------------------------------------------------------------------0 {2 D$ ^3 \9 ~" [1 @
  2257.   # ● 场所移动前的处理8 @1 L3 [+ d% }6 Z
  2258.   #--------------------------------------------------------------------------
    2 K3 X! F; A& ~- N: G
  2259.   alias sion_mouse_pre_transfer pre_transfer
      ]$ y# N& @2 o: i& k- M& C
  2260.   def pre_transfer
    4 p" h1 z7 p& b* b. Y
  2261.     $game_player.reset_move_path# d* u  S2 [( m5 d
  2262.     sion_mouse_pre_transfer
    : M6 @% l/ X7 ^! {/ [" S( C
  2263.   end; R& P/ l6 D7 h! ]8 U4 s
  2264.   #--------------------------------------------------------------------------: [: i2 X; Y/ j* z
  2265.   # ● 监听鼠标左键的按下
    2 v4 O0 u& Y2 k8 b$ p
  2266.   #--------------------------------------------------------------------------
    0 `. [! O% I0 w: W# Q+ h. n
  2267.   def update_mouse_action, E5 s7 r, F2 R; x& m; B
  2268.     $game_player.left_button_action if Mouse.press(0x01)# Y% f6 L- T" F8 u
  2269.   end4 R/ p4 h1 W2 W& ]7 j7 L% J0 n7 `
  2270. end
    : i: E$ j/ r9 J. U  e

  2271. 2 W1 A, \7 W8 M- a3 q8 \3 f; W; r
  2272. #==============================================================================6 d6 R+ {5 N3 b" r9 h* z
  2273. # ■ Scene_File
    % \: J2 ^5 t4 i+ k" w( b4 N$ g
  2274. #------------------------------------------------------------------------------
    + t9 A& M4 P  ~7 U  g4 x: F
  2275. #  存档画面和读档画面共同的父类
      f. H! U9 Q! U
  2276. #==============================================================================
    ) e" @% j  C: i- Z* {
  2277. class Scene_File  Scene_MenuBase$ Y, P% U+ c3 @0 ~; S3 _" f# G+ X
  2278.   #--------------------------------------------------------------------------
    ! K- w8 x8 N5 U5 j
  2279.   # ● 开始处理& @5 Q: j( P) ~. ?, s% _7 c# @2 P0 g5 T
  2280.   #--------------------------------------------------------------------------+ w- c/ R& A2 N: ]/ g* u! V
  2281.   alias sion_mouse_start start4 j( L* A% D, u* c4 W) k
  2282.   def start; _- B3 P2 Z/ I0 e
  2283.     sion_mouse_start
    + U" |( w- {* [1 {9 f. i
  2284.     @move_state = 0
    ) U2 H& }4 @# j6 O) `
  2285.     set_mouse_pos' d/ L2 \5 \' F6 h
  2286.   end- w" {/ U, k, `9 t! o
  2287.   #--------------------------------------------------------------------------) ~8 v8 U4 [6 M. b) T  Z: y! @2 T
  2288.   # ● 更新画面
    1 }& K: B  \5 R- ^# n5 G
  2289.   #--------------------------------------------------------------------------
    6 a. F. c6 q/ y' Y' d6 h  E
  2290.   alias sion_mouse_update update
    * P& }  Z" b) x* W7 d& i( _7 M
  2291.   def update+ I- f  f6 Z& s7 ~0 b$ `1 t' ~& r
  2292.     sion_mouse_update
    " ?' ~% m/ I  u5 q1 z/ ^4 Z0 F
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos6 h6 y6 k1 U" p0 K9 D
  2294.   end
    $ W" s+ ^0 C1 t  w3 g  f& x
  2295.   #--------------------------------------------------------------------------; Y3 w* F, C  B" [  F- Y
  2296.   # ● 更新光标
    0 D* i9 J% |$ i
  2297.   #--------------------------------------------------------------------------
    - C+ Q/ j' Q6 p
  2298.   def set_cursor- b# E  S% E- q& r$ F
  2299.     @move_state += 12 F/ @+ x& ~  }, o. A& ~
  2300.     last_index = @index
    $ F. U: r* G; ~- Q3 k, c* s$ P2 s
  2301.     if mouse_which_window == -24 ^" I* B: u" }( F
  2302.       if (@move_state - 1) % 6 == 0
    0 m3 ]5 ^8 i4 O' M) C
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1! |8 Z2 s/ ~7 M8 p* I& u. `3 o
  2304.       end
    , ^* i# I) z7 {9 [7 i  s
  2305.     elsif mouse_which_window == -16 c3 {8 m: W* H: s0 A; ]
  2306.       if (@move_state - 1) % 6 == 0
      H3 G5 q. ~/ ~6 S( e/ n+ T$ }
  2307.         @index = (@index - 1 + item_max) % item_max if @index  08 A' r3 c6 Y: \; ~
  2308.       end0 I# S" L" H- Q& A8 j
  2309.     else
    , ?" R% T8 T$ Z% e& Y3 g
  2310.       @move_state = 0, G/ |0 V4 @: v5 n$ q0 B5 d5 S
  2311.       @index = top_index + mouse_which_window
    * S, C2 M0 f6 f8 q5 h
  2312.     end8 U6 C! S. V* x7 J/ f8 f* X
  2313.     ensure_cursor_visible
    " e2 @' t6 \' J* E# S
  2314.     if @index != last_index
    9 R( u8 [, p0 Z$ {% \
  2315.       @savefile_windows[last_index].selected = false
    ) G( H4 a. b; m4 d2 q% ]3 V
  2316.       @savefile_windows[@index].selected = true& v1 \4 W9 s9 z' d
  2317.     end
    4 }8 g4 ]* R9 [0 g1 J
  2318.   end) P+ W2 [) F% U6 V3 \# v
  2319.   #--------------------------------------------------------------------------$ ?! s& X6 v$ S( ^" F, P
  2320.   # ● 判断鼠标位于哪个窗口, A+ g' t7 }: V% |. p! T' L! W
  2321.   #--------------------------------------------------------------------------3 r, F! x% \  l8 d' V3 ~
  2322.   def mouse_which_window
    6 T5 f: W6 @  ~6 T( e0 f
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y: J( j* S2 }  P1 ~- ?3 {# }
  2324.     if mouse_y  @help_window.height + 14  ^9 F  l, N( G, G/ Y4 u2 K
  2325.       mouse_row = -14 Q% r& Y1 R! `/ y# L! K
  2326.     elsif mouse_y  Graphics.height - 14
    . _6 l3 ?$ u* V$ |9 Q4 h* A8 _/ ~
  2327.       mouse_row = -2) B( \, K# w1 I* m
  2328.     else
    ; {* M# u9 E. O+ H
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    % h/ E. \/ }/ N9 ^" n
  2330.         (Graphics.height - @help_window.height)+ {1 R6 F' @) Y5 l: c6 _
  2331.     end
    0 W' }# i3 R+ X
  2332.     return mouse_row
    0 X' w! \/ \3 |, e5 r6 y+ d$ j3 ~
  2333.   end1 l( X' y7 y. L6 u: z* N
  2334.   #--------------------------------------------------------------------------
    2 X% W+ J9 ]* ]/ r4 z( p
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    5 c* N) f2 Z6 v$ e. F- d; |
  2336.   #--------------------------------------------------------------------------
    3 a6 a: w; Z! P. [) J
  2337.   def set_mouse_pos) G8 H& l6 r$ N* X
  2338.     new_x = 401 v& E( b; d, Y: M3 U& ]0 [. O5 ~
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    , j, {( W3 |4 V+ z" q
  2340.     Mouse.set_mouse_pos(new_x, new_y)( o' U9 E) ^& }+ _+ n: `: ]
  2341.   end
    $ Z: x* D6 r7 ?
  2342. end
    $ \* o# Y, V2 u, x( T; K/ B

  2343. , n  W+ O- Y* C4 e
  2344. #==============================================================================9 e# O3 P3 }+ G2 X
  2345. # ■ Game_Event, f0 J+ R& ~% q8 _/ p6 {
  2346. #------------------------------------------------------------------------------; w$ j7 x* Z6 m  G# z- [2 P
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。0 V8 }- N" M: s0 o2 d3 b
  2348. #   在 Game_Map 类的内部使用。
    4 c1 r; p3 @7 o  k
  2349. #==============================================================================
    5 }4 }: F! P( s
  2350. class Game_Event  Game_Character' t! s( i, w# w- y, A1 b" W+ |6 I
  2351.   #--------------------------------------------------------------------------, A" T* S9 |3 D2 X( L, w
  2352.   # ● 事件启动6 ~( q- c/ Y# e0 G
  2353.   #--------------------------------------------------------------------------
    # t. i. k% `( x, _+ L
  2354.   alias sion_mouse_start start& g8 W( D* w' U; w" t  T6 a
  2355.   def start* A! x7 f) c# }" z
  2356.     return if mouse_start && !Mouse.press(0x01)" T9 ]5 ]& @( E% C7 B4 h
  2357.     sion_mouse_start. F0 Y, q( r$ V4 [" N3 S, @# v
  2358.   end
    + X7 \# q" u+ m1 e$ W' q
  2359.   #--------------------------------------------------------------------------
    2 k2 P9 S* b4 e, x1 v0 R
  2360.   # ● 判断事件是否由鼠标启动7 H! m* ^% l  I3 H. Z
  2361.   #--------------------------------------------------------------------------& Z: E2 R4 J+ |9 A8 G6 r0 s* x
  2362.   def mouse_start
    $ J1 Q5 X+ T8 t! {5 A+ `! h6 K
  2363.     return false if empty
    # P0 E* S- k& B( X
  2364.     @list.each do index
    * ]# B3 T: C, ]
  2365.       return true if (index.code == 108  index.code == 408) &&/ n( r/ Q. [: @2 o1 R
  2366.         index.parameters[0].include('鼠标启动')
    & [# h3 D( o7 h5 s# i, r+ ]2 ]
  2367.     end. _2 w; [1 _2 \! W, @% L
  2368.     return false
    # y( D% I1 o7 \& i+ P2 q7 L
  2369.   end4 K1 v' f2 \" h4 u( b, }: V* d
  2370. end& T6 ^4 N. K/ ~# |* f

  2371. 7 H' T+ L$ u8 L( L2 }1 q. l+ _4 E
  2372. ####泥煤的height/ a. ^; l; @2 T7 V" T0 P4 e
  2373. # @height = height
    + |; U5 q8 V2 N$ ?

  2374. 0 x6 `1 G3 t- v1 ~: d5 X( Y
  2375. class Area_Response+ q4 |5 u, x) T. [
  2376.   attr_accessor type- g, n8 |2 C" \# N; K3 V
  2377.   attr_reader ox
    3 F* i. o- l# J7 ^# c5 l' E
  2378.   attr_reader oy
    ; `) |. e6 n& r# J* D! _8 }
  2379.   attr_reader width! ?0 Y0 q5 j1 i2 U3 O8 ~& W# a
  2380.   attr_reader height4 _! M9 P3 L, h
  2381.   attr_reader switch_id$ |. E/ y+ `- H3 J- O+ p( n
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)
    4 l( v9 x1 g5 T/ }) I+ K5 t
  2383.     @type = type) C% C/ x! \! a2 T- h" S/ y
  2384.     @ox = ox; m7 H- L) b) T; \) H5 ~
  2385.     @oy = oy8 e* J9 A% Q8 w8 n0 P9 A
  2386.     @width = width9 r5 t* }. X" a  G0 A
  2387.     @height = height$ M9 e/ A! t  v# z7 S& T
  2388.     @switch_id = switch_id
    , |  ]8 T" s" J: p  H5 k. W& \
  2389.   end6 @" M/ g0 `2 E- ^9 {
  2390. end
    , n% P3 D- T$ O+ ^  q9 B: Z

  2391. 3 T7 e$ K- W3 v' p0 u# S# S( q
  2392. $area_responses = []9 B; w" Z  L5 s6 m: g

  2393. 7 E) G% |9 _* M& A
  2394. class Scene_Map
    3 {4 I" P0 P  `  e  V
  2395.   alias update_mouse_2013421 update_mouse_action0 k: r# K' ^6 m, W' P' q- }
  2396.   def update_mouse_action
    - x8 t5 `7 D+ L
  2397.     update_area_response
    ) T/ q7 @1 q9 z. U
  2398.     update_mouse_20134213 p5 o/ x) }4 x7 r( S2 K
  2399.   end
    / P9 {; t0 j) G
  2400.   def update_area_response/ V0 w8 x: o& P- D, t, o; d
  2401.     responses = $area_responses+ g; p1 j+ s- r7 F, G7 Q: M
  2402.     responses.each {response
    6 D$ T8 g" Q6 h
  2403.       ox = response.ox, Z2 y0 `' V, A% [/ m; U% ]
  2404.       oy = response.oy
    / r4 C/ v- _5 x( h8 S
  2405.       width = response.width
    7 d: [3 N- E$ {2 Q4 T
  2406.       height = response.height
    - F( u! r- R* ?$ N9 Y# P* l& {
  2407.       switch_id = response.switch_id
    3 M( q$ X8 F3 X4 N
  2408.       case response.type
    / u9 m$ ^; S  E' s4 E* k3 j. @
  2409.       when 0
    # A- a) U2 E$ C+ k+ A
  2410.         if mouse_in_area(ox, oy, width, height)
    . Q; E. A# b, Z% t
  2411.           $game_switches[switch_id] = true9 V6 Q) I+ G8 l0 Y9 R0 t$ N# z
  2412.           $area_responses.delete(response): }+ e& v/ N, Y( k% u( g5 j
  2413.         end
    " _# `8 o3 O$ P/ `( |
  2414.       when 1( k8 m5 F% [' ]9 D( Z) T7 O
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)* u1 D# L- {5 k) c4 ], L+ m
  2416.           $game_switches[switch_id] = true5 }- z: b# Y5 t; x9 ^
  2417.           $area_responses.delete(response)0 z' @& ]$ O3 I/ `! \1 ~! c
  2418.         end% t8 k1 L9 U) V; m* J" s& w+ I# o
  2419.       when 2
    / u! f: f, G' R$ k- b# t) k4 w( J
  2420.         if mouse_in_area(ox, oy, width, height)
    % t# h. }1 Z+ j, q) e
  2421.           $game_switches[switch_id] = true" h6 ^2 U( @. U* E$ m' g0 J: I
  2422.         else( A8 C9 }% X; d) Y, N7 p% R" @
  2423.           $game_switches[switch_id] = false& {4 t" c+ ?7 {0 @' T0 |
  2424.         end
    6 p# |$ U/ t9 b/ w
  2425.       when 31 x( j+ H. A0 \* L6 @& t4 h
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,
      E: {" t$ E; ?: `
  2427.             (oy - $game_map.display_y)  32, width, height)
    8 @+ Q" w9 M& W: n
  2428.           $game_map.events_xy(ox, oy).each {event) i! |9 {: X; E  v  S
  2429.           event.start* V" ?8 ?% }8 a% T2 V8 C: ^) z$ q
  2430.           $area_responses.delete(response)& o, u+ H# M: L) q1 h
  2431.           return
    8 }" n' d6 @' q
  2432.           } 0 V6 P* J' N! ~
  2433.         end* J- [, U  m& H, t* c1 n
  2434.       when 4
    8 x  W5 o0 q6 ?/ B
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,3 A" c5 W8 [2 F* d6 \" M, i
  2436.             (oy - $game_map.display_y)  32, width, height)8 x: X+ `9 L/ f& N
  2437.           $game_map.events_xy(ox, oy).each {event2 L$ s7 M( J. K! _. G
  2438.             event.start1 S2 B8 W. K- k  X+ }8 g
  2439.             return" ]; m& e3 o2 S
  2440.           } " ]8 x& f0 Z; [; P: H- b) r
  2441.         end2 t' q9 k1 w( T
  2442.       end1 l1 ^- V! V. F+ i
  2443.     }
    3 F* b# l* M0 j1 T: K( e9 J& ?
  2444.   end
    0 ]0 M9 N+ \. E
  2445.   def mouse_in_area(ox, oy, width, height)1 `2 p( |4 o( ]. l6 i2 E
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&1 ^+ w* e# [+ ]+ X5 v; x6 l2 y
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height
    * s+ x" R- _6 P
  2448.   end7 w- h' [1 k3 p( W( q1 G5 ^
  2449. end
    5 X: l" Z4 |5 ]8 R+ n. b
  2450. class Game_Interpreter
    $ u, l* H; _. O" s$ _; p7 t
  2451.   def area_response(arg); i7 p2 Z( W( y5 ~! F4 D' S
  2452.     $area_responses.push(Area_Response.new(arg))) ]7 @- R! q# b. K8 N
  2453.   end
    / c; e/ j( E1 k: Z0 N/ ?8 {- `
  2454. end, r9 \: d4 y. I
复制代码

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

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

GMT+8, 2026-7-25 09:47

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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