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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    7 S4 m+ m! L& M. V& g

  2. # H- k5 Z7 K% d$ q2 @6 O  v4 A; h
  3.   Sion Mouse System v1.3e
    6 i; m% c7 X' ~6 C
  4.   
    0 u) r: O2 e8 ~" I
  5.   Changlog1 B, T: Q* @0 M! U; A: v: T
  6.   
    * b. ~) P3 K; j9 Z! T; ]9 x
  7.   2013.4.21 v1.3f# `' q2 Q5 ~3 ]& v% l8 l
  8.     5 p! g2 A/ y% X
  9.     1.3f 卷动地图 bug 修正
    5 u( K0 j# r+ w* K6 D; I3 p$ V& i4 d
  10.    
    ; O" [, E% H5 q. T" t
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口
    : ]( ~* [9 i5 F
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内
    " e8 V! ?& Y7 R5 H& Y4 V0 b6 D
  13.                               Mouse.unlock_mouse_in_screen 解除锁定
    2 s5 I9 @4 U6 G! O/ D' f  D7 \

  14. 6 ]  ^3 q8 C3 s
  15.     1.3f bug修正4 n+ Q& _% f* M2 ^' d  L) c* m
  16.   / b$ B/ j5 G. l& s
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及
    % F  F$ O' m# W6 e4 T
  18.           关闭菜单时,鼠标是否移动到原来的位置。8 z9 F* E$ _0 J: F
  19. / D9 J/ V6 ^, _4 g7 s) x& f
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处! b" c: w! g8 J5 y
  21. ; K, [& c( c2 l$ S' H
  22.     1.3b 修正一些罕见的bug;
    0 H+ }; l- B0 G% w0 u* D9 Y8 U
  23. # d" s$ }1 Z7 T$ a: X4 N
  24.     1.3a 代码小修改;1 d6 Z- t2 ~. s/ R3 f
  25.           加入了鼠标点击启动事件的功能,
    : o* N( {" G2 P( |
  26.           在事件中加入“注释”: 鼠标启动  ,/ ]8 k4 _% W0 [! v2 C; W
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    - Y  ~: n$ q/ x. z! ?. K+ N4 Z
  28.   
    . e6 _/ Z# E" q
  29.   2013.2.12 v1.2
    ' e5 q8 U( u0 u- R: V- X! k0 {
  30. $ N: |0 y( t: v" f( Y) s3 q7 a  `$ R
  31.     寻路逻辑优化;
    ! t/ H& W! {8 l- E) i0 C
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;
    ) G, k, D' Y9 c
  33.     现在支持用鼠标来操作载具了。) Z0 U' h& s0 N) w7 u+ n3 Q
  34. : H# d; R9 {0 G' s% W
  35.   2013.2.8 v1.1, e# o2 T' p0 o2 w2 B
  36. " m2 ^! t3 g9 s& I- u' E
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    0 w: o8 m3 i3 |9 r  f
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;
    9 m" n5 d' f% M  ]) r' E
  39.     移动时,路径指示点的绘制更加稳定;
    ! @% e) }3 N+ H. V3 ~. B; R9 {
  40.     现在支持默认存档画面的鼠标操作了。$ n! k( n4 b  u2 |
  41. % f# f# l. ?/ d# n0 R

  42. 9 L# Y" f$ i, R( }/ l" F7 ?
  43.   OrigenVersion: a+ K1 ~* S# t% K0 ^+ c) Y5 j& D
  44.   ) i: k& ]" ?. F, [7 }
  45.     2013.2.7 v1.0 - N2 {6 F& e: R1 f- m
  46. " A9 Y/ Y+ }7 P( [7 ~
  47.   主要功能
    ; Y3 A" _6 {. R4 f1 v, \/ [' Q
  48. $ I, G" T% \0 `- x& d3 @- P
  49.       使用鼠标进行各种操作...
    , S4 i+ `) t* a- O0 V) O6 r
  50.       将鼠标锁定在游戏窗口内
    + D* b) n( K* M# n: I7 V! W, f
  51.       自动寻路,按住 D 键可以扩大寻路的范围3 m9 I3 h6 I! M2 {3 j5 C; d
  52.       双击鼠标进行冲刺+ R' X5 J4 M. H8 B1 y% f3 s
  53.       更改地图卷动方式以适应鼠标移动" s' ]; \( P5 ]
  54.       变量输入框改良2 y& g7 y& C* D7 ?* O

  55. % l5 v9 X1 {& I: E
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹
    - i0 b0 Y$ a( i' y6 e0 O
  57. 2 I' H! D2 c( ~8 k
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹& D. Z& C1 E/ K! q% k: R
  59. , k) I4 W7 D- M: y  _; `
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭+ ?8 b; i+ e* X6 N% y- r! w
  61. 4 A8 i0 N- p$ l$ I  j

  62. 2 G5 K0 Z; t; W; X0 T$ F1 p
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★
    ! ?! d5 L& `. V2 V) Z
  64. . K& f7 L! B) _) s

  65. + `! K% P( m* a, \, C' v
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示5 q3 O: r; \, w& W4 F0 ~

  67. 9 d8 o1 s4 b) _
  68. #==============================================================================0 a! W0 I" I$ W" [8 x3 W, C0 I
  69. # ■ 常数设置   T9 r6 x( b8 n- b5 q# {2 w4 Y7 Y2 v
  70. #==============================================================================" m. a: @$ j/ V% l  h9 _9 G
  71. module KsOfSion9 L2 V/ O5 |$ U1 T- S
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false
    4 k9 {3 P) U( N( L
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑
    % q3 |: J3 h: z, @* T7 r
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false, m0 Z* a& V3 b+ B0 s+ K
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量, u. n: C: p6 Z" ?- p6 G0 W" ?
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处, _  F! c+ `& U
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧6 {4 a, L# ~, r3 l" l
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)2 Z. n& E: g" R% L6 a7 b, l7 V
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键
    $ ~& m% p/ p& E
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)
    ' B! j& h' {, t3 N( Y
  81. end
    7 i, z( M' ]3 D) N
  82. + ^: @) @8 ?$ y' b
  83. #==============================================================================% T1 k$ E: k  U/ _7 n
  84. # ■ 用来显示路径点的类/ w9 @$ e6 _3 x) @& `
  85. #==============================================================================1 f- L3 l2 H/ N! u0 ]
  86. class Move_Sign  Game_Character: D+ Q$ p! o( y0 f5 G
  87.   #--------------------------------------------------------------------------
    . S% B- H9 v7 T! n
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图. c* j" i; x: i0 A) r
  89.   #--------------------------------------------------------------------------
    ( g9 R- p. Z0 V8 H, e* q
  90.   def init_public_members" o0 k0 Y/ |3 K
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹
    6 s5 h! K8 c6 C) A4 P: c4 D
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    2 J$ A2 s+ \$ `& \, L
  93.     @move_speed      = 5        # ★ 踏步速度
    ' H/ b3 a4 |1 U0 ?/ D3 {
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)6 J' t: g! Z( _4 H* V$ Y, x" b
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度
    ; G" t2 z& Y& w( Z7 H, P! a
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)
    ! V# M  _; f1 o3 M3 w. O5 w
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列" T% _, l. }, H
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1). U3 _5 N2 }% u1 J
  99. 2 a) |# u% h; N) j, v  o: `

  100. ( q8 @6 _& B$ ~6 Z" _5 O+ |* D0 C
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★3 V& ^# c# {$ l* B, ^6 G( d
  102. 0 {& V% V) i; A0 d' g) G
  103. : N3 ]7 X5 E8 T" s5 T
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图$ u7 c* Y. l5 I2 g' [
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    - G/ |  L" W, c9 `6 q, W

  106. " t+ X  q8 \* g, S# A4 P
  107.       if $no_arrowpic_warn
    4 [3 \7 P7 \3 s  R
  108.         MouseShow_Cursor.call(1), Z9 [2 ]+ k1 E6 k
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png& \! V" m7 H3 `% l4 R0 i- _& c% e3 W

  110. 6 R3 ]" ]5 j  n, d$ Z3 E9 T  a
  111. “路径指示点”将使用游戏自带图片2 j. h* H; p8 n: o0 V! i
  112. + u9 H  V/ y; k& T$ @- F* L' l" A
  113. 该提示可以在脚本内关闭')6 F* c& H2 ^: {  i: a
  114.         MouseShow_Cursor.call(0)+ W7 o, d' }( Y$ h* G( r
  115.         $no_arrowpic_warn = false
    ' h: U5 D6 ?' t" ^
  116.       end
    5 C4 t" @/ @% l. o& v, ^
  117.       @character_name  = '!Flame'
    / l5 ]* E, [9 O! d9 Q; F! i
  118.       @character_index = 6& R: f) k" i2 r3 X- b( |9 h6 X
  119. 4 g( p/ N" H+ Q- n
  120.     end
    + k' R* t% |/ O$ C$ I! c! M+ O5 k
  121.     @direction_fix = false  # 固定朝向
    1 l& p1 W4 X0 L$ s5 r
  122.     @move_frequency = 6     # 移动频率. ]! z8 _/ ]2 w
  123.     @walk_anime = true      # 步行动画  u1 j' }" n# K7 d7 |& |% q1 J" D
  124.     @pattern = 1            # 图案: L8 I% x+ P& {7 m3 u
  125.     @through = true         # 穿透
    9 t2 s1 o) g( ^
  126.     @bush_depth = 0         # 草木深度% |2 ]3 d9 ^% _7 M: `
  127.     @animation_id = 0       # 动画 ID! B& b+ m2 x% d$ ?9 E% t
  128.     @balloon_id = 0         # 心情 ID. c0 q: V4 R/ W& v, L# t4 g1 P
  129.     @transparent = true     # 透明
    ! @0 ]) c: C. K" Y6 s
  130.     @id = 0
    : K' k6 W: z' e2 w' ]3 i8 A
  131.     @x = 0+ k. e: G3 q+ v) R7 f7 M
  132.     @y = 03 ^$ B* R! S( d/ c) z
  133.     @real_x = 0: p, q/ {& [+ m4 ^; }
  134.     @real_y = 0
    % W! r* a$ t1 ^( |2 n( y6 b( e
  135.     @tile_id = 0+ s, N) h1 a( R' r+ r7 G1 j
  136.   end
    + D( |6 k3 c, R" m. ^  i" I! R
  137.   #--------------------------------------------------------------------------4 e4 l1 B! a' s; l; B
  138.   # ● 定义实例变量
    4 R  J% }1 r9 S. Q
  139.   #--------------------------------------------------------------------------" g% R6 M! z* K4 x8 j, E. h1 O
  140.   attr_accessor direction
    6 X9 D3 J0 d; Q1 I3 L+ r
  141. end0 H' l# P& Q& S) o$ f% K

  142. ( u  b6 G( `9 r- }
  143. #==============================================================================
    0 u) h# A+ a% f; a7 b
  144. # ■ Module Mouse
    # i! w/ q8 L& R  U2 K2 @' _
  145. #==============================================================================
    - j& T+ w7 b) p/ Z4 x( w1 X$ g$ b/ J
  146. module Mouse
      k9 x. j' K" s9 V6 r+ u; Q2 O& F
  147.   #--------------------------------------------------------------------------
    . M; i. k$ {. {
  148.   # ● API
    ; F% S$ ^4 ~% Q' d* g3 [
  149.   #--------------------------------------------------------------------------
    6 {( V9 {6 _& N+ T
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
    ) L3 s8 S$ ], W" ?5 A! b
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')& ]0 ~6 m6 H. o$ c  W
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')
    # P$ ^& Q0 B# A0 v+ e
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')
    ( c0 |3 [8 _8 M, @% i& e* ]
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    9 p/ H* X$ |3 s9 [' |- s
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')& U5 b5 \, h1 u/ T) @
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')4 L) [. K6 ]3 y# t# }
  157.   Window_Hwnd       = Get_Active_Window.call
    8 D8 d+ [" ~) ]: \) C
  158. * ?" N% P) k/ ]9 K
  159. class  self
    % A/ j) f) V% z2 K6 W) S2 d- w. ^7 o
  160.   #--------------------------------------------------------------------------
    # M& [! X% [7 }, q7 d' s4 t1 Z
  161.   # ● 初始化9 v: m) J2 z9 Y
  162.   #--------------------------------------------------------------------------/ _+ h9 \8 A, W
  163.   def init& O# I4 _6 h8 I: D0 u
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor. e8 N7 y9 `% E- T
  165.     @left_state = 0- ]& `5 m2 D, h- H" o" _
  166.     @right_state = 0) m" a3 @. D! x
  167.     @ck_count = 0 # 帧数计,单击以后从0开始: z: ]& ?* T( e$ }% [  r
  168.     @dk_count = 0 # 用于双击的判定0 s+ h0 S: A( y* R
  169.     @clicked = false
    $ Z& g3 D3 K7 u
  170.     creat_mouse_sprite, m  N2 O3 p1 S
  171.     update
    $ k+ n9 m' ?; _! \
  172.   end
    8 G  A- P' F/ u) X9 G5 U
  173.   #--------------------------------------------------------------------------
    1 y) }5 }" ~$ X$ T+ N& t, y
  174.   # ● 鼠标指针精灵0 R" i+ m6 a' P) G" D& F* z
  175.   #--------------------------------------------------------------------------
    : v$ ~- M2 e9 Z% A& H# G) Y  t& t
  176. #~   def creat_mouse_sprite* J0 U# B; `6 q  _1 I
  177. #~     ; c; D6 t* G+ Z' y! G
  178. #~       @mouse_sprite = Sprite.new* t% |. g3 ]0 s! N! {: `0 M
  179. #~       panda = 2#rand(2)+1
    0 V/ q! ~) A: h2 ]' s- V* E

  180. * L% p/ K! y, f. u# _& E/ A* ^
  181. #~      if panda = 1
    ! y0 v0 ]9 g# W+ w: m% |
  182. #~        if File.exist('GraphicsSystemCursor2.png')/ k4 L5 H5 r2 w
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')3 U6 t. n3 y3 n+ t
  184. #~        end#with if File.exist
    : h6 B' S" J0 j' b$ p/ ]4 X* p
  185. #~    . n, }* J, ?: b# P
  186. #~     else if panda = 2 #with if panda=13 s; C% m7 i7 z7 ?& r! k
  187. #~      
      K8 q# o7 Y& \/ O0 T9 N7 h. H+ G
  188. #~      if File.exist('GraphicsSystemCursor2.png')5 s+ A2 N0 A& b
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    0 P; b$ n1 J  M! G2 G6 J! L
  190. #~      end#with if File.exist
    ; x; U8 o7 X) \
  191. #~       3 B8 L, P& F8 a5 N6 m! y
  192. #~     else #with if panda=1
    + ]. G# I7 I: F7 l6 o1 c4 U4 ], s
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    # [5 v# _9 O# V; b8 Y+ N5 s% |
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),5 |4 }# b# Y  p
  195. #~       Rect.new(5  24, 24  24, 24, 24))5 W; L- Y) k7 ^  R) K* U4 G
  196. #~     end#with if panda=1
    ; ?) S& l. \2 T  ~/ m9 k
  197. #~     
    & U  G8 F0 Q2 a' F, y
  198. #~     #with def0 r) \- I+ [4 o8 O' g( m
  199. #~   end
    4 \/ B! P9 }. N0 h/ b! H5 u: H
  200. def creat_mouse_sprite
    1 [9 @& B8 S0 Z- f6 Y* ^5 D
  201.     @mouse_sprite = Sprite.new
    + {, [( {" q* `* _  h. L
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})
    2 l' ~9 A$ `2 ~  b+ V( M& h& z) x: G
  203.     @mouse_sprite.z = 99990 F8 F; Z4 Y) b) R7 t" n
  204.     Show_Cursor.call(0)5 x9 N5 j2 W( d0 c6 O5 S
  205. end- N( q5 E; F0 |

  206. # q6 y1 T4 P, E3 o6 J! c. H
  207.   #--------------------------------------------------------------------------  A4 H" s1 A) I" w( {7 X
  208.   # ● 更新
    & A# b0 T; a9 I8 K
  209.   #--------------------------------------------------------------------------
    # v; c" Q5 v% ^+ A0 N+ Z- w
  210.   def update4 v5 y; O' D: m0 F3 s! l. x
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos  U1 g* @) o! P
  212.     left_state  = Get_Key_State.call(0x01)" f1 g# ]; u& G" d: b. R
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0& `6 Y4 d; _( z9 w" y4 w
  214.     right_state = Get_Key_State.call(0x02)
    0 l( ~. l. t# D5 M, }! ^% L
  215.     right_state[7] == 1  @right_state +=1  @right_state = 00 `" R( o5 }( ~! \* x
  216.     update_double_click
    # K! g! w, A* r# L: X
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1
    3 o* D/ h: f% u
  218.   end
    / p* T& |& `: V8 c$ ~* p
  219.   #--------------------------------------------------------------------------9 o5 ?; T. U$ J3 [
  220.   # ● 获取鼠标坐标( o3 w7 `- O7 Y3 q  g/ l
  221.   #--------------------------------------------------------------------------
    7 p$ N5 {# T8 K; s: A, h
  222.   def get_mouse_pos3 Z0 o1 j" J2 K6 d- K1 A% O& e2 g( v
  223.     arg = [0, 0].pack('ll')5 b/ N( D) ^1 |: B
  224.     Get_Cursor_Pos.call(arg)
    9 Z  ?$ v3 i2 E- }4 `9 y/ N
  225.     Screen_To_Client.call(Window_Hwnd, arg)3 I; k# C2 s4 L5 s# O
  226.     x, y = arg.unpack('ll')
    7 r2 V( z/ O& C( \( _6 ?. R8 ]4 ], y
  227.     return x, y
    ; z* `' ]/ K" m0 k) V# D
  228.   end! P& j6 w2 a, c, ]1 `* g* {) M
  229.   #--------------------------------------------------------------------------9 _8 \4 J" S5 l" l' k; o9 u
  230.   # ● 将鼠标固定在屏幕内
    . t6 i# Z0 |- x6 ~0 b* o) Y( [
  231.   #--------------------------------------------------------------------------) ]( Z' w& a# O  K$ K8 y0 J
  232.   def lock_mouse_in_screen
    1 h! W/ r8 Q' T+ e1 _" M/ O) n
  233.     arg = [0, 0].pack('ll')/ U# f' l) V, f
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    3 t$ i, X7 t+ ]7 Y: {2 Y. V( W
  235.     x, y  = arg.unpack('ll')0 ^# c  o4 y& b0 H4 ]' K& Y0 Z
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))' e9 n9 v. ^' ?9 \2 e
  237.   end
    + B' V, z2 {1 {% u8 D. `
  238.   #--------------------------------------------------------------------------
    5 V; |2 S% Y9 R/ t* i1 B9 f
  239.   # ● 解除鼠标固定
    # ?9 U- F" e, S0 u
  240.   #--------------------------------------------------------------------------
    ! _2 Z6 c) j. l" U' V: {/ x
  241.   def unlock_mouse_in_screen
    # Q2 ]9 s7 A, }) G0 w& Y) I% R
  242.     Clip_Cursor.call(0)5 l$ Q# e$ [4 E! X1 n! s
  243.   end
    ) J1 w: V$ m0 {6 a2 P
  244.   #--------------------------------------------------------------------------2 l! @  v; Q' C- u- ^4 k0 s$ t; _
  245.   # ● 鼠标双击判定. [: B: T+ X! r( ]5 B6 @0 j& Q
  246.   #--------------------------------------------------------------------------
    5 R( B! I$ W) N" ]: k2 m: s, L) b
  247.   def update_double_click9 }( M4 F) h( {! L7 J! c" w) U. ?
  248.     @clicked = true if @left_state == 1  o- D" G# O- Q& k, a& n" p5 [
  249.     if @dk_count  0 && @left_state == 12 n6 [5 Y1 H( w& `; a3 i0 h
  250.       @dk_count = 0; @clicked = false
    , M) q; W. I  M  ^5 A9 I
  251.       return @double_click = true
    ! a5 O$ z5 h, j) e* M' P
  252.     elsif @clicked7 V# m! j5 w: Y7 p9 S$ P
  253.       if @dk_count  KsOfSionDbclick_Frame1 V9 A! S% M5 B5 z
  254.         @dk_count += 1
    # _" Q2 H2 |6 ^  N: ?
  255.       else
    ( U( P1 u4 Y% _8 Z% a9 n
  256.         @dk_count = 0; @clicked = false4 ?' K) a4 }/ |, y3 v
  257.       end
    1 _* o" A3 Y; v6 M
  258.     end+ e9 l# k/ [: i7 }7 `
  259.     @double_click = false6 L( u8 }* T1 a% F: O* }
  260.   end$ S4 ^' v8 j' g" U# P7 ~0 T, J- j
  261.   #--------------------------------------------------------------------------9 ?1 L* V9 Z! |* a- {* k+ H! i
  262.   # ● 按键被按下就返回true
    # [! E/ C0 D4 G3 r6 P: j2 _' O
  263.   #--------------------------------------------------------------------------; Q, D% ^7 ]) f" |
  264.   def press(button)
    , _& p4 L; T  O* u/ c0 f* d  p
  265.     case button; Z/ m8 f% @5 a9 H4 q
  266.       when 0x01; return !@left_state.zero1 h. F9 G3 z1 M9 @8 x/ n! g, m. Z
  267.       when 0x02; return !@right_state.zero0 M0 o) _5 D$ U, P
  268.     end
    7 [' d1 R& t- c7 T8 ?1 c0 L
  269.     return false
    3 j$ G4 c. W6 E) K" T2 G3 z
  270.   end
    & U1 _9 ^) V  f; p/ x
  271.   #--------------------------------------------------------------------------  O& C$ Z$ p! Y7 K/ l4 B
  272.   # ● 按键刚被按下则返回true0 M6 D  R5 ]9 p" f# `
  273.   #--------------------------------------------------------------------------
    ( ?$ |1 Z" [4 H3 T! \0 J( A
  274.   def trigger(button)
    5 f7 a% }# t2 K' b
  275.     case button9 j2 ~: Y5 K- r5 P  c& e
  276.       when 0x01; return @left_state == 1
    ) l) u9 X  ^: q8 b0 W" K$ N
  277.       when 0x02; return @right_state == 1
    & c9 N" H0 u, e  [9 C
  278.     end
    6 ~5 v/ T" v9 Q
  279.     return false5 m! Z3 _' Q* H6 Y! x3 @
  280.   end
    ; g! [( G- L6 O. [( c& y. {
  281.   #--------------------------------------------------------------------------
    / c5 t. u( Z1 d1 w( U. D3 {) N: Z" t
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true+ w& T8 F+ ?/ g# K* n
  283.   #--------------------------------------------------------------------------
    1 u* D- x+ t2 z/ ~: E" _0 C
  284.   def repeat(button)
    ) _- ]2 |7 b1 t" P, {% M5 r
  285.     case button5 E7 J& O1 j* e
  286.       when 0x01; return @left_state == 1
    4 c! b3 O# y: e3 b/ M
  287.         (@left_state  22 && (@left_state % 6).zero)& Y" w1 t6 [8 R3 g0 M6 z5 g
  288.       when 0x02; return @right_state == 1 4 [4 [" o  }/ a# P
  289.         (@right_state  22 && (@right_state % 6).zero)9 a$ O1 e+ U" ?) M6 h$ c/ B
  290.     end
    . _  T4 ?* t1 g5 X" r! P3 r
  291.     return false
    - p' }9 U9 t- D4 W
  292.   end
    4 a* @+ ~3 l$ U( n6 l4 a
  293.   #--------------------------------------------------------------------------
    : C1 B& Q, U6 \3 U+ b
  294.   # ● 判断是否双击鼠标) u$ b! W; _% l* P" c
  295.   #--------------------------------------------------------------------------% Y) k. ^4 K- B- Q  U
  296.   def double_click
    ) k; B; X" a& _; l$ A1 ^
  297.     @double_click0 J" F2 u+ N( g7 R' ^3 |
  298.   end& u& ^5 `) w4 b, O
  299.   #--------------------------------------------------------------------------
      S2 M. J4 y5 h% H8 ^$ y7 Y* E
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)
    5 A7 Y$ N# a: P+ A+ J
  301.   #--------------------------------------------------------------------------" e$ X9 b; h% O8 i0 e/ {/ I
  302.   def click_count
    & s! q+ N6 @. e2 D9 z) i7 L
  303.     @ck_count6 S1 v$ V0 [$ Q% h* P! W
  304.   end7 ]- b; }) j/ G
  305.   #--------------------------------------------------------------------------
    - a+ \% L3 Z7 a5 b2 S, Y8 D6 Z
  306.   # ● 获取@left_state(按住左键每一帧+=1)8 ~2 S* y; V' V$ Y) X  l
  307.   #--------------------------------------------------------------------------* M8 E' V0 L2 m* F* @* q. d
  308.   def left_state( l1 m3 E: p; f  f* e0 x
  309.     @left_state: n; G+ _% C! k- D: a+ B' X2 Q# B
  310.   end
    8 d: e: r- E+ M/ |# z
  311.   #--------------------------------------------------------------------------: z- }+ r0 i2 [- B- C( g
  312.   # ● 获取鼠标的x坐标
    7 X- H& B* n) ]; |. L" J
  313.   #--------------------------------------------------------------------------( v4 q* E9 `0 F) @  \
  314.   def mouse_x
    * a# R1 k& P( b; ~
  315.     @mouse_sprite.x
    ) t$ H4 l2 @& k6 X! g$ j
  316.   end+ `% D" J+ O9 B5 G  f0 E- V
  317.   #--------------------------------------------------------------------------
    ( v6 t+ n6 v+ _3 G
  318.   # ● 获取鼠标的y坐标
    ! v' U: b0 s9 a" U" q/ [- M" B
  319.   #--------------------------------------------------------------------------1 B: c# |" r! D8 m& Y% P
  320.   def mouse_y& P  m' r2 E1 ]: X
  321.     @mouse_sprite.y
    . |3 ]9 b# h3 g* b( r2 A
  322.   end! W3 K/ ^% }# T0 j' U! ]  j
  323.   #--------------------------------------------------------------------------
    , ]# Y- d& W+ Q
  324.   # ● 设置鼠标坐标
    # U" c- C. g' X" D9 a, S; a
  325.   #--------------------------------------------------------------------------
    / G# {2 x- F# s) {9 k8 ~4 Z3 S
  326.   def set_mouse_pos(new_x, new_y)& E; b/ e+ I" x3 w% u; U6 c2 c
  327.     arg = [0, 0].pack('ll')
    ) ]: j' ^; [7 @
  328.     Screen_To_Client.call(Window_Hwnd, arg)$ y8 B* g9 h, T' T" H, Z) i& O1 h
  329.     x, y  = arg.unpack('ll')
    ! ?* m# O. S0 }1 H
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)' d% L& g/ k: a
  331.   end
    % y: x: k3 V2 ?: t8 \6 g: }5 |
  332. end #end of class  self - y% j, x  G/ V0 n1 M$ w6 U

  333. * F. I( I' ?! k# w" _+ o
  334. end
    5 O5 q; _; e  I7 }& G; D4 u
  335. % h' u: E7 a, c# F: r
  336. #==============================================================================6 F1 ~% S8 M- N: U6 g
  337. # ■ SceneManager
    5 }3 q- w' _- L! p( |
  338. #==============================================================================! p0 ], _8 _/ f* M# [7 ~
  339. class  SceneManager9 R, f% f: M5 J% `4 R; v2 \. \
  340.   #--------------------------------------------------------------------------, N& n7 o9 x6 z, v  x' [
  341.   # ● alias
    ' M' o# E( ^5 O
  342.   #--------------------------------------------------------------------------
    8 R4 z0 ^% n) k7 X  j$ c
  343.   unless self.method_defined(sion_mouse_run)
    / ~( v. H: N7 F, Q
  344.     alias_method sion_mouse_run, run; w7 M) ~( a1 U* R. E1 q! E
  345.     alias_method sion_mouse_call, call2 |" e- G0 W* \
  346.     alias_method sion_mouse_return, return
    # R" [6 Q5 g9 b" V  f$ r/ Q6 X
  347.   end
    " N# \* X  N! D4 g( R6 @- o5 X
  348.   #--------------------------------------------------------------------------' U9 M- R+ Y& h6 f. b3 v5 _7 P
  349.   # ● 运行
    9 e& F  j1 p- \- L. B% b
  350.   #--------------------------------------------------------------------------
    4 Z6 [! ~- r  F
  351.   def run
      v1 o4 }& Z9 A) r7 `8 t; L
  352.     Mouse.init
    & W, A/ t4 w7 C' X& w
  353.     sion_mouse_run0 F# S1 i: N& J/ c( I7 s
  354.   end! B" K$ g8 \3 \1 F5 M2 M
  355.   #--------------------------------------------------------------------------
    + C. p2 a+ T4 `
  356.   # ● 切换
    * `% {1 Y5 A' e/ h
  357.   #--------------------------------------------------------------------------
    3 k5 J' I0 Y# w9 E
  358.   def call(scene_class)5 i. S4 a; l( |5 @! j
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)
    ! ]) d: K& z) H- O, B. m
  360.     sion_mouse_call(scene_class)
    5 Z7 b8 A9 ^+ {- V8 W( s
  361.   end
    / |4 f2 [0 Y% v. }& p9 @
  362.   #--------------------------------------------------------------------------2 a7 b) F6 g5 N% T% _; K
  363.   # ● 返回到上一个场景
    5 y  S4 G: P, H
  364.   #--------------------------------------------------------------------------
    $ U+ R4 g4 X8 j$ r0 x& o- U$ ]; k: h
  365.   def return2 d& n$ T. l$ B& J% l
  366.     sion_mouse_return
    7 m- I9 B) b- d: L+ n
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&6 T9 ~8 Q# }# m: E3 I
  368.       @scene.instance_of(Scene_Map)
    ) h& y/ q8 h& \' e
  369.   end) O) ]: ]8 I9 Y" X! `- W, x
  370. end
    # C% W! k8 q/ J& U6 s6 _4 O

  371. % C0 |/ J  ^9 S* P* `+ j- Q
  372. #==============================================================================( i  A: m$ P7 n: A# `, I
  373. # ■ Module Input
    6 j' b% W8 _- P& D
  374. #==============================================================================
    # c( N, n1 A( m; y
  375. class  Input
    # O! s1 H+ o+ ]9 E& z
  376.   #--------------------------------------------------------------------------7 E% ~, b5 l3 {& [3 [- L1 m
  377.   # ● alias' r1 M5 S1 I- A! _( c+ X
  378.   #--------------------------------------------------------------------------! u8 ^) Q7 F1 l
  379.   unless self.method_defined(sion_mouse_update)  J% z( m' A% R) V+ ~" S
  380.     alias_method sion_mouse_update,   update
    ) S! H6 `& l  J8 u
  381.     alias_method sion_mouse_press,   press
    0 v; c# e) V0 c: A: S% @
  382.     alias_method sion_mouse_trigger, trigger
    ( d& c; @% h  e0 h$ U8 F& q4 F
  383.     alias_method sion_mouse_repeat,  repeat
    & U1 I, ?$ E. ~7 A0 E
  384.   end
    9 _4 b( W4 A8 h3 M1 t% Q
  385.   #--------------------------------------------------------------------------
    ! x. _+ o1 b6 s! O' u( M$ O) T& p
  386.   # ● 更新鼠标
    9 a1 a3 S/ t3 Y9 P4 t# t
  387.   #--------------------------------------------------------------------------5 R8 P4 I2 Y$ A; S
  388.   def update9 d0 \) F' p0 E3 S8 l- }( \3 M
  389.     Mouse.update7 x' z  G( a% c: E, ]. p) a0 D
  390.     sion_mouse_update  Y: |4 L9 |& y, o' ]! {
  391.   end1 K+ E! H* H3 U& A% }6 e8 T
  392.   #--------------------------------------------------------------------------( x* m) R8 v- x1 K
  393.   # ● 按键被按下就返回true
    9 p1 g- t- D- d2 |" ^
  394.   #--------------------------------------------------------------------------
    0 z; T6 A7 d- A
  395.   def press(key)1 o+ _! l! H3 |8 A
  396.     return true if sion_mouse_press(key)3 b2 G; Z( s! @! F2 ?( Z
  397.     return Mouse.press(0x01) if key == C
    $ {' p6 y( F# c. M$ y
  398.     return Mouse.press(0x02) if key == B
    . |1 k& ]6 r( j, O  ~9 O3 F% W3 }5 A
  399.     return false' T) @4 h1 @. y3 p3 d( {
  400.   end
    4 E! Y+ Y+ r/ W
  401.   #--------------------------------------------------------------------------) K7 n0 x; S: u! h8 n" r) J
  402.   # ● 按键刚被按下则返回true
    6 ~% J/ y- T, a6 z" c
  403.   #--------------------------------------------------------------------------7 t! |4 A8 l) k+ s: z7 v. y
  404.   def trigger(key)
    + X! j8 m# p' M8 V; G6 Z# p" F
  405.     return true if sion_mouse_trigger(key)5 d( k8 C: ^3 K6 k5 ]
  406.     return Mouse.trigger(0x01) if key == C
    ) M& f7 v5 S$ P# s; Z8 M- g# S. a
  407.     return Mouse.trigger(0x02) if key == B4 C1 `# I* a3 G1 h" Q( G$ J# Q& I
  408.     return false
    ) [" f0 K) E1 a4 a4 s- s, M  t9 z
  409.   end
      A: O" ?: p. x: G
  410.   #--------------------------------------------------------------------------) {7 l, V4 `0 E# k
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    1 b  R4 a8 F9 a% T' M2 J
  412.   #--------------------------------------------------------------------------1 M0 {* y. f) q7 c" L4 ^
  413.   def repeat(key)
    ; X+ X* @2 ?# }' o6 r4 Q
  414.     return true if sion_mouse_repeat(key)7 g6 R& I4 i. z( w) S
  415.     return Mouse.repeat(0x01) if key == C: m2 `3 i$ t: z' \( P1 H
  416.     return Mouse.repeat(0x02) if key == B
    - A% k  o% y- ]6 Y9 `  T9 ]* }# W
  417.     return false+ k, g' O4 C, s, T' |* S  n& J- d0 J
  418.   end
    4 W; ^: D% B. P! }5 H
  419. end  l* R" F8 Z% I0 M
  420. " F$ M: u0 f0 C
  421. 9 }9 }! b! e$ r3 R. P
  422. #==============================================================================
    $ j0 J: z/ Y: S5 Y& v6 P5 F
  423. # ■ Window_Selectable- M+ Z- `& n" G, C4 L% C
  424. #------------------------------------------------------------------------------
    & D- D" @6 [$ F6 U/ a( L8 C% m' q1 L& v
  425. #  拥有光标移动、滚动功能的窗口
    ! z5 l) o8 [: q# Z
  426. #==============================================================================
    ; F& m. W+ L4 F$ z, u" j
  427. class Window_Selectable
    . ?, b- Q; X# c* i
  428.   #--------------------------------------------------------------------------* b# ~: m3 s- H2 ?3 g
  429.   # ● 初始化( m! U# I* S& [" v* o4 f
  430.   #--------------------------------------------------------------------------
    - P$ F- e+ d7 A- \) A7 ^+ e
  431.   alias sion_mouse_initialize initialize! M. L; I1 K6 h$ t: r
  432.   def initialize(x, y, width, height)
    . T9 {* X& \4 e( l6 A; q; O
  433.     sion_mouse_initialize(x, y, width, height)+ t3 C6 `8 J* @3 H4 T
  434.     @move_state = 0. |. P. G  {( y& a) D0 `
  435.   end
    2 h  U) R+ _, H5 n3 K, {% A) ~
  436.   #--------------------------------------------------------------------------& N- N$ w! `% n' T
  437.   # ● 更新
    + A; K9 O5 z! b1 c
  438.   #--------------------------------------------------------------------------
    8 o) ]/ s. y( N1 m& ~# P* u
  439.   alias sion_mouse_update update
    8 a; S+ O- G. e8 f4 g- v1 B
  440.   def update2 B" F; s! m5 Z" {, g$ G
  441.     sion_mouse_update! F' c) R: k, ]( x
  442.     update_mouse_cursor5 M/ h$ S& T' |# |; w
  443.   end! j1 v7 v! [6 W! h
  444.   #--------------------------------------------------------------------------( B- r; l" v. g$ U+ {5 z/ H
  445.   # ● 启动后设置鼠标到index位置
    $ h. l; e! ?/ a9 l6 ~
  446.   #--------------------------------------------------------------------------
    : s" m# ^$ [7 u3 N: ?" A4 C
  447.   def activate* G. M' u& L3 T" u/ i' V  U9 c6 G
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos. }5 y4 A, R3 e6 |; I7 `
  449.     super
    ( L8 q' `9 m9 n! k% y: e' N. R
  450.   end
    2 @" ^2 [+ ~, N- y# K
  451.   #--------------------------------------------------------------------------
    , I1 e% P; m! {& Y
  452.   # ● 更新鼠标和光标的位置) f* ^  O: T$ h# A# c
  453.   #--------------------------------------------------------------------------: f% v5 {- v) X
  454.   def update_mouse_cursor
    4 |4 @* M- x' Z9 N  ~4 _( o
  455.     if active
    2 A3 w# `# i7 S* N4 T( I
  456.       if @need_set_pos" t; K0 f: P) O/ }. k- g
  457.         @need_set_pos = nil
    - Y, e3 C/ O, m3 Z
  458.         set_mouse_pos8 c3 n3 L& n) p7 ~+ k& z  i
  459.       elsif cursor_movable
    " ~5 J. y; p2 h6 U0 y; J" v5 E
  460.         Input.dir4.zero  set_cursor  set_mouse_pos+ W* e7 p9 `' m* L
  461.       end8 U. `% u. N* h! c7 X8 B0 `/ Q
  462.     end4 d, n: g/ V/ ?& h
  463.   end$ l0 c, i* o9 y6 I
  464.   #--------------------------------------------------------------------------
    + _) T0 U5 k8 x  S. r
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能. t3 K6 g: s) X, l8 |
  466.   #--------------------------------------------------------------------------
    ) b8 M  P6 J$ f& K
  467.   def set_cursor4 N4 m! b  ?, P: E2 P9 U8 E: A
  468.     mouse_row, mouse_col = mouse_window_area8 ~; ]9 k- T6 J! y- U9 c% G, {( Z
  469.     if    mouse_row == -1
    2 A: k4 _, V$ Z3 |
  470.       @move_state += 1 if need_scroll7 o! @0 n" t+ M8 ]6 r6 @2 F
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand7 v$ d) d: F8 W0 r2 d+ p2 H  u; a
  472.     elsif mouse_row == -2
    1 [( k4 c" h% u
  473.       @move_state += 1 if need_scroll1 i* A: P8 ~/ R% Y( v$ q+ @
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    . @' s! R) [; X8 Z
  475.     elsif mouse_col == -1
    # i1 o0 K, y3 y8 ]
  476.       @move_state += 1 if need_scroll
    % m5 t6 |* o" p% l
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    6 I$ R; ~5 Y# M1 J
  478.     elsif mouse_col == -2
    1 s8 j. K2 R, @  u3 ]! v4 v
  479.       @move_state += 1 if need_scroll
    8 k6 D& D, m# ?0 O7 X0 g/ }7 Z
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand% F; |9 b" [% b
  481.     else5 F/ p; h9 m) e8 x% k9 V
  482.       @move_state = 0" x4 s0 K$ K8 |
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col
    $ o7 k6 e5 G' H0 X
  484.       select(new_index) if new_index  item_max && new_index != @index
    5 R- ?# u6 n7 t0 r8 @' E8 w- X
  485.     end( E, w7 s* Z* G' I. I# [+ C
  486.   end
    , |: u( A) H0 r' l" B" G+ u
  487.   #--------------------------------------------------------------------------/ @" e/ v+ q; j# y9 j
  488.   # ● 判断鼠标位于菜单的第几行、第几列, M5 h( w  D9 A# O3 n1 l
  489.   #--------------------------------------------------------------------------
    1 [" M; t, C; l
  490.   def mouse_window_area
    ( I9 w. F, o5 J8 s" |8 `& c$ k
  491.     if viewport.nil # necessary!) z8 |( {- d2 f" M0 Z
  492.       vp_x, vp_y = 0, 0: O' z% M- p! z) B6 ^' Y
  493.     else
    ! m( I) _. {6 l, G: N& N3 b
  494.       vp_x = viewport.rect.x - viewport.ox
    6 }/ {4 e% F. l! K5 w
  495.       vp_y = viewport.rect.y - viewport.oy" {( B: w# Q8 i5 z9 g. p* c/ X
  496.     end# Q8 u- ]' b7 ]" v: Y9 I* f
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    . j8 R, T' C' ?9 h
  498.     item_x1 = vp_x + x + standard_padding 1 W; g( z3 z2 i/ B7 {2 _: l# y) Z( T
  499.     item_y1 = vp_y + y + standard_padding+ n) i6 l3 U3 s4 c/ k) n- ]
  500.     item_x2 = vp_x + x - standard_padding + width
    : |" J1 A  z/ N$ M9 M. A  n
  501.     item_y2 = vp_y + y - standard_padding + height" Q/ f8 l  O3 Y6 Y0 k1 A
  502.     if mouse_x  item_x1
    % s8 `* I! o2 U, Q4 `
  503.       mouse_col = -1
    # r7 B0 r" }/ F+ A) l
  504.     elsif mouse_x  item_x2
    $ f# u5 O* g; R! ]% b
  505.       mouse_col = -28 M. a; S* h6 e- N7 p8 x
  506.     else
    $ M# ]/ ^) K0 ]- w  U; ~  O
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)
    ' V0 Q  O7 w' ]. b- V$ x5 L, S
  508.     end& w' i- b. b6 H9 Q
  509.     if mouse_y  item_y1
    # m8 P9 }8 n% i) H9 e" `: U
  510.       mouse_row = -1
    / o$ i* q- u+ M
  511.     elsif mouse_y  item_y2
    / b; t: m# X3 O7 L! \- A, n' P/ F
  512.       mouse_row = -2) L# ]* f. z3 f1 ~
  513.     else8 c% d/ r- ~0 U3 k! i% M
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    2 k, S( @0 j- q  _1 N
  515.     end
    0 U2 S5 ]( O' e: g9 h4 P" z
  516.     return mouse_row, mouse_col8 h* F9 R7 z7 w4 B
  517.   end: S% n% |8 m! ^4 H, Y
  518.   #--------------------------------------------------------------------------
    1 _! f0 n" ]+ L+ B- {
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置* E8 I5 l4 O$ h
  520.   #--------------------------------------------------------------------------
    ; W! R! ^6 K6 \
  521.   def set_mouse_pos5 [2 E& N, h" R. z3 d
  522.     if viewport.nil # necessary!; q0 S* _* v1 t. U( \% i
  523.       vp_x, vp_y = 0, 01 `3 A) Y" e! V
  524.     else& m- y' v+ D1 p
  525.       vp_x = viewport.rect.x - viewport.ox5 M5 S2 ^  }; l
  526.       vp_y = viewport.rect.y - viewport.oy
    5 J* `! D) J5 W$ X* ?+ y
  527.     end
    6 ^! D( q  @; _3 Z& t2 o% c: }
  528.     item_x1 = vp_x + x + standard_padding / V( u$ v" U* C: c3 y$ N  d
  529.     item_y1 = vp_y + y + standard_padding3 \7 }8 {! F2 A& t8 Q4 F
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
    2 m- R6 W- g7 a( f7 X' v
  531.     row = get_index  col_max - top_row  Y  v5 _4 b( O9 t
  532.     col = get_index % col_max
    , S# ~3 A/ A& e% _& F3 w# a
  533.     new_x = item_x1 + item_width  (col + 0.5)6 W( w) {3 X0 j5 F0 S% R3 ?! g
  534.     new_y = item_y1 + item_height  (row + 0.5)6 L8 U: A: \# n& c' V( ?/ X
  535.     Mouse.set_mouse_pos(new_x, new_y)
    , Z, I& U( {0 U1 M/ ?
  536.   end* I8 o0 e5 @3 Q; G8 k% Q5 u
  537.   #--------------------------------------------------------------------------
    ( I1 s! D9 E0 P: J4 K2 O1 z
  538.   # ● 判断菜单是否需要卷动
    5 ^- m, l4 N( [2 P
  539.   #--------------------------------------------------------------------------# H3 n+ L' B- w
  540.   def need_scroll
    6 S& H0 @: {2 e% `8 T, y% e. c
  541.     item_max  col_max  page_row_max
    ( H/ o+ _% s& _$ u8 W$ P. c
  542.   end" X: L. H& Z3 w+ z
  543.   #--------------------------------------------------------------------------
    5 [5 O+ ?3 y0 w+ W! \
  544.   # ● 判断是否为水平卷动菜单' B6 b& K7 V  k6 \" L1 ^% }
  545.   #--------------------------------------------------------------------------9 |4 @- A$ c3 W. Z4 Z4 `* h$ H8 F; _
  546.   def is_horzcommand* V7 y2 c3 }- k5 B- _
  547.     return false
    ) D# \! P) M' B& Y7 N' f  c; [3 @9 |
  548.   end
    + }) V8 a$ p* R6 z' Z& _' P
  549. end
    / `; t. c3 V$ z

  550. 2 @, s4 n" V5 Y( _
  551. class Window_HorzCommand" k' g2 ]+ R$ A% ]
  552.   #--------------------------------------------------------------------------
    / U: ^7 E, B! _6 B% n- _8 A
  553.   # ● 判断是否为水平卷动菜单% ~5 M; m6 A8 C) |* R
  554.   #--------------------------------------------------------------------------
    , ?, v) d4 L8 V; i( _6 `
  555.   def is_horzcommand+ q% W5 m5 O" L3 l- e& }  m
  556.     return true
      N- Z, A6 i' S9 f" i
  557.   end
    4 t; y7 \2 j2 m3 |, C5 m9 J
  558. end8 |+ G; V6 X/ n2 N& x

  559. * a) R5 A/ L* _# `
  560. #==============================================================================8 p- z' T3 c" U+ {8 m' E* k
  561. # ■ Window_NameInput: K8 u' a3 d# u, f) n" B5 _
  562. #------------------------------------------------------------------------------, \& y* t$ _  t- @- k" F+ l# A
  563. #  名字输入画面中,选择文字的窗口。* ]: }6 @- k3 w) ]
  564. #==============================================================================2 U) }3 b& s" n9 G# g
  565. class Window_NameInput8 S" C  I; B( s1 p7 V7 q5 B
  566.   #--------------------------------------------------------------------------
    ; g  t9 {; ]; c- h: x2 \
  567.   # ● 设置列数/ s/ G0 O9 |: N1 l$ _( {
  568.   #--------------------------------------------------------------------------
    ! v7 O) E- L+ i  O; S/ c
  569.   def col_max
    & p6 `! v, k# p2 j  E2 T: p  T
  570.     return 10
    # R4 e- l0 E' P3 ~! J# T1 T
  571.   end/ x4 F2 b# q/ U+ A
  572.   #--------------------------------------------------------------------------
    & B" F( o. L. I0 L' ~  n) }
  573.   # ● 设置填充的Item个数3 ~$ F# Q& `1 }& M3 l9 t6 |& W7 _
  574.   #--------------------------------------------------------------------------
    & \( [) ~  h) E3 {, O
  575.   def item_max
    " K' o6 P" Z' M& E6 J% E
  576.     return 90
    1 d3 S; j5 g: f/ r4 q. i* }
  577.   end9 F1 S" y$ e/ E
  578.   #--------------------------------------------------------------------------
    / H( c$ ^& T0 T. f1 |2 E
  579.   # ● 设置填充的Item个数; a  K" }2 f. t+ Q4 y( X+ x
  580.   #--------------------------------------------------------------------------
    * F. B) w: c+ v! \0 T( X+ \: d# r
  581.   def item_width
    & x& O$ L$ U" [5 m' f- G
  582.     return 32& _6 m* @1 v3 h9 p# _! H
  583.   end; A# X4 J! S, |9 f
  584.   #--------------------------------------------------------------------------
    - j5 p' Y6 X# S. V6 A
  585.   # ● 判断鼠标位于菜单的第几行、第几列/ D! w& A/ @2 Q. O  }/ _
  586.   #--------------------------------------------------------------------------
    0 P" {+ O$ A2 V4 l; I+ F
  587.   def mouse_window_area
    0 r& _0 l6 O( T2 |( C/ g5 K' i
  588.     if viewport.nil
    7 O6 k; i. g  O9 Z7 c' z
  589.       vp_x, vp_y = 0, 0
      n+ Y* ~6 U2 A: t4 F; \5 [
  590.     else
    * V# Z, W4 a( @: T2 B7 Z+ \; ]
  591.       vp_x = viewport.rect.x - viewport.ox$ f8 i" x: e1 t; y. t4 w# W
  592.       vp_y = viewport.rect.y - viewport.oy6 t4 m2 B0 {, E7 J9 Q
  593.     end
    3 j, {' _$ g7 h' O9 K
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    7 i1 G. B4 A+ t# q4 o( e! t1 }& W
  595.     item_x1 = vp_x + x + standard_padding / ~5 O4 R& r" o; o7 h& _8 v- I7 j
  596.     item_y1 = vp_y + y + standard_padding
    % v3 K$ |& ^- i* k' i, B; Q
  597.     item_x2 = vp_x + x - standard_padding + width
    1 d! _8 `7 {3 [
  598.     item_y2 = vp_y + y - standard_padding + height# Q# h! {' W9 n% P+ n) a* g4 d) m
  599.     if mouse_x  item_x1
    " U3 h! ?( x/ b: g9 O! x3 K
  600.       mouse_col = -1& G6 i& F' G+ X& a, a+ j
  601.     elsif mouse_x  item_x2
    8 e" c% z* u, q" I; M
  602.       mouse_col = -2) x5 ~3 j5 \6 m5 O. a
  603.     elsif mouse_x  item_x1 + 160
    7 F$ }/ f# ^4 \" J
  604.       mouse_col = (mouse_x - item_x1)32% m! D7 i5 o- ]2 _) A+ T
  605.     elsif mouse_x  item_x2 - 160
    6 @- \$ Z4 |6 }! U( @2 O) I
  606.       mouse_col = 9 - (item_x2 - mouse_x)32
    " K' O. h9 Z- f% o# {
  607.     else7 `, |' @( s! e, B# L
  608.       mouse_col = mouse_x  x + width2  5  4
    & @9 ^7 T$ z0 \1 r% V3 R- _% ?) \
  609.     end
    ! {- P: K; v# D' G# h
  610.     if mouse_y  item_y14 W% G7 M# d9 H. X
  611.       mouse_row = -1
    2 a4 ~& \, B' O- F
  612.     elsif mouse_y  item_y2
    . F. |3 @8 m+ U  O0 Z0 f6 G
  613.       mouse_row = -2
    6 Y2 c5 U! R/ z( k0 A( H* x
  614.     else
    ' K) f4 X3 ~# g
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)- I! }7 p, J$ M$ H
  616.     end5 y( t( ^  `9 K! i: P
  617.     return mouse_row, mouse_col
    ) X$ b* n7 f- D1 X4 C2 W5 b( J! C
  618.   end
    + [4 E7 H: `4 x2 V  k+ f
  619.   #--------------------------------------------------------------------------
    2 z0 N5 C1 }6 `2 A, X% _" o
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置4 D7 O- N7 c5 ^6 n6 D
  621.   #--------------------------------------------------------------------------
    1 {0 B2 i7 B( b9 h
  622.   def set_mouse_pos
    % M) R+ x( B& e4 g
  623.     if viewport.nil # necessary!" x: O' N. v0 q$ @
  624.       vp_x, vp_y = 0, 0
    " V5 E3 ]; Q) Q  o  y$ d2 v' O
  625.     else& L( W% G2 }4 I2 l
  626.       vp_x = viewport.rect.x - viewport.ox
    / a- h) J) @% Z9 G8 G8 q% B) x
  627.       vp_y = viewport.rect.y - viewport.oy, D1 S" w9 B9 _0 N
  628.     end  }6 }# l- y! V' l
  629.     item_x1 = vp_x + x + standard_padding ' B' B9 @" i, T: X. b+ J" i
  630.     item_y1 = vp_y + y + standard_padding- m9 x+ I; ]+ d+ o; N
  631.     get_index = @index  0  0  @index * O6 m0 S, ^* [) M: Z/ \
  632.     row = get_index  col_max - top_row
    7 l1 [3 i( U9 K! Z7 I% X
  633.     col = get_index % col_max
    - ~8 z, K  v7 O* A9 g9 J
  634.     new_x = item_x1 + item_width  (col + 0.5)
    2 `# U! n+ b8 K  O3 ?* i$ X
  635.     new_y = item_y1 + item_height  (row + 0.5), `  V5 T$ L& J! D  s( P
  636.     new_x += 14 if col  4
    ( a, h- R3 D% d- l6 q! t. a/ e
  637.     Mouse.set_mouse_pos(new_x, new_y)6 R' |0 i( `+ B/ \* R  G0 G6 z
  638.   end! J/ P, n  p+ J4 Q# o/ b2 l
  639. end
    4 r: i; z1 p0 H* B

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

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

  2225. 1 [$ D& H0 G( J5 V  V" S
  2226. #==============================================================================
    ( z6 k& P; f) R, V. d
  2227. # ■ Spriteset_Map
    ! b/ {' V0 d: ]% `* c7 C
  2228. #------------------------------------------------------------------------------8 e0 O, q0 F. A5 {% V
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。
    - T/ B- L$ z5 m
  2230. #==============================================================================
    + R9 e, F: F. {* ~6 b0 k& x
  2231. class Spriteset_Map
      e+ I3 }$ Z; M/ }. ]
  2232.   #--------------------------------------------------------------------------
    - d$ b6 ]. {1 B9 s
  2233.   # ● 生成路径点精灵. R3 Y3 c0 `- V
  2234.   #--------------------------------------------------------------------------3 X1 d' _: ]& S% c6 }
  2235.   alias sion_mouse_create_characters create_characters, W2 Z) X2 s2 y: B# b1 H
  2236.   def create_characters
    ( T7 M' n+ _; Q) D. a, t5 H
  2237.     sion_mouse_create_characters# O6 x6 K# F/ i" ]5 y% @: {3 u
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))7 c+ \& e3 X. Q
  2239.   end
    2 `3 T5 J6 u7 A7 t  _* T
  2240. end
    ; q1 v) ~" B# u7 {/ E: o5 S
  2241. ' Q+ h# V! `: P
  2242. #==============================================================================' z. {2 U! W, {% H/ A
  2243. # ■ Scene_Map7 b) h' u) e% p: z8 }$ z- [
  2244. #------------------------------------------------------------------------------
    3 g' k3 l" L. u: ]
  2245. #  地图画面
    3 d& `9 l( F8 s  T
  2246. #==============================================================================. Y/ |5 O3 W6 t; ~; t9 z( ^0 b
  2247. class Scene_Map  Scene_Base
    ' E$ ~) S. D# Z, `/ a4 s' O! F/ H& U
  2248.   #--------------------------------------------------------------------------
    ' o" a9 ~9 Q% d2 [0 q1 a3 n
  2249.   # ● 画面更新  M9 m0 j9 X8 Z
  2250.   #--------------------------------------------------------------------------7 c! i: O0 Y" ^- |3 v
  2251.   alias sion_mouse_update_scene update_scene
    7 r8 W9 U9 N! H' F8 M* E  Y
  2252.   def update_scene
    / Q. A, X+ O% }% U" S* X
  2253.     sion_mouse_update_scene
    * }' s/ E  _0 \5 h
  2254.     update_mouse_action unless scene_changing
    , |* p, P' Q1 j
  2255.   end: b3 v, ?6 k3 s  m; P! o7 D
  2256.   #--------------------------------------------------------------------------# x& D+ @0 p# F+ l5 W6 i
  2257.   # ● 场所移动前的处理
    , t1 X8 p7 v; X4 C- v: P
  2258.   #--------------------------------------------------------------------------% w* }' g2 P8 ]2 y' F& |) X
  2259.   alias sion_mouse_pre_transfer pre_transfer
    & X# @  M1 j' I8 R) D7 r5 D$ O* U
  2260.   def pre_transfer
    # b* f# r$ }3 I4 J5 [+ I
  2261.     $game_player.reset_move_path
    : p" K: B4 f! R6 o. b
  2262.     sion_mouse_pre_transfer
    % J6 ~( _& B) N8 h0 z
  2263.   end7 M1 @! P/ k: V+ a: X
  2264.   #--------------------------------------------------------------------------
    % O$ ]2 L: I1 k( T- P! V
  2265.   # ● 监听鼠标左键的按下" _, d* B6 Q: s% j
  2266.   #--------------------------------------------------------------------------" P6 q0 }. v. b( \, _& Q+ P
  2267.   def update_mouse_action9 b5 M% Z, \) k
  2268.     $game_player.left_button_action if Mouse.press(0x01)
    8 n; X. ?0 h/ q' I3 P+ A3 b
  2269.   end5 T% Z" n# c5 y: J
  2270. end9 V# r( E8 C- \

  2271. ! v: h" f- r# d6 g7 ?  o) k$ y
  2272. #==============================================================================& p. M& F: _  l# z) x
  2273. # ■ Scene_File
    ; a( p; ]8 h. r, T; S5 d
  2274. #------------------------------------------------------------------------------( B; w$ h' {/ o4 l
  2275. #  存档画面和读档画面共同的父类/ g4 A$ e. F9 a3 p6 z# O! R
  2276. #==============================================================================
    9 q: `; x. X6 g: t+ U. {6 H: J
  2277. class Scene_File  Scene_MenuBase
    8 A$ N: M; K; v% v1 Z1 u% ~
  2278.   #--------------------------------------------------------------------------
    5 e( k  ?. @3 C2 ~
  2279.   # ● 开始处理* p( s& A# g% e2 A. s5 z& v% I" H4 }6 d
  2280.   #--------------------------------------------------------------------------) B8 i$ V2 b) x
  2281.   alias sion_mouse_start start/ |+ i( f: J& w9 K! G% X6 p2 s
  2282.   def start, ^) M) ~6 m: R# v" t
  2283.     sion_mouse_start0 B; p3 X% H2 c
  2284.     @move_state = 06 Z, C7 f# z# G+ z
  2285.     set_mouse_pos
    + m2 g* Z( S- E( z3 i
  2286.   end9 p- y4 u+ l# R# a: x  g5 x" g
  2287.   #--------------------------------------------------------------------------
    % }, ?7 ], i1 j4 P6 @: S' J  @: v
  2288.   # ● 更新画面
    ! I+ m2 V6 h6 ~
  2289.   #--------------------------------------------------------------------------
    6 r/ m- @0 j& [( y
  2290.   alias sion_mouse_update update
    / E) H0 g6 t( d7 [7 r( l
  2291.   def update
      l- B! Z, p7 b- r: V, u; l
  2292.     sion_mouse_update7 T2 @8 N8 ^  o8 j& ^% L
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos
    : v, @' ~4 [! A1 d
  2294.   end
    ' \  a  ]' q0 a2 W9 q
  2295.   #--------------------------------------------------------------------------
    - @- c) k: q4 |$ w1 J; d
  2296.   # ● 更新光标9 D1 V; E6 l. c2 V2 \5 d- \! d
  2297.   #--------------------------------------------------------------------------1 |5 t# W) i0 W( H% g% e+ p
  2298.   def set_cursor  Y; @: ?4 Z# D- q& d3 l# ?% k
  2299.     @move_state += 1
    . X' ]. o4 J  t7 O" Z1 G
  2300.     last_index = @index
    / }  x; q( b; ^
  2301.     if mouse_which_window == -2; c3 e' N% w2 y- V+ W8 z2 m8 \
  2302.       if (@move_state - 1) % 6 == 0
    , e0 p9 E# W6 N4 }
  2303.         @index = (@index + 1) % item_max if @index  item_max - 12 N6 n( g7 ~" W& f" w
  2304.       end$ J. S. X; ^8 o# p
  2305.     elsif mouse_which_window == -1
    % ~7 k" h) D" H, u9 s' ?1 t- h
  2306.       if (@move_state - 1) % 6 == 0$ v* E3 z% Z2 R
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0" ]( o: q& X- k; ]" s6 Y
  2308.       end/ @' Q- N  q7 E; |
  2309.     else+ F: a, F: q6 U& o
  2310.       @move_state = 0) e7 i" j0 B1 }5 p4 C
  2311.       @index = top_index + mouse_which_window/ F# q% K9 C1 y
  2312.     end
    / Z9 d+ t4 \$ s3 ?3 A
  2313.     ensure_cursor_visible0 q. S6 }! l+ T
  2314.     if @index != last_index: W) m8 N* D0 n5 d& |. R
  2315.       @savefile_windows[last_index].selected = false2 J( j* f- B# q& ]
  2316.       @savefile_windows[@index].selected = true. O6 U1 R$ ~- y3 D* _
  2317.     end
    : i. Z' }# z. X* q/ u6 C
  2318.   end- S& u7 I) C0 d- e
  2319.   #--------------------------------------------------------------------------+ ~5 ]+ q& C$ ~: f) w
  2320.   # ● 判断鼠标位于哪个窗口
    ! e5 \, ]* y) T: ^" G& @+ k
  2321.   #--------------------------------------------------------------------------% W0 c/ e' Z8 P. B3 C5 F; ]+ f
  2322.   def mouse_which_window& @2 X: I+ m2 T4 }+ t
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y' h- x$ v) F' l0 j# o5 O
  2324.     if mouse_y  @help_window.height + 14% B9 |+ t+ ?. L# }( ?, ^) q
  2325.       mouse_row = -1
    7 P' ]* H+ D  c: c2 L  k: K& N
  2326.     elsif mouse_y  Graphics.height - 149 f2 r, y# T9 `) W; R
  2327.       mouse_row = -2, t- z* X: b3 L. Q2 i+ Q
  2328.     else% O; y3 G2 a! d) y
  2329.       mouse_row = 4  (mouse_y - @help_window.height) $ U$ D6 h) A' L( i
  2330.         (Graphics.height - @help_window.height)
    # s  w+ O6 v: l# V& {0 x/ k8 ^' {
  2331.     end! L/ ^  V/ j2 Y* R" Z' K/ Q7 M- i
  2332.     return mouse_row
    ! w  s/ y- q: K4 p& \; }3 S6 {
  2333.   end& T6 D$ q# S/ T* x6 h/ b9 x+ B
  2334.   #--------------------------------------------------------------------------
    4 f2 v! H" A/ R- k1 z/ V
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置+ W8 u) [- m$ H$ n/ ?( d
  2336.   #--------------------------------------------------------------------------' }& D" h3 C9 K) I
  2337.   def set_mouse_pos! X; K" r+ K/ p" o9 G
  2338.     new_x = 40
    $ R5 {3 r8 `4 A  V+ `- ]
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    ) N6 A/ u+ }0 w0 S" B
  2340.     Mouse.set_mouse_pos(new_x, new_y)
    / c/ d0 D8 O: a% h  A
  2341.   end
    ( y; f9 ^  M! w: ~
  2342. end2 W5 d) q% T! K/ e& P* \  E1 F' H! m

  2343. + @6 U3 V2 q' l7 ]
  2344. #==============================================================================, Z: n5 F- d  ~2 A! ^/ F5 C8 M6 I2 |6 k
  2345. # ■ Game_Event7 F% L! Q7 t( J
  2346. #------------------------------------------------------------------------------0 |9 k3 Z1 M4 S; `  ^
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
      P0 I) A8 }& h0 t/ e; b; k
  2348. #   在 Game_Map 类的内部使用。
    4 k/ j0 D$ s" n8 I# j8 e
  2349. #==============================================================================; K% [: j  C2 r( C9 s! ]7 g
  2350. class Game_Event  Game_Character9 b/ E% v$ U+ A
  2351.   #--------------------------------------------------------------------------
    2 K' i# L5 s; l+ L& L# q
  2352.   # ● 事件启动
    # j* N' |: l2 y4 l7 r0 n
  2353.   #--------------------------------------------------------------------------
    1 z6 ]7 [( \* c2 U1 D9 |" p1 P
  2354.   alias sion_mouse_start start$ h; R* J- T" ]; B; \6 T
  2355.   def start  J2 v2 |" o, a* s6 z
  2356.     return if mouse_start && !Mouse.press(0x01)
    $ F5 o/ n0 J) `) ?9 Q. j! W
  2357.     sion_mouse_start
    ( f5 E$ T/ x6 n: U
  2358.   end- j. G5 u5 h- \8 g' B9 L3 b' E% }
  2359.   #--------------------------------------------------------------------------
    - f$ L" g1 v/ w+ h' P9 e% ^$ n
  2360.   # ● 判断事件是否由鼠标启动$ U* w8 f) q+ q( t+ |/ I' m
  2361.   #--------------------------------------------------------------------------+ s: e# {6 t7 l5 }) w
  2362.   def mouse_start
    6 k, @9 q7 |5 O3 K. J2 B
  2363.     return false if empty, O* s6 d& b* _' ^
  2364.     @list.each do index
    , }$ e0 t4 v+ P* m% i7 q) T
  2365.       return true if (index.code == 108  index.code == 408) &&4 z9 V& \/ k$ J8 Z  B0 ]1 I1 M
  2366.         index.parameters[0].include('鼠标启动')3 L; q! a0 E8 f$ k  O3 m
  2367.     end, z( `1 B) T* v, m0 V
  2368.     return false  i; M! n7 O2 v. v: ~7 ?0 u0 A; b
  2369.   end( }$ X7 I3 G0 g7 i. V
  2370. end# f" R4 A5 e& w7 ?
  2371.   P& X# _5 ~( f0 J  o
  2372. ####泥煤的height) w% s: s* I7 f( w6 S% H1 }9 ^' d" V
  2373. # @height = height
    ) o$ u( H# m; |$ k9 L1 ]/ t
  2374. & U8 Y8 w1 U" M8 s2 d7 a
  2375. class Area_Response
    & o$ W; `/ ^9 x3 S2 Q
  2376.   attr_accessor type
    + X( z$ j1 H2 ~% G2 j: {/ c% b
  2377.   attr_reader ox
    7 J% W$ `" ?9 u, ?- k
  2378.   attr_reader oy
    9 z. c+ x& r6 p. r& V! s
  2379.   attr_reader width; _& }5 d9 y  h& H9 T4 a9 d
  2380.   attr_reader height
      v7 }1 ]: }% h1 |) ^, M0 q, |9 `' {' ?
  2381.   attr_reader switch_id
    3 s) e& K. d% R5 l
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)
    ; r* [& c- e* l' y; ?5 z
  2383.     @type = type' u7 H  F3 [, O7 t8 I  r( V% F
  2384.     @ox = ox
    # R5 P$ \% l6 g
  2385.     @oy = oy/ ~/ v3 |( D& ~  S6 }9 b$ s
  2386.     @width = width
    " i8 r1 {6 O# M
  2387.     @height = height' M: Z' Z& F0 t! M
  2388.     @switch_id = switch_id: o2 M( L3 Y& Y" x3 N
  2389.   end
    0 K5 d8 l, r+ A* P
  2390. end5 b. `: }1 y+ H4 r/ U0 {

  2391. ; k% Y0 U% ?. g' a) k( Y
  2392. $area_responses = []* S% _2 T! @0 O1 L
  2393. 2 P& B0 Z- `& Q! E6 U  }* ~2 L# i4 G
  2394. class Scene_Map
    * J8 [# Y) M! W
  2395.   alias update_mouse_2013421 update_mouse_action
    % }$ _. [; @% V9 }: O
  2396.   def update_mouse_action4 f' ^/ \1 {0 [! @  q) e: u4 P
  2397.     update_area_response
    4 J" t% v. f- M% b
  2398.     update_mouse_20134217 E. W: E9 y, P2 s& C
  2399.   end; `- {/ T0 U  A$ b; W( @
  2400.   def update_area_response
    . v4 }9 H9 }1 y8 C$ f
  2401.     responses = $area_responses
    8 |" m6 A9 d" Y. p3 W' S( @& E
  2402.     responses.each {response
    6 Q# Q! a* L% f3 h6 ~. t, _0 r" |
  2403.       ox = response.ox
    0 X9 k0 G$ S* [# L
  2404.       oy = response.oy& {' e) G5 Q4 s6 u) u0 x1 U% f! q
  2405.       width = response.width4 O# j  ]: y# \) A+ o- b
  2406.       height = response.height2 W6 K9 z* L+ @2 ?- O6 p' x
  2407.       switch_id = response.switch_id3 y/ x" u' |  p) B  {
  2408.       case response.type% s1 t( B8 f& }2 [0 ]4 w) `" p
  2409.       when 03 H# f2 g; H5 n$ E) I4 j
  2410.         if mouse_in_area(ox, oy, width, height). Q( U' C  c3 Y/ {' A2 W/ ~  k
  2411.           $game_switches[switch_id] = true. \& A  ]. k  G& P* N) s+ r
  2412.           $area_responses.delete(response)5 z1 s, T: M* t
  2413.         end5 b3 Q2 X/ b/ B5 J: U0 F
  2414.       when 13 g" f) {* ]. d8 c. F# l9 C7 R
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)+ Q4 D2 X( w- _1 w2 Q' M# Y6 e' r
  2416.           $game_switches[switch_id] = true
    ( W# F" K2 L8 b; w" l& I
  2417.           $area_responses.delete(response)( Z& }. e1 }+ |/ n
  2418.         end
    ; n! W& l6 q5 l5 t2 |* D
  2419.       when 25 k; R, Z) `* W' s9 }6 f  U
  2420.         if mouse_in_area(ox, oy, width, height)2 N( f/ u% w' N
  2421.           $game_switches[switch_id] = true# Z: C! Z6 w2 b: M4 I) ]$ I8 R
  2422.         else- M( d9 ^5 z  v& M7 y7 E. w- F7 d
  2423.           $game_switches[switch_id] = false  L2 u) d8 G; K$ `& ~  @
  2424.         end3 j+ a+ c; A' e+ h0 |- Y9 t  o: e
  2425.       when 3
    $ T% e7 C+ T6 M. s+ d
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,
    7 S  }: s$ a! j3 v6 A
  2427.             (oy - $game_map.display_y)  32, width, height)# O  b3 }( T  w) v
  2428.           $game_map.events_xy(ox, oy).each {event+ S8 l' e3 F: ]0 P& J2 b' L7 ~5 m
  2429.           event.start
    % v  c: V# ^- {
  2430.           $area_responses.delete(response)# P( r- T( Y) S8 Q
  2431.           return1 _: ^7 H  `- F6 c' w- y; t
  2432.           }
    , B9 M% {( d3 A( O0 k- N
  2433.         end
    ; M% @$ Z1 E2 o. E) Q
  2434.       when 4
    8 {" n7 o/ F' i2 {" }! D
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,+ C% I. L8 r7 L- R! y
  2436.             (oy - $game_map.display_y)  32, width, height)7 Q3 G; T" N; U
  2437.           $game_map.events_xy(ox, oy).each {event
    4 M8 U4 |* E; _
  2438.             event.start
    / L3 ?6 M' Q/ O' }4 I
  2439.             return
    # O: F6 ?. f' m" ^0 p, d
  2440.           }
    - C5 B: Z1 p0 i6 n/ A
  2441.         end- i. M3 N/ E, F9 C7 ^. Q+ M
  2442.       end
    % ]3 D# p; K  o: V; s  C
  2443.     }' y3 Z; U* }, c3 y- [
  2444.   end
    & b# d" B- H  b& H
  2445.   def mouse_in_area(ox, oy, width, height)
    : X# H! P* |% k" K5 _
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&
    2 [& T, c) P! v5 p1 ?7 C  _2 X
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height+ b; O0 C) f- H3 ]6 t) e& n9 u
  2448.   end4 F( u! S6 j( i! j% s3 @- B
  2449. end
    4 w( l* F4 B3 R, Z. H
  2450. class Game_Interpreter, D# ]+ F1 B7 R- v
  2451.   def area_response(arg)3 L# a/ i. _) L# z: ^* J, i9 o
  2452.     $area_responses.push(Area_Response.new(arg))2 {5 a$ Z7 \+ N0 U; A6 y  M
  2453.   end
      p* a/ {& k& G" A) n7 L
  2454. end
    ! S8 W; r/ E% \. `$ I
复制代码

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

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

GMT+8, 2024-5-4 11:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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