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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    5 ~9 [( @& a! U$ f

  2. ) j5 p6 V9 p' y- v
  3.   Sion Mouse System v1.3e
    9 B9 K6 t/ O) S4 l' ^( K, {( Y# B
  4.   2 l1 E+ f; X: d
  5.   Changlog0 h6 K' R$ O: y9 ^! D- z  c# O/ k0 M
  6.   
    & @+ f0 a2 Q% i3 f' Y8 x+ Z
  7.   2013.4.21 v1.3f
    6 L3 k& X, V) r- K  u5 {0 ~
  8.     - g2 O* i" ?, M3 E' {- j. G
  9.     1.3f 卷动地图 bug 修正
    : t  x3 u- ~7 F- q4 V4 H+ V7 O. O
  10.     7 E+ u; X! x) Q% m
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口
    / [$ [- d; O" p. D8 f
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内; `( ]& K( z0 ^5 H6 n
  13.                               Mouse.unlock_mouse_in_screen 解除锁定
    : |7 t& n' m) g$ x
  14. / S. y2 ^/ ]( m  U
  15.     1.3f bug修正; }& u8 a$ o" e# Y  F$ I# a2 w' a
  16.   
    " L1 U6 B  m$ `  U, C* u
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及) I+ ]3 z" E- v3 `8 c
  18.           关闭菜单时,鼠标是否移动到原来的位置。( ?. [, v: z2 a7 o/ @

  19. ' R4 a5 |7 s  y5 Z% y
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处; N* D1 ~( `  ~6 X

  21. , \- c- ~; Q, _1 a' v
  22.     1.3b 修正一些罕见的bug;
    3 X- S# l+ |0 R  X" b& `
  23. 5 I. v. Z7 Q  g% T1 r
  24.     1.3a 代码小修改;
    + g4 k; N7 Y7 x* c! y( f& @; _
  25.           加入了鼠标点击启动事件的功能,# y! j( l4 ]! m- Z- Y5 l, l* a
  26.           在事件中加入“注释”: 鼠标启动  ,
    2 u/ s7 ?* p- C7 x
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。3 V( E1 P" C7 b  G7 {  F1 x# W; j
  28.   
    ! W6 g) k& t( Y: q9 k5 N
  29.   2013.2.12 v1.2( \( V' }$ |0 W$ |4 L( J

  30. 4 {( l$ r, i7 q4 @3 `* F
  31.     寻路逻辑优化;
    - ^8 X8 w+ Y; \+ B# T, i+ o
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;
    9 y  H" B/ Q! R& k1 C% V7 b# Y
  33.     现在支持用鼠标来操作载具了。
    2 M& L* X& i* A

  34. 3 T0 _# J( b& P; s  u
  35.   2013.2.8 v1.1
    ' Z( V9 d7 w0 B

  36. , j# o- F3 U% A3 Q5 c0 y& }% X
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    $ I( x: c; f7 Y: @, D; @
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;( w" c: ]6 w% ~! }% w
  39.     移动时,路径指示点的绘制更加稳定;
    / i: W- @9 N- E- Y  ]
  40.     现在支持默认存档画面的鼠标操作了。# l3 R5 ?/ g" Z  c8 s
  41.   ~3 K# D; y# e+ G, C+ I

  42. 1 L# r' N# t. D& O3 U9 h$ \9 Z
  43.   OrigenVersion
    + T4 P9 u5 {( s, `, Y: w
  44.   
    + W& r1 c1 S( |' Q
  45.     2013.2.7 v1.0 9 C/ k4 w+ m$ _0 r4 `
  46. ! m" m5 ~' K3 P
  47.   主要功能5 F% A1 j  S+ j$ L

  48. / I0 w& i- h/ f7 t0 \! S. I* b
  49.       使用鼠标进行各种操作...
    : ]# p2 F" }+ p0 Q+ p5 ?" ^; o7 ]9 q
  50.       将鼠标锁定在游戏窗口内+ u4 P2 t: z% X) |: Y% j
  51.       自动寻路,按住 D 键可以扩大寻路的范围
    ! L6 J* r$ g% t" i" C5 t: v& X. Q
  52.       双击鼠标进行冲刺
    . j" ~- u* M" n! I+ n! K
  53.       更改地图卷动方式以适应鼠标移动: V0 z' A! \: S3 F4 H1 M
  54.       变量输入框改良1 G4 U, q- ^' K, ^- z8 R% I1 w
  55. * |8 X( W, P, j% v% @, x+ {7 j9 J, H
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹( w. \' n2 F' [; ^1 O

  57. 1 i2 K- Z9 y$ X  n
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹
    0 ~: Q* o6 z8 n

  59. 7 m4 t( G% z, ?+ p0 N3 s$ n7 U
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭8 m- u- T- r. O3 n* g
  61. ; u6 @7 L8 B# {5 }( O. n
  62. 9 M( s4 M8 G" v4 _. k+ m5 x6 N
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★4 Q* h1 \/ q# Q' R

  64. " `& V+ N+ h- n; e) l# h
  65. 4 d8 c4 l# {. o! C/ q' \) j
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示* R: `# z( C, ~; _

  67. % u3 [6 R5 h, o4 A4 ^& @
  68. #==============================================================================
    , E4 b, t/ G" o' _( a! a$ N
  69. # ■ 常数设置 8 q9 w" l& e' `/ i; h) T) m% m
  70. #==============================================================================3 c6 `: z- G* P7 r( l8 @/ X! I5 A# f
  71. module KsOfSion- Z. ^3 W+ K! u4 P7 A2 N
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false
    5 V2 p/ F' D7 b2 w7 h$ ^
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑$ [7 B2 ~$ H+ Y( y/ f! w
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    9 @. N5 A0 @& X: Y
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量6 H8 r6 l, g" l# D5 Y$ T
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    ( c8 |4 w+ E% {3 ~- j
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧% E6 k* h$ y# n2 x* A
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)+ u  d/ G5 w& g$ ~1 G
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键) w9 a4 t; c$ R) M
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)' D: i! S' |) D5 R; I
  81. end
    . ?8 `5 d( I- u+ [, T" a- I5 b
  82. # C$ h9 d) H) H! h6 S/ K+ _$ C
  83. #==============================================================================
    : L( X% `$ D" J* j3 z
  84. # ■ 用来显示路径点的类3 ]: M4 g$ j- d" {* Q; Y
  85. #==============================================================================3 W. k+ W; N9 N3 h6 ]! ~  w) Z
  86. class Move_Sign  Game_Character
    . g" `7 T! z+ r! y
  87.   #--------------------------------------------------------------------------+ K7 l6 w6 `& a/ G2 V
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图0 X: C2 @0 F6 I; ?7 }3 B
  89.   #--------------------------------------------------------------------------6 X$ W2 `5 p$ O' T0 n0 E3 A3 l
  90.   def init_public_members2 @% s& ^" w7 A' R: X' ?- g
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹
    : j$ h, u1 Q& }; m
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为08 t. x& c1 T; G  ~# R3 W) u' m' l8 ^
  93.     @move_speed      = 5        # ★ 踏步速度
    ' ^% v$ F, S9 T* g" }1 X3 r
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    , {6 A9 L0 t# s6 I/ d
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度
    ) \! t7 A/ D' m
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)6 e. {& o* X* {, \# X" n1 S
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列
    5 m9 X$ Z) i& d+ E# w! m% P
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)
    7 d- j! K8 A4 [4 h" d

  99. : C4 }" t. Q) {: G3 ]" N7 W
  100.   @8 j. y) V5 p8 ~- a
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    2 C, o# X4 e0 ^5 ~) O3 N
  102. ( ?7 o" E* x, W6 i3 f3 K8 n

  103. * e7 R7 U0 ^! {9 }8 ~4 j
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图! X: p! |; V( f- t" ?& C
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    ; x1 g! l# d% X1 A2 ^
  106. * C. `# z* a. Z, F9 j
  107.       if $no_arrowpic_warn, X8 w7 {1 d) |+ y- z4 o6 q' i% k
  108.         MouseShow_Cursor.call(1)' w" ^9 D8 Q3 ]  B
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png: K0 ?6 [( z& L8 w
  110.   }  b2 l9 z5 d
  111. “路径指示点”将使用游戏自带图片  j) ]0 k; {+ i

  112. % \( A1 v6 O  h# L* D* w* w
  113. 该提示可以在脚本内关闭')
    5 N+ D! z- n& ^: `
  114.         MouseShow_Cursor.call(0)
      k9 z; u. S6 m8 m- E
  115.         $no_arrowpic_warn = false# c# g8 v  @, N9 c! W
  116.       end; i. m) U2 V! W! Q' @
  117.       @character_name  = '!Flame'# z5 |  [; o  S
  118.       @character_index = 6
    8 A8 |+ @2 J& I7 d

  119. . r7 L1 z  _: {/ E/ C1 }
  120.     end* }4 B5 D" W! l+ t$ `
  121.     @direction_fix = false  # 固定朝向
      V& O5 @& }6 a
  122.     @move_frequency = 6     # 移动频率
    7 i1 L+ U7 G: s
  123.     @walk_anime = true      # 步行动画
    & R5 M+ H# M" q9 d! J
  124.     @pattern = 1            # 图案' X, E  E; w6 Q0 d- z6 o
  125.     @through = true         # 穿透
    7 x! L" w' E) k0 ^  R
  126.     @bush_depth = 0         # 草木深度
    : [" ?& L. P: X
  127.     @animation_id = 0       # 动画 ID
    + _9 v5 p8 Z: V4 l$ |4 G5 S  t
  128.     @balloon_id = 0         # 心情 ID/ O( V# }7 l1 ^& h% V$ l
  129.     @transparent = true     # 透明
      P2 G4 H4 X; Z! H4 m4 L
  130.     @id = 0% w: ^, f8 h9 D" Y2 d+ w8 A: C+ j
  131.     @x = 07 \7 l/ O! U6 Y) O+ S2 {* @+ b
  132.     @y = 0
    2 l5 v# M; j3 d+ P& w& M! i& X
  133.     @real_x = 08 `# }/ C1 H% q/ ^0 y4 _! K/ ]1 p
  134.     @real_y = 02 ?- D3 F8 |/ b# _0 c! j: z
  135.     @tile_id = 0
    % z, c- P! S0 ]; c* d! H0 v
  136.   end  e+ _1 t1 u& C  [6 h8 |3 y
  137.   #--------------------------------------------------------------------------
      `7 R; R; H* _' J3 i* _7 E  z2 Q  J
  138.   # ● 定义实例变量
    + V7 n0 D/ C! E- h
  139.   #--------------------------------------------------------------------------' |4 y- H  D+ S0 I4 ?% J! \
  140.   attr_accessor direction
    / V( N: G7 K  Q/ R. |& r/ u
  141. end
    , P7 m$ d; L. @8 I

  142. * @3 g5 R8 U/ H  B" }
  143. #==============================================================================
    + w& t; C8 Q; u3 W
  144. # ■ Module Mouse
    # X8 }: d4 b  z0 Q1 J& u5 e
  145. #==============================================================================  c2 Q) I$ Q5 v
  146. module Mouse( a9 G5 {2 O$ \. O5 E
  147.   #--------------------------------------------------------------------------5 o& M# m8 A8 A- j" ~9 }# ?
  148.   # ● API
    " J- b6 A+ B) J& m
  149.   #--------------------------------------------------------------------------
    6 p! q7 X4 a: j
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')% I* S# H3 b! U1 I
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
    # \- ]0 w8 w1 g0 ^
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')
    , W  B( G; _  K. j
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i'); d* }, M" t5 z/ L; P
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    : v1 q: J. L% H& s$ A
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')- W- y: v, P4 a/ x, _2 H
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')
    5 I2 h2 s" |  a; g# d( W: {
  157.   Window_Hwnd       = Get_Active_Window.call
    # I7 m8 p* a2 v

  158. ) j" d* O# i4 _% a6 R  S  S
  159. class  self" e. x/ t# b  i) X* V0 t
  160.   #--------------------------------------------------------------------------" A7 N" u: n' k9 \& p& Y  Z% |
  161.   # ● 初始化
    ' G% \* p2 a8 v/ K4 f1 J
  162.   #--------------------------------------------------------------------------1 B0 |; a1 }& C* Z- t* K' i9 z
  163.   def init6 n+ u0 B: Q8 w" E
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor4 H* R6 w, L# X$ c9 f0 {
  165.     @left_state = 0
    * c4 F+ o) K* l2 m  j3 L& X( M
  166.     @right_state = 01 h6 \& @- R' g* k/ M) L1 Y+ m
  167.     @ck_count = 0 # 帧数计,单击以后从0开始# J& D: E! {/ Z
  168.     @dk_count = 0 # 用于双击的判定
    9 t* M: U1 O% H( ?$ I( Z
  169.     @clicked = false" V' o( m! L" d: ~! L
  170.     creat_mouse_sprite( ?2 L+ |0 R6 _' z, J7 q3 M5 R
  171.     update8 _$ f  U  L. _2 w
  172.   end# e1 \* I3 Z) ^. Y6 R  e; S+ G
  173.   #--------------------------------------------------------------------------
    . C4 P. Z$ M8 Z7 l
  174.   # ● 鼠标指针精灵4 A( H- P% ?9 ]+ y, y1 Q" ~
  175.   #--------------------------------------------------------------------------6 j+ b( o# K+ T. t% z7 u5 f3 ~
  176. #~   def creat_mouse_sprite, a" R# k- _1 o4 S; l! M' ^
  177. #~     
    . L9 q  d# ^, _" H7 }- b/ q5 B
  178. #~       @mouse_sprite = Sprite.new3 R8 s1 F" d' L$ ?7 {
  179. #~       panda = 2#rand(2)+1
    5 Z7 R. I- y, {+ ~
  180. 6 i6 S/ O! i; z6 V
  181. #~      if panda = 1
    # J6 `2 @, k2 z$ V: D9 F, N
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    4 z/ ]1 Q- F$ y# V( Z3 K& P) ^1 W
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')! G4 ~% x- R# M/ _9 T  u
  184. #~        end#with if File.exist3 f% w3 [8 F& Z- w+ e$ X
  185. #~   
    % O: D' \' ?& X% ]$ D. c
  186. #~     else if panda = 2 #with if panda=17 F6 F% y$ }. @
  187. #~      
    2 q' l$ L4 |& l3 X9 }
  188. #~      if File.exist('GraphicsSystemCursor2.png')
    ' v  o6 N  I- s3 u& {6 B
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')$ X! }/ i( c6 V
  190. #~      end#with if File.exist
    5 x* Q" p) q0 s
  191. #~      
    $ _# T" k& i9 k
  192. #~     else #with if panda=1
    ( g- }1 [2 R6 [! S" U
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)9 s0 k7 U( h) l' {5 K) H5 C- ]  `
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),
    ! Z$ F3 `9 r) }
  195. #~       Rect.new(5  24, 24  24, 24, 24))9 [0 n" Z8 `2 ]; t
  196. #~     end#with if panda=1
    , z7 t# k; x4 |& x* y
  197. #~     0 J) e' q/ X2 M4 x' C
  198. #~     #with def7 ^* E! `7 f' e; }) S
  199. #~   end
    " \' _) B' Q" ^
  200. def creat_mouse_sprite
    ; d# h( f" `' M& P. }
  201.     @mouse_sprite = Sprite.new
    , N7 T% S& f  i! N5 q8 ^/ z  U
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})
    2 c' z% A, X8 [& j" ~6 `7 C
  203.     @mouse_sprite.z = 9999
    ; G1 k0 B0 ?% U
  204.     Show_Cursor.call(0)2 f1 B9 ?- ^8 U
  205. end
    1 m6 J# D" C7 A
  206. 1 `2 J+ x& H7 K. X$ u" V$ `
  207.   #--------------------------------------------------------------------------5 N5 n# o# n( \; j# g, g* g- c# |
  208.   # ● 更新' j/ w5 {9 d+ M+ _- f
  209.   #--------------------------------------------------------------------------
    # ]+ b- {- Z, [& @
  210.   def update
    9 D! V& k: {% X
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos+ F8 I+ R8 o# d6 r( }$ w& c1 E/ n
  212.     left_state  = Get_Key_State.call(0x01)1 x% e2 f4 P1 v" z
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0
    $ j1 o$ o8 _4 {, S  }
  214.     right_state = Get_Key_State.call(0x02)
      h; J& R* Q# G  S) [4 N' ?
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0
    - i5 K5 ~% \. j+ z- a$ j, A" B% x
  216.     update_double_click# p' C2 P2 q. Q/ P6 F
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1; j- G" [1 [4 H
  218.   end
    8 U( T6 d! z+ w. M/ p
  219.   #--------------------------------------------------------------------------
    7 _( @  J2 f% h# }. x
  220.   # ● 获取鼠标坐标5 V4 x* c; x: U
  221.   #--------------------------------------------------------------------------+ c7 H$ H$ J5 W4 j  @5 ^
  222.   def get_mouse_pos
    6 b7 L/ \. Y! q, ^2 X
  223.     arg = [0, 0].pack('ll')$ W) {# p8 f, @# ]+ r& b# E
  224.     Get_Cursor_Pos.call(arg)% J5 b% }3 E, U
  225.     Screen_To_Client.call(Window_Hwnd, arg). c. D" T$ a0 R* T6 G8 M
  226.     x, y = arg.unpack('ll')9 T: k+ `+ z$ a, _% q! [% F4 F
  227.     return x, y5 c( t1 b/ {  ^. q5 g
  228.   end
    2 d& }$ n8 l' q9 O
  229.   #--------------------------------------------------------------------------
    ' ?% u! O, \- J' v
  230.   # ● 将鼠标固定在屏幕内
    / o! n6 U, S; |5 S/ A9 {1 D4 h% c
  231.   #--------------------------------------------------------------------------+ [7 ?5 H4 f0 Y* ~
  232.   def lock_mouse_in_screen1 D% {& l! g( |0 ~: p
  233.     arg = [0, 0].pack('ll')6 q# s: |! h* f4 P5 d* ^4 |
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    3 V# F5 |0 v  N7 G
  235.     x, y  = arg.unpack('ll'); H  l6 E' D, @% X. D
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))
    $ Z, c: o1 J' A8 f. ^
  237.   end0 `' U& i* Y4 N; Y
  238.   #--------------------------------------------------------------------------0 t% a( ?, @) M+ W4 h' Y
  239.   # ● 解除鼠标固定$ G9 B3 }' y" u5 H$ s3 R; I
  240.   #--------------------------------------------------------------------------2 e, ]3 Q$ V4 P5 c
  241.   def unlock_mouse_in_screen* T' S4 I* R: b2 ?* _
  242.     Clip_Cursor.call(0); T, S/ @* @) Y8 t6 e
  243.   end) @2 W! {* F+ Y
  244.   #--------------------------------------------------------------------------
      B. X1 }5 b' t! b9 Y8 t# i
  245.   # ● 鼠标双击判定. X4 A( I& |- _' u, B  _, p
  246.   #--------------------------------------------------------------------------0 o( B: T0 Q3 |9 _0 L- s
  247.   def update_double_click
    ) n3 h( [. _0 Z% e
  248.     @clicked = true if @left_state == 1  s, u/ m' Q/ U, S5 h
  249.     if @dk_count  0 && @left_state == 1/ w  V8 M0 v  i& Q
  250.       @dk_count = 0; @clicked = false
    7 M, s& u7 ~: [5 m1 x% [
  251.       return @double_click = true
    ' V( p, e% f& R" p, d
  252.     elsif @clicked8 k. u( I( s* ~4 c; U, P& e
  253.       if @dk_count  KsOfSionDbclick_Frame
    : x3 u# S: A6 _# H7 p( }
  254.         @dk_count += 14 q1 t/ |* ]# t3 y( l
  255.       else/ [4 u9 S( Y, |( a
  256.         @dk_count = 0; @clicked = false
    6 t* `' a$ i) b, h; t" {9 @! D8 ?
  257.       end
    # i4 ?0 ?4 p  V/ A2 i
  258.     end  V7 c: J2 x% e+ c) u: {
  259.     @double_click = false
    1 Y  [. d8 Z* n* S
  260.   end: Z  m+ |( B% r( n4 P( X
  261.   #--------------------------------------------------------------------------
    - S2 B  e7 p+ A. j6 C  B6 T8 K9 k( m% q
  262.   # ● 按键被按下就返回true5 w" J5 N& w9 W2 i+ w5 g+ {( z
  263.   #--------------------------------------------------------------------------$ ?; `* ]4 Z1 V" J  C0 ^
  264.   def press(button)
    / q. {* I2 Q' Q; u
  265.     case button
    3 G5 S6 E& J6 z' Q% I& j+ c
  266.       when 0x01; return !@left_state.zero% ~7 G5 A. @* }* t8 j
  267.       when 0x02; return !@right_state.zero8 U( R+ T. I8 K& K& k; ^
  268.     end' u& b5 c% ^. ~; `  E1 W# f0 Z
  269.     return false
      ]( ]' `5 c5 z, T; ^! p; t; ]
  270.   end+ ?) Q3 v, x$ F8 Z: @
  271.   #--------------------------------------------------------------------------
    7 W, L- S& q8 d3 Y9 j; q# ^+ ~
  272.   # ● 按键刚被按下则返回true4 j/ R! g# S4 Z) u& S
  273.   #--------------------------------------------------------------------------5 N% D  [0 V0 C3 E
  274.   def trigger(button): o$ x* V8 m) z/ t. V# T, E9 A- c
  275.     case button
    # r$ ?, d* \: g/ s
  276.       when 0x01; return @left_state == 1
    ! J1 C* ~/ p$ {5 x
  277.       when 0x02; return @right_state == 1
    , j1 c! S' M! w: t$ Q2 ]
  278.     end
    , p( L: N7 T5 e
  279.     return false
    4 g& B" L. o) e$ m  M' s+ H
  280.   end/ r% y( q9 ~! u" }$ @+ A
  281.   #--------------------------------------------------------------------------
    & ]$ R9 S6 C: Z8 K! b
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true5 b; g, G6 w0 y
  283.   #--------------------------------------------------------------------------( c- @& K: ^$ n  |8 \
  284.   def repeat(button)- B' e3 w7 c% F) S4 `
  285.     case button! [" u5 }6 m, {# Z5 x3 I
  286.       when 0x01; return @left_state == 1
    & Y5 ^- q- v8 O; {
  287.         (@left_state  22 && (@left_state % 6).zero)
    1 c+ z! I- p* X2 k; [2 A
  288.       when 0x02; return @right_state == 1
    $ S# W/ N! H9 L
  289.         (@right_state  22 && (@right_state % 6).zero)
    " {' T" a" d+ C
  290.     end
    3 b% S, y, A( i! s# d
  291.     return false. n6 _( B: ~7 `# H) ?5 D
  292.   end
    ; ^5 o" i% l8 [' I, I
  293.   #--------------------------------------------------------------------------
    ) b( g/ Y3 S$ ?, ~" B0 q' y
  294.   # ● 判断是否双击鼠标
    9 a5 X) }( x: {; S% c7 ^7 ^4 O9 q; \
  295.   #--------------------------------------------------------------------------. M( g- O* [6 V! P( I
  296.   def double_click+ c% [* j/ H" F$ a2 Y, d% l, n, p
  297.     @double_click
    ) H; M8 }- J  {* g5 A* p+ |7 x" E
  298.   end) i& T6 J2 y8 o+ u7 z& w
  299.   #--------------------------------------------------------------------------* {/ _, ?6 k& X( }
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)
    7 t3 G2 Y# I, D8 _2 _. Y
  301.   #--------------------------------------------------------------------------6 w* M4 }& G9 z) v0 k; q
  302.   def click_count$ }$ h2 Q: E8 v5 [7 ?: @9 T
  303.     @ck_count$ G) n: F+ X0 ^) s) S2 P; R* X
  304.   end
    5 z4 l6 j8 Z& M7 e* M- z- c
  305.   #--------------------------------------------------------------------------
    1 c6 a$ P4 I* S4 _: e
  306.   # ● 获取@left_state(按住左键每一帧+=1)+ k5 M6 }' r1 C: A  b  Y
  307.   #--------------------------------------------------------------------------7 g6 Q* b0 G. i4 T0 d
  308.   def left_state8 S  |7 U$ K0 I5 d1 ?: P4 E& h
  309.     @left_state
    ' I, n. z4 h/ V: }' X/ |
  310.   end- D/ W) h5 c' M7 {( n' B
  311.   #--------------------------------------------------------------------------
    2 \; U( I0 H  B; l) d) W. [& q
  312.   # ● 获取鼠标的x坐标
    # {0 w/ r! g8 j2 d4 V/ I' j2 ~
  313.   #--------------------------------------------------------------------------  |1 O5 a, X  b" V( l
  314.   def mouse_x
    " L4 ^( N7 _" P- A  ]
  315.     @mouse_sprite.x
    8 O( Y  `4 ^" m, }; w' l
  316.   end
    4 d1 W. ?( \! t3 n% R5 E
  317.   #--------------------------------------------------------------------------
    6 C" o8 _' ~  x- ~3 V+ N
  318.   # ● 获取鼠标的y坐标
    ; a  G" N, d  `( x
  319.   #--------------------------------------------------------------------------
    & s6 j) u7 V$ M5 l, h- r1 H5 ^
  320.   def mouse_y$ I& q9 V. r% N8 q; S: ~& ^2 F/ r
  321.     @mouse_sprite.y: ]2 O: ]& }7 y/ m
  322.   end4 Y1 Z1 u4 M" \  T7 W/ ^
  323.   #--------------------------------------------------------------------------5 U: e# ]5 f, c1 x6 j8 t( ]/ V
  324.   # ● 设置鼠标坐标# R. {& ?" F9 d
  325.   #--------------------------------------------------------------------------+ [8 }! X& C% L0 D7 R/ v
  326.   def set_mouse_pos(new_x, new_y)
    7 Z) J( F% |4 T) X
  327.     arg = [0, 0].pack('ll')
    # d+ R, ]5 ~# ]& X; c* f' N2 y
  328.     Screen_To_Client.call(Window_Hwnd, arg)  ?% `& O/ S* M7 g+ z
  329.     x, y  = arg.unpack('ll')
    2 @4 L( g# _7 e. _
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    : @3 m/ B, {+ k+ ?" g
  331.   end( F" o5 U2 d2 T+ k4 w
  332. end #end of class  self
    6 O" d" K( [0 g. {* w7 v, q
  333. 2 H2 Q1 p1 ~; o
  334. end) w) l7 U* e0 g9 W( i' E
  335. , x0 t" Z, Q" h+ e: U# z! E/ Q
  336. #==============================================================================4 Q# E' ~3 a3 h" y! D9 f; m) v" i
  337. # ■ SceneManager
    3 L, k+ K5 M, f/ U* }3 i! ^9 l
  338. #==============================================================================5 P( T' s' o/ l2 R/ \3 |
  339. class  SceneManager2 b3 I- C8 _9 r( F% _
  340.   #--------------------------------------------------------------------------. |- O" r8 r) x, C
  341.   # ● alias' l) A: o( N6 n: K
  342.   #--------------------------------------------------------------------------
    , [. F- g9 R+ `+ \6 x8 q* D% I( r6 f
  343.   unless self.method_defined(sion_mouse_run)1 [6 p* V) K" T+ d; h! G% {+ ^. ?& g
  344.     alias_method sion_mouse_run, run
    1 y9 z( m3 \; W- o1 A
  345.     alias_method sion_mouse_call, call9 j) b# T* P1 u6 r' _; h% I; A1 n
  346.     alias_method sion_mouse_return, return) ?8 Z0 g6 z6 O6 a, n3 W$ ~3 m
  347.   end$ t+ g! ^' c% P- a" `
  348.   #--------------------------------------------------------------------------) R, _5 P1 a% _6 b
  349.   # ● 运行
    & U& d5 Y: C4 }4 ]0 J
  350.   #--------------------------------------------------------------------------  l1 u7 q0 E$ }. A& \! M
  351.   def run4 G- V6 g6 g2 V- \3 m
  352.     Mouse.init( _" G% k0 C& n2 A; H( ~
  353.     sion_mouse_run
    ' y% X5 t& \* X5 f- \& k
  354.   end! h4 Q7 J) W- A
  355.   #--------------------------------------------------------------------------
    9 L+ ?( W4 _( n& d# n
  356.   # ● 切换$ X% R5 P6 z" O5 B/ a. z  c5 M
  357.   #--------------------------------------------------------------------------
    1 p; h) o; V5 L# @
  358.   def call(scene_class)
    , l7 J! j* l+ a4 X  g# c
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)
    5 V0 L* Q) {0 P1 [9 ~$ G( z/ y
  360.     sion_mouse_call(scene_class)6 X2 {) ?* C0 T+ ~- O
  361.   end- c: K; W$ W3 O3 q& ^- p! S* w
  362.   #--------------------------------------------------------------------------0 l% f* p* q5 G* h/ F
  363.   # ● 返回到上一个场景  Q2 h  ~. u0 t0 ]9 g8 F* J
  364.   #--------------------------------------------------------------------------! g$ f, R+ x/ t( t9 P4 u: ~
  365.   def return* I; w. U% q" a$ E8 I
  366.     sion_mouse_return
    ! N! f1 C% V; z( S( D% C
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&( m9 l) ^  ^9 T1 j9 u
  368.       @scene.instance_of(Scene_Map)
    % g1 j0 J2 @8 V0 @& I8 ~+ i
  369.   end
    5 b7 q; F) D' Z4 |- M, [- I, z3 ~
  370. end- y/ e! u% O- A: x

  371. 0 @, J; o; p6 \' a' a) X
  372. #==============================================================================
    ) X+ s/ ?: j; l( Q, z
  373. # ■ Module Input; C1 |% m3 q' L4 |( l2 r& z
  374. #==============================================================================
    : |) q; k0 \( c: K
  375. class  Input' l& p% {8 P1 I& S; i; b
  376.   #--------------------------------------------------------------------------
    2 z; E3 {8 |* z: M8 Z
  377.   # ● alias! W. s+ K4 E, d; ?& _
  378.   #--------------------------------------------------------------------------
    ) z( s0 O2 |3 {3 r- }* |( @1 p. A
  379.   unless self.method_defined(sion_mouse_update)
    % c; V' m! c3 E1 V9 t: {
  380.     alias_method sion_mouse_update,   update. U5 i2 e% \( M2 O
  381.     alias_method sion_mouse_press,   press; V) A+ h) y$ C; i, G+ T' k1 U
  382.     alias_method sion_mouse_trigger, trigger+ _2 y, t5 t" ^
  383.     alias_method sion_mouse_repeat,  repeat
    2 \6 p) S4 Z* r' J. s$ N7 _& ~
  384.   end- U& K; O% [9 j7 w
  385.   #--------------------------------------------------------------------------
    , X# v  @/ _9 @! e0 e4 r# }+ J, @
  386.   # ● 更新鼠标+ v1 S# C! K; ]1 ~6 \! O( O
  387.   #--------------------------------------------------------------------------% X: t" Y4 y7 V% n; O$ n3 K! G  \
  388.   def update
    + C, X! ^3 ~# k: }8 h- d
  389.     Mouse.update
    ; Q" e7 q0 _* ]
  390.     sion_mouse_update
    % x- k' K7 R" v$ V; o- J
  391.   end2 b% x8 K* }" R/ `" s2 d8 ^" }# M
  392.   #--------------------------------------------------------------------------& Y6 w2 b7 Y' N+ C- p# [
  393.   # ● 按键被按下就返回true
    $ I5 L5 N3 Z2 l; C+ c
  394.   #--------------------------------------------------------------------------* Z3 [2 `; n1 m) A( ]
  395.   def press(key)- J6 _% T3 z7 R% `- }
  396.     return true if sion_mouse_press(key)
    : f* C3 x/ P  K( i: E  H( I# [9 l
  397.     return Mouse.press(0x01) if key == C6 n4 j1 S. M% e# R0 w: x' Z$ l
  398.     return Mouse.press(0x02) if key == B6 M$ U4 h+ {9 H% D5 ~8 B3 Q
  399.     return false
    6 o, z, |9 }7 o" I
  400.   end
    $ k' p- Y" m7 x* M5 Z* r
  401.   #--------------------------------------------------------------------------7 L9 |) s. Y  i: E0 Z& J9 {
  402.   # ● 按键刚被按下则返回true
    & D1 T& h9 R; z! @
  403.   #--------------------------------------------------------------------------
    . a, A) C# I/ Q/ q# H& e# ~. g
  404.   def trigger(key)( R. j1 `4 t7 l
  405.     return true if sion_mouse_trigger(key)
    0 n' |' [. R: p# ]+ u# r, a
  406.     return Mouse.trigger(0x01) if key == C
    2 z& Z* g& X- Y9 |
  407.     return Mouse.trigger(0x02) if key == B
    ; Z" Q3 C( j8 `
  408.     return false6 w$ l9 X' M  G7 l  T5 h. {
  409.   end$ ]1 G8 E5 D9 }! s/ t
  410.   #--------------------------------------------------------------------------7 I; {6 ^) d( S( t9 m8 h
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    3 o3 P! p# K- A4 ^
  412.   #--------------------------------------------------------------------------
    9 ^7 a3 S7 N* `6 a7 ^
  413.   def repeat(key)
    1 L8 Q: F! g/ ^1 L+ S( b4 t6 W4 M
  414.     return true if sion_mouse_repeat(key); G: f2 j1 U. o: B7 I
  415.     return Mouse.repeat(0x01) if key == C$ l: A  v$ t$ k' ?, Q) C0 w
  416.     return Mouse.repeat(0x02) if key == B. d0 k, j$ z/ B
  417.     return false
    " \. l5 ~; m( H5 }
  418.   end3 k; C) C+ I4 d+ g; {
  419. end
    $ D# Z+ h: K9 f

  420. 2 a6 s3 }: e- F0 r: M  x

  421. * B$ E/ h- Y5 |9 E
  422. #==============================================================================7 @7 f( d% f. E  B: B" B. \
  423. # ■ Window_Selectable/ \( d4 B1 @5 F9 }# \( N$ l
  424. #------------------------------------------------------------------------------# Z; `+ h5 `% B& R" ~1 q$ h' P
  425. #  拥有光标移动、滚动功能的窗口/ [" H* X: S" U; Y6 P
  426. #==============================================================================
    . i( E) s/ G3 j
  427. class Window_Selectable
    " C/ Q/ Z9 L- f, n) d
  428.   #--------------------------------------------------------------------------
    % |! l& y+ Z4 n  z4 M  o
  429.   # ● 初始化
    ! e, d, _4 q4 G7 k6 l. F
  430.   #--------------------------------------------------------------------------
    1 ~- m# c9 P+ N  r* D0 ?
  431.   alias sion_mouse_initialize initialize
    8 o. o* t; d& h9 J8 _) @" `. X* v
  432.   def initialize(x, y, width, height)9 s7 |2 O5 Z+ \! }1 z. Y
  433.     sion_mouse_initialize(x, y, width, height)
    3 ^+ x% b- N' y+ p5 ^- M
  434.     @move_state = 0  h2 @8 `( x- S/ b! H! [: O
  435.   end
    3 Q4 o, `7 C2 I" h$ T5 z8 c: R( S
  436.   #--------------------------------------------------------------------------, r, u; R0 u; w: }2 F& ]: k  f# V
  437.   # ● 更新/ G- B4 H8 `9 s. T" X5 X
  438.   #--------------------------------------------------------------------------
    / ]" ]+ n+ k- j9 I
  439.   alias sion_mouse_update update
    4 a  p! Y4 P+ `* ^0 s5 ^4 R% ?' w
  440.   def update. D9 q! C( G; U" c0 S
  441.     sion_mouse_update
    . c  G# D/ U  s# i( F
  442.     update_mouse_cursor
    2 E5 ]& c; _! M8 P7 Y$ f9 B; Y7 z! y
  443.   end- A5 o4 U1 U  Y9 i" ~3 j
  444.   #--------------------------------------------------------------------------9 r7 T% N: s/ e, ~; }5 W* Z1 t
  445.   # ● 启动后设置鼠标到index位置: y: E* N: g( r: W* a  j
  446.   #--------------------------------------------------------------------------
    7 P3 n. l; B% e* T. \2 P3 o1 r3 D
  447.   def activate
    - g- U$ X% F: ?9 k7 b2 D/ z- [
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    $ W" H7 r8 o) ?( j1 ]
  449.     super9 I. q+ o' ]& G. }& O
  450.   end; A+ f: F9 a% x/ l# F2 R
  451.   #--------------------------------------------------------------------------1 V  e4 |2 J. x  W5 r- A+ ~  e
  452.   # ● 更新鼠标和光标的位置; }4 u6 e6 b" }$ n" {) L
  453.   #--------------------------------------------------------------------------
    , w8 m. b' K( y. Y- u* c
  454.   def update_mouse_cursor
    / w/ |+ m" {( l" o' v
  455.     if active5 x% O! x( v2 q% ]" I- U
  456.       if @need_set_pos
    : N9 O* D5 B6 a$ t+ p
  457.         @need_set_pos = nil
    % }% E3 {+ l; Z6 x* _
  458.         set_mouse_pos
    4 m2 ?' ]" k- K+ |: N
  459.       elsif cursor_movable$ t+ U" v% ~3 m. ]
  460.         Input.dir4.zero  set_cursor  set_mouse_pos0 d* ]8 ^- D* ~$ x  D  w( j, D
  461.       end
    ' q/ u+ U' }( L7 l. \( `" P8 Y" L
  462.     end
    " I0 L  p/ ^  q5 X) V0 J9 i
  463.   end
    7 `0 B" k( p1 R; ^( y0 ]" J  K
  464.   #--------------------------------------------------------------------------
    % M  V+ J) Q+ E* x! Z2 I6 }
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能
      L" c5 y: b1 G5 g
  466.   #--------------------------------------------------------------------------) h4 m$ ~7 T% U3 e# [: s! o
  467.   def set_cursor
    $ ^1 R4 Y+ o4 X* k1 @) f( Q
  468.     mouse_row, mouse_col = mouse_window_area
    3 Y5 I4 q; y+ a( Z. s
  469.     if    mouse_row == -18 L/ d8 h' `0 O
  470.       @move_state += 1 if need_scroll! G$ a2 z# D& X) J5 L
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand* B* {3 @3 H5 Q7 F1 W! }
  472.     elsif mouse_row == -2) g$ V  Y% ~4 Z, S' s& Y8 Z
  473.       @move_state += 1 if need_scroll5 w9 v* [" P  ~, g4 |
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    7 K; U  u, D+ u0 ^
  475.     elsif mouse_col == -16 S# U" t# F5 D6 f" m
  476.       @move_state += 1 if need_scroll
    6 z  O: ~! H" [1 }" @
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    $ C- u9 K9 C  _3 i+ H3 {
  478.     elsif mouse_col == -2/ G8 v4 i3 q5 ~) A2 \) q4 [: n
  479.       @move_state += 1 if need_scroll5 }0 `$ F# }& j0 \* e$ i7 T
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
    2 |6 g! _9 R2 Q) U, Q
  481.     else8 u% t# _+ B7 X0 R
  482.       @move_state = 0
    2 d: \  g" I8 c6 i
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col/ G* O( ], o/ d: M. J
  484.       select(new_index) if new_index  item_max && new_index != @index
    $ C6 N! A7 A  S3 E/ X  I
  485.     end& [* M7 b1 l1 V+ k& k
  486.   end2 r6 q" T- Y1 ~9 b. S3 I0 ~+ _
  487.   #--------------------------------------------------------------------------
    % n2 d! S0 q' Q; Y% ?6 ~7 h( ]
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    % u3 z: ^, u  ?  l/ G
  489.   #--------------------------------------------------------------------------; o( Q5 K9 {- I8 r/ X2 L9 p
  490.   def mouse_window_area
    3 k) h3 `8 }1 f0 b9 N( c: c
  491.     if viewport.nil # necessary!
    ! M0 T  Y7 s+ O, V. q% W) ], f; x
  492.       vp_x, vp_y = 0, 02 i4 ?6 W5 O5 @; D9 ]
  493.     else3 z( ]' q! B, Y1 o( P
  494.       vp_x = viewport.rect.x - viewport.ox
    0 K% L) F- I4 I8 I3 [" }
  495.       vp_y = viewport.rect.y - viewport.oy4 B1 q- L; E4 p! ]1 D/ S/ W) ^
  496.     end$ Z+ ?3 \# p% x7 l
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y7 l& Z/ L' A$ x
  498.     item_x1 = vp_x + x + standard_padding
    7 m' Y4 ]. T7 D# r# C
  499.     item_y1 = vp_y + y + standard_padding
    , P/ z, A) r8 t9 V
  500.     item_x2 = vp_x + x - standard_padding + width& P6 z! m* T# g, ^7 J. |
  501.     item_y2 = vp_y + y - standard_padding + height
    2 u) R) K6 ?. h' h8 b$ U8 r( f8 Y/ r
  502.     if mouse_x  item_x1! _8 n1 p% b0 y$ F
  503.       mouse_col = -1
    + M/ T( Q7 V3 E4 `4 J3 d! u
  504.     elsif mouse_x  item_x23 `* U6 J; p0 R6 q+ b9 b
  505.       mouse_col = -2
    ' n, c) g* F9 |# N
  506.     else6 a0 d; v5 V! F7 I5 u5 U- E8 ]2 a
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)6 l2 R- l* l: {  K! O9 f
  508.     end" n4 a# s( t4 k- i
  509.     if mouse_y  item_y16 b" X3 [7 x$ |/ D# |; G
  510.       mouse_row = -1
    . Z; s$ l2 s7 E3 u9 u
  511.     elsif mouse_y  item_y2( a. ^! M5 S, ~" {' d
  512.       mouse_row = -2
    6 r, R1 ^9 v0 O$ g& s- c8 n8 }
  513.     else3 [. W) y+ o3 K- _( n# n9 Q
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)  @, o$ v. U  J
  515.     end
    $ }& V/ m: o4 w3 E# ?+ N( A9 D* ?
  516.     return mouse_row, mouse_col
    ) a( y& H) L1 Y# f( e, Y7 {$ O: K) H
  517.   end0 K* p1 d' e9 ~8 i
  518.   #--------------------------------------------------------------------------: {7 Y! P2 q4 i# |; R# q' z
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置5 \0 D1 l$ d8 E& h8 @  a8 T
  520.   #--------------------------------------------------------------------------  n" d' a) Z6 j% R) J' t
  521.   def set_mouse_pos
    + E" n5 q* ~! S$ H# u3 y( i
  522.     if viewport.nil # necessary!( g: l, a/ V, l( `) c  u* ?
  523.       vp_x, vp_y = 0, 08 f& ^! B* S4 t" x2 E
  524.     else) j2 W6 p3 L# h
  525.       vp_x = viewport.rect.x - viewport.ox
    % G& M: c& P3 n+ q8 [
  526.       vp_y = viewport.rect.y - viewport.oy
    5 D2 ?0 K0 _) K9 n9 J
  527.     end& s6 V2 y/ n( E7 [; ]6 C1 k6 Z
  528.     item_x1 = vp_x + x + standard_padding
    9 c: Z1 a/ D$ C/ O) K5 V) P
  529.     item_y1 = vp_y + y + standard_padding( {7 \) r! P! P7 w
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index / c5 {# j4 I6 V! n5 n, h$ W
  531.     row = get_index  col_max - top_row
    # s9 h+ j9 Y9 M0 X6 K
  532.     col = get_index % col_max  {( F6 g% T+ Z' p+ Y) s! c
  533.     new_x = item_x1 + item_width  (col + 0.5)1 f% \4 @- g" q; ^& h0 b  a
  534.     new_y = item_y1 + item_height  (row + 0.5)
    " P' K* [2 D2 ?5 o5 W
  535.     Mouse.set_mouse_pos(new_x, new_y)& X  d+ O7 B# I/ ~
  536.   end
    ( `( B" W0 e% Y3 T  N
  537.   #--------------------------------------------------------------------------
    ( I6 t  F" B% A1 T4 \5 n
  538.   # ● 判断菜单是否需要卷动9 {, T5 J1 |6 B
  539.   #--------------------------------------------------------------------------- j2 k; t" y! K. W- X: ?
  540.   def need_scroll# L+ E9 E3 z5 r1 n& h; ]+ E
  541.     item_max  col_max  page_row_max
    ; x, P2 V% C: s7 q! ]
  542.   end* B) g3 D4 b, Q' P% M
  543.   #--------------------------------------------------------------------------# H) H* X# L2 S. n9 e- o' T6 s
  544.   # ● 判断是否为水平卷动菜单5 Y, }( O4 G) I3 s4 S. w( `, u3 d# Q
  545.   #--------------------------------------------------------------------------, t- n' {! a0 M: J5 L; u* C- o
  546.   def is_horzcommand
    & V$ [( B" `1 o4 k  {
  547.     return false6 M. c6 g* s- c. M% h
  548.   end
    3 ?# O3 t* G$ I$ ^" A, X+ P
  549. end# N) v! ~. K: o, a

  550. 4 k# q2 K* u5 d# H( o) S4 T
  551. class Window_HorzCommand4 h# v" w5 [, D0 |* `& s4 v$ p
  552.   #--------------------------------------------------------------------------  `4 h7 r" J7 E2 w! J& L
  553.   # ● 判断是否为水平卷动菜单
    6 [) T: y# ]. P
  554.   #--------------------------------------------------------------------------
    ) j$ Y- Z2 E' q; `7 n9 P' F3 n
  555.   def is_horzcommand+ {/ G/ u3 ?* @) H
  556.     return true6 h) p7 I' |8 x' y" Z
  557.   end
    % s9 V9 c+ ?7 D% d$ g
  558. end
    ; i" W; I; W' [  f/ z# O' X+ U4 D

  559. ( M& K7 \& [& r& d7 h5 B4 [* h
  560. #==============================================================================
    ! o7 W& W: Z2 R% l& x
  561. # ■ Window_NameInput
    , c! n4 `) `  V3 l) S  F
  562. #------------------------------------------------------------------------------: A& f9 m0 _: d, n2 i; b8 ~) [3 N
  563. #  名字输入画面中,选择文字的窗口。0 Y' D& M( S) |4 G5 ^7 [, ~
  564. #==============================================================================
    0 K; O% M6 k5 `- Y" l" a  g5 x4 |
  565. class Window_NameInput
    ( V6 ^% B  I/ t0 V; {1 V/ h! ~
  566.   #--------------------------------------------------------------------------' h( f. f4 v6 S  j
  567.   # ● 设置列数
    * z0 U0 J2 |# h" N3 {
  568.   #--------------------------------------------------------------------------
    # _8 A& z8 @/ A! u0 l
  569.   def col_max/ r: H: n1 e/ }2 g0 E4 u
  570.     return 102 b' |9 ~; O2 V3 p; G
  571.   end
    $ X5 ]5 E& p; o* B) u9 K, Q% a
  572.   #--------------------------------------------------------------------------# m4 O9 b. @3 k2 G4 j
  573.   # ● 设置填充的Item个数
    5 H" e5 d( h5 X
  574.   #--------------------------------------------------------------------------$ o" ~/ L/ V2 h% Q) u8 q+ |" X
  575.   def item_max
    0 V) O9 K4 `* A
  576.     return 90
    & B" L" D+ ~5 v" p
  577.   end
    9 s" a  d% ]5 A. j/ @/ _
  578.   #--------------------------------------------------------------------------
    / ^& J4 F; {4 [" ?
  579.   # ● 设置填充的Item个数
    . L8 g1 y7 n* o8 v+ I
  580.   #--------------------------------------------------------------------------) b6 X* w* G' T% ~4 y
  581.   def item_width2 ~0 ?) l1 s- l) U( q
  582.     return 32! ^! G$ S3 K2 F0 b5 e2 i2 _/ A
  583.   end
    2 L' K# g+ Z4 g5 q1 T8 c5 C
  584.   #--------------------------------------------------------------------------) P# K! {2 B. `8 Q; b( F0 R
  585.   # ● 判断鼠标位于菜单的第几行、第几列! M* ]) D3 I3 N, K
  586.   #--------------------------------------------------------------------------
    & U9 l9 J5 M! D
  587.   def mouse_window_area3 T& I) m, k7 `( S
  588.     if viewport.nil( \) s2 @$ L. G) u8 E1 b3 ?# G4 G
  589.       vp_x, vp_y = 0, 06 m0 Y. O! z" T! a8 `
  590.     else
    . v+ ^8 Y& W( s5 u5 Z+ r+ l9 @
  591.       vp_x = viewport.rect.x - viewport.ox
    0 r4 m2 d: [% {7 t) y. l; n5 Y
  592.       vp_y = viewport.rect.y - viewport.oy
    0 D# B' R: L6 B/ ~
  593.     end
    2 P  ~, V& n! h" K# t3 P( l
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y6 r/ A9 [8 ]+ U" O& w: X# ~5 u9 ]
  595.     item_x1 = vp_x + x + standard_padding
    " d& j$ M: j$ S3 `' ?
  596.     item_y1 = vp_y + y + standard_padding! l# S5 H' l3 u4 }$ D1 w
  597.     item_x2 = vp_x + x - standard_padding + width
    6 }" w' `3 ]( ?* L+ P
  598.     item_y2 = vp_y + y - standard_padding + height
    5 L1 x6 I+ s% P  b* j9 t  b6 S0 b
  599.     if mouse_x  item_x1
    5 \- c# t, X1 x& W2 h
  600.       mouse_col = -1
    * E# g0 J' @- t: E
  601.     elsif mouse_x  item_x21 x! T; D0 q7 C4 A! X6 Y
  602.       mouse_col = -29 U) o, ^  O% V" u3 h
  603.     elsif mouse_x  item_x1 + 160: D+ D6 G% E' M- C. S! }
  604.       mouse_col = (mouse_x - item_x1)32
    % l* K& ~/ g% g4 C, `- _
  605.     elsif mouse_x  item_x2 - 160
    8 U/ G$ I+ N. `' b, g
  606.       mouse_col = 9 - (item_x2 - mouse_x)32
    4 Y/ L7 l' p9 u1 n$ L! s; G9 u
  607.     else" g0 x4 f$ w2 L
  608.       mouse_col = mouse_x  x + width2  5  4" X& e5 g3 z1 c8 r
  609.     end# [: O+ v" G( \0 l$ B! b
  610.     if mouse_y  item_y1+ |- j; y3 e2 G. B6 A* t
  611.       mouse_row = -1
    8 }7 V) `$ }5 r
  612.     elsif mouse_y  item_y2
    5 S/ d# V+ {) j* }. {' k
  613.       mouse_row = -24 T+ _  b' l+ X) I6 L4 z
  614.     else+ l6 Z9 t0 b- L' u* z. W
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1); b5 U/ W+ `8 m2 M$ y
  616.     end
    & d* q3 \: r* ?) j8 G/ Y$ T% V7 P" `
  617.     return mouse_row, mouse_col
    6 G% f$ j- g8 e
  618.   end, T& W% O; L6 [* B* d7 V  e- R. G
  619.   #--------------------------------------------------------------------------
    # V* f1 }9 ?3 Q
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    " _: `7 i  t4 B. I
  621.   #--------------------------------------------------------------------------
    $ h: J& ]; g3 N. L" y
  622.   def set_mouse_pos
    0 I3 n4 v2 M: g* h; z, ?; c
  623.     if viewport.nil # necessary!
    1 z' V7 \2 L7 H1 M) N
  624.       vp_x, vp_y = 0, 0
    ; c0 `- o0 v4 e/ K5 Y
  625.     else, `3 \) [4 z. X$ ]9 q: A
  626.       vp_x = viewport.rect.x - viewport.ox0 d3 f( T% f$ {8 a9 [# h
  627.       vp_y = viewport.rect.y - viewport.oy$ c; _; h3 d! I) A
  628.     end$ q4 \" O4 C0 _; ]% V6 p
  629.     item_x1 = vp_x + x + standard_padding % d: {9 K6 I2 k$ |  q" a
  630.     item_y1 = vp_y + y + standard_padding  J+ x9 L6 ^; m3 t
  631.     get_index = @index  0  0  @index
    1 s& V2 C4 W* T: a) `; y$ j
  632.     row = get_index  col_max - top_row" V) z! E8 s/ M' _, B$ ]; d8 j
  633.     col = get_index % col_max
    ( H6 `; U9 r5 A( o# o8 U& {
  634.     new_x = item_x1 + item_width  (col + 0.5)6 r- {. [7 ?0 K' B* t
  635.     new_y = item_y1 + item_height  (row + 0.5)
    % ]3 U# s' n) s
  636.     new_x += 14 if col  4
    & C' @' r' E0 `+ k1 Y6 `
  637.     Mouse.set_mouse_pos(new_x, new_y)  R, L  _+ u' u5 ]2 U0 |( U
  638.   end
    ! f: {% J5 Q. J7 R2 g$ D" h" C
  639. end/ c* @' c. k$ }: g5 q( U

  640. : r/ q4 T, m1 M3 A2 |2 h
  641. #==============================================================================4 d! a6 [6 p: L* z# m
  642. # ■ Window_NumberInput
    8 ^% d  _, Z% K
  643. #------------------------------------------------------------------------------4 |& \+ }  |, k# _$ M2 z( I
  644. #  重写了数值输入的方法以适应鼠标
    / O7 {$ B! B( e
  645. #==============================================================================5 f6 W3 o2 S# I3 l7 s
  646. class Window_NumberInput  Window_Base" b3 O- G( K0 X
  647.   #--------------------------------------------------------------------------
    4 m6 Z& v& v6 d! Y" E
  648.   # ● 定义实例变量
    1 B) F4 |6 C; W! f0 N+ h7 F
  649.   #--------------------------------------------------------------------------
    : J# f& s) ]1 k. u' I
  650.   attr_reader extra_window
    * d  `, M: O5 j" C3 }
  651.   #--------------------------------------------------------------------------
    0 G+ I- E' Y# U
  652.   # ● 初始化
    2 @- \3 Y8 h- g7 m3 Z' i8 U* @* v
  653.   #--------------------------------------------------------------------------3 r. Y5 H  b! ?4 Y
  654.   alias sion_mouse_initialize initialize
    1 p0 @- b* [+ T1 H
  655.   def initialize(arg)
    5 u5 ~' z0 s8 b" \# w0 P+ ?
  656.     sion_mouse_initialize(arg)+ `! A% Q" t  L. _
  657.     create_extra_window
    1 X5 n3 o' }; K1 _! o) N( T
  658.   end  x- ?1 M- P  a" S2 F
  659.   #--------------------------------------------------------------------------
    1 S. F0 e5 I5 P- W% }
  660.   # ● 启动9 X2 R) W7 F' b* O
  661.   #--------------------------------------------------------------------------1 t2 D2 ^: v$ }; b% _6 Q$ ^
  662.   alias sion_mouse_start start
    $ X9 `5 h; k: }3 [
  663.   def start
    5 j: U7 v1 @8 z  b$ x& M
  664.     sion_mouse_start
    ) t/ ^- v" q) N" q7 _& [4 n! ~
  665.     deactivate" D4 i1 O" n( d' I- n  {
  666.     extra_start
    ) V+ K, A. ^* f, \6 h5 q
  667.   end6 l7 P. z- D! R* I2 k% Y; h
  668.   #--------------------------------------------------------------------------! |  ]9 d& i( j# Y
  669.   # ● 创建新的数值输入窗口
    0 R" s( Q% d/ ^
  670.   #--------------------------------------------------------------------------
    & ^7 x9 [7 w5 a% t" [
  671.   def create_extra_window1 \( ~+ E9 q' x7 K: v# a5 H
  672.     @extra_window = Window_NumberInput_Ex.new
    9 k$ s4 e% S2 n+ w& C
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2$ d/ _7 E" w# t: ~4 \1 M( T% ^
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }
    $ T! O+ n, U  p6 u
  675.     @extra_window.index_proc   = Proc.new {n @index = n }7 |0 V) ]# w/ Q. o6 U" ]
  676.     @extra_window.close_proc   = Proc.new { close }
    - _/ t8 W3 R1 r8 k* z2 ~& Q
  677.     @extra_window.refresh_proc = Proc.new { refresh }( h9 y% u; ?2 U$ X: c
  678.   end% C8 h! j4 G/ v9 K, F0 ^, C# m
  679.   #--------------------------------------------------------------------------
    ! g# z: e, b9 l8 [" W8 ~; ~
  680.   # ● 激活新窗口
    9 y8 _9 ^, ?. I3 E  S  F
  681.   #--------------------------------------------------------------------------& c, I0 t3 }/ q1 ?( {
  682.   def extra_start
    % y, `/ m8 ?0 C7 _4 [- ]* i- t
  683.     case $game_message.position
    5 M$ b/ Z4 R3 I0 m$ ]- y: ?) }, o
  684.       when 0; @extra_window.y = y + height + 48 z* I( \" z5 p
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8- b* V# k$ c. L/ `* N8 S
  686.       when 2; @extra_window.y = y - @extra_window.height - 4
    # b( j! B" T( w! i) P1 M1 O/ J
  687.       else  ; @extra_window.y = 8
    & U' X  c) s" x7 R
  688.     end9 a* E* O2 v; A
  689.     @extra_window.variable_id = $game_message.num_input_variable_id/ P' P8 h+ O( V& a" j  G# `
  690.     @extra_window.digits_max  = @digits_max
    ! O' C6 m2 ]7 L/ Z, ^
  691.     @extra_window.number      = @number
    ; G3 I+ t1 _6 O- a9 T) ?
  692.     @extra_window.open2 P: ?9 x; m0 @* @) e% L
  693.     @extra_window.activate
    & E) l3 x- a& g
  694.   end* B. R% K4 e4 _2 I
  695.   #--------------------------------------------------------------------------' R! r' y0 \- i9 E- z: V
  696.   # ● 更新' ]+ f3 z/ i* z  T- ]
  697.   #--------------------------------------------------------------------------
    ) D) c9 d3 \" k( n* F/ I
  698.   def update) ?2 [: f; R# O/ I
  699.     super& E$ ]% \% o* c1 Y4 a* `0 ?
  700.     @extra_window.update$ D. q! j; g$ a0 n* i
  701.     update_cursor% }/ I% Y9 J# f+ V" x$ l
  702.   end* l) u1 u2 g1 b( n# t0 M" i
  703.   #--------------------------------------------------------------------------: K9 p" K$ u/ H
  704.   # ● 关闭窗口
    ( X' g: @, w% M5 P8 M
  705.   #--------------------------------------------------------------------------- }& l$ Q/ J8 T& f- u' K
  706.   def close
    2 A6 _3 V  I: |
  707.     super
    ; m/ \0 c5 Y4 T' ]6 T7 f
  708.     @extra_window.close) o2 Q. J7 g: A( f" u4 Z7 N- @, F
  709.     @extra_window.deactivate) y/ e+ u- B7 R' ]' M
  710.   end9 ?1 B3 {$ y4 N. R- Y* t1 J
  711. end
    3 D; @: N; \+ Z( U5 S  d8 }* c. J% _
  712. ( b% n# _$ b' o
  713. #==============================================================================
    " w) l2 z2 z, A- e6 T6 ~
  714. # ■ Window_NumberInput_Ex
    " ^/ J) {7 V6 G" q+ f- a. {+ S
  715. #------------------------------------------------------------------------------
    ! n, y8 \! z1 }2 b" a: ^# r
  716. #  新的数值输入窗口(NewClass)
    ! r2 d/ a/ t/ @( S8 _
  717. #==============================================================================0 i8 v. ^6 ~! c6 o% D) l# z: H7 `" m1 h
  718. class Window_NumberInput_Ex  Window_Selectable
    - F8 D3 L* U8 w7 F6 t
  719.   #--------------------------------------------------------------------------
    ( W: a* A+ x# H/ P- z; s
  720.   # ● 定义实例变量
    $ L) F( I0 a3 O
  721.   #--------------------------------------------------------------------------$ M9 M8 Z' k: d. K1 m+ f8 X1 {0 W
  722.   attr_accessor number_proc1 |* A+ [' l. Q
  723.   attr_accessor index_proc
    ) b- {/ L& M! E& E+ \% d4 Q" |
  724.   attr_accessor close_proc
    2 \9 k5 L0 ^: k/ T
  725.   attr_accessor refresh_proc
    ' ~( x. [" n% x: _: e
  726.   attr_accessor number
    - E0 q1 N9 e" {) Z& Y% |! E8 W
  727.   attr_accessor digits_max
    ' ]- @) M) [0 ?
  728.   attr_accessor variable_id( e0 V# |% L/ L
  729.   #--------------------------------------------------------------------------
    # [; X6 d: [2 ^- A3 k- ?
  730.   # ● 数字表
    8 P. @( `: R  R5 k7 o
  731.   #--------------------------------------------------------------------------
    2 V4 ]' b1 K+ {5 m. q
  732.   TABLE = [  7,  8,  9,  {- b. o) E( E
  733.              4,  5,  6,3 e5 j( ^6 I4 k* X! s
  734.              1,  2,  3,; e% u. X! `0 i3 B  @; v. `0 s' H# o
  735.             '←',0,'确定',]
    7 ]: {% w- [' G1 Y
  736.   #--------------------------------------------------------------------------0 B2 v. d& F6 B# y% q7 g( m6 u
  737.   # ● 初始化对象" f' {* T. L" v  B
  738.   #--------------------------------------------------------------------------
      {4 }2 F- s8 u1 f* N6 ^4 F# d
  739.   def initialize
    ) K( j" W+ [' Z# X. d( P; S
  740.     super(0, 0, 120, fitting_height(4))3 W- |! W1 w8 X: t9 w/ l) p0 Q$ X
  741.     self.openness = 0, k$ W  N* F1 G# {
  742.     @index = 0  y! f/ U! L& ?
  743.     @number = 0& _+ p: T1 [- d- ]6 W' H. H
  744.     @old_window_index = 0
    - c9 T7 d, Z7 E: ~( k6 s
  745.     @digits_max = 02 F( v8 [7 Q1 `% i6 h
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }
    " e& [; R+ h6 a+ L; d( z8 I8 X
  747.   end' I% b! Z, M: @
  748.   #--------------------------------------------------------------------------
    , o+ Z9 D2 p" D) Y$ T0 ?. T
  749.   # ● 获取项目的绘制矩形9 _$ m9 e! n: a% \. L
  750.   #--------------------------------------------------------------------------: c; R+ l7 n: }0 V% n. U8 I* h  `
  751.   def item_rect(index)1 Y, o6 G" M9 ?3 M0 |8 I$ E: n5 }6 d
  752.     rect = Rect.new
    ' {: S/ ~1 \6 m$ C. @
  753.     rect.x = index % 3  327 z8 |: T9 J2 T) m) Y
  754.     rect.y = index  3  line_height
    ' f6 g  y$ z8 F  v# d6 c
  755.     rect.width = 321 u: \7 r- ^( O: f) ~: e4 u
  756.     rect.height = line_height- q8 m$ s# S7 [+ b& y
  757.     return rect
    ) |4 E6 Q# l9 _5 Y
  758.   end
    : C* p- ^4 Q- \% O
  759.   #--------------------------------------------------------------------------
    + q+ t& _9 x9 v, K0 V
  760.   # ● 将光标设置到鼠标所在的位置
    % M+ B& n3 s# z8 s, F6 G+ H
  761.   #--------------------------------------------------------------------------# B1 @; ~8 D! f" H+ U! b6 {1 E$ H
  762.   def set_cursor
    ; W* H$ k: b) I, x4 K  a$ u' ^
  763.     mouse_row, mouse_col = mouse_window_area
    ) ]3 S8 ^- _" E$ X' F7 ^4 v
  764.     if mouse_row = 0 && mouse_col = 02 k; o7 |9 [, G9 C
  765.       new_index = mouse_row  3 + mouse_col2 i, `: }# ~6 B& G4 h
  766.       select(new_index) if new_index = 11- V/ _" k9 L0 y/ R, z
  767.     end$ a4 b. {) f" N3 D. w6 }
  768.   end
    . Q) ]5 B! p* a0 l4 @( r) o" p) _1 g
  769.   #--------------------------------------------------------------------------
    ) _  s" g: Y/ @2 [
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列4 w$ Y6 T& e: L8 f( Z
  771.   #--------------------------------------------------------------------------
    * C5 l, H4 s" R- z1 j
  772.   def mouse_window_area
    1 Z0 N% q; k0 F% B( N% T3 Y
  773.     if viewport.nil
    5 b; T4 }# k# Y- U
  774.       vp_x, vp_y = 0, 0
    & V) Y# h$ v( m! e# N& b. r) g
  775.     else; j4 ?3 a" y& r8 s
  776.       vp_x = viewport.rect.x - viewport.ox6 Y. T/ m( f! C2 N( i+ T$ G
  777.       vp_y = viewport.rect.y - viewport.oy% A6 _+ t% ~2 N0 C: s
  778.     end
    ! a8 W9 o7 c! v
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    ( \' X6 g# t- c' D
  780.     item_x1 = vp_x + x + standard_padding 4 K9 |, y, \) {& Y5 E& y" N; Z
  781.     item_y1 = vp_y + y + standard_padding. p( i) Z5 s* W7 d, W7 [" H
  782.     item_x2 = vp_x + x - standard_padding + width
    / t) @6 F9 L% M* ^, _
  783.     item_y2 = vp_y + y - standard_padding + height, T- g* B4 T0 q1 V; q
  784.     if mouse_x  item_x1
    ; w$ o/ K6 O% C7 V4 c5 T6 w
  785.       mouse_col = -14 n% ?6 _, @- B0 _$ P+ K0 \9 w
  786.     elsif mouse_x  item_x2
    : ^% r9 B7 ?6 Y6 T( ]4 J, y) Z- \' ^
  787.       mouse_col = -21 _& X$ C. M3 N( k
  788.     else
    * a' B' l7 X) U4 K& `% O' w( _) h
  789.       mouse_col = (mouse_x - item_x1)  32
    0 T4 J5 v* X, K4 M$ E0 w
  790.     end1 h: E. |# I# h5 K8 T. U9 V
  791.     if mouse_y  item_y1* z9 L# N/ f* D. {5 c
  792.       mouse_row = -14 B$ f3 ^, u' }; T; ]) Y$ b
  793.     elsif mouse_y  item_y2
    ; F9 x! A7 o* a# B3 S. o; E. i8 n
  794.       mouse_row = -2
    2 g* p% J( w% x! x
  795.     else
    % B2 g- j' l% i: ~% c
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)$ k4 G3 n& h) T( s7 m9 v: ?& _
  797.     end
    7 l0 p# k- ~6 F" o; N
  798.     return mouse_row, mouse_col% }3 n- t% F' C3 [+ a
  799.   end' J. g  {  G6 k4 i
  800.   #--------------------------------------------------------------------------4 I6 b4 g# ^4 \5 q# o! k
  801.   # ● 获取文字
    * W  ?2 T/ \$ f: |; i$ y) S
  802.   #--------------------------------------------------------------------------
    & ]7 w, T: S1 L! U% e. N
  803.   def get_number7 q$ }$ B5 a+ O  s+ L" X( Z
  804.     return false if @index == 9  @index == 11
    9 X; x# S0 w$ r1 i8 \, p
  805.     return TABLE[@index]
    5 L" y  i" p9 U" G% A9 ?
  806.   end/ F1 l* o' A2 j* J$ K, G: ]
  807.   #--------------------------------------------------------------------------
    + `8 j  ]  n2 s* i
  808.   # ● 判定光标位置是否在“退格”上! @# _% c1 `) g, V# K, V
  809.   #--------------------------------------------------------------------------
    & W& |" H) m. p# @& h
  810.   def is_delete# T; z% `1 i  E7 F. ^
  811.     @index == 93 O- S. N5 @: |) ?" E& d
  812.   end2 z; H8 a/ d4 {- q6 d
  813.   #--------------------------------------------------------------------------9 p! `5 I7 s5 @! z7 F
  814.   # ● 判定光标位置是否在“确定”上. ^% _4 r8 r! p+ g& i+ t
  815.   #--------------------------------------------------------------------------1 b$ r8 n3 U# A
  816.   def is_ok' Z8 ^% p0 F5 Y
  817.     @index == 11
      q- n, x" y3 k, [/ u+ _2 l1 E
  818.   end
    * B% u" j9 _+ V
  819.   #--------------------------------------------------------------------------
    ! q5 V" G; _8 o
  820.   # ● 更新光标
    4 Z& _0 ]/ S& v  X% f% E1 ]* a2 s
  821.   #--------------------------------------------------------------------------! p0 i5 G3 V/ S2 ]; `
  822.   def update_cursor) L# ?  Z: C- b; N4 M
  823.     cursor_rect.set(item_rect(@index))1 l- ~  A0 d# g& F+ Z/ t5 C9 ~
  824.   end
    4 F8 ^" ~& w6 K  l! Y7 ~
  825.   #--------------------------------------------------------------------------
    0 e9 I) |( r) K  Q# m  C; w7 w+ K0 t
  826.   # ● 判定光标是否可以移动0 C# Z# w" S, C, _. B: a
  827.   #--------------------------------------------------------------------------! k# Z% H. t3 N4 e. @, N: [
  828.   def cursor_movable# \+ P4 h8 a* ^6 {$ G4 C' P
  829.     active
    8 a5 b3 ]; k  B/ e5 X9 |9 P
  830.   end  H0 _  x+ Q* Y6 }5 `" L1 k
  831.   #--------------------------------------------------------------------------4 e2 Q( s2 K1 X* u
  832.   # ● 光标向下移动
    / Q! o% ?8 E' t. c! k
  833.   #     wrap  允许循环7 x$ `# G9 t1 ?, w' n7 w* J
  834.   #--------------------------------------------------------------------------; e$ {* R' Q. [8 B+ X( c$ d7 d
  835.   def cursor_down(wrap)! O2 r  K. E# p; c& g* V: d
  836.     if @index  9 or wrap
    ' j) C& x/ o" `6 K5 B: T9 i7 ~
  837.       @index = (index + 3) % 12, @2 H4 P2 c: t0 {/ j% }
  838.     end
    - b: O1 ~, l, p# n/ i
  839.   end) m2 I' a0 {. G$ _9 L; s9 W+ H1 j
  840.   #--------------------------------------------------------------------------& {. I8 L3 M$ i# K: f
  841.   # ● 光标向上移动
    2 {) \' Q% ?" |! E
  842.   #     wrap  允许循环
    7 d8 b8 i5 f- \1 w" Z/ M) n
  843.   #--------------------------------------------------------------------------
    . f$ }. S6 A: \* Q: D# j2 X4 n
  844.   def cursor_up(wrap)
    3 O, t+ m, B) @% ~+ x5 e
  845.     if @index = 3 or wrap1 r$ Q$ ]/ G, C, q
  846.       @index = (index + 9) % 12
    4 T! V( [" q3 g6 ?
  847.     end
    4 u! Z( ~' D- h: R4 p
  848.   end& n; V4 ]0 [7 |" }& a6 P0 C: a, H
  849.   #--------------------------------------------------------------------------% o' F5 q+ l% |2 j, s! x2 \
  850.   # ● 光标向右移动
    & }' L. K0 w# J
  851.   #     wrap  允许循环0 ^1 f  \% e9 z% ^& J2 Z, r5 {
  852.   #--------------------------------------------------------------------------
    # x0 @  }+ U3 |. ^* @
  853.   def cursor_right(wrap)# \, }$ A- k/ A4 x& j& w
  854.     if @index % 3  2
    9 c) j" f, g. i
  855.       @index += 1) I5 ?$ [3 l7 K
  856.     elsif wrap
    " @2 g0 m/ P& a0 S7 f3 y
  857.       @index -= 2/ z1 H& N* Z% b7 i
  858.     end3 S& A9 {  e' Z8 t0 w9 @
  859.   end
    % Q" q$ d$ G" n
  860.   #--------------------------------------------------------------------------4 ^! s, `2 C( J0 a! C0 ^
  861.   # ● 光标向左移动; ~; ?. y7 v6 E  z( ]. j7 K( H1 L
  862.   #     wrap  允许循环. \( [! l; I( C& p
  863.   #--------------------------------------------------------------------------7 z* t+ T) F! t; c3 i
  864.   def cursor_left(wrap)# L) d, c! ]5 O+ ^( ~
  865.     if @index % 3  0
      \3 p4 U5 c8 C' b$ S
  866.       @index -= 1
    . R% m# D; \$ ~' |% d9 n
  867.     elsif wrap
    5 J9 F. K4 I: u( n6 \; c8 `
  868.       @index += 2! F* i/ L* N3 B0 @1 H
  869.     end
    " K* U' ]) b7 R" r3 W2 x* {( [
  870.   end
    ( C5 Y8 {# C7 f( h0 {9 D8 ^; n
  871.   #--------------------------------------------------------------------------
    7 M8 \5 m# M4 p6 Y9 [- Q) S
  872.   # ● 处理光标的移动
    & C/ ]3 D* o" J9 c+ O# F$ }
  873.   #--------------------------------------------------------------------------
    - V9 M4 ?) {% L# u
  874.   def process_cursor_move5 P) H* F: i" J$ C$ O) f
  875.     super5 f) C% \) {$ w7 N8 M
  876.     update_cursor0 n8 E5 S. L; T/ z: p1 Z3 e$ {
  877.   end) y  S" h/ q4 ]& v
  878.   #--------------------------------------------------------------------------
    ! X$ A& n+ L* `% `% s8 H6 G! P
  879.   # ● “确定”、“删除字符”和“取消输入”的处理/ S+ `. b. t4 u* K8 O! \/ [
  880.   #--------------------------------------------------------------------------, {! Z; B9 d. W4 M' N
  881.   def process_handling, d- h8 h0 ]$ p
  882.     return unless open && active
    3 ^4 g6 x1 p( |: r0 l- p8 s
  883.     process_jump if Input.trigger(A)5 L/ Q& ?8 y$ T% Q+ r
  884.     process_back if Input.repeat(B)' k' j' @( z5 r% o
  885.     process_ok   if Input.trigger(C)
    2 C7 o4 Q0 r) `
  886.   end
    * Q, \- u- ~2 X, B* [
  887.   #--------------------------------------------------------------------------1 L- a9 a2 ~8 v0 ~
  888.   # ● 跳转“确定”
    & }, L7 P2 N7 Q4 j; J+ `1 a4 `
  889.   #--------------------------------------------------------------------------% ]2 S! B& n( W/ x5 J$ O
  890.   def process_jump4 `, d  C+ b$ L0 o' ^7 g5 w7 g# N
  891.     if @index != 11* W3 k  g; Y2 V' W; C
  892.       @index = 11
    $ y2 z. F; u9 Q9 b  d
  893.       Sound.play_cursor: a- n3 C4 L* G- a+ w6 K- U
  894.     end! n8 Y) H) k% Q0 n6 L2 d/ I  L
  895.   end7 y$ ]; R/ M/ J7 @- w
  896.   #--------------------------------------------------------------------------! k* O1 p+ i6 \
  897.   # ● 后退一个字符
    * w1 Y( V# s' }1 S4 N6 O: ^" D
  898.   #--------------------------------------------------------------------------
    1 b: L$ S% c+ C* O
  899.   def process_back
    7 K. c0 n2 I8 ]3 A) N/ q
  900.     Sound.play_cancel
    & M0 i' L* Z) M) ~+ C
  901.     place = 10  (@digits_max - 1 - @old_window_index)
    * @9 X& E0 d, f- ?
  902.     n = (@number  place) % 10
    $ U9 d" j7 V/ p7 d: H" A, P
  903.     @number -= n  place' y; c: y4 y; O
  904.     @number_proc.call(@number)
    9 R: m/ G% ?! a% a
  905.     @old_window_index -= 1 if @old_window_index  05 \( n% z" B* P; x6 M6 j2 T# r) [6 K
  906.     @index_proc.call(@old_window_index)) O" j9 C2 ?/ j( O/ b
  907.     @refresh_proc.call# s1 ]; E$ \9 K( Y3 f6 g' m  C
  908.   end' v" C& H! }3 v% V) Q
  909.   #--------------------------------------------------------------------------
    3 h" z; D" _$ p( S6 @" W& o% Q
  910.   # ● 按下确定键时的处理. X3 @3 a1 j1 y( J$ r) F/ l1 A
  911.   #--------------------------------------------------------------------------1 ^- R& q& Q! u) G, R+ T6 q/ o6 ]! u
  912.   def process_ok
    2 x% O. L  e0 t+ F3 y
  913.     if get_number( |; j. v& f, W1 |; i6 ~; b
  914.       Sound.play_cursor
    " q8 Q" A( ]( ]2 `; D
  915.       place = 10  (@digits_max - 1 - @old_window_index)
    7 B: F6 a9 s0 o9 q7 j' g8 X' z
  916.       n = get_number - (@number  place) % 10
    / [- n2 ?, Y1 N/ `
  917.       @number += n  place
    7 T6 i/ Z! U( t& I7 r8 a5 `& X
  918.       @number_proc.call(@number)# k# N! I/ L% k/ c$ I5 o
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1: o! _; S* c. K% W$ ]" v
  920.       @index_proc.call(@old_window_index)
    * Q+ s3 p9 K8 W# j/ C7 u  M
  921.       @refresh_proc.call$ U6 {2 Y, n9 G. a& x
  922.     elsif is_delete
    1 [5 `4 Z/ d: V
  923.       process_back
    1 N6 A# h+ X9 |7 \( y
  924.     elsif is_ok0 S/ p* Q4 i/ z1 j0 t, E
  925.       on_input_ok5 v" `  V1 K  \- T5 J& Y
  926.     end( W: ]3 }, L; Y8 n9 M
  927.   end
    " A6 ]: ~/ n& p. D6 P# o
  928.   #--------------------------------------------------------------------------
    * b; ?! n  v% E# j8 y' V& e
  929.   # ● 确定2 c" Z" U9 r# [2 x' T' H& ?
  930.   #--------------------------------------------------------------------------9 P& X2 a$ m+ H% ~
  931.   def on_input_ok- ]3 }8 d7 e& N6 i% y
  932.     @index = 0
    / A$ ]  s; v# Y# N
  933.     @old_window_index = 00 b6 Z8 n$ C$ |" B
  934.     $game_variables[@variable_id] = @number
    5 M1 r$ S2 }) m! x# Q6 e1 B0 c
  935.     Sound.play_ok3 ?3 s3 H" g7 Y  Z4 L
  936.     @close_proc.call
    3 ]9 \: r; v2 a( R$ ^' g3 l
  937.   end4 M2 _% O' K( a' I3 C: U! g1 r" }
  938.   #--------------------------------------------------------------------------- {0 G; I8 f$ q5 W% ^. Y& V
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    5 c6 h7 M4 q4 F+ A  C
  940.   #--------------------------------------------------------------------------7 B' `* c' q* i! H2 r4 s% ?
  941.   def set_mouse_pos
    ! v  C- D! ?- p0 _: `
  942.     if viewport.nil # necessary!' g1 u7 Q8 o# a, @8 ~* ?
  943.       vp_x, vp_y = 0, 0
    . i, b: `- J( N4 V9 y$ W, m" A" B
  944.     else" [* Y; J0 o  A1 W) O6 h
  945.       vp_x = viewport.rect.x - viewport.ox
    9 @" i3 \5 {9 C* g" H: s* b
  946.       vp_y = viewport.rect.y - viewport.oy
    # S6 M( R# x5 [" m
  947.     end
    " g" Y8 p! b: ~% ]# s0 Z; N( G
  948.     item_x1 = vp_x + x + standard_padding * Y& R2 l$ Y4 e& _
  949.     item_y1 = vp_y + y + standard_padding/ y( `9 B7 U+ r/ H  `
  950.     get_index = @index  0  0  @index . g! U7 l9 Z2 h9 E) K7 i
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)! }4 {9 r+ {) p  \+ n' E( E4 C
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)
    * B; ^  z4 H2 l# W! A
  953.     Mouse.set_mouse_pos(new_x, new_y)/ }  G) Y3 A+ `" W- U7 _
  954.   end( j/ \) x! w/ \) ^7 Q/ K* W
  955. end% s0 V# ^+ d5 b6 c* P

  956. % a9 K9 R) N- b' Q+ b2 ?+ W: n
  957. #==============================================================================9 E  P0 l( R1 q! F" g! G( |- Y7 A
  958. # ■ Window_Message
    * _; b. N6 j9 p
  959. #------------------------------------------------------------------------------6 y1 N3 [0 C- a; B. n/ {
  960. #  显示文字信息的窗口。
    3 v" J; B/ O) m2 n, k0 v
  961. #==============================================================================1 {# f2 H3 A) S
  962. class Window_Message  Window_Base
    7 x, s3 ?/ M$ ?6 `8 U6 K0 f1 p9 L4 H
  963.   #--------------------------------------------------------------------------3 C% V4 X& D9 m) i. K5 Y. a; n) }
  964.   # ● 处理数值的输入(覆盖原方法)
      L  E0 u  R; N8 `! a
  965.   #--------------------------------------------------------------------------
    5 V9 u' j7 j" A! E) D) v. n
  966.   def input_number/ \; I  G2 G* a+ n# W
  967.     @number_window.start
    # B2 x9 R' U5 u& Q# A5 c
  968.     Fiber.yield while @number_window.extra_window.active
    / f  l) ^# ?5 \
  969.   end# }  }2 q. j( I9 m% E
  970. end+ ^" P% i- @" L: R

  971. 1 O! V8 D: n: @2 B% a' B# I
  972. #==============================================================================
    6 c- `7 P1 u+ P" R$ V
  973. # ■ Window_PartyCommand) U- p, t' c+ D; v2 ~3 @0 Z
  974. #------------------------------------------------------------------------------1 ?1 H' D6 T3 O! f9 K9 {; @6 d4 d
  975. #  战斗画面中,选择“战斗/撤退”的窗口。4 V9 m9 H& M0 `: s4 M
  976. #==============================================================================
    + D, d( U2 Q, r/ _; z& z
  977. class Window_PartyCommand  Window_Command
    4 E7 d/ X1 U. X
  978.   #--------------------------------------------------------------------------' A; B* W0 F6 g* B4 I
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置3 b% G( {  i2 Z& Y
  980.   #--------------------------------------------------------------------------
    $ ^: [2 t4 T/ D3 s8 u3 C  M$ @5 `+ T& j5 d
  981.   def set_mouse_pos
    & q/ d! G. ~( w
  982.     if viewport.nil
    * f! `4 c$ b) l  ~' U
  983.       vp_x, vp_y = 0, 0
    . x) L: R4 ]% |% }
  984.     else
    ; I; A- ], v% J1 w) ~
  985.       #vp_x = viewport.rect.x - viewport.ox
    3 D6 D8 B) S& R
  986.       vp_y = viewport.rect.y - viewport.oy! R( J4 O  R+ |0 f' N1 e/ F
  987.     end; X+ R/ O& {- `% a
  988.     item_x1 = x + standard_padding 9 A+ l1 M! P: j7 C3 F
  989.     item_y1 = vp_y + y + standard_padding& t/ I7 I% v: G3 Y9 g  B
  990.     get_index = @index  0  0  @index
    2 L. c( O- V) U1 u8 _6 u- s
  991.     row = get_index  col_max - top_row
    % H. D+ \0 Q' g' ^
  992.     col = get_index % col_max9 S: v6 q9 a. a, F; f
  993.     new_x = item_x1 + item_width  (col + 0.5)
    * A5 o2 b$ ]; Y" Y$ k
  994.     new_y = item_y1 + item_height  (row + 0.5)
    " \% O& Z- T* o; t
  995.     Mouse.set_mouse_pos(new_x, new_y)
    0 d. {6 y7 |8 D2 [7 j) U
  996.   end. P7 I! x& U4 Z% V8 a
  997. end
    : g$ Z1 d% G0 t3 V: j) w0 t

  998. ; x- l2 ^0 s( c; t! K7 I7 I
  999. #==============================================================================# C) y" r; k2 o
  1000. # ■ Window_ActorCommand4 {, z! c. }5 R8 K' M/ e
  1001. #------------------------------------------------------------------------------" z! L) `) c/ @% e5 d) Z1 j
  1002. #  战斗画面中,选择角色行动的窗口。
    & }+ R: _) w. V( j
  1003. #==============================================================================
    - S8 \* ]; L' g
  1004. class Window_ActorCommand  Window_Command; J8 u( p! b% \3 ]. @" ^5 ?
  1005.   #--------------------------------------------------------------------------7 a3 F. X  Q, J. \$ J
  1006.   # ● 方向键移动光标时将鼠标移动到对应的光标位置. k9 L/ u0 L3 C6 w
  1007.   #--------------------------------------------------------------------------' l+ O. s" p& a) A  ]7 [2 p
  1008.   def set_mouse_pos
    ) K# b7 w1 S8 T/ v1 j4 Z/ Y8 q
  1009.     if viewport.nil; s, k; a0 J5 h9 v% T
  1010.       vp_x, vp_y = 0, 0$ Y+ C8 P- `) O7 ?+ m$ z# C
  1011.     else
    . y5 ]" g3 T) d2 q2 {" Y  x- b
  1012.       #vp_x = viewport.rect.x - viewport.ox$ K' c1 e# p; B8 D( L8 D
  1013.       vp_y = viewport.rect.y - viewport.oy
    + u0 ^( S% N! P) M" g- n
  1014.     end* y  Z* d/ @% O) Z( O. M& h  {
  1015.     item_x1 = Graphics.width - width + standard_padding) T6 u- H5 w( B) n+ P
  1016.     item_y1 = vp_y + y + standard_padding
    % B) A+ H+ m. v' O8 c* V3 K( l
  1017.     get_index = @index  0  0  @index 0 E; v9 S: U) _5 F
  1018.     row = get_index  col_max - top_row. k7 _" N* y: o! E! _2 Q2 B0 V
  1019.     col = get_index % col_max% G' D; }* s7 V
  1020.     new_x = item_x1 + item_width  (col + 0.5)
    : ?  Q* l7 P. q) u. E
  1021.     new_y = item_y1 + item_height  (row + 0.5)7 _+ ~4 e0 S; d, _# y1 v% I% l# a
  1022.     Mouse.set_mouse_pos(new_x, new_y)3 _+ ^  k7 P; `2 z8 T0 G
  1023.   end
    7 Q# O+ ^  O  [. V6 }
  1024. end5 ]" w; Q: M& k- i$ H! a, K

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

  2145. : `8 K9 P( k) \9 j* M6 N
  2146. #==============================================================================
    1 y1 `$ U8 n; m; v7 T( [! t
  2147. # ■ Game_Map  `7 ?3 Y+ R1 F$ m- W4 R7 A, Y
  2148. #------------------------------------------------------------------------------. T2 W8 g4 l' N7 s4 `, ~% V0 T
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。, \  [: w6 k% t  @( O9 P( [
  2150. #   本类的实例请参考 $game_map 。6 l6 Y8 N' I- |, {) {
  2151. #==============================================================================
    1 E+ |9 t: y: l" g7 j
  2152. class Game_Map
    " X( E# J: ^5 h. s: L4 K
  2153.   #--------------------------------------------------------------------------
    & W/ m2 F+ a* Q- Z/ O
  2154.   # ● 定义实例变量* t. @) x3 d: W- X* c3 I) C0 Y
  2155.   #--------------------------------------------------------------------------
    5 r/ N$ a& A+ \+ L
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据( j- T& t5 l4 P/ Z6 A( p& o, t
  2157.   attr_reader mouse_map_y # 同上
    6 {( g; Z3 S- D6 X# G6 [/ B) B
  2158.   #--------------------------------------------------------------------------0 _9 J. a- {* t! _
  2159.   # ● 初始化对象. N4 k% P. Y( \$ W4 M
  2160.   #--------------------------------------------------------------------------8 t8 r$ j9 `' b" ]- J) B/ [
  2161.   alias sion_mouse_initialize initialize- r" H# ^: n% T+ B
  2162.   def initialize
    2 U1 ~7 C( J' z1 A8 _) c7 V, A
  2163.     sion_mouse_initialize5 N5 j, c$ v  G# S$ Q3 V' I
  2164.     creat_move_sign  ###
    6 ^1 `1 f5 }; h+ t& N( u' b
  2165.     set_constants" K: z. e5 }+ v, G4 h/ d9 b7 _
  2166.   end
    , _1 \. K; \8 ]) @
  2167.   #--------------------------------------------------------------------------9 n, c3 J# L! F$ q
  2168.   # ● 更新画面8 C7 n0 g5 J( n
  2169.   #     main  事件解释器更新的标志9 a* ~- v6 p: L0 t% }9 A2 P9 i
  2170.   #--------------------------------------------------------------------------
    + a+ j2 l/ b+ a; X
  2171.   alias sion_mouse_update update" ]" k8 N4 R$ |1 g. T  m5 ]
  2172.   def update(main = false)
    2 X: O5 a1 G2 u! _0 l! a
  2173.     sion_mouse_update(main)
    7 k( _7 s+ U) U
  2174.     update_move_sign
    0 _0 B1 i! _" R+ e5 D
  2175.   end' B( ^6 `. T* i$ G9 ~+ }0 V
  2176.   #--------------------------------------------------------------------------
      }+ P& X. \5 i# u1 w9 C
  2177.   # ● 创建显示路径点的事件) J0 P4 y1 m2 [& [% p9 e: \* u
  2178.   #--------------------------------------------------------------------------
    ! ^7 H! f" X2 x2 F" m0 m
  2179.   def creat_move_sign6 k7 ~) Q8 n; b. t; i8 w/ D( ^  I
  2180.     $mouse_move_sign = Move_Sign.new9 v- P% C, h- `( m% _% b+ l% P
  2181.   end& A3 v2 i# L! X" F
  2182.   #--------------------------------------------------------------------------, x6 {: x& e& \
  2183.   # ● 更新显示路径点的事件
    + w+ H( X+ {  [+ v* s/ j. ^
  2184.   #--------------------------------------------------------------------------7 b6 b3 X' E7 |
  2185.   def set_constants, \7 w/ `% w% N
  2186.     @mouse_pos_setted = true
    2 A' l8 H" G2 r3 U  J
  2187.     @set_pos_prepared = false
    $ r3 }9 @( c. F2 @# V
  2188.     @mouse_old_x = 0$ _, P' B# `/ p( G; O
  2189.     @mouse_old_y = 0' z$ [9 E$ N9 ^% N9 T5 g
  2190.   end
    ! g) z- m; W; {( ?" I4 y# a
  2191.   #--------------------------------------------------------------------------' E; X7 x- h9 i; X2 z) Z$ ^5 v
  2192.   # ● 更新显示路径点的事件6 L* J& {/ l8 H, ]8 \
  2193.   #--------------------------------------------------------------------------
    4 Y" |6 V: [9 {, @$ j; [. P9 s
  2194.   def update_move_sign% Q# l( b; Z* O
  2195.     $mouse_move_sign.update; R/ J4 @% ^% T# y
  2196.   end3 z8 v7 _/ x4 N* L8 m8 T, C0 X
  2197.   #--------------------------------------------------------------------------- P% j% s5 k% u9 Z( g
  2198.   # ● 获取鼠标位于的地图块的x、y坐标
    $ D, d' C* M; o9 U& o% _. i
  2199.   #--------------------------------------------------------------------------5 X5 `# w: I' i+ ]% |! h
  2200.   def get_mouse_map_xy
    1 f( s$ `2 w+ d$ J2 C: N4 W$ e
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    & R. u9 v: o9 B5 E
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i)
    . V( ^& l# V9 _5 u/ C
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i)
    ( Q0 G2 K. j3 T0 Y
  2204.   end% P/ A/ J* y  K% s9 z/ E
  2205.   #--------------------------------------------------------------------------4 i: n5 p- X2 |; i- C% B
  2206.   # ● 返回地图画面时重设鼠标坐标
    . R# _% f) }6 ^0 O
  2207.   #--------------------------------------------------------------------------' o5 {  g. O+ p9 a6 K7 l# ?
  2208.   def reset_mouse_pos2 b4 M/ F& I8 T( Q: H
  2209.     return if @mouse_pos_setted
    : s) r! u( A" |/ ]; w7 e
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y)5 t% J0 d* t6 t6 T. T
  2211.     @mouse_pos_setted = true
    % M" v# p/ p* ^. u
  2212.     @set_pos_prepared = false
    ( }" e# E# u) i; n
  2213.   end! a- R1 @' t; u1 |+ N) z
  2214.   #--------------------------------------------------------------------------, a" Q. j4 j! x8 a; E
  2215.   # ● 重设鼠标的坐标
    ) H3 ^/ v( j: \
  2216.   #--------------------------------------------------------------------------' U2 m. J7 g9 |& i5 ]0 e
  2217.   def prepare_reset_mouse_pos
    ; S/ f/ T6 V2 n3 d
  2218.     return if @set_pos_prepared# K6 B% n4 s1 m+ v1 @; @2 K
  2219.     @mouse_pos_setted = false
    6 K0 I4 h0 m6 J5 Y" X
  2220.     @mouse_old_x = Mouse.mouse_x" _- o; _; Z9 a. ~/ a) g
  2221.     @mouse_old_y = Mouse.mouse_y) r" }/ \7 B) o( }3 E' z
  2222.     @set_pos_prepared = true; u: X) ~$ X# `( O  r
  2223.   end
    & F2 j% `% W( z& u$ {
  2224. end
    , h( z6 |+ V. ?
  2225. ; Z; y3 E3 I+ V4 W9 p: `0 A; {( B
  2226. #==============================================================================4 \% G3 @' F6 t4 d% X$ D
  2227. # ■ Spriteset_Map* ^, w% ~/ f( ~9 I* X, S( n
  2228. #------------------------------------------------------------------------------3 ~8 {- Q5 e8 m8 a: Y9 ]( e" s/ @; Z
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。
    - P/ N; L8 _8 E1 ^8 l3 \
  2230. #==============================================================================
    1 @$ u4 I) ~6 x2 E9 n7 Y6 y3 r
  2231. class Spriteset_Map
    % N. I% E3 t: H- \  s
  2232.   #--------------------------------------------------------------------------
    " `& G& I; M3 f1 N
  2233.   # ● 生成路径点精灵0 u& @# K! M3 ]) d4 P  L! C
  2234.   #--------------------------------------------------------------------------6 g0 A/ W. z7 x9 [& J4 t; c! \
  2235.   alias sion_mouse_create_characters create_characters
    + s: C' L2 H. j; e( {5 g& b4 l# M
  2236.   def create_characters0 r" U2 }7 w" g! P# z
  2237.     sion_mouse_create_characters6 E9 |# U% h' g9 E* @. W
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))
    # z+ R$ Q$ H: \* Y! [
  2239.   end- G/ r7 z" R; G7 F. x, r' {
  2240. end3 i4 O1 L( `  u1 J2 @( O
  2241. ! P5 u2 l. p) \1 j5 W
  2242. #==============================================================================9 E0 h$ u$ V! w7 ?/ l
  2243. # ■ Scene_Map
    + G3 b! r8 }4 a6 \
  2244. #------------------------------------------------------------------------------9 z% A0 T& j1 z5 u2 j1 K4 ~& K; G
  2245. #  地图画面
    % ~' q$ G5 h8 q; F. k
  2246. #==============================================================================
    8 o4 a9 u4 i6 g# d, P
  2247. class Scene_Map  Scene_Base- N( H) j# V) R0 R3 x
  2248.   #--------------------------------------------------------------------------
    " @3 E0 `4 U2 E- e
  2249.   # ● 画面更新5 l9 e' i% d  F" `
  2250.   #--------------------------------------------------------------------------
    & `1 J8 I4 C; }7 J
  2251.   alias sion_mouse_update_scene update_scene
    : }: V! y7 x+ M, i
  2252.   def update_scene
    % x8 y( Q5 b/ S4 f; W
  2253.     sion_mouse_update_scene+ V/ y+ _/ u6 Q: X
  2254.     update_mouse_action unless scene_changing/ x3 f2 I# w# h' X: I2 _1 [' E0 T
  2255.   end
    0 U! ?6 H+ b$ \* ^
  2256.   #--------------------------------------------------------------------------
    4 |; R- q* J2 A
  2257.   # ● 场所移动前的处理2 y+ P( O+ m5 p5 [$ O
  2258.   #--------------------------------------------------------------------------
    + j4 }* K. b4 d
  2259.   alias sion_mouse_pre_transfer pre_transfer. @1 b$ @  s! n, I% T' ~0 w- F
  2260.   def pre_transfer
    . I) t5 H3 Y. F1 L
  2261.     $game_player.reset_move_path1 b) q( m4 J/ k# t& m6 u  l/ r- W
  2262.     sion_mouse_pre_transfer
    : ^% l6 E7 ~% E5 u" I! {
  2263.   end: G4 K( m8 o" d8 t, Y9 j
  2264.   #--------------------------------------------------------------------------! h: q% X4 J" U' l' i6 N
  2265.   # ● 监听鼠标左键的按下
    & X" _5 L% h! e+ K3 }
  2266.   #--------------------------------------------------------------------------3 ?+ o* G! q" v" P. y
  2267.   def update_mouse_action5 J" |0 x( h0 @$ ]9 Q8 }
  2268.     $game_player.left_button_action if Mouse.press(0x01)/ f: S' V) d4 b5 [2 M: n9 }
  2269.   end
    + r, t  R2 w# {: S2 ?' `% r) c
  2270. end, j( R: |5 u# l; L

  2271. 3 o  o$ V, p' }, A
  2272. #==============================================================================  N% c  _) N3 a; r- Y6 b
  2273. # ■ Scene_File
    ' S, a& K8 \% f" e/ `
  2274. #------------------------------------------------------------------------------
    ! I/ n; h7 H7 }6 Y# M, J$ j
  2275. #  存档画面和读档画面共同的父类8 O! A0 a4 D2 G+ F2 m
  2276. #==============================================================================
    : ]& A6 P: T) V3 ^0 i. `3 {
  2277. class Scene_File  Scene_MenuBase0 |' p* z0 A' o
  2278.   #--------------------------------------------------------------------------0 K' D. m: Z+ d* Y
  2279.   # ● 开始处理0 u& [* J. o: V) K
  2280.   #--------------------------------------------------------------------------' N5 H9 q( r, t% |7 \- Q( k
  2281.   alias sion_mouse_start start6 _, g' H6 {3 G% }! z  n
  2282.   def start  h- _3 i4 r) u
  2283.     sion_mouse_start- R0 o( b3 L- T5 z) R& c/ I0 y% @
  2284.     @move_state = 0
    % [5 M& o0 W5 q9 ~2 \, @' P
  2285.     set_mouse_pos7 h; E: [8 d5 {+ \: P/ t2 `2 P3 O
  2286.   end7 E& K9 u  ?( @: |- V2 J5 ?
  2287.   #--------------------------------------------------------------------------
    $ S* q" z# r: T0 e. A. H
  2288.   # ● 更新画面, {# X6 }) J0 Y1 i2 I  Q7 R$ F
  2289.   #--------------------------------------------------------------------------) S" S4 J- v; V1 J. ^& {
  2290.   alias sion_mouse_update update/ C5 j1 d' z5 B' T
  2291.   def update  A8 t2 }8 N% T% ?: l
  2292.     sion_mouse_update
    # p5 D( X( t" R  m
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos) P) h) C5 m0 h4 v# \- ?
  2294.   end
    & v8 y& h$ R8 x) r0 _" S1 ?
  2295.   #--------------------------------------------------------------------------1 O9 N4 `! i. U& Z
  2296.   # ● 更新光标
    & H' m' k. y; E5 C# X% K
  2297.   #--------------------------------------------------------------------------
    $ A$ N1 W, Z) s# {1 Y: `0 h: [
  2298.   def set_cursor
    5 N- _$ S) m* v$ o
  2299.     @move_state += 1; F7 c8 ^+ S+ E$ I; q4 d: R
  2300.     last_index = @index
    ; d. s# j* l7 Z1 M. U
  2301.     if mouse_which_window == -2
    " I- d4 [$ Z% r, @
  2302.       if (@move_state - 1) % 6 == 0
      H+ O7 C3 w6 _, q$ E7 \
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1
    / Y+ X1 \( W2 i/ R9 C' Z+ {+ B# Z
  2304.       end
    ! f5 W+ Q% l( @$ _+ z3 q1 B
  2305.     elsif mouse_which_window == -1# ?$ Y. C" ~8 `6 Q# h
  2306.       if (@move_state - 1) % 6 == 0( w$ }. r" Q' {3 }$ D5 ]7 j6 V
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    & Z: d) f/ f$ ]: J
  2308.       end
    $ N: x" L) M& ]0 U; I4 o
  2309.     else
    : C: H6 g1 w1 ~
  2310.       @move_state = 0, `% g& F0 P( Y! e6 _! I
  2311.       @index = top_index + mouse_which_window% S9 L3 f9 K0 D! z( W; p+ ~
  2312.     end8 w5 u; O3 L# I3 q
  2313.     ensure_cursor_visible
    - `1 i& W, y6 r4 S
  2314.     if @index != last_index8 l- R8 J* Y5 D' u# ^. @: E1 `
  2315.       @savefile_windows[last_index].selected = false
    8 L0 f. b2 q7 O1 {, @
  2316.       @savefile_windows[@index].selected = true7 c: A4 i- G$ o, e6 l8 j7 ^- K
  2317.     end
    % H3 D: Y) D0 O) J6 }+ `4 o  r
  2318.   end; [; v* X, K; Z; ^; ^
  2319.   #--------------------------------------------------------------------------
    5 q2 ^! G* F% l% E0 S
  2320.   # ● 判断鼠标位于哪个窗口
    + }3 |7 i  O& D& [* V' C
  2321.   #--------------------------------------------------------------------------
    4 ^3 `1 r) X9 E( o( j, K% [
  2322.   def mouse_which_window
    9 t0 G8 E# y- x% J  G0 P/ D
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y- P3 s2 b3 [, h8 w4 u
  2324.     if mouse_y  @help_window.height + 14
    5 V$ W; ]* u, R# O
  2325.       mouse_row = -1( c# U: c  u! _3 ~/ J& [9 y
  2326.     elsif mouse_y  Graphics.height - 14
    ; b8 P; R& g0 v+ E3 W
  2327.       mouse_row = -26 n- }; |4 d5 R6 n2 R6 m6 Q
  2328.     else
    ( _& R" T( [7 X4 W* g: ^
  2329.       mouse_row = 4  (mouse_y - @help_window.height) " G3 C6 s/ r# j8 S
  2330.         (Graphics.height - @help_window.height)
    8 z4 L9 k3 }3 E1 u& q
  2331.     end& Q" B/ U# R1 q& O3 ]
  2332.     return mouse_row
    - G; B$ y0 L! V1 A) x$ q1 C( b* g3 j
  2333.   end
    & c# Q. Q# {3 q# e+ i. @( Z6 B
  2334.   #--------------------------------------------------------------------------0 r% ~7 {+ i+ U& V5 i. V+ o: O1 A
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    - J' o/ \6 g. F
  2336.   #--------------------------------------------------------------------------. U, V; }8 ?$ b8 B! r' J
  2337.   def set_mouse_pos( M6 E4 H( t  f
  2338.     new_x = 40
    7 M9 U3 \  b4 M# J. L4 a
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    ' F: w% n# Q7 V& w8 Q
  2340.     Mouse.set_mouse_pos(new_x, new_y)
    . _$ v$ \0 x) p0 h( J  V3 P$ V
  2341.   end
    / W1 `, Q* R! j4 K
  2342. end+ w/ O" z/ h6 X" u7 q0 }7 b

  2343. " `! N& X3 k9 I8 h9 ?
  2344. #==============================================================================" \' E' Z6 f9 U; W6 N( r+ ~
  2345. # ■ Game_Event
    % ~$ x  G, n$ u+ l7 V- ^$ s
  2346. #------------------------------------------------------------------------------
    9 }' T% ^6 w6 c  u
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。  y* D& t( h* @4 w# M7 x1 i4 A( |
  2348. #   在 Game_Map 类的内部使用。
    8 Y& _% B. P; q1 O  K; _0 a
  2349. #==============================================================================
    - M, z4 u* d0 K* E
  2350. class Game_Event  Game_Character, s. @: j% r: j5 R9 G% Z
  2351.   #--------------------------------------------------------------------------  d* G3 s9 P2 s2 L5 N/ x4 V
  2352.   # ● 事件启动+ f, z# ?% L" g
  2353.   #--------------------------------------------------------------------------. @/ `4 D6 w+ l/ k
  2354.   alias sion_mouse_start start8 Q( P$ |9 S# R
  2355.   def start6 ?$ J8 J8 Y$ A+ [$ g5 h: b3 V/ h
  2356.     return if mouse_start && !Mouse.press(0x01)1 b8 ~+ |! d* Y% F, I' ]( @( m
  2357.     sion_mouse_start3 [! c1 `6 q$ J  p) O
  2358.   end
    ! t7 L% \0 F3 y
  2359.   #--------------------------------------------------------------------------
    1 w  s$ O4 v* X1 _4 N
  2360.   # ● 判断事件是否由鼠标启动
    6 Z- {- L7 ^( F
  2361.   #--------------------------------------------------------------------------1 {# H9 s' V  h) }& g
  2362.   def mouse_start
    4 s8 G# X3 U) F
  2363.     return false if empty: w* ?$ t* x. a% ]5 l
  2364.     @list.each do index
    1 }1 j5 N4 V" [, p
  2365.       return true if (index.code == 108  index.code == 408) &&
    ; U# R+ L% V3 U: {7 q% `, }
  2366.         index.parameters[0].include('鼠标启动')( ^5 H3 F- m+ r, ~; Q* j& c
  2367.     end4 g7 ~! [& g( V( z1 j9 g) b' g
  2368.     return false
    # g; n3 o  l6 e4 O1 q7 }
  2369.   end
    1 {  E7 _3 c5 A& I" P3 m
  2370. end1 T( B# `; K5 g- h8 }' E
  2371. ! l9 @8 \' t3 p) y5 @7 a9 [5 t
  2372. ####泥煤的height
    7 u% t, Y% X. {5 D
  2373. # @height = height0 T; e! ]$ I8 m/ M/ E

  2374. " W! L4 [6 M- _5 F7 ?) _
  2375. class Area_Response/ o6 Y- I/ Q7 ?+ }3 y  D
  2376.   attr_accessor type
    , B) G( J8 S) z' y8 t
  2377.   attr_reader ox4 T9 [( U3 s% Q9 S" v
  2378.   attr_reader oy! u9 E6 [( Y3 X; i$ `
  2379.   attr_reader width2 w0 K! B8 c1 @. t+ L
  2380.   attr_reader height
    & Z. }# t) ?- _% z! C- }: @
  2381.   attr_reader switch_id
    1 C" H2 z# \  ?1 ?
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)! E+ L) x0 j" R. N! ]# }
  2383.     @type = type' u9 V9 c; j5 n2 o  D
  2384.     @ox = ox1 j% I; H$ [% n
  2385.     @oy = oy
    : D( P' u. ?( N0 I( W: `1 {
  2386.     @width = width; v% ]9 T2 h6 m2 H
  2387.     @height = height; O& h  x0 w+ j9 A& N) m& `
  2388.     @switch_id = switch_id: u" h6 g  }3 j* J) I' M
  2389.   end
    & ^" G6 B% m9 c
  2390. end
    - v: z- r5 ~9 O# p
  2391. 1 W' N+ ]% p* x' n" }4 {
  2392. $area_responses = []) i; H# Q5 L5 N$ g. `- p# M" p
  2393. # B% {8 v2 y' n: I5 g! x
  2394. class Scene_Map
    2 y; i, U6 O) F$ @( W8 q+ a, _
  2395.   alias update_mouse_2013421 update_mouse_action
    % [3 m- J1 P) ^& f) ^4 u
  2396.   def update_mouse_action
    9 b5 f3 T* k( N& C9 h/ p+ {
  2397.     update_area_response8 E% v5 E4 [, a3 u6 W' F
  2398.     update_mouse_2013421
    4 I) a- L2 d% k; _$ c  ]
  2399.   end6 ?$ ?: S( E. q! g5 Y; A
  2400.   def update_area_response
    ! s' S% w* Y5 V1 q. b
  2401.     responses = $area_responses
    " S+ f. d; I8 R2 N' u$ V
  2402.     responses.each {response0 Y7 a  w3 N( q
  2403.       ox = response.ox
    1 o& i6 ]' I* T4 O4 |! B
  2404.       oy = response.oy
    # Z% w8 w- O/ K) Q) M
  2405.       width = response.width
    8 {7 O. W$ a  ]
  2406.       height = response.height* D5 c( `& |. c+ j; U" R
  2407.       switch_id = response.switch_id
    1 ]! W4 ]% r( X# q7 `4 j4 q' E
  2408.       case response.type, [5 W0 g9 g; H4 x/ G& B
  2409.       when 08 U  U& U$ W' {  R1 H, E
  2410.         if mouse_in_area(ox, oy, width, height)
    1 m; O4 L; a( H
  2411.           $game_switches[switch_id] = true
    % q2 W4 i, m; K' n" S
  2412.           $area_responses.delete(response)
    0 ]! c" Q+ R* i3 V) P# A
  2413.         end- n: g: }/ b: T: Q# y
  2414.       when 16 l* ^' P( s% r) \
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)
    - Z& V) }+ ?, Z( B$ W# Q
  2416.           $game_switches[switch_id] = true) \' p6 F3 Q3 q. M6 e$ x
  2417.           $area_responses.delete(response); O1 L2 n' g2 m* F+ E; S% b2 G
  2418.         end# x' t, M% x2 @) \* d% k  k6 g; n
  2419.       when 2
    . l* N- A+ Q8 Q+ n* I
  2420.         if mouse_in_area(ox, oy, width, height); r0 M. f1 b! x3 U
  2421.           $game_switches[switch_id] = true2 M' x/ w6 {, J0 Z, Z
  2422.         else
      }6 y+ b3 _. @3 c# o1 C
  2423.           $game_switches[switch_id] = false/ C! z# Q1 d# o  r0 E; O: a' e! {
  2424.         end
    % j% n1 w) H. G# h- X7 k$ A% Y9 c
  2425.       when 3  D, m  I: r0 U* Y- _1 x. i
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,+ m0 S& z: ?, `
  2427.             (oy - $game_map.display_y)  32, width, height)
    * z  A0 ~6 ]: ]5 X1 j
  2428.           $game_map.events_xy(ox, oy).each {event
    : y1 \8 F& n& c3 n, `$ v
  2429.           event.start
    " J' X# Z; v% Q: ~3 f1 z) `
  2430.           $area_responses.delete(response)
    . _+ V! r  b: l1 J/ o
  2431.           return
    $ D" @4 k' O9 A$ A: t" V; z
  2432.           } 8 W7 p5 P1 v$ W1 h/ W' V. @8 i
  2433.         end! l4 R4 W# ^  @, h0 g
  2434.       when 4
    7 j6 y/ F& J2 `' l, t7 i
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,% `! l4 ?# e/ B7 r. f
  2436.             (oy - $game_map.display_y)  32, width, height)
    / B4 d" [& K7 l" Y2 Q% A
  2437.           $game_map.events_xy(ox, oy).each {event+ ]  q5 i' ^  q+ M: y( r8 p& k) I( P
  2438.             event.start
    / S0 X% W. D, Y4 ]4 T1 o
  2439.             return! k: M, q3 h# ]8 r0 g. ^2 R; R9 R
  2440.           }
    : x1 _4 M' R# {6 e
  2441.         end2 ^$ x+ {; Y( g$ a6 f2 I! M
  2442.       end
    7 f* b! F3 ~* M) _* g/ r, [$ ^
  2443.     }5 Q2 t$ p/ a; O( p
  2444.   end4 M1 o6 g8 a- J9 ?; p! Z1 n
  2445.   def mouse_in_area(ox, oy, width, height)& g9 Y: w  O- B9 d  G
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&
    : b! I2 |; ?3 G; Z9 V
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height
    . N) ~; i' V# m6 i: E! b7 e
  2448.   end6 t; h6 r( C& Q( V
  2449. end
    7 p- h  o  h( z* W
  2450. class Game_Interpreter/ _4 @" N# G7 L; j
  2451.   def area_response(arg)
    5 e( f2 r* ]9 [! l
  2452.     $area_responses.push(Area_Response.new(arg))$ @4 r# Z# D, ?' u3 {7 c* x
  2453.   end
    5 O0 w8 ?; K7 v, v
  2454. end
    / V# ~: e7 z7 {2 m3 F* E, z' j
复制代码

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

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

GMT+8, 2025-2-21 18:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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