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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================2 a+ c" D0 {& I- I  @
  2. ( [( I5 e* w' Q& y/ V
  3.   Sion Mouse System v1.3e! p7 o& X* T% F! Z; K& [) ^
  4.   
    1 U9 B' U$ C2 t( U8 x- v6 f
  5.   Changlog
    - Y2 P( k# V7 R/ @+ G) C- y
  6.   ! U3 Y) g% A8 a
  7.   2013.4.21 v1.3f, c! |$ p: J9 K
  8.    
    7 u7 D" |4 v' `" M
  9.     1.3f 卷动地图 bug 修正, k! i7 ?& ]0 W+ o* W0 V5 [
  10.    
    0 _; v+ {% ~- h' [
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口
    6 S% |9 V. ?! V* A0 M- a) c
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内
    & D8 m  n6 o, v/ n* f7 O; b# j7 S4 r' a* V
  13.                               Mouse.unlock_mouse_in_screen 解除锁定$ o* m7 X: C" I# z4 U* t
  14. 8 f/ _+ a. {" E, ?3 ^4 X
  15.     1.3f bug修正3 v* c/ n1 g# ~5 V9 s
  16.   3 L; |/ z" }- ^# C1 S
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及/ X( l8 d6 J. v4 ?
  18.           关闭菜单时,鼠标是否移动到原来的位置。
    2 T+ u2 t0 ~, b# w
  19. : Q- g' {( J* \- m, L) f
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处
    0 @  B3 c' z6 p# _0 I9 j# G4 r9 i
  21. - P3 \) Q8 _: T0 G! O8 p
  22.     1.3b 修正一些罕见的bug;
    3 S1 `! W6 {# J* E" r+ g' v

  23. # `% x% U/ }' N0 p- T9 _
  24.     1.3a 代码小修改;
    ! o8 _5 r5 B: z- t& ]9 S  k
  25.           加入了鼠标点击启动事件的功能,8 W2 n# l6 A- X" F  D6 i$ x$ ?
  26.           在事件中加入“注释”: 鼠标启动  ,' L# J8 V" c0 d$ q, o4 M
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    ) n$ W5 x  _  E2 g% r" w: w
  28.   
    . R3 e0 b  B- e" K" C
  29.   2013.2.12 v1.2
    9 s" V; ^+ G. R7 X% R
  30. ! [6 I/ q% h8 I% U4 f
  31.     寻路逻辑优化;$ z* g0 G/ v5 s* [' A+ W
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;6 y( Q  x! f- A% e! X
  33.     现在支持用鼠标来操作载具了。3 B5 \, k) O8 K4 H& E' M! H
  34. . A  B3 t+ }: {- L
  35.   2013.2.8 v1.1) I( v0 Z$ e( A$ H# P) v1 s# x. j
  36. - ]0 Q  ]. ^) v# N8 X; n! w# m5 X
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;9 B0 [; k2 g* |. U
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;$ G+ y) x" g2 ?4 }) q7 S* I
  39.     移动时,路径指示点的绘制更加稳定;" D0 R1 R2 |5 S7 Y# n
  40.     现在支持默认存档画面的鼠标操作了。
    3 N9 f( ^7 M1 `: e( \  G4 C' J4 \
  41. & I5 j$ {: c) W) M4 ~7 Z

  42. 4 p0 O3 Z  A/ M; u, F, b; c
  43.   OrigenVersion6 M" v& t1 X& `; R" G* R! ]) @
  44.   
    " Y( n1 h% K& {7 A: R& u1 C
  45.     2013.2.7 v1.0 , K  M8 H; H' k$ c: K6 H1 f

  46. 1 b3 k  i3 Z+ D; m- e3 t0 P& k
  47.   主要功能3 F! _9 \/ G# Z( G

  48. 2 i5 u0 {: ]1 c4 s& {3 ?  E8 S9 `- l
  49.       使用鼠标进行各种操作...+ f: x" D! X& b) A* `% T4 M: Q1 q1 z
  50.       将鼠标锁定在游戏窗口内
    4 F! c% \- R3 C* A1 o+ f9 ?" k) t5 ^
  51.       自动寻路,按住 D 键可以扩大寻路的范围; z+ l' T6 S. C; B3 \7 u8 z* w- P9 V
  52.       双击鼠标进行冲刺
    3 R5 _, B: o  o) `9 `
  53.       更改地图卷动方式以适应鼠标移动
    ( x7 A* A) k0 S3 q7 p
  54.       变量输入框改良, t4 y' m# l6 m& _: E
  55. . t' \1 ~( ?9 C5 v( i2 A
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹
    4 D8 R. P1 p5 V9 U8 `% z1 Q* i
  57. 9 p, _) [7 U- L- l% a( e
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹
    + |/ e8 s1 @% @. J# ]

  59. - T  e* a; p$ s2 W. u. l; h+ v
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    % v1 X" b' ^  j' `
  61. . c/ P, s9 y' h! Q8 V

  62. 2 C/ j. t/ H1 f0 t( Y
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★
    ' r# C7 w5 J4 w/ Q: ~
  64. 4 ^4 i. c/ X* E+ [$ i
  65. : Y( [$ u- z9 ]) _/ d+ x* L
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示7 p3 ]+ j2 j+ ?2 l  @7 k
  67. 2 K, ?! t4 _9 [
  68. #==============================================================================
    & r$ t+ C) N  l3 z7 r* x
  69. # ■ 常数设置
    # L# v1 [7 d" m
  70. #==============================================================================
    + G$ L9 X8 ~0 c! \' [
  71. module KsOfSion3 V% H( }+ m' b; w3 L
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false6 ~2 F0 Y: j+ b5 r4 r. y
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑& d3 y/ T  Q/ h) f! y, f
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    9 _+ q& o0 J1 Y" q( [( {
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量' a5 g5 x2 A$ y$ K7 Q
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处6 N* @9 @& c8 U7 M( @" U
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧
    # V/ r3 ?1 U* s9 S5 E
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13), ]) @1 _3 G3 `, t
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键
    3 ~8 b  Z2 V; u* d3 |& `
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)% R8 ?6 O7 t* m7 Q/ v) G
  81. end2 J- v% ~) c& Q5 k6 q
  82. , t+ b, q; l" O6 Z+ ?( ^
  83. #==============================================================================
    ( j( i& w& [. |1 K2 X# r4 Q
  84. # ■ 用来显示路径点的类
    ( _6 p4 j5 S( @' W
  85. #==============================================================================
    ! m* i  Z( g* l, c# N
  86. class Move_Sign  Game_Character
    / [- b& Q+ |3 K0 l9 G+ G
  87.   #--------------------------------------------------------------------------
    / N+ g/ U' d' e- z6 ^2 \. S% ~6 m
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图
    & y& K4 L, W9 b/ B
  89.   #--------------------------------------------------------------------------1 a9 T" _; q$ L7 c& \6 y
  90.   def init_public_members- J; @& r: }) Q2 e$ y" x' F
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹! Z) x  ]$ b0 s5 t) d" s
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    6 f& M' e# T  g" s$ L
  93.     @move_speed      = 5        # ★ 踏步速度
    : z6 L0 n; s. Z" `" k, |) I3 {
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    9 s/ d( L4 d6 Y5 @3 S, k
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度
    $ L9 F$ ]& L8 r
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)3 @% b  U1 p$ x4 N5 k
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列
    8 G3 @& @3 A# m' ]! y0 h" W3 F% k
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)
    ; R1 i5 g# F. J! x) ]+ a6 ^  Q

  99. " S- G" G) A2 ]

  100. 1 a1 x3 ~& z' n
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★  r( J3 o+ Y* {& J3 ]/ r& x
  102. % H' `& P$ ?% i/ O; l! t- C1 {6 {
  103. / Z5 c# Z/ z! J* i6 k  K1 w# p
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图9 w( w! O- Y$ Y( @; y
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    - R5 T/ n$ h9 j3 m: h

  106. # M! j$ V3 k7 T: O4 b6 W! S6 {
  107.       if $no_arrowpic_warn
    & ~+ Z3 w8 f5 a$ u1 `3 l" H) q7 d
  108.         MouseShow_Cursor.call(1)
      y" V1 P9 [4 ~, h0 C6 W: i
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png
    + A/ h( G  {' }; u9 v# k5 U
  110. - v: y- i! e+ |: e/ i" A
  111. “路径指示点”将使用游戏自带图片
    : X1 J* K$ n1 z3 Z" {

  112. # q8 O* d6 R! H$ T
  113. 该提示可以在脚本内关闭')6 R% Q/ E' O7 f5 m1 _7 P
  114.         MouseShow_Cursor.call(0)
    3 P  H4 u5 ^4 p+ K) m. K% ?+ J/ L
  115.         $no_arrowpic_warn = false
    * k- P# \' O7 C* b# a
  116.       end
    * C1 v. {/ t8 d7 |) I. y
  117.       @character_name  = '!Flame'9 V; @$ \# B0 C# U
  118.       @character_index = 6
    : K% D9 H$ P8 e; z  j

  119. 6 o* m4 ~& N4 o8 g# R5 R" A
  120.     end9 E) Q* Y$ }1 C. [. z
  121.     @direction_fix = false  # 固定朝向
    ( A; P* c' F; k2 j% r3 J/ A6 A
  122.     @move_frequency = 6     # 移动频率
    ' {1 r/ `7 [) ]! B
  123.     @walk_anime = true      # 步行动画
    0 u5 r. K3 O. o( R
  124.     @pattern = 1            # 图案0 B" P' g: T' T: S: N
  125.     @through = true         # 穿透
    ( E1 i  E2 T4 I# r
  126.     @bush_depth = 0         # 草木深度+ P1 o2 J0 w% Y; Y- h( h$ n5 K
  127.     @animation_id = 0       # 动画 ID
    : `7 \& I: h% O1 U! O1 y
  128.     @balloon_id = 0         # 心情 ID' C4 P8 H4 U! Y
  129.     @transparent = true     # 透明
    $ s- x2 l8 Q3 E" ?" l, A
  130.     @id = 0* O  H+ j8 z: c8 _' h8 u! e6 m
  131.     @x = 0+ g! L) @3 w% L( d- K  q
  132.     @y = 0
    , P/ }7 _/ T0 Y
  133.     @real_x = 07 Y8 U! F4 Y9 Q5 m9 }
  134.     @real_y = 0* g& U, C  ]' R# n$ e3 E
  135.     @tile_id = 00 z2 Y# H- M7 y5 {0 W3 }! f8 j4 l
  136.   end
    % \2 N+ ~2 u  t0 ], `
  137.   #--------------------------------------------------------------------------
    % e1 V8 o- J7 ~- G# T1 V
  138.   # ● 定义实例变量1 l# u& j$ m" h% e6 E, p0 W
  139.   #--------------------------------------------------------------------------9 S4 L: x+ T' v; [" }) i
  140.   attr_accessor direction# ^- X' k" p3 r) M% A8 U; M
  141. end" G+ J3 q0 y5 e, Z2 |

  142. " B( C' b% Z' m8 _3 r& [( y# N
  143. #==============================================================================
    ! d2 V/ X* _8 s( |; o& |
  144. # ■ Module Mouse
    % |; v3 w* C6 x# G9 R" f
  145. #==============================================================================2 C/ q% {7 t6 b' A- }( y! ~4 U
  146. module Mouse
    $ x* e8 F, h9 D8 A4 r
  147.   #--------------------------------------------------------------------------# z% w% K) {& |. o
  148.   # ● API- _, F. i/ a) C- X+ j
  149.   #--------------------------------------------------------------------------( I7 Z& g) c+ t  ]
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
    # b. J# m) g8 b9 Q
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')" a6 W: ]0 |* z# Q
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')
    ! }: w/ I/ p4 I( S
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')$ }7 J7 ~$ N; b, P7 v$ E6 O
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    $ k  |0 a3 f1 U9 V+ O% ^
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')" H6 _4 J# H+ w; k
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')
    8 Z! ]; h2 T- w7 |3 ?/ A" h5 s
  157.   Window_Hwnd       = Get_Active_Window.call4 d6 f4 ^' f" v4 w2 M
  158. , [! ^2 y( f! t% d$ D* B) K4 G
  159. class  self1 w5 l9 W1 a1 Y/ ^
  160.   #--------------------------------------------------------------------------$ M8 V; R% k1 \; h
  161.   # ● 初始化
    ; ]; Y1 X. J! v1 `
  162.   #--------------------------------------------------------------------------: o- }  q+ {+ a7 F* ?
  163.   def init
      [/ b. m% h  f3 G' e
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor
    ; Y0 e& D" ]. h" H1 r3 ]
  165.     @left_state = 0
    3 Q+ Y- p. F7 o. h1 E
  166.     @right_state = 0
    6 D) D, W* b  ^3 V! S
  167.     @ck_count = 0 # 帧数计,单击以后从0开始. g9 i9 M( E# t  }: C; W5 g' ^: @
  168.     @dk_count = 0 # 用于双击的判定+ t# h1 n# @" c1 }* N) C$ j
  169.     @clicked = false$ o, g/ F5 C  M$ O
  170.     creat_mouse_sprite) b2 M0 x7 c) A/ k6 F
  171.     update
    ; d7 P/ Y- }0 @# u- G6 M
  172.   end
      b! B+ @: w: a7 ~) d
  173.   #--------------------------------------------------------------------------
    ' y2 N6 S5 @8 D! E. \; B
  174.   # ● 鼠标指针精灵
    ' j1 E6 K! s, u$ F! F0 K
  175.   #--------------------------------------------------------------------------9 D; d1 V9 y2 a( l
  176. #~   def creat_mouse_sprite
    , ~1 d/ l9 j+ P% N- @- b
  177. #~     9 t/ k( D3 U- w6 F4 S" Y
  178. #~       @mouse_sprite = Sprite.new3 g3 X# R4 l1 b3 }- r6 a  x
  179. #~       panda = 2#rand(2)+1& z  F5 y" i  ^6 @* O

  180. - Z6 J# V& K7 e0 ~' J1 }2 _5 d
  181. #~      if panda = 1" F8 _/ X0 t9 V# V* a3 J9 N' L
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    9 M* j' a4 h# @0 i3 b4 |
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    3 o5 d/ x0 i; V  u& n- L
  184. #~        end#with if File.exist" w% {3 ~. E1 D+ s2 c' k
  185. #~    . E7 P" j8 ~5 |; w6 r& |
  186. #~     else if panda = 2 #with if panda=1
    + e/ u) k2 M6 F
  187. #~      * t& L! Q" n# G
  188. #~      if File.exist('GraphicsSystemCursor2.png')$ E: T- b; C) Z; C6 `( n
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    / p; v% ]9 S+ p$ }1 {2 `/ s& s
  190. #~      end#with if File.exist" `1 ]4 r) _2 x. {0 h3 R/ q6 K4 N
  191. #~      
    : O) p: t+ H5 Q$ I: x7 ]* U
  192. #~     else #with if panda=1# g& q, M6 J1 I% W
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    4 v: l. s! [3 T5 p! X8 g- `) p. {( P# F
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),
    ' x7 W# j/ I7 L
  195. #~       Rect.new(5  24, 24  24, 24, 24))9 m  g. c8 I& ]* ^
  196. #~     end#with if panda=1# n, E* H" Q/ H4 D. M& C1 g; [
  197. #~     : ^1 D6 Z4 Q- n4 ~; b( `6 a
  198. #~     #with def
    5 K9 ]/ \8 B- g
  199. #~   end
    " N$ f3 p( a: Q8 G1 p
  200. def creat_mouse_sprite
    $ S* ?8 J8 P6 }, \
  201.     @mouse_sprite = Sprite.new
    $ J* T3 I5 i" q/ ^/ {  G
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})
    - e6 o) M2 x- Z+ B$ s
  203.     @mouse_sprite.z = 9999
    4 ]3 J" z# [& R4 y6 [
  204.     Show_Cursor.call(0)' ]2 a6 I2 ~/ |6 t
  205. end
    2 h8 q# j0 E9 V6 [) o! v1 N

  206. 4 D6 r/ v6 }7 A; f  n
  207.   #--------------------------------------------------------------------------
    9 C; R3 K+ `1 ?
  208.   # ● 更新! f( W+ `0 @  H* x3 p  s- G
  209.   #--------------------------------------------------------------------------
    : P, y; @/ o6 ]+ t
  210.   def update  [0 m& c4 L  X1 |
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos
    ) W+ w3 @! Y. _6 J1 d6 E
  212.     left_state  = Get_Key_State.call(0x01)
    / N3 B  N. V2 c
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0
    % g0 r1 E% W" C* f/ {. M; I
  214.     right_state = Get_Key_State.call(0x02)
    1 e. K5 y. }! c: W7 Z6 _7 \
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0( x" U1 @2 D: A/ n# u! U7 n
  216.     update_double_click# ^8 n$ e6 `9 s2 r9 y+ e# v1 [- b
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1. d5 F) q& Z8 ~- V% T  Y- b
  218.   end
    % u0 L) p6 r2 u% h# s
  219.   #--------------------------------------------------------------------------
    % F" h9 r: Y2 @4 F: v
  220.   # ● 获取鼠标坐标
    9 W" N# H0 |- F8 h0 I
  221.   #--------------------------------------------------------------------------
    + P; h/ i, O* T) |
  222.   def get_mouse_pos
    5 R; K; t) E% E, a6 j5 b' L
  223.     arg = [0, 0].pack('ll')$ L4 Z2 |$ C' O2 R
  224.     Get_Cursor_Pos.call(arg)
    ! c: S& C& u- I1 m: r. l
  225.     Screen_To_Client.call(Window_Hwnd, arg)$ q  O' [4 d3 C6 ~( s5 A
  226.     x, y = arg.unpack('ll')( d- }# U8 s- {& l) e# g) a5 x+ f
  227.     return x, y
    " f. k3 w. l9 G: X3 H5 h4 s2 Z
  228.   end
    # w# `( {6 E/ f; m& P+ N
  229.   #--------------------------------------------------------------------------
    ; s5 C9 _) W  y/ v! g0 S4 j
  230.   # ● 将鼠标固定在屏幕内
    , i6 C5 N7 v8 e
  231.   #--------------------------------------------------------------------------
    7 G" G$ I1 u& C, w' C
  232.   def lock_mouse_in_screen
    2 w2 g. q& n0 N* {/ f' N- T
  233.     arg = [0, 0].pack('ll')
    9 y% _3 d: b% {* l% Z/ D' s
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    ( t' B# j- D( Y4 V+ H
  235.     x, y  = arg.unpack('ll')
    / U: @3 E& ?. o0 T$ q$ E
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))
    2 Y- u/ c5 N) ^" D% t8 g
  237.   end; H8 W. w7 q: @3 l4 F5 `5 D6 W
  238.   #--------------------------------------------------------------------------
    2 f& B& ]! ^, Y# a' y" j9 @
  239.   # ● 解除鼠标固定
    5 h" l1 m1 _8 k/ O: s
  240.   #--------------------------------------------------------------------------
    4 K3 _/ o! \% K1 H
  241.   def unlock_mouse_in_screen, }* Y6 [6 ?" ^
  242.     Clip_Cursor.call(0)) w. ~6 i5 _. G
  243.   end
      X7 n9 ~# O+ h+ o
  244.   #--------------------------------------------------------------------------) ~$ G8 W# a. f& M# y
  245.   # ● 鼠标双击判定9 c5 c! J* \& u# J  w/ ^  v
  246.   #--------------------------------------------------------------------------
    ! y; X8 {* [* ^, f1 w; |" m& r
  247.   def update_double_click6 T/ }5 ~7 J0 L; c
  248.     @clicked = true if @left_state == 11 d( R, c1 i' D8 z' x
  249.     if @dk_count  0 && @left_state == 1" X9 V/ K; A, X5 D
  250.       @dk_count = 0; @clicked = false8 A* C7 f0 u  m& z$ `
  251.       return @double_click = true
    " ]6 J3 N  n2 Z* F0 f
  252.     elsif @clicked
    ' S! {- c  t+ p$ h
  253.       if @dk_count  KsOfSionDbclick_Frame% p1 b" K& {# q
  254.         @dk_count += 1; q( H* B4 @3 O" z4 a
  255.       else/ y! k) `3 O2 U" P; X$ n. F
  256.         @dk_count = 0; @clicked = false2 m* A2 w* x! N5 }8 m2 d2 A
  257.       end
    3 M" g8 G+ d8 D
  258.     end
    % I( b. o: L- S
  259.     @double_click = false
    9 C9 [/ T2 e; L% Y
  260.   end
    * [3 ?, r* ]; M% M' H5 B) j
  261.   #--------------------------------------------------------------------------
    ! Q3 g' z  @3 ~/ j8 Y6 j5 {) S" \
  262.   # ● 按键被按下就返回true' p; i# f5 N( p" _3 k4 Y9 y1 X
  263.   #--------------------------------------------------------------------------
    . `1 l5 [1 m. C* w0 D$ X7 p. ]
  264.   def press(button)
    ' ~6 u9 q7 i( [. o$ _
  265.     case button2 r4 C) x$ Y5 A7 H# ~9 C
  266.       when 0x01; return !@left_state.zero
    ( H) f- \$ X. E4 M
  267.       when 0x02; return !@right_state.zero
    % s" N4 _; i7 u  ?! p6 b
  268.     end
    % R+ K# j" A) a0 ~# s# b
  269.     return false7 _* Q/ {+ L4 k6 M2 C; M- P
  270.   end
    8 ~  N* ?# |5 Z" T
  271.   #--------------------------------------------------------------------------
    : `) x2 e: A: C
  272.   # ● 按键刚被按下则返回true6 e( N) n9 h9 p# Z
  273.   #--------------------------------------------------------------------------
    4 Y/ u; U* M# s" T# q5 _6 q, i
  274.   def trigger(button)
    % c5 {: U' M9 Y8 x$ e$ m
  275.     case button& Q3 Y, C9 o% N- T- |, s
  276.       when 0x01; return @left_state == 1! x4 Y4 q# V; F8 R7 q* C
  277.       when 0x02; return @right_state == 1$ g1 a% s& {6 F% ^3 P# g9 U5 U
  278.     end2 J+ O# O. A# |, r* y
  279.     return false0 c% b. o& j2 a) {; N
  280.   end
    4 [3 I' [+ Q( _, x) u9 n, X
  281.   #--------------------------------------------------------------------------
    6 V5 M1 j4 j5 C+ J
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true8 R4 ^1 O. r  h6 p
  283.   #--------------------------------------------------------------------------* H0 u+ R& f; _, k- {8 u$ p
  284.   def repeat(button)
    9 j! o( U$ }8 Q! T$ w
  285.     case button
    , n; n8 ~  @! K  ]1 b6 J6 j1 Q
  286.       when 0x01; return @left_state == 1 $ L2 S( B2 E# g" y3 q, h
  287.         (@left_state  22 && (@left_state % 6).zero)6 f9 Y3 Q& V$ O7 F; x# t) g
  288.       when 0x02; return @right_state == 1 + W) O) ?* o* h' J, C7 \; ?% _
  289.         (@right_state  22 && (@right_state % 6).zero). Y0 d. S' J- p6 h+ V, l) `
  290.     end
    ( Z$ Z  N* o7 |* h: i# Q
  291.     return false
    ' H# u- ~% T; o7 c( a- p7 u
  292.   end
      g# ^  o7 M" I3 ?. [* E
  293.   #--------------------------------------------------------------------------
    6 z% U5 z( S& q7 t. S  Y
  294.   # ● 判断是否双击鼠标
    + F3 j, k5 O8 f- o3 u' W
  295.   #--------------------------------------------------------------------------
    ! t" q( B* d% ]% V% u: s6 Z6 r
  296.   def double_click- Y$ [7 \( [/ _0 X
  297.     @double_click
    3 D, W0 {" h; v5 h! ~5 u: f! s
  298.   end
    , u' C7 {' p8 J( r7 J  [
  299.   #--------------------------------------------------------------------------# j. E+ R9 X  N) W* a! W1 V! Y
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)5 N& F6 T" b3 ]1 F5 w  ^2 @3 z
  301.   #--------------------------------------------------------------------------! ?4 Q0 I; z# U: i' \1 v: V1 U" R  k
  302.   def click_count) ], X* q6 m! Y3 b
  303.     @ck_count
    / D5 u. Y" w* a* y2 J# n
  304.   end* Q* U  u$ ^9 {4 _" e# ]
  305.   #--------------------------------------------------------------------------; d% c% R) P! s% P
  306.   # ● 获取@left_state(按住左键每一帧+=1)1 i, J7 T0 V5 _0 V* X! Z6 L
  307.   #--------------------------------------------------------------------------9 ^- {1 u2 J1 T
  308.   def left_state' u. ]; H1 j0 r! i3 I% o  Q
  309.     @left_state
    ' a0 H7 a$ F/ D, F- t
  310.   end
    . R! q+ w9 f- m3 U3 s% L
  311.   #--------------------------------------------------------------------------
    - Z3 q% c$ P( {" W9 B" B
  312.   # ● 获取鼠标的x坐标
    # d" {4 `0 H2 o5 C5 V& Y
  313.   #--------------------------------------------------------------------------
    8 i& A! M9 S& C+ }
  314.   def mouse_x
    - r; c5 r, E, U4 t9 T
  315.     @mouse_sprite.x
    , p6 p  ?6 Z# }6 z" i
  316.   end5 ], l+ }. i( o" g) a5 W9 ?( u6 N
  317.   #--------------------------------------------------------------------------
    8 E0 _: R1 `$ V- s
  318.   # ● 获取鼠标的y坐标$ Y* k9 T2 C$ f; s) ]2 e
  319.   #--------------------------------------------------------------------------
    # r" S! l6 c& g& M. g
  320.   def mouse_y
    ! p. Z# n$ B2 O: E+ M
  321.     @mouse_sprite.y. J1 e4 k/ _- {1 |$ C
  322.   end. e4 {6 K$ B  @3 z* ^! {
  323.   #--------------------------------------------------------------------------. K1 G8 B, n% m, [
  324.   # ● 设置鼠标坐标
    9 t% j" t# r6 s/ q! k
  325.   #--------------------------------------------------------------------------
    - \0 V# R7 j5 s  l" q: n' ]( [$ h
  326.   def set_mouse_pos(new_x, new_y)
    ! M7 `0 G  H6 l+ U; L
  327.     arg = [0, 0].pack('ll')
    # `  o0 [* m% G; X8 y8 _& s. a6 H
  328.     Screen_To_Client.call(Window_Hwnd, arg)8 m' |& i( U9 s4 M  f3 L1 M
  329.     x, y  = arg.unpack('ll')6 v- i: u# K0 X, M( O; X
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)+ H) `' A. |+ V3 k; d. b
  331.   end
    9 z* n2 i, i# R1 \
  332. end #end of class  self ! s, U' }$ f+ p
  333. ' U! J3 b2 @* S" A& I6 q( u# O4 B
  334. end
    0 `7 c7 N6 Y5 y5 n5 _9 t9 T: K
  335. " p1 @& k, n! _2 s
  336. #==============================================================================' G3 v& P, |" H2 Y
  337. # ■ SceneManager
    0 Q$ P- Y% x% Q, o
  338. #==============================================================================$ o6 P4 P% Z* r( \- b* O7 p$ u7 L
  339. class  SceneManager
    ) V5 x3 Y2 f! ?5 O" K4 j2 I
  340.   #--------------------------------------------------------------------------
    ; I( f; B& M4 B8 P* |- Y7 {, ^
  341.   # ● alias4 }4 A2 Q* M6 y& o
  342.   #--------------------------------------------------------------------------6 @) g  |9 e7 L" P6 g1 V9 ^
  343.   unless self.method_defined(sion_mouse_run)3 _( p- O/ y' x4 s
  344.     alias_method sion_mouse_run, run& v, S. Z" p; v1 V0 p; k
  345.     alias_method sion_mouse_call, call
    , v% o/ z! n' s; r
  346.     alias_method sion_mouse_return, return  \, `( ?+ g2 [$ s$ G5 C
  347.   end- D$ [  X& e* _& K& k, C! E
  348.   #--------------------------------------------------------------------------
    / f: J4 C4 m# z* B8 J' u1 e
  349.   # ● 运行
    9 J7 u" a& F/ P. N( V2 D0 S" \  _8 m
  350.   #--------------------------------------------------------------------------' g# b/ h* W" ~* y' L! v8 E& w
  351.   def run
    / g3 X! K# D  q& A2 e
  352.     Mouse.init
    5 A$ @+ C  h% [1 O3 L4 ~7 `
  353.     sion_mouse_run
    6 ~9 y% P. \& e% t
  354.   end
    % e7 V( n) P/ Y5 N# Z7 t8 t
  355.   #--------------------------------------------------------------------------! v& l/ Z+ h9 m0 q
  356.   # ● 切换7 F6 Y. [; ~* k- K. \
  357.   #--------------------------------------------------------------------------
    9 Z7 L$ c/ c* h
  358.   def call(scene_class); v" f) l8 ~( r# x2 y; C: o
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)$ L3 Q( `3 |' q+ G
  360.     sion_mouse_call(scene_class)
    & e+ ?3 t  M2 e
  361.   end( l8 u4 t$ n  H. h# ]
  362.   #--------------------------------------------------------------------------  {9 t' j7 L% J: n4 I, ]3 d/ u
  363.   # ● 返回到上一个场景4 [  t; M, q* y; n  _) }
  364.   #--------------------------------------------------------------------------: w4 G' F7 q! D6 X% _( K
  365.   def return
    . E( j0 O, w+ T8 \
  366.     sion_mouse_return
    * G  T  V/ _6 T6 {9 [# L  P% t
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&
    9 R8 H% K. \2 D, l
  368.       @scene.instance_of(Scene_Map)
      F! e2 x/ I2 @& j
  369.   end
    * N) U. z% ~2 n# O$ X8 l
  370. end
    4 m2 {5 D0 T1 V# d$ o+ w$ B

  371. 2 k' N- j* e. I" T0 U
  372. #==============================================================================% B% E. N/ w0 f1 M
  373. # ■ Module Input
    % s3 l9 i# r) u: l1 x  q
  374. #==============================================================================
    ! N+ }) o) H" W9 ]
  375. class  Input/ V* _2 O. C* @
  376.   #--------------------------------------------------------------------------
    , t1 i4 w8 r. U
  377.   # ● alias
    ( z  b9 }# j# V+ m. U+ r
  378.   #--------------------------------------------------------------------------1 C$ c8 V9 p# E" p* s+ @
  379.   unless self.method_defined(sion_mouse_update)$ T% O2 ]3 E9 c3 C+ Y, d
  380.     alias_method sion_mouse_update,   update
    / g3 N( \' J9 d& i- d- L) J9 u; S
  381.     alias_method sion_mouse_press,   press
    / ^" z, E  z- \2 H- s/ g2 h% M
  382.     alias_method sion_mouse_trigger, trigger
    ! F8 e9 U8 n6 Q$ W- k9 j$ r
  383.     alias_method sion_mouse_repeat,  repeat
    6 N2 A$ f9 h' `/ k$ \2 o6 P  ?
  384.   end& r8 Q/ h* ]' u! x1 i
  385.   #--------------------------------------------------------------------------
    8 ]. ^1 B) E- j  H# k1 U8 u
  386.   # ● 更新鼠标/ N1 x7 F* L* C+ l2 v8 `
  387.   #--------------------------------------------------------------------------
    % S' _; W2 v; N3 i& q
  388.   def update
    1 O' J. x$ }7 {: Y  L
  389.     Mouse.update
    - R% K/ O8 H& I
  390.     sion_mouse_update- j0 w! E. J* B* U
  391.   end5 Q" j! w  R$ S! I& A7 U% A6 A  L
  392.   #--------------------------------------------------------------------------
    8 h& e- a6 _% S, t
  393.   # ● 按键被按下就返回true0 g' ]6 o, `* \8 i; }8 T
  394.   #--------------------------------------------------------------------------' C, y2 }  W, e3 ?* `( i0 L: B
  395.   def press(key), X+ ~& G8 V3 C+ g" V
  396.     return true if sion_mouse_press(key)- S% O& y  ^5 u  C* l
  397.     return Mouse.press(0x01) if key == C
    $ H5 g# S5 g# G  |
  398.     return Mouse.press(0x02) if key == B
    + r. {; N; @0 B" L) U
  399.     return false3 m6 I9 x  Q0 n1 y1 ]" R
  400.   end6 X/ E/ }" q4 {8 D6 ^0 l' j5 N4 p
  401.   #--------------------------------------------------------------------------
    2 z5 x" m9 j6 g3 m
  402.   # ● 按键刚被按下则返回true* o) v% t5 e/ m0 i  c" G
  403.   #--------------------------------------------------------------------------6 g! S" d5 l) w% T
  404.   def trigger(key)
    + ]0 X* v1 i5 K- ~: O
  405.     return true if sion_mouse_trigger(key)
    ! ~1 P4 U# X% }& D4 z
  406.     return Mouse.trigger(0x01) if key == C3 F7 R8 q+ m) H$ E: q$ o+ F
  407.     return Mouse.trigger(0x02) if key == B
    , j9 m+ i# i' q$ o
  408.     return false
    5 n. ]/ ~3 m3 Y0 h1 {
  409.   end6 e4 o* R- t* O) y# X
  410.   #--------------------------------------------------------------------------: @0 j3 A7 \3 x3 M! ]9 E
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true9 o7 E4 a* ]( C
  412.   #--------------------------------------------------------------------------
    9 s, ^4 a5 b/ z: e
  413.   def repeat(key)
    , E+ U1 V0 N( y+ m  t  l/ _! G
  414.     return true if sion_mouse_repeat(key)9 A# s5 L2 A) H- R
  415.     return Mouse.repeat(0x01) if key == C
    * |5 y7 V1 g# y, Y7 Y* @
  416.     return Mouse.repeat(0x02) if key == B
    ! D! O; C8 A  t8 c; o  l
  417.     return false
    : T* {  K9 Y( u4 x
  418.   end- E" d# q. v  v( u8 H6 {
  419. end, U- \3 G, l# P

  420. $ W& `0 [. {  w
  421. ) n3 `7 S& d  J
  422. #==============================================================================1 k! U' H" m2 y  w
  423. # ■ Window_Selectable
    0 w- k! T3 U8 P" F
  424. #------------------------------------------------------------------------------! e1 H5 `- C* T4 B: o! X7 x' y
  425. #  拥有光标移动、滚动功能的窗口( C/ q2 V! C) W% H# @
  426. #==============================================================================& g( m1 k- [. W" q
  427. class Window_Selectable
    : v# `1 a$ A( w" W* m" U
  428.   #--------------------------------------------------------------------------/ b: K% ]6 B5 r
  429.   # ● 初始化5 Q. ?' O- R: z/ P' I
  430.   #--------------------------------------------------------------------------' ~7 D4 L/ v  f0 K$ _+ W& h
  431.   alias sion_mouse_initialize initialize
    5 L- `, L, O! n& j$ Y
  432.   def initialize(x, y, width, height)
    : l7 C$ u' d' G9 T& N8 r& n1 Y  Q
  433.     sion_mouse_initialize(x, y, width, height)+ @, V3 q4 Z  |$ I" c
  434.     @move_state = 0
    7 D: x9 z$ E: M' ~" w% d
  435.   end) X# {; g. f. S8 F2 w* m; ]
  436.   #--------------------------------------------------------------------------+ l- [7 o: [% ^; Z
  437.   # ● 更新4 N* {9 [- `" S
  438.   #--------------------------------------------------------------------------2 g1 D  E' b7 P1 C2 f- Z8 i/ I
  439.   alias sion_mouse_update update' }! E% V# u+ s* F3 @0 F: V
  440.   def update
    9 s! p  Y$ n* k  @$ W: P
  441.     sion_mouse_update7 S" e* n2 b6 y7 G+ ~6 E0 Z8 \
  442.     update_mouse_cursor# M! G. u6 ]7 |$ v6 `* s5 {: F& A1 D
  443.   end) l3 O1 t8 h+ ?7 W+ H: B
  444.   #--------------------------------------------------------------------------
    + L7 i: u" o) m) u$ X: w" G% [- Z6 c2 Y; P
  445.   # ● 启动后设置鼠标到index位置4 q5 m. C! q: p4 _" ]
  446.   #--------------------------------------------------------------------------
    ' K* Y9 J: g. v8 f6 v9 q) x
  447.   def activate" c: c3 v$ r* B
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    ' i# y* X) h0 G, h
  449.     super: e' @* l/ A' H
  450.   end
    , t  D  W$ O* y# O
  451.   #--------------------------------------------------------------------------4 T( k5 `) u5 ^% N; I* J
  452.   # ● 更新鼠标和光标的位置$ t$ X- ], J2 s" \) a9 `. M
  453.   #--------------------------------------------------------------------------
    ! d3 K/ z# z8 C5 a
  454.   def update_mouse_cursor6 n0 F% ~( R0 K/ a6 O8 u
  455.     if active
    + Z: s( c! b2 O! e! D' k1 u
  456.       if @need_set_pos
    2 z3 W# W" M" V+ [' ]" E4 C6 Y
  457.         @need_set_pos = nil
    3 z6 H3 ]5 c8 W, D2 Z" M0 q* t
  458.         set_mouse_pos" U' U0 r$ r  j# M) V, H
  459.       elsif cursor_movable& H% Z3 W( V% G0 n4 P: M# a
  460.         Input.dir4.zero  set_cursor  set_mouse_pos
    - v4 Z, s- s* |! H) c4 E8 L+ d
  461.       end) s! W8 ?" y  Y/ Y3 T' B# @! e; W( F
  462.     end; k7 ~8 @7 |0 @6 I, ~. h8 h
  463.   end
    7 D4 m) [* o/ D+ {7 y$ w" e8 b
  464.   #--------------------------------------------------------------------------6 Q! |5 p/ M4 h) a4 p
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能
    4 e# z: {2 t+ p* q/ v; ?
  466.   #--------------------------------------------------------------------------7 g9 k% Z+ u3 y0 ^3 f' ]3 o$ u
  467.   def set_cursor
    / W) ~) R# w" E2 Z( \
  468.     mouse_row, mouse_col = mouse_window_area
    9 ?( X5 z. q. J/ R
  469.     if    mouse_row == -1
    / I4 ~, W- A, A! M' g1 j1 v; K" X- o
  470.       @move_state += 1 if need_scroll! z2 z9 ?. S, P- O
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand
    , |1 G1 E4 X8 h% E
  472.     elsif mouse_row == -28 Y$ V- M: `& b& }
  473.       @move_state += 1 if need_scroll. D6 H. ?  b! ?* U( r, s; _# i( C
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    1 a" j1 w/ [9 X# @
  475.     elsif mouse_col == -1
    # S6 z% {! K' C3 k4 N5 b" j) f
  476.       @move_state += 1 if need_scroll
    2 m! f6 L: V! a# L
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    ; o1 ~# y# g0 z) b8 i
  478.     elsif mouse_col == -2) b/ [/ b/ \6 V  q+ Y- ?
  479.       @move_state += 1 if need_scroll8 Q. ~8 i. A* D, i, p
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
    . _6 P8 P: b+ s1 R1 T8 Q5 {+ W
  481.     else
    ! Z* _+ U6 G3 e5 w- E2 F# m7 q9 [
  482.       @move_state = 01 D' x3 J; Z: z0 b" U
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col; ^) m! N* N' O) T7 c+ B
  484.       select(new_index) if new_index  item_max && new_index != @index, Y1 [; U8 k+ g7 x& {
  485.     end: E! ?) D' {& E# K, b
  486.   end* D, X. c0 M) \1 v
  487.   #--------------------------------------------------------------------------
    . X1 T( l, |5 H9 n* W3 Y( k1 i
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    ( L9 ~( c1 n; w, r5 A
  489.   #--------------------------------------------------------------------------
    : P# l6 E( f, M9 O9 w! ?# F
  490.   def mouse_window_area- i' H8 s. A" s7 }( P1 ?0 _
  491.     if viewport.nil # necessary!/ Q* ?3 |  f: k; P/ h
  492.       vp_x, vp_y = 0, 09 Z. R; o$ }1 ]* \7 ~8 |5 ]6 [7 r
  493.     else9 d$ @2 h' y: Y3 Y8 M
  494.       vp_x = viewport.rect.x - viewport.ox
    - L/ C/ R0 R' m+ h) Q. v! _6 s
  495.       vp_y = viewport.rect.y - viewport.oy7 u5 X2 B, k0 C" r5 k& v) @
  496.     end
    , z3 t9 ]' L! Z) S( u
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    $ D0 V, E+ g: k4 y% B% g  Y
  498.     item_x1 = vp_x + x + standard_padding 1 g- s& k5 @; ]7 S4 W
  499.     item_y1 = vp_y + y + standard_padding
    ' y6 A6 k$ [1 \* e- g5 ^
  500.     item_x2 = vp_x + x - standard_padding + width5 r+ m. c/ F4 i  m+ w; F! s5 R
  501.     item_y2 = vp_y + y - standard_padding + height8 Y) _1 z* m7 W) N6 N" n
  502.     if mouse_x  item_x1
    ! D0 u5 ?% V* o, S/ ]- k4 E) X
  503.       mouse_col = -18 T0 I6 I0 M: C- m3 ^5 d
  504.     elsif mouse_x  item_x2
    $ K9 g5 X0 `/ a
  505.       mouse_col = -28 o( z1 ^# \/ W4 t" E& E7 j: f# z
  506.     else5 B# w9 H! S, @4 U  i5 _
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)4 X! L. j7 z5 ?& S/ C
  508.     end
    * P& J; t0 V; ^6 b$ T
  509.     if mouse_y  item_y1
    # x' d) K) V% }9 E
  510.       mouse_row = -1
    3 J" Q- b8 ^$ }6 a
  511.     elsif mouse_y  item_y27 M; v( u$ m1 Q% y
  512.       mouse_row = -2
    : X( J8 D% [! }# v/ n4 E
  513.     else
    . s* ?7 v' }5 t. l
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    ; ?5 f' E% H) t6 Y3 \
  515.     end$ Y: S' P4 x+ z. H/ ~, D8 a7 A
  516.     return mouse_row, mouse_col
    . g9 }/ L* k. k
  517.   end2 ^% ^8 h3 h; R
  518.   #--------------------------------------------------------------------------
    - v+ y3 I) U+ X% ~% \8 w
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置0 B6 y+ K7 s6 D; G+ x- p0 v
  520.   #--------------------------------------------------------------------------
    ) [8 ]  C5 i1 ]* r( P
  521.   def set_mouse_pos
    + L+ h0 V) k6 Q7 U
  522.     if viewport.nil # necessary!2 [# U' S2 Q" D- D5 T$ Q
  523.       vp_x, vp_y = 0, 0. r0 m2 O0 @7 a+ W+ [
  524.     else3 ~1 M5 p6 l" v  h
  525.       vp_x = viewport.rect.x - viewport.ox
    : J6 L' N$ O+ Y, r2 e3 T% p
  526.       vp_y = viewport.rect.y - viewport.oy. B6 E2 a$ k  w8 X/ d$ o* i$ G
  527.     end
    " V7 ?3 H% x5 l; w9 ^
  528.     item_x1 = vp_x + x + standard_padding
    1 d- X# G% I5 f- c0 I
  529.     item_y1 = vp_y + y + standard_padding
    8 U8 v4 V4 ?: e0 A" @( r4 O& S
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
    + D2 t6 g# A! f; ?6 S
  531.     row = get_index  col_max - top_row
    + I+ n. o+ `5 p% I3 G
  532.     col = get_index % col_max. f8 d# p$ q1 J' Z. U/ W
  533.     new_x = item_x1 + item_width  (col + 0.5)$ o: l- H0 g( ^
  534.     new_y = item_y1 + item_height  (row + 0.5)
    - h; n) i3 b' d7 z2 Z
  535.     Mouse.set_mouse_pos(new_x, new_y)% d, Z7 q6 b  h6 s. _( f! K
  536.   end$ i" r- p1 _8 j$ C
  537.   #--------------------------------------------------------------------------4 e( F! x2 ~+ c
  538.   # ● 判断菜单是否需要卷动5 J0 x/ z3 ?9 A# x/ m
  539.   #--------------------------------------------------------------------------$ A' U3 ^0 S& a% o" {' N& P
  540.   def need_scroll% q' s# y5 }( ~- ^; p. J* V
  541.     item_max  col_max  page_row_max' ]& r/ O( F  d! ]8 \
  542.   end
    2 f* |8 ?7 W( ]
  543.   #--------------------------------------------------------------------------
    & g8 y, G1 N. o/ Q' V4 c
  544.   # ● 判断是否为水平卷动菜单. J8 Z6 [  }" ]# [% Q# R6 E
  545.   #--------------------------------------------------------------------------: m$ x6 R, c2 }( r0 s- j3 ~
  546.   def is_horzcommand: w. U4 C( @$ V/ f7 C
  547.     return false
    5 r6 z* x7 b( M" l; T5 Z3 a+ r
  548.   end% c: t# b. _. N% f
  549. end' q2 c4 \% D* u( t0 B$ m

  550.   ]5 q$ G. Q$ u) k9 ^, W5 F
  551. class Window_HorzCommand# J* N& y: Q; o: O9 D
  552.   #--------------------------------------------------------------------------( y( s, r+ T/ ~
  553.   # ● 判断是否为水平卷动菜单4 ^" H; j: @0 M$ o1 q
  554.   #--------------------------------------------------------------------------2 A" e  I3 h0 j3 G5 \  @
  555.   def is_horzcommand2 K& Q; G8 o3 p# G8 O4 t
  556.     return true
    # e( u: A5 C0 |0 d# X* k9 r
  557.   end
    " Z7 a0 O/ h9 H0 g; q0 o
  558. end" F5 z. n- \0 w8 F  y
  559. # D* N' m8 s; B3 X& ?! B3 G' Z5 e3 b
  560. #==============================================================================
    ( m6 [' O+ @; o$ Y. m
  561. # ■ Window_NameInput/ m; \/ L  C6 m9 p4 Q8 z
  562. #------------------------------------------------------------------------------( }: F$ e& j2 _' k& ~
  563. #  名字输入画面中,选择文字的窗口。  t$ |/ D& u2 Z' b' w! O& `' g
  564. #==============================================================================
    - B4 S! ?+ O" e1 t) k
  565. class Window_NameInput
    / h% t- j5 |% S7 k# x: t
  566.   #--------------------------------------------------------------------------$ r/ r4 M8 p& f
  567.   # ● 设置列数+ Y3 A: I' _9 l% M0 K+ s
  568.   #--------------------------------------------------------------------------% z& y; ]- w) d3 X- Y6 d
  569.   def col_max
    6 l. a% i$ W0 W( E; O/ t' s2 W
  570.     return 105 R+ n# W5 n6 Q8 ?7 V
  571.   end
    1 U" w2 f! Q) D) d' W: ?
  572.   #--------------------------------------------------------------------------
    ! @0 n, A* `' C- n' P
  573.   # ● 设置填充的Item个数
    5 X& M- R/ K2 k( j( H# O
  574.   #--------------------------------------------------------------------------
    ( C* _+ R! m! F9 G  C% Q+ [
  575.   def item_max- Q' u3 F- y8 U) t# [4 r
  576.     return 90
    0 j2 i; C1 U0 [$ T. g4 @8 N; j  R
  577.   end
    : _4 d/ \; H7 C2 I* d0 P0 o
  578.   #--------------------------------------------------------------------------/ ~5 f; d' |5 Y# O( m: W
  579.   # ● 设置填充的Item个数* }! I( A" L% r) E% c6 h
  580.   #--------------------------------------------------------------------------9 @& Y; h. n. p) C6 B
  581.   def item_width( a$ I7 S- O' N8 w% v
  582.     return 32
    2 o) t& ^# G; d- v
  583.   end5 i& U% F9 F: [! M0 a5 E' d' R
  584.   #--------------------------------------------------------------------------
    ( A) s6 h0 c" l9 x8 t
  585.   # ● 判断鼠标位于菜单的第几行、第几列, j" c" P7 O% W: x% ^; {8 w
  586.   #--------------------------------------------------------------------------) B9 Z" j. ~) t# J6 n
  587.   def mouse_window_area
    : |* L# U) }9 j3 D# R5 t
  588.     if viewport.nil
    2 x; b, o7 `1 P7 |; N7 D/ M
  589.       vp_x, vp_y = 0, 05 q5 n0 D7 X7 N1 t8 \5 ~& w
  590.     else
    , f' l* Z" U) H% F9 b
  591.       vp_x = viewport.rect.x - viewport.ox
    4 F: V3 h) s3 M- ?! B9 C3 N  D$ _
  592.       vp_y = viewport.rect.y - viewport.oy. N+ L; V4 d. K' D3 g
  593.     end0 g: D: L) U5 P; k5 k. U
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    6 c9 ]9 o7 z- M" S; h
  595.     item_x1 = vp_x + x + standard_padding   E; _; E- l3 F3 h8 I
  596.     item_y1 = vp_y + y + standard_padding% E2 I& e& c( g! C/ n2 m! |: s
  597.     item_x2 = vp_x + x - standard_padding + width# n" v( F( T/ q6 U8 q! s
  598.     item_y2 = vp_y + y - standard_padding + height8 Y, g0 N+ Z+ P1 I9 j( e
  599.     if mouse_x  item_x1
    6 @% O- h. `) F: ^
  600.       mouse_col = -1
    2 Z9 H6 {7 t! q+ m
  601.     elsif mouse_x  item_x2& _4 V: L3 F  Z) F5 h- D2 C
  602.       mouse_col = -2
    1 u9 z4 E! n) I6 ~( h$ \$ x
  603.     elsif mouse_x  item_x1 + 1607 d( j7 F% C( M7 q2 L  y8 H5 j' G
  604.       mouse_col = (mouse_x - item_x1)32  @' i- c( Q) X6 M+ t# s% A
  605.     elsif mouse_x  item_x2 - 1604 ]# x) |9 ]2 Z
  606.       mouse_col = 9 - (item_x2 - mouse_x)32
    + E0 J& s4 Y/ v6 h0 Q. `/ }
  607.     else
    / z& m! G1 H2 v; v, v$ @" h
  608.       mouse_col = mouse_x  x + width2  5  4
    + d7 k9 o, t6 z/ f& R
  609.     end8 `# N0 E6 n2 J5 m" l
  610.     if mouse_y  item_y1
    7 a' e! a! k( ^* C: b' G
  611.       mouse_row = -1
    * h. u8 K$ V# C- W" j% E
  612.     elsif mouse_y  item_y2+ F1 \: \* k- y4 A) ~7 Y
  613.       mouse_row = -2
    3 N$ U3 i0 G/ u/ k0 \# B
  614.     else
    . T* j1 F/ I9 `9 L( }
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)
    ; r# E) C$ N: C6 C/ X
  616.     end
    ( }4 k' `2 _$ _2 e( o9 k
  617.     return mouse_row, mouse_col7 B1 O: ~8 u1 q1 Y( ]% c  w
  618.   end
    , _! E+ @6 m$ s( D0 o3 u  j" g
  619.   #--------------------------------------------------------------------------7 S4 L  @% ?4 F4 c( f" g7 K9 s
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置( j/ C0 R/ [& W6 I
  621.   #--------------------------------------------------------------------------9 w! o: p: y. A. ^; X
  622.   def set_mouse_pos
    $ x* U" R+ Y& H' X& V3 P8 B  Y
  623.     if viewport.nil # necessary!" d7 Q. K- {! r3 |7 ^. v# u
  624.       vp_x, vp_y = 0, 0  ?# [; p7 @5 q9 e
  625.     else% G: ~( a2 e% d, @( i1 N# ?
  626.       vp_x = viewport.rect.x - viewport.ox2 z; m+ ?; ~8 R$ U# @
  627.       vp_y = viewport.rect.y - viewport.oy
      F# P+ l6 J8 ?. r* A8 W
  628.     end1 W, Y; @+ c8 `
  629.     item_x1 = vp_x + x + standard_padding
    " S. k5 ~. [1 C0 C0 {6 u, D! u( B
  630.     item_y1 = vp_y + y + standard_padding
    ( O' A9 C( M4 v! k% x
  631.     get_index = @index  0  0  @index
    * t4 G' |( w. P
  632.     row = get_index  col_max - top_row
    5 I" B. N6 t9 s  i/ d
  633.     col = get_index % col_max: S8 [9 Z0 K9 t. a0 z
  634.     new_x = item_x1 + item_width  (col + 0.5)
    " y( I5 y, J# a+ i7 G5 w
  635.     new_y = item_y1 + item_height  (row + 0.5)
    2 r5 W# c. S1 V+ x4 \0 J: e8 n
  636.     new_x += 14 if col  4
    & N6 J- U' v2 k
  637.     Mouse.set_mouse_pos(new_x, new_y)
    5 G8 F' G6 e3 p+ B' d7 T2 _
  638.   end
    + t" i( O3 W+ d  k
  639. end7 P0 g4 u9 Y1 d/ e) T/ b' O

  640. ( `8 s. G8 l# j/ i8 x
  641. #==============================================================================
    , i7 B- Y" v; V
  642. # ■ Window_NumberInput
    ! \; i% S9 g4 i6 G& Y* ]
  643. #------------------------------------------------------------------------------0 g* A! \& X2 u+ S4 U8 P) @
  644. #  重写了数值输入的方法以适应鼠标7 y) a& h+ Q/ E/ z0 K2 Q& F
  645. #==============================================================================0 c$ \/ v  k* p& W. c# }% s
  646. class Window_NumberInput  Window_Base) R6 [: I. Z1 S7 _- W9 W# x
  647.   #--------------------------------------------------------------------------( z8 R7 {+ ]8 U2 J* }* T. F1 x8 S, C" C
  648.   # ● 定义实例变量
    - i8 s5 r! X/ I( x/ P3 [1 f3 L
  649.   #--------------------------------------------------------------------------
    5 H" ?4 _$ M3 R6 [3 H; F! t
  650.   attr_reader extra_window
    6 y9 y& X0 V3 n
  651.   #--------------------------------------------------------------------------
    " |# H2 ^  j4 k# P, r
  652.   # ● 初始化
    % X% E& Y/ m/ F7 f' @( C+ H- B6 R
  653.   #--------------------------------------------------------------------------7 D, _' B' U8 |9 D6 t. R+ U
  654.   alias sion_mouse_initialize initialize1 N# f$ S/ b" s3 Q! z9 {9 B7 v
  655.   def initialize(arg)# o8 U9 k  J8 \- c8 e: K6 i7 B
  656.     sion_mouse_initialize(arg)/ J0 Z0 l) k) q" j$ `1 O
  657.     create_extra_window
    2 k; K# r" K3 x4 t9 X/ q
  658.   end
    # v, o, t6 V. o' n0 S5 i
  659.   #--------------------------------------------------------------------------
    0 ?$ p0 z, V7 k6 b# A
  660.   # ● 启动
    8 T+ u8 {' z1 Q8 d$ T9 k$ T
  661.   #--------------------------------------------------------------------------4 H7 J% ]5 a) Q+ D* x# D' q4 @6 t
  662.   alias sion_mouse_start start
    , g* S' ~0 J' n5 \9 }
  663.   def start
    - h7 x4 j$ P# }: Y9 k( m
  664.     sion_mouse_start
    6 A9 X$ u3 Z/ a. |
  665.     deactivate
    , S3 x6 \0 y- P' y. v! |8 Y
  666.     extra_start
    3 M4 c3 v$ M- U
  667.   end9 `0 c" V$ v6 M- |  s6 t
  668.   #--------------------------------------------------------------------------
      G0 p0 I1 i4 c2 G
  669.   # ● 创建新的数值输入窗口
    5 Y$ u8 k9 F" R3 U& a( D
  670.   #--------------------------------------------------------------------------7 \/ a' S7 a3 [
  671.   def create_extra_window
    / _! g" L8 \; E- Y
  672.     @extra_window = Window_NumberInput_Ex.new% a; U! P" _3 P, @9 m$ T
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2
    3 D+ V& W7 V9 N' T3 ~
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }$ q. p* b8 T- l9 V" @- {
  675.     @extra_window.index_proc   = Proc.new {n @index = n }
    + g, P9 W- X( ~+ V
  676.     @extra_window.close_proc   = Proc.new { close }
    + W$ P5 m1 _; r4 ?  Y8 d$ I, S
  677.     @extra_window.refresh_proc = Proc.new { refresh }5 l* v, T8 {6 f5 [( O
  678.   end
    * J5 N. T% B0 n# G2 V5 J$ J1 F& r
  679.   #--------------------------------------------------------------------------0 p" V* V. u# H. P9 A. x$ }
  680.   # ● 激活新窗口
    : {. P8 K/ [3 c( f8 O  v5 s
  681.   #--------------------------------------------------------------------------/ c( ?5 o' e3 t! j6 U3 J  H
  682.   def extra_start
    6 v6 `9 e& B8 a
  683.     case $game_message.position
    ; b& o2 z6 I( M3 N" b+ p' M
  684.       when 0; @extra_window.y = y + height + 4
    % Y5 T# m$ N% z
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8' h& d: X& D- l; e3 l2 F
  686.       when 2; @extra_window.y = y - @extra_window.height - 4
    , S; c. P3 f' Y; ~; w' ^9 D2 {
  687.       else  ; @extra_window.y = 8  s0 z  ~+ i% p
  688.     end
    * _$ x" w* d$ a$ u. b: r
  689.     @extra_window.variable_id = $game_message.num_input_variable_id( m" S' O$ \( B, a1 y, ?! X0 [
  690.     @extra_window.digits_max  = @digits_max
    ' s, P( v. }: @/ E+ Z4 }
  691.     @extra_window.number      = @number1 h$ O4 C6 [; v
  692.     @extra_window.open
    4 B3 E8 \' D5 g5 `
  693.     @extra_window.activate0 N6 n1 x! h3 O' p
  694.   end( R% F+ P& E5 ]" ~1 \
  695.   #--------------------------------------------------------------------------
    ' `$ m* y3 |. P# b6 f6 _
  696.   # ● 更新, G$ k  ?7 ]/ [! s) t% |
  697.   #--------------------------------------------------------------------------, M' s6 {# {, }
  698.   def update
    0 _$ {) R: v% }
  699.     super9 O1 G# i- ]( g8 v
  700.     @extra_window.update
    $ K" ^, a! s! b! E5 q
  701.     update_cursor# h; o5 e/ @+ n2 W7 B$ ]7 i
  702.   end
    / H1 N$ y1 w+ ~& F3 t
  703.   #--------------------------------------------------------------------------
    ! h, @3 N# a  d7 \5 O
  704.   # ● 关闭窗口
    - ^4 u3 H/ c( L# M# n8 H
  705.   #--------------------------------------------------------------------------
    - `6 @3 ?0 H# f" z: W' l) t
  706.   def close0 N( ^2 q1 m) Z% d0 P4 i% H( u6 A& j
  707.     super
    1 i- @/ l1 e2 H% B( m
  708.     @extra_window.close8 e. a& s  }$ V. M) t4 v
  709.     @extra_window.deactivate+ [/ Z# r% @/ w& g  D) k
  710.   end
    4 A: C# u1 m- \/ _8 u  {. q7 ~
  711. end: w7 ]8 [, S0 W

  712. $ d1 @  h4 c0 _6 V  h# c) X
  713. #==============================================================================2 J3 T" O; F2 \' \5 s
  714. # ■ Window_NumberInput_Ex
      d5 B! P! A3 ^- K4 f% o" J" Y
  715. #------------------------------------------------------------------------------/ X3 D& C7 b  _/ X& A
  716. #  新的数值输入窗口(NewClass): P, {/ o5 @5 J
  717. #==============================================================================
    ; R: P4 x( e, R% n, V
  718. class Window_NumberInput_Ex  Window_Selectable
    8 R  X9 \8 q0 ~" f: z6 A* a
  719.   #--------------------------------------------------------------------------
    5 |' m5 p# b; _) K
  720.   # ● 定义实例变量
    4 @+ \7 L! T# t0 ]& p+ b, x
  721.   #--------------------------------------------------------------------------
    + d; \% R! o9 a  [' J6 S9 E0 f( Q
  722.   attr_accessor number_proc& B6 E( G. }. I0 j0 u4 P
  723.   attr_accessor index_proc
    ) Z! C2 B; `4 s" [+ z5 a7 ^2 |
  724.   attr_accessor close_proc' \" r/ k1 t' S; x8 y+ K
  725.   attr_accessor refresh_proc$ q( U5 B0 z) L
  726.   attr_accessor number
    ) b. N- A' L+ i3 J% R" K
  727.   attr_accessor digits_max
    ; t7 Z$ R! s& H8 Z) @
  728.   attr_accessor variable_id8 e) z2 A( Z0 u. \) ~
  729.   #--------------------------------------------------------------------------4 ]% [+ n" L$ [8 L+ ?/ z
  730.   # ● 数字表! [- \2 Z' x  p9 |& n3 i& R
  731.   #--------------------------------------------------------------------------$ c% b2 l1 I5 {4 A* u$ F
  732.   TABLE = [  7,  8,  9,! ]( _4 r( q  m9 A5 Z
  733.              4,  5,  6,
    7 _& b/ a5 c, A7 ?) W
  734.              1,  2,  3,
    3 [* M2 A0 S* }, T8 `  x3 ^
  735.             '←',0,'确定',]
    * j% E) P7 s; U) |0 S9 C: g$ X
  736.   #--------------------------------------------------------------------------
    4 Y6 u! \6 r  m/ Q* n
  737.   # ● 初始化对象$ a% E- }7 t1 B" y
  738.   #--------------------------------------------------------------------------% V+ D( R5 [1 y
  739.   def initialize
    / z4 _. V. [1 d) Q
  740.     super(0, 0, 120, fitting_height(4))0 m; `8 Z' l* X2 _& r5 B
  741.     self.openness = 0
    ) j$ A  F0 O9 K1 ~$ _$ [& Z! E
  742.     @index = 0
    4 Z9 X' M/ `' S& [
  743.     @number = 0
    7 S' }! p' s2 \" X' n% a
  744.     @old_window_index = 0, D' i& \" L# P) ^2 o
  745.     @digits_max = 0
    ( j) @9 u  M; l. ~
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }9 m5 F+ p5 Q$ L* u
  747.   end. Z. R  [  Z; j' `: ~
  748.   #--------------------------------------------------------------------------  B# h4 g% ?5 {6 [- m9 m% u
  749.   # ● 获取项目的绘制矩形
    , B6 o; h) q0 |+ h- K
  750.   #--------------------------------------------------------------------------) G* ?; [" M, ?2 F" l. _1 p) L
  751.   def item_rect(index)
    6 _3 E# }1 t. c9 [8 g: h& K
  752.     rect = Rect.new
    / o& X9 D2 e; a
  753.     rect.x = index % 3  32; v- I7 A$ h# K8 l
  754.     rect.y = index  3  line_height
    / C+ K9 F5 s( ^% ~' N. T# z
  755.     rect.width = 32
    4 r5 A/ Y9 U! W# }' |6 J* U) @
  756.     rect.height = line_height
    + r- J& S5 x4 H1 W0 }, L4 c) s
  757.     return rect4 L- U. b. X0 S% M: q
  758.   end
    3 D# H6 _$ m! A) a$ K
  759.   #--------------------------------------------------------------------------
    6 j! [- @6 J* K. Z' ?
  760.   # ● 将光标设置到鼠标所在的位置- K9 |; o6 E. V9 b- r; g( Q
  761.   #--------------------------------------------------------------------------5 l$ N6 T( |9 U
  762.   def set_cursor2 ?5 {, u5 [# ^
  763.     mouse_row, mouse_col = mouse_window_area/ r; Y3 ^& h$ K  W9 L
  764.     if mouse_row = 0 && mouse_col = 06 V5 V8 k+ W( Y
  765.       new_index = mouse_row  3 + mouse_col4 v3 F+ J+ h; r$ x- {
  766.       select(new_index) if new_index = 11
    # b* K0 X( `0 ]$ r' S
  767.     end) I2 q$ s# f5 `
  768.   end9 x  E# [& ~8 o' O6 T1 i+ ], m1 E
  769.   #--------------------------------------------------------------------------7 n' a( o3 L" J% ~
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列3 g" b* V( E! M/ [  a; A1 `
  771.   #--------------------------------------------------------------------------, w' L3 `+ v$ n8 [
  772.   def mouse_window_area1 s( A+ R. y" ?$ x5 G
  773.     if viewport.nil
    ' m. G: ~0 |6 I" x, D3 q
  774.       vp_x, vp_y = 0, 0
    / J# a: Y# G+ W. v. y
  775.     else& x1 f+ D1 H5 r% c8 K+ o& U, d
  776.       vp_x = viewport.rect.x - viewport.ox% m  F' X$ H: ?! M
  777.       vp_y = viewport.rect.y - viewport.oy+ z; Y. C; e4 _. D
  778.     end9 t# t2 f; _. c: ^5 b+ i
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y' B1 n- U0 f( u( W9 C: o/ r$ Q5 D
  780.     item_x1 = vp_x + x + standard_padding
      s9 A- I" F, X8 U5 S# _$ r
  781.     item_y1 = vp_y + y + standard_padding6 X! N; Y' A4 v$ }  Q2 w) T
  782.     item_x2 = vp_x + x - standard_padding + width$ {& o6 N* Z2 [- a
  783.     item_y2 = vp_y + y - standard_padding + height
    2 {  V; I" q8 `* o% a
  784.     if mouse_x  item_x1. Y6 l" a: z& Y) R& t. {
  785.       mouse_col = -1
    # b8 Y( A* c) @$ V- P' ^  h4 @, c
  786.     elsif mouse_x  item_x2/ c; ]8 {  ~1 k( ~7 S1 _
  787.       mouse_col = -2  S1 Q% V) V6 S: S
  788.     else0 ?3 E! V$ E, k  s- a- R' `
  789.       mouse_col = (mouse_x - item_x1)  32
    $ L4 ~/ e9 d8 W( _4 e0 X# |
  790.     end/ o. a1 S+ X2 t% E* o2 b; s
  791.     if mouse_y  item_y1
    ( J* P5 }5 j9 x* c9 n
  792.       mouse_row = -1
    * y" D/ J" d1 a
  793.     elsif mouse_y  item_y2
    , q4 R' h: X( D$ k" Q
  794.       mouse_row = -29 X9 e9 o, A/ Z) a; v# T
  795.     else% w$ n5 b6 f3 m' t' w: d8 y7 k$ n- n; [
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)9 e& }9 F3 Y9 _6 @4 q5 z& }; h
  797.     end2 V. v# ?) u+ A+ D& i% |' S
  798.     return mouse_row, mouse_col
    9 \4 K6 `0 p/ {# j" K
  799.   end3 E( o* m# U* f; Y$ f
  800.   #--------------------------------------------------------------------------
    0 y* g1 f7 |) i: e( D' h! F
  801.   # ● 获取文字4 C2 F4 Q" I% i; S
  802.   #--------------------------------------------------------------------------& t  ?; z  b( z& W, J
  803.   def get_number
    5 f# M4 _7 |$ k$ c( V& e" H$ Y
  804.     return false if @index == 9  @index == 11$ r3 T2 `' @/ f/ ^" h
  805.     return TABLE[@index]
    , ^7 ]- }+ j6 n9 c
  806.   end
    5 W& f3 ]: A/ A- K1 [# Q
  807.   #--------------------------------------------------------------------------
    % m6 ^, D- J$ E
  808.   # ● 判定光标位置是否在“退格”上* k* k; i0 S2 g
  809.   #--------------------------------------------------------------------------" L) G1 m1 `/ Q6 P( z' v
  810.   def is_delete
    & d& H6 ?6 ~3 d; s
  811.     @index == 9
    ! M& {5 F/ z* m" T5 Z1 v. A9 t
  812.   end8 A+ J- j3 w! G8 Q0 S
  813.   #--------------------------------------------------------------------------
    , W3 H6 Z; ?' b0 j
  814.   # ● 判定光标位置是否在“确定”上& O, q0 L0 S4 e: b- d7 H- \
  815.   #--------------------------------------------------------------------------
    & h* C# t3 l' E' P% T- U
  816.   def is_ok) s' ?$ D  q9 G9 S/ X( `# _
  817.     @index == 11# T" u8 t: r9 B; H* K0 e
  818.   end- t0 ]+ ^7 E4 |  Z* d: U( S
  819.   #--------------------------------------------------------------------------
    # |+ \* u0 e- I5 M
  820.   # ● 更新光标
    ; f. d" H# A+ d0 ~+ K
  821.   #--------------------------------------------------------------------------
    9 }4 s1 Y# Y; ~. l+ K
  822.   def update_cursor
    $ ~" n5 a- H# f/ e" A7 ^* G
  823.     cursor_rect.set(item_rect(@index))
    : b) y- m4 O4 e* d
  824.   end
    ) K0 c" h# A, h0 P# }( A* ]
  825.   #--------------------------------------------------------------------------
    : U6 C  e8 L& [: c( O. A
  826.   # ● 判定光标是否可以移动* G; P) X1 P* w5 a
  827.   #--------------------------------------------------------------------------$ w- T* {, f; i  |5 ~
  828.   def cursor_movable
    # g  t1 ?/ |8 v2 Z
  829.     active
    ; u% K. V8 ?! [
  830.   end/ `7 i" G/ W7 Q
  831.   #--------------------------------------------------------------------------6 k# H+ j% b1 j( I  |
  832.   # ● 光标向下移动
    % N! ~' s) v% ?# e
  833.   #     wrap  允许循环9 B0 `& P# q' p# Y
  834.   #--------------------------------------------------------------------------' |. M9 L. y& K* Q, O* {' m
  835.   def cursor_down(wrap), ]) j4 {: [! I  l! O4 E
  836.     if @index  9 or wrap! G& ?. \" p! X) @6 n
  837.       @index = (index + 3) % 12" {) y5 K6 r* X/ ~3 N
  838.     end
    - N7 X' W1 v% z5 ]) \
  839.   end1 X, ?  A3 O5 D
  840.   #--------------------------------------------------------------------------# t) F0 N( j+ G: L2 o* j0 Q
  841.   # ● 光标向上移动) J) K+ Z3 e& t7 }% n
  842.   #     wrap  允许循环
    ; M" O# [/ U1 Z8 [3 V
  843.   #--------------------------------------------------------------------------
    + i- s, @' h; A1 s5 M) L. z
  844.   def cursor_up(wrap)
    - [' Z8 X2 |" ?
  845.     if @index = 3 or wrap
    2 H7 {" y' c2 p
  846.       @index = (index + 9) % 12/ i8 z+ J7 Q3 A2 l9 r: g& a: k* [
  847.     end
    / C& N7 `; L# x2 h
  848.   end0 x7 G7 o* K( x
  849.   #--------------------------------------------------------------------------: P5 ?$ w6 E# i# O/ Q& ~6 B
  850.   # ● 光标向右移动
    $ y( H6 p5 M& B. A! r3 d7 W- A
  851.   #     wrap  允许循环5 h9 j( Z0 h; G( A% j  D$ T) ~* S
  852.   #--------------------------------------------------------------------------
    , o& {  W8 `( |/ I2 t
  853.   def cursor_right(wrap)
    - ]9 ?  c7 c1 _' a9 u" K
  854.     if @index % 3  2
    ! h( u: F3 X) U
  855.       @index += 1
    ( M+ q' {( B! ]% S
  856.     elsif wrap- U' R/ h1 s( ?: j3 @5 J
  857.       @index -= 24 M4 N# t) M7 Z  r6 V% b1 x) R; @
  858.     end  B: E  M& j9 V' ^- h
  859.   end
    / ?5 A- r' ~+ ?/ s- z
  860.   #--------------------------------------------------------------------------6 K( f5 Z; Y& y/ _, V0 Y
  861.   # ● 光标向左移动
    8 w1 {# R# x; O0 f
  862.   #     wrap  允许循环1 L% V+ M. f+ V% }( k1 P1 r
  863.   #--------------------------------------------------------------------------& K3 t' }9 a& v$ R- i6 {. o
  864.   def cursor_left(wrap)
    ; D2 i: S5 v. l. @' y
  865.     if @index % 3  0
    # {/ C$ j% B0 z/ d6 X! I
  866.       @index -= 1- h! J0 q# |) i! y4 D* X; v2 p7 u
  867.     elsif wrap
    ; H7 N$ [% g, J# w- N
  868.       @index += 2. }2 U3 [% S, u; C  t& ~2 g
  869.     end' V* c  Y) _/ a/ b" s) P
  870.   end9 f+ o& t" _! b$ C
  871.   #--------------------------------------------------------------------------
    $ V' N- Y, s; p
  872.   # ● 处理光标的移动6 `8 g" s$ i) d0 M- C: t# ^8 J5 d
  873.   #--------------------------------------------------------------------------* B& ~2 P' L( M& J+ O  a
  874.   def process_cursor_move) Y( K/ T* T5 o$ `  Z' y
  875.     super
    ' |4 G% x2 N; ?& O8 v- Q6 S
  876.     update_cursor
    7 _4 h7 O8 f- f0 G
  877.   end
    ) d4 G! }/ A) v7 S7 V
  878.   #--------------------------------------------------------------------------& Z, F% e& h7 _
  879.   # ● “确定”、“删除字符”和“取消输入”的处理
    7 n- \7 B, {4 l7 j3 j& F
  880.   #--------------------------------------------------------------------------
    4 ^$ J! j# }2 [% _7 w: o& l
  881.   def process_handling
    9 w) k$ `. \3 n9 {* M/ \
  882.     return unless open && active
    : R* A6 S, }/ L
  883.     process_jump if Input.trigger(A)
    # A6 B0 g# }0 |8 k! ^2 T
  884.     process_back if Input.repeat(B): N) ~" V. R% {" L, x
  885.     process_ok   if Input.trigger(C)
    - I1 \# c& g& i/ s! f
  886.   end
    6 y4 ~- ^$ j+ ]4 B8 H  m  m4 w3 P
  887.   #--------------------------------------------------------------------------* ]* O5 L' Q: {7 B, n7 |0 H
  888.   # ● 跳转“确定”+ F& k# A$ B# ~: O* O
  889.   #--------------------------------------------------------------------------' m) [' B% }; w
  890.   def process_jump
    / T8 Z, v: C& j* _3 t! c
  891.     if @index != 11
    4 @. C5 B9 ]& Z# K% f0 z6 P
  892.       @index = 11
    6 K+ O0 h& g; j* {) k& i7 t
  893.       Sound.play_cursor" z& y5 y  G( v. g' {8 b9 L
  894.     end* l7 w3 d' |3 u) J8 h! ?
  895.   end
    5 N: `4 x) o, ^" \
  896.   #--------------------------------------------------------------------------
    * F# n, M6 j2 r9 E. l5 ~
  897.   # ● 后退一个字符: V7 [' |+ x4 b
  898.   #--------------------------------------------------------------------------& i+ Y7 y) V, S/ c% i  G& o$ o
  899.   def process_back# J4 e8 K/ o& F( `4 R* Q
  900.     Sound.play_cancel
    " ^$ G; ]1 U5 g$ ^
  901.     place = 10  (@digits_max - 1 - @old_window_index)* e/ i/ K( [# @; \
  902.     n = (@number  place) % 10) P# x' [' Y' k1 H2 B
  903.     @number -= n  place! o- u  I" t7 v. u0 {5 ?  z
  904.     @number_proc.call(@number)4 q8 a* c6 d) T% ~4 ]5 x
  905.     @old_window_index -= 1 if @old_window_index  0
    3 d( {. }$ U, D
  906.     @index_proc.call(@old_window_index)7 S0 Z8 L$ B, f# q$ W" m/ J
  907.     @refresh_proc.call. w" P! K/ }: X) Z9 s4 H
  908.   end
    : X- {' |5 O- ]* w5 H
  909.   #--------------------------------------------------------------------------
    , {: B, f0 ^* P# c
  910.   # ● 按下确定键时的处理
    7 O% F: \5 A! \3 e* T
  911.   #--------------------------------------------------------------------------  _$ ~% M  k) U7 S
  912.   def process_ok' I/ m- x* }9 W2 v: C* I# B0 j
  913.     if get_number
      c) A' t! L3 S% ]. X/ z, O
  914.       Sound.play_cursor* p. ^! J* G) t. b( X& o
  915.       place = 10  (@digits_max - 1 - @old_window_index)# [, C$ t8 Y6 u# i
  916.       n = get_number - (@number  place) % 106 o" v3 {- R- A  k8 G: V: M- N
  917.       @number += n  place
    ! D4 n9 l! T2 @  B1 u0 h
  918.       @number_proc.call(@number)- b* d6 o% w+ j2 S' z; _
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    % [- x4 e" E) M0 M# A' w
  920.       @index_proc.call(@old_window_index)
    / v- |) u- i& m. e
  921.       @refresh_proc.call
    / X- f+ P- V% [8 k! [8 Q
  922.     elsif is_delete' M8 Y! y- D( A
  923.       process_back# {7 n( q8 n  O, Y" z% ?" \
  924.     elsif is_ok9 P# S! Y: o, [! N. e4 E6 v
  925.       on_input_ok
    ' F4 N: o1 c6 m. f- r* C) x
  926.     end& W  E7 x3 g! U# J
  927.   end
    * |( l! a. O: {% p/ r( O/ h
  928.   #--------------------------------------------------------------------------6 D& z# `. W2 s" A& r5 M
  929.   # ● 确定
    7 W6 Y/ {. X  B4 O) X! O' t
  930.   #--------------------------------------------------------------------------5 H  Y8 J- t4 |8 Q9 k% R
  931.   def on_input_ok4 n1 k0 t8 ~9 _
  932.     @index = 0
    . }7 p# @- R( p1 D' y8 q0 l
  933.     @old_window_index = 0
    1 \+ J* s, ~2 u( ]7 ^6 v* p
  934.     $game_variables[@variable_id] = @number
    7 T1 v) O1 `( E! l* _( m+ E4 Q
  935.     Sound.play_ok
    : \: P! L( o2 Y3 {1 ]
  936.     @close_proc.call3 z  [! I1 A9 [+ E- ^% z0 Q
  937.   end
    1 Y$ E& i4 A5 n. z
  938.   #--------------------------------------------------------------------------5 K1 R0 B; R6 M
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置, C: K( n) w) s. u) O2 J% O1 W
  940.   #--------------------------------------------------------------------------
    9 h: ]  Z* r' c; E8 I3 y
  941.   def set_mouse_pos
    ; ^5 e5 o& X& {4 `& H
  942.     if viewport.nil # necessary!
    ) G$ G, n2 \5 S6 b
  943.       vp_x, vp_y = 0, 0
      ]4 D  p" N2 U  s0 F) W! }
  944.     else0 M' t6 G  M+ |0 x! n- z  w
  945.       vp_x = viewport.rect.x - viewport.ox6 E) n8 F- w. I6 U& J
  946.       vp_y = viewport.rect.y - viewport.oy, q* S9 B3 B  S' o
  947.     end: ?. m2 ^6 D9 Q1 q; E
  948.     item_x1 = vp_x + x + standard_padding % _, E- s. p- X% A; q! S
  949.     item_y1 = vp_y + y + standard_padding
    . s, a$ y+ F  b/ p+ j
  950.     get_index = @index  0  0  @index
    - \  W* p! q2 b! X. E2 I( M: C+ K
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)
    ; `( S6 a% i& @4 `5 a! ~
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)- [3 n- j6 `# ?& s  l& F
  953.     Mouse.set_mouse_pos(new_x, new_y)
    0 W  W8 v* n2 @+ }- b$ p
  954.   end
    ' y: X% ^# ~5 C
  955. end
    - b/ [' t1 m, ~  `

  956. ' O3 Y! d; z3 `* t" `
  957. #==============================================================================1 R5 [+ ?5 f; @
  958. # ■ Window_Message$ _6 v' }' |4 A9 a
  959. #------------------------------------------------------------------------------, R* L# z# M9 F* T4 X
  960. #  显示文字信息的窗口。
    / Z! i# S+ B8 \3 Y; N
  961. #==============================================================================) }% ^1 O7 R: }( J) G2 H1 J) \
  962. class Window_Message  Window_Base3 R- L0 @! @% @  M& g. u$ W' J
  963.   #--------------------------------------------------------------------------
    0 ]) H( R( |1 ^" K; N: u+ \- _
  964.   # ● 处理数值的输入(覆盖原方法)5 C! H# P# S, `
  965.   #--------------------------------------------------------------------------
      {0 `5 Y9 _  k+ R6 Y
  966.   def input_number: K/ o+ N' {& U% Q6 @, e/ b9 W2 U
  967.     @number_window.start
    0 C8 Z# r2 o& s7 s+ J+ V1 F
  968.     Fiber.yield while @number_window.extra_window.active
    / ]! J4 |' p$ @( L, V& F
  969.   end
    . {4 }! W. V, Y" A1 `, Q
  970. end; M. g0 N# u' ^  E4 c
  971. . B& h* @; U3 {$ O0 D5 r0 ]. D
  972. #==============================================================================4 j  K( U0 L" M8 j3 j  x
  973. # ■ Window_PartyCommand
    / p, A' p$ i. Q  b" b
  974. #------------------------------------------------------------------------------
    & A6 I9 Y: f: l
  975. #  战斗画面中,选择“战斗/撤退”的窗口。6 f" H7 k4 @& Q4 ^- ?7 |9 E
  976. #==============================================================================( ]5 r" O- E9 _5 U
  977. class Window_PartyCommand  Window_Command% R. F& a" i- D2 \4 b9 K
  978.   #--------------------------------------------------------------------------
    : [# P5 h+ ~; C" R
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    + ]/ ]- ~) e: ?! A! L! ~0 V
  980.   #--------------------------------------------------------------------------; `: m! R$ T0 H% r
  981.   def set_mouse_pos
    & o) ~6 l7 a. N! f
  982.     if viewport.nil7 d8 z+ i# g0 d+ }2 B0 G: g
  983.       vp_x, vp_y = 0, 0) e1 w( Z! Q' x0 H5 L
  984.     else% Q0 U. N* m/ E* Q! ?* v
  985.       #vp_x = viewport.rect.x - viewport.ox' v8 J% C3 g$ }; H- I" a0 y
  986.       vp_y = viewport.rect.y - viewport.oy
    * Z9 A# y7 \+ C
  987.     end
    # w7 O4 z( d( j  Q' ?8 `$ p% B
  988.     item_x1 = x + standard_padding 1 d& m  N! Z! x# h; D
  989.     item_y1 = vp_y + y + standard_padding
    / p2 y3 g, |0 [
  990.     get_index = @index  0  0  @index ' C7 e- q" Z3 X! J7 E, O
  991.     row = get_index  col_max - top_row
    8 s! W: t1 u! K  I7 B
  992.     col = get_index % col_max2 b1 ]7 x3 I( m5 A; S
  993.     new_x = item_x1 + item_width  (col + 0.5)
    7 c& ]# Q" J/ e2 f: ^" k/ l, Q
  994.     new_y = item_y1 + item_height  (row + 0.5)
    ! I( M" ~4 _: X. s$ h3 ~
  995.     Mouse.set_mouse_pos(new_x, new_y)
    4 E# q. J; H. G' C: o( O1 s
  996.   end$ g. X, }* {! I: j! a# w! [
  997. end7 a) e6 P& O1 ]0 ~: S" O! @- r

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

  2145. ' ~  `6 T9 F6 J& i0 n4 [
  2146. #==============================================================================
    ; v# j& w. m/ J7 j  r' V2 a6 \
  2147. # ■ Game_Map
    ! Y, e% r1 R; m% V2 C
  2148. #------------------------------------------------------------------------------
    ( w4 y0 B) z1 ]0 E: m
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。
    # k7 ?, S0 ?$ M% Q' o3 W" g
  2150. #   本类的实例请参考 $game_map 。
    ; m% g6 c2 b% Y' _. u! `
  2151. #==============================================================================
      M9 ]% V# V' b$ C, E6 v
  2152. class Game_Map
    $ x( a  g+ Q/ {# K- i3 ?
  2153.   #--------------------------------------------------------------------------! Q6 P( E+ [6 {) q" D
  2154.   # ● 定义实例变量2 \; I% b8 i9 y! c; l+ g% Y. v
  2155.   #--------------------------------------------------------------------------, B/ Y* W0 c; B8 |. ?' R& \
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据
    % }+ F  c  {. F1 y
  2157.   attr_reader mouse_map_y # 同上
    & _8 @  M( \/ c
  2158.   #--------------------------------------------------------------------------
    / Z  P4 ], Q! ~- `2 V+ G2 o
  2159.   # ● 初始化对象
    ' L% u2 G5 F$ b2 R: E' ?' H
  2160.   #--------------------------------------------------------------------------
    ' u1 |$ @+ M% X
  2161.   alias sion_mouse_initialize initialize
    . W  n' C( }- P' i  A
  2162.   def initialize
    5 U4 r+ U  g% j( q2 ]: H+ a( C
  2163.     sion_mouse_initialize
    8 x+ X) u' ~: J9 b% A
  2164.     creat_move_sign  ###* @- c8 n8 q4 R2 {& I1 ~5 v
  2165.     set_constants
    0 @3 U6 {  H" A+ `0 x% P( j1 t
  2166.   end% J( {7 C( l( n5 I! E" g
  2167.   #--------------------------------------------------------------------------
    % b! D' B* X& [( x- `
  2168.   # ● 更新画面9 a6 m# _7 L; J
  2169.   #     main  事件解释器更新的标志% }# p' S! E9 O3 D- v# k
  2170.   #--------------------------------------------------------------------------
    8 D9 R; T+ {5 O/ h0 P  u
  2171.   alias sion_mouse_update update
    8 W- L+ y, m9 J7 b
  2172.   def update(main = false)
    0 N- I% h% b/ n7 O8 ^& @; s$ j( n
  2173.     sion_mouse_update(main)
    ! U! d( b$ o6 O
  2174.     update_move_sign& b# J2 N/ I8 K. _9 l; j4 X3 T& q4 Y8 W
  2175.   end
    7 U5 ~4 V5 l, `, u4 b& @
  2176.   #--------------------------------------------------------------------------, N. a: d$ g  O6 R
  2177.   # ● 创建显示路径点的事件. c5 V3 g- j3 s
  2178.   #--------------------------------------------------------------------------
    7 l4 S1 O& u  Q7 M! J5 m
  2179.   def creat_move_sign
    ' ], X# ]. |' [. F+ u$ h2 C, p
  2180.     $mouse_move_sign = Move_Sign.new6 V! \: z' J1 Q  d* W4 d
  2181.   end
      N  N* d9 X" D0 t* j/ m( e
  2182.   #--------------------------------------------------------------------------0 z- x4 D6 r3 v( Z
  2183.   # ● 更新显示路径点的事件* ?2 K( v7 |* l9 k1 T% A) {
  2184.   #--------------------------------------------------------------------------, g; B7 E7 Q+ K0 s7 a
  2185.   def set_constants
    / f5 C/ l. m. r& ]
  2186.     @mouse_pos_setted = true# [0 u: ?( M+ j: r2 m
  2187.     @set_pos_prepared = false
    % f- I4 K4 k/ u
  2188.     @mouse_old_x = 0
    ! J% ~- E8 T! R' ?. y/ n
  2189.     @mouse_old_y = 0) g$ K6 k  L6 }9 T: V2 `
  2190.   end6 |' s2 F# Z/ @0 S) u8 |
  2191.   #--------------------------------------------------------------------------
    " \  v+ f( x2 [2 m: F0 f3 w7 \
  2192.   # ● 更新显示路径点的事件8 Y" P1 ~& O* g# v( O; a2 k. Y2 z) B
  2193.   #--------------------------------------------------------------------------* e7 B( @" t, [
  2194.   def update_move_sign- I( f4 V0 P& [
  2195.     $mouse_move_sign.update6 z# w$ B+ x- u: K) E' M
  2196.   end
    " ^' n8 ^& S: B! n
  2197.   #--------------------------------------------------------------------------. a* l, I4 M$ q% k
  2198.   # ● 获取鼠标位于的地图块的x、y坐标4 _* ~' Y) p5 w  P& F. n
  2199.   #--------------------------------------------------------------------------
    ( \+ s. o6 g) e1 m% i+ u
  2200.   def get_mouse_map_xy
    6 @: r" g; Y& |5 o  d; A
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y* B+ E# d$ V) S- B' a  \& k0 I+ f5 S
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i)
    2 h$ |; {( w$ o# t4 B9 y0 `
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i)
    3 l0 A; `8 S9 @8 P+ B# r9 \
  2204.   end
    1 o3 ~6 }7 E) r) l, t; ]* u
  2205.   #--------------------------------------------------------------------------
    3 S' ^# E, S, r( I
  2206.   # ● 返回地图画面时重设鼠标坐标
    ! O1 ?% F; g1 Z" B9 p
  2207.   #--------------------------------------------------------------------------& k6 R* x8 V/ V+ Q+ H3 u8 A! v
  2208.   def reset_mouse_pos$ E; y, B; P( `. t
  2209.     return if @mouse_pos_setted: C' q$ o: q! l, B! K
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y), J( g, j3 n1 T7 ~+ D- D
  2211.     @mouse_pos_setted = true
    & d6 i4 e) n# a5 n6 A
  2212.     @set_pos_prepared = false3 _) l. |( u" W6 z4 {5 I
  2213.   end( N  A7 A6 v, c; j1 a
  2214.   #--------------------------------------------------------------------------: @0 K2 i0 s2 A
  2215.   # ● 重设鼠标的坐标
    - G+ `: p& l' i, A/ J' s8 e8 ~
  2216.   #--------------------------------------------------------------------------
    3 M  h6 [5 K% @% t
  2217.   def prepare_reset_mouse_pos
    - f3 b, v3 {4 j  o
  2218.     return if @set_pos_prepared
    1 v1 S; D) E/ `- v" S7 }/ L# v
  2219.     @mouse_pos_setted = false8 g5 U3 G! S* U% M2 t1 t
  2220.     @mouse_old_x = Mouse.mouse_x! D3 J1 K6 _- ?% ?+ r# J  G- Z
  2221.     @mouse_old_y = Mouse.mouse_y+ I& R7 h1 `: J+ ]
  2222.     @set_pos_prepared = true: ?0 f) G# C. j* v4 F" L. b/ l
  2223.   end
    : H6 p9 V" x0 `, j6 m
  2224. end% B1 k7 N. ~/ {3 T! H

  2225. ) i3 t& D6 a: p/ Q9 e2 q" Y7 k
  2226. #==============================================================================
    : t2 A  \# q1 J  S: r' h
  2227. # ■ Spriteset_Map, P: n5 F9 m, a% K
  2228. #------------------------------------------------------------------------------
      w+ _) [% E0 }4 c5 Z
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。* H6 p( M% R' t
  2230. #==============================================================================2 R  |1 I6 b# }9 O+ I% _5 Z# ]# ^
  2231. class Spriteset_Map
    , W7 g8 C" V1 s, f8 [- }7 p5 Z
  2232.   #--------------------------------------------------------------------------$ L& _  a' A( H: r3 u
  2233.   # ● 生成路径点精灵
    ' b; h1 a3 q) r7 P4 Q9 u
  2234.   #--------------------------------------------------------------------------
    8 ]+ {9 [* F7 [" n, c( s9 V. O
  2235.   alias sion_mouse_create_characters create_characters
    ; Y. K; T2 @4 r7 t- m$ B7 J
  2236.   def create_characters, g" d* X& i* G
  2237.     sion_mouse_create_characters
    & Q* q1 r# L; _; Z& v2 Z  u7 @
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))& N0 s1 W+ l, s5 m4 g
  2239.   end
    : W* R  x  x' |5 P
  2240. end* c5 v( K1 h; q! y

  2241. 2 x6 J6 X6 O5 c! L
  2242. #==============================================================================* A# v  l  ]% ?$ _6 j
  2243. # ■ Scene_Map) f! ^" y7 f, Y0 y
  2244. #------------------------------------------------------------------------------
    # n5 \) G+ Q2 n
  2245. #  地图画面  t3 M3 l* @: D
  2246. #==============================================================================& ]+ O5 h0 ]0 U
  2247. class Scene_Map  Scene_Base7 y# s  r* r; b9 _
  2248.   #--------------------------------------------------------------------------
    : x: @& p9 u  }% ]
  2249.   # ● 画面更新9 B5 l2 Q9 l' W( m
  2250.   #--------------------------------------------------------------------------
    ( _% d, M) @# B" E5 ~0 u3 C1 R
  2251.   alias sion_mouse_update_scene update_scene
    , b0 b7 X" _' s+ i0 L! G
  2252.   def update_scene
    " E' i1 n0 k7 o$ G: C
  2253.     sion_mouse_update_scene
    * B* d+ Y( ?6 B- |/ Q
  2254.     update_mouse_action unless scene_changing
    3 b0 M0 g: n# M( u, U
  2255.   end. J$ I8 j/ b* g$ w1 L
  2256.   #--------------------------------------------------------------------------; e" D5 a* g9 }  j1 B( T
  2257.   # ● 场所移动前的处理! G' k4 x: g. P3 \7 V! M) d/ C
  2258.   #--------------------------------------------------------------------------
    5 i7 o7 m) D; L! N; ]
  2259.   alias sion_mouse_pre_transfer pre_transfer5 D1 F* Q# ^  T! m- q& A
  2260.   def pre_transfer  {/ e& {8 T- b* X0 d. j" t% o
  2261.     $game_player.reset_move_path
    ! y5 n+ ~  q% R% e3 b. ^4 T& M
  2262.     sion_mouse_pre_transfer) _6 M3 e) s/ s2 v+ `
  2263.   end
    4 Y" m6 N' v, Z
  2264.   #--------------------------------------------------------------------------0 S9 l1 `5 s  t  P' Z  {
  2265.   # ● 监听鼠标左键的按下
    & V0 Z4 x! {0 u' ~5 h- e
  2266.   #--------------------------------------------------------------------------
    # q9 U6 W: S; O
  2267.   def update_mouse_action
    : R5 e. a0 z* i5 }3 V
  2268.     $game_player.left_button_action if Mouse.press(0x01)
    ' Q. L' x, _7 k2 S* ?
  2269.   end
    / E' m9 ?- n  w4 B; S1 o+ x. J5 t/ S
  2270. end
    9 m1 {; {( }6 n: J# B+ j* J

  2271. 5 g" p; z$ r6 s3 P3 \# I- W
  2272. #==============================================================================" H6 m0 V4 J8 H  e" N
  2273. # ■ Scene_File+ _. D8 V" W+ t8 h
  2274. #------------------------------------------------------------------------------
    + |7 f/ C0 @" Y8 {7 d
  2275. #  存档画面和读档画面共同的父类3 R8 M- M4 k$ a4 x: C' h
  2276. #==============================================================================
    ; ?/ r5 J6 V3 T8 v: e6 o! R
  2277. class Scene_File  Scene_MenuBase; d* p, b5 _* L! o6 T  n
  2278.   #--------------------------------------------------------------------------8 Q5 a7 F5 I% O5 c# i
  2279.   # ● 开始处理
    5 P) a2 G2 U, i9 B
  2280.   #--------------------------------------------------------------------------; S* [1 f' m) f# C) E' {( C) P
  2281.   alias sion_mouse_start start+ i2 U0 o# \* K4 J
  2282.   def start6 |& V4 u: I* [7 l0 ~
  2283.     sion_mouse_start3 P* E: ]9 R" v; n1 a) Y; f: n6 o
  2284.     @move_state = 0
    , d# X1 w3 R) f4 L/ s
  2285.     set_mouse_pos# }" t- N# a! z' v8 b, Q7 ]
  2286.   end
    6 H" ~# f0 c$ w4 ?* o
  2287.   #--------------------------------------------------------------------------
    ( _7 k% q; C! Z9 x) \# V
  2288.   # ● 更新画面
    1 h. `. c, C' p' Y5 U) i
  2289.   #--------------------------------------------------------------------------0 R$ U- V  e- R; a4 n( a
  2290.   alias sion_mouse_update update1 P9 i* g  v0 v& J% G
  2291.   def update' H! f# o8 ^2 I: q. y' r6 X, `  e
  2292.     sion_mouse_update
    1 T0 i( n" n; f1 u% y3 `
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos, N3 g/ @8 P4 Z& z
  2294.   end
    6 O1 j( J: V  V, W# ^6 i  {7 H
  2295.   #--------------------------------------------------------------------------1 f4 [9 y3 I2 [: n9 R
  2296.   # ● 更新光标2 ?/ s! l* R) }# i
  2297.   #--------------------------------------------------------------------------/ e$ v$ W% N( d& B
  2298.   def set_cursor
    ( n* P6 d* q  m2 M$ Z  c+ J$ o
  2299.     @move_state += 1- v5 ]- q3 r) x: E6 i+ E
  2300.     last_index = @index: Z( I1 n4 v7 J) O" B
  2301.     if mouse_which_window == -2( J- E: L) g4 h  ]4 i4 p
  2302.       if (@move_state - 1) % 6 == 0
    7 C' W3 n# {3 U% d0 y
  2303.         @index = (@index + 1) % item_max if @index  item_max - 13 P) f8 k4 {' q. E% R$ w# @
  2304.       end
    % [: }  y1 G2 C: Y- g% Z
  2305.     elsif mouse_which_window == -1
    ) r/ C3 M1 {" V- r% Y3 G8 ^" F
  2306.       if (@move_state - 1) % 6 == 0
    3 S5 Y& c1 }! b* @6 @3 c
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    4 z1 J! l6 b; A5 p$ o0 e+ u
  2308.       end8 g7 H: R+ R  V/ [1 B
  2309.     else
    % Q5 t/ `3 E" J! I7 I! K
  2310.       @move_state = 0
    ' k* c( a  s/ c0 G( a$ H) E
  2311.       @index = top_index + mouse_which_window
    " J' W- f8 \! w
  2312.     end& G9 i- r6 `' J2 c) H4 x" S
  2313.     ensure_cursor_visible
    : J. e+ s7 D( B$ T
  2314.     if @index != last_index
      x1 G% L6 r' ^1 i
  2315.       @savefile_windows[last_index].selected = false
    8 S9 c1 d; t  `$ |0 w( R# I" E
  2316.       @savefile_windows[@index].selected = true3 G2 U4 {8 y9 ~, ~8 z
  2317.     end! `3 j8 Q" l, ^/ E# T
  2318.   end
    ) }) s) \3 T3 L" Z9 ?  ~' W! w8 y3 F
  2319.   #--------------------------------------------------------------------------
    * Z  M- q% U+ L) }
  2320.   # ● 判断鼠标位于哪个窗口
    ( F1 r- p. _; u7 I  D
  2321.   #--------------------------------------------------------------------------
    , @7 X/ I) a, H; B+ w. L( Q8 T
  2322.   def mouse_which_window- ~8 [; k. ]' Y3 {. I9 x8 W
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y  g1 z$ Y0 T! G5 |
  2324.     if mouse_y  @help_window.height + 14( V+ D, N: H& e- J8 R% r% O! e# u* e
  2325.       mouse_row = -1
      A9 T) ]  v8 L
  2326.     elsif mouse_y  Graphics.height - 14% O: n! y, ~! G2 S9 P; ]5 @
  2327.       mouse_row = -2
    5 Q2 B% _# L$ Q# W' T/ y4 A
  2328.     else
    4 D; q. L, q3 p
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    ) `9 D( h: M; B2 q5 ^, [. {7 @, q
  2330.         (Graphics.height - @help_window.height)
    ' y0 o- ]1 D" `' E7 k% d
  2331.     end7 K  w- X# m& c6 _6 j1 O7 `* ?
  2332.     return mouse_row
    0 a( y& [6 ?0 n2 ?1 _% o; y) W* o3 F
  2333.   end; a' A+ d; h  w2 j* ~
  2334.   #--------------------------------------------------------------------------
    7 x' a/ {( p* M3 a1 i4 d
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置, w) U; H/ W7 w
  2336.   #--------------------------------------------------------------------------
    8 ]0 U: T, r$ P- P# G7 [
  2337.   def set_mouse_pos) g, L6 t  ^" Q4 P2 B, v' E* S4 U
  2338.     new_x = 40
    ' S5 H' w4 y; P! E/ P" ~8 i
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24- Q3 @8 V# p$ S, `: _
  2340.     Mouse.set_mouse_pos(new_x, new_y)7 R- `& o/ f, B& Q
  2341.   end
    . M) m1 X) [; ^" ?" p- q0 P
  2342. end% n1 b- v2 C9 J& |% p$ \6 U

  2343. + I; @4 P$ Y& t" E3 `1 M* T1 K
  2344. #==============================================================================
    8 Q. X, A' q8 P' S
  2345. # ■ Game_Event
    7 z+ W2 T2 u% q7 C4 Z0 E& o
  2346. #------------------------------------------------------------------------------- {) t6 b( n$ n* O+ m
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。- @& Z& H$ O7 d& ]" U- M
  2348. #   在 Game_Map 类的内部使用。
    / K7 ~( k0 e  o# W6 g$ L* a0 b
  2349. #==============================================================================
    , R# T- ^8 M: E4 s! j6 V
  2350. class Game_Event  Game_Character+ A+ ^- x2 r* H8 \
  2351.   #--------------------------------------------------------------------------- E6 G( u% `8 k; y8 }7 h
  2352.   # ● 事件启动
    8 Q  k- _5 G9 ?9 H
  2353.   #--------------------------------------------------------------------------
    # [4 ^" J8 n( z$ ?3 H
  2354.   alias sion_mouse_start start
    ) n. _- @4 G8 D7 `
  2355.   def start3 k0 e9 t/ N: M6 [7 f8 P
  2356.     return if mouse_start && !Mouse.press(0x01)
    $ s) k+ D8 T( C% y9 ]7 z
  2357.     sion_mouse_start
    8 l/ x2 k5 i, m  T* Z) u. k! B
  2358.   end
    # k( W8 Z& r/ v/ ^9 x
  2359.   #--------------------------------------------------------------------------1 W/ y+ O# Q& T/ t7 K
  2360.   # ● 判断事件是否由鼠标启动
    5 r* |$ l# x- v% N! T
  2361.   #--------------------------------------------------------------------------4 b2 r( S/ G1 {! c7 c0 [
  2362.   def mouse_start
    5 P7 s+ M6 a1 V9 P! z4 `0 _
  2363.     return false if empty
    $ R7 }, B+ M0 s% g# g- L
  2364.     @list.each do index1 j8 v* M# J4 O1 S, _. W) w- B# p
  2365.       return true if (index.code == 108  index.code == 408) &&& \) o0 u4 a- S
  2366.         index.parameters[0].include('鼠标启动')
    3 w. v5 s0 N. J5 m, R
  2367.     end4 \2 H! b: p) L- x* \' U! B# p
  2368.     return false
    7 q$ p3 b% c$ M0 b+ C
  2369.   end
    9 S; X  G7 D" g" M/ ~+ g
  2370. end
    ( U- n3 z% v) a4 ^, W4 A3 X) z+ `; ^
  2371. * T5 n; g3 f( T8 v7 M
  2372. ####泥煤的height
    4 D- k) `, u; Z$ u3 |. ?
  2373. # @height = height
    ) \4 V" r! D' }3 i
  2374. 2 h! b5 c7 c/ V+ k7 x. ~
  2375. class Area_Response
    8 x7 s$ I  o( L
  2376.   attr_accessor type$ Z$ F4 e4 k- W( p
  2377.   attr_reader ox% b4 d' v( G4 p8 `  _8 x
  2378.   attr_reader oy
    1 ~! |! p# ]: o( |7 ]  W- R9 u
  2379.   attr_reader width
    1 o+ Q! _" Z) L3 P& e5 z
  2380.   attr_reader height; T% u3 D2 v( ^( @
  2381.   attr_reader switch_id: f# ^6 t( L' D; Y( e- d/ g0 @
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)) j! W; h4 g( N- I* K/ T& S& @! s5 R
  2383.     @type = type6 P$ i9 z6 a5 S" x7 _' J. D
  2384.     @ox = ox. S  a0 p1 ?& t2 j: c. M' ]* W
  2385.     @oy = oy3 I  e. s5 J, x" @8 |. f9 e
  2386.     @width = width* J6 {, {( W7 n8 q, @4 {
  2387.     @height = height
    , S/ T; u$ L4 e+ P: h3 N) S
  2388.     @switch_id = switch_id" @+ [- z. l( u) f1 a0 ?, C! ~- p
  2389.   end0 Z% a! p5 S, [; l4 L/ L
  2390. end. E! g1 q: h( x, x6 v3 }! e! c
  2391. : X6 z3 v, t. Y3 i
  2392. $area_responses = []
    6 L- s* I3 x5 P( `1 V
  2393. , r# h" Z* ]0 K9 R5 b" u7 m4 U
  2394. class Scene_Map
    3 C: O" _$ F$ Z- X4 r+ {
  2395.   alias update_mouse_2013421 update_mouse_action
    : M7 r& K. t( `* U+ j
  2396.   def update_mouse_action6 N9 w/ E' H+ C) ]
  2397.     update_area_response
    7 ^1 z* _% D- |& e
  2398.     update_mouse_2013421
    ' t. W- W8 Z6 }& `, v( F( }
  2399.   end
    ; u$ h8 y! X2 l* t
  2400.   def update_area_response' y3 S* F. y5 h1 O/ J9 u- G
  2401.     responses = $area_responses' d, J5 k( e" |, u& _
  2402.     responses.each {response
    8 i& q3 K% @) g# x2 O* u
  2403.       ox = response.ox
    ; T' J9 k4 J" \# m3 ^
  2404.       oy = response.oy
    7 z$ H$ B* V- H! z, R9 D1 H
  2405.       width = response.width
    ; K; j1 W, G( v9 n2 _+ L
  2406.       height = response.height+ C% z8 g3 i, V4 Z3 u! d
  2407.       switch_id = response.switch_id" K+ e+ X0 u% l8 H! ~. f
  2408.       case response.type: o7 \4 {% F$ X2 d  g3 F- p- O
  2409.       when 0
    / e& D9 m5 p$ C
  2410.         if mouse_in_area(ox, oy, width, height)
    2 p7 p; ~2 B) S6 C
  2411.           $game_switches[switch_id] = true
    7 U7 X. {# [4 c9 x. R" j
  2412.           $area_responses.delete(response)2 d# J1 |+ W# i( }
  2413.         end
    : @! C& ]+ ^1 K4 {
  2414.       when 1" ^( n9 Q( }% i# j
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)
    6 @/ A  o. C8 w
  2416.           $game_switches[switch_id] = true
    " L6 g# v3 t* m( B. P2 c- s
  2417.           $area_responses.delete(response)4 d4 C  ?) f8 ?* v" U
  2418.         end
    ! i1 L" `6 s$ q' X4 @5 Z9 l
  2419.       when 2
    ( {# q9 b. t" N3 E" b
  2420.         if mouse_in_area(ox, oy, width, height)  Y9 X3 @% c% `; w& d6 C$ S8 p
  2421.           $game_switches[switch_id] = true0 O  K+ \; D$ g" y/ J8 ]
  2422.         else
    4 p% @! V7 v" e$ ~# S5 g: g5 S
  2423.           $game_switches[switch_id] = false) {# O& e% w- V# s- B
  2424.         end$ T8 y: e2 |0 _) T2 \- m
  2425.       when 3# R/ k" A7 D+ \/ Z" l+ W& y
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,2 Z1 ~+ d- K5 H# F7 F+ B
  2427.             (oy - $game_map.display_y)  32, width, height)
    0 G7 b; G1 h: u, O* E/ ~
  2428.           $game_map.events_xy(ox, oy).each {event) N! l) K. C, {4 o8 I+ X+ k
  2429.           event.start
    9 O* c, \4 Q8 J5 w. A& N2 w
  2430.           $area_responses.delete(response); O+ h/ T& r7 d! d; a# A
  2431.           return9 _6 ~; ]" z  [3 S
  2432.           } 2 S. \' \$ e3 S) F
  2433.         end
      N! U4 s+ {, x. |9 l$ Q( U. A
  2434.       when 47 @2 I' {* I9 L8 o
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,
    $ S. _; X0 c% F8 C2 @1 C
  2436.             (oy - $game_map.display_y)  32, width, height)) |( H4 O2 a3 C" V9 N
  2437.           $game_map.events_xy(ox, oy).each {event
    ( n; A/ h! R4 m' E( h. A
  2438.             event.start
    5 b; r5 }, u! @8 Z
  2439.             return
    ) C' j8 Y5 _% R8 b5 i- q
  2440.           }   v* }' H7 G! w6 y7 E& i
  2441.         end
    ; C+ J- ]* ~* r2 }9 _! w6 Z
  2442.       end. f$ X* y6 o5 O# Z
  2443.     }
    + d% s- `- f+ `
  2444.   end( m. G+ e/ y+ q$ g; ]( n8 Y  i
  2445.   def mouse_in_area(ox, oy, width, height)
    $ A$ u$ g3 |/ j+ q! v& |) a- B
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&* G# H% @+ g, F- j" ~/ R
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height
    3 \. `) x8 u% n9 _( C" e8 e; R
  2448.   end
    ) u: D' R5 Y0 w- j: r8 U3 U
  2449. end& R3 ]7 w8 N6 S3 h' f" u
  2450. class Game_Interpreter
    / L7 D9 H# ], d, T0 j
  2451.   def area_response(arg)9 w- K& F' Y* d# p$ `( T
  2452.     $area_responses.push(Area_Response.new(arg))
    6 L8 S! w" `* R" u
  2453.   end
    0 X3 \, \+ F% ^' W+ M% U& W
  2454. end
    - P% |1 r4 V' R: p6 b, h0 ^6 ~+ ]: s
复制代码

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

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

GMT+8, 2025-5-12 15:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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