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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================7 M( m" E& p) P% z! a6 C

  2. . X( X' o! d, c9 }. b1 X" s! ?
  3.   Sion Mouse System v1.3e; j& N$ [7 N, X0 C8 b
  4.   / c) b! k3 W7 }; g0 s- i& J  D+ G
  5.   Changlog
    + w* g" l, s+ \3 u; t- Q
  6.   
    : P9 \  d8 b! L) i. I& D8 l
  7.   2013.4.21 v1.3f
    $ }* @1 `! j& F9 o
  8.    
    * C5 e! W2 A) I7 s" a8 F% l9 \
  9.     1.3f 卷动地图 bug 修正- @  ?; }/ s; [# r
  10.    
    3 j7 ^. d2 W& d. w6 f
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口% |- A: X: _3 {( @  e8 Q% n
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内: T# b+ t# X; y$ G$ N
  13.                               Mouse.unlock_mouse_in_screen 解除锁定2 I. z/ h: A& f* x# T  ~4 P
  14. # q+ q4 K  E+ o, N! k9 d
  15.     1.3f bug修正
    / t* |- f' y9 _& G' U. j9 U% X
  16.   
    ! f* ~+ y' I! c
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及' v1 E0 L7 _) }  X
  18.           关闭菜单时,鼠标是否移动到原来的位置。( l1 }* Q! |$ v) D. @  L# P
  19. % N6 Y5 S2 f7 r2 Q0 ~
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处& N# }6 D" p* G6 N- G

  21. * c: @' p; g4 h0 N# R" J6 }
  22.     1.3b 修正一些罕见的bug;
    ( O3 [2 w- ?6 \( ^! b) m
  23. , E8 V6 i  U; U3 @5 H' N% _
  24.     1.3a 代码小修改;: M# p) A6 C7 t' c3 Y9 V- ^- [) R
  25.           加入了鼠标点击启动事件的功能,
    6 g( D8 |( T$ J
  26.           在事件中加入“注释”: 鼠标启动  ,5 e& G0 B" Q6 ?" H& p
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    1 v6 e) @+ _1 m9 o# y5 Z
  28.   ( f0 r6 [# ^* a8 g
  29.   2013.2.12 v1.2
    ' w8 h4 Q. b3 N

  30. + o" s! r- F. U' n7 t6 E9 ]
  31.     寻路逻辑优化;
    8 K- V! E. C4 |4 [: ^
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;) W8 P$ |) P' O
  33.     现在支持用鼠标来操作载具了。6 o# X9 f1 }, M0 g. ~" Y

  34. ' _+ J  G& ]! `" r
  35.   2013.2.8 v1.1% V. e, s2 @9 j- S9 {# p. l

  36. / _, W; E! \' |& g
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    % m* e! W/ u) c- `$ n0 y4 O3 j
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;6 g+ g2 K; ~# I. V' U, ~' X
  39.     移动时,路径指示点的绘制更加稳定;
    & c) H( m$ ?, [
  40.     现在支持默认存档画面的鼠标操作了。* T" f4 L, r! l' b* a2 M
  41. % T" w: C0 w8 O1 _8 L- |# x* P* _0 [
  42. 0 G! U& w5 J4 m* X9 J( ?% U- ^
  43.   OrigenVersion
    ' X, e- s' ^2 M2 T7 W$ H
  44.   ; i' c% A/ m: }& G
  45.     2013.2.7 v1.0 $ F( m  K) Q$ d5 e0 U* S

  46. , i& M, }7 x& B* K/ X& W3 ]
  47.   主要功能) r& K" |" e$ W- ^/ d! ?, G6 \5 l$ Q
  48. $ J, ]8 Q% O) a/ d
  49.       使用鼠标进行各种操作...0 U2 `) Z2 K' O/ [) {/ l# g7 u, r" t/ c
  50.       将鼠标锁定在游戏窗口内
    ; J3 w: j& g( a
  51.       自动寻路,按住 D 键可以扩大寻路的范围
      `2 s7 V8 ~* l
  52.       双击鼠标进行冲刺6 T4 g$ W1 m( T1 l0 _/ y
  53.       更改地图卷动方式以适应鼠标移动
    + e6 z7 Q8 ?! `2 o
  54.       变量输入框改良
    ; u$ k! Q  A; i9 k' D
  55. & }" I7 b# w: [( L/ [3 N
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹
    # W; _9 q* y5 y0 ]! J5 R6 ^* H$ Z. ^

  57. 1 X& Z; I3 p4 |; M* I
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹2 r! P, j! j8 \2 d- z, d1 ~/ j
  59. % [3 X  C* F; B
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    , T: @/ v: D0 d# X8 z7 o6 b, R/ W2 w/ ]

  61. ( U. N) q: j" C2 X0 q0 N

  62. " \8 o6 n  |- t+ j% m: W* o
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★
    1 f, N5 @8 h- B- Q
  64. : }, w1 c/ U5 m& E: O0 c
  65. 9 s; t; i$ d' L1 |
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示
    8 p' G' e/ M! A& Q2 i2 L
  67. 3 w! E, [3 P6 v- g& P$ J( ^% Y; Z
  68. #==============================================================================* p5 `2 W" a/ p; B
  69. # ■ 常数设置 * n) W3 _  U* p  K0 B% F
  70. #==============================================================================
    + X; h, Q$ _1 d. u
  71. module KsOfSion
    ; I( A, Q# Q% V9 k9 V
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false; J# j! }' N! W) a
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑
    , h) o; A. w& o7 C
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false7 H8 ]$ _, J2 ^. G" F
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量- h; E6 A7 o0 |) c; j1 O* z8 }
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    ( i3 ~, w, Q* ^  V1 R1 K  R
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧
    * {5 I1 ?5 c3 i( E# z
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)3 u1 B% K3 D5 U/ v& A
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键
    * @  s( F  u5 x) M9 H0 W: S
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)
    4 V2 Z& \9 Y6 y" d9 o9 U
  81. end" P1 n2 q; }9 d$ R: n

  82. . Y* g* W' t) y( J& M' [
  83. #==============================================================================  X- S* x8 e  E& J$ L
  84. # ■ 用来显示路径点的类7 l0 x; B% G  \0 V1 T8 O0 X* ]" i
  85. #==============================================================================
    ! M8 H' a  T8 r0 ~" u
  86. class Move_Sign  Game_Character4 o  n& v/ X- K5 R5 i+ k
  87.   #--------------------------------------------------------------------------  y0 ^+ p6 `0 ^% M; Y
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图
    ' V* ]' T2 n* P# U
  89.   #--------------------------------------------------------------------------
    2 O7 M# F& z  O" @: w1 R
  90.   def init_public_members) d$ g1 i# }, |: U* i
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹: h9 t. r- N8 J1 U) k7 q5 |
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    9 X6 x4 ^- P5 x. X: ?
  93.     @move_speed      = 5        # ★ 踏步速度: D8 p( n: y4 i5 V) v2 c
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    % ?1 T, r. F% }# q3 [
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度
    1 J, b+ R6 \5 f" m2 \7 {' u+ H7 c
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)
    * U5 c' I, f2 s2 [/ K8 T. P
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列5 q* e. u3 z2 ~
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)( D' k' `4 f. u/ ~8 N8 m* ~
  99. # F( Z; A( [. @2 h
  100. ' j0 p' y. H6 u* Z$ K' ]7 `
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    0 k: x; [& |$ f" b# e

  102. " u: M( ]0 c( Y: i- p3 `9 H- \

  103. 8 d0 n# h/ ?0 ~" A6 L
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
    " s/ F2 F& B3 J! {
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    . C3 v1 ~4 [1 }% o
  106. 0 _0 d$ l* j1 k: D5 R6 j/ Y4 q. _
  107.       if $no_arrowpic_warn
    / H" [% z5 H: i# b
  108.         MouseShow_Cursor.call(1)( I7 C* X9 u6 M5 J* ~# u" t% |
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png" X$ x& I1 F5 b; x9 k( q
  110. , {& O& f0 Q! Z/ T
  111. “路径指示点”将使用游戏自带图片
      B! I0 W4 M& N3 d) K9 a$ r

  112. : ?: t! U/ f% a! j" Z* A
  113. 该提示可以在脚本内关闭')8 _: }% \' c  ~( y
  114.         MouseShow_Cursor.call(0). G$ H2 V1 d$ ]: @5 N/ A
  115.         $no_arrowpic_warn = false
      D+ [% y6 ?* O4 F, z7 o
  116.       end
    3 |$ u5 l2 K' c: K
  117.       @character_name  = '!Flame'
    ; \5 `$ T. Q  s+ H
  118.       @character_index = 6
    " I# ^" g5 A  ?" H' d
  119. 7 I% \1 m. X$ X) j1 \. ~( L0 {
  120.     end$ Z, D' |6 _+ S( f' i( n  Z
  121.     @direction_fix = false  # 固定朝向
    1 O2 h1 l; T7 t5 S) o0 G( s4 A9 A
  122.     @move_frequency = 6     # 移动频率
    % q5 T" ^/ ]  _& I8 [/ A1 ~- E
  123.     @walk_anime = true      # 步行动画
    4 ^. y) j% d4 y
  124.     @pattern = 1            # 图案0 G& s6 F- d% Z5 W! |( l
  125.     @through = true         # 穿透
    8 E) o5 l. s8 p/ G! C$ K$ y5 C
  126.     @bush_depth = 0         # 草木深度  h9 @7 `. r. }
  127.     @animation_id = 0       # 动画 ID! d1 |3 S4 @; f+ r2 a
  128.     @balloon_id = 0         # 心情 ID
    + x- J# S/ ~7 `. v
  129.     @transparent = true     # 透明
    ; q2 O1 }4 V/ U1 i  G: T
  130.     @id = 0- E( \. y3 b0 k* J  Y* O: g( Q
  131.     @x = 0
      D! S- ~- e, v) t% A5 R
  132.     @y = 08 B0 U3 e( q6 @4 f: l& \
  133.     @real_x = 08 q. q9 K! X$ A5 o
  134.     @real_y = 0
    8 A4 S1 p$ {6 T. `0 k4 G
  135.     @tile_id = 0
    - y1 f1 Q! L: `" ~0 |: e8 ^
  136.   end4 p. [3 g) C7 D4 ^6 O8 \
  137.   #--------------------------------------------------------------------------
    . e7 Z: E3 C$ D" k  R  |( c
  138.   # ● 定义实例变量. a" f* @) Y: P5 c" s& h
  139.   #--------------------------------------------------------------------------
    4 ?6 ~7 X5 Z8 g( q9 J. Z' d$ x
  140.   attr_accessor direction
    - @  S0 e5 v- l: W+ v1 D/ }
  141. end6 z/ E5 b; Z, o9 ^" U
  142. % U5 q' P! L& x& y% f
  143. #==============================================================================6 \4 R0 E4 `7 v% K# s+ R9 U
  144. # ■ Module Mouse
    $ c3 @2 f' {  m$ P$ z) n6 Z
  145. #==============================================================================
    " |) Z9 A/ w/ {% i
  146. module Mouse$ v, V% S5 Y8 g- u& F0 v
  147.   #--------------------------------------------------------------------------/ M# u0 s+ A8 V; d$ {% X7 ?9 h; Y' X9 i
  148.   # ● API
    % ]$ n/ E$ A; _) u9 U- x
  149.   #--------------------------------------------------------------------------6 j5 ~8 s/ |# ?- K% J
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
    ' t6 }- b/ }8 l) l' B1 s( F2 k5 l4 L
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
    ; b! ]* m6 c# [5 h
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')- h" p* e% _0 X  B- Y8 d7 ]
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')# w8 @- O" D/ N; }) n
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l'): }( V8 V3 I7 I4 o* y
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')
    3 {% `( ]. G4 _, d# z9 B
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')
    5 W6 h7 |# d: P( l
  157.   Window_Hwnd       = Get_Active_Window.call7 \6 \+ i; {2 q8 l
  158. 6 _' z* F; N: h5 Y4 t3 ]# l
  159. class  self
    1 |9 t2 [& [/ n" U' q
  160.   #--------------------------------------------------------------------------
    1 h) R3 l9 @5 O: b$ Q- ^
  161.   # ● 初始化
    ( V3 e2 I$ J$ y1 t- E
  162.   #--------------------------------------------------------------------------3 v6 l3 l. C5 N% z
  163.   def init6 n1 y( i  \; A" x3 U
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor
    $ @+ c4 U5 J8 g
  165.     @left_state = 0
    + }, ^7 }+ @: C: }+ ]" h* S
  166.     @right_state = 0" Q; D& [  A* x! ~7 ?6 d1 v- k
  167.     @ck_count = 0 # 帧数计,单击以后从0开始
    ! |, S; d/ r8 _# h
  168.     @dk_count = 0 # 用于双击的判定: w# E; e5 |2 G$ l) P: v
  169.     @clicked = false9 B+ S% g! \( `0 w
  170.     creat_mouse_sprite+ r3 }6 s5 t5 n4 p* q* `7 [
  171.     update# N# U# W8 p0 Y0 k
  172.   end+ \' C$ F4 T# O; N/ E/ }
  173.   #--------------------------------------------------------------------------
    ) O9 I% ~: u1 ]
  174.   # ● 鼠标指针精灵
      K2 R" y' _/ X; S: X
  175.   #--------------------------------------------------------------------------. D5 u1 c" W' t# k0 {% j1 X
  176. #~   def creat_mouse_sprite
    / \6 L. o1 Y7 U# w! V: v
  177. #~     2 N- T+ O9 d$ t0 K
  178. #~       @mouse_sprite = Sprite.new$ F; K! J$ C) u$ Y4 N$ b+ t+ B5 a
  179. #~       panda = 2#rand(2)+1& ~" y$ E, G! ^

  180. 9 y( h9 O/ [' ?7 N4 W% f* B+ x3 e
  181. #~      if panda = 1
    . s1 j# c# z! T( y
  182. #~        if File.exist('GraphicsSystemCursor2.png')' d) A, b0 O' R
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')# E' X9 ]5 X4 b7 j# G# s; J9 d
  184. #~        end#with if File.exist" K& t" K6 ~' x, g4 H( x
  185. #~    . e4 L  D: P/ \4 g
  186. #~     else if panda = 2 #with if panda=1
    4 v6 d' ^9 @0 T4 |7 A% }
  187. #~      
    3 q; e. n3 R$ G% _0 M/ @7 y/ @
  188. #~      if File.exist('GraphicsSystemCursor2.png'). S) j- _8 m& o5 ]- ?3 d
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    0 T$ [5 r, Q- b3 A) G3 b
  190. #~      end#with if File.exist
    7 c3 W, k2 G' A" u
  191. #~      
    2 l2 S5 B2 T: l, Q
  192. #~     else #with if panda=1
    ) _' s8 A7 e1 w# w1 q6 g
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)4 D& j) O# a3 W( @
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),
    , z9 l) h8 |* h/ q2 h
  195. #~       Rect.new(5  24, 24  24, 24, 24))
    ) z  `; L6 R3 K2 u3 W4 A/ G% w
  196. #~     end#with if panda=1
    2 I* S0 }6 Z2 \/ h' N3 f9 m
  197. #~     % ?* [+ v  ?* v7 E, i( x9 J
  198. #~     #with def: {% P0 g0 ~9 G7 I) D6 K+ ]
  199. #~   end( |5 d5 E, ?! E
  200. def creat_mouse_sprite
    . O9 Q! I1 q* b. j  x+ w' Z8 `, H
  201.     @mouse_sprite = Sprite.new
    0 F; i( W5 Y3 h* R
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})( e( M" I8 y1 L" ?# Y0 C5 ]
  203.     @mouse_sprite.z = 99992 B' d; O+ a! z7 u
  204.     Show_Cursor.call(0)
    ; U  G! g5 x4 ~  g
  205. end
    / r: W+ l& y+ n& S/ N+ D4 T. ~; U: x
  206. 9 W4 j* u* [3 @. [+ I0 E, @, p" n
  207.   #--------------------------------------------------------------------------" e, }0 Y$ O! D+ P! p
  208.   # ● 更新& d* V& j; f: p
  209.   #--------------------------------------------------------------------------
    ; K9 o5 h$ O' @; [- m& l0 _/ W
  210.   def update
    7 c8 A* @/ p/ _! W
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos* Q- F' {# s: D* `
  212.     left_state  = Get_Key_State.call(0x01): w) m+ s7 Z& i  s# \. Z4 e0 U* q
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0& C0 E$ X8 y  _$ }& b$ v6 r& A8 S5 S; l
  214.     right_state = Get_Key_State.call(0x02)
    ( t2 {2 s& Q8 J" ^
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0
    * W3 e0 X0 s" w( ]7 W7 t
  216.     update_double_click/ B1 g& I2 o0 I: S
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1
    ; u7 z# ^% H; A" L8 g
  218.   end
    . \- h, A# |; o# @- T
  219.   #--------------------------------------------------------------------------7 b! C% S9 g- m7 a6 `! E
  220.   # ● 获取鼠标坐标& n- w+ W7 y# W
  221.   #--------------------------------------------------------------------------: w& Q) a; n- f2 P& |6 ]
  222.   def get_mouse_pos
    / Z5 h3 ~1 W+ z. }+ p6 K
  223.     arg = [0, 0].pack('ll')
    # P1 R. ]0 G4 F+ w% |
  224.     Get_Cursor_Pos.call(arg)- t: P+ _  p: S2 G
  225.     Screen_To_Client.call(Window_Hwnd, arg)
    ; f3 k2 H6 t: b" J% @
  226.     x, y = arg.unpack('ll')  P5 L" F- |1 X9 z- A* Y7 a
  227.     return x, y  L' p3 u1 Z  T
  228.   end
    : M: Z. G  g7 \& N
  229.   #--------------------------------------------------------------------------
    0 v) w, y1 Y2 g( N# z# z
  230.   # ● 将鼠标固定在屏幕内4 F9 _/ @& W% j
  231.   #--------------------------------------------------------------------------% R3 t. H! ]& J6 f
  232.   def lock_mouse_in_screen
    9 z% W* Q2 l: K% X
  233.     arg = [0, 0].pack('ll')9 g0 a9 ~  q, d9 s8 u5 F3 C
  234.     Screen_To_Client.call(Window_Hwnd, arg). S" U; M4 q* w& M0 A. x1 j+ G
  235.     x, y  = arg.unpack('ll')! l6 R+ h! O; D! `) P
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))" ^& V" e9 q0 V" w% G
  237.   end3 E! X  y5 o  i% P; w3 k: r
  238.   #--------------------------------------------------------------------------6 q% i/ n: v4 L# `1 h
  239.   # ● 解除鼠标固定8 j% c6 J- X+ b
  240.   #--------------------------------------------------------------------------" z6 A+ e/ Y# p
  241.   def unlock_mouse_in_screen
    6 v: N$ R  H5 y6 F
  242.     Clip_Cursor.call(0)% A: Z5 Z) P' J2 w
  243.   end! g+ K. @- u( @6 q  X: @. H
  244.   #--------------------------------------------------------------------------
    ) \5 `  e  d  I, Q' v
  245.   # ● 鼠标双击判定0 c+ O+ ^- n* ~. q! r+ j( ]
  246.   #--------------------------------------------------------------------------
    1 Q8 V! Z8 k8 ^6 E
  247.   def update_double_click
    ; I- B( q. y+ T! f: e( \% ]
  248.     @clicked = true if @left_state == 1
      r" R+ d0 K& H& P2 X$ C: z2 \
  249.     if @dk_count  0 && @left_state == 1: f5 P* P3 c5 X( L
  250.       @dk_count = 0; @clicked = false. n$ _, }; s/ _! f% ~) G
  251.       return @double_click = true0 D- U, ]  l' H9 I! `; P! x: i
  252.     elsif @clicked
    5 E. M+ m% _" u1 m2 [5 a5 K2 `
  253.       if @dk_count  KsOfSionDbclick_Frame4 \+ t3 X( U  q' Y3 c" e- i+ i
  254.         @dk_count += 1/ r( i# d2 u: [) _. r, b0 K5 K
  255.       else
    - R/ J4 v5 G& c" a+ L6 {+ m8 B7 P$ s
  256.         @dk_count = 0; @clicked = false
    ; z1 x, S3 ^1 ~' [# \- [
  257.       end
    ( D. J; f0 V+ v& }: I; V
  258.     end
    * \7 ]+ l# X1 M+ a' F" P
  259.     @double_click = false& o; Q  M1 o! Z9 c  Y
  260.   end$ S6 d/ F# O9 C. l, b% f2 u
  261.   #--------------------------------------------------------------------------
    2 d# M9 Q* c! Z& P5 `
  262.   # ● 按键被按下就返回true- ~: |; u& z0 ]$ ~
  263.   #--------------------------------------------------------------------------
    : b' X+ I: [  c( g9 W8 E
  264.   def press(button)! p- k2 a0 U0 _( J- B/ a% g
  265.     case button
    6 @1 k. d: I( Y9 x- _# |" c4 a8 N
  266.       when 0x01; return !@left_state.zero
    0 i( i% s% O  S% i
  267.       when 0x02; return !@right_state.zero$ I' c8 H2 Q/ O
  268.     end
    % A& p- u' ^) n1 e
  269.     return false7 w4 s) ~$ m' J1 I, }1 g3 [% V
  270.   end
    " d: s# V$ y5 j& ?' Z/ H6 a8 j
  271.   #--------------------------------------------------------------------------
    $ w1 ?( B6 }# H% b2 D. n" K
  272.   # ● 按键刚被按下则返回true6 K: X% ^/ o( z" N9 U7 n# A* g
  273.   #--------------------------------------------------------------------------
    , d$ k& o( ]9 X* y; j( G" D
  274.   def trigger(button)$ P( G* ?( x; X8 \8 j. ?
  275.     case button
    . z2 j: L. o/ ?8 P8 x1 [* `
  276.       when 0x01; return @left_state == 1
    * g( w) w. `. _. [$ f8 _
  277.       when 0x02; return @right_state == 1
    9 }9 h/ ~7 A6 d5 W$ X7 W7 [- M. j
  278.     end
    & \- G2 t# s3 k: y: k' W
  279.     return false; L6 I- Q) k2 Y% e3 p2 k3 E
  280.   end
    5 ^5 m) h3 H( g# R
  281.   #--------------------------------------------------------------------------/ Z2 [% E9 a3 t
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true8 [: Z# _+ B; I5 o0 ?$ q
  283.   #--------------------------------------------------------------------------
    % \* K5 \& w& [
  284.   def repeat(button)" }' ?9 Y+ `; t3 }% E3 S
  285.     case button0 ]- o& _( u7 a! Z
  286.       when 0x01; return @left_state == 1
    5 c: F# z4 F4 D" o
  287.         (@left_state  22 && (@left_state % 6).zero)% x5 l  G. X: P) \4 y& ?" m3 f
  288.       when 0x02; return @right_state == 1
    - i' _3 U0 U4 |& S8 \
  289.         (@right_state  22 && (@right_state % 6).zero)/ j: o! d. S! P
  290.     end7 d6 u4 `( n  g7 z, X7 W4 o+ O
  291.     return false% a3 k* k# A* }" t& ~8 t/ A
  292.   end
    0 l. Q9 d9 p  X
  293.   #--------------------------------------------------------------------------
    6 |# x) c" v  N) N6 j9 a" Y
  294.   # ● 判断是否双击鼠标- D) Q0 B3 V& E" d5 K
  295.   #--------------------------------------------------------------------------
    $ }6 p! V" @' C# V3 L' i$ u) x8 ]6 ~
  296.   def double_click8 o7 W* z- @0 `& f5 O
  297.     @double_click
    * _# }/ y% |9 ]& c' ?  r  }
  298.   end
    ' x8 m- i" t8 V+ b
  299.   #--------------------------------------------------------------------------) X, N. s2 H  G6 F/ e
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)
    : s. H! k+ `; b8 s$ C
  301.   #--------------------------------------------------------------------------
      J* H/ }  Z3 |( z# u0 J; }
  302.   def click_count3 X- `: f* s/ j  z- F' a
  303.     @ck_count
    0 M, ?$ I# c8 e0 b; B
  304.   end# w; w3 p, H/ A  w( E) Y
  305.   #--------------------------------------------------------------------------' V* m' w! Z8 x1 Z
  306.   # ● 获取@left_state(按住左键每一帧+=1)! `/ j+ f' `* @! d3 ^
  307.   #--------------------------------------------------------------------------: d  a0 U2 P1 C) J; X/ L' v
  308.   def left_state
    0 q0 `  ]: _- W. \5 B' W3 W- z
  309.     @left_state
    ; \5 g3 W: j4 z4 D- K4 Z8 I
  310.   end0 X$ M6 ?2 h3 \1 g# ?3 t
  311.   #--------------------------------------------------------------------------" p: {" n& u! v
  312.   # ● 获取鼠标的x坐标8 M+ _' a1 d* l+ W& J: n
  313.   #--------------------------------------------------------------------------
    / O5 Z! j4 ~8 o  U2 V' M
  314.   def mouse_x) O/ [* f! W% Q3 T) s  Z, s
  315.     @mouse_sprite.x
    ' K- z* F* D. _9 I" T- {: [
  316.   end
    2 h4 m$ U0 @9 K5 F& \
  317.   #--------------------------------------------------------------------------
    8 c6 ?& b  `" t7 z; {
  318.   # ● 获取鼠标的y坐标& ], i! F# ]8 F0 u. r
  319.   #--------------------------------------------------------------------------3 n! t; D( f+ ~, U: O& n0 z: Y6 a5 [
  320.   def mouse_y
    / A/ I8 a, K  L  v* K
  321.     @mouse_sprite.y
    0 A$ {5 H1 Q* ?& v  Q; l; m( C
  322.   end: Z( D2 P$ ]+ x2 a! U. u+ M
  323.   #--------------------------------------------------------------------------, q$ P5 ^3 ~( ^. a
  324.   # ● 设置鼠标坐标
    . M/ f7 j1 O7 L- f- _% v4 K, v' {/ {
  325.   #--------------------------------------------------------------------------& |4 K" c( x# v4 X# j
  326.   def set_mouse_pos(new_x, new_y)
    % {8 R- N+ g. ^# o" X/ I& k
  327.     arg = [0, 0].pack('ll')  j+ [( i/ v  ^' G2 v
  328.     Screen_To_Client.call(Window_Hwnd, arg)9 ?# a( ^; ?4 ~% f- Z) `/ m
  329.     x, y  = arg.unpack('ll')
    : H, R$ Z4 q5 M( |  N2 F% f* t
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    2 D4 S3 m+ m# L4 ~  X
  331.   end( A' E$ |, H0 e" ^" J
  332. end #end of class  self + o9 `: w. Z1 W7 I; l

  333. 6 s6 T+ T' |1 k' r$ v2 d
  334. end
    ) Q2 ]6 [6 n) Z- O3 l

  335. . K* b& Q3 ^6 T$ P" A( z
  336. #==============================================================================
    $ b. S! K8 ?  F# W5 }6 }+ C1 Q
  337. # ■ SceneManager2 r+ n1 A& Y2 y8 ?
  338. #==============================================================================* ?+ Y0 D& v3 \; R% Y/ W; |* J! |
  339. class  SceneManager
    5 c" k$ E8 L4 ]; f0 b6 B
  340.   #--------------------------------------------------------------------------# z% [' U1 D$ ?+ {
  341.   # ● alias4 V& o  F0 L7 @
  342.   #--------------------------------------------------------------------------
    5 ~2 V4 p/ ]+ Z: I
  343.   unless self.method_defined(sion_mouse_run)% L# u0 g. N& _9 ^$ {$ `$ f4 R/ A
  344.     alias_method sion_mouse_run, run
    . t8 X( a4 _' C
  345.     alias_method sion_mouse_call, call
    " ^$ }' W3 I: P/ F6 M
  346.     alias_method sion_mouse_return, return
    / ]% I( `5 o  K' G
  347.   end" u1 d- n4 j4 O+ ?/ ~- U
  348.   #--------------------------------------------------------------------------
    5 D% }2 H/ c0 ^
  349.   # ● 运行
    ! K+ Y1 e. v% V( R$ I3 e
  350.   #--------------------------------------------------------------------------
    5 w6 Y8 F0 C# @/ Y3 h
  351.   def run
    & f# Q5 l2 j& ^5 X  v/ D5 Y
  352.     Mouse.init+ k" n2 b& \  A8 h5 K# n  o
  353.     sion_mouse_run
    " [+ m0 D% t" t9 I
  354.   end
    % c% Q  r: k' O: Y; r* {
  355.   #--------------------------------------------------------------------------
    8 ?- z, d9 b% P6 v5 w  a
  356.   # ● 切换( E8 P6 L0 t9 X* ?, z3 s
  357.   #--------------------------------------------------------------------------3 N7 }7 E7 a1 o9 d! a* D( i# x5 Z& O
  358.   def call(scene_class)
    8 X- O* `5 |' Z$ o
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)
    " q  E& C8 Y8 t' i
  360.     sion_mouse_call(scene_class)& u7 w8 r0 ]+ U) {3 V
  361.   end
    ; h. h. H" ?/ z' Y2 M9 J& i
  362.   #--------------------------------------------------------------------------
    3 ?: C7 X' G! I" b' s4 g' d5 D
  363.   # ● 返回到上一个场景
    $ f* c( F6 w% |# S5 w; C
  364.   #--------------------------------------------------------------------------
    $ f" F; C4 T* W! u2 m
  365.   def return* M. R+ \& ]1 H" F4 I" E
  366.     sion_mouse_return& v5 F: Y+ h5 W5 `0 z9 p
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&
    & J  a6 S4 w+ ~! H
  368.       @scene.instance_of(Scene_Map)4 i/ r% Q8 l+ h$ m) r) t# z
  369.   end
    % E0 o/ _: b" K* W- {* ^* L
  370. end
    7 G$ U" F3 `& q+ T" w
  371. 3 I8 Q$ K8 F+ l$ C
  372. #==============================================================================7 I& j* d- O% J+ }- {: T- y: s+ Z8 b
  373. # ■ Module Input
    1 ~6 t; x8 U6 p9 e3 C# K* J
  374. #==============================================================================
    6 q) f# B  S( s5 J) r2 y8 C8 f
  375. class  Input: O$ T* y! h4 y$ E. G) ^- y
  376.   #--------------------------------------------------------------------------9 D4 @" Y+ M+ Z- Z- d4 t5 K( q
  377.   # ● alias
    / ]& D# b9 K/ X+ q2 q; u
  378.   #--------------------------------------------------------------------------) f9 L- ^1 i- Y9 i5 S
  379.   unless self.method_defined(sion_mouse_update)' K6 r! S2 T+ q" }5 M3 V
  380.     alias_method sion_mouse_update,   update
    % N: i& W1 k8 B( h
  381.     alias_method sion_mouse_press,   press5 }4 x6 G. i4 ^- j  l- [
  382.     alias_method sion_mouse_trigger, trigger
    ) H! |2 [& |, w  {7 u
  383.     alias_method sion_mouse_repeat,  repeat5 E+ @7 \: |2 S
  384.   end
    & t! X  {. m. o7 h3 D% h5 E
  385.   #--------------------------------------------------------------------------( H, o! n# I: k; @% P0 a
  386.   # ● 更新鼠标
    ) x& l( `$ b$ {  j: g
  387.   #--------------------------------------------------------------------------
    . F0 \; X" G. d3 a' l# M1 }- ?( x
  388.   def update8 J/ B6 F8 ?# M# D+ m1 A
  389.     Mouse.update
    . C5 z; V* T, E: H! `4 p# L/ I
  390.     sion_mouse_update( z5 ^8 }. o" N4 s7 C) Y% o
  391.   end5 M4 [$ w. {4 c5 M4 o8 a
  392.   #--------------------------------------------------------------------------
    3 t" u) E; `( x9 C" h) ]2 `
  393.   # ● 按键被按下就返回true
    ) {- g& @+ h& w# y0 Y# L! S
  394.   #--------------------------------------------------------------------------
    ( k. _' V+ p1 @& d' E! w7 a+ I* b
  395.   def press(key)
    " U1 o+ d$ p# y3 V
  396.     return true if sion_mouse_press(key)
    % A  A6 J- w- p, c
  397.     return Mouse.press(0x01) if key == C
    ( U& d+ K5 |2 |, K( U
  398.     return Mouse.press(0x02) if key == B
    # f, h8 H- T( z, h
  399.     return false
    2 E2 d3 F6 L- K5 d% \( z
  400.   end
    9 w' N/ I' E0 {, E% r# U: x' A
  401.   #--------------------------------------------------------------------------2 u7 c/ _7 J" |4 m1 V) Q0 q; F
  402.   # ● 按键刚被按下则返回true; j0 v& ^' e7 K7 @! T
  403.   #--------------------------------------------------------------------------) j. S0 J  F! @, R) I3 y
  404.   def trigger(key)
    * C' ]: c$ t+ U: p( t! C6 S
  405.     return true if sion_mouse_trigger(key)
    - U$ J$ S  x) ]6 \. @" G+ n
  406.     return Mouse.trigger(0x01) if key == C+ c  V7 u6 Y6 L6 W( U9 \. X
  407.     return Mouse.trigger(0x02) if key == B8 T" k, h6 c/ k/ r) H
  408.     return false8 d+ b- U6 N5 q- M; W% H
  409.   end
    6 N  |0 `, h1 V- X
  410.   #--------------------------------------------------------------------------
    . g: w6 R  q) \" e( P, z2 {/ b) i0 L
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    ' d1 J' t- W6 v# `+ P/ k
  412.   #--------------------------------------------------------------------------
    ( M+ H  W- n5 P
  413.   def repeat(key)
    / Z( Z9 F8 X3 q, L( x* _$ H
  414.     return true if sion_mouse_repeat(key)
    * T. s. j) z% n& @. |
  415.     return Mouse.repeat(0x01) if key == C2 C! Q! P- @; ]8 A
  416.     return Mouse.repeat(0x02) if key == B' s! t( \0 @" z+ B2 B
  417.     return false
    9 a3 W+ }( S  Y. q3 I/ O
  418.   end
    - U6 ]6 ~8 G# f# B
  419. end) I- F  O+ B2 {- A/ A# h

  420. 7 d7 @8 |) S% }, P) B& h
  421. # M6 |* D0 H, x4 x. A6 q
  422. #==============================================================================
    2 T, H/ p2 a) c% B  {$ {
  423. # ■ Window_Selectable
    2 K! F6 o" `, Y; ]9 `5 t7 a
  424. #------------------------------------------------------------------------------& {8 x7 B1 u. V* c, q: E" D2 E5 [" K
  425. #  拥有光标移动、滚动功能的窗口
    4 _; v9 e2 d* q8 y8 r, J1 z; v: v: q* [
  426. #==============================================================================
    ) v% I( M$ [) n( o6 ?: V; V  c
  427. class Window_Selectable/ e+ u$ Q5 r! @+ |/ {: g7 j
  428.   #--------------------------------------------------------------------------* y+ k- b( G' v$ K$ W/ r. \
  429.   # ● 初始化, a) P) p6 a! M. B/ q
  430.   #--------------------------------------------------------------------------1 l& [$ E6 C4 p* H  f
  431.   alias sion_mouse_initialize initialize
    ' V# u- Z  d) ?2 z) i7 p
  432.   def initialize(x, y, width, height)3 c8 P8 T0 E4 G* Z- k. _
  433.     sion_mouse_initialize(x, y, width, height)
    * ^; f5 Z2 M5 n5 ~+ W# r: d
  434.     @move_state = 0+ V9 P6 q1 o0 d- i% q6 k: L  l
  435.   end
    . v: n7 j4 }" A( @! s) b3 Z' _" b3 J
  436.   #--------------------------------------------------------------------------  n& _4 a2 l+ D5 i" n% B! g; m
  437.   # ● 更新
    # h* _) _+ r2 Q/ S3 o) U
  438.   #--------------------------------------------------------------------------
    # H$ }, c/ V8 X( U; w
  439.   alias sion_mouse_update update6 H  |* O* H4 c, z' K
  440.   def update
    9 @: N+ p* A2 U( @2 e6 y
  441.     sion_mouse_update  Y, G9 t: v& ^2 w: W
  442.     update_mouse_cursor- L  z2 x$ {. M" d0 s$ _8 ~
  443.   end- V* t3 ~) }6 S
  444.   #--------------------------------------------------------------------------. p/ u# U! @( g
  445.   # ● 启动后设置鼠标到index位置, [. C0 H) z) |
  446.   #--------------------------------------------------------------------------3 p% P% @* {; p; ?' d
  447.   def activate+ f0 v) W+ [1 W8 _4 |! C
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    ; p4 }2 i8 y& D8 |  `
  449.     super
    6 j5 w% j" h" z9 a7 E3 i% _
  450.   end
    ( |7 s7 a5 I; J) t
  451.   #--------------------------------------------------------------------------
    * s9 |$ |, ~6 k* L: L( ]
  452.   # ● 更新鼠标和光标的位置
    3 [* @& C4 B" O1 [
  453.   #--------------------------------------------------------------------------
    + h5 q4 h0 |+ }, M; d9 T( |
  454.   def update_mouse_cursor4 U* G, q1 l- f9 b( O
  455.     if active/ K% z+ K- i# W. e+ \5 R: x
  456.       if @need_set_pos
    7 k' [; D8 B- [8 J
  457.         @need_set_pos = nil
    & W2 C" U0 j& z" C4 f) U" D5 j5 m
  458.         set_mouse_pos
    3 O3 k, r  F/ y
  459.       elsif cursor_movable% t& s, ?& W4 p4 g0 h- z
  460.         Input.dir4.zero  set_cursor  set_mouse_pos
      _% o; I+ y0 {5 j
  461.       end
    % N$ b) G1 X7 H) s% D8 v' R
  462.     end
    & P0 Z: A. R& r' i9 p6 h' p
  463.   end
    & P& x0 ^- U/ m2 H% @3 N7 \
  464.   #--------------------------------------------------------------------------. {0 l0 k2 p* g0 |6 \1 [; r
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能) n4 e: H5 |7 e, {- ]4 q
  466.   #--------------------------------------------------------------------------) E' k, Q# T9 P/ t! h
  467.   def set_cursor
    & q* J$ W2 e2 |/ i9 H
  468.     mouse_row, mouse_col = mouse_window_area
    $ r! u9 J+ w3 C2 R1 K( P) g
  469.     if    mouse_row == -17 d* G3 b' z9 j6 h
  470.       @move_state += 1 if need_scroll
    7 v3 ~' C- w/ g
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand1 M, M; ^1 w; X+ e: I( v+ D% [* ?. P" v
  472.     elsif mouse_row == -2
    : G& l0 ^5 k$ E  [* x
  473.       @move_state += 1 if need_scroll
    & T4 w" Y7 k* H2 G$ l! ^
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    ) H# s8 s; B: u# ?/ ^4 J
  475.     elsif mouse_col == -1
    6 }" L. s; s) }
  476.       @move_state += 1 if need_scroll0 F* P# \$ g# v* a! }9 I+ v
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    / u( ?# |9 u: @" ?( J( d
  478.     elsif mouse_col == -22 z4 _! \, i% J& C: H
  479.       @move_state += 1 if need_scroll
    6 I/ F4 j7 n% M
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
    . \5 q' b* [3 L5 b, c& X# a
  481.     else
    4 @& G, Q( P% |; l$ v! l% C
  482.       @move_state = 0
    1 |4 c% z* v4 j. g; k1 b6 P* Z9 R: i
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col) g! s) G& y3 K# `% Z) v9 x
  484.       select(new_index) if new_index  item_max && new_index != @index* l9 n: O) s; Y! O9 ~5 t
  485.     end5 g- [) C* `: x" c$ g1 u0 P
  486.   end: [8 S/ w' @( X( {8 d- V
  487.   #--------------------------------------------------------------------------
    ( V+ I, B8 a: g  i6 q) s. R
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    3 l6 ~/ |& d  T' n, n8 H' Z: Z+ V% D+ _
  489.   #--------------------------------------------------------------------------. R) h% g% D' {8 @) U* g1 ~! G8 d% P
  490.   def mouse_window_area; c/ V# j' S  W
  491.     if viewport.nil # necessary!
    , y3 w$ D* c5 z9 w- R* |+ \
  492.       vp_x, vp_y = 0, 0
    9 J7 j3 j& H+ j4 C! n/ P
  493.     else; J- m) ^. T# d8 g! T
  494.       vp_x = viewport.rect.x - viewport.ox9 R& q, Z& o4 [7 B6 P# T
  495.       vp_y = viewport.rect.y - viewport.oy
    : i* O7 r4 _9 d' P  b
  496.     end4 {9 v- D0 J3 m# A- f' J
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y4 j) ^( A/ Q) y1 c4 r0 \2 p
  498.     item_x1 = vp_x + x + standard_padding $ _6 u9 Z5 M5 Q' ~! B- u
  499.     item_y1 = vp_y + y + standard_padding
    - f: B9 ^& t: O1 L" Z+ v
  500.     item_x2 = vp_x + x - standard_padding + width
    * u- Q" t, Q" k8 h9 W2 H9 |/ r
  501.     item_y2 = vp_y + y - standard_padding + height
    + V4 q+ G/ J7 A" `
  502.     if mouse_x  item_x1
    , H; F: m$ h: h! s1 p9 {' X
  503.       mouse_col = -11 F9 B- w8 W9 t  N
  504.     elsif mouse_x  item_x2
    * m4 |) s2 [% J& U. a
  505.       mouse_col = -2/ y* E0 p1 B' v5 v% E+ Z, k9 a
  506.     else3 D. D( i2 h8 M
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1): b, S- D0 e0 m; M0 K( |( [
  508.     end, {' N$ A5 q+ L' e; Y
  509.     if mouse_y  item_y1
    " Y- A4 I# t. m, \' `
  510.       mouse_row = -12 R2 T" k  Y' V7 ?3 }% C
  511.     elsif mouse_y  item_y2
    5 ?! p/ _: q/ `2 T1 a4 e% k
  512.       mouse_row = -2
    & y( V5 [6 ^/ _4 M- \
  513.     else
    8 Y4 j  F+ k( u+ I# a+ ]
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    ) N' K3 G$ o! A
  515.     end, ?) B! `; o7 E8 @( I( @1 v# I0 C
  516.     return mouse_row, mouse_col
    6 K( \! Z; ~/ |+ _. n0 B
  517.   end! j1 K# x6 j7 W- _9 T0 t
  518.   #--------------------------------------------------------------------------
    : Y) V- N/ _0 b4 y
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    . V3 ^3 B6 b1 L# w
  520.   #--------------------------------------------------------------------------& _2 G/ U' J. x+ k+ x8 W0 E
  521.   def set_mouse_pos! t2 _" Z3 ]8 R) X* ]
  522.     if viewport.nil # necessary!
    ) M+ C# s8 Y  K2 {
  523.       vp_x, vp_y = 0, 02 r( h& ?6 c, z: s7 _9 _
  524.     else. n) Y8 o' s) ?2 f
  525.       vp_x = viewport.rect.x - viewport.ox
    ) k$ D% c9 a2 L, E! c; l- B
  526.       vp_y = viewport.rect.y - viewport.oy
    ! c: e/ P( Y6 N5 f5 K
  527.     end
    $ L0 H9 f2 {! g9 [( O) j" e
  528.     item_x1 = vp_x + x + standard_padding 2 I5 s, V, y8 t# U0 V1 h/ c
  529.     item_y1 = vp_y + y + standard_padding; W1 m6 L5 d  D6 y: r
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index   n2 r* L4 c0 X0 J
  531.     row = get_index  col_max - top_row
    ) \' F! g' Q4 i. @8 M, A; c5 R
  532.     col = get_index % col_max
    ' Y- z7 P8 h1 I6 C
  533.     new_x = item_x1 + item_width  (col + 0.5)) n- L& S# [" u
  534.     new_y = item_y1 + item_height  (row + 0.5)# q, E9 P4 E6 Q! ~8 |
  535.     Mouse.set_mouse_pos(new_x, new_y)
    : ^- S0 d7 a# l! ^6 p( k
  536.   end
    ) |( w+ R) v6 e$ ^" q$ E
  537.   #--------------------------------------------------------------------------/ Z: x4 X0 y  m9 l
  538.   # ● 判断菜单是否需要卷动
    ! }" ?- b% L" G+ c
  539.   #--------------------------------------------------------------------------6 u: ]2 S1 N' |/ u+ k5 @
  540.   def need_scroll/ r! m. Q1 C# h, P# r% I
  541.     item_max  col_max  page_row_max' a& h$ @) h  B9 Q# J* F  n6 [
  542.   end& J& Y0 a& z. Y2 k
  543.   #--------------------------------------------------------------------------
    # T, [6 z# B& X  j* P. ]
  544.   # ● 判断是否为水平卷动菜单6 f6 r0 d5 k6 V# D" t0 n( F/ j
  545.   #--------------------------------------------------------------------------
    # N* f/ c$ {( N
  546.   def is_horzcommand# O' g2 z) S; T( Y+ f' E
  547.     return false7 Y" a% W+ v' _
  548.   end
    0 U& U: H" b+ K6 q
  549. end1 y% k- W$ c6 R& h1 Q, o

  550. % e4 c, K$ E/ T. I( ?6 i2 Y
  551. class Window_HorzCommand
    2 l8 K2 l4 _! ^* a8 R$ T! n* A
  552.   #--------------------------------------------------------------------------
    ( w, y: ]( V0 F4 F1 [0 Y& F
  553.   # ● 判断是否为水平卷动菜单
    - g( V6 O( d% P8 r3 I1 M
  554.   #--------------------------------------------------------------------------+ G7 w& V# ?5 l2 G5 W
  555.   def is_horzcommand
    : o. T" `2 X- c
  556.     return true
    / `" G* k$ ]% B) A1 j- G
  557.   end
    ) z* \. l) v) L4 H5 |; R! J0 N8 M
  558. end
    . M8 _. A1 e; w% p" r

  559. : f9 ]4 J$ G6 F" p, i
  560. #==============================================================================5 d0 z$ X* H9 P2 |/ x" G
  561. # ■ Window_NameInput
    ' S$ w$ L% |4 p+ N
  562. #------------------------------------------------------------------------------7 ~* I; Q+ n: j5 }+ u
  563. #  名字输入画面中,选择文字的窗口。3 M6 t# K0 o. Z
  564. #==============================================================================  n& X/ }+ \6 ~# [( K
  565. class Window_NameInput
    ! l0 r1 n6 Z& Q6 r- Q! K
  566.   #--------------------------------------------------------------------------
    4 s9 l0 F/ t# |- z! X5 I( x
  567.   # ● 设置列数+ z8 e0 ?! Y- f8 Y4 A8 s0 I
  568.   #--------------------------------------------------------------------------
    0 a( W, C: A0 f# r9 ]9 l, ?
  569.   def col_max/ v. A1 M- z3 Z/ Q
  570.     return 10
    ( P& f1 u' I6 D8 S: p6 p
  571.   end* }2 X/ {7 _5 L
  572.   #--------------------------------------------------------------------------
    / W3 @* r7 X2 z# b+ l
  573.   # ● 设置填充的Item个数
    8 y8 h) y/ v7 c: A3 ~
  574.   #--------------------------------------------------------------------------. V- h8 z7 |8 L& r+ V" H
  575.   def item_max
    ; o1 G; `! f2 I0 c  G) ^
  576.     return 90
    * P$ p+ f( L* h: s) u0 H( Y
  577.   end2 G2 V. v5 e0 {& N
  578.   #--------------------------------------------------------------------------
    % p- G  N: v9 D3 a& P
  579.   # ● 设置填充的Item个数" x( @7 ~  f- j
  580.   #--------------------------------------------------------------------------# X" J" s$ G2 j7 b
  581.   def item_width: X4 j, ]0 ]/ s$ G: W: `- F
  582.     return 322 Q* z  ^2 p; S+ q: B& j0 p, B
  583.   end* K* F/ W0 u; p$ s: D! m) H3 \
  584.   #--------------------------------------------------------------------------
    - w0 N, v' o- \
  585.   # ● 判断鼠标位于菜单的第几行、第几列
    1 w7 G" _. V# |9 n2 v  G
  586.   #--------------------------------------------------------------------------
    0 M; I& c5 i3 B
  587.   def mouse_window_area9 A7 E, g3 z. |  a' O
  588.     if viewport.nil
    ( s. _9 s: F$ _. [
  589.       vp_x, vp_y = 0, 0* e; I' P+ y& Y8 ?$ d
  590.     else
    4 h# q  W' p& V: u/ f
  591.       vp_x = viewport.rect.x - viewport.ox
    ! y9 D/ U$ Z! C2 F# U) c" ~/ Z
  592.       vp_y = viewport.rect.y - viewport.oy( w) h; m& U5 |# ^/ l
  593.     end  U7 g' N" r/ ?" X
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    ) I# {. U1 w+ v7 i# A
  595.     item_x1 = vp_x + x + standard_padding
    3 t9 g6 s/ k: k! f2 R5 B( P
  596.     item_y1 = vp_y + y + standard_padding2 F+ B" E1 L8 C( W; Z& d0 T; e2 d' l6 P
  597.     item_x2 = vp_x + x - standard_padding + width7 J# \1 h# q, E3 j3 E6 x6 H
  598.     item_y2 = vp_y + y - standard_padding + height  K3 ~# }9 s* i; w2 B5 Z. q% _
  599.     if mouse_x  item_x1
    ! k  f% j, f" ^; ?5 o- }
  600.       mouse_col = -1
    - n8 O' [( q3 f" j
  601.     elsif mouse_x  item_x2
    0 b7 ?' I9 g9 R: x8 d- Z- d
  602.       mouse_col = -2
    6 o" W. C  c% S- L& K# e( O
  603.     elsif mouse_x  item_x1 + 160
    6 d  E' }( a) H! Q0 O
  604.       mouse_col = (mouse_x - item_x1)329 k$ f4 I& u3 o) G$ }
  605.     elsif mouse_x  item_x2 - 160% e) N- M$ I/ z+ _
  606.       mouse_col = 9 - (item_x2 - mouse_x)320 g1 D8 L- ?5 |2 @3 X! q
  607.     else% u+ J/ ~& j% H+ u
  608.       mouse_col = mouse_x  x + width2  5  4( U) c! n8 c4 ~, N6 a: i
  609.     end
    9 Z5 d5 X7 q6 N) _. c& e
  610.     if mouse_y  item_y1( ?5 w3 u/ \4 {6 n3 f* ^! B
  611.       mouse_row = -1
    1 Y! A7 W5 O( q0 f: {& S- `
  612.     elsif mouse_y  item_y2% g) N: r! f4 S
  613.       mouse_row = -20 N9 n6 k; Q- A; X: x
  614.     else
    : O" G& ]0 @& ^1 m' E5 H  I
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)
    . c" R! }1 j- H; \: S  i  u
  616.     end
    + q/ l9 ?! G9 t  N: H6 H* I$ O) B2 h
  617.     return mouse_row, mouse_col
    - |+ W% J: L; J( {! f
  618.   end) q! T9 w( [. s( W5 ^8 q2 v
  619.   #--------------------------------------------------------------------------
    0 r& T7 O4 W# w  {
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置9 @* A$ T& c, b7 F/ I. I9 Q
  621.   #--------------------------------------------------------------------------# ?. j1 i6 B6 \6 \, `$ Y
  622.   def set_mouse_pos9 b/ U# s8 d5 }3 T7 }" H6 X* B7 B
  623.     if viewport.nil # necessary!# V& X: l* g% N# g3 P5 [
  624.       vp_x, vp_y = 0, 0
    8 H. J9 }% ~! P1 ?2 s# h
  625.     else& _7 |3 F" Y- w
  626.       vp_x = viewport.rect.x - viewport.ox
    8 `/ a" j; ]8 i7 i
  627.       vp_y = viewport.rect.y - viewport.oy4 f3 o8 f/ b' [3 b
  628.     end
    * C/ K$ b' B! W( U8 i
  629.     item_x1 = vp_x + x + standard_padding   y0 J" t- @: i2 ?
  630.     item_y1 = vp_y + y + standard_padding
    ( r0 L6 ^% Q: V1 @0 a: @6 x
  631.     get_index = @index  0  0  @index : u4 C/ F3 x- L) |' Y" ?
  632.     row = get_index  col_max - top_row' |4 I* n" o2 r( W4 ]" D
  633.     col = get_index % col_max4 h) r! @( M1 w( }; Q1 i0 q' i
  634.     new_x = item_x1 + item_width  (col + 0.5)5 U) b3 l- l$ C% P0 j5 @
  635.     new_y = item_y1 + item_height  (row + 0.5)
    ) {! F6 s8 B0 g
  636.     new_x += 14 if col  4
    7 q7 q7 b% U7 |" Y' W
  637.     Mouse.set_mouse_pos(new_x, new_y)8 Y0 I  l( p+ [1 m% R
  638.   end% g# [) I+ l- p' ^) c+ g# S8 o; ]0 Z; i
  639. end
    ; g2 H$ h" e" l  B1 [

  640. " B% m0 z- e% e6 U
  641. #==============================================================================/ D8 @! _7 g9 C+ i9 u2 \5 x" O0 o
  642. # ■ Window_NumberInput
    7 g( d/ d1 Q2 U0 j
  643. #------------------------------------------------------------------------------/ C2 a2 m' a* n
  644. #  重写了数值输入的方法以适应鼠标
    ) p  B( X/ P5 B% p0 _. a
  645. #==============================================================================; A9 f) v& p$ d: H+ f
  646. class Window_NumberInput  Window_Base2 s; n) w' V9 F: [2 |
  647.   #--------------------------------------------------------------------------7 [) {$ T5 j" \
  648.   # ● 定义实例变量
    " i( P* j4 ^! `* ~* K* |4 }
  649.   #--------------------------------------------------------------------------9 R( m$ T, i/ \: I* I* O5 J
  650.   attr_reader extra_window1 @+ V& h, S& B# W+ d
  651.   #--------------------------------------------------------------------------4 Z  Q* y2 K* c4 z8 ^
  652.   # ● 初始化
    ( J6 X9 K" b% N8 a
  653.   #--------------------------------------------------------------------------
    % R: t' N  t7 B* U3 h1 r6 {; D
  654.   alias sion_mouse_initialize initialize+ F2 D& r# d, [$ \
  655.   def initialize(arg)9 V, Z6 f6 L5 i" b' ^9 z; y  A
  656.     sion_mouse_initialize(arg)
    % b  ]% r- J- n& w( t
  657.     create_extra_window
    # H1 q% b6 Y( ]; z% s9 y: }
  658.   end
    9 v6 z, E+ H' I* H) L
  659.   #--------------------------------------------------------------------------
    ) }3 ?5 P3 J8 l/ T8 {6 ^: h
  660.   # ● 启动
      }2 \0 V: ^- t3 c: |1 o
  661.   #--------------------------------------------------------------------------
    ! Q  Q! \2 v, J% R* k/ F4 S! O7 D" M$ a
  662.   alias sion_mouse_start start% ^) r2 {, o! [
  663.   def start6 }8 v$ B9 G+ O  Q
  664.     sion_mouse_start: i; W% p" [- L2 Z" I# Z
  665.     deactivate
    # z- K) J" j. U$ L* \( L! x, ?
  666.     extra_start
    : i  Z4 W( K1 C
  667.   end
    6 |1 A. k$ L- k, E' N) Y5 c
  668.   #--------------------------------------------------------------------------5 S5 B4 t' k8 I' O- k( N
  669.   # ● 创建新的数值输入窗口; j1 n8 N. m7 F7 ~& u: g. u/ B3 ?
  670.   #--------------------------------------------------------------------------
    + Y& N" }/ c& f
  671.   def create_extra_window
    . }" j6 K  P- b6 F3 w
  672.     @extra_window = Window_NumberInput_Ex.new
    ! f" K  [7 s* V4 H2 Y6 T% t
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  28 p; G( D  A( s7 z
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }' N9 Y) _: I0 {8 h; L
  675.     @extra_window.index_proc   = Proc.new {n @index = n }
    5 T: z$ r2 ^" R' ?" v
  676.     @extra_window.close_proc   = Proc.new { close }
    : V% r) M# l: ~
  677.     @extra_window.refresh_proc = Proc.new { refresh }
    0 g+ {- _, H# `
  678.   end; \( j( w! v8 `6 ~) w+ D. z
  679.   #--------------------------------------------------------------------------
    & W) b2 Y7 z# u# i/ j
  680.   # ● 激活新窗口( J% q- ]4 o9 q5 M! @
  681.   #--------------------------------------------------------------------------
      S4 |' O) K/ y. m# S% X
  682.   def extra_start
    . D1 t. G% H! Y9 v; n1 g$ J) w0 Y; M
  683.     case $game_message.position
    + u* K/ q. q  w& O5 J; d+ K8 A" F0 Z
  684.       when 0; @extra_window.y = y + height + 4
    7 j: B, ~; g7 l/ {* c0 a
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8; t3 _% r% s3 _! Z  y" U
  686.       when 2; @extra_window.y = y - @extra_window.height - 4& f1 W' |$ i7 l5 @& s
  687.       else  ; @extra_window.y = 8
      D( G$ b/ b( A, j+ R
  688.     end  G: J) ^& q: E- q
  689.     @extra_window.variable_id = $game_message.num_input_variable_id
    ' ]' e, a% t# M' `3 e
  690.     @extra_window.digits_max  = @digits_max: _4 ]4 Y9 G- N) P. ^! f( ^
  691.     @extra_window.number      = @number& a0 I5 v* [. c6 x8 M' F
  692.     @extra_window.open
    ' Q5 ^4 l7 {9 h
  693.     @extra_window.activate# t5 |$ n5 R6 K0 e" `+ k
  694.   end$ A% `- j8 U& Y! s2 ?3 k2 \8 r
  695.   #--------------------------------------------------------------------------
    " Y+ L' ?% S  n+ Y) q
  696.   # ● 更新5 R& U# ]1 }: B7 H0 N4 J5 C1 e  k1 Z
  697.   #--------------------------------------------------------------------------
    2 }) V2 m5 `0 z
  698.   def update3 q4 J& i* \1 Q8 b
  699.     super
    . U' b* C8 i" o, D0 ~
  700.     @extra_window.update- e" L1 v) u; o7 ?
  701.     update_cursor& H0 f* x* f/ v2 f
  702.   end; ?# m* b, A2 j% }0 w
  703.   #--------------------------------------------------------------------------3 G+ A/ G- a7 p9 D0 f
  704.   # ● 关闭窗口
    0 X  C' i1 @# G# q" Y/ ]+ q
  705.   #--------------------------------------------------------------------------
    ; F2 H$ Q. G3 e. e' D! M& M6 g
  706.   def close) |6 `5 @7 Q* l/ \6 ]) A' n1 h3 a
  707.     super$ p' x! M9 E' {
  708.     @extra_window.close% {7 Z- d) u6 D" M* u7 V  h* `5 D7 K' y
  709.     @extra_window.deactivate
    . H% c' B! e1 z  d
  710.   end
    & i0 H. W# I' K+ g2 D
  711. end6 c- B9 ?7 J% t1 i! o! X6 n
  712. 9 D5 O1 _8 r% g  T" _3 A
  713. #==============================================================================" D* b$ h: L  _- O. N
  714. # ■ Window_NumberInput_Ex; O9 Z2 ?# i" g. E
  715. #------------------------------------------------------------------------------% U) H. ~" A9 D+ w* X5 ~/ c
  716. #  新的数值输入窗口(NewClass)- K. T% ]% s& f6 M- j
  717. #==============================================================================4 z' ~5 F. s9 j# r8 T
  718. class Window_NumberInput_Ex  Window_Selectable
    9 p# T! c! i# ^2 ~/ Y
  719.   #--------------------------------------------------------------------------
      k# D* [) ^- N+ b- F5 ~! t
  720.   # ● 定义实例变量: _4 G2 l4 u2 w0 w
  721.   #--------------------------------------------------------------------------- {- I* g9 j1 [+ {0 P% K
  722.   attr_accessor number_proc+ I- l. j& B: Q8 z
  723.   attr_accessor index_proc
    ) g' T: I( H6 y- Z6 x* i! K
  724.   attr_accessor close_proc
    1 M4 p- w- J# [  S1 F5 b
  725.   attr_accessor refresh_proc
    , v+ K* @# O, o% M( \6 x; U; q
  726.   attr_accessor number
    * u) J- u% Z; y. }8 ^5 e) o" b- ~
  727.   attr_accessor digits_max
    ; _# Q# P  ]/ m: k
  728.   attr_accessor variable_id
    9 J3 A: s- k( f7 N" V- M( u7 ?9 B. F  K
  729.   #--------------------------------------------------------------------------' H; M4 f) o( l' h- j$ l
  730.   # ● 数字表3 a# e. o8 @# r$ @2 N9 g$ F
  731.   #--------------------------------------------------------------------------
    / G& s9 R0 `- H! [5 v. e
  732.   TABLE = [  7,  8,  9,
    ) ^- H% R9 T% m* s* m4 z* L
  733.              4,  5,  6,4 {" G: O. t0 j8 x8 O) `" k$ _
  734.              1,  2,  3,  W2 }7 o+ z4 X
  735.             '←',0,'确定',]( K: m% K$ B2 h2 i+ I" R# ^
  736.   #--------------------------------------------------------------------------3 W: C. y. x+ L7 ]. O1 i
  737.   # ● 初始化对象3 v2 n8 a: {) R6 M8 ^0 f
  738.   #--------------------------------------------------------------------------
    ) W; D: g( x+ A  i1 \& ^3 y
  739.   def initialize3 s& n% v: |; d  l
  740.     super(0, 0, 120, fitting_height(4))
    9 w7 s( y/ n  E% V/ ~6 Q3 z
  741.     self.openness = 0/ A6 L1 ^$ h% a" D
  742.     @index = 06 O7 K2 ]" l5 g+ p2 }' c! K
  743.     @number = 0) w  K/ @- z  S! L2 ~
  744.     @old_window_index = 0
    0 |; i- u( r$ V$ c& Y
  745.     @digits_max = 0+ ]' Q% J8 l5 d, a
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }
    % F; F  C: W) Y- p0 v
  747.   end) h/ t8 k) p0 z) @% b
  748.   #--------------------------------------------------------------------------3 B: x  h9 w9 E  P$ d  F
  749.   # ● 获取项目的绘制矩形/ h: r: Y8 l% x1 e% m2 k
  750.   #--------------------------------------------------------------------------
    & D, w3 r0 j# d8 C8 U0 l$ i
  751.   def item_rect(index)
    " u8 \8 d: Y+ B, p' t6 }
  752.     rect = Rect.new
    * ~8 b. I  U& n4 l. d
  753.     rect.x = index % 3  32
      L0 J/ S2 v, m0 u( M# E
  754.     rect.y = index  3  line_height( B& L$ x1 h1 B9 g# v6 a. n, y2 _
  755.     rect.width = 320 E8 T* i8 W/ v2 W& ]
  756.     rect.height = line_height% f6 K5 M" i# W1 d( s
  757.     return rect
    - Q& M- x/ U- s# p9 c
  758.   end
    4 I+ u5 O" l4 u2 U6 c& B2 r! X/ l
  759.   #--------------------------------------------------------------------------9 `/ w4 R6 l3 l# z
  760.   # ● 将光标设置到鼠标所在的位置1 ^1 n& `) }. |* {- W9 k5 b  r. P
  761.   #--------------------------------------------------------------------------
    , C9 w" q8 t( l0 M. f6 |( S1 }
  762.   def set_cursor" l6 @6 u/ I9 z0 B, G7 N% _6 r9 F- A
  763.     mouse_row, mouse_col = mouse_window_area
    ( E  S: @* S* a
  764.     if mouse_row = 0 && mouse_col = 0
    9 h% i& T+ l! C% ^7 [& g
  765.       new_index = mouse_row  3 + mouse_col
    5 z/ C" k2 E  S$ j3 X
  766.       select(new_index) if new_index = 11( L! L5 I% S2 `$ @& N" |
  767.     end
    ' f& F+ m* n+ f
  768.   end( [/ t- H; s/ Y
  769.   #--------------------------------------------------------------------------4 X7 Y3 o% a  C! C5 [( [- ^
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列
    , V- ~0 G# T! A) u( ?
  771.   #--------------------------------------------------------------------------
    ' x6 `6 j" O4 {; n+ L& X
  772.   def mouse_window_area* M. [9 P) [( |: M
  773.     if viewport.nil9 _6 _6 z4 B2 M% H& u# ?8 p
  774.       vp_x, vp_y = 0, 02 r  l/ Z2 d8 F
  775.     else
    ' x" s* [/ o) x- G
  776.       vp_x = viewport.rect.x - viewport.ox5 t, i0 \2 Y8 F% l
  777.       vp_y = viewport.rect.y - viewport.oy
    ; U) L* z( a) m$ D4 d
  778.     end7 L* }5 n% F2 D
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y5 ?1 F# s1 i9 s. C  v* ^4 j
  780.     item_x1 = vp_x + x + standard_padding / {) l# l; j* g7 }
  781.     item_y1 = vp_y + y + standard_padding
    " R' u( @* x- h" z4 ^; s
  782.     item_x2 = vp_x + x - standard_padding + width
    8 G" Z0 ?" a, p4 Z$ q1 ^4 ^
  783.     item_y2 = vp_y + y - standard_padding + height
    # F/ V# b* J$ |" b) p7 @5 G6 a
  784.     if mouse_x  item_x1
    " P7 H9 L3 U1 P4 Q& I
  785.       mouse_col = -1) Q1 o3 A9 B8 i! I" w6 `0 ]
  786.     elsif mouse_x  item_x2" ], L+ s# `: a
  787.       mouse_col = -2
    2 `9 P( k' U# x. C
  788.     else
    9 z4 f- S! ]# }- i, E+ ^' y
  789.       mouse_col = (mouse_x - item_x1)  322 Z" U4 W8 Q4 B. D
  790.     end
    ' g3 V* `' x" i2 Z) T
  791.     if mouse_y  item_y1
    ' [. K/ j! n3 z- c
  792.       mouse_row = -1
    - j% G2 L; Y5 e: H3 a# R- O- u
  793.     elsif mouse_y  item_y2
    ( x- d+ |3 {/ X" e. t3 Q
  794.       mouse_row = -2
    2 ^) `! C; q3 r& V2 b3 `
  795.     else
    . o% p  Z5 v! e9 @- |) K
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)* ]9 e& \. h3 ~, [* l! I
  797.     end
    % Y4 ~; `# v9 _3 h2 A, z$ A( [7 ?
  798.     return mouse_row, mouse_col
    3 D- Y; n; F  \% i
  799.   end2 n/ L' l/ c* G$ t( c% ~: P( Q" r( ~
  800.   #--------------------------------------------------------------------------
    ! C. {8 U7 @7 O5 W/ I" B6 O
  801.   # ● 获取文字5 v7 g: M6 s% ^; @
  802.   #--------------------------------------------------------------------------) L& J( n7 s: ]* J: a
  803.   def get_number. a7 r# q* K; S8 |
  804.     return false if @index == 9  @index == 11
    ( t5 G2 @8 X* S9 N$ ~
  805.     return TABLE[@index]3 Z  b2 g/ y9 S+ M6 _2 V
  806.   end
    0 H" N: X0 f( ~- [6 c3 N- D2 c
  807.   #--------------------------------------------------------------------------2 Y# H' \: e3 C/ T' X. [, f1 S( {
  808.   # ● 判定光标位置是否在“退格”上1 m" k' B. G2 L' C$ x1 B2 q) M4 @
  809.   #--------------------------------------------------------------------------5 q# d% s, I: a
  810.   def is_delete/ C) v5 h+ g" ?& `  e4 c
  811.     @index == 9
    2 v5 O& u( P" T1 v2 s, O! |1 S
  812.   end
    , B8 x4 R$ v2 k- y
  813.   #--------------------------------------------------------------------------
    ) {" \, i9 g) m/ I6 s
  814.   # ● 判定光标位置是否在“确定”上: M& s9 P' u/ e7 I) X4 `( }
  815.   #--------------------------------------------------------------------------
    ( M6 N' Z2 n! ?5 x, l$ S
  816.   def is_ok
    ! u1 v: W2 p! l. j; D; V
  817.     @index == 113 ]  P( D, ~$ r$ n" p% M( k
  818.   end+ `$ O6 b1 ]% ?5 X
  819.   #--------------------------------------------------------------------------8 V; ~0 E8 a5 [4 H2 u
  820.   # ● 更新光标2 _/ L: ~4 E) u0 q
  821.   #--------------------------------------------------------------------------
    2 a1 d, `' E6 t) `% G
  822.   def update_cursor
    : M, v* {( c% S% j" Q
  823.     cursor_rect.set(item_rect(@index))  ?- [( ?. ?( j5 S. U, [
  824.   end7 @: o9 u* P) |- W0 h. H* \
  825.   #--------------------------------------------------------------------------
    ! O  }+ @% h& x; K5 J2 A
  826.   # ● 判定光标是否可以移动
    % w0 F9 Z: Z6 A5 L5 H" g
  827.   #--------------------------------------------------------------------------( [  P6 n' S3 h- x2 |6 N
  828.   def cursor_movable0 R. E8 ~1 }. M$ ?" L, ?4 m
  829.     active0 l0 T9 W7 l* k% V6 o+ {
  830.   end: a' h0 M. ~, d2 [* d$ |
  831.   #--------------------------------------------------------------------------
    : D: x# @# t* P) @! D' r+ w% @
  832.   # ● 光标向下移动
    ; l+ n5 [; V6 _: C# j# M; O& @
  833.   #     wrap  允许循环
    / [9 Q: ]4 @; d% l1 @1 ], l
  834.   #--------------------------------------------------------------------------! V1 D' R. [! S* @& C; S1 j
  835.   def cursor_down(wrap)
      ?- R% D- r3 x, g3 t
  836.     if @index  9 or wrap7 P) s& E) W  |% U, U4 ^# x
  837.       @index = (index + 3) % 12
    8 ~5 [: l* Z! n( c  X% S
  838.     end
    / P: L6 n5 h7 _+ l- c$ C
  839.   end! {; V  ]" P& [: o9 ]7 H* j& @+ U
  840.   #--------------------------------------------------------------------------
    # U5 F7 Z9 M( v6 z8 |
  841.   # ● 光标向上移动
    ) \5 k, w, u5 D; D4 w3 \
  842.   #     wrap  允许循环
    * J8 F" `" b5 b
  843.   #--------------------------------------------------------------------------
    : D  l* j/ \9 i) }  P
  844.   def cursor_up(wrap)6 Z$ H5 \7 g- R$ F+ t
  845.     if @index = 3 or wrap1 w5 }- |" G  e
  846.       @index = (index + 9) % 12
    / F- A$ H% j7 @$ j4 K; G3 ^9 k
  847.     end
    0 n* t8 R5 Z: Z
  848.   end: k2 |4 y1 a! c6 g! @* D1 U& I7 a
  849.   #--------------------------------------------------------------------------
    + N& `$ B" E! e  ^8 N
  850.   # ● 光标向右移动
    - n; z2 k. c" a3 C7 ~9 J
  851.   #     wrap  允许循环% n: P( ^8 @! A* E
  852.   #--------------------------------------------------------------------------% U$ Z$ Z: c6 U6 H
  853.   def cursor_right(wrap)
    " r" {7 S1 d" ^" `+ }( V# N! i, d1 l$ o' s- x
  854.     if @index % 3  2
    * u, X4 R9 H9 x
  855.       @index += 1
    , u& o& @: P, z! F1 \; L7 p1 w3 i( ?
  856.     elsif wrap
    8 Z# W' n  `: J9 @* [
  857.       @index -= 2- X. R- Z7 B+ `* h6 l  ^' H
  858.     end) \6 M& S2 h" \
  859.   end& b& ?6 k5 X) x0 i$ x" W* e
  860.   #--------------------------------------------------------------------------' \' m, d! A. F4 Y# D
  861.   # ● 光标向左移动/ z! p5 d; |8 e8 l5 A
  862.   #     wrap  允许循环
    ! H5 n8 ?' d4 z. F4 K
  863.   #--------------------------------------------------------------------------
    / c6 ?/ N9 g0 ?  q( |5 X8 f& @
  864.   def cursor_left(wrap)
    5 B  V* w3 N+ w# f1 k
  865.     if @index % 3  0/ ^! Q4 C  Z0 k  R
  866.       @index -= 12 }: W8 \1 H& w5 j. i% T& i
  867.     elsif wrap
    + H! {3 A8 u# e
  868.       @index += 2
    & }, B9 x7 s8 G2 y' n
  869.     end2 }; l& l# N( @- m
  870.   end
    , P" ^: z% H, Z) F! X2 X
  871.   #--------------------------------------------------------------------------; ]2 o. o* I( j
  872.   # ● 处理光标的移动5 T3 h7 {+ I; z1 w5 d' M) p
  873.   #--------------------------------------------------------------------------4 o+ c" E1 X+ @0 G; Z. U& u
  874.   def process_cursor_move9 j0 v' X) e0 Q- J  E. J
  875.     super# E* V) D' `$ d% M
  876.     update_cursor6 V7 C$ |! U& g( b5 d: B9 a/ i
  877.   end
    ' k( ?- o) j* G4 j: e" W
  878.   #--------------------------------------------------------------------------1 R1 H; D3 Q" |: U$ K  s  \1 b
  879.   # ● “确定”、“删除字符”和“取消输入”的处理5 s9 [0 M* c+ E& N. F# b$ c
  880.   #--------------------------------------------------------------------------" }2 N6 Q: s3 F
  881.   def process_handling
    . Z5 R& m; W( V; l
  882.     return unless open && active. d+ G1 W0 g" {9 T0 r
  883.     process_jump if Input.trigger(A)" R; B: b- x7 T) M# y( {
  884.     process_back if Input.repeat(B)
    % P; [$ C- w% D- g
  885.     process_ok   if Input.trigger(C)2 ~0 S6 x5 X7 `  S' F3 n9 R
  886.   end7 I4 `4 h" z% H" G# H2 T1 ~
  887.   #--------------------------------------------------------------------------
    $ u0 ^3 {' D! P4 E
  888.   # ● 跳转“确定”
    * X& y4 e$ z' r2 W( `+ q
  889.   #--------------------------------------------------------------------------$ C( K' M4 J. a% _8 }( y
  890.   def process_jump. o" ~: F+ y- w* B1 N
  891.     if @index != 11
    ; s) l6 \1 i/ P. z; v; m2 |' o
  892.       @index = 119 E. e, s5 u7 L: s! A
  893.       Sound.play_cursor
    9 Y7 A1 ~8 F( W$ p
  894.     end
    3 K: A7 U$ R( C# _
  895.   end# H; q3 ?- G5 V4 C$ N( s+ v
  896.   #--------------------------------------------------------------------------3 _1 Y5 U5 \) W( V3 K' `
  897.   # ● 后退一个字符5 r. c1 c' C2 b* \% G: \
  898.   #--------------------------------------------------------------------------; z" w; F7 f0 S- D8 G
  899.   def process_back
    - v- M/ |" Q8 s2 _; r
  900.     Sound.play_cancel0 s  y- n/ w4 w! ?1 c+ F) n: e
  901.     place = 10  (@digits_max - 1 - @old_window_index)
    ' A  N. }4 j+ v3 w
  902.     n = (@number  place) % 105 @! y( W! ^- E- n4 M3 Z+ g
  903.     @number -= n  place
    * k  V6 a' f; m. _3 m, m! J
  904.     @number_proc.call(@number)
    % I) h* D0 S/ T0 D2 y9 `, e
  905.     @old_window_index -= 1 if @old_window_index  09 S$ A4 {* d) L- ~- K
  906.     @index_proc.call(@old_window_index)
    7 ^9 U7 O5 `( v0 |( i
  907.     @refresh_proc.call: b+ j" j- o. j( t+ W' i! |% r+ Q
  908.   end
    # g( v4 ]8 Y2 T0 f2 q
  909.   #--------------------------------------------------------------------------& D; F. ^& X0 v7 s
  910.   # ● 按下确定键时的处理
    1 H$ R# ^2 r. Q: p# q; j" Z" J
  911.   #--------------------------------------------------------------------------/ W/ |% d4 C6 v7 l0 Z
  912.   def process_ok" z  d- e: y* ]+ r3 c* @1 J
  913.     if get_number& N% h5 X3 u3 m! H9 `, I+ w" m
  914.       Sound.play_cursor% f& r6 ?/ m. n; x* y/ x) o
  915.       place = 10  (@digits_max - 1 - @old_window_index)4 g0 ~0 K5 j5 G# x5 X5 \
  916.       n = get_number - (@number  place) % 10
    & s, l  i, |% O8 ^; `
  917.       @number += n  place2 c/ V  P: k; P) s  I/ T+ @5 V7 H9 l
  918.       @number_proc.call(@number). r0 Z8 Q* a2 T* D/ q
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    9 p. E/ s0 U  G) Z: H$ b$ P
  920.       @index_proc.call(@old_window_index)
    8 y$ a8 ]4 u% w4 }( Y
  921.       @refresh_proc.call7 `. Y, r) w1 r& b& s0 d5 K3 E
  922.     elsif is_delete% V& s% A- z0 G
  923.       process_back4 z- }" n8 Q3 o3 N$ R  M% X
  924.     elsif is_ok
      I0 v( R7 X- m( ~9 a' r, R
  925.       on_input_ok1 Y! |) M1 f, x/ w
  926.     end
    : v; K: F: o6 j2 V
  927.   end* o& h, K. J- `* K# Q; [/ R
  928.   #--------------------------------------------------------------------------( l" r% u. K( E/ M* [& j. W
  929.   # ● 确定
    2 I! u* q+ B  p
  930.   #--------------------------------------------------------------------------
    0 V9 m5 {7 F: K8 v( X* E. x! H! m# U
  931.   def on_input_ok
    $ g. C  `/ t  O
  932.     @index = 0
      u! q5 X; a- g1 Q/ [
  933.     @old_window_index = 0
    2 Z& |: l# ~5 U& f
  934.     $game_variables[@variable_id] = @number
    2 }! W, h9 ]6 k  b6 I; q
  935.     Sound.play_ok
    $ E* {& K9 e" h7 O6 G
  936.     @close_proc.call$ S2 A1 Z# V. W" ]# H
  937.   end
    ) |9 y1 ]* R2 Z
  938.   #--------------------------------------------------------------------------, t5 \1 I0 B4 Q3 y' `  d6 f- B/ X
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置& ]& J* ?! ?* i' O( w
  940.   #--------------------------------------------------------------------------
    0 L% j2 u, |. Z  L  D
  941.   def set_mouse_pos" N% w0 @, t0 h, [
  942.     if viewport.nil # necessary!
    4 N, Y' ^5 ]6 o- b
  943.       vp_x, vp_y = 0, 0& k4 g. }5 M+ f, W6 b& r
  944.     else6 x% F8 a* u) p/ ]; G% H
  945.       vp_x = viewport.rect.x - viewport.ox! h0 s0 W. y! w. T
  946.       vp_y = viewport.rect.y - viewport.oy
    2 \  g. \# j/ E" F
  947.     end/ C6 e7 d: N: `; E: q' p
  948.     item_x1 = vp_x + x + standard_padding
    ' y+ a- f( }! e
  949.     item_y1 = vp_y + y + standard_padding% f; h# f9 ]6 o
  950.     get_index = @index  0  0  @index
    0 c3 Q5 ~1 J! p
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)
    7 V7 V. ]8 d! m% Z5 y' C( T
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)! D$ D: A6 P1 j
  953.     Mouse.set_mouse_pos(new_x, new_y)+ O+ i* g# i8 u
  954.   end- M1 t: k- H: R0 j0 j' {
  955. end4 w  s5 b9 T/ i3 C; t
  956. 4 H( f0 Q# j1 A9 u$ [' U
  957. #==============================================================================
    & d" f$ G+ X% h! t
  958. # ■ Window_Message4 ^' o  q- z( _" R1 E# }
  959. #------------------------------------------------------------------------------
    # Y4 e+ \2 W+ b5 C' d8 g8 ]
  960. #  显示文字信息的窗口。8 ]" r% q% j( @9 F
  961. #==============================================================================
    - e7 h! `* d: ~+ a4 ^+ d# @  o
  962. class Window_Message  Window_Base
    : W; n% H3 R& e) c
  963.   #--------------------------------------------------------------------------
    1 F1 D7 p2 d/ ^/ c" Z
  964.   # ● 处理数值的输入(覆盖原方法)! v' A( A' _) n; r
  965.   #--------------------------------------------------------------------------
    1 Z' }0 _3 s/ W9 I- t# M# f/ [6 n/ G
  966.   def input_number
    # r7 P' r0 X) ^+ n  e/ n
  967.     @number_window.start
    & W: h: \* M# \2 x4 G$ s
  968.     Fiber.yield while @number_window.extra_window.active
    % P; a/ j, r. s$ j+ ~, O
  969.   end. x' W2 ~% I5 h2 e; g( }3 @
  970. end$ X: J4 N( N8 m4 \1 V3 V3 x# Q; y

  971. ) x- g% U9 |  ?* b; F3 L0 f
  972. #==============================================================================
    7 D6 S5 w: s2 v! J5 A
  973. # ■ Window_PartyCommand, R- [$ a6 j0 B1 v1 j
  974. #------------------------------------------------------------------------------, M9 W& W8 C. }4 I
  975. #  战斗画面中,选择“战斗/撤退”的窗口。
    8 p: K& l; Z7 ]
  976. #==============================================================================
    6 E$ p* E# M/ Y, a' Z
  977. class Window_PartyCommand  Window_Command: y2 F8 P) }5 c$ y
  978.   #--------------------------------------------------------------------------
    - j' g6 a3 T* v
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    ) ], {8 `' m2 J! p" u' i
  980.   #--------------------------------------------------------------------------
    " F) ]" w6 x4 }9 r5 ?
  981.   def set_mouse_pos
    - T% _3 }2 S; c- Y
  982.     if viewport.nil
    * A( M! c/ I+ H2 e- a6 w3 x* _
  983.       vp_x, vp_y = 0, 0
    $ {# o  i% E6 A5 a
  984.     else
    ' D0 n+ x. z% U5 k. k
  985.       #vp_x = viewport.rect.x - viewport.ox' r; o8 U9 D1 W
  986.       vp_y = viewport.rect.y - viewport.oy
    ' I1 y7 H) u6 m! m; T1 W
  987.     end
    % c, z2 ~7 h5 ^" \2 H
  988.     item_x1 = x + standard_padding : w: a' {( I% T5 f+ d
  989.     item_y1 = vp_y + y + standard_padding$ l( L. F% ]. x  _" B
  990.     get_index = @index  0  0  @index 9 V6 c- }  H& N" W3 h
  991.     row = get_index  col_max - top_row
    8 r2 u7 n9 C. h
  992.     col = get_index % col_max
    % X+ `! }; n! f6 y2 y0 G
  993.     new_x = item_x1 + item_width  (col + 0.5)( q/ |  x" o1 ]; \3 J: J3 h
  994.     new_y = item_y1 + item_height  (row + 0.5)
    6 {2 _# j+ M5 i8 A  t
  995.     Mouse.set_mouse_pos(new_x, new_y)
    ' S* h* b( v# Z, K
  996.   end
    & C; ~! a. a, _# n
  997. end+ @* L& u* R* b

  998. . ^' _7 a( v; Y! ^5 G  L
  999. #==============================================================================) b, L: I( L1 `2 F/ v0 h6 |  D3 P
  1000. # ■ Window_ActorCommand
    3 q* h+ t: }7 ^. g
  1001. #------------------------------------------------------------------------------
    9 D' k6 Z  x4 J6 ]
  1002. #  战斗画面中,选择角色行动的窗口。
    3 f4 g* @& j4 d- i" r
  1003. #==============================================================================& s8 h( y( s) h* ]2 r# t4 `" H
  1004. class Window_ActorCommand  Window_Command
    4 L) [, Q) h) f" I; S4 g0 L* G
  1005.   #--------------------------------------------------------------------------. }; q* a+ T3 k
  1006.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    . c5 V; v3 I7 X: P$ o$ L
  1007.   #--------------------------------------------------------------------------
    - d- A% R  O' u& O' W
  1008.   def set_mouse_pos# d# a0 l% z6 C: H
  1009.     if viewport.nil
      q( Q: U" ^# [/ [
  1010.       vp_x, vp_y = 0, 0
    ; p1 {; A& m0 p% U( J
  1011.     else
    * A$ G% c1 G) d, G# Z+ N, [
  1012.       #vp_x = viewport.rect.x - viewport.ox
    9 C* C1 V! x- W+ m6 Z
  1013.       vp_y = viewport.rect.y - viewport.oy) ]! I) z/ D/ A6 }1 @
  1014.     end
    ; G9 r+ n2 b  l" g# x
  1015.     item_x1 = Graphics.width - width + standard_padding
    4 P8 q0 ~  L4 N$ |/ L( t
  1016.     item_y1 = vp_y + y + standard_padding; B% i) |7 V. G& G/ n* C
  1017.     get_index = @index  0  0  @index 8 P3 M% ]+ r8 n: k& _
  1018.     row = get_index  col_max - top_row
    ( x  H9 t/ p. @8 ~; u# G% r
  1019.     col = get_index % col_max
    & m( U! T+ z, g" h# o
  1020.     new_x = item_x1 + item_width  (col + 0.5)
    & C8 O2 H0 o9 I0 m' i" j
  1021.     new_y = item_y1 + item_height  (row + 0.5)
    : ]( v" Z2 Z4 p) B0 w
  1022.     Mouse.set_mouse_pos(new_x, new_y)
    & n6 N+ C' _: e$ U2 C
  1023.   end$ U9 U6 B' v9 {# M
  1024. end
      i: h7 @8 G/ {. ~1 b4 ?

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

  2145. 0 X9 q/ B1 @( y, K
  2146. #==============================================================================6 q/ ?- Q: }; s, ]
  2147. # ■ Game_Map6 W9 [* z+ g2 E4 s- d
  2148. #------------------------------------------------------------------------------  k3 x- Y1 P  e
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。, r  ?) p' N8 _" r% Y/ ~" d+ H
  2150. #   本类的实例请参考 $game_map 。5 H  t0 R' u/ _- I
  2151. #==============================================================================& U. _4 [' b+ e8 q" j& M
  2152. class Game_Map
    * u! F2 m9 r/ O) H
  2153.   #--------------------------------------------------------------------------8 C* c) y; S3 i0 B. {
  2154.   # ● 定义实例变量
    ! k$ n# i/ P  [
  2155.   #--------------------------------------------------------------------------; {" X7 a$ U3 M/ a- X. F
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据: e! ?9 P/ j# a* U4 d
  2157.   attr_reader mouse_map_y # 同上
    ( W3 K3 d- {3 s
  2158.   #--------------------------------------------------------------------------6 e+ F+ S+ c, ^9 S  V
  2159.   # ● 初始化对象+ f3 {- q  p* F0 ~
  2160.   #--------------------------------------------------------------------------
    " p0 C6 ?) ?. w3 p/ r& r
  2161.   alias sion_mouse_initialize initialize7 B. d5 E  `: c% {) z- i1 {0 L! M3 l
  2162.   def initialize
    5 `- Q2 L, A8 N/ q4 S( \! A5 @4 d
  2163.     sion_mouse_initialize1 c6 w8 s: `  ]% o# S. Z
  2164.     creat_move_sign  ###
    * }" q! F: L3 I9 m7 ]$ S
  2165.     set_constants8 M& d6 C4 q# J  {( l6 n9 y/ |
  2166.   end
    ; m9 A, L0 _) W- B3 I9 R' ^/ i
  2167.   #--------------------------------------------------------------------------
    7 z0 u5 g6 N" h) w6 s$ h
  2168.   # ● 更新画面
    - _7 d& A' n  Z4 j2 L! k
  2169.   #     main  事件解释器更新的标志
    2 d. i+ o' r2 |1 r
  2170.   #--------------------------------------------------------------------------: j4 x  N8 @4 V$ I* M: l
  2171.   alias sion_mouse_update update
    ; Q( F8 J. k- ^/ k( r0 c7 N
  2172.   def update(main = false)2 S) w8 x6 Y8 L
  2173.     sion_mouse_update(main)
    3 K- Z# D+ R6 A; I3 I
  2174.     update_move_sign
    - {  I8 ]) L- V+ _3 b( X
  2175.   end8 v1 ~2 ?; f6 w$ f# A1 G
  2176.   #--------------------------------------------------------------------------( D1 o5 M8 F. ^0 r% b6 y2 t0 O
  2177.   # ● 创建显示路径点的事件/ s9 E% n. @9 z8 [& U
  2178.   #--------------------------------------------------------------------------% q4 L! t4 G: Z1 K6 k; {
  2179.   def creat_move_sign
    ; @- K$ r- m( e8 p
  2180.     $mouse_move_sign = Move_Sign.new
    / k4 e) p' S5 G" Q: ?# O
  2181.   end
    " ^/ U: _& K4 J4 u( I4 @8 A
  2182.   #--------------------------------------------------------------------------
    9 O9 @' I+ O, m8 \
  2183.   # ● 更新显示路径点的事件
    1 K7 ]+ R0 N$ o% u$ T; y5 S  f
  2184.   #--------------------------------------------------------------------------* w  S; g4 v& h  g" V. ], |
  2185.   def set_constants$ X5 _5 K3 t4 u3 y; x+ c9 S  T" o
  2186.     @mouse_pos_setted = true  p, ]+ e3 Z6 R- a" _: Y
  2187.     @set_pos_prepared = false* b( S4 ]- T8 \5 M
  2188.     @mouse_old_x = 0
    3 b7 t2 S; ^. k  q& w
  2189.     @mouse_old_y = 0& |6 ~% ~5 a. D3 g& N& o9 A& v
  2190.   end
    8 p) z* e$ O- l9 G# r) n. \. \3 n
  2191.   #--------------------------------------------------------------------------
    ! b: i. c" \1 D1 n% ^1 B  L2 V( L
  2192.   # ● 更新显示路径点的事件" o! w7 T- l' |! k7 B
  2193.   #--------------------------------------------------------------------------# t# J0 ^  j" S3 [1 n' I
  2194.   def update_move_sign) `$ k' `' q2 G2 o3 E
  2195.     $mouse_move_sign.update
    : r% w4 w8 ]% }7 w% h: Y4 V
  2196.   end
    * p( ~) \; ~4 N" g$ ~  b% v8 p
  2197.   #--------------------------------------------------------------------------8 V6 p6 G  j% `: K% X
  2198.   # ● 获取鼠标位于的地图块的x、y坐标
    * A/ r' {. H3 V" C; X, s' _
  2199.   #--------------------------------------------------------------------------
    " Y# f( Q& \  @3 N$ x
  2200.   def get_mouse_map_xy" e9 N: C' \  \' c
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y  \0 M7 S) A2 s# Q4 m' }0 D+ Q; d4 e
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i)
    / T2 E1 Q- {5 ~
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i)
    1 V0 Q9 O, w& s0 ?
  2204.   end
    ' K! j8 p3 X9 a4 i9 n6 c
  2205.   #--------------------------------------------------------------------------0 S, U' O3 \. f, _0 k; x
  2206.   # ● 返回地图画面时重设鼠标坐标
    * s$ D0 R( o7 L# f3 N( P
  2207.   #--------------------------------------------------------------------------2 X/ \. Z. [: v
  2208.   def reset_mouse_pos
    4 B( H: p1 y$ J: S* s
  2209.     return if @mouse_pos_setted/ u* S$ y4 d0 L' Z1 f- V; k
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y)
    , n, S: e! S3 w0 \4 ~7 L% i1 I
  2211.     @mouse_pos_setted = true( s" y# s# G- E! u
  2212.     @set_pos_prepared = false1 |; M/ e$ V- `, x: M
  2213.   end
    . a1 ^! B* M6 V, j, j, Z
  2214.   #--------------------------------------------------------------------------
    # ?5 _! C; }; z. D  }2 j; l; n. y
  2215.   # ● 重设鼠标的坐标5 v6 |- g' q$ A  s0 k
  2216.   #--------------------------------------------------------------------------
    $ ^9 k) v# P- w2 g
  2217.   def prepare_reset_mouse_pos$ C$ j+ s( R$ h$ Q: y" n1 O
  2218.     return if @set_pos_prepared
    2 v- }  f5 `" b( A
  2219.     @mouse_pos_setted = false1 W4 f& m& f( M  M' E( t2 D, W1 j- [
  2220.     @mouse_old_x = Mouse.mouse_x
    - w1 V5 m: K; m' g( W( R
  2221.     @mouse_old_y = Mouse.mouse_y
    , W# H$ n+ h; h5 T
  2222.     @set_pos_prepared = true
    % ]; U0 \5 n0 z$ L
  2223.   end
    7 o7 f5 E0 N# d; K
  2224. end* ?2 y5 c0 [$ _& Q, l

  2225. ; f% m! ^7 @& i" l2 n2 E8 s
  2226. #==============================================================================1 d7 j  `3 M8 l* c2 X
  2227. # ■ Spriteset_Map* [/ r- \: {1 v: A) s
  2228. #------------------------------------------------------------------------------
    - b  D2 e9 d" ]0 k3 A
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。
    . ^0 f; c- c0 D
  2230. #==============================================================================4 R8 P/ L4 V6 E; o$ j7 D. n
  2231. class Spriteset_Map
    9 c$ z- I* V7 O/ B  A9 ^
  2232.   #--------------------------------------------------------------------------
    # f! y6 V5 p9 I, X+ X7 b7 X) E2 @
  2233.   # ● 生成路径点精灵5 e# r0 a6 q# W7 s
  2234.   #--------------------------------------------------------------------------
    8 g1 b) Q2 ^! O
  2235.   alias sion_mouse_create_characters create_characters2 U" C) B! P' N7 Y" U9 d
  2236.   def create_characters8 _5 T2 Q7 s+ Z8 ?5 ~6 N" W
  2237.     sion_mouse_create_characters; G2 o7 f" j1 E( T
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))+ {% ?8 p& B2 T3 P% d  o* r0 w
  2239.   end
    4 r, X+ j3 ]  U& H% j$ U
  2240. end6 r9 q2 l0 B: _( E, O
  2241. ' n% }0 m3 W* Q  P
  2242. #==============================================================================
    & _0 \5 d1 F- }9 |
  2243. # ■ Scene_Map7 A1 J6 J2 x) A8 B
  2244. #------------------------------------------------------------------------------& f/ O! J3 e0 I+ m8 |' \. y" ^1 A
  2245. #  地图画面
    + b* Y% h  Y5 E
  2246. #==============================================================================
    " L1 U* _7 @& h3 [+ u+ F9 M6 ^+ i- L
  2247. class Scene_Map  Scene_Base6 o4 g6 p. N# E4 |. A- g+ E
  2248.   #--------------------------------------------------------------------------
    ; m9 ~$ q$ R3 V( T) \
  2249.   # ● 画面更新
    2 Q& |( h5 l) Y
  2250.   #--------------------------------------------------------------------------
    9 t; @: U9 C. i. A& T3 P( S! x
  2251.   alias sion_mouse_update_scene update_scene0 X% q, H& U/ x5 `9 p$ Q, t
  2252.   def update_scene# |& G  `% M, t6 U
  2253.     sion_mouse_update_scene+ t4 ?- @* }4 v% z. y! [: [: S: P
  2254.     update_mouse_action unless scene_changing3 _. @' N" m- j! V% j/ F/ A! v
  2255.   end$ p- S) x  S5 C. c# x  \
  2256.   #--------------------------------------------------------------------------
    % H; p/ n( A( D! Z  ^  y, u
  2257.   # ● 场所移动前的处理$ i8 o! Y0 c& B8 j/ }
  2258.   #--------------------------------------------------------------------------0 s; X% C0 U* ?/ v* C5 C
  2259.   alias sion_mouse_pre_transfer pre_transfer2 ?6 ~3 l) |# f" D, M; [
  2260.   def pre_transfer" r% w/ o, c; L# P8 M9 u% L5 C
  2261.     $game_player.reset_move_path
    9 U  w4 H3 d& C/ C- l
  2262.     sion_mouse_pre_transfer
    ; a# y6 e4 c3 Y4 k7 Z
  2263.   end- @, A% ?# J: X) o) F
  2264.   #--------------------------------------------------------------------------9 S- x- f1 E& Y% E: f# I
  2265.   # ● 监听鼠标左键的按下- X$ }( v/ o3 w( {& {: O4 U9 j9 |
  2266.   #--------------------------------------------------------------------------  @" L9 U  K1 m( a' H5 @
  2267.   def update_mouse_action" `8 K9 M9 O. [* N$ [
  2268.     $game_player.left_button_action if Mouse.press(0x01)
    8 a9 }- {% e) T" f0 J% N
  2269.   end) {" R+ d8 i& j' r: a% e8 _8 E
  2270. end+ L. W$ ]- G" F( x' N$ V

  2271. . T) O+ _3 l1 c; s9 b# l
  2272. #==============================================================================
    3 m! [$ X. j, k& q4 h( j! u9 w9 ~
  2273. # ■ Scene_File
    / }5 }% K* @5 X' [4 B7 L9 J$ W, `
  2274. #------------------------------------------------------------------------------
    ; x3 h# s4 D# k/ j
  2275. #  存档画面和读档画面共同的父类
    - o6 u! F  A1 l0 A. z6 b1 }& v
  2276. #==============================================================================: L  j9 g* q" q4 d/ Y6 Y& i. N. Y' |; S
  2277. class Scene_File  Scene_MenuBase( C' v5 Z! Q  p% X; }) t+ g( w
  2278.   #--------------------------------------------------------------------------0 \7 T5 @/ v; s! V* Z
  2279.   # ● 开始处理- m2 z7 b0 {& S2 D
  2280.   #--------------------------------------------------------------------------
    / l7 u' u8 l& s7 @* u+ T: q
  2281.   alias sion_mouse_start start: L7 Q# X; a  A( q; b7 V
  2282.   def start
    - D: F- q6 p1 d8 R4 u. I7 ^, f; ~  Q
  2283.     sion_mouse_start& |( B1 a' H) }. Q
  2284.     @move_state = 0; X/ l1 e2 H2 T) u
  2285.     set_mouse_pos+ I$ ]' z8 b% V4 G: p- H. n( P
  2286.   end* ?; G. ~4 c8 N
  2287.   #--------------------------------------------------------------------------
    5 Z' ^7 f3 T+ @6 Y
  2288.   # ● 更新画面
    " B8 X6 h/ q4 _" p
  2289.   #--------------------------------------------------------------------------% i8 a  x: @" n, P: D/ a
  2290.   alias sion_mouse_update update$ ]% k" K# @; ?3 f3 p, A& [5 |
  2291.   def update
    - O! t# z# s( p7 C. z
  2292.     sion_mouse_update
    3 R: i) @* J- `% h. i& P
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos
      L8 Z, E: k7 R7 C, u. `
  2294.   end) g' Q1 @  R9 c4 t( h& F
  2295.   #--------------------------------------------------------------------------0 ]! o4 _  Y3 \3 {$ v2 R
  2296.   # ● 更新光标
    - P* X, B4 R; N1 s( }( e" q8 D
  2297.   #--------------------------------------------------------------------------
    + B7 m7 Z2 X5 s+ D4 J& U
  2298.   def set_cursor
    : L- o* E; }3 u$ Z1 [; `7 ?3 r
  2299.     @move_state += 1
    ( d  o' o- Q& T% c
  2300.     last_index = @index/ ?5 e% L) W) P) ^$ R
  2301.     if mouse_which_window == -2
    . g* h2 d7 K7 |6 I. @0 r1 l. F
  2302.       if (@move_state - 1) % 6 == 00 c/ v8 X! L. S2 s. Y8 F8 q* E$ Z
  2303.         @index = (@index + 1) % item_max if @index  item_max - 16 f+ K1 N4 w' U6 u9 f
  2304.       end' s6 u) ^) h& g0 F
  2305.     elsif mouse_which_window == -1
    1 I# J2 y% R* t* i9 |, u0 `9 E
  2306.       if (@move_state - 1) % 6 == 0
    ) x6 K8 M) M! V
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    5 W. H0 j% D2 K9 w. O# s# N* `
  2308.       end3 m9 p+ v6 \; p. `1 W
  2309.     else  A# U, [. w" q6 t# j
  2310.       @move_state = 0
    . W0 Y; `+ ]" G! l
  2311.       @index = top_index + mouse_which_window& w+ D5 X5 v: x( t5 S. c0 f5 V* p
  2312.     end
    / \% W, ^) Z; b! H( a, n
  2313.     ensure_cursor_visible
    # k* U3 Q$ O4 U" t
  2314.     if @index != last_index6 `: I- d: @: i$ u: {" N4 A' E
  2315.       @savefile_windows[last_index].selected = false
      n6 ]; @# R4 r0 \
  2316.       @savefile_windows[@index].selected = true! ?/ W, F& z1 l1 N
  2317.     end
    : x/ Z8 \$ g" t  L+ H8 {$ }, s2 M
  2318.   end- {8 s/ o' _8 s# z
  2319.   #--------------------------------------------------------------------------
    7 i$ B2 W2 V5 y4 ]
  2320.   # ● 判断鼠标位于哪个窗口* k, W# {' O  n- Y. e
  2321.   #--------------------------------------------------------------------------
    - Q/ t; Z& r# z2 ?* A' M( j
  2322.   def mouse_which_window
    - }: Y" w3 e; D3 |) H$ [. y
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y* E) K( d$ b' L2 D
  2324.     if mouse_y  @help_window.height + 147 R& k4 h+ T; s# m% S
  2325.       mouse_row = -13 Y0 A& T: Y! h9 A% i% t. |2 }- `
  2326.     elsif mouse_y  Graphics.height - 14' k  i' ^3 V+ N9 T
  2327.       mouse_row = -2
    + ]9 l8 p6 A% J, S$ ^6 j
  2328.     else
    : ^3 Q. c1 q0 b' v' k
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    ' `5 X1 |9 N& T) B6 r1 Z: `
  2330.         (Graphics.height - @help_window.height)
      y# _! X) K5 J5 d; N
  2331.     end) f2 y  K* \5 W9 }, N! F
  2332.     return mouse_row) N) F# r2 F" _1 s/ _3 H
  2333.   end
    & `- Q6 b* L5 p  x
  2334.   #--------------------------------------------------------------------------
    0 T( C& J: x% k4 z! Z4 }
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置7 L" S) g. s+ Q  m5 ~
  2336.   #--------------------------------------------------------------------------
    ! f  ^; `8 F# G1 X
  2337.   def set_mouse_pos
    " y$ T) q+ u. Z: H* W
  2338.     new_x = 40
    " M6 I* L8 {7 X3 m& I; {0 G2 X
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24  A0 l" G9 [" O# d$ K9 X. L
  2340.     Mouse.set_mouse_pos(new_x, new_y)  M* g$ i: X( g+ b! g1 s& Q
  2341.   end
    5 i/ x* n; f, B0 \2 _
  2342. end: z: Q3 \- ?8 Y( |- C8 s
  2343. - Q: t+ j, e+ e% k6 T
  2344. #==============================================================================
    , r3 h7 |' K3 G: R% K8 D6 V
  2345. # ■ Game_Event  L* k7 l: \5 I/ P( u1 W( u. x; ]4 N
  2346. #------------------------------------------------------------------------------
    * p" D4 f* s% j! f5 f; L
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
    % p+ P  e' L& Y' }) A: D$ k& w
  2348. #   在 Game_Map 类的内部使用。, Q$ V$ \) y/ G5 a" U
  2349. #==============================================================================* A, y8 U4 a- E$ g$ z5 [
  2350. class Game_Event  Game_Character
    # m% \4 z. C2 K- r5 G) Q
  2351.   #--------------------------------------------------------------------------
    , ?& X6 R1 @7 a' d& z6 X( v
  2352.   # ● 事件启动
    . y" }5 d: y. S* u  h' k0 z
  2353.   #--------------------------------------------------------------------------
    / E, y* ]9 K7 ]/ F  U$ \; e2 n0 B; _
  2354.   alias sion_mouse_start start+ ?9 M" v) `1 ^! [+ k) c
  2355.   def start
    4 O) |8 O  ]2 j/ e. Z
  2356.     return if mouse_start && !Mouse.press(0x01)7 ^& @0 h0 ]. J' S0 [
  2357.     sion_mouse_start7 Y9 K; E4 O' K5 }; D
  2358.   end
    + w- ?0 V. j) O  A# C. I/ d
  2359.   #--------------------------------------------------------------------------
    ( f; D, h! g! W, o) [. M" s# X, U
  2360.   # ● 判断事件是否由鼠标启动
    $ M& ^5 R- f7 t! Q) z$ b! C7 W4 b+ t
  2361.   #--------------------------------------------------------------------------/ @- E+ x' O" W# h
  2362.   def mouse_start
    ' P  ?% ]0 w! T  p7 f' t0 `4 Y
  2363.     return false if empty) O5 F/ {& b) s" @, Q+ a0 ]
  2364.     @list.each do index) F* k/ c- G7 D- o5 H( y
  2365.       return true if (index.code == 108  index.code == 408) &&
    : l  H$ H- C" k; Y  e) U9 O5 W' j2 N
  2366.         index.parameters[0].include('鼠标启动')+ b) {/ T/ a8 J% p/ @, r
  2367.     end9 h6 {) a" g2 L4 L+ x
  2368.     return false, g& q+ A" }) Q
  2369.   end
    ! Q* ~# L5 j4 t( q
  2370. end
    / i! V2 Q3 v: m$ S0 V# `
  2371. . B" p6 G- w/ L  h/ T: [
  2372. ####泥煤的height
    , W+ p+ o5 X! h3 q: R1 q
  2373. # @height = height  l0 w" l; c4 g5 r6 A7 d: i& P3 x+ G
  2374. 6 s+ x1 O# w% p0 I. X
  2375. class Area_Response; q. ?! N- j1 r
  2376.   attr_accessor type0 E. V5 w( Q  R9 j
  2377.   attr_reader ox
    $ U$ E# R& q) X5 G
  2378.   attr_reader oy
    0 U- P2 q! c% z8 P5 e) ^1 M! e
  2379.   attr_reader width
    ) a. K3 E- Z9 n
  2380.   attr_reader height2 p5 p* h; c9 ^+ R
  2381.   attr_reader switch_id$ H! G1 r. l9 i' w" ]3 S
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)9 ]+ E5 }4 @2 y9 U) d, |
  2383.     @type = type
    1 X$ B6 V2 y4 u
  2384.     @ox = ox  W! |: Y2 V5 Y+ Y/ j' U4 K
  2385.     @oy = oy
      D$ m2 ^) D" \& l, ]: V4 {( d
  2386.     @width = width. G' d; ]( `" i" K0 h/ o
  2387.     @height = height: I, p; E  y6 \% c, |) s2 B- O
  2388.     @switch_id = switch_id
    $ H. `6 o$ n8 S- |( {: ?
  2389.   end* I5 {" R. G0 F2 ~
  2390. end" I" R0 y  X; ]5 z, A
  2391. 4 x" i/ s) U# C
  2392. $area_responses = []
    * z9 W- W( x* |
  2393. 2 Y+ A" Q9 b) ~/ l; w
  2394. class Scene_Map. N7 g" _! Y. x: q4 x3 H
  2395.   alias update_mouse_2013421 update_mouse_action
    1 h" j+ W" k0 v, w) @- \2 x
  2396.   def update_mouse_action& f, C0 Y( o# N+ e" O8 S. U; A
  2397.     update_area_response/ h7 Y) Y* v6 L. D  _8 d
  2398.     update_mouse_2013421
    5 G9 ?9 b1 U7 `  a" }! c0 o
  2399.   end+ [% e0 i" w5 u0 m8 @
  2400.   def update_area_response7 Q% K7 V, Z8 q/ Q% Y
  2401.     responses = $area_responses. ~  g$ H7 k6 Y
  2402.     responses.each {response
    4 i( P$ t* y1 |# V
  2403.       ox = response.ox0 z/ j8 ^! p0 C( z
  2404.       oy = response.oy
    ) [3 f+ O9 E8 G7 N- d( G
  2405.       width = response.width
    ' Y4 {. h1 ^  T  O+ E5 a% S
  2406.       height = response.height
    9 \- M' `2 n5 p
  2407.       switch_id = response.switch_id5 j7 p( h  \4 ~
  2408.       case response.type7 w5 i$ C7 n/ ^' I7 a3 ~% C- r% }
  2409.       when 0! ~1 w% N( o' P: H% O
  2410.         if mouse_in_area(ox, oy, width, height)
    / f7 ^  X# b1 N) L# g
  2411.           $game_switches[switch_id] = true# l! u; M: R. e; o) i
  2412.           $area_responses.delete(response)
    % \* ?% p2 v# k4 w7 G6 N
  2413.         end  Q3 Q& _' q4 K" `" m% I
  2414.       when 1
    # T$ a! Z; T+ \1 X6 t0 E2 D; E( G2 ^
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)
    2 t2 I( ?4 y6 Y$ K+ t- x' s( M
  2416.           $game_switches[switch_id] = true4 x+ w) R. m- A& i, ]1 s! r6 |# l. p% ]
  2417.           $area_responses.delete(response)7 F% v1 D- U0 o- X# `2 V: o
  2418.         end
    3 N5 K# U2 @( B  D9 y6 s* k: w
  2419.       when 2) F$ N6 L8 N/ X/ h
  2420.         if mouse_in_area(ox, oy, width, height)) z. Q: u! n; v- F' }. d- ~
  2421.           $game_switches[switch_id] = true
    ) d4 V6 n2 X# U7 @/ o* m* f7 O
  2422.         else
    : \3 d9 Z) o+ j. ]0 X, ?
  2423.           $game_switches[switch_id] = false
    8 a# ?" R) Q; {1 B- b
  2424.         end
    " i( n# \) w" `; I, F
  2425.       when 31 w$ i/ W6 f" a& k( N% @+ d
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,$ j  F# B5 }. Q* ~% T
  2427.             (oy - $game_map.display_y)  32, width, height)
    + g6 G% U3 v9 ]( {( J
  2428.           $game_map.events_xy(ox, oy).each {event
    9 Y) n- T6 e+ |: s# H- `
  2429.           event.start
    ! \2 Q4 M$ P* m; ^1 V
  2430.           $area_responses.delete(response)
    ) n$ x% [) S1 A7 `  M. c# y
  2431.           return0 [) N8 r: ]: H/ g# g* P! j
  2432.           }
    ; \6 S8 g8 R5 m: F
  2433.         end
    3 l+ s3 S7 [1 ]) z+ R6 A( \9 j
  2434.       when 44 r5 G. f  v$ P, W" Z% v7 N% v6 I5 D+ e
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,( _& q* ^5 |' d1 m, j$ Y8 I
  2436.             (oy - $game_map.display_y)  32, width, height)5 @! Z. {( y0 I# n/ T  y9 ?
  2437.           $game_map.events_xy(ox, oy).each {event
    3 ^: i/ f7 k2 t
  2438.             event.start
    " C7 [; k4 t& o. s4 {
  2439.             return
    4 e# h2 b; B( |+ A0 k6 t
  2440.           } ' v& K- t* Z8 b5 o+ j1 H3 n) _% M
  2441.         end
    ! V; S* x; @& c3 @# m; h
  2442.       end% |. r  J1 S& d. a
  2443.     }& f/ M  X7 X% R
  2444.   end
    * o/ \( s1 D: i) L4 E  f" H' B' ]
  2445.   def mouse_in_area(ox, oy, width, height)
      k" z( D; C" d! K! ~# q3 S( I
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&
    7 a6 ~& G: d! z+ K, K' |4 f7 j
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height
    # h0 y& E( C# |9 y
  2448.   end
    " c7 D4 M$ r5 Z, E) b0 ~7 k6 z
  2449. end
    4 x* Y) p4 Z2 T9 U
  2450. class Game_Interpreter9 f- w; |/ z- h& y7 J# Z, G
  2451.   def area_response(arg)6 b. g/ T2 I/ o& B3 l
  2452.     $area_responses.push(Area_Response.new(arg))
    - Y. A4 ~. G9 P/ ]1 I5 I
  2453.   end' B9 J7 \7 M3 U5 l5 E4 ^0 Z
  2454. end. X. ?1 D& {; y9 g
复制代码

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

站长信箱:fux2@moe9th.com|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-7-15 14:09

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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