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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    3 H1 d8 a9 |0 C" |/ N! g: r% i) B& R

  2. ! A$ I5 T. p3 f) L
  3.   Sion Mouse System v1.3e
    + x* \- `/ s6 w. O; |* k! u
  4.   
    / d/ _6 E3 b) \3 V) @' D
  5.   Changlog, e! J2 F9 o7 P3 G9 t/ o
  6.   8 A% N5 B/ T9 e8 h; P+ P( k
  7.   2013.4.21 v1.3f
    # z9 e! }8 W3 E' m- x" o! Y
  8.    
    . D, L  F% i- R2 `  I
  9.     1.3f 卷动地图 bug 修正* Y' _6 Z" {3 Z2 |
  10.    
    ! D* f, m3 O; e' O1 x4 H( i
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口1 N' d4 v# a- Z+ z2 o& h0 A
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内! H9 {7 s0 z- J1 N# \1 f
  13.                               Mouse.unlock_mouse_in_screen 解除锁定3 ]2 r# C; z& |) B2 P
  14. 1 w+ m, r) z. M! o- [' g
  15.     1.3f bug修正
    3 q7 w) w1 u: _3 t
  16.   
    ! a7 ^. ^" B1 |2 q
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及
    ; Q5 d* l1 Q! o) `( t4 K0 U
  18.           关闭菜单时,鼠标是否移动到原来的位置。
    # Y  d2 R. o" q! w: d

  19. $ _2 }) W7 [" p3 f% g5 J
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处
    * _) w5 ]$ S/ l0 ?" f# Z
  21. 7 n( Q" I/ K3 A; m1 _
  22.     1.3b 修正一些罕见的bug;5 w+ b! L& q! F' y) E+ c
  23. $ O7 s0 w* C5 ]9 l. t! m
  24.     1.3a 代码小修改;8 F) D& d: j$ i6 X5 H. G0 v7 i8 i; l, y
  25.           加入了鼠标点击启动事件的功能,
    " y+ b3 J3 e1 n  }5 i. D) R
  26.           在事件中加入“注释”: 鼠标启动  ,( G. ?3 M. ]. W3 ~
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。% A# J3 K' ~0 p
  28.   . z, P9 ?  J6 c8 z
  29.   2013.2.12 v1.2* i. T- z" Y3 r- ]! O2 B
  30. + R, G" {0 O: k8 v
  31.     寻路逻辑优化;. r. a9 [7 I, {7 ]
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;
    " i- k/ ~8 _: u' L
  33.     现在支持用鼠标来操作载具了。) ]0 f0 I; _) N2 y$ b! K  V4 E2 p
  34. ' T2 n* S  |# m1 e4 S8 ^9 g& u
  35.   2013.2.8 v1.1
      r2 W& g: b' N
  36. / Z! S+ |& M- d  ^* P9 `
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    & E( Z- c0 Z$ H" ]! y
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;: X0 r/ l' C& K( w! _
  39.     移动时,路径指示点的绘制更加稳定;
      O: j4 @( J7 N/ }: O. k
  40.     现在支持默认存档画面的鼠标操作了。) D% j- a! G  H2 u) c

  41. % }) Y# s7 u$ Q

  42. & f3 y$ Y! ~. \0 H8 K
  43.   OrigenVersion
    3 J2 `3 n) h- j! Y& K7 v$ Y  t& q
  44.   - a9 o' v  m  C) H3 R/ w+ w
  45.     2013.2.7 v1.0 ' Q5 |3 E, M1 v+ _# N- x
  46. % f, X, r" y9 {# V# ~( x! x
  47.   主要功能
    7 Y) R) c+ \5 C& }
  48. & ]4 E' }$ p! \5 v& ?- r+ e
  49.       使用鼠标进行各种操作...6 {1 {9 _0 S' t9 P5 P
  50.       将鼠标锁定在游戏窗口内
    ( L- W  e/ m# a
  51.       自动寻路,按住 D 键可以扩大寻路的范围
    9 Z- s9 O8 F( K& G
  52.       双击鼠标进行冲刺$ N$ Z2 u3 n: g- [
  53.       更改地图卷动方式以适应鼠标移动, A6 N0 @1 t; B
  54.       变量输入框改良
    # Z7 S2 s, i, ^) s

  55. & G7 B6 l% _7 {
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹
    , e5 R) n+ v2 {/ g

  57. 6 @( c( S) I+ `# X; `$ j
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹; N# m2 l1 q# e9 E. @
  59. " J# ^& Z0 m# m. W
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    ) h! `" Q$ z# t

  61. + }# A1 ?; H% d% j- H4 e# s
  62. ; g4 Z5 k( R( \5 ~  M1 K6 A
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★
    - f  c! N' N& @3 e/ k  O
  64. 6 n" Z/ _; L/ r9 G! X; E
  65. , Q$ F8 x, K2 L3 w( ?/ _
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示+ R; H: v% w5 q1 ^) b2 B  }, ^
  67. + h' H: c* ^8 F! l* c0 B
  68. #==============================================================================4 h8 D) G2 R, Z( C! o
  69. # ■ 常数设置 / D2 f3 o$ E: }8 |8 |  a! B
  70. #==============================================================================
    9 J" G$ G+ Z8 X! T4 \
  71. module KsOfSion2 |. @1 X8 z1 ~0 U$ D1 f& B/ T! K8 a
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false9 a4 S" J1 }9 @( d& D
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑% l1 ^5 k8 L$ h, Q, ]5 L3 Q1 r. l" |
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false! ^0 O" S% |# `' I( X
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量' p5 C9 D. |% U+ k, o
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处) p6 D# c$ x( ~1 G
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧
    . u* t2 I3 ?0 E8 R# o; G
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)
    ) ]+ V9 z0 \$ W: D: _
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键
    ; @: Q: F1 B: Q! S9 H
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)5 |8 h, [2 h7 X4 M5 H8 H* G  \
  81. end+ Z+ N, w" ]# ~5 {* @, j
  82. % W! b' M# Y4 L  Z
  83. #==============================================================================' T* S9 ]5 J" S; X
  84. # ■ 用来显示路径点的类& Z9 c3 ]8 R4 k& s. {0 s
  85. #==============================================================================; S3 a0 w2 v) t8 @6 N  q. P
  86. class Move_Sign  Game_Character7 [, {% X- q( M! Y- \
  87.   #--------------------------------------------------------------------------, y9 L1 H- t& B1 a: h+ C: l2 @
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图7 y; V+ h2 t3 Z& b+ R& V3 o
  89.   #--------------------------------------------------------------------------) x3 k6 i( A; R: P
  90.   def init_public_members9 C2 x% L7 R8 _5 Q
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹9 V6 C6 I) g4 K; j, T( D6 G
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    , K1 v3 e- _8 E* T) H, Z; A
  93.     @move_speed      = 5        # ★ 踏步速度
    0 s! o1 a7 D4 O! V- C# }
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    . N4 Z% ?' `/ i% w/ r$ Z
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度4 h6 n4 I$ |5 C# g# W
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)
    - P" ~8 l: n, Z& T0 P8 r
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列' d5 g& F5 X9 ^( k3 u
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)8 K& ?- q4 o* Q4 c& v5 y
  99. % p% @3 j9 V8 Z- p+ n( v' N7 p; G
  100. " I3 n* \  ]$ i0 D& ^
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    + X$ b0 K0 _- B7 e, j

  102. # Z4 y0 @! S; S8 a

  103.   b6 p3 K( l8 S
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图1 p, |. X3 m- }9 }( b$ [0 W
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')% v! T2 S* c4 M. [

  106. ( c# Z. ], `  n
  107.       if $no_arrowpic_warn) F6 |$ ]( s/ s( L
  108.         MouseShow_Cursor.call(1). n7 n2 r5 d* [, o- b+ h8 n8 T
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png6 q3 h1 M# W4 \  b4 M& ]; q& @

  110. 2 P( u$ ~1 {2 Y2 i
  111. “路径指示点”将使用游戏自带图片
    - D; U0 R. O  I: ^% O8 l0 |8 @
  112. , u4 h( A9 E8 O& @2 Q) F  K6 k
  113. 该提示可以在脚本内关闭')! \$ h) x$ k+ x7 n" h
  114.         MouseShow_Cursor.call(0): \6 p9 ?% y# b: r) }: @
  115.         $no_arrowpic_warn = false
    " f$ k7 n0 a6 U* q. q# G
  116.       end
    + J; A0 M/ Q  z8 f( {' R
  117.       @character_name  = '!Flame'
    3 A: \+ \, Z3 d$ v. M& ^7 {* c' L
  118.       @character_index = 6
    % ]/ F0 Q4 W% `; b
  119. 3 @! O! g& \. Y  O3 z! A' s
  120.     end
    ( @+ \0 x% v8 n$ P- q- C* _
  121.     @direction_fix = false  # 固定朝向/ B; M1 G" [1 U* t( M( f
  122.     @move_frequency = 6     # 移动频率
    0 Y2 Q% p3 {+ Z' A) {
  123.     @walk_anime = true      # 步行动画; X4 L; z; u. d9 A( R+ |8 ?0 R: ?
  124.     @pattern = 1            # 图案) h5 i3 C, g. N+ C
  125.     @through = true         # 穿透
    4 a, _8 L$ h$ r% q; ~
  126.     @bush_depth = 0         # 草木深度0 T1 G# x+ Z! ~
  127.     @animation_id = 0       # 动画 ID
    - k1 D" {* M7 a" _, K1 p
  128.     @balloon_id = 0         # 心情 ID
    ( ^) S- D  b1 J! U
  129.     @transparent = true     # 透明
    ) q- \" C+ f- |6 t, Y+ i
  130.     @id = 0
    7 k, S! I* u3 \' Y5 _. H8 s' ?
  131.     @x = 0& W$ w- c  V3 Z: P; q3 X; @% V
  132.     @y = 0
    2 P9 T: w- X" {( l
  133.     @real_x = 0# }* L1 O  p$ M5 B& A
  134.     @real_y = 0
    2 p9 R( j- D( d" N% G
  135.     @tile_id = 0' a- m3 C9 W7 N$ A0 p8 @
  136.   end
    4 x8 @  K- J7 p; Q( _
  137.   #--------------------------------------------------------------------------
    & ]$ f; a: k7 u( {0 T
  138.   # ● 定义实例变量
    ! }% C6 O  j0 \$ Y2 o  i/ B/ q
  139.   #--------------------------------------------------------------------------+ i# @9 a% U9 [# \
  140.   attr_accessor direction
    + m; [. _* ~2 e( v3 B
  141. end
    " I( w' K. }4 r6 n
  142. 6 z7 |: K! o. C1 u* E, i
  143. #==============================================================================
    # C2 s% N7 @9 R6 ]. N; x# G
  144. # ■ Module Mouse
    * R& v& Y4 H4 j5 q1 L& h' `' f
  145. #==============================================================================
    ! J2 y& U! v7 r! F
  146. module Mouse! Z9 G  v1 t8 C
  147.   #--------------------------------------------------------------------------2 J8 W1 G2 Z+ C" t+ c1 P
  148.   # ● API
    + D7 f: ?* W  j8 X# P' T
  149.   #--------------------------------------------------------------------------2 I1 r  _1 }" T) j7 o
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
    4 |: S( f/ {9 W# _
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')7 j) C% m8 d: w- Q3 ^$ ?5 E6 U
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')
    ' e- E, F4 @: N) z$ j& Q
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')+ J3 Z8 e, C5 I$ t. N
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    , h* Q6 ^9 q2 O3 s& O* H* o4 S
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')# i; y. ?/ m0 U' W+ K5 O
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')
    7 ~! F8 C- t+ G7 ~0 P
  157.   Window_Hwnd       = Get_Active_Window.call" U6 ?8 I' S& s+ W' J3 Q

  158. : W$ D( q* g* A0 {) P0 j
  159. class  self
    3 d, a4 O: ^# ]& i
  160.   #--------------------------------------------------------------------------- m, J; O1 ~2 Z
  161.   # ● 初始化& }9 B+ ~" o5 |: p. H4 C8 l
  162.   #--------------------------------------------------------------------------; C0 U5 i) C! k9 O
  163.   def init
    5 v& P( \. o( [) M
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor& M. |2 i" f, M: J* U
  165.     @left_state = 06 [6 E- ?4 m3 a+ i
  166.     @right_state = 03 P$ a. @0 D/ e! S2 I: {
  167.     @ck_count = 0 # 帧数计,单击以后从0开始, f5 z* g$ U( v! Z
  168.     @dk_count = 0 # 用于双击的判定
    4 X$ ]3 O* c3 M+ g
  169.     @clicked = false; ~1 L. ^* H; L
  170.     creat_mouse_sprite
    7 ^# Q% D9 _$ n% e( J9 V
  171.     update
    % ~8 H" f6 T+ `% m
  172.   end
      a$ q7 D, a% {( ^. {
  173.   #--------------------------------------------------------------------------
    * l2 l  S5 e: p( j- u
  174.   # ● 鼠标指针精灵
    % f2 N! k6 q7 P9 f8 b4 }7 Y. z. T
  175.   #--------------------------------------------------------------------------$ w8 r& z* I# Z! [3 k/ R+ d; f
  176. #~   def creat_mouse_sprite
    ( N2 U$ ^* j9 _0 h# `& ?
  177. #~     
    9 z0 |% \  r* m+ a- V% J% O
  178. #~       @mouse_sprite = Sprite.new
    8 ^" }6 n2 K/ J# j! A! M
  179. #~       panda = 2#rand(2)+1! t: A" f7 n. F
  180. / l& Y1 O6 d* ]7 d  W' B7 u' U
  181. #~      if panda = 1; H/ Z6 b7 E& \  c  |
  182. #~        if File.exist('GraphicsSystemCursor2.png')( C. L8 n% p  g) l2 q
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    " I' k7 d5 D* b1 u/ x( C9 L
  184. #~        end#with if File.exist
    ) Q- k' M4 q- t+ Q. C
  185. #~    " I( Z9 c) Z- D) W
  186. #~     else if panda = 2 #with if panda=1
    " R7 ?0 I  v4 A$ B/ D, V) O, m
  187. #~        E! u5 O3 z, z8 {/ k
  188. #~      if File.exist('GraphicsSystemCursor2.png')- L4 W$ p: ~4 h0 i
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')  q4 o. j4 W: }" Y7 Z
  190. #~      end#with if File.exist! q3 g% p) w3 a- ~# _
  191. #~      
    & B8 T/ o# n8 G! v8 D
  192. #~     else #with if panda=1$ Q, l# P8 \5 [9 V6 c5 ~
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    8 v5 O  t% A. k  B" h/ \
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),5 B, W/ N  i" M! t% t
  195. #~       Rect.new(5  24, 24  24, 24, 24))1 p: @' b/ ]' \* b! |: s
  196. #~     end#with if panda=1
      N5 E. ?7 V; o' ^4 D" B
  197. #~     ) Z- D9 [* W+ m8 O8 {) M
  198. #~     #with def3 [0 l8 ^  p( a6 U% `- ~  N0 U
  199. #~   end& W' D7 A" |+ U7 T
  200. def creat_mouse_sprite# J0 |8 t+ u5 }) Y% Y( ?( j
  201.     @mouse_sprite = Sprite.new
    5 N+ U3 @$ V0 V4 W) k# i( q$ N
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})
    / _1 |' i9 f+ ]
  203.     @mouse_sprite.z = 99992 E. W* m5 c! l( y% J5 L6 P4 U' |; O
  204.     Show_Cursor.call(0)+ d$ a& Z  V0 k6 @
  205. end
    + r  E$ {% f! _4 T8 m3 v8 i  Q0 \  H6 m

  206. 2 k! R7 z' o0 ]- e  n- E
  207.   #--------------------------------------------------------------------------
    % S7 a* v# Y2 A) p4 J+ b+ o
  208.   # ● 更新4 ]# f( c9 @% d' y. X
  209.   #--------------------------------------------------------------------------
    5 S8 B# ?* N" a+ Z( }
  210.   def update3 X  W4 I, y5 F
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos
    9 E4 \5 Q, n9 j! o0 j3 t# l! w
  212.     left_state  = Get_Key_State.call(0x01). V; r: ~3 s8 L4 H( E" c7 C
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0
    ' G" h8 ]; a# F% A
  214.     right_state = Get_Key_State.call(0x02)) a* F$ U, n. o: H8 R/ u
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0
    $ I8 L; U/ g% _; Q
  216.     update_double_click7 M- H) X$ m" k% ]+ j9 p3 `
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1
    $ Q. m; l- X2 [1 ^) b
  218.   end  D  r; D/ C  f: g5 b% G# o
  219.   #--------------------------------------------------------------------------
      Q& G" o/ b' X* h
  220.   # ● 获取鼠标坐标
    $ y7 v! f$ [: J, E+ A
  221.   #--------------------------------------------------------------------------
    , u% C/ P# k. O4 R6 \
  222.   def get_mouse_pos* S5 c0 \) r9 z
  223.     arg = [0, 0].pack('ll')
      [/ f) G- [6 E6 U
  224.     Get_Cursor_Pos.call(arg): X% `1 [3 W8 [7 |6 l4 p
  225.     Screen_To_Client.call(Window_Hwnd, arg)
    & X+ Z5 ?5 [/ e, }  k
  226.     x, y = arg.unpack('ll')
    9 U( E$ f# [1 S" _% B/ s3 G  s
  227.     return x, y
    4 H9 A+ T+ b: T" |7 s2 D
  228.   end
    / d( r) y# A' L" O* v: H
  229.   #--------------------------------------------------------------------------/ k. h4 P* F7 O+ g. N' m7 w* X6 T& T
  230.   # ● 将鼠标固定在屏幕内9 ~9 @5 q5 h* h3 G: z' _! j6 H
  231.   #--------------------------------------------------------------------------
    , }0 s1 ?: L+ c  r& {) Q$ ]
  232.   def lock_mouse_in_screen- Y- \! V) B1 ^+ g/ z! b
  233.     arg = [0, 0].pack('ll')
    ! m  n  m5 N7 ]& @% j0 n6 p
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    - P3 n) C+ r: S* V* p* s: s- S
  235.     x, y  = arg.unpack('ll')
    1 }$ w9 P( I4 F) m3 y7 v( N; a
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))8 B8 ~( A9 z+ d+ o5 m, S
  237.   end
    5 v9 D( y4 j+ L: V
  238.   #--------------------------------------------------------------------------
    5 Y" q2 j% Y0 V% K/ J1 h) g$ P
  239.   # ● 解除鼠标固定& @. H$ V. S+ c4 D. O6 m% g8 a
  240.   #--------------------------------------------------------------------------5 d& u) ?; ?6 a" Q
  241.   def unlock_mouse_in_screen
    7 P+ m$ ]' Q1 \' q
  242.     Clip_Cursor.call(0)
    4 A! b  H7 ^! G  n
  243.   end
    7 u- a! ^( `% Q$ u$ |
  244.   #--------------------------------------------------------------------------
    ( r7 Q! j7 M" d1 F+ ?
  245.   # ● 鼠标双击判定
    2 P4 u3 x$ S) Q& a5 J2 M- U: p
  246.   #--------------------------------------------------------------------------
    . ]/ Q) L" U  T- P5 [' N& I
  247.   def update_double_click4 y7 \) z  \8 G! W+ J
  248.     @clicked = true if @left_state == 1
    8 R" t. U/ v' f% x
  249.     if @dk_count  0 && @left_state == 1
    5 z8 F9 r5 l* q- @/ \& W8 `
  250.       @dk_count = 0; @clicked = false/ O5 c0 v; v  _; U
  251.       return @double_click = true9 O2 z3 t6 l; r
  252.     elsif @clicked
    * i2 S$ q$ `* R$ n% L$ U- }7 y; d
  253.       if @dk_count  KsOfSionDbclick_Frame
    2 X) P  R6 A& P4 f( L! S" Q7 a
  254.         @dk_count += 19 I0 R9 V4 w+ B, ]5 w! f$ _4 A
  255.       else4 Q% u3 u6 T7 p9 j. f' i
  256.         @dk_count = 0; @clicked = false2 u) J- a0 g, |& L
  257.       end
    8 h/ p3 k' U+ z
  258.     end
    $ O- S% }: r9 r1 J# t% K
  259.     @double_click = false
    2 T9 x$ ]' }' U8 Q. y
  260.   end0 d5 ?! k3 ?6 o7 }
  261.   #--------------------------------------------------------------------------
    ( B8 i* y5 j6 \# T8 U& z
  262.   # ● 按键被按下就返回true
    8 F0 U! i, F0 s6 Y0 o. J. R
  263.   #--------------------------------------------------------------------------
    2 Y9 P4 p; V% v
  264.   def press(button)
      C# W: q; A0 u
  265.     case button  B& N; [" I4 v7 \8 Z6 a, G
  266.       when 0x01; return !@left_state.zero
    & C! F% {" n% r7 b; w' X! _
  267.       when 0x02; return !@right_state.zero% \$ [& ?: ~( s  n2 s3 O
  268.     end
    / @; u* t3 t7 t0 K0 E( Y  k
  269.     return false3 `- o" J; [7 M
  270.   end( ?: o# c0 e5 @# i( n$ D
  271.   #--------------------------------------------------------------------------' p/ ~) Q+ n3 l# Y
  272.   # ● 按键刚被按下则返回true( e6 T: q" H: t5 d4 l
  273.   #--------------------------------------------------------------------------
    ! y4 b( M1 p2 ?4 e6 H, l
  274.   def trigger(button)
    ! S! O  V: ]! ]1 j% u
  275.     case button
    ( {/ H- ^/ }/ ]' r% K/ }0 k' Q: z
  276.       when 0x01; return @left_state == 1
      X" s0 b% X3 Z; ^/ Q8 L4 k4 }. S
  277.       when 0x02; return @right_state == 17 V/ _4 I7 j9 V8 k. I+ r; D% {
  278.     end+ p: y, U" K! n4 ?# e8 R
  279.     return false: W! g9 L8 G9 H- y& d: G
  280.   end
    . A5 n* e/ U: r# x6 _3 `3 S
  281.   #--------------------------------------------------------------------------
    * d! ^! R2 B1 }: q4 p; \3 }
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true, ?) N* z9 {! b/ W4 j/ L8 F
  283.   #--------------------------------------------------------------------------
    3 ?9 U% f3 F* V
  284.   def repeat(button)
    ( W) W# B; E9 `5 f; `" ]
  285.     case button
    ) w3 g0 S6 v2 p$ F4 W  G% G
  286.       when 0x01; return @left_state == 1 $ w# ]* z/ T4 |4 d
  287.         (@left_state  22 && (@left_state % 6).zero)
    9 f. _. B+ m8 ?, E5 q( v
  288.       when 0x02; return @right_state == 1
    9 U6 `- {/ \% x
  289.         (@right_state  22 && (@right_state % 6).zero)
    5 `: M' X& f. N% Z
  290.     end
    $ T2 ^2 j8 q; A. ]
  291.     return false
      M4 u5 X  t% C  M0 Q  ?
  292.   end* P" Y. `- H" s$ i0 {# z; z
  293.   #--------------------------------------------------------------------------! [8 x2 O( U) b2 t) S% r. ]+ `, q
  294.   # ● 判断是否双击鼠标1 v% \- K% ~3 f) ?, f! _: a3 f" I
  295.   #--------------------------------------------------------------------------0 N- v& U4 x! C% R+ ^
  296.   def double_click& K0 F) M4 [( K6 N- U5 C
  297.     @double_click
    8 U/ w9 O" e8 P  [
  298.   end
    ' n1 U3 {" ?* }" W- p& k
  299.   #--------------------------------------------------------------------------% V7 e/ c: N9 B1 P9 Y; n2 V+ r3 }+ i
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)) s3 N1 a/ z& `% A! k. r8 I
  301.   #--------------------------------------------------------------------------1 g9 v; f. ~( I4 u
  302.   def click_count
    ; n: H+ _: F7 h2 h; F- M$ ?5 Q
  303.     @ck_count5 t1 l3 J, F4 U/ {
  304.   end
    - ]6 s1 M6 Q3 K. t% H4 g
  305.   #--------------------------------------------------------------------------" z( ~/ h4 m, o/ w; P- I
  306.   # ● 获取@left_state(按住左键每一帧+=1)1 f$ ~( L1 h7 H1 l& m
  307.   #--------------------------------------------------------------------------
    4 Q% \) d7 a4 K' W
  308.   def left_state, ]9 n' v. O: |5 s4 F5 s0 b
  309.     @left_state
    $ Y: Y6 @! i5 L+ l0 L4 H. S9 R: |
  310.   end% H3 s$ J# [( a" E  D/ T9 C0 Q
  311.   #--------------------------------------------------------------------------+ a1 ]! X- ?! }; Z: _* U% B4 |
  312.   # ● 获取鼠标的x坐标  }0 P" a( O4 [" [& K2 s) ]" e
  313.   #--------------------------------------------------------------------------
    " P& m  \& T$ V2 x
  314.   def mouse_x
    4 E. Z( M- C  e# N+ u
  315.     @mouse_sprite.x
    / M& T# k9 W7 X
  316.   end
    # G2 {$ a# u5 ?" E. ]
  317.   #--------------------------------------------------------------------------" x5 T7 r) d8 d7 {
  318.   # ● 获取鼠标的y坐标; r9 U4 A7 Z7 X+ Z1 M3 b' y
  319.   #--------------------------------------------------------------------------
      O3 x4 C% E1 @) x" y
  320.   def mouse_y
    ! q6 h6 [% e( E* \
  321.     @mouse_sprite.y
    1 g4 H. e* P4 t
  322.   end
    - y- M5 W  H: P6 a6 F' \, `6 ^
  323.   #--------------------------------------------------------------------------* R; w; q1 i. H/ L& k. Q
  324.   # ● 设置鼠标坐标2 [; d5 \0 \& c7 l) j% Z% T/ a
  325.   #--------------------------------------------------------------------------' S9 a( ?* K) n. E" x# Y/ E5 \
  326.   def set_mouse_pos(new_x, new_y)
    ( g% \. v5 ]7 p+ m( ?7 m' I% Z+ {
  327.     arg = [0, 0].pack('ll')
    ' R8 N# @/ u' r. z6 W; [% A
  328.     Screen_To_Client.call(Window_Hwnd, arg)
    5 S  K$ \& M7 [6 Y
  329.     x, y  = arg.unpack('ll')
    " ]; I, U$ I* ]+ U: X$ n7 O
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    $ }8 j2 q+ ]. u$ A
  331.   end: @5 G( |8 K, f1 h) h  P
  332. end #end of class  self 6 M& L( {! V" D: ?/ p4 y1 ^

  333. 7 c2 l# }+ L# F- [& b( `) [: J
  334. end
    ( d8 X0 K0 O( I

  335. 1 ~# L& R6 x8 y: c
  336. #==============================================================================
    % m: L( m+ G5 a  A) Z
  337. # ■ SceneManager+ @5 [* A* x6 A6 d% t! W: E
  338. #==============================================================================
    6 H: f  O. p; h7 p+ \  A& R2 Z
  339. class  SceneManager+ s4 p1 k. x- d6 `" m
  340.   #--------------------------------------------------------------------------
    ! F- F4 l8 r4 F; O& f! k6 i, t, T
  341.   # ● alias
    3 K6 z+ `  s/ I: t
  342.   #--------------------------------------------------------------------------+ r5 o3 h0 {# Z6 m+ B
  343.   unless self.method_defined(sion_mouse_run)
    7 j- @5 q; w3 j9 O- M- Z
  344.     alias_method sion_mouse_run, run
    7 F8 u: n7 _' |4 ~4 ?$ d' H
  345.     alias_method sion_mouse_call, call
    9 @. u# R( P- [
  346.     alias_method sion_mouse_return, return) n+ T# _7 n5 `+ K: A7 u
  347.   end6 ]; R2 k( R2 U- s% `$ `# j
  348.   #--------------------------------------------------------------------------
    0 z- p  M) g6 }5 A. [
  349.   # ● 运行
    ! T3 u7 C/ J* z2 E( J2 Z6 f( z1 E. l, t
  350.   #--------------------------------------------------------------------------) g3 g) E) }" L* \1 C1 T" ~  O
  351.   def run$ P. _. O8 |0 G' Z, A
  352.     Mouse.init' W5 `8 v$ X9 ^, a9 g+ @  {
  353.     sion_mouse_run' {' k7 i' I1 k& g. k  _7 @
  354.   end
    $ s  i" }( J8 g
  355.   #--------------------------------------------------------------------------
    8 _& l* x7 y- ^% v# K. y
  356.   # ● 切换% r: {0 b8 r3 u+ A! {  y2 C  B8 p
  357.   #--------------------------------------------------------------------------" i, J9 B4 B$ o7 M: K% O9 N
  358.   def call(scene_class)
      _2 _' I* E. s8 i
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)" o& {  {$ h+ l6 h. B/ C) X! ~
  360.     sion_mouse_call(scene_class)1 p' W% l' F2 e+ N
  361.   end' q) `- _( e7 N: i, `2 U
  362.   #--------------------------------------------------------------------------- N; D& b5 P4 `, h
  363.   # ● 返回到上一个场景; Y# B' W3 Q" r+ V
  364.   #--------------------------------------------------------------------------" o( V6 A2 w2 K1 ]/ n2 S
  365.   def return
    7 p+ I0 k. b+ n9 x0 t
  366.     sion_mouse_return
    7 }' X1 R4 c) }4 b
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&8 C' @# O; E& Q9 B" z6 @; h
  368.       @scene.instance_of(Scene_Map)
    ( M* z# F' L3 w, c/ x0 J
  369.   end+ {  e- E# p- w# u% B- j
  370. end, j1 @1 |9 b8 _. \# n1 G
  371. 0 X7 D; o- [7 U3 {) D) I/ |
  372. #==============================================================================7 P8 M, a7 A) x8 `7 K4 u
  373. # ■ Module Input
    ; `: a4 N6 A8 o3 |* D5 k
  374. #==============================================================================2 `6 U6 S9 o! t; G. z
  375. class  Input! l) p& e3 D& {  i/ g7 J0 W
  376.   #--------------------------------------------------------------------------
    ! y# g) W" X4 O5 J0 `
  377.   # ● alias
    ( R/ o! U/ E% Z' V, n8 c. q
  378.   #--------------------------------------------------------------------------
    1 \% B( g5 h3 x/ ^  _: D
  379.   unless self.method_defined(sion_mouse_update): ^( z1 v% l6 Y; \6 r
  380.     alias_method sion_mouse_update,   update! t4 ~9 _( V0 K3 U4 {) T" P
  381.     alias_method sion_mouse_press,   press% J  O" d7 l& y$ _" j" }/ {" [
  382.     alias_method sion_mouse_trigger, trigger
    + ]" F) [+ t. y# X" _: k
  383.     alias_method sion_mouse_repeat,  repeat3 v$ e% ~5 F2 e! _4 b
  384.   end8 H( K& u8 z3 c, Y1 |! p
  385.   #--------------------------------------------------------------------------
    / s' w8 @; x% o5 A/ A: u# C
  386.   # ● 更新鼠标9 `" z6 _0 c  N- h: ^; _
  387.   #--------------------------------------------------------------------------" q+ h) g! b& Q, B
  388.   def update9 D% A  @9 {, x- Y4 \# b) O
  389.     Mouse.update6 x( d& t1 x! M' A2 L! d
  390.     sion_mouse_update" q2 u* M7 X) Q% S7 y0 N: @
  391.   end
    * r" E2 v& r8 `- y; d9 v
  392.   #--------------------------------------------------------------------------
    / b  S  y* S8 _7 \# y2 a: q5 `
  393.   # ● 按键被按下就返回true
    : ?: S3 ]5 K8 H+ @
  394.   #--------------------------------------------------------------------------: s* h/ W$ [% U4 F! r
  395.   def press(key)
    % ^9 y8 C8 K& K- K/ E/ p: [
  396.     return true if sion_mouse_press(key)9 ~  d: g1 \: M  K
  397.     return Mouse.press(0x01) if key == C
    - e% q  x' E* M/ _  P
  398.     return Mouse.press(0x02) if key == B. Z( q2 C5 m( @5 f% _6 \4 m
  399.     return false
    - O3 A0 M4 C# V! o% j$ B6 ?$ J, S
  400.   end0 w1 J$ F) D. J! I* F, F  Y
  401.   #--------------------------------------------------------------------------
    % d# a! E  T% o: J( S  B1 C
  402.   # ● 按键刚被按下则返回true
    2 q; q% m3 m$ ~# i& |
  403.   #--------------------------------------------------------------------------
    ' {! `& h4 F+ U; n' v* `
  404.   def trigger(key)9 W$ @0 w; n8 \  a* Y) w
  405.     return true if sion_mouse_trigger(key)
      w/ `$ ]7 a% i) ]' c
  406.     return Mouse.trigger(0x01) if key == C
    ! L& o" J8 e! H! |% C2 f  c
  407.     return Mouse.trigger(0x02) if key == B
    7 Z5 x+ f7 x8 J% J; L/ r* v
  408.     return false
    8 L- g9 S4 L  y) h7 Z
  409.   end. J8 Y" k  Z# j9 M  @' Y
  410.   #--------------------------------------------------------------------------
    $ s) p/ w) H; z
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    5 f2 e4 p) V0 _5 |: F
  412.   #--------------------------------------------------------------------------
    % m8 V' d+ M/ |, {
  413.   def repeat(key)
    $ b+ Z9 k, g$ \% D; Z, m" n5 N1 A7 h
  414.     return true if sion_mouse_repeat(key)( L% b% r' ?  q. ?2 Q: T
  415.     return Mouse.repeat(0x01) if key == C
    ( Q* K$ T' F) T2 G1 y. V& g5 R
  416.     return Mouse.repeat(0x02) if key == B1 n1 o& N& M- t5 e! b
  417.     return false# i$ ^8 e# b4 h# x
  418.   end& w2 x. S6 e6 U& Q
  419. end7 a! g! t" h3 p

  420. ( b1 m. A* h1 a! ?, ~0 r  m

  421. , w, Z6 @1 ~0 \
  422. #==============================================================================
    " z& M0 G7 g; M. b
  423. # ■ Window_Selectable- |9 j4 ~' z7 ~, r; _
  424. #------------------------------------------------------------------------------
    1 {! ^7 ?) `0 u7 h3 A1 K5 ^
  425. #  拥有光标移动、滚动功能的窗口
    ; a( b* R5 T& f; t/ J0 h
  426. #==============================================================================
    " A( ^0 G; }0 X) X/ f
  427. class Window_Selectable# ^0 C  E+ {, v7 L" D7 |5 q5 k5 w
  428.   #--------------------------------------------------------------------------( l2 ~% i4 S7 a
  429.   # ● 初始化3 I/ s8 _% |; S+ H
  430.   #--------------------------------------------------------------------------( l1 m6 B6 M: q' w2 B
  431.   alias sion_mouse_initialize initialize
    : S9 M2 z1 ^' I: R& \
  432.   def initialize(x, y, width, height)
    ! Z3 T2 s8 @+ N" W; v" A* c  s/ Q
  433.     sion_mouse_initialize(x, y, width, height)0 Z9 b5 m7 C; s  c. ^
  434.     @move_state = 0
    . ?8 V" P0 t, [9 g( g. _* D
  435.   end" z4 u8 ]& W0 g0 [" T
  436.   #--------------------------------------------------------------------------
    4 E; k  q' e( N
  437.   # ● 更新
    3 G( @' t9 m+ W' D  J1 f, k2 y% J
  438.   #--------------------------------------------------------------------------1 Q5 i1 i! D; b0 x: I9 z
  439.   alias sion_mouse_update update
    + Y" z$ L/ W) s7 R
  440.   def update
    " c  M+ n6 L: u
  441.     sion_mouse_update
    2 q& Z; L7 S, q. ]* D
  442.     update_mouse_cursor7 s- p2 m8 _, g: ~+ J* T. J
  443.   end
    $ F: v! o4 p, g+ u) Y2 ?
  444.   #--------------------------------------------------------------------------
    . ]/ u) J9 V: w1 ~
  445.   # ● 启动后设置鼠标到index位置
      ^& c! d! u; u% ~! ^# k, |
  446.   #--------------------------------------------------------------------------' ^3 c. n; Q5 p  o. _
  447.   def activate
    ; z; d. N1 N5 s% {# I0 B" O
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos! Q4 d" g5 g( F5 q; `2 j9 L( K/ Z
  449.     super
    4 @& p% R3 j7 J0 R
  450.   end
    - E4 d& T7 q1 e1 C( i( u
  451.   #--------------------------------------------------------------------------% ~: Z0 B/ c; b; F9 N( a" ?
  452.   # ● 更新鼠标和光标的位置0 t+ r, q! h/ X3 p6 f
  453.   #--------------------------------------------------------------------------* m9 y5 u2 l' a: E3 v1 y
  454.   def update_mouse_cursor7 @  {; X! m+ ^- T: s
  455.     if active+ J# m7 i) d1 Q$ I" B; ?
  456.       if @need_set_pos# v  i; ?9 O7 _1 f' r+ `' K
  457.         @need_set_pos = nil0 k3 D: f5 {% u% x  U, E& N
  458.         set_mouse_pos' h6 K) D! R+ G- Z- b& W
  459.       elsif cursor_movable
    6 ]# j4 s$ V; N/ Y2 y  U
  460.         Input.dir4.zero  set_cursor  set_mouse_pos* `# ]- y6 k; C$ `! ?  j2 \
  461.       end' s; A! w5 I4 p8 ~( G- G2 B) x
  462.     end0 B* S7 k6 Y- g7 @6 r* @, P: K
  463.   end
      K- F4 h4 T7 |; U4 T
  464.   #--------------------------------------------------------------------------* S& _) D  l5 p4 P; J4 x* Q1 j
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能6 ?) m8 l: h3 c- J% b* a, S. i% t% I  O
  466.   #--------------------------------------------------------------------------
    ( S& k- @7 e& I$ n+ K2 ?. P. y% M
  467.   def set_cursor
    ; {2 d2 U: x9 W" s0 R5 s. X
  468.     mouse_row, mouse_col = mouse_window_area
    % {* e3 q8 g9 w& e
  469.     if    mouse_row == -1
    0 e% {3 S: |0 z* ~2 }- G8 l: \
  470.       @move_state += 1 if need_scroll
    ( A" [  Q9 K6 j# y
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand) n1 D4 [& r8 Y6 A  K0 D
  472.     elsif mouse_row == -2
    - M- r: R# d- v. I% G
  473.       @move_state += 1 if need_scroll
    9 ~! @7 A. {& Y  Y' r. G! x" G
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    9 }( L- Y+ M7 d# p
  475.     elsif mouse_col == -15 ?( R# V' N4 ?, k/ w/ J
  476.       @move_state += 1 if need_scroll- V$ T+ Z: o+ j& _
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand- e8 T% u2 K; j3 z* R6 H6 m( K
  478.     elsif mouse_col == -2' w+ h9 V8 |" \- C, J, b* A
  479.       @move_state += 1 if need_scroll0 q) S: e  w3 m; g& W! C
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
      [1 R/ Y1 y! }5 j) n6 g/ @7 w
  481.     else6 F: p6 q7 T4 E1 ?2 K" t
  482.       @move_state = 0
    % }/ r; q4 j1 a# t
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col1 S+ L/ y3 O1 `- v7 v2 ]4 ?' L1 |
  484.       select(new_index) if new_index  item_max && new_index != @index) B# L+ Z1 R7 d' v. ^0 T
  485.     end2 I* v: a' A9 ]- T2 B( u
  486.   end4 }; p( X; b+ S* n6 ^/ O
  487.   #--------------------------------------------------------------------------) f/ k4 l( T( i% Y: O, ~5 j
  488.   # ● 判断鼠标位于菜单的第几行、第几列5 l" x% y% @( \& h/ `3 w7 H% w! h
  489.   #--------------------------------------------------------------------------
    4 n: S& Y8 q, J2 ]5 ]9 A
  490.   def mouse_window_area6 {9 y7 u( h; [. t) i! u
  491.     if viewport.nil # necessary!' E5 [) @# m9 O8 D# a+ X$ k1 x/ \
  492.       vp_x, vp_y = 0, 0
    . t$ N$ k/ I; ]
  493.     else
    5 d! r' d3 A0 q
  494.       vp_x = viewport.rect.x - viewport.ox
    8 i  {% H! _; K/ E. u
  495.       vp_y = viewport.rect.y - viewport.oy
    * |8 S  s$ x  ^  ]3 G! U
  496.     end* b1 {2 W' s- }+ O3 K' H+ f
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    4 {' n9 c" M' k2 U3 L% w
  498.     item_x1 = vp_x + x + standard_padding % O) j6 D  S- H% F/ c
  499.     item_y1 = vp_y + y + standard_padding
    % [6 x7 ?& o/ h2 |- U
  500.     item_x2 = vp_x + x - standard_padding + width  L$ o. y9 u, o6 x  O. q* s
  501.     item_y2 = vp_y + y - standard_padding + height5 L! q: c; J5 R, @
  502.     if mouse_x  item_x1
    $ ?; h0 K8 _; S3 k  N
  503.       mouse_col = -1& Q2 R/ m' S) n9 j6 L
  504.     elsif mouse_x  item_x20 g. V; q7 i* e5 B- R9 r
  505.       mouse_col = -20 ~% V: @0 G! `  }+ U, E
  506.     else. ^7 T* M9 ^+ X( |. o
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)
    2 W4 R! e% U: K1 r6 v& o+ u$ w
  508.     end6 H7 @5 p3 \1 Z8 @4 [+ m# g
  509.     if mouse_y  item_y1
    - N' @6 k) g9 F3 v  d$ w* H: G
  510.       mouse_row = -12 {+ k: R( X1 k3 _
  511.     elsif mouse_y  item_y2
    + ]9 a. i9 h. S4 {& }
  512.       mouse_row = -2
    6 J5 D7 T1 o) N5 R  P
  513.     else; B9 e, S0 I' \
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1), d" x! e( B$ T8 p9 q( r8 B0 Y
  515.     end
    + m+ g" x  q( R( m' F) {
  516.     return mouse_row, mouse_col$ d( c1 q' z3 g* c9 W2 d, z
  517.   end
    ' y0 X) n( O' T) G5 a6 B5 W5 N8 Q
  518.   #--------------------------------------------------------------------------
    . B, y8 s& \  `" Y
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    : g( J4 D* D# h* V4 K
  520.   #--------------------------------------------------------------------------
      n$ }0 G5 |/ C' W) m* O5 s
  521.   def set_mouse_pos
    7 E9 R! n" b9 q; p! \( R: b% ]
  522.     if viewport.nil # necessary!
    9 y/ W4 n2 }4 ~5 l+ h9 {
  523.       vp_x, vp_y = 0, 08 `6 q  q  m) c. w! Y; k% _8 d
  524.     else+ R$ ]$ l" ~2 ]) ]; c* r
  525.       vp_x = viewport.rect.x - viewport.ox
    , T5 e  x' s0 H* F( \, G
  526.       vp_y = viewport.rect.y - viewport.oy/ q0 f: s* n, R( L6 Y: V7 z' q5 G- ]4 M
  527.     end* G: v7 x9 B5 ^: I* R; l
  528.     item_x1 = vp_x + x + standard_padding
    % U- G6 ]! T# F+ }# p1 D8 z# j
  529.     item_y1 = vp_y + y + standard_padding
    0 v" B+ N/ U$ L% {
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
    : U. @! C& G. `5 k+ V3 w1 i) M
  531.     row = get_index  col_max - top_row
    ' n: B$ G; d- @! x8 c
  532.     col = get_index % col_max" _, S( r: i; p1 K8 t5 i9 j
  533.     new_x = item_x1 + item_width  (col + 0.5)# C" h$ }& }+ A5 A  k. I
  534.     new_y = item_y1 + item_height  (row + 0.5)
    2 K# B( d3 t6 K  v' O; z0 c  K( y- U
  535.     Mouse.set_mouse_pos(new_x, new_y)
    ) `. l! C4 g+ j8 B5 v
  536.   end
    , E. X  G- s. g0 l: W2 s
  537.   #--------------------------------------------------------------------------
    6 Q0 o+ z, a# ^: J5 V- j/ m2 ]7 e
  538.   # ● 判断菜单是否需要卷动, f/ a* P1 }6 [
  539.   #--------------------------------------------------------------------------! C# b. t5 d* w3 F
  540.   def need_scroll
    2 z. c2 x5 L( p
  541.     item_max  col_max  page_row_max
    / T" {3 ?( u: B5 h( ^& |
  542.   end5 r# A8 e3 a) D7 B/ p
  543.   #--------------------------------------------------------------------------( N8 L& a8 u! \: b
  544.   # ● 判断是否为水平卷动菜单
    4 T& u. r' T$ f/ c2 a; X% f' r
  545.   #--------------------------------------------------------------------------
      V" |0 I0 U: ~3 H9 N* H3 u2 S
  546.   def is_horzcommand( A' f& W& Q1 S
  547.     return false
    4 _. }' J( n8 _; D5 ]4 F
  548.   end& a; F, u/ e2 w/ @% k
  549. end- W( o9 s- M' P# l
  550. " c7 |$ @* x$ o9 w3 z
  551. class Window_HorzCommand
    1 V; F# P1 k  O
  552.   #--------------------------------------------------------------------------, T& ~8 p0 @  T7 E! G5 d. l
  553.   # ● 判断是否为水平卷动菜单4 K5 C5 u+ [) T
  554.   #--------------------------------------------------------------------------* v4 U2 `1 P, @% a2 ?
  555.   def is_horzcommand
    , g2 [+ m1 P4 k9 ~8 J, e8 T! e$ C0 @
  556.     return true3 d/ @1 |) t* v+ O6 U
  557.   end0 D' ?5 P$ e. U8 O/ x
  558. end; j1 z( ~/ y! o7 U
  559. $ A; ^$ e% B, q' O$ R! D4 N' v
  560. #==============================================================================( ~) m8 W* q% B& c5 S; Q; \
  561. # ■ Window_NameInput, s- R& q1 v. }# E( y% S
  562. #------------------------------------------------------------------------------: @7 [0 y1 j- D+ w
  563. #  名字输入画面中,选择文字的窗口。/ d) Y; p/ J+ P
  564. #==============================================================================
    $ w; c8 g  \& b8 ?3 r& M
  565. class Window_NameInput" E; x+ q% n# H$ H  [2 i4 k
  566.   #--------------------------------------------------------------------------- @& R+ _- J* ?- `( D2 u
  567.   # ● 设置列数
    , P1 g' U6 A% j: F0 W! Y
  568.   #--------------------------------------------------------------------------7 D$ E8 M- F& H" y' z+ p
  569.   def col_max+ n" c* M9 x9 e, ~' d4 ^: _- E
  570.     return 10
    - F# \" l3 s2 `0 \
  571.   end
    0 ]4 b( t9 f, q3 ]/ |
  572.   #--------------------------------------------------------------------------
    : M2 d5 E' h4 |3 d1 s0 B% h
  573.   # ● 设置填充的Item个数5 c$ m5 N  M7 t( @
  574.   #--------------------------------------------------------------------------
    8 t1 m( D2 I6 M7 G. P0 _, T* F
  575.   def item_max
    ) x8 l% i( v: q2 X- _  K: Y
  576.     return 908 d9 H3 V( B  ^- `! Z* ~
  577.   end
    8 i4 I6 j$ t( f- a
  578.   #--------------------------------------------------------------------------  T+ I2 Y2 _! Y0 h. g
  579.   # ● 设置填充的Item个数. N4 v% @& {9 Y6 C
  580.   #--------------------------------------------------------------------------
    ' v. h1 @- L% D6 W2 O, D
  581.   def item_width2 |! |) c2 d7 n; N8 g* A* R/ B- _
  582.     return 321 D! s0 W3 o* q
  583.   end* ~" Z' s* H* u) O: Q9 f4 O
  584.   #--------------------------------------------------------------------------
    ( _2 n7 W- n7 I6 o; f% ^
  585.   # ● 判断鼠标位于菜单的第几行、第几列. C# U; ~( k7 _0 ~/ F, u! G
  586.   #--------------------------------------------------------------------------1 ^( k8 q% e4 N, p2 z6 S7 F
  587.   def mouse_window_area7 K$ ?9 u# H# _7 S; `
  588.     if viewport.nil
    , ]* b8 [2 w/ f. Y* {
  589.       vp_x, vp_y = 0, 0# d5 g1 z9 U) w. q: q' g
  590.     else
    , K6 f1 e; h, C2 G- K& p+ t9 e
  591.       vp_x = viewport.rect.x - viewport.ox1 _1 W- Y! C: ]' s' r' [
  592.       vp_y = viewport.rect.y - viewport.oy
    . N% Z/ Z  V! d/ J$ c  M* {
  593.     end* _4 g* p# i( [8 D8 q5 Z2 f: t
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y, t$ k; X$ m0 b
  595.     item_x1 = vp_x + x + standard_padding # f% [* R4 {3 I. ?+ _3 F3 [# ]
  596.     item_y1 = vp_y + y + standard_padding% h) e: {, M4 }( ?. X
  597.     item_x2 = vp_x + x - standard_padding + width+ K: a% b3 K% h* c! c
  598.     item_y2 = vp_y + y - standard_padding + height
      h. L. T1 e/ c& R5 h
  599.     if mouse_x  item_x11 x& d1 f+ B" ^3 M) {) R* i
  600.       mouse_col = -1
    6 t% q! C5 U& q: Y' t
  601.     elsif mouse_x  item_x2
    2 c( D- o$ _' p+ p6 }2 ^& ~- a
  602.       mouse_col = -20 ^" [) ~$ S; _" ^
  603.     elsif mouse_x  item_x1 + 160) t* \( p, U: i( K. y. B% R1 V
  604.       mouse_col = (mouse_x - item_x1)32
    : P# H/ l# l( u( M/ _) I
  605.     elsif mouse_x  item_x2 - 160
    / M# Q3 V+ v( W% i4 H/ G6 e
  606.       mouse_col = 9 - (item_x2 - mouse_x)32% u* q2 d! d7 b6 U5 H0 C" X
  607.     else0 f8 P! Y3 S( e. g0 K
  608.       mouse_col = mouse_x  x + width2  5  4" {( i" V9 T2 E8 \/ l
  609.     end
    6 A' N8 G/ j7 X! Q; D2 O" A, K0 L
  610.     if mouse_y  item_y1
    ! _1 \) R: i7 G0 u$ }* `& a
  611.       mouse_row = -1
    & q; S  E' M; p3 D
  612.     elsif mouse_y  item_y2
    . v; h% G$ U: Q
  613.       mouse_row = -2! A6 a4 A$ v/ _
  614.     else5 S! }6 f; ], E1 v7 E: w
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)
    & ~( j$ U- k- E0 \
  616.     end& t* O1 F, X2 e9 B8 \
  617.     return mouse_row, mouse_col9 B* I& i; g8 ?$ g8 c% v
  618.   end
    , T" a: v: ~: f* z1 I' U
  619.   #--------------------------------------------------------------------------8 i. D4 o4 ^8 s3 j2 Z
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置4 g$ K9 O7 h( A4 J; v  g
  621.   #--------------------------------------------------------------------------0 P0 m. p6 }4 W1 a
  622.   def set_mouse_pos6 ]( W7 V: y5 G8 I% Z+ L
  623.     if viewport.nil # necessary!
    " a2 l. \1 y- _3 h; Z
  624.       vp_x, vp_y = 0, 0* X$ N9 o* e/ [* N5 g( p
  625.     else4 J* U: ?: a( Z4 P" O. q
  626.       vp_x = viewport.rect.x - viewport.ox( m8 Z( Z# q- g& O# V3 {3 _0 z
  627.       vp_y = viewport.rect.y - viewport.oy
    : }7 h3 f/ k8 \
  628.     end
    , j' }$ O! _! ~  r$ X2 E
  629.     item_x1 = vp_x + x + standard_padding
    : y* d1 w) w1 K; f5 P* ~8 F
  630.     item_y1 = vp_y + y + standard_padding
    ) p: D8 x$ f7 L% r9 K  @1 i  p
  631.     get_index = @index  0  0  @index 5 f/ _& A. |! y: K
  632.     row = get_index  col_max - top_row
    ( o3 K( ]9 U3 b, R& D9 S8 E
  633.     col = get_index % col_max/ A+ r3 i% U7 h9 Z% P
  634.     new_x = item_x1 + item_width  (col + 0.5)
    - _& ^' u; z' Z! @" }3 i
  635.     new_y = item_y1 + item_height  (row + 0.5)7 s, E: r! o) H' b8 ?: L
  636.     new_x += 14 if col  41 U) H8 C: q* K$ v" T. x
  637.     Mouse.set_mouse_pos(new_x, new_y); l  u2 ]* k/ |5 u8 |
  638.   end) N4 r* l- C+ n7 W, q& h$ V) V
  639. end- j2 D2 s" L4 f5 |
  640. % }+ x# [& R% c: U0 N* ]/ l: w
  641. #==============================================================================5 ^! m3 i! m* Q6 i! A/ k) Q
  642. # ■ Window_NumberInput
    % M) |, P+ @7 N. o
  643. #------------------------------------------------------------------------------
    # P, M- A+ U9 h
  644. #  重写了数值输入的方法以适应鼠标: s) w- ~9 T: u+ o8 T3 O
  645. #==============================================================================
    ; d2 T4 l8 x! H
  646. class Window_NumberInput  Window_Base
    6 o1 ]4 S" n4 i+ j6 }
  647.   #--------------------------------------------------------------------------
    2 X3 H% r! S. v$ V8 Z* r
  648.   # ● 定义实例变量
    * L& R" f* X& h
  649.   #--------------------------------------------------------------------------
    1 J  i% Z- J7 O- O! S0 M
  650.   attr_reader extra_window2 c$ S: S9 A) f: |
  651.   #--------------------------------------------------------------------------; ?9 Q& h$ z4 R7 ?+ s9 _, V# n
  652.   # ● 初始化6 O+ u- Z' \9 @/ v
  653.   #--------------------------------------------------------------------------8 F$ e( g, Q9 _
  654.   alias sion_mouse_initialize initialize8 [* O4 \! [% y# v/ Q
  655.   def initialize(arg)
    & ^$ n( i7 [  n0 I+ p2 x
  656.     sion_mouse_initialize(arg)
    . M. ~1 ~) q5 z5 |7 K0 A
  657.     create_extra_window
    0 n, n1 i$ V0 i! p6 ]
  658.   end* }, O) F8 S/ X, D) m; R& G( H
  659.   #--------------------------------------------------------------------------
    8 s" |" G! M7 ]0 h+ j# q; `* ^# h
  660.   # ● 启动
    4 I* t" Y3 H4 s  ?' ]: \) e
  661.   #--------------------------------------------------------------------------
    3 a6 v$ F5 K4 X2 a
  662.   alias sion_mouse_start start
    " q2 N" H% _+ O& i3 X- R: [* b
  663.   def start; G8 D" w+ B: T7 z8 m
  664.     sion_mouse_start
    4 S$ U' {6 ~, D& F
  665.     deactivate
    & s! u/ o6 Q4 G9 D) c
  666.     extra_start
    + }% g% x& _9 i' M
  667.   end1 }9 I& c& M7 q4 k( I( x
  668.   #--------------------------------------------------------------------------
      v* g' U  l& J3 x5 @
  669.   # ● 创建新的数值输入窗口! K5 R& @: G1 {1 `7 }7 z+ m- [( Z
  670.   #--------------------------------------------------------------------------. E3 D9 x: j, u# i! M& F9 V) Y
  671.   def create_extra_window( _5 m" `7 X1 F- C+ |7 ^' Z- Y
  672.     @extra_window = Window_NumberInput_Ex.new1 U: H  E* p$ y) i) O
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2
    % [- ?9 S) b; F
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }
    , h' r" u8 B0 m7 s
  675.     @extra_window.index_proc   = Proc.new {n @index = n }
    , Y* }, f8 O" Q: B8 s
  676.     @extra_window.close_proc   = Proc.new { close }- B, q, c; y! W6 a* `$ ?1 W4 m# x
  677.     @extra_window.refresh_proc = Proc.new { refresh }% D/ Z( g& ~' f7 @
  678.   end
    1 y* A# F4 s% Z' [# s5 C- `
  679.   #--------------------------------------------------------------------------; u3 {7 i0 m4 W! m3 s- J9 p. y
  680.   # ● 激活新窗口4 M( m2 @3 Y* |# B2 m* q1 [
  681.   #--------------------------------------------------------------------------7 \) N. `: ?4 Q6 }
  682.   def extra_start0 N' F7 p6 f0 ^% P" n) A
  683.     case $game_message.position+ P* Z! }8 N* F3 m, K8 J
  684.       when 0; @extra_window.y = y + height + 4
    ! I0 L  D9 }' S8 N( g: g) I9 w
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
    5 L# ^9 o- p% e7 s. q% L
  686.       when 2; @extra_window.y = y - @extra_window.height - 4
    9 r" \/ [' w8 O' a
  687.       else  ; @extra_window.y = 8. u0 I$ S% ~3 J
  688.     end3 K* C. I: U  g6 ]
  689.     @extra_window.variable_id = $game_message.num_input_variable_id" j1 ]* p2 s, N4 z1 C+ ~
  690.     @extra_window.digits_max  = @digits_max6 R* t* {% ?* G+ m
  691.     @extra_window.number      = @number
    5 w  p* _. ^! P' i3 u7 R6 y
  692.     @extra_window.open5 J% b4 k7 O, O  j" I2 ]! h  H
  693.     @extra_window.activate# N5 x7 F1 y3 A% e) S9 ?, ]
  694.   end
    ) u4 B% V  z: m" L7 o
  695.   #--------------------------------------------------------------------------
    / [2 Z* |( \; S* M3 g
  696.   # ● 更新
    # d& W$ `8 b5 W  `( l3 w( m
  697.   #--------------------------------------------------------------------------! l; F& \1 p' ~- {5 K  H3 A- J
  698.   def update; H+ \2 g7 O# v, A$ n  o
  699.     super
    $ k3 V! T8 I0 B1 X1 Y7 m5 r
  700.     @extra_window.update  k) u) z. F2 Y* l
  701.     update_cursor; h: x$ b4 y7 J; v* H
  702.   end
    7 \0 ]4 |2 c1 q4 A
  703.   #--------------------------------------------------------------------------
    3 i/ S; H6 b; ^1 l; i
  704.   # ● 关闭窗口
    7 B0 ]* F/ a  }
  705.   #--------------------------------------------------------------------------  t3 a" g+ h, w# p9 i( z/ L9 O, Q
  706.   def close3 U& C1 h3 e" ^6 o5 h  T" A
  707.     super
    : @0 R2 L0 w1 a3 B- W
  708.     @extra_window.close
    0 ]1 |) L# R7 b' v- I) C3 r$ g- ?
  709.     @extra_window.deactivate
    , G( f8 {2 t7 J7 \1 }/ e2 {
  710.   end, j. k5 R: \' M0 I/ M
  711. end
    6 }) R0 V7 {1 G& |8 t, F1 x

  712. * m) l( S. \0 h% j/ a6 }* F( K
  713. #==============================================================================5 Q. J7 Q. v7 q
  714. # ■ Window_NumberInput_Ex
    / a3 b; n% z7 |$ Q7 I* P
  715. #------------------------------------------------------------------------------
    & A2 J! K' C! r2 F( \" [
  716. #  新的数值输入窗口(NewClass)" D7 w' B' y- p# N1 M9 d8 |. m
  717. #==============================================================================, v+ |! f+ H9 ~0 ~! r
  718. class Window_NumberInput_Ex  Window_Selectable' H! I6 X2 {0 J/ b0 c# M3 D" M
  719.   #--------------------------------------------------------------------------1 k6 z7 T+ h* D3 _; q1 X
  720.   # ● 定义实例变量" B9 H) J! K+ \" W, V" |
  721.   #--------------------------------------------------------------------------: z5 A& a9 ^& u  ?: F" Z( ]
  722.   attr_accessor number_proc- C% N5 e  v0 d; k, u( ]; f
  723.   attr_accessor index_proc
    : o( B* f2 |  [# G
  724.   attr_accessor close_proc" c( L+ H& J4 W) W. `; T
  725.   attr_accessor refresh_proc7 X0 r, s& F2 \; r% Q9 J! N6 S3 s( ^
  726.   attr_accessor number
    , ?/ v+ G3 I- @( Q6 k
  727.   attr_accessor digits_max6 ^# T1 l0 g0 K0 k9 T- w
  728.   attr_accessor variable_id& Q1 s* `$ g4 D; y% h) n! {
  729.   #--------------------------------------------------------------------------
    # ?' l2 H; q, d
  730.   # ● 数字表. Q$ j+ w) `6 }* s) t9 L
  731.   #--------------------------------------------------------------------------- O$ c% W' G0 L
  732.   TABLE = [  7,  8,  9,
    8 x  G. s& D6 _5 b' y" d* m1 |1 c  t
  733.              4,  5,  6,
    , P) I6 g, l% q$ P% G
  734.              1,  2,  3,1 }) o) s' D4 _" L+ R5 S, _8 @, X
  735.             '←',0,'确定',]3 \' e' \6 O" q* v$ {# u% P
  736.   #--------------------------------------------------------------------------$ f0 Z: r; J* g( s) z9 E
  737.   # ● 初始化对象
    . w# [# |: j2 ^& y# X6 ^+ N' y
  738.   #--------------------------------------------------------------------------$ t2 Z1 v4 L7 c  l7 G3 @2 ?
  739.   def initialize
    $ [- d1 E. W' G" c; C
  740.     super(0, 0, 120, fitting_height(4))
    , J; d. v& g0 B* A% W% |/ w7 d
  741.     self.openness = 0; ^5 }, l6 z. N9 c/ t
  742.     @index = 03 \# N0 ^% \4 C
  743.     @number = 0  ]0 S8 y8 A8 n9 I2 _( Z
  744.     @old_window_index = 0
    / d' w5 F3 j$ M/ [5 ^+ D0 ^2 B: ^. K
  745.     @digits_max = 0
    - V1 A1 [4 P: i
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }
    * k: Q: X) ^6 M3 d8 e
  747.   end' w+ {+ u9 A$ d
  748.   #--------------------------------------------------------------------------
    - c/ R: M* e* T5 ~. h
  749.   # ● 获取项目的绘制矩形
    * q. J9 w- }( r* z6 b7 q* U1 ^
  750.   #--------------------------------------------------------------------------2 ^  J" s: _. v6 o
  751.   def item_rect(index)
    9 U" a2 D8 G3 R$ g* w
  752.     rect = Rect.new$ r, a; s1 C  u7 G
  753.     rect.x = index % 3  32
    # n" M* }; w: A# i0 G
  754.     rect.y = index  3  line_height
    / M! s( ]" w  ^3 |
  755.     rect.width = 32
    - e, @: |+ n9 J: s3 w: Y. }
  756.     rect.height = line_height) m+ d5 u% R7 e/ O& s4 `8 R& l4 P( H
  757.     return rect
    $ Z# ~5 `1 `6 r! X: E0 Y8 A% C
  758.   end
    2 K! u( ^' I# l
  759.   #--------------------------------------------------------------------------" j8 l0 c  V" W2 X
  760.   # ● 将光标设置到鼠标所在的位置
    % ^/ I" R) x; c- E' Z
  761.   #--------------------------------------------------------------------------
    + X- W( P# ^2 a+ F
  762.   def set_cursor/ i" R* v/ R. [$ t. ?9 d+ R
  763.     mouse_row, mouse_col = mouse_window_area+ c; w' T/ N) i/ r
  764.     if mouse_row = 0 && mouse_col = 0: z+ O  d; b& ~+ J6 f& C
  765.       new_index = mouse_row  3 + mouse_col& |1 q! m* z0 D% L% Y
  766.       select(new_index) if new_index = 11
    7 _% p  ?9 \2 v0 f, M4 T
  767.     end
    $ s* O; B/ {8 B
  768.   end1 K* S& U) t! e* W* N$ G# v; P( n
  769.   #--------------------------------------------------------------------------* m" Z, ]1 \- @! u- h: A: n
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列( P( w. |8 \9 ]9 Y/ r# y( `
  771.   #--------------------------------------------------------------------------. [9 j: M9 ~0 J% |, t1 I
  772.   def mouse_window_area
    ! j& P/ u; p* J1 _: F1 B% X. }
  773.     if viewport.nil
    & [4 X2 p2 ~& N; w
  774.       vp_x, vp_y = 0, 03 g4 V/ D5 w: Q, W
  775.     else8 \3 v- f. Y6 r; u
  776.       vp_x = viewport.rect.x - viewport.ox
    ' v/ U; [/ D# }3 M
  777.       vp_y = viewport.rect.y - viewport.oy
    3 _: C5 r( }  I7 @
  778.     end
    2 ]0 c& [  K! C( U; s8 C7 b
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y7 g7 @- _' }9 E# X# a+ h
  780.     item_x1 = vp_x + x + standard_padding . p1 C: G! ]+ C5 o# c$ N5 C
  781.     item_y1 = vp_y + y + standard_padding
    " a, R' \' c3 B# L/ i5 `& K
  782.     item_x2 = vp_x + x - standard_padding + width
    * [* z8 P1 ]  a2 t  i1 m6 G( v
  783.     item_y2 = vp_y + y - standard_padding + height3 g6 {1 f. j. `7 m# ^7 I) t6 T
  784.     if mouse_x  item_x1
    # f6 f# W) L/ ^
  785.       mouse_col = -12 H/ S) ~2 W! e+ f7 r
  786.     elsif mouse_x  item_x22 i! k8 D/ S+ u9 }: v
  787.       mouse_col = -2; s, @- f" \  S$ D1 V' J; z
  788.     else
    ) @1 L' T2 N# {' v6 z
  789.       mouse_col = (mouse_x - item_x1)  32
    5 ]6 e( E8 J3 _4 P* Q# U
  790.     end
    , a1 i, B) _5 D/ }4 {8 a6 h$ v
  791.     if mouse_y  item_y1
    ; O# s4 E9 P9 E) `6 `) @+ Y* h
  792.       mouse_row = -11 \* j/ l8 w/ L
  793.     elsif mouse_y  item_y2
    + t" b0 c7 R8 z9 t
  794.       mouse_row = -26 p+ E1 F) w  i+ P/ T+ g
  795.     else
    ; f' y1 X( Y# }
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)+ A$ `1 I1 ?- |
  797.     end/ }0 P, {8 M9 z  n% n8 y$ |
  798.     return mouse_row, mouse_col2 _7 J6 b2 K* q" O$ b) W
  799.   end6 Y7 p" S# ~( [1 q. j: i3 G
  800.   #--------------------------------------------------------------------------
    5 G) B/ ^: F; e1 U! l) e/ J3 O9 n
  801.   # ● 获取文字
    9 A! p* ?/ c6 J5 D% g
  802.   #--------------------------------------------------------------------------4 s- f" J1 G0 @. B& T6 g
  803.   def get_number
    9 ?9 v) {; }7 c9 ^
  804.     return false if @index == 9  @index == 11
    3 O) w/ Z' l5 e) ~
  805.     return TABLE[@index]/ b! X5 h  T. T
  806.   end
    ! w+ E! \% k. ?3 s- o9 D- [& u5 v% F
  807.   #--------------------------------------------------------------------------
    ; d2 t: b( y0 c) k7 q, h
  808.   # ● 判定光标位置是否在“退格”上3 L! N+ t6 g: A5 H: i
  809.   #--------------------------------------------------------------------------
    ! N( W  h! _5 k! r5 D. H
  810.   def is_delete6 d/ n( q! {/ U) v
  811.     @index == 9
    ! m; f) P+ x% |: s6 k2 i( e  H
  812.   end
      J- s7 @4 x, w: p/ m7 p
  813.   #--------------------------------------------------------------------------; Y( k  b" a& U! |1 `# r2 t
  814.   # ● 判定光标位置是否在“确定”上2 W0 e2 q6 m* x; I0 J( @4 f
  815.   #--------------------------------------------------------------------------
    " [7 Y/ y( T9 k9 Z' |
  816.   def is_ok; i, O3 c0 T$ D9 u  a  v4 n0 _
  817.     @index == 11
    : T+ Q1 `; H: {; c* n, l* v
  818.   end
    ; o% m$ S+ E. a. O
  819.   #--------------------------------------------------------------------------! x7 d: v9 M. Q: V7 R! C9 Y
  820.   # ● 更新光标3 ^0 S' y2 J- _, }* U% t: E7 A& ^1 S) A
  821.   #--------------------------------------------------------------------------
    * v, y. K! r) Y8 ?" l- o  w
  822.   def update_cursor' p4 a' \9 i/ f" C
  823.     cursor_rect.set(item_rect(@index))
    ' [9 T9 Z$ S8 e5 ~9 s
  824.   end
    , m3 j5 n) B& T3 C  O3 v
  825.   #--------------------------------------------------------------------------4 X9 ?* c  j# x1 l5 m9 Z! e- C6 K
  826.   # ● 判定光标是否可以移动
    . h. h, F6 m. R3 ]0 F
  827.   #--------------------------------------------------------------------------3 E2 T/ w0 m, g9 D
  828.   def cursor_movable
    ! w* ~5 T: \" Q6 H5 Q
  829.     active1 |, x: f  N5 z7 H" q. g8 R' S
  830.   end
    2 P7 i' C, _. |, ~9 p+ N' }) d
  831.   #--------------------------------------------------------------------------
    5 f0 r9 A* Q. G; ?
  832.   # ● 光标向下移动
    7 k1 E; `. K8 k7 O( z/ D+ d
  833.   #     wrap  允许循环% s! F+ n0 N2 j4 K1 g2 w% P; Z
  834.   #--------------------------------------------------------------------------
    + V$ p: x$ Z7 s6 }( Y- _
  835.   def cursor_down(wrap)) T; |& i  H! t; S) g
  836.     if @index  9 or wrap
    ; o% Y( }" c7 V8 j2 ^4 W
  837.       @index = (index + 3) % 128 v% O# p, @( ~" C* O$ W$ n+ V% n
  838.     end
    # G- I1 ~# v# K4 E1 |
  839.   end
    % T0 m% M+ C3 K! P" q
  840.   #--------------------------------------------------------------------------
    7 S8 A$ [' x! c+ @
  841.   # ● 光标向上移动
    7 f% W; |2 }" ~/ \: P* J
  842.   #     wrap  允许循环2 ?1 w, z5 |6 d/ f
  843.   #--------------------------------------------------------------------------
    " E) f% w" X1 n- P( E) y
  844.   def cursor_up(wrap)
    / N4 H: l7 Y4 d9 E2 P4 |  \
  845.     if @index = 3 or wrap
    : e0 j. s+ e6 B
  846.       @index = (index + 9) % 126 P8 L' o6 G/ Q- Y( v" |9 _' d
  847.     end7 J. s4 d, I2 R. p, i& G: ]( O2 U1 O  p
  848.   end! M* [$ u3 J+ q6 M
  849.   #--------------------------------------------------------------------------
    ' _; W" K$ U' j
  850.   # ● 光标向右移动
    3 o1 k* e/ s. I4 L" V6 ]. E2 P# X
  851.   #     wrap  允许循环% {# {) I/ y  m/ [5 w9 q
  852.   #--------------------------------------------------------------------------
    , L: z& p% w: |2 _  r; J" i& \& J
  853.   def cursor_right(wrap)
    4 A, P# ]& K' u/ G
  854.     if @index % 3  2. F9 \+ f- {) v) l3 i4 m) `
  855.       @index += 1
    ( X/ s0 b+ d7 p6 Y
  856.     elsif wrap
    ; p8 ~; H9 w' c& V
  857.       @index -= 2, n$ e  b: I, |9 O: e, Q4 O
  858.     end
    ( x; \0 J  T: Q, G6 J  T" g3 p" C
  859.   end
    ) w* n0 f' W( y6 w. H5 ~- o5 f
  860.   #--------------------------------------------------------------------------
    " O  z3 g  l: o7 E: h: O- `
  861.   # ● 光标向左移动: r9 i, k0 F& D
  862.   #     wrap  允许循环
    ' f5 `3 }2 i) Z( [2 E3 M. H
  863.   #--------------------------------------------------------------------------9 \" s2 g; P" B2 M6 d2 p
  864.   def cursor_left(wrap)
    ! t5 o( b' ^  W; l4 p* i
  865.     if @index % 3  07 ?% Z: F3 C2 Z8 {* C; A  @( y
  866.       @index -= 1. V9 i# }! @$ j2 u* V* Q) n6 F* |" F
  867.     elsif wrap2 z5 [; u6 N* @% i. A8 o( l
  868.       @index += 2
    ( l- B( |- S. C. O; |1 d/ o
  869.     end
    2 ?, G' X1 L% U; _4 c  G4 C
  870.   end
    / u: [* C% M- S& N/ Z
  871.   #--------------------------------------------------------------------------) Z3 |; [/ o% y7 M  B, W% [" G
  872.   # ● 处理光标的移动2 W' ?0 \' C- e* G
  873.   #--------------------------------------------------------------------------2 g! M* E( {% m, A
  874.   def process_cursor_move$ e$ R! n4 X. z0 X, f3 ]3 v
  875.     super; D! e/ ?. T6 M( O7 H5 H/ N. C
  876.     update_cursor. Z: W6 B; g, ?7 E; Q  Q  u
  877.   end
    1 W6 r& k$ h( u9 n% J7 C( v6 E
  878.   #--------------------------------------------------------------------------
    & h: l3 |' C9 U
  879.   # ● “确定”、“删除字符”和“取消输入”的处理
    , A) y$ |2 m1 R- X# t
  880.   #--------------------------------------------------------------------------
    2 Q* t$ f! h0 {% \' S# F8 S4 h
  881.   def process_handling
    $ v: V5 C9 V2 U, v0 Y- X) H$ b* f$ j
  882.     return unless open && active2 q+ D; Q2 i4 B5 `0 {
  883.     process_jump if Input.trigger(A); r& y- _; I# T
  884.     process_back if Input.repeat(B)
    9 I2 O) y7 i8 f6 @
  885.     process_ok   if Input.trigger(C)$ s4 P, o. B0 }6 e1 p
  886.   end- j, [1 W# e) c% F
  887.   #--------------------------------------------------------------------------4 e2 L* f1 C# }
  888.   # ● 跳转“确定”
    " A: E* P. r, R+ _0 l& z
  889.   #--------------------------------------------------------------------------
    . [2 [& E7 o5 g* m
  890.   def process_jump
    7 W0 Z0 R  U, h
  891.     if @index != 110 ?: \7 \6 U* ?& Q) e4 J
  892.       @index = 11  e2 \) U# x- g' G
  893.       Sound.play_cursor5 E/ L  X; j5 c* S
  894.     end$ L# p. ]1 q* N# L$ ?! W* E  C: X
  895.   end
    - C, y, Y: k( y: t* K
  896.   #--------------------------------------------------------------------------* [2 X* W  u% f# j+ f
  897.   # ● 后退一个字符
    ( i# |4 A4 V6 R
  898.   #--------------------------------------------------------------------------; m. E' n' l8 h  q% d/ ~7 O: u5 y. b7 a
  899.   def process_back' C0 e5 I+ }& v9 [! Q5 N! |- Z
  900.     Sound.play_cancel
    3 F7 i% U8 o# S: E: g9 z: Y
  901.     place = 10  (@digits_max - 1 - @old_window_index)
    9 p1 J# _5 M1 h! b
  902.     n = (@number  place) % 10
    ' C5 Z/ }; h8 {' Y* w! J
  903.     @number -= n  place
    7 W) z: o' A  n8 }$ U8 d
  904.     @number_proc.call(@number)* B) K+ q9 z1 r
  905.     @old_window_index -= 1 if @old_window_index  0
    : T! J' @8 o8 i  t% i4 n, U3 w2 d
  906.     @index_proc.call(@old_window_index)) k3 p: ]  C  n8 G$ k; D
  907.     @refresh_proc.call3 s4 k* {, @  \
  908.   end" R( G) E1 q5 r& ^
  909.   #--------------------------------------------------------------------------5 V+ B4 @( p, W! \; y
  910.   # ● 按下确定键时的处理
    ! x( E5 F- Y5 U4 }3 |
  911.   #--------------------------------------------------------------------------" ~# @  D- z3 V& v
  912.   def process_ok
    9 i4 \0 U) ~; M! a( }
  913.     if get_number! V( a+ m- w  X& u
  914.       Sound.play_cursor+ ?1 u4 T& p1 \1 s& a8 s! z
  915.       place = 10  (@digits_max - 1 - @old_window_index)
    & {; H: V, B6 i7 I
  916.       n = get_number - (@number  place) % 10+ f" s) ?' h9 z: M6 Y, y
  917.       @number += n  place
    * `1 R' S% D+ j) r6 P7 m' r; R
  918.       @number_proc.call(@number), }) ^/ Y" `1 x4 B  m: v2 U
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    # n! `1 C% X+ _2 b$ _( p& t
  920.       @index_proc.call(@old_window_index)
    % M; y4 _! |) ?
  921.       @refresh_proc.call
    0 q1 Z5 ^* H' |9 F* W
  922.     elsif is_delete
    ( a( `/ p% h5 Z
  923.       process_back
    5 ]: P2 A7 E, _1 h5 n1 `2 f
  924.     elsif is_ok
    . K- z2 v7 z# R- G- g
  925.       on_input_ok% r5 F+ P8 P+ U) B2 b- o
  926.     end
    . n' m( f) T/ _7 r
  927.   end8 f. J; N" O! y& Y
  928.   #--------------------------------------------------------------------------
    3 V: N. n( E9 c
  929.   # ● 确定
    : ?8 e3 k! R, w6 S8 A$ Z* E
  930.   #--------------------------------------------------------------------------
    % h1 i+ A+ x3 a; w
  931.   def on_input_ok
    ; G$ h( r+ k: d  _+ S+ G
  932.     @index = 0# c* O# ]! J  ~8 Z. p
  933.     @old_window_index = 0% u2 k/ V+ W  j( D
  934.     $game_variables[@variable_id] = @number1 B# {& E, Z( z& b8 K$ m" M
  935.     Sound.play_ok
    5 Q. Z9 H1 ^5 P& I" e3 Q1 \9 {$ E
  936.     @close_proc.call7 |" q( x: }! e
  937.   end
    5 z; D/ {( y$ w; I' D* ^  I# |
  938.   #--------------------------------------------------------------------------/ D& k% T2 i% o& M9 P- R- a
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    & R* f- S2 J' o3 H
  940.   #--------------------------------------------------------------------------
    * ]8 `# e% K$ ]3 r  |+ B
  941.   def set_mouse_pos
    + m: h3 C1 `0 H: j" c2 \
  942.     if viewport.nil # necessary!1 D: Z. Z; K3 t9 V0 U
  943.       vp_x, vp_y = 0, 0$ ?* {# u( ?1 X$ x2 {9 P
  944.     else
    % H9 I$ ]6 A% E/ |
  945.       vp_x = viewport.rect.x - viewport.ox0 P) j# z4 u' V
  946.       vp_y = viewport.rect.y - viewport.oy, F  b3 l! M( d( v
  947.     end/ p# ?% Y6 n6 ~# S2 m
  948.     item_x1 = vp_x + x + standard_padding
    ; {' x2 l& ?0 o- _( ?' T5 i0 b' p
  949.     item_y1 = vp_y + y + standard_padding
    $ a* [  i4 X; ~
  950.     get_index = @index  0  0  @index
    ! p# @; V$ s) _( j0 ^, X2 B
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)* a1 s# a+ e0 r1 n
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)' y2 ?" P) a8 L2 `3 b1 j2 ]
  953.     Mouse.set_mouse_pos(new_x, new_y); d& z( ^" O# @  `6 T! e
  954.   end
    6 S  e2 ^8 y  s/ s. x
  955. end5 h5 {5 S6 |! c# P( I- K" ~

  956. ) b2 e. b  H+ `8 s, [) X$ B
  957. #==============================================================================- a: {% J  t. w8 d4 _
  958. # ■ Window_Message( h: f' B2 O; h# p+ s
  959. #------------------------------------------------------------------------------) n) }& S% P+ }' ~8 e" N
  960. #  显示文字信息的窗口。: |9 A1 [% V! j- Q" `. `% A
  961. #==============================================================================8 X( T. S# I' v8 ^+ {0 [
  962. class Window_Message  Window_Base: Y* @; x0 _9 Y  M! n
  963.   #--------------------------------------------------------------------------7 O8 [! `7 u% T# x5 q. H
  964.   # ● 处理数值的输入(覆盖原方法)
    ; U( ]0 b7 F. g+ I# f
  965.   #--------------------------------------------------------------------------
    2 T. e( N. w. p% _0 H
  966.   def input_number
    , V! ]. Q) |% R" U9 X$ K/ @* c% d
  967.     @number_window.start1 j& H% ?$ C4 [% e* e/ ^* |+ h1 P6 s
  968.     Fiber.yield while @number_window.extra_window.active
    5 J# B" E5 y3 e) F
  969.   end
    . O& N$ A% b) _& u: r. \; S
  970. end! `. y: j; w6 y3 r2 L

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

  2225. / V( S0 z; ~, e+ U$ J
  2226. #==============================================================================
    3 z9 K) b  j5 ]- R9 S& e1 C- s
  2227. # ■ Spriteset_Map4 k5 E9 n3 h  b1 m& _, }
  2228. #------------------------------------------------------------------------------5 u5 k  I' m& x7 L
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。4 F& u' u; K! q' s! T3 a
  2230. #==============================================================================
    * ]: \. _' }6 y) r
  2231. class Spriteset_Map, b" A" o# U9 E4 y
  2232.   #--------------------------------------------------------------------------! I( ~$ B! u; J! B! d7 Y  `$ k
  2233.   # ● 生成路径点精灵* C2 Y% B  d. F0 r
  2234.   #--------------------------------------------------------------------------9 d: W: i  m+ i( s  i  F, Q
  2235.   alias sion_mouse_create_characters create_characters
    ) j% G1 c3 ~9 t4 U; h4 I
  2236.   def create_characters
    3 L& u/ u) S# h) W
  2237.     sion_mouse_create_characters
    8 h# @9 N# }) M2 y: J
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))
    0 h$ V+ o( _0 [
  2239.   end
    9 u, {( F/ a, C, Q. D1 x
  2240. end
    1 w6 T9 }8 ~8 h* @3 t; f  B
  2241. ; c' y& d& e/ q4 U
  2242. #==============================================================================
    ; S8 n0 a( }& A
  2243. # ■ Scene_Map. B$ {9 h! L* ?! _0 }: |
  2244. #------------------------------------------------------------------------------9 F" p  Q. ]# a) s3 O
  2245. #  地图画面
    1 s* v4 j" u. ?, D9 c- V
  2246. #==============================================================================
    2 A/ D3 q% [2 M) ]6 I3 a: i
  2247. class Scene_Map  Scene_Base
    " \2 [4 F& I; p+ V) X- L3 y
  2248.   #--------------------------------------------------------------------------" F2 t" L4 E9 f/ _; C* Y2 D+ Q# T
  2249.   # ● 画面更新9 a" F- N9 l1 w9 f. ^9 Z8 `7 _
  2250.   #--------------------------------------------------------------------------. f- X7 h5 f' |3 t+ O& `
  2251.   alias sion_mouse_update_scene update_scene3 o1 @8 U" P1 f  C; r* x# K7 o' f3 Z
  2252.   def update_scene' K* F/ r( P6 K3 o% h- }+ F4 i; z
  2253.     sion_mouse_update_scene
    % _8 U0 |( S4 Y9 y$ W# `* ~
  2254.     update_mouse_action unless scene_changing
    & ?% D* B$ y: C0 |1 n) ^
  2255.   end0 l2 C) j. ~& M4 s; e
  2256.   #--------------------------------------------------------------------------/ [. T4 A# D7 o8 [% X/ T2 y7 o
  2257.   # ● 场所移动前的处理, a' ^) y" ^, J$ ?. h
  2258.   #--------------------------------------------------------------------------
    - w. r; X. k0 n8 \7 F0 H
  2259.   alias sion_mouse_pre_transfer pre_transfer) o2 d1 g+ u, R0 m9 C! M" p
  2260.   def pre_transfer
    / E4 r, i* v- D' h4 ~! P
  2261.     $game_player.reset_move_path
    - q& X( o6 j' l- B5 f4 W) z2 L
  2262.     sion_mouse_pre_transfer6 _' G1 N- j- O8 N. |
  2263.   end
    7 c  o, p6 ]  y* _$ g
  2264.   #--------------------------------------------------------------------------& `, b5 ~" E$ V/ j7 U" O) Y$ r
  2265.   # ● 监听鼠标左键的按下
    0 p; b, |9 |! N6 k  w
  2266.   #--------------------------------------------------------------------------
    5 W; K5 L1 d  m/ |7 S9 }& u7 p
  2267.   def update_mouse_action) ~" p% L; t# Y4 j  H# A! _7 H
  2268.     $game_player.left_button_action if Mouse.press(0x01)) ^- P' Q; v2 q, W
  2269.   end+ A! F& R/ q* S7 _# S
  2270. end9 Z8 [' W4 H0 T, n( r
  2271. 5 J+ w" L6 \1 i
  2272. #==============================================================================
    : }/ i) G; F- l. k" M
  2273. # ■ Scene_File
    2 y$ T0 E% ]2 H& i" I* n
  2274. #------------------------------------------------------------------------------: ^' T9 T$ @0 r7 s: x
  2275. #  存档画面和读档画面共同的父类
    ) ?, F; @$ c3 p+ @: {" P
  2276. #==============================================================================- b$ H9 X5 d( D' }' p
  2277. class Scene_File  Scene_MenuBase# ]2 E( i# g5 r! Y
  2278.   #--------------------------------------------------------------------------" d' P% E9 r" T
  2279.   # ● 开始处理6 K3 X: F, Z; F$ x& R% d
  2280.   #--------------------------------------------------------------------------
    0 r- x+ [( p4 |  w
  2281.   alias sion_mouse_start start
    / L) |0 ?8 g. F
  2282.   def start
    0 {/ K% I" d, B
  2283.     sion_mouse_start& h% P; c& ?) O5 R3 N) x  x" t' C
  2284.     @move_state = 0
    , O  u' @! E% Z0 e3 Z& ^2 N
  2285.     set_mouse_pos
    8 W# l/ W  Q0 C: _8 l2 u* H
  2286.   end
    ( k8 d+ c* N. W, ~
  2287.   #--------------------------------------------------------------------------. m. b5 Z0 R+ z
  2288.   # ● 更新画面( J/ I  R% c. H2 |8 q; R
  2289.   #--------------------------------------------------------------------------$ H5 p4 j0 g) U) x6 K
  2290.   alias sion_mouse_update update+ ]: S4 a* e% @: N' y0 O' L$ m
  2291.   def update
    ) W. G9 ~; \$ U
  2292.     sion_mouse_update
    1 Y0 M7 ^3 f9 U
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos
    - B3 ?6 C1 `5 A( U0 K
  2294.   end9 A' A1 F, z1 |# J& [* o
  2295.   #--------------------------------------------------------------------------
    3 ^' Y4 m! L% F# M
  2296.   # ● 更新光标
    : P# f: ]$ {; `; I! V# O% ^4 H
  2297.   #--------------------------------------------------------------------------" ^+ z* p# n5 G4 ^
  2298.   def set_cursor
    . m( H" _/ B) E# n# ^6 A
  2299.     @move_state += 1+ c7 x, @5 t0 [+ _
  2300.     last_index = @index
    2 m9 }) G. ^& l& G% m2 k) p
  2301.     if mouse_which_window == -22 a# U* D: ~4 K' n! Y
  2302.       if (@move_state - 1) % 6 == 0
    - h, Y3 L0 Z: B
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1
    " p+ L2 ]$ x; @4 z# B# n: ]8 l5 ^
  2304.       end
    . l3 e7 b. H9 r: N% a# T
  2305.     elsif mouse_which_window == -1
      e) R9 O  O- h! h5 N3 s% T+ f
  2306.       if (@move_state - 1) % 6 == 0
    4 P* O! k* Q& ^
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0+ R1 \8 p7 q3 p) p0 N/ m- o4 L
  2308.       end
    ; _/ ?6 `. n, A. e( M- w& v
  2309.     else
    : G/ T+ v( ~  ^7 M
  2310.       @move_state = 0
    ) t: G- m& O& u0 I$ v9 R) r" {( o
  2311.       @index = top_index + mouse_which_window
    - z1 U6 C; b" A; |7 i2 o
  2312.     end
    6 W7 E1 h, o& G; S
  2313.     ensure_cursor_visible9 O+ g" a3 |- j9 L! L5 K2 M7 D
  2314.     if @index != last_index4 b1 \4 e8 N# t, S* Y  o
  2315.       @savefile_windows[last_index].selected = false
    3 t5 r, {. u3 [
  2316.       @savefile_windows[@index].selected = true% H/ Q- X# F, V8 J/ j
  2317.     end
    & I# m9 }) Y; L1 N) v" o
  2318.   end4 h6 d) y/ `$ _+ ^! {
  2319.   #--------------------------------------------------------------------------/ b, m9 N' Q$ ?9 q+ b
  2320.   # ● 判断鼠标位于哪个窗口$ R. j& M! D" X4 k3 o$ k6 `4 t
  2321.   #--------------------------------------------------------------------------) {# y0 [% n2 A2 ^( b
  2322.   def mouse_which_window
    ' L/ X2 X: Q+ f; K4 R; l
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    - Q( ~" \9 m& p) @+ e* m
  2324.     if mouse_y  @help_window.height + 140 d& m0 x# z' L7 o
  2325.       mouse_row = -10 P9 T/ _  h/ z$ m3 R
  2326.     elsif mouse_y  Graphics.height - 14
    # B  I; o& J! _2 {0 A3 e
  2327.       mouse_row = -2  t8 f! L- _6 M& s/ }+ ?+ R
  2328.     else# R: g3 A% b) u  k# q
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    ; V* v* S& S5 X7 r7 N' W. p) X
  2330.         (Graphics.height - @help_window.height)* }3 t) @; @% H# j! h
  2331.     end
    ) p) G( X) ], D/ K% |% s- v( W! G- g
  2332.     return mouse_row3 x) Y$ I6 Y! G3 N5 [5 j7 ~4 M# r
  2333.   end
    . Y0 u, G) V: {1 w: h# q
  2334.   #--------------------------------------------------------------------------/ H: d  @: E% m& Q$ j! C1 ]( ~" U
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    4 L! n. P" h. @. ~5 w
  2336.   #--------------------------------------------------------------------------9 t2 P! K# ^% B
  2337.   def set_mouse_pos: B! u( S" Q- {+ \5 Q8 P# o7 ?
  2338.     new_x = 401 S  k+ ?; }, g7 h
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    - z$ }! `3 h' l% `- V0 c- k
  2340.     Mouse.set_mouse_pos(new_x, new_y)
    ) @. ?- w! ?7 G( v: i0 o' f
  2341.   end( L: H; O$ _( W" O5 _
  2342. end
    6 C0 l! h5 Y; Q( M7 P
  2343. % p9 R; j& R: g9 I+ u: u$ m5 Q
  2344. #==============================================================================) t8 s6 c* |" |4 q& l
  2345. # ■ Game_Event
    $ m7 ]. Y* ~/ o% {
  2346. #------------------------------------------------------------------------------
    0 N0 w6 l- I; o' v  a
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
    + {* t# }! R- @2 H
  2348. #   在 Game_Map 类的内部使用。
    0 c* ?/ h. W, U9 I
  2349. #==============================================================================0 v. Q0 D) G" @( s+ m
  2350. class Game_Event  Game_Character
    - _) g, n: ~8 N' Y
  2351.   #--------------------------------------------------------------------------! K, }6 s2 ^+ ~# V- m8 Y' G: ?6 d7 V  ~
  2352.   # ● 事件启动' }& R" E1 N: g
  2353.   #--------------------------------------------------------------------------
    7 s0 }, U# m: `* ?8 E; A. W
  2354.   alias sion_mouse_start start
    5 y  F8 n$ e( e* W5 c- ?
  2355.   def start% ^, z! a. ?3 z8 o* q6 E2 ]
  2356.     return if mouse_start && !Mouse.press(0x01)2 E  r, o/ j5 ~) [  A" h
  2357.     sion_mouse_start
      t* x. z- z& g) {) D8 _% S) ~
  2358.   end
    7 [6 q# M* m- H0 G7 K' Q- G
  2359.   #--------------------------------------------------------------------------% o2 D1 `; F4 ^( r
  2360.   # ● 判断事件是否由鼠标启动4 I% `- G% ?& W. ~! C! Z/ I( G
  2361.   #--------------------------------------------------------------------------  I7 g* {1 e$ w! w* S3 A
  2362.   def mouse_start/ t9 ]. l; p* A* v  d  @
  2363.     return false if empty
    8 |9 \$ P4 ?  @) n$ d
  2364.     @list.each do index) Y" h( z5 Z/ i2 D9 `6 w3 ?- x4 y
  2365.       return true if (index.code == 108  index.code == 408) &&
      _9 L' W6 l' G0 {7 m, S
  2366.         index.parameters[0].include('鼠标启动')
    3 k# W$ j. L5 `$ Z# K
  2367.     end
    6 g) E; _' d1 _$ k" U- l/ K
  2368.     return false
    ) J+ N+ }( Q, g! C; Y
  2369.   end; l/ A' B7 P; Z. f/ }6 f2 h
  2370. end
    + X& Z0 N) o: ?" l2 O- e% R/ k

  2371. 5 L! O4 j' i; E- v% n* Z5 N
  2372. ####泥煤的height
    9 d# a* H% ], M# X: I
  2373. # @height = height
    ) u- K% N' G; k7 w  @
  2374. & }' s6 _7 n- w7 U
  2375. class Area_Response
    5 Z: |! ~  B8 z, k4 {: B
  2376.   attr_accessor type
    ; X5 p. ^) p3 h) v  \/ g# o
  2377.   attr_reader ox
    ' w! ]( }6 F3 m! S
  2378.   attr_reader oy
    ; X+ c0 e: t* S- N- V
  2379.   attr_reader width/ U4 Z) }7 d; O: V8 P8 u
  2380.   attr_reader height, `9 W  a! I: ]/ U# s1 a; D
  2381.   attr_reader switch_id  X/ ~& I# [: Q3 \% s  Q. q4 s
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)
    + o# d& M' i9 ~7 T! P# g3 \
  2383.     @type = type
    / Y2 h, F: l# Q- L+ O# N
  2384.     @ox = ox6 }. O9 p, U) o
  2385.     @oy = oy
    6 D3 |# o4 \% Y! T
  2386.     @width = width
    # L$ D7 }3 l' M. a
  2387.     @height = height
    ; U9 c! Y  ~0 w1 Y0 a) O' w7 p
  2388.     @switch_id = switch_id
    2 }8 ?$ F! b. u, d
  2389.   end: t/ w" V4 `  H, Y& x, u1 O% r5 ^
  2390. end7 a+ Y; ^+ u5 T3 l9 t6 k1 w  w
  2391. % C0 N2 J1 `; \$ ^) _
  2392. $area_responses = []& z" k- q: p9 ~1 ?, e

  2393. - L4 P% ^" T' u, A; q
  2394. class Scene_Map
    ' t( k/ `. Q5 N; ^
  2395.   alias update_mouse_2013421 update_mouse_action2 T" R$ C* {5 E
  2396.   def update_mouse_action9 U, D- g+ m& W# o0 q. D( d8 q4 e% T
  2397.     update_area_response
    5 V/ i0 a: ^- S
  2398.     update_mouse_20134219 M  [0 c2 j2 b5 z. x% Q! {2 q
  2399.   end
    6 H9 d3 ~, F3 z# z
  2400.   def update_area_response7 `9 ^* S" I; Q* |! n# \0 r
  2401.     responses = $area_responses
    + a+ h# o) K7 j9 h$ w# U, R
  2402.     responses.each {response
    # T* q& @: B# S/ F3 y/ ~
  2403.       ox = response.ox! Q6 m, W0 c5 w5 s5 `$ t9 y3 P
  2404.       oy = response.oy2 C5 c* \5 `" {& E5 j) g
  2405.       width = response.width
    3 k5 L4 @. o' q$ C
  2406.       height = response.height' ]. |/ o0 J' ^& G9 V4 ]0 O
  2407.       switch_id = response.switch_id7 V2 C) f- ~7 X: K, z8 r5 d* ?7 w
  2408.       case response.type
    9 m& h" w2 @' B
  2409.       when 0
    ! s7 M- W) N1 A* `' u
  2410.         if mouse_in_area(ox, oy, width, height)5 i9 W) D* U/ G) T! y0 m
  2411.           $game_switches[switch_id] = true
    , ^3 R! U$ M, e+ J3 w
  2412.           $area_responses.delete(response)! }8 n( U  x; n  v3 a
  2413.         end
    7 u5 Y* [9 D- Z1 `
  2414.       when 1; O- b! g7 h* P
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)
    : h3 H4 J, v: Q9 Q
  2416.           $game_switches[switch_id] = true8 e% S! ~3 S% d$ l. S
  2417.           $area_responses.delete(response)
    6 M& ]$ h1 i! A" x% v, ]" Z0 p
  2418.         end
    , a" _, K+ Y% d5 G# C& V9 i( k1 m! o! E
  2419.       when 27 [% Z! s( P* R5 o
  2420.         if mouse_in_area(ox, oy, width, height)( t/ m$ Z3 c6 [6 f& ~
  2421.           $game_switches[switch_id] = true$ n7 T# }5 M. g+ Q4 O" n6 |( h
  2422.         else
    . H& D) w6 ^. _, b4 l" V- ^
  2423.           $game_switches[switch_id] = false
    $ e. ^# }- f  Z: n. ^" d
  2424.         end' n, E; `0 B  n( Z! \3 ]2 _. O  D
  2425.       when 33 {( J3 c; z# Q- ~+ f9 \- i& {
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,
    3 }9 E& h3 S! L( m, R0 O+ J
  2427.             (oy - $game_map.display_y)  32, width, height)7 Y% m2 {! V. A6 f
  2428.           $game_map.events_xy(ox, oy).each {event
    $ M: Y* A! R8 _& r* N
  2429.           event.start
    0 C  X; Z6 U' L* g0 O. _- r5 R
  2430.           $area_responses.delete(response)
    # V/ [. N3 r8 _9 k3 Z2 M- W6 J$ ~/ R
  2431.           return
    ( h; E; ]6 N! ?: w4 z- I+ s
  2432.           }
    : J) m- ^. {; g6 p' |( Q5 A4 m  _
  2433.         end
    & H1 e! P5 X8 t: ?! R
  2434.       when 4: U: R+ c# L4 d) F
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,
    9 ^0 j0 _  e; `) \4 I/ ^4 z
  2436.             (oy - $game_map.display_y)  32, width, height)
    1 Y$ y) E! _2 a6 o4 O
  2437.           $game_map.events_xy(ox, oy).each {event* K. z' n3 r7 n
  2438.             event.start# U& k/ h- @2 I$ o3 ^$ |8 A
  2439.             return3 I$ Y: y+ e5 y  i/ u' I
  2440.           }
    2 M/ L  I5 I' t# o/ T- O9 e5 w' N
  2441.         end
    6 n: ^5 x( r4 Z+ T
  2442.       end. l) Y( N3 C* |9 g8 I
  2443.     }. t2 m7 |/ a& F3 j2 f
  2444.   end# @' d) l! @( @0 U  C
  2445.   def mouse_in_area(ox, oy, width, height)' {+ V5 B6 n: O' E" p9 v7 y: Z
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&7 c" s5 u7 ]* I+ P
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height- b4 s( I- ]# U  @
  2448.   end  f: ?9 [/ T  t
  2449. end" E1 ^! d, t* c! Q! g0 b
  2450. class Game_Interpreter/ M8 G2 M9 J0 v4 s% H
  2451.   def area_response(arg)
    6 q! y, q- ?; D: e: E) `; D$ R
  2452.     $area_responses.push(Area_Response.new(arg))
    $ w3 B2 e0 O" }" e4 Q+ g" D
  2453.   end- P. s; i; D! e
  2454. end
    6 e, W: `# u2 y5 v
复制代码

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

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

GMT+8, 2025-11-1 23:04

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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