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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    . i7 i, F9 O" F7 g

  2. 3 _" x, b5 Q0 t0 N$ B
  3.   Sion Mouse System v1.3e
    3 h! P5 X( t* c
  4.   
    5 I/ n& k7 K( V* v
  5.   Changlog
    7 J& Q: T9 Q: X& [  Q
  6.   6 G- B  j: ^* v3 B- W: R
  7.   2013.4.21 v1.3f
    - g  S; Z  \" S4 ~3 ?8 g3 |8 A- G, j
  8.    
      r: P7 j# F- W
  9.     1.3f 卷动地图 bug 修正+ c2 B1 y) r/ K6 F/ B
  10.     / s8 }0 k6 F0 h8 m
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口
    * ^% Z! j0 K2 f: Y! y& b
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内: e2 B8 Y5 I5 ~: g5 P9 [, M
  13.                               Mouse.unlock_mouse_in_screen 解除锁定4 M* x0 x% @* b5 u  x

  14. 1 U- z8 B3 a8 H9 L, k' u* q
  15.     1.3f bug修正
    3 W0 \5 f0 ], C" F1 ?
  16.   
      Y% A* V) l5 n) |3 P
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及7 J! y: c  J! M$ }* a1 P
  18.           关闭菜单时,鼠标是否移动到原来的位置。
    2 b( C2 a& e& O+ w& i
  19. $ P9 ~; N8 R; X4 i0 \; S" r$ Y
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处
    % q0 }, o& p) d  y3 X: L3 B4 i4 ]. c

  21. - v8 E: u2 X7 c4 l* o) r4 t
  22.     1.3b 修正一些罕见的bug;
    $ b  V  Q$ a5 N+ Z1 g8 @  C- k% p

  23. 2 s9 M+ H2 M' }) ?% Z- C' w
  24.     1.3a 代码小修改;, a" L' R- E, j6 y  M
  25.           加入了鼠标点击启动事件的功能,) p9 _5 I4 V0 d
  26.           在事件中加入“注释”: 鼠标启动  ,
    * d8 g/ r, @! L( X) w6 f& }5 Q
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    & e2 D. l( Q! Y7 B3 y/ d
  28.   
    : ?; e2 c% S0 g7 ~  g$ N
  29.   2013.2.12 v1.2
    1 ^4 \: \& `9 N- Q/ {' g- T; W

  30. 8 [  e: m; \4 M* V4 S$ m
  31.     寻路逻辑优化;
    $ `/ n6 V9 A% A5 S
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;3 f: _  X( ?+ K1 d# B
  33.     现在支持用鼠标来操作载具了。: Q& v: M: p& m# [
  34. : {+ S3 D8 j0 Q. o
  35.   2013.2.8 v1.17 H  ]8 i* f% t: A5 Y
  36. 9 v" ?" o9 c7 W" S- [
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;; u/ p* S4 G. B
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;  E- P6 B0 R7 k( U7 P1 M/ p9 E" z3 {
  39.     移动时,路径指示点的绘制更加稳定;
    - E4 ~; m0 D, Y: [# g( m
  40.     现在支持默认存档画面的鼠标操作了。
    7 `2 I5 U0 A( X; V
  41. ! D* g: B) ~4 k' I- T- d: g0 P; e

  42. ; A0 h  n5 g7 o1 O0 I: @0 @
  43.   OrigenVersion" A' _  {* g( D& c5 u, ~9 o
  44.   4 Q1 s  R% A2 Z# D
  45.     2013.2.7 v1.0
    , p" l5 N$ q1 G" z
  46. / D$ ]8 W$ }( v( e6 A7 _5 B
  47.   主要功能7 [- l  O; z; `- f. i8 k" S' ]
  48. ; j$ k& h3 H/ d. q% @/ k
  49.       使用鼠标进行各种操作...
    7 u8 j/ P! H( o0 V# x
  50.       将鼠标锁定在游戏窗口内
    8 F2 F' S( g) S( {
  51.       自动寻路,按住 D 键可以扩大寻路的范围7 T& |! I8 d. w1 D  M( ], W
  52.       双击鼠标进行冲刺' y. c* H# S' D; f1 r. \" U
  53.       更改地图卷动方式以适应鼠标移动- ]' C, r6 J9 i$ G* u  h. L( I% \
  54.       变量输入框改良
    ( |2 H, K; e) Q: q8 ~
  55. / J  j1 V1 d8 o8 J1 I
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹9 M1 N: ^# {) Y! ]0 M% x
  57. % H0 ~; D( R  Z9 w8 q
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹2 p+ [" T6 k! W, t1 c0 T

  59. - \- Q: C: l/ x$ x; t; r5 E
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    ( U! |4 @& f' |
  61. 1 Q; D  W) W3 a  v2 P7 O! m

  62. 1 G6 ?* ?3 W- T
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★/ V" Y% y9 H; z% ?1 u

  64. ! }3 E% s) b5 u6 C1 e
  65. 6 H" E6 ]2 }( N) {
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示
    3 N1 \9 P3 c- }4 u

  67. " j# Q& N: ?8 ?- u8 g( I) A
  68. #==============================================================================8 h7 B9 J8 _6 C8 K* s+ {' F* \: s
  69. # ■ 常数设置 4 N3 O0 t% w. E, C
  70. #==============================================================================
    & F$ A$ q. V( c9 h  R
  71. module KsOfSion5 q$ F$ M% ~+ g; p6 W
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false
    ; P$ }& y4 h. o9 f* \! s
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑  y! w8 ]) b! f. E
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false1 I  x) w0 S  E/ r9 ?
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量0 v/ \# T; M" ^% O/ o
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处- n( h$ ^' f% H; \. R4 W" D/ m
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧8 g5 G1 D* S( ]' f+ p; a9 b
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)
    ! T# y/ C8 Y# G: E2 [5 x- m- f
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键
    7 P8 s1 S) e& K: F6 U* L
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)
    9 J: N& L4 P. N* U" D5 O
  81. end0 V8 j2 g/ S0 m4 K, i) m! s

  82. 8 W6 t9 l5 L; X. c3 _1 g
  83. #==============================================================================
    ) W' v& I5 Q/ a& b/ g, O/ o
  84. # ■ 用来显示路径点的类
    % a* }9 f' b) |( l3 p. g) p4 a0 b
  85. #==============================================================================
    0 ^& g7 K1 z5 V& O2 e1 _
  86. class Move_Sign  Game_Character
    5 d" Y# X+ ?2 Y) d
  87.   #--------------------------------------------------------------------------
    1 b. u/ O1 l, _1 g( h
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图6 I, X3 B- D9 X  l( ?# s7 h
  89.   #--------------------------------------------------------------------------7 p7 ]7 \5 |# \3 f; W! x
  90.   def init_public_members9 t. W9 g0 p1 g  N" Z' o7 |
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹
    6 n. ?. _3 i1 [  ]/ j1 l5 b7 A% ]
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0* {& [2 I4 s4 w% k( O* x9 \* Z
  93.     @move_speed      = 5        # ★ 踏步速度
    4 d  K% `/ Z* J4 e1 Y6 J
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个). F% u  j7 U0 s  f3 ?7 o" l
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度
    , [6 l) A6 z/ K- F
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)+ H# Z" B1 ?( Z! L* v
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列# k1 R4 q+ p& {) _# R: c
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)
    / b. R; l7 R( P& I7 l% M
  99. 3 k5 J5 K5 W* \# S: M5 K

  100. 3 r- r/ s3 a( q" u
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    ' n* [& Z; h! P! Q

  102. : t, ~2 X) D& W  k! P7 ~
  103. $ a6 ?+ \! J. ^/ I" q' f+ W2 I3 M
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图: S5 T7 B% ^1 w- [3 N
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')( g+ E- [9 w0 h/ E) B) O
  106. 6 f' d; O4 x( ~4 T. b7 v
  107.       if $no_arrowpic_warn; ]/ ]# y: F0 Y
  108.         MouseShow_Cursor.call(1)
    5 E# P2 Q: T/ O
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png
    5 S# z1 c4 a% f( d! q! v
  110. , }0 }2 a. i$ S  s# K& Z2 v0 b+ {5 H) w# B+ U
  111. “路径指示点”将使用游戏自带图片6 g, ~: x4 V6 E$ j
  112. " w7 i# m0 K; K, T2 c
  113. 该提示可以在脚本内关闭')
    * W( Y$ o; C9 q1 j& {% j# ]
  114.         MouseShow_Cursor.call(0)9 {& b- o- r  _! @
  115.         $no_arrowpic_warn = false
    4 ]% t; m- a1 G( `# P" H  \
  116.       end& L# Z, x+ M4 V4 V, j3 O$ e
  117.       @character_name  = '!Flame'
    0 w+ O! W! t, ~% G+ l8 X" d
  118.       @character_index = 6
    * u5 ?: X; g, c  J6 L
  119. 5 i( ]) A4 R, \0 K6 H
  120.     end
    2 ~3 O. `$ G5 ^. F/ M8 t, K" l
  121.     @direction_fix = false  # 固定朝向
    / q8 }8 f5 t  h; P
  122.     @move_frequency = 6     # 移动频率% u# }  I# q4 h0 }, ]( m
  123.     @walk_anime = true      # 步行动画! o+ U- B% k* }0 T- l2 s# K
  124.     @pattern = 1            # 图案
    " u% ~% W" x2 _/ `0 m" F; I
  125.     @through = true         # 穿透
    6 N2 o: Z: ]1 H, M) M
  126.     @bush_depth = 0         # 草木深度$ T0 C' t0 u. U6 f
  127.     @animation_id = 0       # 动画 ID0 c8 ]2 c# Q/ M8 H( v2 N+ d
  128.     @balloon_id = 0         # 心情 ID5 `; s# ^! ^- |. M" R1 p7 T
  129.     @transparent = true     # 透明
    . e6 q4 L- E. ^9 ~* S* a2 F; j0 \, r' J
  130.     @id = 0. z+ g% B6 F  {* W1 P1 s! T$ _8 C
  131.     @x = 0
    3 V; [& D) H* k& N* _) u
  132.     @y = 0: h, u, c1 D: ]: O2 M6 U3 s  g4 Z
  133.     @real_x = 0
    ! i/ H# d- l( G4 Q% F! Q+ _
  134.     @real_y = 0' r2 s2 P% F5 B2 m
  135.     @tile_id = 0/ C. q' D' \' z! G( T
  136.   end. _/ b; P) u% ^# v, K
  137.   #--------------------------------------------------------------------------0 z; E  I2 m  S% d* ]) [
  138.   # ● 定义实例变量
    1 o8 J) ]0 ^1 H4 x, `* X
  139.   #--------------------------------------------------------------------------* [, n1 d$ ]/ H
  140.   attr_accessor direction
    9 v+ ?8 r* X2 K4 K7 V1 s' N
  141. end
    1 c$ v" U* A6 P4 C! A1 r$ v
  142. ( ?/ ?6 f! M0 }$ Z
  143. #==============================================================================
      N2 k/ ], w- }; V: r$ S
  144. # ■ Module Mouse
    . V  O$ q2 L6 u0 T
  145. #==============================================================================+ j" }9 \5 R" V" S$ H, q$ W
  146. module Mouse" }; u+ W* L4 [. v1 F0 Y
  147.   #--------------------------------------------------------------------------
    " x3 K, W" t( G2 P7 ^5 X/ z, d
  148.   # ● API
    / ^* s0 N& O8 G1 A/ E& u$ O
  149.   #--------------------------------------------------------------------------3 w# F& ^1 _% l+ Q) p
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
    9 Z" R  b- k5 j* c
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
    : v4 C' Z! j+ Z, n
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')1 Z0 a# e; d1 }. P1 R
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')
    0 Q/ a4 F, e% S7 j; s  P% N5 S$ m5 w, Z
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    % |4 E8 f* v. b# ^
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')
    ' g; i1 ?. T1 A7 S3 \+ [; B: Y3 c5 V
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')
    5 Z' s6 y- L2 y4 ?  |. o
  157.   Window_Hwnd       = Get_Active_Window.call" D: E0 e, U1 B" P  k4 e6 X! K2 ?
  158. - a6 g$ W2 w' F. Z( N  K' }: ^& \
  159. class  self
    ) U7 ?/ Y# A5 m+ H0 s
  160.   #--------------------------------------------------------------------------
    5 Z) X) p1 \  w8 `& G3 o- q6 a
  161.   # ● 初始化# d( F5 G2 r2 _, x7 h
  162.   #--------------------------------------------------------------------------+ u2 K" Q% H2 V; l4 u
  163.   def init$ X  Q' u& Q! u# R
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor
    4 o# U7 P: W% B! v2 Z  |
  165.     @left_state = 0/ p: W% N3 c& [, B+ R
  166.     @right_state = 0
    % {, t8 z  v, Y5 G* m2 N# h
  167.     @ck_count = 0 # 帧数计,单击以后从0开始
    8 Y" b, ?+ o$ Q2 h) @( Y$ {
  168.     @dk_count = 0 # 用于双击的判定" J0 X7 i/ W2 W  h  u. o. {" L
  169.     @clicked = false% H! f: \" A; _. q% i0 u# a1 I
  170.     creat_mouse_sprite2 k: S7 @  m, M9 D! \) V8 M9 e
  171.     update
    + y) x/ |' ?$ Z" W- T2 _- w0 s! b
  172.   end
    3 s4 E! f: n: Y& \, l: U  |
  173.   #--------------------------------------------------------------------------
    * m" F: y- \7 M/ N/ k5 s
  174.   # ● 鼠标指针精灵
    0 E+ S8 d6 U( e& s) M! `3 ]
  175.   #--------------------------------------------------------------------------" m$ F3 V* i, e
  176. #~   def creat_mouse_sprite
    ' K9 x' T/ T$ D1 g8 t
  177. #~     
    4 f5 T( z0 K4 k# A2 m, \
  178. #~       @mouse_sprite = Sprite.new
    + N1 y. J1 [; O
  179. #~       panda = 2#rand(2)+1
    & a* [8 E; l# {8 g1 [
  180. % Q/ }( s  y* z6 c9 i( c
  181. #~      if panda = 16 S& Z9 f6 h' t* ?- ?* J
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    5 y& b& k4 v# [/ {" c/ K! H
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')8 K, u7 [( H) i( U. {% d& l
  184. #~        end#with if File.exist  W1 j1 p# E/ G7 d) P; x) m6 M
  185. #~    4 B( r& ~" Z" C+ c
  186. #~     else if panda = 2 #with if panda=1- P+ c! o0 \4 j$ t$ Y
  187. #~      
    : I# E- N5 I7 q
  188. #~      if File.exist('GraphicsSystemCursor2.png')
    + N6 j$ i2 P: e1 V6 z
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    # B3 l0 F' i  f6 A- q- d
  190. #~      end#with if File.exist) J) Z7 U) J" d: K
  191. #~         c# i, S" f6 k( q/ e0 a
  192. #~     else #with if panda=13 r* `3 ?. M0 T
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24). `, s' v2 E; L0 k, F
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),! z1 G% f. Q3 {+ r) d
  195. #~       Rect.new(5  24, 24  24, 24, 24))
    / p3 y7 L  Y" u3 W+ V" w
  196. #~     end#with if panda=1
    . N" H( v* k/ N$ v
  197. #~     
    % _! n  O: o* o2 e$ J
  198. #~     #with def
    $ r. \% H* f, |; T/ R6 v" d4 J
  199. #~   end+ ~/ [# l: q9 P6 `
  200. def creat_mouse_sprite
    7 e/ n, t+ k& |0 Q7 |, l7 U- ]2 S6 \
  201.     @mouse_sprite = Sprite.new" p5 N' O  y9 K/ {
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1}): k% q. T: V7 A+ [2 E
  203.     @mouse_sprite.z = 9999
    " C  C! w2 ?( p; d( x
  204.     Show_Cursor.call(0)
    + W( a% A& D6 C* W9 X( w
  205. end! J, O; c/ d+ H. ^5 r% ~2 D% r
  206. $ b# r, M5 a! v0 ?
  207.   #--------------------------------------------------------------------------
    ' g  M$ c- Q- _& E, g. h9 d
  208.   # ● 更新
    8 `0 z) _1 b8 {( k9 O5 t0 d
  209.   #--------------------------------------------------------------------------
    9 @$ ^7 g1 v( d8 F
  210.   def update  H7 z* S' Q& m$ n7 M6 Y$ x
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos
    , O# E! Y: H5 v$ T8 J
  212.     left_state  = Get_Key_State.call(0x01)
    5 L3 y/ l/ Z' j# a1 Y% r
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0, R: s9 ?9 s0 d! f8 {3 W
  214.     right_state = Get_Key_State.call(0x02)
    / j; S9 e  q! S# G7 a2 B
  215.     right_state[7] == 1  @right_state +=1  @right_state = 07 q! a; e# c$ M1 B% e" U' m: x7 o
  216.     update_double_click% ~- U# J  u# p, c  t+ v
  217.     @left_state == 1  @ck_count = 0  @ck_count += 15 w* C8 A8 Y  L! ~% R* n& W. k7 k" \5 U
  218.   end
    4 M1 m9 P# k8 s4 G( d  l
  219.   #--------------------------------------------------------------------------' l; |3 d9 p8 ?' K
  220.   # ● 获取鼠标坐标
    5 \% r# N! Z9 r8 N
  221.   #--------------------------------------------------------------------------2 U: l  q3 j' E! {" e* A$ ^
  222.   def get_mouse_pos, `2 l& A+ \, D% t
  223.     arg = [0, 0].pack('ll')# x, \& u5 x  E
  224.     Get_Cursor_Pos.call(arg)- q' i" r8 p' z" M4 e4 k; p+ K& h
  225.     Screen_To_Client.call(Window_Hwnd, arg)( @2 o5 M9 }- @/ J
  226.     x, y = arg.unpack('ll')
    3 C! K) P% s) A7 k  V, P, x
  227.     return x, y( D- v( Y, X" T2 a
  228.   end
    ( R% `, V# o1 a% |( L/ B
  229.   #--------------------------------------------------------------------------
    * ~+ G/ g; v, K  p
  230.   # ● 将鼠标固定在屏幕内% l' u$ D2 R9 @) K, m" ~* _) ~
  231.   #--------------------------------------------------------------------------
    5 A" }) _+ a! S
  232.   def lock_mouse_in_screen
    4 l8 R/ a9 p5 h8 E1 `0 J
  233.     arg = [0, 0].pack('ll')
    9 K0 e, ]! X' ]) d* A3 H
  234.     Screen_To_Client.call(Window_Hwnd, arg)% d  a' [: J: g; v6 X
  235.     x, y  = arg.unpack('ll')( ^  b6 r2 a$ \% v1 B
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))  y9 }2 y( B# @# L* m5 l- c# i, R
  237.   end  `* W" L4 U' s5 m- T$ R8 f
  238.   #--------------------------------------------------------------------------
    . E! l. S& F. ?8 g( d2 g* G
  239.   # ● 解除鼠标固定
    ! Z0 I& {. ^0 b3 b
  240.   #--------------------------------------------------------------------------
      C; `6 h: l% Y# W: {6 x4 O& V4 w
  241.   def unlock_mouse_in_screen' [0 `1 c( }! \( U  W
  242.     Clip_Cursor.call(0)0 @3 d. l2 T! v8 P: h
  243.   end
    * x5 h; }' l' T7 d
  244.   #--------------------------------------------------------------------------
    - p: |; [9 c# p, T6 ]5 L( q0 F
  245.   # ● 鼠标双击判定9 y' A7 S% N* w+ w1 r0 p! N( f% C
  246.   #--------------------------------------------------------------------------
    4 p$ G, m5 ~2 _4 B
  247.   def update_double_click9 j1 ]/ x- k+ I8 F: ^, s: {4 ?
  248.     @clicked = true if @left_state == 1# u6 Y# D  U' k- R
  249.     if @dk_count  0 && @left_state == 1& `  k/ ^6 T" J  {
  250.       @dk_count = 0; @clicked = false
    . G$ F+ B: l% h/ j: @
  251.       return @double_click = true
    " I+ u9 Y8 r) s4 C/ p6 ]' B
  252.     elsif @clicked
    ; }. i8 ~6 G. G6 B
  253.       if @dk_count  KsOfSionDbclick_Frame
    " {7 ~: z6 P5 {1 Y3 q: g
  254.         @dk_count += 18 ~4 W; h% P  p3 K6 U
  255.       else4 Q  B( R; h5 P2 Z: ~+ |! B
  256.         @dk_count = 0; @clicked = false7 n1 F, O3 N0 b! l' X8 m( G$ A7 V, b
  257.       end' i, c- [& x2 G2 t3 Z3 A
  258.     end. {, q5 g3 a+ ]0 S  G
  259.     @double_click = false; O- F! `2 ?( B
  260.   end
    1 U, v! b" V5 W& B* g- C' R8 @; b' q
  261.   #--------------------------------------------------------------------------
    7 m8 w& b& C2 S$ f  c( d+ ^+ c$ X
  262.   # ● 按键被按下就返回true+ L9 `& P7 ^3 [& O% c
  263.   #--------------------------------------------------------------------------
    : q  p5 J" R" J% {9 B
  264.   def press(button). v% X$ d& r; j4 \
  265.     case button
    1 c8 V: H! |& `/ h5 ^
  266.       when 0x01; return !@left_state.zero* Z% r# A  j# `+ k1 F( {4 A( G! N5 r# U
  267.       when 0x02; return !@right_state.zero
      J% N9 m0 D; b
  268.     end$ _7 ?9 r) Q! Q- C; [' W0 i& K
  269.     return false7 |7 k4 P7 m9 J3 |9 {* b* @
  270.   end
    % M$ u# U8 [8 W' Q, t8 c8 s
  271.   #--------------------------------------------------------------------------
      |2 ^2 B/ ~# {
  272.   # ● 按键刚被按下则返回true- q5 \) q) ]3 v
  273.   #--------------------------------------------------------------------------# y# O( d- W8 a* n) b
  274.   def trigger(button)1 S  ^( U2 A$ t7 `9 @
  275.     case button
    * Y; |7 r* P7 O+ \' t
  276.       when 0x01; return @left_state == 1* D# G# @# t- D- D3 x, S9 d
  277.       when 0x02; return @right_state == 1
      D( w& p6 O/ U3 @/ V. H$ o
  278.     end
    $ o" b- r6 N, G& k
  279.     return false2 V% e6 N) |; M0 f* T& ?
  280.   end2 |# L6 b5 E  x8 H; d; ^& Y% z
  281.   #--------------------------------------------------------------------------
    ! X' o  M/ q. ~' c
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true$ S. f. x+ ^0 w
  283.   #--------------------------------------------------------------------------4 d! r. t3 d. r6 T  {
  284.   def repeat(button)
    0 S7 Q4 Y. k5 H8 f6 f$ A
  285.     case button+ B# b! x& d5 d  N8 V: s
  286.       when 0x01; return @left_state == 1 3 K2 H5 [" g6 K$ o/ h( {
  287.         (@left_state  22 && (@left_state % 6).zero)' O, L% e9 e) ^
  288.       when 0x02; return @right_state == 1 - \  w" V1 [/ H
  289.         (@right_state  22 && (@right_state % 6).zero)
    ; [1 k" i) g9 ^1 p( G
  290.     end9 Y! v. [' h' x
  291.     return false
    / M; \$ x' n6 @/ f$ W' O4 y7 V* F0 i$ l9 B
  292.   end/ d$ o: m& a1 g; z
  293.   #--------------------------------------------------------------------------
    9 d9 {" P" ^; Z" P% [
  294.   # ● 判断是否双击鼠标
    " t1 g, B' [+ O- e* p% R8 `( ?
  295.   #--------------------------------------------------------------------------8 f) s9 o% O" q6 x% A
  296.   def double_click
    ) X1 ~- Q& ~% L4 g: q1 s( W1 O
  297.     @double_click6 Q9 t0 o- y9 j# c. ?5 q
  298.   end; R8 j* M+ w& o% i
  299.   #--------------------------------------------------------------------------0 E* W2 v2 M4 n1 t# W$ Y
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)
    ' `- M1 i* _) ?: w% }8 c
  301.   #--------------------------------------------------------------------------- e# s, V/ t* a4 ~' e6 ]& d
  302.   def click_count
    " V9 z; _3 C) p8 R& b
  303.     @ck_count) H8 ?  N' K1 @' q: q
  304.   end3 o" P6 Z# U6 z' Y# R( d
  305.   #--------------------------------------------------------------------------
    & h( ^7 D% e0 I# I1 t
  306.   # ● 获取@left_state(按住左键每一帧+=1)4 |9 m. {, i1 E3 F+ m
  307.   #--------------------------------------------------------------------------
    , J: {, H" N1 h
  308.   def left_state4 c/ x+ e, q5 _: V
  309.     @left_state
    " @8 T/ {5 `5 s3 G+ @! l
  310.   end: q7 n$ c! b( s
  311.   #--------------------------------------------------------------------------4 V% z# Z0 B7 S+ k' A8 G! F
  312.   # ● 获取鼠标的x坐标) f! X! `' G  z$ n
  313.   #--------------------------------------------------------------------------& E6 g- f* q0 W2 Z& {  ~
  314.   def mouse_x
    4 ^9 g  ]. L  Q4 s3 }# h
  315.     @mouse_sprite.x8 Y9 t7 S! I! R  }
  316.   end
    & ~3 T& l9 d. l
  317.   #--------------------------------------------------------------------------1 k3 U4 {8 }/ S% H0 L: E) c7 n1 X
  318.   # ● 获取鼠标的y坐标$ v0 P+ P9 x: m
  319.   #--------------------------------------------------------------------------
    $ @- ]9 y/ N+ N/ _0 [1 b# v) }
  320.   def mouse_y
      T1 i/ w& a1 Z, B
  321.     @mouse_sprite.y
    3 J. V  X% h5 a: U
  322.   end
    / F+ L  w5 o0 `" A7 x4 A6 X
  323.   #--------------------------------------------------------------------------
      E- ~' q% b" ~, \5 _
  324.   # ● 设置鼠标坐标% p' e9 A; ^& m( B8 a# X
  325.   #--------------------------------------------------------------------------  d1 [: K. u1 G  \  ?. y/ z; T
  326.   def set_mouse_pos(new_x, new_y)0 u$ Y) L% r$ B( B9 U# t  a6 h
  327.     arg = [0, 0].pack('ll')9 ^" Y4 S) ~$ p7 G0 z% E
  328.     Screen_To_Client.call(Window_Hwnd, arg)
    2 a3 Y# x+ _* v( W7 p. u" g$ l
  329.     x, y  = arg.unpack('ll')0 f2 \- w' ?" E2 s
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)% U3 c/ f' U( F( k, T
  331.   end
    9 B6 v7 C% s+ n0 \7 N) `2 n$ g5 @
  332. end #end of class  self ! D) o- s/ R! A0 p

  333. ) \- p: W" U( w
  334. end: q4 h4 d$ Q+ v2 C0 b
  335. " {9 c" m) p2 i8 k5 K$ d. d0 ~4 T/ p
  336. #==============================================================================
    & f9 i; }6 N2 K: r# k6 B
  337. # ■ SceneManager
    7 O. |% C9 ?( U  s
  338. #==============================================================================& O( V# c/ X7 `: a
  339. class  SceneManager+ \! [8 r5 k3 }2 \: w. ^. H
  340.   #--------------------------------------------------------------------------
    $ W& e7 r$ r% g4 _
  341.   # ● alias
    % z" Z8 P$ t) D% R/ \% b! Y7 k
  342.   #--------------------------------------------------------------------------
    3 ~+ |* \+ j& a, X+ T- }  G6 V
  343.   unless self.method_defined(sion_mouse_run)
    ! q7 \$ t! ^+ a- J( n2 ?1 z
  344.     alias_method sion_mouse_run, run1 {+ A# o2 w8 J- O6 v
  345.     alias_method sion_mouse_call, call' Z* e( @( l( C4 J: W+ R* g
  346.     alias_method sion_mouse_return, return
    3 U9 \8 l) S( j! V& z* k
  347.   end2 @( {* Y7 Q7 g  M- r$ R7 D$ h( Z$ p! M
  348.   #--------------------------------------------------------------------------
    5 f6 T4 I+ W* g3 ?: a
  349.   # ● 运行, t' P3 [7 a+ q$ H
  350.   #--------------------------------------------------------------------------4 W' A; a5 m9 K
  351.   def run- A/ C* M8 I5 Y8 q- e! A
  352.     Mouse.init8 L# |: A# c4 d% r" g& W; k( R
  353.     sion_mouse_run
    ) C" B5 j( `6 H" B5 t
  354.   end
    7 F! H3 u, B% ]: U! d  o
  355.   #--------------------------------------------------------------------------& V; `6 O' X. L2 X
  356.   # ● 切换
    + k9 W; R; h, J
  357.   #--------------------------------------------------------------------------$ p, r' J0 ]% V4 `$ J
  358.   def call(scene_class)3 V! i! @3 l) n
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)
    - O0 P+ I2 E  s: N# G- H( J
  360.     sion_mouse_call(scene_class). |8 A* H0 ~( N- ~9 s; [
  361.   end
    ' P+ k, H+ o2 x! {
  362.   #--------------------------------------------------------------------------
    0 b$ |! c' L0 p) k* V8 p* ]
  363.   # ● 返回到上一个场景; {4 U/ V1 y1 F) g! N
  364.   #--------------------------------------------------------------------------
    8 @) X5 Y. B, R5 l. Y
  365.   def return
    / T# ?. o% ?; R6 z
  366.     sion_mouse_return
    # _9 Q2 i7 j8 e! c
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&" ^8 s8 {5 G) l( e% o  a5 y" \
  368.       @scene.instance_of(Scene_Map)1 _/ l- M3 [8 A+ Y* y
  369.   end$ _3 x- i  L! Q( o" v+ e- f- O3 L
  370. end
    " _* d, Q0 Q! a; ^% u$ T

  371. # u( L: H. P  g9 J8 S% g) G
  372. #==============================================================================( V# Y2 n+ x' }* B, @4 o6 {
  373. # ■ Module Input% l, k0 L; \, q) e/ D
  374. #==============================================================================+ D/ X5 N% B& w0 k" F
  375. class  Input% ~6 @2 C& d, M- A
  376.   #--------------------------------------------------------------------------% O0 w/ |! J: T# m/ e) |9 l9 _
  377.   # ● alias: R3 a, w6 {" g
  378.   #--------------------------------------------------------------------------0 u3 g( e; T% ]4 {+ C( F  w
  379.   unless self.method_defined(sion_mouse_update)) [) H& d( I. b9 _
  380.     alias_method sion_mouse_update,   update# B3 G) ?6 M! `1 r! p
  381.     alias_method sion_mouse_press,   press
      n* S' Q! w& a$ [; Q! p1 \- B
  382.     alias_method sion_mouse_trigger, trigger
    5 q8 U2 \# w, a8 {8 h' O
  383.     alias_method sion_mouse_repeat,  repeat" l& q" r0 ~& R3 b3 R* E# ^
  384.   end8 [. W* r$ A: }, D: E/ j
  385.   #--------------------------------------------------------------------------6 B) @9 a( g  c& t/ i2 W8 t9 C
  386.   # ● 更新鼠标) e! C: }+ A" S& k' l. ?
  387.   #--------------------------------------------------------------------------
    , `! A  t0 N; E$ O7 _, D" K& A
  388.   def update( L8 J6 J3 `. A: O- E* q: a2 E0 \
  389.     Mouse.update/ `+ x# S1 k; o/ y& F! h* w
  390.     sion_mouse_update4 Q. u. O5 _$ r& Q7 b
  391.   end4 c6 C  @( Q3 {1 K" q7 b( f, X- {3 `
  392.   #--------------------------------------------------------------------------
    2 Y6 m! `. t; D. X8 m* Y
  393.   # ● 按键被按下就返回true2 H1 D5 ^! ^- C" E
  394.   #--------------------------------------------------------------------------# w5 G2 f6 V, a% k
  395.   def press(key). Q; @# f7 B' e9 H
  396.     return true if sion_mouse_press(key)
      {8 W, c! v' L$ ?8 z9 o2 Z" j/ J
  397.     return Mouse.press(0x01) if key == C
    8 |  H* z+ S2 p& f' I, F+ {
  398.     return Mouse.press(0x02) if key == B- p9 s( K( B% j. b6 ^* D6 \( B
  399.     return false
    ! \- z' C- n3 J$ x3 M. c5 ]
  400.   end1 Q, S/ I2 H( ]* O- }3 J& g& X
  401.   #--------------------------------------------------------------------------
    ) Z6 j, g/ K" T* C
  402.   # ● 按键刚被按下则返回true/ c5 g/ e3 B- f3 B  }7 H7 X! `! W
  403.   #--------------------------------------------------------------------------% J( H! j6 x. j+ B) @4 e
  404.   def trigger(key): W! Z, A' O6 i* ~
  405.     return true if sion_mouse_trigger(key)0 F# w' y8 G7 |( M/ s  w
  406.     return Mouse.trigger(0x01) if key == C& {; A1 J$ C* D5 V5 L6 x6 Q
  407.     return Mouse.trigger(0x02) if key == B# z' N7 @9 m0 A) z( ]/ F% `* C
  408.     return false
    , R3 t. G0 P: N8 W: G
  409.   end
    ( q+ @& ~0 B4 L) O7 o- S
  410.   #--------------------------------------------------------------------------
    # U$ m& \! h* j7 N- V3 t
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true8 G+ z; P% D. m. Z8 ^, s
  412.   #--------------------------------------------------------------------------
    ! j/ A: _9 X# r: y, G& ?
  413.   def repeat(key)
    ( f9 w/ o3 c, Z3 q' O' V9 P
  414.     return true if sion_mouse_repeat(key); `. B: H; }5 X3 n
  415.     return Mouse.repeat(0x01) if key == C
    6 s% Q; W) Z6 z1 m6 B1 @
  416.     return Mouse.repeat(0x02) if key == B
    * G% h5 l) t, Y) K
  417.     return false
    , y+ J- O  w2 X6 O  C' k: v, o2 B
  418.   end, ~1 U- z. E8 r2 d( a# a, W
  419. end# j, f+ j4 l* I$ |, h! |
  420.   d) B% s0 y7 N, B
  421. ' \7 I! E9 l5 [- X
  422. #==============================================================================3 e) x$ b% A! b, ^; Q
  423. # ■ Window_Selectable* S: d( [% _4 l9 m# m% G% ~
  424. #------------------------------------------------------------------------------3 l+ j) {2 g6 k# N! f# A) A
  425. #  拥有光标移动、滚动功能的窗口$ F+ h4 W1 }+ V8 D' m2 G8 f0 r
  426. #==============================================================================
    " j' V: h8 y; J$ e) a, S
  427. class Window_Selectable3 }6 y; q$ r/ T8 e( {! l; T
  428.   #--------------------------------------------------------------------------
    . |8 n4 I0 t- I7 T$ M& C
  429.   # ● 初始化
    ( {- R* D7 D/ e9 ^3 H
  430.   #--------------------------------------------------------------------------
    ! I, H9 w! S8 I$ Y! l4 z
  431.   alias sion_mouse_initialize initialize. u6 X  k1 N+ _
  432.   def initialize(x, y, width, height)9 X4 x( |. b" H& N
  433.     sion_mouse_initialize(x, y, width, height)
    4 ]3 ^  ~7 i% K; ~1 m: o
  434.     @move_state = 0
    & [$ Y! @3 ^8 K2 K% [# r/ H! y/ o
  435.   end" i, R  A, a7 L( a/ Z8 t) B; z. C
  436.   #--------------------------------------------------------------------------# V" n0 q/ R  y/ Z7 U
  437.   # ● 更新
    ) O/ v- Y8 I! K* W2 P8 D/ A) P
  438.   #--------------------------------------------------------------------------
    8 {2 w1 R) M4 W. U6 x
  439.   alias sion_mouse_update update
    ' h7 B+ V0 y3 m4 _2 w. v: a
  440.   def update
    ) f6 a" }8 G1 f) P! L1 t' r  t0 ~
  441.     sion_mouse_update
    * {6 [/ n5 x, b$ E  P6 B" F* i
  442.     update_mouse_cursor
    5 o& Q$ O0 R' i6 {
  443.   end- O1 L5 K( b* O. F! R+ v
  444.   #--------------------------------------------------------------------------" k* a- i- [* C5 P4 B9 M( n" v
  445.   # ● 启动后设置鼠标到index位置
    " J0 q3 Y" a0 j: n
  446.   #--------------------------------------------------------------------------; t6 T; y, b+ c- v7 o
  447.   def activate/ ?! W) J( M$ {  N: C
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    " D  M# |( s' g8 P8 p) A
  449.     super2 G% r2 ~6 X; [( @7 w& a+ g. M3 }6 [
  450.   end2 W- g5 k9 d- s, l: M
  451.   #--------------------------------------------------------------------------
    / P/ E- k. L4 @5 E. y( h
  452.   # ● 更新鼠标和光标的位置" }/ T$ A, \0 j4 U
  453.   #--------------------------------------------------------------------------
    - k; ~# P7 C' z  G( w7 f6 ?) W' e
  454.   def update_mouse_cursor, S1 l: Q; o# q0 [
  455.     if active
    + [( u& h4 t/ a4 h/ T
  456.       if @need_set_pos
    ) |8 m" y2 x; J. Z- [
  457.         @need_set_pos = nil  C4 ]" Q3 x3 X) a" m/ M( O
  458.         set_mouse_pos6 m" H5 _; @2 J: y0 H2 _
  459.       elsif cursor_movable- o( z4 @; b' [3 a+ M$ }
  460.         Input.dir4.zero  set_cursor  set_mouse_pos
    9 J6 p7 U1 r  n- ^% p" q  d5 U8 J
  461.       end
    , M1 Y7 Q# O8 C6 z$ X
  462.     end% S# j0 y6 L% \4 u/ p
  463.   end6 u9 a3 Q  X, z4 L3 ]
  464.   #--------------------------------------------------------------------------0 q( {5 O' E1 j" T3 D, N) A: i6 J
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能3 P' }3 i2 F& J
  466.   #--------------------------------------------------------------------------, k$ @5 r* w& r0 N, m
  467.   def set_cursor8 C* G0 U4 h) H3 L; x( v( _/ [' @
  468.     mouse_row, mouse_col = mouse_window_area
    / ?; s2 l+ D- ?# }6 T# M8 t6 x
  469.     if    mouse_row == -1" ^/ Y) ]; Y8 W' f- L& z6 U0 s" r
  470.       @move_state += 1 if need_scroll
    * o2 r; {. X4 P& @
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand
    3 d+ w6 U# v- O
  472.     elsif mouse_row == -2
    0 V4 H+ A/ @. l: r; \+ b
  473.       @move_state += 1 if need_scroll+ J9 U! `# ~3 _
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand" X" U- U" N1 \( @6 [3 E5 l# o9 h
  475.     elsif mouse_col == -19 n( i3 e: H% }, t( {* x6 J
  476.       @move_state += 1 if need_scroll* T5 z# U4 c6 |# L: |7 k# A
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    % ?: C7 a+ a  n
  478.     elsif mouse_col == -26 p+ L- o: M) i: q3 x, ~8 M
  479.       @move_state += 1 if need_scroll+ g( O& P; ]& d4 z2 b" I
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand" G) ]- h2 M* e
  481.     else/ I" N# f) g: ~; `2 a* R7 A
  482.       @move_state = 0/ k# {& H' j2 f  h
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col
    5 u! ~, {' {2 X- S* t
  484.       select(new_index) if new_index  item_max && new_index != @index, M- W8 o  U/ Z
  485.     end
    7 J8 V1 l3 Q$ U# w) d3 H/ L% w
  486.   end
    $ \) `& l+ ~* p% [1 J. V8 ]% g5 O
  487.   #--------------------------------------------------------------------------
    0 S0 M# [  Z: A( K2 V
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    - u$ t  t/ z1 m0 }
  489.   #--------------------------------------------------------------------------
    * i5 v4 S* n1 |% [+ V4 n0 p) t
  490.   def mouse_window_area' K5 I- X* C- F  ~5 V6 b
  491.     if viewport.nil # necessary!
    . ?8 p; Q/ m7 r, @
  492.       vp_x, vp_y = 0, 0
      G' u2 |* S( [8 U
  493.     else. h% ?, O! E0 V$ i4 U9 _6 g
  494.       vp_x = viewport.rect.x - viewport.ox  ]! F3 z2 j5 c" r  l$ V$ V
  495.       vp_y = viewport.rect.y - viewport.oy
    # l, v6 j, G# H# s: U# M# x
  496.     end3 T+ l' i' ^) H- ~4 L. M2 Q
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y! e" n6 I8 ~- E5 t; Y+ K! N4 y
  498.     item_x1 = vp_x + x + standard_padding
    0 T: J0 y" N9 ^- I, a9 P4 Z
  499.     item_y1 = vp_y + y + standard_padding6 l) T6 e1 v- R$ n( E4 S
  500.     item_x2 = vp_x + x - standard_padding + width
    9 m* b7 o+ @, o: [/ {: r6 S
  501.     item_y2 = vp_y + y - standard_padding + height% V& ~4 M4 J4 ]# V  K2 V
  502.     if mouse_x  item_x1
    . Y% o: p1 r, P6 D% r, U+ g
  503.       mouse_col = -1
    . U* R. T" \( ]( R/ Z
  504.     elsif mouse_x  item_x2
    ; E4 @7 P/ h- G7 P# |4 ^/ z
  505.       mouse_col = -2
    & _5 a5 T' P9 |/ w' K: y
  506.     else
    3 {  h4 J+ a. U" T9 z" \
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)
    . G3 L2 d: t5 g
  508.     end2 ~0 L( K% D! r2 ~2 G, f* k$ u
  509.     if mouse_y  item_y1
    # r" ?9 Y" l( X
  510.       mouse_row = -1
    8 _3 a0 L* X/ Q+ I
  511.     elsif mouse_y  item_y28 k  h+ \3 \* z* s
  512.       mouse_row = -2' a4 k) o- H! P/ `
  513.     else+ M- `" C1 F9 |6 `
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    6 B3 x4 B3 {9 [9 V
  515.     end
    * J7 D0 l& k. s5 _- H
  516.     return mouse_row, mouse_col
    8 B; m1 q. |% z$ r/ U; \
  517.   end- ]( f5 ~3 C0 x* c* q; x
  518.   #--------------------------------------------------------------------------+ g( a, x; ^. u( B' y: J
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    4 M  A+ ]. W: H4 f7 ]- l- b4 c; ?
  520.   #--------------------------------------------------------------------------
    # N) v. t  h" V
  521.   def set_mouse_pos
      Q! Z9 b; j' b7 c
  522.     if viewport.nil # necessary!+ O! k8 a( R- Y3 |
  523.       vp_x, vp_y = 0, 05 P$ F1 q4 s" `
  524.     else5 x( c" @" B1 u8 H! e
  525.       vp_x = viewport.rect.x - viewport.ox# m3 p% c* }& Z* L5 s; j( e4 F
  526.       vp_y = viewport.rect.y - viewport.oy- M; T# q: L1 e  L! M
  527.     end- u* |3 ]/ x% o: Y
  528.     item_x1 = vp_x + x + standard_padding
    7 n. j8 t: e8 s# S, C
  529.     item_y1 = vp_y + y + standard_padding( @# {! A0 j1 @# u
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index 0 k( S/ H0 A  K* ~, N( v1 ^, G
  531.     row = get_index  col_max - top_row
    ; Y$ `7 e$ f9 b
  532.     col = get_index % col_max
    ; a. M, Q+ L$ C- @
  533.     new_x = item_x1 + item_width  (col + 0.5)
    3 W( ?3 ^5 A' R
  534.     new_y = item_y1 + item_height  (row + 0.5)0 O4 M% [+ U: O1 f2 x
  535.     Mouse.set_mouse_pos(new_x, new_y)9 k! I+ J* r* {8 Y' [& M7 [) b
  536.   end
    5 c: a) h, I9 h! D$ U% _
  537.   #--------------------------------------------------------------------------" U( @- m' q# D9 B2 Y, H( `; ?
  538.   # ● 判断菜单是否需要卷动: P3 D  W" S5 U8 x% Y$ y6 n
  539.   #--------------------------------------------------------------------------& q& [: W$ q+ G9 I, |5 ?" w
  540.   def need_scroll) p# |& u% U3 Z
  541.     item_max  col_max  page_row_max
    * ]; p0 G% R# B6 D
  542.   end
    , ^/ [1 t4 b7 n
  543.   #--------------------------------------------------------------------------
    9 `# C4 u1 _: I2 P5 D
  544.   # ● 判断是否为水平卷动菜单
    , [0 f5 _2 Z( k3 O- R9 w
  545.   #--------------------------------------------------------------------------
    $ A$ q/ g+ r' U8 P$ a
  546.   def is_horzcommand
    7 t& J7 \: H$ y
  547.     return false3 v% K+ J: z3 q( `% H( j
  548.   end
    5 c+ c- q, s+ V
  549. end
    3 u6 ?/ x: b( L/ f
  550. % ^2 \% v# m( d
  551. class Window_HorzCommand
    : R. i# N5 i& j2 I
  552.   #--------------------------------------------------------------------------& {9 h/ r8 l& Q  w
  553.   # ● 判断是否为水平卷动菜单
    . @3 w# A; T- J$ q1 S
  554.   #--------------------------------------------------------------------------
      ?' Z8 m3 _* C: R) J* K
  555.   def is_horzcommand
    6 q( S1 j* o/ s" l$ g2 R
  556.     return true( f/ T1 I/ G/ k; o
  557.   end! @# N5 j; i- @- Q
  558. end6 F% \/ N0 A" ]! b8 g0 u! {
  559. ; j$ x' u$ Z- `6 D
  560. #==============================================================================
    $ N5 x7 }  d+ ?4 t
  561. # ■ Window_NameInput) O6 t! [1 u2 i6 P
  562. #------------------------------------------------------------------------------
    & Q2 O* ~% n4 t* g  A5 j
  563. #  名字输入画面中,选择文字的窗口。& v$ a* ?9 {) r3 d  I+ x
  564. #==============================================================================$ {7 k2 Y5 c+ F5 X5 j' P+ s7 D
  565. class Window_NameInput3 x6 [9 @8 h  D- Z' r6 x
  566.   #--------------------------------------------------------------------------
    1 ^! Q3 D$ t1 s. @8 n
  567.   # ● 设置列数
    * x- _8 S$ ]4 q4 x
  568.   #--------------------------------------------------------------------------
    7 i7 A' j/ ~+ j+ s0 X4 M
  569.   def col_max
    ; G* V1 U) |! P7 f
  570.     return 10
    ( h" Q" U# {7 p2 E7 |
  571.   end
    , B- r' T6 r' J" D5 j
  572.   #--------------------------------------------------------------------------# W9 @+ `; R: ~$ |
  573.   # ● 设置填充的Item个数
    $ H% n4 Z) Z2 F
  574.   #--------------------------------------------------------------------------0 B3 ]/ x: S# Z1 I1 O
  575.   def item_max
    , L% |8 D" D& P
  576.     return 90
    - X) @( s$ f) \
  577.   end
    , j# T$ ^7 F: G6 k
  578.   #--------------------------------------------------------------------------9 t' I7 w- c% z. p! C* x
  579.   # ● 设置填充的Item个数3 x7 U7 E& W/ Y  n2 x) U' U
  580.   #--------------------------------------------------------------------------! D2 b1 x0 v% |( {* y+ O
  581.   def item_width
      r; h4 T' f7 n: F9 p* \5 _
  582.     return 32
    # F# S% ^' s! o: T. u- _
  583.   end
    9 G8 `- R- N& W3 S* O; W% V/ a
  584.   #--------------------------------------------------------------------------- ]! D) u4 {( ]$ J: Z: r% m3 q1 t
  585.   # ● 判断鼠标位于菜单的第几行、第几列, K* Y% \4 z+ x/ h1 R1 p2 t# K5 y  G) b
  586.   #--------------------------------------------------------------------------/ Z4 B8 e2 _* |
  587.   def mouse_window_area
    / c: {$ n6 T8 D  L
  588.     if viewport.nil- j/ D% k; `7 ^" T7 B0 \
  589.       vp_x, vp_y = 0, 0: t) A4 z( p7 L. e; s4 j
  590.     else/ V; [+ r1 C/ s; C8 B
  591.       vp_x = viewport.rect.x - viewport.ox2 c; Z6 d* ~# k: D4 W1 _, |! G
  592.       vp_y = viewport.rect.y - viewport.oy' x! c, q+ i0 {$ H0 O; x
  593.     end# x1 W9 S' @2 t! J
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y0 ]9 y1 X  `6 S/ J
  595.     item_x1 = vp_x + x + standard_padding
    % }  v4 d' Z/ ]; S& R
  596.     item_y1 = vp_y + y + standard_padding, B4 H4 \; \" D% e* ~$ [
  597.     item_x2 = vp_x + x - standard_padding + width
    ) [- P, [$ S/ @8 P% i8 l; X; K# R& S
  598.     item_y2 = vp_y + y - standard_padding + height
    ; k7 s: O  p3 |2 |
  599.     if mouse_x  item_x1
    9 y& n5 Q! i3 l0 M( i: ~3 n
  600.       mouse_col = -1
    # F3 p  S4 Y2 P: k
  601.     elsif mouse_x  item_x2, K1 P% K6 e% ~$ O" b& h4 y, P
  602.       mouse_col = -2
    5 b$ [8 E+ T! x$ c  l& l) |- S
  603.     elsif mouse_x  item_x1 + 160
    " ]2 r/ t6 O3 N
  604.       mouse_col = (mouse_x - item_x1)32: g' s: p1 r: u. `
  605.     elsif mouse_x  item_x2 - 160
    2 O$ f; i; \9 h* q0 m: t7 n
  606.       mouse_col = 9 - (item_x2 - mouse_x)32; }. [% u) `( o2 o- g$ U
  607.     else* D. u- m, e  U  f0 i
  608.       mouse_col = mouse_x  x + width2  5  4, q& L, l$ |0 b" ]; t* c" Y- h
  609.     end  K, }6 {4 ~/ c7 u* Y
  610.     if mouse_y  item_y1
    9 V& @$ d" V6 f/ S- A
  611.       mouse_row = -1; N! U6 U7 V+ ]0 ^- G7 K
  612.     elsif mouse_y  item_y2: s0 M8 m. g2 I6 z7 L3 X
  613.       mouse_row = -2
    1 Z" j0 {: V/ Y9 c
  614.     else
    + O2 R# B( H6 @7 d7 T
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)
    2 u7 P; ^) e& {
  616.     end
    2 P- O; `0 }3 V8 [9 n  j" |; ^
  617.     return mouse_row, mouse_col
    " K: R# c0 W: O9 t
  618.   end% e% q, q* D7 J/ Q/ f
  619.   #--------------------------------------------------------------------------
    3 Z0 {/ Z+ o* v) T
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置+ N% u* x, }( H. u1 @/ W' i, W; X
  621.   #--------------------------------------------------------------------------: j  @0 ~6 [0 U- m# I9 _$ e* G
  622.   def set_mouse_pos- ?1 Y  c3 Z/ o
  623.     if viewport.nil # necessary!
    9 V' h: v: v0 @/ P/ q- V% J; ~
  624.       vp_x, vp_y = 0, 0% D, E7 o. ]; O# ^
  625.     else
    + o& |7 |  e4 V2 p* I, t8 H; Y0 `8 a
  626.       vp_x = viewport.rect.x - viewport.ox3 H9 z7 A9 j9 S
  627.       vp_y = viewport.rect.y - viewport.oy( w  \4 y" o) G" m, x7 }% x
  628.     end
    / U. _7 p+ ]8 ]9 r4 |! ^
  629.     item_x1 = vp_x + x + standard_padding
    3 L8 Y! F- t0 r/ @; M' e/ D6 ^# [; D
  630.     item_y1 = vp_y + y + standard_padding
    ( ^" p1 B5 b0 n1 f- q9 j
  631.     get_index = @index  0  0  @index 6 s) F8 }* J/ f$ P6 Q
  632.     row = get_index  col_max - top_row' u+ l- {- U9 c% ~# L
  633.     col = get_index % col_max
    + _; z1 f% B" F+ @
  634.     new_x = item_x1 + item_width  (col + 0.5)1 e7 L  Y. {, }
  635.     new_y = item_y1 + item_height  (row + 0.5)
    8 K2 g' I; L3 Y1 c% s4 c) f& a6 S, O
  636.     new_x += 14 if col  4
    ! z* I1 R/ d: I% W, T1 q8 \% R
  637.     Mouse.set_mouse_pos(new_x, new_y)& g0 H& j0 t3 B, R" G
  638.   end4 h' l; X7 |  L( z
  639. end, {: `& O% |- F/ T, q
  640. - E$ v  C7 ~. i7 ?; F
  641. #==============================================================================3 x1 b( r  m; Q  J, D: s, S
  642. # ■ Window_NumberInput2 ~0 Z; S' @5 T6 ^. Y9 d
  643. #------------------------------------------------------------------------------7 p, E! N( d8 y: q
  644. #  重写了数值输入的方法以适应鼠标) O! q2 `8 L+ r& s' J3 p- F9 a( C/ ]" j
  645. #==============================================================================1 U4 X. N$ [! m: B* \& s/ T( ^- Q
  646. class Window_NumberInput  Window_Base4 a1 {7 w! \- g& t
  647.   #--------------------------------------------------------------------------- H7 b* H# ]  y+ f$ ?
  648.   # ● 定义实例变量$ u, `8 A. j- ~, U
  649.   #--------------------------------------------------------------------------
    ' P  @* Z% g* f% E
  650.   attr_reader extra_window
    - @/ A! ?4 g; n7 ^' _% U
  651.   #--------------------------------------------------------------------------
    # P2 t% H1 j7 \5 n' H3 X4 ?' U
  652.   # ● 初始化
    : `- \( A( j5 O# B2 E, P% L- x
  653.   #--------------------------------------------------------------------------3 k8 K! ?9 I4 d! O/ c/ K( r! U  Q$ h
  654.   alias sion_mouse_initialize initialize
    " I2 [/ H# @; U% M9 a* W- A
  655.   def initialize(arg)
    5 {, @) w0 |8 {' B
  656.     sion_mouse_initialize(arg)
    / ^1 f; F5 {/ i/ c
  657.     create_extra_window% h8 ]) `, ^' C' }/ H, `
  658.   end
    - U/ O* S2 ~; ^8 H2 v0 h5 a: l2 S
  659.   #--------------------------------------------------------------------------/ ?5 ^! m4 y. h$ a: n
  660.   # ● 启动. H! b' v  u; W/ m; {( x
  661.   #--------------------------------------------------------------------------- \8 i# U& f5 a( O6 Q
  662.   alias sion_mouse_start start
    " ^) g3 A5 t% Q4 D
  663.   def start
    ; I; m% g& Q0 w: a& k$ Q7 U. m; b+ H
  664.     sion_mouse_start
    3 B$ w4 }/ u6 O0 r- w" d
  665.     deactivate9 ?* t& G* |3 Y% d) Q) f
  666.     extra_start
    # `' ?# d! I5 u8 _" P: l% n
  667.   end
    5 v% [- u3 j" p
  668.   #--------------------------------------------------------------------------' I: C9 t7 w( [7 L
  669.   # ● 创建新的数值输入窗口7 ^5 u9 ~1 r" J1 j
  670.   #--------------------------------------------------------------------------! t2 L+ G& a2 R& e( c
  671.   def create_extra_window+ F, I7 M/ A6 s) z( y! T- X
  672.     @extra_window = Window_NumberInput_Ex.new4 `$ l3 W+ f6 h4 Z: Q3 c
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2' R7 W  C1 v' @) {) {/ w2 f) t5 t; `
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }
      a0 A5 }- I# G% t
  675.     @extra_window.index_proc   = Proc.new {n @index = n }
    + l9 q% K6 z. j0 A7 {
  676.     @extra_window.close_proc   = Proc.new { close }
    ' Q" L) E; l; X: I5 C$ X
  677.     @extra_window.refresh_proc = Proc.new { refresh }' H- j  J, B/ {
  678.   end
    ! V+ P' o5 ~' ~4 G) ?1 p
  679.   #--------------------------------------------------------------------------
    ) _2 t; \0 R0 t, i! z. f9 U* k9 P
  680.   # ● 激活新窗口' E9 h8 ^  P1 w3 |9 c/ P( j) n
  681.   #--------------------------------------------------------------------------
    + V& x; ^4 A+ j7 W
  682.   def extra_start
    7 Y# h! k) b' A. D
  683.     case $game_message.position
    ( }& t1 _9 {" ?! s6 _
  684.       when 0; @extra_window.y = y + height + 4
    6 P1 g0 C/ K: ^) c; U2 o
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
    . p( _: F' `. V
  686.       when 2; @extra_window.y = y - @extra_window.height - 4
    & P! Y* e, m/ o- |/ k5 U
  687.       else  ; @extra_window.y = 8
    - W2 S3 e# @9 _5 q2 }
  688.     end- `6 y+ f$ m4 m& M7 U$ j: ]
  689.     @extra_window.variable_id = $game_message.num_input_variable_id
    . |; F, H8 b' I9 T( q% W! H0 t
  690.     @extra_window.digits_max  = @digits_max/ N; n$ i$ o0 e, `
  691.     @extra_window.number      = @number
    2 M; ^3 n" k- D# K5 ~! t2 o. F
  692.     @extra_window.open
    ! e/ ~  t3 k. N" j& J
  693.     @extra_window.activate
    2 g9 n8 @0 N) B
  694.   end
    ( }* b' q8 w5 V) [- d
  695.   #--------------------------------------------------------------------------* v9 m6 _' a- Y6 C  L
  696.   # ● 更新4 i0 p, m8 n( Q2 c
  697.   #--------------------------------------------------------------------------/ s; d2 G6 A6 r5 b
  698.   def update
    4 C# C- ^" y' l% v7 n
  699.     super8 n3 i. r: I/ C2 k  C/ T0 p
  700.     @extra_window.update9 K+ y1 g% |( z$ Y+ g0 X3 a
  701.     update_cursor" I) v) C# O, x: @7 Z
  702.   end
    5 ~; u$ }# a9 n) B
  703.   #--------------------------------------------------------------------------
    & h+ k. G& C9 U9 c! F, w& b5 q
  704.   # ● 关闭窗口
    / M0 G* m2 n( l% \  L
  705.   #--------------------------------------------------------------------------
    5 ^8 J4 W" q; |% ]$ U% v% |1 F
  706.   def close
    3 D. Z* U4 i8 x4 J" X+ B$ c
  707.     super
    / T1 G2 @4 O/ U' h( n* [3 J
  708.     @extra_window.close/ l* f0 z8 g, [+ G- }) N
  709.     @extra_window.deactivate) s' M4 |! b: I
  710.   end
    2 w2 o6 V! Z! G5 C. b3 M
  711. end
    ; `/ z! a' o% J# X5 ~
  712. / T$ t( |7 [6 x8 n/ `, ?
  713. #==============================================================================! o4 n/ S4 D; I) E* `5 l3 q- f
  714. # ■ Window_NumberInput_Ex( M1 J" d, j- t7 ?, `- h
  715. #------------------------------------------------------------------------------
    - h8 @" P7 }) [% H5 z/ A
  716. #  新的数值输入窗口(NewClass)9 A* h+ ^* O+ d. [2 h, O
  717. #==============================================================================& x) X0 [+ L$ n7 L
  718. class Window_NumberInput_Ex  Window_Selectable- V4 k" f; R" g% x* c' e9 S
  719.   #--------------------------------------------------------------------------
    : M8 R3 Y& R4 `9 w
  720.   # ● 定义实例变量
    ! X8 O; a# V$ w8 u' x
  721.   #--------------------------------------------------------------------------) z, z+ T+ l* j( {& q! l# M
  722.   attr_accessor number_proc# H( p0 d. o, A5 w+ L' G. d8 @( G) d
  723.   attr_accessor index_proc3 u- z8 K7 ]% T$ T  N! `/ O
  724.   attr_accessor close_proc
    5 A/ I# g& M- O& P% A
  725.   attr_accessor refresh_proc; a. b- ?& ]  m
  726.   attr_accessor number3 Y  j3 |+ T: l
  727.   attr_accessor digits_max1 l, U% a% Q6 ]& B1 V8 H
  728.   attr_accessor variable_id! K8 H: W" j; k$ X: ]) S! x7 C
  729.   #--------------------------------------------------------------------------
    $ |/ ]5 j3 Z+ ^9 G
  730.   # ● 数字表
    , V" ^3 q5 }6 Q/ B  S) ^
  731.   #--------------------------------------------------------------------------
    : y% A5 ^/ {  l% B8 i: k" @
  732.   TABLE = [  7,  8,  9,$ x% I* R- ]0 o
  733.              4,  5,  6,
    9 D2 u/ p( F3 h1 p0 _
  734.              1,  2,  3,
    * g0 I0 z8 e( i7 m' [8 k$ u+ L) \# m
  735.             '←',0,'确定',]9 {$ F0 z, H& v% @, |/ n3 u
  736.   #--------------------------------------------------------------------------% x5 b+ u% m1 A/ `3 e0 d  m
  737.   # ● 初始化对象% E7 M1 u1 Q2 x; r) R8 A, F
  738.   #--------------------------------------------------------------------------0 N/ W$ Z- B4 f* d
  739.   def initialize. W  f- c- h  j; j( G
  740.     super(0, 0, 120, fitting_height(4))# w& T/ @  D; c6 V
  741.     self.openness = 09 n) G3 h" |, V" |- b
  742.     @index = 0
    & Y+ d' i! L2 C8 c- K
  743.     @number = 0
    0 ~$ P# A6 }  ^$ y. r2 g
  744.     @old_window_index = 0& h7 G$ m" n- [$ m! @  D% A
  745.     @digits_max = 0
    8 Z' G- Z. [+ n% F$ ?
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }" G" @. C3 X6 i2 x1 @. T2 I$ S
  747.   end  H( q+ z0 {/ Q' E( q( J2 a
  748.   #--------------------------------------------------------------------------
    # f2 z; X  J( t& ^) G
  749.   # ● 获取项目的绘制矩形
    ; P; I* s+ v$ v
  750.   #--------------------------------------------------------------------------- s5 @, f2 O7 S3 l5 \
  751.   def item_rect(index)
    9 V" O, V) K- g, n: T
  752.     rect = Rect.new/ y' `3 r% t0 O; M
  753.     rect.x = index % 3  32
    8 y+ K3 B0 y* C2 c8 ?0 U
  754.     rect.y = index  3  line_height0 a% @- o7 L9 `# ^1 V7 _/ o+ z
  755.     rect.width = 321 k5 z  \! f6 a
  756.     rect.height = line_height
    3 Y" b  G4 g3 L9 Y: O5 q
  757.     return rect
    8 U3 z1 a, E' W3 i8 q/ Z5 V
  758.   end
    % k' D- R: U& `6 A1 G6 U$ @* i
  759.   #--------------------------------------------------------------------------
    0 x0 c5 N7 L; ~$ H; X
  760.   # ● 将光标设置到鼠标所在的位置
    : y7 N' ?* f$ a% X3 ~
  761.   #--------------------------------------------------------------------------# R* ]/ r3 }& H7 i0 r
  762.   def set_cursor
    9 m* h3 Q- ^/ \  _4 \4 E
  763.     mouse_row, mouse_col = mouse_window_area, h4 v* ]- q7 r' |+ r0 A
  764.     if mouse_row = 0 && mouse_col = 09 H2 H- l+ x+ O4 |
  765.       new_index = mouse_row  3 + mouse_col- y+ _# H2 ^; r: }* b9 ?7 M/ u
  766.       select(new_index) if new_index = 11
    & a& L/ A& O- y2 M+ {; A8 d% Y
  767.     end
    ! p; ?% Q5 Y% I+ e" z
  768.   end: o6 P# {) h: _) z, K6 i) c
  769.   #--------------------------------------------------------------------------8 v- y* }  J" T
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列
    ' X7 ]' U2 b0 @/ L2 O. P
  771.   #--------------------------------------------------------------------------
    & v% _  J4 f6 N* Q
  772.   def mouse_window_area
    & q$ N: g9 ]$ D! n
  773.     if viewport.nil) U# i  k) |3 z" A
  774.       vp_x, vp_y = 0, 0
    , T* E: C6 e* P" w
  775.     else. g5 j& @; [3 N6 ]8 q: n( m
  776.       vp_x = viewport.rect.x - viewport.ox
    - \7 }1 W; q' L( G0 F/ {
  777.       vp_y = viewport.rect.y - viewport.oy$ N$ _, ]8 t' O- n7 y. V7 r
  778.     end
    ) o! \# J% q- ?) u3 }
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    $ M9 [/ y& G* Y
  780.     item_x1 = vp_x + x + standard_padding
    : j' q: a$ v( x# z* K! K
  781.     item_y1 = vp_y + y + standard_padding# U, F7 h8 n% f, k) q
  782.     item_x2 = vp_x + x - standard_padding + width4 H; i# z$ s6 D& Q) N, n2 ~
  783.     item_y2 = vp_y + y - standard_padding + height
    % \2 q" P! o1 q4 r
  784.     if mouse_x  item_x1* {' D; v  }6 X; \- z- z% s
  785.       mouse_col = -1- c# @0 o$ O; i# L  m
  786.     elsif mouse_x  item_x2
    ) N* y6 h3 Q1 k5 ^- z) w( _7 h
  787.       mouse_col = -22 f9 V" `9 R. {! c+ z3 o6 n' ?7 ?
  788.     else; |! K& _  I  n
  789.       mouse_col = (mouse_x - item_x1)  32
    ( e: x9 }! x1 V( m- n% r+ i1 n
  790.     end
    ' }- c  |& j, Y) O
  791.     if mouse_y  item_y1, g( \" j9 x' h1 @# Y: e
  792.       mouse_row = -1$ X7 t2 L6 L3 w: Q, p
  793.     elsif mouse_y  item_y2& U# L, @0 S8 Z' h4 Q
  794.       mouse_row = -2
    % c" e) x' F! v; T6 O" w
  795.     else
    8 _2 J# b6 Q; B5 M/ U, L
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)  C* h7 U* H: A$ E# n/ Y# {/ F
  797.     end, G- F' A% m4 a; k9 h
  798.     return mouse_row, mouse_col  i0 v1 E7 R, O
  799.   end5 L' _4 G! i, A
  800.   #--------------------------------------------------------------------------
    . y1 A# H! Y; S7 e* f$ u
  801.   # ● 获取文字2 h& ]1 `+ t+ e, p: r+ [  E+ d
  802.   #--------------------------------------------------------------------------
    , H7 s; B2 g6 N# l/ V( G% S
  803.   def get_number. d" a9 @4 s. o  I# ]# _
  804.     return false if @index == 9  @index == 11. G+ t: x; |  b' h" I
  805.     return TABLE[@index]1 ?. |$ G9 h6 J: b) V0 J" j
  806.   end1 {/ ^) T  R; ?! s
  807.   #--------------------------------------------------------------------------' b' Q2 e% d$ j4 u+ F
  808.   # ● 判定光标位置是否在“退格”上* j- w! c/ Q+ O+ m" x
  809.   #--------------------------------------------------------------------------
    ( O0 C3 N5 S, y0 T" G7 t
  810.   def is_delete
    # W# g; j( L7 {$ I
  811.     @index == 99 T( h1 L" ]' a
  812.   end, T3 Y# L: Q- |# d* J  N
  813.   #--------------------------------------------------------------------------, B6 ?& I! O6 R! f, u4 ]  V  r
  814.   # ● 判定光标位置是否在“确定”上
    1 x9 s) k# ~9 o  J& f1 c: x) p
  815.   #--------------------------------------------------------------------------
    ; a9 ^7 o' k; p$ y) O+ D
  816.   def is_ok  f" ~: J$ _9 G; y% t! Z  G% I
  817.     @index == 11  o) }% `  `7 d2 t' `
  818.   end" U; v4 |$ y  b$ p' X' X6 M
  819.   #--------------------------------------------------------------------------
    4 ^8 h& a# R; f
  820.   # ● 更新光标
    % K, `! d& K1 }8 C
  821.   #--------------------------------------------------------------------------
    & \. Q8 }* z5 f* u/ g2 `
  822.   def update_cursor0 K- s4 [( C4 [$ p
  823.     cursor_rect.set(item_rect(@index))+ @) X% u. I6 s
  824.   end
    ) t# q4 D8 M" {3 K/ p9 v/ v) c
  825.   #--------------------------------------------------------------------------
    5 r% [& t7 [7 l* m4 |. b
  826.   # ● 判定光标是否可以移动
    4 h3 d# c! ~3 z2 I" E% t
  827.   #--------------------------------------------------------------------------
    8 w4 W& }& ^' s; ^2 _! e
  828.   def cursor_movable
    ( p: L" {; s* _8 W7 X4 T1 U
  829.     active
    & {9 ]/ R5 ~. D- _, U- z' W, w2 U
  830.   end
    5 P; R# c4 T1 L1 s9 I
  831.   #--------------------------------------------------------------------------  p! [- u/ g  ^: _
  832.   # ● 光标向下移动
    ( t3 Q+ D# f  p5 C; q
  833.   #     wrap  允许循环" X2 H. c. y! P( b8 T) R
  834.   #--------------------------------------------------------------------------  F9 I2 T& H! Y0 B) I
  835.   def cursor_down(wrap)8 A; ?3 h  E# w" B3 u
  836.     if @index  9 or wrap/ e7 R! {7 ^- ^8 D2 x! X5 V
  837.       @index = (index + 3) % 12" J' u0 Z% J  f& U9 E
  838.     end
    5 \/ S4 v# N; s  @% I6 g
  839.   end( A- U' l- E" h- h3 ]+ B# C
  840.   #--------------------------------------------------------------------------
    8 }, {, d& i3 c
  841.   # ● 光标向上移动/ X( z. B0 F" A% a3 F
  842.   #     wrap  允许循环1 h) i' r# x) _. K6 q
  843.   #--------------------------------------------------------------------------! {7 \6 \. |2 m0 {) g4 g
  844.   def cursor_up(wrap)9 ]. R/ t; J- a" ?
  845.     if @index = 3 or wrap
    * j1 `. A* }* ~# z3 o# z
  846.       @index = (index + 9) % 12+ A% I- a* d" k6 [
  847.     end9 {+ {! b- O) S0 C: v$ z
  848.   end
    ( i! B$ e: W+ s$ F  T% P
  849.   #--------------------------------------------------------------------------
    # h2 C1 W% A6 v& g/ w9 V1 e$ d/ q
  850.   # ● 光标向右移动  d6 w, [1 u, v* J
  851.   #     wrap  允许循环2 I: d3 d4 f. [$ J9 y
  852.   #--------------------------------------------------------------------------
    # t0 ?9 @) f8 m$ |2 a
  853.   def cursor_right(wrap)
    , Z* u- ]; q' Y- x/ Y6 B( y) Q+ C
  854.     if @index % 3  2
    $ D( P' O, j' r( `7 d* l3 x* Z4 K
  855.       @index += 1/ |* M- V, A- N( z1 j% s+ F
  856.     elsif wrap
    2 d6 ?' t7 \9 n+ {  k% Z
  857.       @index -= 2) f4 n- R, p8 d2 G
  858.     end
    0 ^0 y6 y. _1 P% J2 ~) ~: u
  859.   end: N. O- I6 m9 I' }/ s. C3 j- h; a4 G
  860.   #--------------------------------------------------------------------------/ y6 a) e6 p' n: {
  861.   # ● 光标向左移动
    $ @# l9 J) f$ S4 H
  862.   #     wrap  允许循环1 ?4 d$ J. {+ x; i+ j
  863.   #--------------------------------------------------------------------------
    & f- M& O  y% U' \" p
  864.   def cursor_left(wrap)
    0 u" Q7 H" A8 Y" x
  865.     if @index % 3  0
    4 x8 j: D9 `6 i% c! g
  866.       @index -= 1
    7 {& K" \3 {2 e- I+ X
  867.     elsif wrap
    & t! b9 I. p; c5 O5 L! B1 V
  868.       @index += 2( O  |  s  {4 T" {- H
  869.     end
    8 o( H1 M5 ^! e% C
  870.   end) W1 U" v/ D% R7 B/ ~& t
  871.   #--------------------------------------------------------------------------
    , F2 [8 ~2 h, L+ E6 t3 T
  872.   # ● 处理光标的移动- X& L- x, |: L+ m% |- t$ F# w
  873.   #--------------------------------------------------------------------------  X: |3 H3 @( i" {" ^! w
  874.   def process_cursor_move
    ! u+ S, C+ {3 Y' _
  875.     super
    " b/ Z& R( E3 w5 ~4 N
  876.     update_cursor
    ; k4 _+ p( ~2 H3 C  }  x* c% o
  877.   end' M- u5 `" j+ q
  878.   #--------------------------------------------------------------------------, a- \, n( @3 [4 I4 a& R7 W" ?
  879.   # ● “确定”、“删除字符”和“取消输入”的处理
    ' D: n4 [2 @  {
  880.   #--------------------------------------------------------------------------
    # M, f' g1 x$ U1 S- F$ |
  881.   def process_handling
    6 u- K/ O% p" C. T4 T. _) H
  882.     return unless open && active+ _6 x* W4 O* m. t' n2 Y1 L  r
  883.     process_jump if Input.trigger(A)
    ( P- h' |5 E" d3 j) [6 i
  884.     process_back if Input.repeat(B)9 N4 r, z3 j: f1 T% R. P  T% ?  s5 Z
  885.     process_ok   if Input.trigger(C)! G: A) s' v$ F9 d: w% P  z" v0 B
  886.   end
    / N( |% r' j7 F6 A  M0 @5 R
  887.   #--------------------------------------------------------------------------1 ?7 y; ]- C  y! \9 z
  888.   # ● 跳转“确定”+ j1 r  ~/ `3 r; W9 F
  889.   #--------------------------------------------------------------------------  [  i: n) n9 r: z
  890.   def process_jump
      @9 H1 j% t; f: V* v8 I: S
  891.     if @index != 11
    6 T, i/ F' U. x% C
  892.       @index = 11# N$ W) p% p, }) w
  893.       Sound.play_cursor& A) \4 A4 T0 p4 L- q
  894.     end: Y( ?2 n4 |: c1 p+ Q
  895.   end
      P0 A* q/ d& s. p* Z
  896.   #--------------------------------------------------------------------------$ w! t* r- |4 D1 t
  897.   # ● 后退一个字符
    " J$ j2 w; E; [4 m
  898.   #--------------------------------------------------------------------------$ C% y6 y5 L. P( k7 A" n; L9 k: Z0 A: D
  899.   def process_back
    : ]; `) x- t  q, G  s  n  x/ i" }
  900.     Sound.play_cancel, T3 C) q" a  f1 ^7 M- N& c) o
  901.     place = 10  (@digits_max - 1 - @old_window_index)
    + i  M$ f+ c7 p+ ?& |& r
  902.     n = (@number  place) % 10
    , f: \9 x5 F2 E, K- E, [4 ]
  903.     @number -= n  place: n2 w7 l) o% N: M
  904.     @number_proc.call(@number)
    ! p( `: R# Y: ~9 U' T% P/ ^& K5 x
  905.     @old_window_index -= 1 if @old_window_index  0
    ' X( p7 w3 z  M) w0 z, @2 ~: A. a
  906.     @index_proc.call(@old_window_index)( a1 J) v1 ~, e0 G2 p6 n
  907.     @refresh_proc.call
    ! p: \" k% o+ j' C7 |
  908.   end: H4 }( y3 O/ i( K$ x3 c3 Q
  909.   #--------------------------------------------------------------------------* Z  m& V& H+ ^& d6 v
  910.   # ● 按下确定键时的处理6 L! ~* |$ s1 g* N+ @8 [
  911.   #--------------------------------------------------------------------------- l$ x$ _8 T+ b' {" O) r
  912.   def process_ok( x4 L) ?& O9 A* ^$ O* B
  913.     if get_number) P8 t; h7 e; r7 k2 N
  914.       Sound.play_cursor* C2 V5 q7 @3 X5 S. g1 h
  915.       place = 10  (@digits_max - 1 - @old_window_index)4 u) \2 M2 e& [8 e' V
  916.       n = get_number - (@number  place) % 10( J+ j$ K0 W. D1 r# J( ^/ v$ u
  917.       @number += n  place
    6 {4 q/ w) Y0 n) b* D5 D' d. t5 a
  918.       @number_proc.call(@number)
    + d$ O4 l3 C; z( P  m% a
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    0 d2 }+ b7 q* |& w; v& Y3 v
  920.       @index_proc.call(@old_window_index)& M8 I6 P/ V' L5 I7 y
  921.       @refresh_proc.call. Y* ^, \4 k9 n- g
  922.     elsif is_delete
    2 E0 C$ y) h! u' B/ q
  923.       process_back
    3 }5 P. X$ N& X: N# p
  924.     elsif is_ok3 @* e) \6 X/ R3 q9 I
  925.       on_input_ok! q' e4 N6 E4 Q' B
  926.     end+ o5 m" w, ^$ K8 V9 ~8 t* I" Q3 t
  927.   end1 h# v+ {3 T( J. |: d
  928.   #--------------------------------------------------------------------------( v; J: \* r7 J9 O7 I# {- z- ]
  929.   # ● 确定  Y7 P8 B' t- o' U9 T
  930.   #--------------------------------------------------------------------------  W' ^, \3 r& l& }! a8 G+ A
  931.   def on_input_ok, w; R; T- z0 f; z
  932.     @index = 0
    ( f" A7 `. b7 Q. d( g! n
  933.     @old_window_index = 0
    $ g' H2 b9 V+ l0 {2 ?
  934.     $game_variables[@variable_id] = @number2 p  {. u/ e) N% C3 I, q9 g
  935.     Sound.play_ok
    + m, Q* P0 L7 |, w6 |) y
  936.     @close_proc.call( a( X: W3 C' c0 I/ L
  937.   end
    2 g8 j% m( m+ r) B3 o- g4 z
  938.   #--------------------------------------------------------------------------
    ) K! G; w) _% A) O& C
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    " n. C. d, l3 R4 N. T2 v- }- f
  940.   #--------------------------------------------------------------------------
    ' x- M& }) b- d0 j' A' u: b$ @) g
  941.   def set_mouse_pos$ p2 s/ b' i8 L& ]- Y" s3 K
  942.     if viewport.nil # necessary!2 {! x9 @7 j/ s4 p" T; H. E
  943.       vp_x, vp_y = 0, 0
    " C6 X3 A. S4 m
  944.     else1 O/ j- d; X* y) F5 m
  945.       vp_x = viewport.rect.x - viewport.ox
    7 d+ o% v+ R6 G! L; w. f  J3 j
  946.       vp_y = viewport.rect.y - viewport.oy3 G& ]1 D5 Z1 p
  947.     end0 B- b4 A" G2 ^( J4 a* @4 O7 A
  948.     item_x1 = vp_x + x + standard_padding
    , j8 v9 w- g, L, E
  949.     item_y1 = vp_y + y + standard_padding5 {4 s* a; R* Y  w
  950.     get_index = @index  0  0  @index $ s+ h" x, Y* h; d2 e% y
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)9 C) N7 g% {, e  V# f
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)
    & I; o: |) G4 O( f" ?. j0 n: o2 W2 h
  953.     Mouse.set_mouse_pos(new_x, new_y)
    - S# ~" e% |1 x! D) Z3 @0 J/ z, V
  954.   end. h8 K. k, P* a: K' t2 G2 k0 q
  955. end' P8 f' A# H2 a2 m4 L, e
  956. 5 y$ o5 ~5 B: ]) ^% f6 \5 s
  957. #==============================================================================: V. O' L6 `$ Q! m  D/ y: |# o
  958. # ■ Window_Message
    6 H; D  h5 Z5 M5 F+ R/ q
  959. #------------------------------------------------------------------------------2 Y. ]/ M6 x9 D" _$ y
  960. #  显示文字信息的窗口。
    7 v( ~" _# J3 E; C* Y  v
  961. #==============================================================================
    5 h) m4 k1 m; C. P. \1 C7 L0 V
  962. class Window_Message  Window_Base7 e9 U+ ]. }0 ]$ f0 d' [. O8 @# L
  963.   #--------------------------------------------------------------------------) A: o; [4 T1 s6 V8 T5 ?7 i/ d
  964.   # ● 处理数值的输入(覆盖原方法)) O3 s& w' q* i# o5 R, e. n: G
  965.   #--------------------------------------------------------------------------
    / r) W* F( [) o0 O0 H
  966.   def input_number, b  E3 L% b8 V/ Y  ~- _! M% \! ], j
  967.     @number_window.start) R* T" D3 N2 N  a
  968.     Fiber.yield while @number_window.extra_window.active4 P/ R  ~$ _) [7 D
  969.   end
    ( q8 T/ t# I2 t. O2 r
  970. end3 W( M6 R. i6 j: e# C, B7 j; b5 y* [

  971. 3 M' @- t6 O% m; {3 \0 D
  972. #==============================================================================
    4 U' d/ r2 L0 m1 L4 d& m5 ]% f* y
  973. # ■ Window_PartyCommand  ^! D  G1 e5 A& W1 q( }* i! G
  974. #------------------------------------------------------------------------------' r- Y3 W6 R6 i$ U$ C
  975. #  战斗画面中,选择“战斗/撤退”的窗口。, W6 j( x  M6 G+ P) `0 U
  976. #==============================================================================
    ; O9 E5 A# e2 J$ @4 S- `) b6 p4 X8 Y
  977. class Window_PartyCommand  Window_Command
    % r( S8 [; N: V6 o
  978.   #--------------------------------------------------------------------------
    ! v! l0 e% G% @
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置, s8 b8 F  r. M# L1 [$ o( d
  980.   #--------------------------------------------------------------------------
    ' M3 z5 ]8 }: }3 L* C
  981.   def set_mouse_pos# ?: n: h: e6 K0 ^, _# }0 U
  982.     if viewport.nil4 N$ g7 d% b2 D, N3 w9 l
  983.       vp_x, vp_y = 0, 08 W, a' S$ [' z/ u8 f: q
  984.     else
    + Z* L7 p# v1 @
  985.       #vp_x = viewport.rect.x - viewport.ox3 ~. z5 G" H4 `/ G% L7 Q
  986.       vp_y = viewport.rect.y - viewport.oy1 c3 e2 n, M3 B, A
  987.     end8 R5 t" _6 Z$ ~) K& j3 G5 k% B9 I
  988.     item_x1 = x + standard_padding   W8 P9 k/ R+ A
  989.     item_y1 = vp_y + y + standard_padding
    # _6 i- f2 x8 |% x" N
  990.     get_index = @index  0  0  @index
    , f0 `' M3 G7 R6 }) |# b7 J, P+ N5 u" p
  991.     row = get_index  col_max - top_row
    8 U- \) w1 f% o# D4 p7 z" @# V5 ~
  992.     col = get_index % col_max. q0 t6 P. B( k6 r
  993.     new_x = item_x1 + item_width  (col + 0.5)
    % n- `4 }  _) V! h; A' ^
  994.     new_y = item_y1 + item_height  (row + 0.5)
    ) T( I# o( K& P8 j  c& X1 z0 w
  995.     Mouse.set_mouse_pos(new_x, new_y)
    ; F) u, C' U; ^' l0 d( Y% Q) U
  996.   end
    9 U/ _* ]3 X4 j7 \4 c
  997. end7 n4 W  v/ T1 ^: o

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

  2145. % p# f' ]  O7 E: t
  2146. #==============================================================================6 ]& x- W; R/ l5 h9 N+ K) A& Y# Q" V
  2147. # ■ Game_Map& U! s8 `0 u2 H; y
  2148. #------------------------------------------------------------------------------( g5 N, T9 o& C  P
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。
    % n$ a, S4 P/ B; o! D  z8 z0 w
  2150. #   本类的实例请参考 $game_map 。6 Y7 e& O8 p# H) _$ D
  2151. #==============================================================================/ l' s5 X# F6 g- M
  2152. class Game_Map- C- H" h# z6 N( s- e
  2153.   #--------------------------------------------------------------------------- v# U. s/ p# ~# t* A, l9 [6 I
  2154.   # ● 定义实例变量
    ! E: x; T; P. H$ _8 S
  2155.   #--------------------------------------------------------------------------, A/ t+ T& x0 H0 K
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据" }& L8 S" A& \( \
  2157.   attr_reader mouse_map_y # 同上' q; w" w! M( r: A1 d! \! O$ ^/ Y5 @- Z
  2158.   #--------------------------------------------------------------------------
    8 M  E- Z3 p3 x9 W: d9 ^: G
  2159.   # ● 初始化对象: P  g+ [" d+ i. h6 ^7 I$ X$ f
  2160.   #--------------------------------------------------------------------------
    $ G8 {7 V( \. P8 K2 [+ b/ t$ M1 r
  2161.   alias sion_mouse_initialize initialize  v3 a- F* A$ Q$ _. T
  2162.   def initialize
    ( t. P  s* v3 t9 n4 H# Z4 V
  2163.     sion_mouse_initialize
    3 \7 k. S  t9 {2 R
  2164.     creat_move_sign  ###
    . R  V2 i1 D- }
  2165.     set_constants  T( Z# u% V) l% Z0 U! h  \
  2166.   end
    ) O$ w/ X# ?7 p- s7 m
  2167.   #--------------------------------------------------------------------------5 a" R  I8 T. I; ]* I( ?4 H
  2168.   # ● 更新画面
    * G6 O2 v9 U. a- j& f
  2169.   #     main  事件解释器更新的标志! E; i/ T$ Z7 V  s5 R) l
  2170.   #--------------------------------------------------------------------------
      g! z( c1 |& W, N2 g8 z
  2171.   alias sion_mouse_update update  ?" v! T' }' x; m( j% D
  2172.   def update(main = false)
    7 j3 E% X4 C2 o3 i  h
  2173.     sion_mouse_update(main)
    1 F- z) ^, i$ z( N4 p+ B2 R
  2174.     update_move_sign; Y; d) N: L: I" Z+ p' |) y
  2175.   end
    4 E+ k8 I5 U2 r) ~
  2176.   #--------------------------------------------------------------------------
    6 P3 K6 D, ~  n7 q8 \% q/ B
  2177.   # ● 创建显示路径点的事件
    " W# L* I7 v0 d! v9 I. I4 X
  2178.   #--------------------------------------------------------------------------9 }: X9 h5 w5 O4 Y3 w! Q/ H. t
  2179.   def creat_move_sign
    3 g+ o2 I( ?* z+ t. k6 {! W, A
  2180.     $mouse_move_sign = Move_Sign.new
    ( h$ f. e2 _; v/ U$ |7 \# s
  2181.   end8 t4 K% N$ H/ u( x% O) O/ ]
  2182.   #--------------------------------------------------------------------------
    + A( j9 r: R9 c/ }
  2183.   # ● 更新显示路径点的事件
    / f" h0 s1 T/ d$ \* h
  2184.   #--------------------------------------------------------------------------
    . Q+ E/ J0 K, R/ p1 A
  2185.   def set_constants
    + g! ?7 K8 N. l2 r1 w! R# @
  2186.     @mouse_pos_setted = true  k" Q3 j. I8 D! i
  2187.     @set_pos_prepared = false7 k' O% N. Z2 B) p7 e( t  e
  2188.     @mouse_old_x = 0) a; K. |' p6 _
  2189.     @mouse_old_y = 01 K. H6 l& ?/ w2 ~8 H& `" F  x
  2190.   end
    . M. ?' ^. H  u" N- L0 \" s8 A. K
  2191.   #--------------------------------------------------------------------------7 N1 U. @$ `" X: \5 p1 V
  2192.   # ● 更新显示路径点的事件1 n/ c1 P6 }* j- u' ?$ v
  2193.   #--------------------------------------------------------------------------2 Z! @% P! y3 a3 n! U8 h
  2194.   def update_move_sign
    9 V2 R" N3 u4 \2 X3 D
  2195.     $mouse_move_sign.update
    3 R! i% m$ D& q5 D* N: K) ]
  2196.   end& Q9 ]1 ?. A" B; t' R" i+ }
  2197.   #--------------------------------------------------------------------------
    - E' p! J  C* a5 X& ^
  2198.   # ● 获取鼠标位于的地图块的x、y坐标9 b0 r6 O7 t( \5 @' s
  2199.   #--------------------------------------------------------------------------
    6 U. a6 {# L* R; O
  2200.   def get_mouse_map_xy  u/ `/ \! C# V& D( k7 @
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    5 I, S( N+ n5 _& B! ^7 M" a' m
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i)) ~. ^$ D* q' f" J7 U* d& H
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i)/ }# u5 _  b" J% c7 T/ D7 {: f7 R
  2204.   end
    + u0 M: f  F) P# j
  2205.   #--------------------------------------------------------------------------
    . X( {: W( V. w0 x
  2206.   # ● 返回地图画面时重设鼠标坐标* J/ N5 v) X' y' I; m3 q* H
  2207.   #--------------------------------------------------------------------------
    4 q; t/ k" z6 U
  2208.   def reset_mouse_pos
    ) ?; v; A% o( x) [
  2209.     return if @mouse_pos_setted
    - s3 P3 ^: k& H7 N/ g  f# R
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y)
    3 k. ?, c4 F2 _+ v
  2211.     @mouse_pos_setted = true  o1 L0 j3 c, T* n
  2212.     @set_pos_prepared = false
    2 [3 _& ?+ M1 \$ x! t) E4 x; t
  2213.   end3 p7 o  z" w8 h9 p
  2214.   #--------------------------------------------------------------------------
    6 `0 ~) q" Y/ C8 E8 e8 F
  2215.   # ● 重设鼠标的坐标$ \$ g0 Y) o8 c# C2 w8 z
  2216.   #--------------------------------------------------------------------------5 a0 g8 [9 L% h/ ~' d
  2217.   def prepare_reset_mouse_pos
    2 c2 ~! I& W; F# w, [
  2218.     return if @set_pos_prepared
    8 r* b8 ^  q* {- y; ~, O, W
  2219.     @mouse_pos_setted = false9 U' \. p. o/ b8 A
  2220.     @mouse_old_x = Mouse.mouse_x
    ) L" j1 I1 Y1 c* n9 k
  2221.     @mouse_old_y = Mouse.mouse_y. Q, j* Y. ]# k* I
  2222.     @set_pos_prepared = true" G0 d- F; A3 Z
  2223.   end
    2 ~9 W) V' A: T; Y6 e
  2224. end
    3 e! m6 Z$ ^$ m: ?

  2225. # Q9 L6 Y( i' k+ G3 W; S: A' g0 [
  2226. #==============================================================================
    / l9 m; m" C7 s; p) Z4 U# X. V
  2227. # ■ Spriteset_Map: j0 q6 [/ `7 U: {1 V. X
  2228. #------------------------------------------------------------------------------9 |: D3 X$ q9 ]. D" A" c  f) ~
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。/ s7 T! o7 k8 u( f$ J5 f0 @" |
  2230. #==============================================================================
    2 k; d, ^( z+ I1 V$ E3 ]
  2231. class Spriteset_Map* ^; O) S, A: `" [& Z! C3 r
  2232.   #--------------------------------------------------------------------------
    ) Y, A+ V, v" D, y3 K
  2233.   # ● 生成路径点精灵5 h  P% L; E0 d2 s. O" x3 b& Q1 |
  2234.   #--------------------------------------------------------------------------
    * X1 A# a3 C) W. V" Q% {8 x
  2235.   alias sion_mouse_create_characters create_characters8 J' T. G  q% z- i
  2236.   def create_characters0 b" C- Z% }/ I/ {! J% [' V
  2237.     sion_mouse_create_characters
    7 C$ A4 p  |2 C/ M! C( Q
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))
    6 H3 x6 n& d* `  r% B7 F
  2239.   end
    * T) U( x2 L) [
  2240. end
    * Z, h# Q8 K) ^8 k2 C
  2241. / t7 o; n* `8 }) r
  2242. #==============================================================================+ e# v7 Q% O4 Y  e* x  A: Y- G" J( t; H3 e
  2243. # ■ Scene_Map' ^* l. o. i' I, d% s8 Z
  2244. #------------------------------------------------------------------------------9 s& Q* R' j4 @  l
  2245. #  地图画面
    & q5 @, _+ Y; z
  2246. #==============================================================================7 I0 M8 Y% E7 V+ h
  2247. class Scene_Map  Scene_Base- j( h' f) N! T* Q/ ?1 W
  2248.   #--------------------------------------------------------------------------
    4 s/ A8 H% s4 M3 z
  2249.   # ● 画面更新. m# A4 |: d- z( H7 I1 ~/ N! ?; a
  2250.   #--------------------------------------------------------------------------) h$ T& v8 Z; N! N( ?
  2251.   alias sion_mouse_update_scene update_scene4 E% q/ e# {0 m: \
  2252.   def update_scene
    ) o. X% a7 t0 _
  2253.     sion_mouse_update_scene8 p+ @# O: b: H5 R
  2254.     update_mouse_action unless scene_changing
    0 A7 Q  `1 t2 Y% H, \
  2255.   end& V% x! C) n$ w' U
  2256.   #--------------------------------------------------------------------------
      W8 A5 ?  H6 j, Y0 |
  2257.   # ● 场所移动前的处理& f3 W( X4 G) _, Y6 G, F( I
  2258.   #--------------------------------------------------------------------------
    " J+ _% n1 H3 N3 t+ H1 E
  2259.   alias sion_mouse_pre_transfer pre_transfer
    # B+ A9 q# u5 c* m
  2260.   def pre_transfer* \; k' S$ q) z( j7 E1 m; U3 e
  2261.     $game_player.reset_move_path
    * e* v$ G3 X6 @/ G: N- K+ \4 p
  2262.     sion_mouse_pre_transfer
    + J, H0 |6 a/ j
  2263.   end/ ]; w# J  i6 q) \2 f- f! h
  2264.   #--------------------------------------------------------------------------
    * q5 h; s1 _8 _( ~+ W, e9 R
  2265.   # ● 监听鼠标左键的按下
    5 h8 l* A5 u& j( Q1 x- x$ S
  2266.   #--------------------------------------------------------------------------
    - d4 M. X; A# [! }& d2 z& ]" ?
  2267.   def update_mouse_action' N% b$ v3 i& e% W. a5 F
  2268.     $game_player.left_button_action if Mouse.press(0x01)
    ! l0 ]9 R: i, |
  2269.   end( S. I- D* W/ R8 N3 }2 S" Z2 P
  2270. end
    8 w9 ~, O6 }, O" n0 q) D

  2271.   A* O) E) [- F
  2272. #==============================================================================
    / N+ F4 g: X5 [$ h
  2273. # ■ Scene_File
    3 r: Y5 e# b" c& v
  2274. #------------------------------------------------------------------------------
    , g7 v$ j7 B* M9 q0 @
  2275. #  存档画面和读档画面共同的父类7 v" z, j# s  F  T4 W* y8 U
  2276. #==============================================================================0 T7 j( s- ]5 p- f  Q% M
  2277. class Scene_File  Scene_MenuBase
    8 S2 l8 [2 T0 M" r
  2278.   #--------------------------------------------------------------------------1 ?, T9 h9 @  k  g% }) N: R
  2279.   # ● 开始处理
    / K! _! b; z. Y# O% ?. Z, Y
  2280.   #--------------------------------------------------------------------------
    . ^1 s! U3 l% T- ~+ U! Z3 i
  2281.   alias sion_mouse_start start. b. K" G% M/ Z8 i6 X. V
  2282.   def start
    9 }! h0 E0 d+ G
  2283.     sion_mouse_start
    7 w2 G* }# l, a: _- N4 H3 v
  2284.     @move_state = 0$ W) \( v' X9 ?: |
  2285.     set_mouse_pos
    9 V! t  w9 `7 p0 v, Z. D. F
  2286.   end4 y8 ^2 O( Y  e1 Q: c0 e
  2287.   #--------------------------------------------------------------------------0 e" _  S2 @4 R* Y0 i% `: p/ M! O
  2288.   # ● 更新画面
    2 u2 u1 a. z1 V# \& h. @- v
  2289.   #--------------------------------------------------------------------------5 o( y' ^4 @. O- E3 ~/ Y
  2290.   alias sion_mouse_update update
    8 F7 Y( G$ [" W
  2291.   def update! v, V( C, o+ k
  2292.     sion_mouse_update
    * R! j0 _; x- s, o; R# ~7 W. c
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos! X" R2 j1 ^. Q& H
  2294.   end
    3 a* Q1 H9 p  t% c( K% `
  2295.   #--------------------------------------------------------------------------
    * ^# m) g; C0 E* d# A2 O
  2296.   # ● 更新光标' M6 _8 F: p6 Q' {6 v
  2297.   #--------------------------------------------------------------------------
    7 h4 B/ D0 s; Q! y) T! E
  2298.   def set_cursor
    8 W+ Z9 P/ j, g: X' P" t
  2299.     @move_state += 1
    ' u" H  v" z# h& \8 S5 p' E
  2300.     last_index = @index6 r# b4 [! j' |5 \& n+ J) L
  2301.     if mouse_which_window == -26 v2 t9 h$ Y! O; R
  2302.       if (@move_state - 1) % 6 == 0+ E# G- R* K$ s
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1% C8 H  j$ M8 T, I9 _
  2304.       end$ `  I/ y: w9 u" G4 y9 r6 ]
  2305.     elsif mouse_which_window == -1, d' q0 O; W9 v: ?/ E
  2306.       if (@move_state - 1) % 6 == 0; X# c7 o0 k+ H
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    : V0 ?* |7 @! O& }/ o; Z2 w8 C, Y
  2308.       end6 K0 y9 B7 d8 K. R4 @
  2309.     else
    : T6 u! A4 G/ s9 i. s
  2310.       @move_state = 0- }, z: ?- A6 j9 [
  2311.       @index = top_index + mouse_which_window
    / |6 u/ A7 \8 v5 r0 O8 t9 G6 s2 |
  2312.     end
    ! s  q! w* f! }4 V4 j3 D
  2313.     ensure_cursor_visible& S0 Y5 s# _" k3 M
  2314.     if @index != last_index5 o5 o! h4 z$ x: G* l8 w5 A; k9 }
  2315.       @savefile_windows[last_index].selected = false
    0 |0 b/ j4 a+ y& ^3 L& k
  2316.       @savefile_windows[@index].selected = true0 |# K2 \  ^( ?* p; ?4 n
  2317.     end
    , h0 u& Y+ s* R# {) N
  2318.   end
    7 _) j+ H5 P( |2 }
  2319.   #--------------------------------------------------------------------------  r1 a% Y  Y! A9 L
  2320.   # ● 判断鼠标位于哪个窗口
    ' D, S& o3 l$ F# ]- |2 d
  2321.   #--------------------------------------------------------------------------
    5 j9 U! I$ k# B2 G/ [4 A& N
  2322.   def mouse_which_window7 b. ]- b. h$ i3 n  R
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y1 {6 G- m- d' N! C/ X' a- ^
  2324.     if mouse_y  @help_window.height + 14
    / j: h& p3 W( x. y/ i7 F% `
  2325.       mouse_row = -1$ z# p$ S9 h' i) U) Q; v
  2326.     elsif mouse_y  Graphics.height - 14
    1 |0 Z2 t& ^+ J3 R4 d+ A
  2327.       mouse_row = -22 F* U8 E- f! X% Q9 c, f$ p
  2328.     else
    - S, n0 K# }, A- b8 t1 o
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    % a* y" q+ \0 _# n4 f  }& e# M
  2330.         (Graphics.height - @help_window.height): J* p" w5 d. ]: T1 x5 m' o# Y- I
  2331.     end; k# p- p2 I0 {3 S; W! T4 Q7 y. t  f! l
  2332.     return mouse_row
    8 I( b$ H3 d6 Q, r, @$ X
  2333.   end
    5 V, ?1 u( K2 i
  2334.   #--------------------------------------------------------------------------9 s& `& g# q9 v# J6 l8 q1 O
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    ' _, I6 k: i. F& p- }1 R  V
  2336.   #--------------------------------------------------------------------------
    - m4 v$ V2 m& B6 e. t
  2337.   def set_mouse_pos" M# h6 ?  M+ z# N
  2338.     new_x = 402 _8 T; X3 \* K8 c8 T
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    - m  {+ ^7 }* K; j; t' X
  2340.     Mouse.set_mouse_pos(new_x, new_y)% J0 G: m" w! |, B3 s  u& B
  2341.   end
    $ `4 T( y5 M* N8 Q/ _
  2342. end! o; C% f  i4 j# U9 j9 {" A

  2343. ! o0 W7 k7 V' A. Q) ~" V+ n
  2344. #==============================================================================
    " m- K' M" G$ E. o' w# V5 r  U6 [
  2345. # ■ Game_Event
    5 \" D# ?5 I$ b8 \+ a4 |) G
  2346. #------------------------------------------------------------------------------
    2 L# ~! w/ q6 {( [
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
    $ |' f. W/ [6 a# V
  2348. #   在 Game_Map 类的内部使用。
    ' G! P/ \' y4 G8 N8 r( i. o3 i" i
  2349. #==============================================================================
    5 H$ Y, ]* t3 b7 v% k/ Z) n
  2350. class Game_Event  Game_Character
    : E' {" c# r% ]; |' @% y
  2351.   #--------------------------------------------------------------------------% Q6 @; T; ~' }6 m& S  O, K
  2352.   # ● 事件启动) x. @" E+ r* [$ L+ ]
  2353.   #--------------------------------------------------------------------------: s* o# j+ L( p0 w, v& R8 g5 K( P
  2354.   alias sion_mouse_start start" \6 y; \+ q  t& k
  2355.   def start9 m, |# P9 A* z% ?+ _
  2356.     return if mouse_start && !Mouse.press(0x01)
    1 r7 W' d# m5 v9 i; }% a
  2357.     sion_mouse_start5 `2 u% b& ]1 u( g9 q2 q  H: a- ~
  2358.   end) o) e! ?' a7 G4 ^! B( ~. Z
  2359.   #--------------------------------------------------------------------------# B1 G: U& I- G: `6 J
  2360.   # ● 判断事件是否由鼠标启动7 B4 w: \7 v* [' @' U" V
  2361.   #--------------------------------------------------------------------------
    3 a$ ^7 d* Z  |' S* [
  2362.   def mouse_start7 }+ z8 b1 X' ]. j
  2363.     return false if empty
    ' z! ~  Q. a7 c4 M. x* \4 B
  2364.     @list.each do index
    ) P& P: E$ e0 W' X3 H
  2365.       return true if (index.code == 108  index.code == 408) &&9 R$ m5 |+ F; ~$ [" j% a9 u
  2366.         index.parameters[0].include('鼠标启动')
    / R7 |$ s5 V5 B
  2367.     end' w* j, h7 R& T0 z& P
  2368.     return false' ]; }6 `$ K6 k; D
  2369.   end$ f. b' \) ]5 t9 q
  2370. end1 ~' c- R  N3 e& ^: m
  2371. + k" I% K  x( u: m: q
  2372. ####泥煤的height
    ) u2 P1 I' w0 G1 Y
  2373. # @height = height
    3 W' l7 k! W8 h+ ?! D

  2374. % U# p3 d& L0 g2 w$ t# |# l$ N
  2375. class Area_Response
    , L1 v7 j" O2 Q* Y- R
  2376.   attr_accessor type
    4 h/ a9 M5 c+ _
  2377.   attr_reader ox
    + V8 V0 W) P. W. i: x: t
  2378.   attr_reader oy
      \- L) {7 _! W$ k7 m& i1 X
  2379.   attr_reader width; |  X% p) P: l2 D, ]) L" f4 \
  2380.   attr_reader height' o# @7 ~  g6 x; c! a. N1 k* \
  2381.   attr_reader switch_id
    ; \, ^# {; y! L2 g. `3 i, P, [
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)1 R1 k: H. T! p* @
  2383.     @type = type
    ' l! B; t: ~% R4 I
  2384.     @ox = ox
    : H% Q  D' w  `" }- g( \
  2385.     @oy = oy- Y# b; \/ e0 J9 g( r
  2386.     @width = width
    4 T4 I4 T9 D. E- i4 ]& Z, J
  2387.     @height = height
    3 R1 [' Q9 b$ s; N* ~* h
  2388.     @switch_id = switch_id
    ' Q! R6 I% ^# f
  2389.   end
    8 @9 |: ]& f$ C* ^! I5 W- W
  2390. end7 @+ p" [# U( w9 X  l" l9 B
  2391. # V; [# N% l: Y' E
  2392. $area_responses = []' A, Q$ J  q( }# h/ n4 ]( _

  2393. & N. Z# {) Z, e2 E
  2394. class Scene_Map4 \0 G" ^& p- n
  2395.   alias update_mouse_2013421 update_mouse_action3 D( l8 m: j2 k8 F, ?& ~) H6 Z
  2396.   def update_mouse_action
    : Y- e- D9 S8 n2 y* M6 I
  2397.     update_area_response% }! c+ \. {) K9 |, c
  2398.     update_mouse_2013421
    & i1 p: {9 F/ n2 v6 V% E# e" P- s
  2399.   end
    7 O! ]$ I: W, B8 i9 R
  2400.   def update_area_response1 A9 {+ r# p: @
  2401.     responses = $area_responses
    6 Z1 ~4 V2 Q8 k7 ?- w
  2402.     responses.each {response- k1 f+ R! G3 P7 G7 Z5 _
  2403.       ox = response.ox
    8 \3 B) |9 A, {6 V+ ~
  2404.       oy = response.oy
    - e  I/ f+ ?/ }' y' g
  2405.       width = response.width; H! t5 ?$ W; G6 y5 E! k( H; U
  2406.       height = response.height* c+ R7 [) C, `. b4 C
  2407.       switch_id = response.switch_id
    3 O0 d0 v; G- H7 z1 `  @0 {
  2408.       case response.type
    - c8 j4 W5 d- d) F% X9 P- k+ z
  2409.       when 0
    5 e* s* ^4 C6 @
  2410.         if mouse_in_area(ox, oy, width, height)
    , k3 ~6 e) O0 g( k; C9 \! [( r
  2411.           $game_switches[switch_id] = true' {; D' e- v$ P, {6 K  E, v; d
  2412.           $area_responses.delete(response)7 {; {6 E( ]+ `4 d. m
  2413.         end
    + Q; G. ^& S: G7 p" y3 f) m1 r
  2414.       when 1
    " Q" A' d4 S8 s+ B4 z) y/ b
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)# D& C+ H& H; c1 Y, j" ~0 I
  2416.           $game_switches[switch_id] = true: a5 K0 d. J6 }. W) M8 J8 U
  2417.           $area_responses.delete(response)
    + C) {3 q0 M4 U: L4 ]
  2418.         end1 g1 @6 y$ R# |+ x* @8 ?
  2419.       when 2' Q- O  G& _& K; K* X3 U- u& \
  2420.         if mouse_in_area(ox, oy, width, height)
    % n/ ^- G4 C6 v8 |3 k4 w
  2421.           $game_switches[switch_id] = true' p9 `, k) m3 J
  2422.         else
    * t. {7 c2 E! l& p0 i
  2423.           $game_switches[switch_id] = false
    + D9 ^7 o8 j2 V0 Q6 S: z) _
  2424.         end
    6 \9 }( `/ F6 w6 ]# N$ K- A
  2425.       when 3$ Z1 |2 t" M- q& n! m3 X
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,, J8 L: m4 b) z# o
  2427.             (oy - $game_map.display_y)  32, width, height)  l! s- m0 E; W  [' n6 a; f/ J
  2428.           $game_map.events_xy(ox, oy).each {event
    ! U6 N5 U4 s: k7 p
  2429.           event.start
    3 G3 d. `  c2 ~# B/ n1 e9 x4 C
  2430.           $area_responses.delete(response)
    6 c+ A/ R5 C: ~* k
  2431.           return" ^, v: A  u6 P. S: _
  2432.           } # r" c1 m$ N/ f5 s6 x1 a5 g
  2433.         end
    2 g: i, g( m; `+ q) {! ~
  2434.       when 4
    $ {. t( \# J" R$ S
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,
    4 U' y1 B4 o* K' u
  2436.             (oy - $game_map.display_y)  32, width, height)
    ; R) E# p3 N0 ~2 v7 s5 f
  2437.           $game_map.events_xy(ox, oy).each {event0 H0 B2 W" ]6 W7 ]# X
  2438.             event.start) {& w( A8 i! M6 b0 S  s, G
  2439.             return
    8 g3 C5 i1 T) C8 f! t
  2440.           }
    " Q, g7 q) ?( A6 T, @
  2441.         end  d3 X$ N, Q/ N/ l4 i
  2442.       end
    * I* V2 l8 M1 `' G
  2443.     }) W7 s: c% v1 q, p2 K8 l
  2444.   end  L" n% x3 i# L5 G  u; U
  2445.   def mouse_in_area(ox, oy, width, height)
    9 [$ _/ v- b; e/ P
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&
    * o2 G! s" G4 U6 ^+ l6 E
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height
    ( v; `9 ~( ]5 ?7 Z) c
  2448.   end
    6 R  v' X. J$ |8 s1 ?0 N; A, Q
  2449. end
    ! D% x8 ~2 ?" h3 y* A
  2450. class Game_Interpreter
    . J6 N3 w* Q1 {) \0 u+ s% `& b  ?
  2451.   def area_response(arg), }& |- v0 S& a8 P
  2452.     $area_responses.push(Area_Response.new(arg))3 _2 o0 ^6 _7 N0 {2 B
  2453.   end
    # I; N1 c7 {1 I# w$ F
  2454. end! ^! K$ Z! X1 p, Y1 M" z  e0 J
复制代码

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

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

GMT+8, 2024-11-10 22:22

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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