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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    - D" N9 ]" k5 G+ k  _# e

  2. 5 l/ S+ o/ f6 T% R; I
  3.   Sion Mouse System v1.3e2 Z! R6 h& ]3 s( S, \; I/ t3 f; ?
  4.   ( |, U- k3 @6 ~  B* s. X. g1 M
  5.   Changlog
    ! r- d: F8 _; C
  6.   & O& z' q7 J+ m3 b0 S, x# e
  7.   2013.4.21 v1.3f% m) @+ j/ X: g7 m" ^4 t6 g! O
  8.     5 X  Z% l4 Y5 X' ]/ D
  9.     1.3f 卷动地图 bug 修正/ U& v% {, [# V4 H3 ]  i1 Z
  10.    
    ) {0 z0 Y% `% l; p0 m  r* T& g
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口
    % ?$ p" W+ t) c
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内2 j2 R$ n; T+ g# S8 R9 Y. ~6 [- _
  13.                               Mouse.unlock_mouse_in_screen 解除锁定) X" b/ `4 v6 A5 y. ^

  14. 6 ^9 ]) R9 N+ P; L
  15.     1.3f bug修正; A7 d1 q3 X) C5 c9 J( h
  16.   
    ; D2 V4 x! C/ l) f$ i- U7 Q  b
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及) @) w! L' k! U! D/ Z- {% R' v
  18.           关闭菜单时,鼠标是否移动到原来的位置。
    3 i. j* _5 J9 Y# n6 w- i

  19. ; C- q. s8 U5 O# o
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处  ^$ }+ }8 |% J# O7 {8 E9 X
  21. * W  E& t( a' h1 c& K
  22.     1.3b 修正一些罕见的bug;- s6 }6 C5 s7 N5 g

  23. 6 j- |9 E+ m) s- j3 Q* a. W" q
  24.     1.3a 代码小修改;
    ( q; }- x6 i( Z4 W4 X# Z
  25.           加入了鼠标点击启动事件的功能,* j$ F, J$ U4 s: Z( C& X) x! C0 r
  26.           在事件中加入“注释”: 鼠标启动  ,
    2 |, `, J; o8 T, U% ^
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    # a2 l% J! X! R. q/ V+ W
  28.   
    % O% H+ @! B6 H: s; e, @& c1 K7 [
  29.   2013.2.12 v1.21 y6 H" y/ b0 P4 e, h& y& W
  30. 0 k1 Y) C9 T7 |1 k# t0 h
  31.     寻路逻辑优化;- B6 f# w/ o$ A# [$ l$ ]8 E* c
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;
    3 |/ }2 ?9 J  L4 h: ~, ^
  33.     现在支持用鼠标来操作载具了。; U. v* F  _8 {! l
  34. 8 F" ]; h8 U8 W' @: [# ?9 H) K
  35.   2013.2.8 v1.1  m8 X) g9 _0 J5 F. e6 s

  36. 8 v. E% X: ]( k  w& D, ?
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    0 V8 U& }- w6 [% l# N$ M: s5 a2 v# Z9 i
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;- M1 n+ s, p2 D! q2 P
  39.     移动时,路径指示点的绘制更加稳定;
    2 S! c. y. Q' k& j% O
  40.     现在支持默认存档画面的鼠标操作了。
    , ]- P6 E/ E- F4 ~
  41. 8 ?* D2 A  j: }' y

  42. 5 ]0 H& [: {' q) R( g$ n8 V3 B
  43.   OrigenVersion2 \4 _' r) m- W" J$ I# t
  44.   - W  ]9 h+ [" M' b: r
  45.     2013.2.7 v1.0 " b/ s1 M1 Q9 J! g

  46. * Q7 @/ ?1 f7 g# e) n5 x  f  q
  47.   主要功能
    . y! }. X$ h: R# e
  48. / J$ ?1 X7 _8 _& k
  49.       使用鼠标进行各种操作...  C3 ]3 p% W2 O
  50.       将鼠标锁定在游戏窗口内
    $ z, H8 T9 \  p( _
  51.       自动寻路,按住 D 键可以扩大寻路的范围! |" Q# I$ w" u# h4 Z! A8 P1 y$ g
  52.       双击鼠标进行冲刺
    / G/ x- V' H( e& P4 \9 o$ w
  53.       更改地图卷动方式以适应鼠标移动7 Z1 `4 Z. y! R& d3 v( x
  54.       变量输入框改良% l2 s3 v1 F& c/ f+ f- B8 N/ Q
  55. 3 m4 Y$ ?4 X. F! j* y8 T0 [( o
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹' {, s& X! \' ^+ F+ O6 _; a

  57. 7 b0 }: k0 w' M( _6 f+ P
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹' ~) U: V+ |) H, d% k: ~: q5 u

  59. # W8 W; r- q; n1 v$ x: w5 J
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    * j$ n. f: E, i9 P& v( j
  61. ) Y* z* {0 o0 B  ~5 Y7 _

  62. - P/ O1 m/ S  U, e1 U
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★! N. v& I  Q6 Y; C

  64. 0 Q8 {! v, M) ?5 S
  65. 9 ?  r1 Y' u7 C7 p! }1 H3 _0 t
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示
    6 y0 E: B6 G) S# b1 N" u2 [/ J

  67. * R( R7 r* ^2 q$ [4 a4 z
  68. #==============================================================================
    ) w) t+ Y. y3 D" @+ E+ f! g  F
  69. # ■ 常数设置
    ! o! j. y& P; u+ A: j0 g1 q
  70. #==============================================================================5 B! r4 h( x0 a6 t9 R6 J" ?
  71. module KsOfSion
    $ Z  z! W3 H( Y
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false! h7 g1 `! f0 ^
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑
    , g6 U, u0 q5 V" B' v
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    6 D) P0 f0 P- w7 E3 u- c
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量4 V8 k2 N3 H" v) V
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处. n, C. o' ^; u: \- v1 H2 K! S
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧) w; J2 i# E- D) a( `/ e6 H* l; f) _. m
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13); k$ w8 }* _0 i, }1 q
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键
    . T' g  P3 a1 n; N
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)6 D0 s8 h  j/ q0 ?
  81. end# _% b/ v6 {$ k

  82. - J; N: c% m* n, Y  Z; m
  83. #==============================================================================! S. @# h# o- ~7 x" R
  84. # ■ 用来显示路径点的类& Q/ T8 `2 W  i! g
  85. #==============================================================================
    ' L3 Q% g9 @! x
  86. class Move_Sign  Game_Character9 v3 t7 Q4 |( Q/ Q  A' R1 Q
  87.   #--------------------------------------------------------------------------
    6 b; c# w- r! R, m
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图& T) y8 ^0 P$ s! r
  89.   #--------------------------------------------------------------------------
    3 k  M' Z& T6 ^2 [3 P
  90.   def init_public_members
    + k  }7 i8 r0 R7 D5 z7 B: ^6 b
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹
    3 n. ?: U/ [) J) h5 \
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    * n" Z  J* o3 x: F! b- [+ }* \5 {
  93.     @move_speed      = 5        # ★ 踏步速度
    % T+ L4 n" ~. t
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    2 @; D% T) q% I6 T) o
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度
    1 q6 R  E9 y. Q. }3 Z) D
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)6 p: e. e3 E5 n
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列- `  I" m; J6 J7 B/ r' F
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)4 L2 }3 D6 k1 C' u# i( u

  99. - c7 o( C. \0 T' D- a

  100. ( _; H6 ]9 N2 Z
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    + @6 A; q% I; t) b5 D
  102. 5 E# [; L) _& {
  103. 7 f7 c& c7 {* }! r# u) p
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图( l+ u# i6 f  Q8 x, C* K5 `7 j1 d
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')4 H" ^/ M9 |: X" U

  106. 7 ~7 v* t8 z( l* X
  107.       if $no_arrowpic_warn  R) _3 J! {2 ?
  108.         MouseShow_Cursor.call(1)! t) W) z7 Q% F  g4 O' z
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png
    0 T- V. {  J8 c( B
  110. - M( J( k) Z% W1 Y/ ~* J
  111. “路径指示点”将使用游戏自带图片1 p2 \, \; b! s

  112.   w" m; I4 N* O% o+ @9 Q, C
  113. 该提示可以在脚本内关闭')
    ! j0 p+ V3 J2 {9 ]" n; b1 Y& C
  114.         MouseShow_Cursor.call(0)+ N) ?7 K6 y4 W8 j+ e; Q
  115.         $no_arrowpic_warn = false
    4 v: e" ~8 _! h* C! q4 _3 j; h8 F
  116.       end
    . V+ k$ ?! G* |# I6 J, q' L
  117.       @character_name  = '!Flame'$ J  `2 @0 `& t1 ^4 E( U3 `
  118.       @character_index = 68 ^8 t1 U, n( C7 E/ E& g7 q, q

  119. " v" p$ ]6 F/ g' r: T* q7 V# {
  120.     end
    ! l7 H# |1 u# z: C; }! s" W
  121.     @direction_fix = false  # 固定朝向
    , `1 z. P" z6 @
  122.     @move_frequency = 6     # 移动频率1 A; x& i( t1 Q; H  w) v7 G+ _4 {( L
  123.     @walk_anime = true      # 步行动画
    ) Z2 J; H9 g- q7 B0 W0 @
  124.     @pattern = 1            # 图案
    & n( G  W4 s- r% p/ r
  125.     @through = true         # 穿透
    $ Y- E+ L+ G2 F
  126.     @bush_depth = 0         # 草木深度
    - \, Z( ?9 c$ G8 R7 H& M0 b
  127.     @animation_id = 0       # 动画 ID9 n2 S1 m5 M! q1 F0 F* a' Q
  128.     @balloon_id = 0         # 心情 ID' P* o2 c! F% f$ T
  129.     @transparent = true     # 透明* C- s9 F' q: w9 `
  130.     @id = 0/ Q$ K8 R  a1 e  {( E; x; X9 u
  131.     @x = 0
      [; @% w) V# [1 Q2 s8 J6 l  a9 S
  132.     @y = 0; h; T; Y7 h# x: O- |( C) k
  133.     @real_x = 0
    / d; [$ w" S/ }0 `) x
  134.     @real_y = 0
    7 \  r3 \& O" h; @6 I
  135.     @tile_id = 0; G; G. N4 k( a, C
  136.   end
    - |# M- y9 [; x# L4 K
  137.   #--------------------------------------------------------------------------
    : {5 O! v2 T6 u7 s7 t" D# t0 F8 I9 ]
  138.   # ● 定义实例变量& A: c4 x9 x  J: Y) |
  139.   #--------------------------------------------------------------------------
    " |4 m- O. @4 ], i; l8 I
  140.   attr_accessor direction* Y$ ~! C' P- @- g' Y; @
  141. end+ d+ K+ A. J  s( A' [0 G* N  K1 v

  142. # G4 l/ c  d9 B- r% s" F
  143. #==============================================================================
    - j: ^; v7 M3 J, B: j
  144. # ■ Module Mouse
    8 t  d3 L6 ]. w) \2 D
  145. #==============================================================================3 D9 }# x/ G6 \0 u$ q# [% d
  146. module Mouse
    / u& g, W2 H- T" U* k7 G/ u
  147.   #--------------------------------------------------------------------------
    , w' E1 x4 L7 Q; v1 R% |5 M) \
  148.   # ● API. P0 h9 l! |- r- Z- ]/ H6 T
  149.   #--------------------------------------------------------------------------
    % y. I7 N0 N5 v& q% _2 h% ?
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l'), o, C. f- |- D- {
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
    1 U5 C; W2 H: |9 h
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')
    # T) f8 a2 I" _7 Q
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')
    5 S. J3 l6 C- r5 x1 u) r6 q$ O
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    * m) o+ s5 d. X+ z$ b: _* n
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')
    & p; s4 `$ C& ~& U" E
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')) G8 w: V) h( l) r! ?2 f, q: l4 w4 D4 c
  157.   Window_Hwnd       = Get_Active_Window.call
    7 U8 n; J& g9 \

  158. , d$ R+ r" @' A$ s% |9 z7 y1 u
  159. class  self
    * k4 }, Z% ^$ l4 u
  160.   #--------------------------------------------------------------------------
    " e3 [# d! X! r6 A
  161.   # ● 初始化
    . c  @8 P" l5 F! V' r: `2 S7 K
  162.   #--------------------------------------------------------------------------
    8 N: Y  {- B! [% o; H
  163.   def init4 ^' Z/ N9 T4 J2 ?8 s
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor$ L( x4 {' w3 R: W( n; O
  165.     @left_state = 0
    2 W  ?+ ^! o5 m+ e# S% d$ x
  166.     @right_state = 0
    # ~: w+ w5 T) N% ^1 ~
  167.     @ck_count = 0 # 帧数计,单击以后从0开始
    7 h5 m% E( S: X4 L2 G; O
  168.     @dk_count = 0 # 用于双击的判定
    $ q/ C0 D8 @" W5 r0 V/ y& j5 P, |4 a
  169.     @clicked = false! z9 Z+ `' R5 w* c
  170.     creat_mouse_sprite" l+ Q5 f4 i8 N- n* j
  171.     update
    5 N* N7 J5 D2 _7 o/ z4 v2 i4 u
  172.   end
    & Q7 [2 J/ V6 Y, M9 w; j
  173.   #--------------------------------------------------------------------------
    6 F. G7 r& ?/ ~9 E  e- S8 I6 _
  174.   # ● 鼠标指针精灵
    9 J/ H1 Z: m$ I
  175.   #--------------------------------------------------------------------------
    * U" e4 _$ v3 p0 G1 h  }/ d
  176. #~   def creat_mouse_sprite
    1 b$ G/ r& P9 `) z# l, }
  177. #~     
    , M7 n" I5 a7 _. i
  178. #~       @mouse_sprite = Sprite.new
    4 p: t5 d- h& ^: h6 W) r1 F! T
  179. #~       panda = 2#rand(2)+15 C( O$ Z. B9 }# R
  180. 8 T, A2 c' Q; _* o! C  j3 Z
  181. #~      if panda = 1" u  x+ P5 o3 F1 Q
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    # g) b( |+ O/ T3 k& s
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')6 g6 w- B* n' f. F6 t0 A* [; s
  184. #~        end#with if File.exist/ B( ~% b. `% H" {4 z  A, J
  185. #~   
    8 x- _5 z3 A& n, I, D6 l
  186. #~     else if panda = 2 #with if panda=1
    , h" X7 h) }0 z+ _
  187. #~      1 M2 @5 q, Z" D0 O
  188. #~      if File.exist('GraphicsSystemCursor2.png')& M( W0 ]6 S: N( b5 j+ D
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    ; g$ |" [4 |+ q
  190. #~      end#with if File.exist
    ! a. v/ e5 g/ a6 c
  191. #~         H5 V; }7 t! m+ E/ s
  192. #~     else #with if panda=1
    * C+ W9 B! j2 K' C3 M6 d) m4 u
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    3 N! m. o! M( {+ f7 _/ C1 ^) z
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),$ b% T/ D- \3 m
  195. #~       Rect.new(5  24, 24  24, 24, 24))
    1 _! F: D, P6 I5 h& h6 W
  196. #~     end#with if panda=1
    5 U8 D8 O5 U; l+ x. D: I/ @: W
  197. #~     
    * T; g* ^2 c. Y1 X2 b: i! f( ]
  198. #~     #with def' h3 l0 x$ k! x* T' q7 [9 h
  199. #~   end6 U% N  W# X$ b; V/ \0 q
  200. def creat_mouse_sprite
    5 ]; X0 L1 V: S& T
  201.     @mouse_sprite = Sprite.new5 `$ h# K" s7 J! ^
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})
    / {- H/ b/ y3 n  T
  203.     @mouse_sprite.z = 9999. I2 y* E$ ~6 i- Q
  204.     Show_Cursor.call(0)2 N1 N( ^; l0 f8 f$ X
  205. end
    / z4 v2 [7 g$ |5 @9 P
  206. % h( n+ f+ m+ J( O
  207.   #--------------------------------------------------------------------------( ~7 L; X0 D/ J7 o+ `
  208.   # ● 更新9 K: s. ?0 s8 p$ @6 I$ N7 O  o
  209.   #--------------------------------------------------------------------------$ j" a8 d# h4 D- ~9 w
  210.   def update; |% U7 o5 O1 R) |1 ^& X9 S( a: `
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos; ~0 C: Z6 e% O( T4 [/ N
  212.     left_state  = Get_Key_State.call(0x01)
    5 B; o+ y: u! U' r8 G
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0, d* t6 z7 }9 c4 H
  214.     right_state = Get_Key_State.call(0x02)& s7 M; g8 P6 O7 q* F* l! r3 j
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0" Q7 f; p$ A8 w+ w1 P$ a) f6 m
  216.     update_double_click! `( S8 R4 c$ B: m0 |  d0 z
  217.     @left_state == 1  @ck_count = 0  @ck_count += 10 H+ s# b4 }4 x+ `, t% Y* h7 o
  218.   end, R& [2 N2 n; n! O
  219.   #--------------------------------------------------------------------------
    ; K1 ~) I1 B6 A0 T6 M" E) P
  220.   # ● 获取鼠标坐标4 g) L' W  D* Z5 {* g, Z
  221.   #--------------------------------------------------------------------------: p2 n5 s( \  t. w
  222.   def get_mouse_pos
    & o  A/ Y3 `4 i( m8 }
  223.     arg = [0, 0].pack('ll')9 ~1 Y' F$ X0 ?, p3 s
  224.     Get_Cursor_Pos.call(arg)6 e) N  T2 K/ ~/ e4 v$ V+ R6 T
  225.     Screen_To_Client.call(Window_Hwnd, arg)
    1 N' {4 G0 T2 [( u8 D
  226.     x, y = arg.unpack('ll')+ B7 k& B0 [1 u  U2 H' Q7 b" N
  227.     return x, y6 k& w, g+ s" m' e
  228.   end
    2 {. g& f* c/ Z" K! m0 D$ a/ `+ W
  229.   #--------------------------------------------------------------------------, H: [, G8 t2 v) P
  230.   # ● 将鼠标固定在屏幕内3 M* j2 n& X; W) L3 ^% H9 @; }3 m
  231.   #--------------------------------------------------------------------------* s8 x  Y  G8 k9 M
  232.   def lock_mouse_in_screen% Y  w+ U1 S: L: n4 N* D8 j
  233.     arg = [0, 0].pack('ll')7 ^+ \1 N$ }+ H# N7 d( @
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    5 ?- U" R5 R0 j) \+ c. X% i$ K5 K
  235.     x, y  = arg.unpack('ll')  O1 q$ f1 G0 {+ }
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))
    ' X' j9 E: C) C: f4 J  R2 R3 n
  237.   end
    ) Y7 D4 Q/ T# K3 h* t$ P& L, B
  238.   #--------------------------------------------------------------------------+ ?' [: H% V0 m% @) F# S
  239.   # ● 解除鼠标固定$ E1 e( w& {% k- u+ P. `# d* l
  240.   #--------------------------------------------------------------------------# {7 M. \9 J/ R$ b0 w
  241.   def unlock_mouse_in_screen
    4 u) W6 R2 I- ^4 G
  242.     Clip_Cursor.call(0)
    & R% g, f) N6 B/ m5 N; r
  243.   end+ u* P9 g& ~8 C/ b
  244.   #--------------------------------------------------------------------------, G# F( P) v: O/ E/ a$ C
  245.   # ● 鼠标双击判定) B* [: t* L6 S/ c5 T: n
  246.   #--------------------------------------------------------------------------( H# d" L9 W' j1 f; G
  247.   def update_double_click: t' [& _: v8 i1 Y2 u
  248.     @clicked = true if @left_state == 10 y( y- k- }: w. i) {! J6 h
  249.     if @dk_count  0 && @left_state == 1; e% U3 o' p$ E& v$ F4 d  b
  250.       @dk_count = 0; @clicked = false
    - b' `8 c, y5 m% l: o1 C
  251.       return @double_click = true6 Y' \  U" O" g8 V4 b1 S+ g
  252.     elsif @clicked& L* C6 b/ H7 k/ P# \% _" O
  253.       if @dk_count  KsOfSionDbclick_Frame3 r' I6 [# g( r. f. J& y
  254.         @dk_count += 1
    + ?* k2 }; e6 O$ l$ v0 Z8 G; u7 G% O
  255.       else# ?" Y2 W! k( S6 K% ]. g# u
  256.         @dk_count = 0; @clicked = false! B/ l; V/ u8 Q# Q
  257.       end
    $ t) T! t: t5 S* a/ G1 m! |
  258.     end
    0 M( g' i, |" m" ^
  259.     @double_click = false
    ; U& \8 ^  ^7 i/ {5 m, ]) _6 L* d9 _
  260.   end  C" ?' X5 p9 q& X: r$ V
  261.   #--------------------------------------------------------------------------
    ; T) }# b3 D, J" W
  262.   # ● 按键被按下就返回true
    : g  K( Y1 L: U3 V
  263.   #--------------------------------------------------------------------------
    3 a8 G: m% w# y. Y
  264.   def press(button)
    5 l% d% q  I3 F: C6 t+ O4 D
  265.     case button
    5 N+ x  O" y, T- K
  266.       when 0x01; return !@left_state.zero
    ; e6 X5 K3 l* }/ x
  267.       when 0x02; return !@right_state.zero
    6 t: j9 }2 F$ N/ y" X' a
  268.     end
    % E3 Y0 |" [! S; a, i! d3 r" L
  269.     return false8 g+ \: H* }6 x; j- I7 [! e' [
  270.   end0 j: e- t! _% j  [$ A2 v
  271.   #--------------------------------------------------------------------------, ^! y; F7 |+ L, U, k9 D) K6 R
  272.   # ● 按键刚被按下则返回true
    * [( D. X. B' h
  273.   #--------------------------------------------------------------------------
    5 Z+ L. I0 ~9 f3 m! h8 E: q1 n
  274.   def trigger(button)
    , g& |6 v/ c5 a* }' B8 |" H
  275.     case button
    * T$ ^  V3 ]: ?
  276.       when 0x01; return @left_state == 1
    8 h0 B5 w- D( c* w0 l- V
  277.       when 0x02; return @right_state == 1( W; u) x0 N& a) ^! B) d- V
  278.     end
    : J2 t( n% P; s4 Q* T
  279.     return false
    # g* l8 O# U2 `! s( O3 y5 E
  280.   end/ B3 T, y7 C. O( H+ M
  281.   #--------------------------------------------------------------------------
    ! N7 Y+ \' B2 V& O* |. a4 I; Y
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    & G2 U, z* G' m! i2 `% o
  283.   #--------------------------------------------------------------------------3 H/ q( X+ @! E- y
  284.   def repeat(button)
    0 b; d9 [" ?1 Q) b/ c$ B
  285.     case button5 E; V1 Y. ~' X# A8 W+ `1 O. u2 Y
  286.       when 0x01; return @left_state == 1 % n8 z2 s1 R4 G7 ^% L& L
  287.         (@left_state  22 && (@left_state % 6).zero)  N6 G9 N. U1 ~1 r! b5 X
  288.       when 0x02; return @right_state == 1
    , y2 t9 e8 k1 W, ?$ C/ S& }3 O
  289.         (@right_state  22 && (@right_state % 6).zero)
    0 E9 E$ I& J& e$ \  Z2 g
  290.     end5 a+ w2 W3 S$ Z3 E- B( U$ o! x
  291.     return false
    ; I% }/ h4 s5 j
  292.   end, S% G* q9 e: D, o' ~
  293.   #--------------------------------------------------------------------------
    ( p; P% V+ u: P* Z2 c" e" h
  294.   # ● 判断是否双击鼠标0 W6 c2 O# ]0 a3 v
  295.   #--------------------------------------------------------------------------3 J$ B6 u  g3 Z0 F, z) f
  296.   def double_click
    : W7 s+ e% ?6 p" j: A9 O
  297.     @double_click  a- {. E5 j- ~2 u9 P) z' T) A
  298.   end1 ?! @) @; q- T: }
  299.   #--------------------------------------------------------------------------' a/ |$ N7 m4 K% A  P( c# l
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)1 z  u: m/ f6 b$ d
  301.   #--------------------------------------------------------------------------5 j4 F3 P. C0 P5 X
  302.   def click_count! d- B* f' A5 R3 J8 ^% x& E
  303.     @ck_count0 M: x1 V) `; M, B$ w: h
  304.   end  u8 X0 n& g. s" D/ T5 {8 J
  305.   #--------------------------------------------------------------------------
    : u1 o8 T4 _0 t
  306.   # ● 获取@left_state(按住左键每一帧+=1)) n8 K. ]% v1 T8 |7 Q
  307.   #--------------------------------------------------------------------------1 Z: v2 N: G; N& `
  308.   def left_state
    9 P6 i5 C3 w7 O! ~; D# a4 h
  309.     @left_state
    , m) U* h( s/ l& T3 @6 P9 o8 _) o
  310.   end
    7 L) E3 G0 u- A% `+ F+ T! U  S# s
  311.   #--------------------------------------------------------------------------, {6 h" A2 X2 S
  312.   # ● 获取鼠标的x坐标
    # T8 |. E* t7 B1 j6 B
  313.   #--------------------------------------------------------------------------
    ' n5 y5 w" J9 [1 i
  314.   def mouse_x
    6 _- y' v, H% R5 @- y
  315.     @mouse_sprite.x9 u+ `( @# W% Z3 G
  316.   end
      a5 N6 b6 Q! O, B8 _2 ?. r& e
  317.   #--------------------------------------------------------------------------
    % {6 a' ^  l( l7 v$ G0 Z
  318.   # ● 获取鼠标的y坐标
    1 R6 D8 ]/ z0 X" S( T: t
  319.   #--------------------------------------------------------------------------1 p% G7 i, Y, A" p
  320.   def mouse_y
    ; a$ W- V+ }0 t' c, |
  321.     @mouse_sprite.y
    . d# |! N0 P! f# ]
  322.   end6 H5 ~. _  g) l( o0 y8 m
  323.   #--------------------------------------------------------------------------) H& K8 Y# \1 s! ?
  324.   # ● 设置鼠标坐标% U# z: ?. l! x3 i9 h
  325.   #--------------------------------------------------------------------------
    0 Y$ s$ o# o" f
  326.   def set_mouse_pos(new_x, new_y)
    & j* N$ h7 b3 ^' `/ a4 t6 H
  327.     arg = [0, 0].pack('ll')/ w, H9 R( G; P: s6 a  u' J
  328.     Screen_To_Client.call(Window_Hwnd, arg)
    & v' _9 ?8 J& U1 y
  329.     x, y  = arg.unpack('ll')
    5 g  ]3 ~% _) c- r& m5 T1 h1 D. |
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
      |! E* ~! V1 R
  331.   end2 \( R" ~, K& K- a8 k% @$ c+ {3 @
  332. end #end of class  self 3 ?8 N0 _; H- Q2 K$ K, o

  333. 2 L; x' i% E* L1 r* S7 @' j& B
  334. end5 g/ o: t7 E+ m/ o5 w; _6 E0 ~

  335. 5 [: c, a4 Q- l
  336. #==============================================================================
    , O3 }+ A" W! h
  337. # ■ SceneManager
    7 n' M' ?" u9 e" l0 w" K$ ?1 z1 T6 a
  338. #==============================================================================
      Q$ n. B2 {* u  j6 q1 b
  339. class  SceneManager
    / e; Y4 x% h; b+ D# m& |
  340.   #--------------------------------------------------------------------------
    " R% g# A3 Y; I0 {( s
  341.   # ● alias! t% {( T! i2 G* z1 I
  342.   #--------------------------------------------------------------------------
    ' m8 K4 U' @4 J+ [; P+ _5 i
  343.   unless self.method_defined(sion_mouse_run)4 m0 {9 r& H2 W* f# b  i( k
  344.     alias_method sion_mouse_run, run
    ' N* H9 k5 @" V% B5 k. W! z7 [
  345.     alias_method sion_mouse_call, call
    ! w7 }* Z! ^% o/ ]% _
  346.     alias_method sion_mouse_return, return" y$ [/ ~& n) [1 {# Q, H1 }
  347.   end  Z( y2 H2 S- n% d- B
  348.   #--------------------------------------------------------------------------
    ! w0 R( d: t& r: z* d, J. G* M
  349.   # ● 运行
    ! @  r' B' H$ k2 I
  350.   #--------------------------------------------------------------------------% i( D  `: I% q1 ^
  351.   def run; M1 F1 b: v8 U8 s  F
  352.     Mouse.init
    , Y$ G: Z. }( i4 z# @, W
  353.     sion_mouse_run
    6 I1 k( ?" i3 B1 J8 J) c
  354.   end
    9 J% A6 I& R4 u$ G  ?, F2 j3 h
  355.   #--------------------------------------------------------------------------
    / d- r: k9 I; Q, T4 R. W9 X
  356.   # ● 切换0 X( X4 t" _5 r
  357.   #--------------------------------------------------------------------------
    , k6 `: |$ e% N
  358.   def call(scene_class)5 ?0 C. V. E/ `" E( G' a) W
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map). X' O6 I- D$ Y! `3 D
  360.     sion_mouse_call(scene_class)
    8 _, d- T; N" W. ]
  361.   end
    4 e! w' e2 F/ V. g1 o
  362.   #--------------------------------------------------------------------------( J% x3 B0 \% V$ p
  363.   # ● 返回到上一个场景
    - r5 ^- ^) R5 n/ Q2 p7 ^
  364.   #--------------------------------------------------------------------------/ @" u. J4 g9 D+ J' G/ M5 s
  365.   def return1 Q8 N0 Y$ ?. H  A9 u5 ?
  366.     sion_mouse_return
    ( Y5 G* S; m8 a; F2 M3 S
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&) G9 h3 o  l; b( `6 c$ P( ~
  368.       @scene.instance_of(Scene_Map)
    / [  M$ i5 o( _+ s  b" o* `
  369.   end
    2 ^4 E1 s$ y8 y( X% t! r
  370. end
      T' c6 |% t. m6 K$ B8 D- c
  371. 2 ^) G2 w4 Z: p4 x; J1 ]% H# q/ S
  372. #==============================================================================
    6 Z6 q& i7 v; r& L
  373. # ■ Module Input% U2 c& V7 J- j# T5 U
  374. #==============================================================================1 g; n. _; T# t  F
  375. class  Input) R: t# G/ t* Q
  376.   #--------------------------------------------------------------------------
    / a1 M7 b2 s/ E/ u6 }
  377.   # ● alias
    + |* W1 ?+ w- @! I6 O
  378.   #--------------------------------------------------------------------------" a4 \. J2 }8 h3 W& k
  379.   unless self.method_defined(sion_mouse_update)2 s8 x, A9 z6 w+ B- L
  380.     alias_method sion_mouse_update,   update7 {8 w* `$ r6 v. v; I
  381.     alias_method sion_mouse_press,   press
    2 t5 d; ]7 X2 T5 Q0 J7 r
  382.     alias_method sion_mouse_trigger, trigger
    $ c/ Q- z, j) @7 ~) F. Z2 @
  383.     alias_method sion_mouse_repeat,  repeat7 {) U# g+ B& C  t, u
  384.   end2 [: j! x4 ]& p8 N: @# J1 S8 p
  385.   #--------------------------------------------------------------------------
    # Q, Q( h& o( U
  386.   # ● 更新鼠标% U2 l7 c( S3 P, c3 t. @
  387.   #--------------------------------------------------------------------------
    2 u& {+ n9 _$ z* H
  388.   def update
    # @  b. ^' G) e
  389.     Mouse.update' R7 i9 @! a4 s( _6 C4 N8 ^
  390.     sion_mouse_update
    4 q; D5 L5 V+ \& j: V
  391.   end
    7 \8 ]) W; V7 {7 C# B" h4 p  @
  392.   #--------------------------------------------------------------------------
    : A4 d% i: P! J' L9 |, O
  393.   # ● 按键被按下就返回true
    0 F' }# c& e  y* A' Y9 u
  394.   #--------------------------------------------------------------------------
    # n6 z" U: p/ H" ?: k
  395.   def press(key)
    - E2 t4 h9 Q- R& M
  396.     return true if sion_mouse_press(key)$ ^* [' t; T! S2 R0 }, g# a) t! h6 |
  397.     return Mouse.press(0x01) if key == C' S' p: F) L' t/ K+ o; v' m
  398.     return Mouse.press(0x02) if key == B- n4 O& }* f$ b; r
  399.     return false
    7 w% N6 F/ ^7 @/ q- s3 t' u
  400.   end
    6 _( ]1 V9 O1 d" ]
  401.   #--------------------------------------------------------------------------9 l/ P3 `7 F7 D1 {+ Y5 h# B
  402.   # ● 按键刚被按下则返回true
    * W3 W* D4 ^4 I) Z/ B$ S
  403.   #--------------------------------------------------------------------------
    % l5 ?- p+ Q6 p
  404.   def trigger(key)8 y, Y  |7 g7 Y, m% E0 C* y
  405.     return true if sion_mouse_trigger(key)! t5 P: q: k/ ~5 N! c
  406.     return Mouse.trigger(0x01) if key == C
    % X: S* ~- G0 p3 G
  407.     return Mouse.trigger(0x02) if key == B
    ) t$ t) h$ h8 @! q8 {) w
  408.     return false8 r( n  _8 b. z2 l9 p
  409.   end5 q; h' {* m5 D+ f
  410.   #--------------------------------------------------------------------------. \. M1 e/ Z+ \2 O
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true2 D( o. M$ j' X6 C
  412.   #--------------------------------------------------------------------------
    / P0 h- S5 d8 f5 P
  413.   def repeat(key). P/ i1 P4 R' n' p8 S
  414.     return true if sion_mouse_repeat(key)+ Y, X9 e+ N8 k2 B3 i, w9 Y
  415.     return Mouse.repeat(0x01) if key == C
    . b8 i0 L2 h9 g; r0 Y7 T
  416.     return Mouse.repeat(0x02) if key == B
    3 y! K/ a- p: A! q* y! s! v
  417.     return false2 A# e' D- T( }) {% y8 T
  418.   end
    ) H$ L# g6 c4 F3 A$ w( F5 [
  419. end
    3 `$ W: g6 d* \- [: g7 H. t( P
  420. 7 q- i- L3 o# ^3 _) S
  421. 6 J8 a6 \9 r6 D7 {
  422. #==============================================================================% r- L7 G, g2 F8 |
  423. # ■ Window_Selectable$ [; V1 x0 }$ S$ A6 `) a' B
  424. #------------------------------------------------------------------------------
    6 w+ Z$ q! K7 y
  425. #  拥有光标移动、滚动功能的窗口
    5 `, ^. I1 [5 E4 n' u9 Z/ i3 ]# P
  426. #==============================================================================- i2 s4 |+ O' A) U3 Z5 X
  427. class Window_Selectable
    7 v( V. ~0 D" S" N; U
  428.   #--------------------------------------------------------------------------, z9 p+ I) T; v; S4 H; p
  429.   # ● 初始化
    3 o. }8 }0 r0 f( y6 d  u
  430.   #--------------------------------------------------------------------------
    3 A% B( }: \+ A1 h/ k5 K& _
  431.   alias sion_mouse_initialize initialize
    # X6 f) T( g6 M9 k  G0 F% i! j
  432.   def initialize(x, y, width, height)7 {. d9 M# T/ I; U. o! a4 K( y
  433.     sion_mouse_initialize(x, y, width, height)
      }, b. f6 U4 {* [% o6 M% e' [
  434.     @move_state = 0
    / x* U0 Q0 Z6 {7 K* |1 M% ]* V) ?
  435.   end
    / C# N% m% L5 h
  436.   #--------------------------------------------------------------------------
    3 o9 P6 M' v6 E
  437.   # ● 更新
    $ A: Q; |1 S( w7 d3 I! X& i( y
  438.   #--------------------------------------------------------------------------, C! @& M8 d! P
  439.   alias sion_mouse_update update
    8 Q  W% z2 |9 d3 i, k
  440.   def update
    6 K' S: ~1 w7 e$ C6 `7 T4 f- T
  441.     sion_mouse_update" ~$ ^4 ~- r" M' C# J; _& {% w
  442.     update_mouse_cursor
    9 ~2 W& f& X6 F8 w+ p) F
  443.   end% o% r+ o) W0 f& o1 f
  444.   #--------------------------------------------------------------------------
    ; m$ Z/ A8 S9 r! U7 P6 e5 B
  445.   # ● 启动后设置鼠标到index位置9 ]: T7 i0 w8 x8 [8 ~
  446.   #--------------------------------------------------------------------------
    % X9 y3 b; O" Y$ L- ~0 e/ U7 V' `) }
  447.   def activate
    + i0 e4 `" k. y2 i9 O: S" ?4 ^
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    * t8 }) }7 e* H% q( C0 G4 D
  449.     super* a- I- |3 _. e4 i) x/ ?" `; B
  450.   end
    + C* n! w" ]$ H  r1 H9 [$ _% p% ~
  451.   #--------------------------------------------------------------------------9 s: t$ P- y5 t) E; A: y
  452.   # ● 更新鼠标和光标的位置' t% o3 a: e9 T$ n8 y: M5 H
  453.   #--------------------------------------------------------------------------2 |6 s1 C) z9 k5 u5 I. k/ S: S
  454.   def update_mouse_cursor. R5 t) C( c5 R0 ]4 ^, v# O
  455.     if active
    : X0 F# O* s) g7 W5 O* B/ c
  456.       if @need_set_pos
    $ s- B3 U7 B# T9 b4 l$ t$ x
  457.         @need_set_pos = nil
    & D; e, F5 n- x; E+ b: D: n
  458.         set_mouse_pos
    3 O. `. e# ?* S; i9 {: c1 [3 S
  459.       elsif cursor_movable9 c% m/ n# _2 h3 H# E
  460.         Input.dir4.zero  set_cursor  set_mouse_pos8 I* {- {  n3 Y7 i
  461.       end' ]/ R0 q) z5 Z" a5 b& t
  462.     end
    + v  R7 O* T$ N, E& e
  463.   end' j4 Y+ A% b& ?; F" g8 t* d$ y
  464.   #--------------------------------------------------------------------------8 y' s5 z3 t9 x
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能
    7 b1 F( H% D3 x8 t, N
  466.   #--------------------------------------------------------------------------
    ) k, j+ g  f4 f1 \
  467.   def set_cursor
    ) ]6 m% w; T$ \$ y1 F
  468.     mouse_row, mouse_col = mouse_window_area
    ; D# H$ M; H, U" H+ n
  469.     if    mouse_row == -1
    8 g0 D9 O" K2 r# {! s
  470.       @move_state += 1 if need_scroll
    ' ?  [' t" a4 h. n% v. Q0 Y
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand
    1 T+ N) Q$ |& h' ]9 {! ?
  472.     elsif mouse_row == -2
    6 {& B3 ~  v6 `9 r1 B' |, S
  473.       @move_state += 1 if need_scroll$ f2 @  Z" V4 u% Y7 S" P. s( m
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    # l7 l7 U$ V5 S' Y4 `
  475.     elsif mouse_col == -1) u* L5 F; d9 n+ T6 t4 e& m
  476.       @move_state += 1 if need_scroll; |3 X9 M( }# j& [
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    - T- F& E& ]4 ?# n$ @
  478.     elsif mouse_col == -2- K. b7 L% K3 M, T
  479.       @move_state += 1 if need_scroll7 n& a; _8 ^( |7 }7 r9 P
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
    1 Q( r1 o7 a1 M' Y5 v/ z
  481.     else
    & Y+ B! L. W* f) g
  482.       @move_state = 0
    : v. K  G1 r  s2 y. g+ u( W
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col. ?# l2 T% {) I5 d
  484.       select(new_index) if new_index  item_max && new_index != @index
    0 ~0 Y* W: w5 D: `8 Q* f
  485.     end1 M* |" `2 y' z: _. N, ?
  486.   end+ k9 g, z' G. o# w' o8 R* ]
  487.   #--------------------------------------------------------------------------& a4 p( c: i6 s
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    ) a2 P, Y* }0 h# B
  489.   #--------------------------------------------------------------------------  S2 A. j, o1 Z9 u6 v/ \
  490.   def mouse_window_area
    ! b* J4 H3 H3 ~/ K( a5 f2 l
  491.     if viewport.nil # necessary!* h2 g! O, @* r* g
  492.       vp_x, vp_y = 0, 0+ U0 z3 `6 B. f1 Y. |1 X& W0 N
  493.     else
    5 W) f  @' @. o" K  @: q+ Z3 z  |
  494.       vp_x = viewport.rect.x - viewport.ox
    % X8 C7 r6 q/ `( b+ V/ x* x
  495.       vp_y = viewport.rect.y - viewport.oy8 B6 o2 t, M' w, |- I$ L
  496.     end
    , \( C; P7 S% ?& @
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    9 \* ~/ W; i* n
  498.     item_x1 = vp_x + x + standard_padding 6 W8 B# f- ?& m
  499.     item_y1 = vp_y + y + standard_padding
      c% [2 b- a8 [6 |1 ^1 |% ^# d
  500.     item_x2 = vp_x + x - standard_padding + width
    - l) g. S2 j, a- Y! A
  501.     item_y2 = vp_y + y - standard_padding + height: j/ h- `1 C# t% T( J, y
  502.     if mouse_x  item_x16 M: o+ i6 X8 A, i8 g
  503.       mouse_col = -1, k5 B* m7 {4 J! e% ?1 b1 _! w
  504.     elsif mouse_x  item_x2
    ' y$ W+ U% h; M8 m3 P  s
  505.       mouse_col = -2
    4 [5 m) U+ W0 S4 ~7 m+ B
  506.     else; d  Y; l8 D% C7 u) B' w
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)
    " P" V& e4 Z/ u3 F& W; E
  508.     end
    : d' O/ O; c. }  K7 v; a( ?
  509.     if mouse_y  item_y1
    ; q5 X0 }9 o* q
  510.       mouse_row = -1
    . ^# }+ N+ x. f+ a: c: C
  511.     elsif mouse_y  item_y2! Z; j- t9 S  `+ {& j, E. Q
  512.       mouse_row = -2
    5 D7 L$ H" L0 a+ k- ^# t! c
  513.     else( {' k0 U" M, J3 A8 D
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)3 j) z1 D: ?: d7 e: u2 q
  515.     end
    ) z- o0 P. u0 B8 h
  516.     return mouse_row, mouse_col/ r9 B3 m* f" |5 G
  517.   end2 t- b8 ?* G" r. L/ j8 _
  518.   #--------------------------------------------------------------------------
    + w( I# x$ ^+ ]( d7 z2 ~9 e; J# I
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置* R: D/ _3 O+ A0 B, b2 C8 O
  520.   #--------------------------------------------------------------------------: ^) F8 S8 [  g: g& \
  521.   def set_mouse_pos* h2 l& k0 I7 A6 x- W- Q9 R
  522.     if viewport.nil # necessary!- }" \  E$ |7 }! @" x
  523.       vp_x, vp_y = 0, 06 _' |0 b9 s. a) i5 a5 @6 h& f
  524.     else
    & \9 H, U6 ?$ ?7 N( d
  525.       vp_x = viewport.rect.x - viewport.ox
    " P) r+ X. T8 T! D$ N
  526.       vp_y = viewport.rect.y - viewport.oy4 e* N! v# M# D/ M  |
  527.     end. j( r3 s9 f7 `6 j
  528.     item_x1 = vp_x + x + standard_padding
    & T5 \& k4 J  \3 Q6 ?/ ]; }* M. q
  529.     item_y1 = vp_y + y + standard_padding
    - v9 I( s# s, Y0 b: r$ Q# }- K4 M
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index * q. X, r1 F  B! F0 |6 B, B# s
  531.     row = get_index  col_max - top_row
    - p; _: J) a' Y  g/ x7 @4 d. y
  532.     col = get_index % col_max" B% F; o" W, d1 X7 d) ^
  533.     new_x = item_x1 + item_width  (col + 0.5)
    ' ~: |7 W% {; {' W7 q' O0 q$ j& r
  534.     new_y = item_y1 + item_height  (row + 0.5)
    + T2 y% d1 R5 a! l/ {
  535.     Mouse.set_mouse_pos(new_x, new_y)
    3 b. o9 L4 ~: N
  536.   end4 L4 O. w; I7 L0 ?- I. J7 u% y
  537.   #--------------------------------------------------------------------------5 v$ ^2 N3 C- u5 [6 R( l
  538.   # ● 判断菜单是否需要卷动
    + t. _: T  k, F8 p; |+ |& N' B
  539.   #--------------------------------------------------------------------------
    ( ~% N; U4 z, z' H! ]- K
  540.   def need_scroll
    - G* I  m7 f9 s4 }
  541.     item_max  col_max  page_row_max! X3 U. g3 o* V2 H7 I
  542.   end
      I0 p1 {: z: A/ ^5 l2 @
  543.   #--------------------------------------------------------------------------
    ( K# _) \  C6 h0 v; U' A, }+ j9 s! ~
  544.   # ● 判断是否为水平卷动菜单7 t: O0 Y8 \6 N  k8 |* z4 u% I; r
  545.   #--------------------------------------------------------------------------% I6 V6 [7 Z$ c- o; g# ^
  546.   def is_horzcommand4 V# C. Z0 y) k" R, u
  547.     return false
    ! [/ J" x6 B( f5 O" _# m$ k$ s4 X  h
  548.   end. d! O& g, H0 Y& v: A( `, |' ^/ O
  549. end& D3 n/ i- E* Y4 u% z& k7 p
  550.   H* W+ [$ c/ ~! @2 O" z) q8 s0 u
  551. class Window_HorzCommand
    1 T3 R! w8 Q7 H* m3 m- o
  552.   #--------------------------------------------------------------------------- ^5 u$ J0 q# h) q9 i! W
  553.   # ● 判断是否为水平卷动菜单
    % ?& z* ?) t  G- K1 U
  554.   #--------------------------------------------------------------------------8 H5 O3 k# {! i3 G3 g7 _
  555.   def is_horzcommand
    3 e, L" J7 F4 C0 d4 E
  556.     return true
    / b' ]4 @4 J9 h2 p) N, j5 h& ~
  557.   end- w0 x# c  [" t) g. I0 ^. F, s, R  j
  558. end9 W" Q: z$ }4 X$ r2 S) X: b
  559. 9 b2 m! ~5 H1 [1 l) Y8 ~
  560. #==============================================================================6 k6 H! [) q7 X) n  a. p
  561. # ■ Window_NameInput) @* z4 }: j; l$ m
  562. #------------------------------------------------------------------------------
    & M: \9 |0 H( b) L
  563. #  名字输入画面中,选择文字的窗口。
    : I  `1 i9 r) D% f% F6 S! f; V* c
  564. #==============================================================================
    0 t, n8 |. E. e" ^% f+ U1 R
  565. class Window_NameInput
    - f, Z4 D# k" s: v, y- `# Z, `
  566.   #--------------------------------------------------------------------------
    : o/ h; I/ v) q( g/ d+ I) u
  567.   # ● 设置列数" |0 B# A3 Z+ C0 z
  568.   #--------------------------------------------------------------------------
    ) ?+ G; h0 X" r( r8 q! W; e  Z
  569.   def col_max% L) \. V. \4 ?2 X, r
  570.     return 10
    ( z  {9 @: d- e2 R8 j9 U# @% B
  571.   end6 w: ?* q) J) I9 e4 E6 z( K
  572.   #--------------------------------------------------------------------------! l8 B2 }4 ?; }( W4 F
  573.   # ● 设置填充的Item个数5 t' U" J! O; e7 o; Y- T% {
  574.   #--------------------------------------------------------------------------
    1 L* j8 G4 J( R1 {
  575.   def item_max
    ( i0 I6 A0 V' a4 Z* E; S1 U6 d: K
  576.     return 90
    ' K/ q' m9 }8 }
  577.   end
    4 \) B" `# a( Z8 h( z
  578.   #--------------------------------------------------------------------------: u8 o0 g. N; N0 e
  579.   # ● 设置填充的Item个数7 D6 D( y4 k2 b% \8 o# z
  580.   #--------------------------------------------------------------------------
    8 f) V- J7 Y" Y3 F: d. L  h
  581.   def item_width+ y6 ]9 v3 H6 G
  582.     return 324 H( U9 ?. D' d5 s+ G0 H* L
  583.   end7 L3 \9 g0 W6 x, ~) Z5 u+ \5 ?& A' r! W
  584.   #--------------------------------------------------------------------------
    7 X2 o  r. `' M/ G
  585.   # ● 判断鼠标位于菜单的第几行、第几列
    ! {1 d+ H& p8 b9 [
  586.   #--------------------------------------------------------------------------4 S5 H7 j8 g  o) P1 X
  587.   def mouse_window_area+ U5 v6 X" Z0 Y" Z7 y, @4 w) l- G3 O
  588.     if viewport.nil: y1 W2 Z$ h2 v
  589.       vp_x, vp_y = 0, 0
    2 B) E& z  J+ O; F
  590.     else
    , n* r  m) T) q9 ~5 B; b. V
  591.       vp_x = viewport.rect.x - viewport.ox* H; I1 w# `9 s3 c9 U; [4 N$ o
  592.       vp_y = viewport.rect.y - viewport.oy
    / F  ?) [; l; a) d% X
  593.     end
    8 k" N9 n3 j2 p# }+ U" }
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    . t9 O* t4 L( V: A( E3 h+ y: D
  595.     item_x1 = vp_x + x + standard_padding 3 }; z/ c8 I: J/ }8 W
  596.     item_y1 = vp_y + y + standard_padding' Z0 n# V. A  L2 q9 V
  597.     item_x2 = vp_x + x - standard_padding + width
    & a4 a/ {2 w' a
  598.     item_y2 = vp_y + y - standard_padding + height. X9 P4 I5 a2 \+ S' e2 K" E
  599.     if mouse_x  item_x1$ k1 \& _2 [/ [9 U( h: p
  600.       mouse_col = -1# m& x( p( R8 l$ |# Z: x
  601.     elsif mouse_x  item_x2
    # a  h( C( [/ G# u. ?4 a. @) A
  602.       mouse_col = -2
    4 j7 Y% n& D% m) |3 w7 j, F
  603.     elsif mouse_x  item_x1 + 160
    , |7 ^2 i% E# j
  604.       mouse_col = (mouse_x - item_x1)32
    ; i4 f& H: Q. p
  605.     elsif mouse_x  item_x2 - 1605 s6 ?9 C  W$ ]8 x2 p5 _9 J, w
  606.       mouse_col = 9 - (item_x2 - mouse_x)32" E; |! P% S. q: z
  607.     else
    , l7 p# J  u  W' z
  608.       mouse_col = mouse_x  x + width2  5  4: H2 ]  o( j  J5 a3 e
  609.     end5 X5 p2 M5 _; n5 \
  610.     if mouse_y  item_y1. \, G: y1 L3 p' h4 a6 ^: L3 @
  611.       mouse_row = -19 J& y, V- }2 p' `5 v
  612.     elsif mouse_y  item_y2
    ; W0 ]( S8 K* [0 t
  613.       mouse_row = -2
    ' z0 N0 V3 A" |
  614.     else
    + s3 `6 r6 e' t' ^
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)9 T7 l! \, V# ]" N/ F5 Z1 m/ M4 \
  616.     end/ R  C7 T. m  F7 N+ C4 v
  617.     return mouse_row, mouse_col
    4 a. e2 Z$ x) O8 M, h$ _! F
  618.   end
    - l5 i1 S8 B( v7 J
  619.   #--------------------------------------------------------------------------0 s! ~* n' L( v- V9 E$ e1 Z6 y9 |
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    $ f7 t" i9 ]' c& O: ?2 \
  621.   #--------------------------------------------------------------------------
    ' x2 x' ^! g) S" q. Z) g" ^
  622.   def set_mouse_pos2 L4 Y& |% ^7 c# R
  623.     if viewport.nil # necessary!
    0 k7 b# i; T, F% N  b. M. o
  624.       vp_x, vp_y = 0, 0
    ! H3 [0 D( F+ a$ o* {  r. t
  625.     else! r% N6 B0 A6 e  l
  626.       vp_x = viewport.rect.x - viewport.ox7 j* U! v0 L+ ~% A1 _! v. M% X8 P
  627.       vp_y = viewport.rect.y - viewport.oy. y& E6 H0 B; @1 E7 |- ]5 J4 t$ M
  628.     end
    + R  T5 Y5 o0 m- H$ A  i
  629.     item_x1 = vp_x + x + standard_padding
    ! [- [+ r5 S% ]6 Z2 a
  630.     item_y1 = vp_y + y + standard_padding; c$ X# u7 ?: X0 y* |, u
  631.     get_index = @index  0  0  @index 1 e) o+ K& e2 \' B- ~
  632.     row = get_index  col_max - top_row
    1 t. X, P) Q  R: `# s
  633.     col = get_index % col_max
    / J2 g+ j+ W# b6 T- E
  634.     new_x = item_x1 + item_width  (col + 0.5)0 \6 t9 d* N3 {' N, Y& \" q4 L  K5 r) v
  635.     new_y = item_y1 + item_height  (row + 0.5)
    1 a# j4 D( Z) F* H) V, l! N4 Z9 q
  636.     new_x += 14 if col  4
    1 @7 H! s6 Z' O+ ~( X2 T
  637.     Mouse.set_mouse_pos(new_x, new_y)
    7 W% K" M3 Q( j* ]
  638.   end  g& W" ]1 v. u3 k* W: W
  639. end- C, ]" \) F6 J' r: g) V
  640. 9 ~9 P/ ~/ t# @! Z# R& R  q
  641. #==============================================================================
    , H* ~' J" ^/ E- N6 p
  642. # ■ Window_NumberInput
    7 h: R, ]5 F/ ]+ {8 }; `% D
  643. #------------------------------------------------------------------------------" x( R+ x& N. j) v1 t7 K3 v- `
  644. #  重写了数值输入的方法以适应鼠标
    . _; ]" p* J: z& x: m/ w, v
  645. #==============================================================================
    9 L* Z2 [  t* i* O% E% W3 A
  646. class Window_NumberInput  Window_Base/ H' W; p- k' ^) S' T/ G
  647.   #--------------------------------------------------------------------------& F, A1 q7 u' Y
  648.   # ● 定义实例变量
    9 Y; b5 h5 @3 ]% F6 G; {3 Y/ p* h
  649.   #--------------------------------------------------------------------------
    6 U" _( e/ i! P: F9 W4 G7 k7 J
  650.   attr_reader extra_window5 Z* `5 w1 n- L* A2 a% |
  651.   #--------------------------------------------------------------------------
    : g- j2 J( c) h+ M9 u, M: f1 h1 a
  652.   # ● 初始化
    3 ]: |+ Y" d/ h. k1 d- L
  653.   #--------------------------------------------------------------------------! y4 _* G3 U; H2 }) c) S& ?
  654.   alias sion_mouse_initialize initialize( k. p2 Q' {1 e6 r  K! r
  655.   def initialize(arg)
    4 J0 ]) O# B$ z& P$ y  G7 X! V
  656.     sion_mouse_initialize(arg)/ S. ~+ c8 Y, `' g1 z
  657.     create_extra_window
    / s: l9 L' J5 O2 {0 B! O6 P9 G
  658.   end
    - @" W3 ]% l+ S  _9 V% h: ^. K9 k. R
  659.   #--------------------------------------------------------------------------
    % D9 x( T+ b2 t2 H: [* I
  660.   # ● 启动0 W1 ]" Y# u  l5 @
  661.   #--------------------------------------------------------------------------% p- b  m$ N+ `) P% N0 p+ H4 F
  662.   alias sion_mouse_start start
    5 d% {6 L- l8 S* t: \8 `
  663.   def start& a  d/ u9 x* n' ?: {' y
  664.     sion_mouse_start
    7 t2 ?- k0 _' ?  D+ X
  665.     deactivate- @! C* P+ }. h' [" m: c
  666.     extra_start% }  P% G5 R7 [/ G' }. t/ b+ L: P
  667.   end$ |$ U, L! m- v  G& D1 P; f& o0 M9 Z
  668.   #--------------------------------------------------------------------------8 v# b) g2 d. X! s: `
  669.   # ● 创建新的数值输入窗口  @$ a1 a- Y5 p" f& l
  670.   #--------------------------------------------------------------------------, k. P; Y. j9 m4 f9 F
  671.   def create_extra_window
    ) r; H0 Y2 y4 Q2 P$ |9 D4 O& e, b
  672.     @extra_window = Window_NumberInput_Ex.new
    / [; X% s3 }- T& k* o2 `
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  24 d5 c1 D. p+ \- w  x0 q3 Q- K
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }  c9 u8 ~: H. u4 y' H
  675.     @extra_window.index_proc   = Proc.new {n @index = n }
    # d4 W* F' I, {; J0 {% T; F& x
  676.     @extra_window.close_proc   = Proc.new { close }: w. H3 d) \" c# w$ P
  677.     @extra_window.refresh_proc = Proc.new { refresh }
    $ Y# _1 z$ Q  u6 l9 I6 f( {( w
  678.   end  E! D9 l  y' \$ T# @
  679.   #--------------------------------------------------------------------------
    9 b% g, [8 f* ~6 O, Q; z3 s& u- @
  680.   # ● 激活新窗口( o6 e" T9 t0 v6 J+ e" d4 {/ D- p
  681.   #--------------------------------------------------------------------------# J; _* C4 L3 O+ y# S1 c$ i
  682.   def extra_start
    , p, o* V: w) p/ O  {
  683.     case $game_message.position
    . J' U0 i* R- _, j6 y
  684.       when 0; @extra_window.y = y + height + 4+ P1 z) @7 |/ `* @2 _5 b
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8+ B' ^$ y. Z% }' N5 O/ L# P. v
  686.       when 2; @extra_window.y = y - @extra_window.height - 48 b0 t" @- p5 x( g, M, ~& a4 K7 ]( ~+ k
  687.       else  ; @extra_window.y = 8
    6 P6 w# w) f1 g" Q4 d$ g
  688.     end, U' ^& w. D1 h6 Z
  689.     @extra_window.variable_id = $game_message.num_input_variable_id
    - K8 v5 y1 C9 o9 \. Q
  690.     @extra_window.digits_max  = @digits_max) J8 @9 d' F9 j+ ]% c" A0 _( Q
  691.     @extra_window.number      = @number; B+ R- G+ \/ c. x
  692.     @extra_window.open
    5 Y4 t2 e- s/ j/ O4 b
  693.     @extra_window.activate0 {' J/ }2 B! L
  694.   end
    . d* X+ r: g5 ~+ n* \6 M
  695.   #--------------------------------------------------------------------------
    " _7 O5 W! ?, y
  696.   # ● 更新( ?9 ~1 A( Y1 b, [5 h
  697.   #--------------------------------------------------------------------------
    , u( y% {' e) a
  698.   def update! y3 R3 f7 W+ _3 D; Y
  699.     super
    % C- g$ q9 ?% h3 K
  700.     @extra_window.update
    : U2 P7 }7 ?& v, O2 L3 }
  701.     update_cursor& J5 o, a- V) P9 s
  702.   end
    ! O7 S  ]& {  T- k" R/ L
  703.   #--------------------------------------------------------------------------
    , f6 A, w) k! \. D* a- f
  704.   # ● 关闭窗口7 N# w# n" `+ E: l8 }" ]
  705.   #--------------------------------------------------------------------------* Q. |$ c" V/ ^! a* f9 x  B+ m
  706.   def close
    % D& D6 E9 w. H/ X5 T* r0 P
  707.     super; |8 ^4 I- _2 q' ]! \- I- I1 N
  708.     @extra_window.close0 {) U. h8 u9 `6 f
  709.     @extra_window.deactivate; F) M. l+ v6 m8 }) A0 \
  710.   end6 Z' f" }% h8 D9 r. J7 N% a' K; e3 ?  R, l
  711. end
    ) M( D& K& m3 l: c4 c- P

  712. 0 `* r3 z- _4 e% E
  713. #==============================================================================
    8 u) ]# H0 N' ^& w
  714. # ■ Window_NumberInput_Ex
    1 j7 U1 V) v" k# B+ S
  715. #------------------------------------------------------------------------------+ D) x/ h% j% g" P5 w
  716. #  新的数值输入窗口(NewClass)2 O2 ~# C5 e5 ?8 C9 E; e
  717. #==============================================================================
    9 F+ ], {* U: t  i) n
  718. class Window_NumberInput_Ex  Window_Selectable$ n* j! {1 Y) `- T  v! R1 t
  719.   #--------------------------------------------------------------------------
    ; J# G" l# v+ O9 `* i
  720.   # ● 定义实例变量; f& p2 i, m1 S! ]! e9 ~" ?
  721.   #--------------------------------------------------------------------------6 I- k4 p& \, H8 J3 g
  722.   attr_accessor number_proc
    , D, E" p8 m' g) U
  723.   attr_accessor index_proc
    8 J' D  {; e" s' b8 g5 V6 q
  724.   attr_accessor close_proc6 c7 ^9 ?2 H" L2 Z0 [. E
  725.   attr_accessor refresh_proc
    : m/ e% G; R8 w5 _2 O
  726.   attr_accessor number
    + f" c$ h0 y7 X# n" j- f* V
  727.   attr_accessor digits_max5 a& ?. z% C. o
  728.   attr_accessor variable_id
    & R, H3 \( D# b9 f" g) i
  729.   #--------------------------------------------------------------------------
    + Y- ~$ H! z. ?
  730.   # ● 数字表+ R- i2 h% L7 }2 @& m! X: }4 B
  731.   #--------------------------------------------------------------------------1 H( q% P. L. e9 a& g8 X
  732.   TABLE = [  7,  8,  9,
    " i! j% j5 S6 \0 N
  733.              4,  5,  6,
    , V* Z% J: w8 R  L/ M
  734.              1,  2,  3,
    8 A% Z6 M/ b# C
  735.             '←',0,'确定',]9 k6 t0 B) g5 h5 ]5 }
  736.   #--------------------------------------------------------------------------
    3 _/ R; O5 x1 Z- Q! o! B: `
  737.   # ● 初始化对象
    . A) g& W! L+ f
  738.   #--------------------------------------------------------------------------
    ; y+ p% Q5 S# h5 a" r
  739.   def initialize6 u$ g  |/ \6 l) N* H, M
  740.     super(0, 0, 120, fitting_height(4))" W$ |8 V( u6 R( b& N8 C
  741.     self.openness = 0% c! A% J5 B7 ^+ T( g
  742.     @index = 0
    # k" e+ Q  z& T. P% _3 r0 f
  743.     @number = 0% n: q& x. G' y) ?3 a7 M
  744.     @old_window_index = 00 V! n7 b8 Z! r5 z* }' \* A
  745.     @digits_max = 05 N9 ]2 y: Y6 L" j) ^
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }8 g9 z% ~. ~0 M% e* N$ y( c1 L
  747.   end
    7 V- p- G& d7 J! Q: U
  748.   #--------------------------------------------------------------------------
    : c7 |  k4 ]) b3 \# q5 [
  749.   # ● 获取项目的绘制矩形' y- R2 ~. N4 _4 ?6 G& F
  750.   #--------------------------------------------------------------------------
    5 e! O0 q# \: k9 W
  751.   def item_rect(index)# t/ G' G! [* [+ w- s" D
  752.     rect = Rect.new
    ) U& E& N2 U' b! [* {
  753.     rect.x = index % 3  32
    ) I5 d+ J  Z$ K- F- c
  754.     rect.y = index  3  line_height
    ; {: I) r6 N8 r' G4 H* U1 Z$ H& k
  755.     rect.width = 32
    & S% j: f& u5 J6 @4 U2 x- s
  756.     rect.height = line_height0 c5 ?% I& J/ X% }7 X
  757.     return rect
    0 ^1 o7 C, L) a$ Y4 u, y$ A/ Y
  758.   end
    : \7 @9 i/ s1 h1 C8 C$ F! {
  759.   #--------------------------------------------------------------------------
    1 \  ^, u% h5 D2 F" j3 E
  760.   # ● 将光标设置到鼠标所在的位置
    . c  A! y2 W8 Z; Q7 q+ b
  761.   #--------------------------------------------------------------------------
    & U- p, Z1 F5 x% c2 d0 \3 X
  762.   def set_cursor! P+ N  |0 I, y7 T8 \
  763.     mouse_row, mouse_col = mouse_window_area6 {) a2 r" s' n$ f1 [  H
  764.     if mouse_row = 0 && mouse_col = 0
    8 k% V4 f. A* Y, V
  765.       new_index = mouse_row  3 + mouse_col) g3 s; z$ v% w8 o( @$ b; w. Y
  766.       select(new_index) if new_index = 11- J+ n8 L) O& n$ [. j
  767.     end8 k; @% M8 J$ v1 ]0 @
  768.   end
    ; F/ c" J$ l% T: d- W
  769.   #--------------------------------------------------------------------------
    $ e- `6 o* b& B& r
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列1 O* y  m8 T$ G' A
  771.   #--------------------------------------------------------------------------
    * y* F4 @  L& k
  772.   def mouse_window_area
    3 Y# m4 f7 V. }& S: j2 ?. F
  773.     if viewport.nil3 w) o( D, O$ N& f- \
  774.       vp_x, vp_y = 0, 0( [  T# b! d4 p- l
  775.     else! S) c) f. A; E7 q3 R
  776.       vp_x = viewport.rect.x - viewport.ox2 |3 N$ E& Z5 k# B+ a, T# S' p; C
  777.       vp_y = viewport.rect.y - viewport.oy
    / C+ p! m; w/ L3 H4 ~$ [, @
  778.     end
    " E% d1 k5 Y1 |7 }8 j+ |
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    4 J& t7 c2 d% ]3 h  r
  780.     item_x1 = vp_x + x + standard_padding   {3 Q/ G5 m7 T
  781.     item_y1 = vp_y + y + standard_padding
    3 s( M7 w' A3 t  f% J
  782.     item_x2 = vp_x + x - standard_padding + width. i- @* R8 W3 ~9 B; ]6 @
  783.     item_y2 = vp_y + y - standard_padding + height; D4 c7 q: i4 t+ I7 m
  784.     if mouse_x  item_x1& n! X: R& N0 D- R* n/ S
  785.       mouse_col = -1
    * _  t0 K4 a5 E& V% Z/ ~5 h
  786.     elsif mouse_x  item_x21 C7 K) P- r+ K( P3 ~
  787.       mouse_col = -2" `6 ]8 U% I4 z) A; y$ ~
  788.     else
    , B9 S+ I/ E* D' m$ h
  789.       mouse_col = (mouse_x - item_x1)  32
    % i; G/ U, b. |/ I
  790.     end+ S, x, @/ S+ T1 P+ n! r0 H4 S0 J
  791.     if mouse_y  item_y1) n  L, c# d7 Q/ S" |, X
  792.       mouse_row = -1
    8 s( d8 ^, k, M) y
  793.     elsif mouse_y  item_y2
    0 I& r; ?9 d: }! n
  794.       mouse_row = -21 G2 X8 {; H: l, Q8 W4 N; ?
  795.     else: o" `9 C5 I' ]
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    # {* d. p! q6 G: j5 y" g5 k
  797.     end$ D& ?1 D0 r5 W6 P  @' c
  798.     return mouse_row, mouse_col
    , v( A- d' M6 Y
  799.   end
    1 ^8 A8 d0 t. h7 w
  800.   #--------------------------------------------------------------------------! i) }: F& K) {2 v6 @" F- W! p
  801.   # ● 获取文字* d9 @- R) d: o
  802.   #--------------------------------------------------------------------------
    # h* c# U" c7 F! D- b$ {
  803.   def get_number
    , [9 P, V: d% ~
  804.     return false if @index == 9  @index == 119 H9 i6 l$ f0 t! z8 Y
  805.     return TABLE[@index]
    " V: l+ F7 n  |% c$ _0 ?+ l
  806.   end
    / G* p  c4 {' [, F1 g  A& U
  807.   #--------------------------------------------------------------------------; P; j7 g; h. p( t: i9 R; B' |
  808.   # ● 判定光标位置是否在“退格”上
    6 B3 d, {/ ^1 ^/ p2 u; P
  809.   #--------------------------------------------------------------------------
    . s* P  @) T- D2 u+ Q- o; d' T- c
  810.   def is_delete% D; `* A% x$ R3 v9 \3 b
  811.     @index == 9
    % K- g5 F( f+ @9 `. d: W4 }- j
  812.   end& L! ]; G1 o' k% D  |( j" c6 f
  813.   #--------------------------------------------------------------------------
    ' |( }9 W( K  F7 S: ~! Q
  814.   # ● 判定光标位置是否在“确定”上
    3 Z+ k; {( b8 u1 N; Z
  815.   #--------------------------------------------------------------------------/ Y( e( u: U1 o! @3 U
  816.   def is_ok7 T& s: L- z( d( E) b. B
  817.     @index == 112 v( d' C: G, `) |; V9 T
  818.   end
    2 M- x, [; P% X. b! a
  819.   #--------------------------------------------------------------------------/ d9 A7 [/ y" C) V+ H2 ?' o. B
  820.   # ● 更新光标6 h" ?! D2 k1 H) |
  821.   #--------------------------------------------------------------------------
    ; l( g/ ^+ `; q5 Z9 p) i
  822.   def update_cursor
    % s% J! F  y  W( f/ n
  823.     cursor_rect.set(item_rect(@index))5 W7 V" T7 L4 F1 b
  824.   end, M1 ]' M- H0 K/ R/ ~
  825.   #--------------------------------------------------------------------------
    " ~% j* b& F! l5 q! g" t: K- e1 e
  826.   # ● 判定光标是否可以移动" o5 H' v8 z4 h9 W- z, H* b4 n" ^+ x
  827.   #--------------------------------------------------------------------------, ^) \3 ^# A$ p; Z, l) J$ J6 z
  828.   def cursor_movable* {% z  s  a. n& J3 V$ c& ]  q1 |
  829.     active
    : K3 B8 b! ]# }$ v9 @* x/ T
  830.   end  v: y  _1 I1 ^- l
  831.   #--------------------------------------------------------------------------; K) [* |7 h+ g8 h9 m9 l' \& i
  832.   # ● 光标向下移动
    $ o" O2 h! G, k" b2 R, |
  833.   #     wrap  允许循环, g2 Q7 T7 H2 L8 ]! \
  834.   #--------------------------------------------------------------------------
    3 M( _. o4 d8 p5 A
  835.   def cursor_down(wrap)
    * L. `5 Y9 i7 X$ ^% {8 P0 a9 J9 H' e' P
  836.     if @index  9 or wrap! q" C2 I. @2 o; y
  837.       @index = (index + 3) % 12
    8 r9 P+ Q% \% i- k" _
  838.     end8 x# u4 L: p/ X# m  J; s, Z
  839.   end
    0 P8 W% C% y+ S6 n' u& V2 Q' U
  840.   #--------------------------------------------------------------------------
    5 u& F3 F3 |; ?' [2 m2 D
  841.   # ● 光标向上移动
    # Q1 }0 K2 g7 ~: ^
  842.   #     wrap  允许循环
    , s; z' B7 m( t& B2 w+ H- z1 \& U9 Q
  843.   #--------------------------------------------------------------------------' N6 v/ A4 l8 L% t/ H# f6 s
  844.   def cursor_up(wrap)
      p/ `& P+ t1 ~& |+ V. w0 {+ @
  845.     if @index = 3 or wrap
    - p" j6 |! j2 }' Q, g
  846.       @index = (index + 9) % 12& H/ T/ l' x3 y& V5 M3 Y8 C
  847.     end
    ( @( K  b' o$ t; n9 B$ H1 n% ]1 q
  848.   end  C& k" z' t; {1 I: c" i
  849.   #--------------------------------------------------------------------------
    ' L& x5 k7 I: o
  850.   # ● 光标向右移动( m, z! y! z! p" C& y5 i0 l
  851.   #     wrap  允许循环+ ^& v: ~- X6 H/ i
  852.   #--------------------------------------------------------------------------
    . m7 y9 e9 H, t; j" A
  853.   def cursor_right(wrap)- ^; M! o9 Z4 \/ i
  854.     if @index % 3  2
    & H6 T  K. [3 _0 I4 B" E! x% q
  855.       @index += 1, ?3 r8 W* S  Y; H; i
  856.     elsif wrap2 t+ }6 Z3 e% G6 `+ i9 S) {9 K
  857.       @index -= 2" C. E, }3 k! x$ r7 n) A3 f
  858.     end
    ( D. j$ N3 C/ l9 _- _
  859.   end
    ; L5 i3 |2 F, m+ e0 L% i9 X, L
  860.   #--------------------------------------------------------------------------0 x# K7 {) Q! G1 {) y
  861.   # ● 光标向左移动# \2 G- [$ N9 X) |, R
  862.   #     wrap  允许循环
    - o  O5 |& b3 w( C
  863.   #--------------------------------------------------------------------------
    5 I, n/ j; B4 W' g+ U% Z( n
  864.   def cursor_left(wrap)
    5 B$ k2 O/ Z. {+ N; @2 u1 T/ ]
  865.     if @index % 3  0
    " [3 X$ w7 S" o9 [) @# V$ Y
  866.       @index -= 1
    ' S/ t* F( P2 ]: \7 \8 I% s
  867.     elsif wrap6 g+ U" R$ W! ]3 D9 N. N
  868.       @index += 22 c# F& y' x( o3 d% [! k
  869.     end
    6 {* S+ V# M% N' T
  870.   end
    ; `/ `3 b& ?. S0 Y8 g
  871.   #--------------------------------------------------------------------------
    9 m. P4 z2 ?4 K1 x
  872.   # ● 处理光标的移动
    9 C) Z2 L' ]! O8 M/ e
  873.   #--------------------------------------------------------------------------
    " m% ]5 J0 k( V9 Y
  874.   def process_cursor_move# I- E" d8 v* I9 Z' A( |0 X: A
  875.     super$ I2 `* \" ?* F: E8 p. p
  876.     update_cursor; w3 `  ?1 Q3 {( M( {  s
  877.   end% o& n2 n$ i$ v2 G1 ~" W' w
  878.   #--------------------------------------------------------------------------: d0 x0 k% n/ l1 t* S, `
  879.   # ● “确定”、“删除字符”和“取消输入”的处理& m" h9 C% d% Z/ u6 ~# h( y) p
  880.   #--------------------------------------------------------------------------# B; u# d! M; ]" E
  881.   def process_handling
    ( v7 |; E% ^0 Y
  882.     return unless open && active
    * e0 V  H& t$ o. A, b
  883.     process_jump if Input.trigger(A)
    + l. y: {8 K& B& i- g0 P9 A
  884.     process_back if Input.repeat(B)( b% ?0 @  l/ f9 R
  885.     process_ok   if Input.trigger(C)
      w' Z. N5 A, Z* I& B. S
  886.   end
    * Q( `1 Z( v. ~/ Z: N8 u
  887.   #--------------------------------------------------------------------------
      C2 K0 z* k) ]; E/ X
  888.   # ● 跳转“确定”3 B0 }3 J( K" L1 }, _7 d
  889.   #--------------------------------------------------------------------------1 s4 C3 k+ o1 {+ N1 p
  890.   def process_jump. `* U; \+ |2 ?, w2 `$ Z- i6 G
  891.     if @index != 11
    & H) t' L& N+ \# }6 ~" a
  892.       @index = 11
    0 |" J) w( y5 b9 g
  893.       Sound.play_cursor
    / f' n+ @/ S- E8 m6 B
  894.     end
    % q1 y- M; f+ M3 X& a
  895.   end6 |- l  X! {4 s5 n2 C1 K% f
  896.   #--------------------------------------------------------------------------- m& c  m5 I9 E$ X
  897.   # ● 后退一个字符1 D( f1 `9 X, C' \. E& p9 d
  898.   #--------------------------------------------------------------------------8 C8 _+ U( x' i8 O
  899.   def process_back
    7 g5 ]) d9 T' H0 S7 s  T
  900.     Sound.play_cancel- b1 q, }+ z& d! Y
  901.     place = 10  (@digits_max - 1 - @old_window_index)% ]+ q9 k0 e! v7 P
  902.     n = (@number  place) % 10! s0 b: v, i3 P. ^( K+ M
  903.     @number -= n  place
      }* D" v; I4 ], H' o# T& e
  904.     @number_proc.call(@number)0 @. j; X. U; k
  905.     @old_window_index -= 1 if @old_window_index  0
    + i  U8 w& J7 s
  906.     @index_proc.call(@old_window_index)
    9 P7 Y4 T1 j. k6 k' K
  907.     @refresh_proc.call0 R' U+ [3 c# M# G8 [) ^
  908.   end" ]  h8 m% a% I* {9 p
  909.   #--------------------------------------------------------------------------& R  I: j' K6 d; {( V' ?6 e+ T
  910.   # ● 按下确定键时的处理" P0 h. V) t8 [5 ^  D: r7 Y3 N
  911.   #--------------------------------------------------------------------------; v  \" p% Q' d1 c
  912.   def process_ok: F/ z' N0 d5 K% q/ l/ Y3 |0 @
  913.     if get_number
    / c( u7 n; H% m- F$ E
  914.       Sound.play_cursor
    . a5 `+ ?; A" Q8 y+ w
  915.       place = 10  (@digits_max - 1 - @old_window_index)) x9 W; \+ G0 x
  916.       n = get_number - (@number  place) % 107 E$ X$ c0 k8 L9 O' B- M
  917.       @number += n  place6 O% m' g8 l$ J/ |3 _
  918.       @number_proc.call(@number)
    7 u9 V. L; [6 e
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    : Q1 N4 V* ?# i( o! M6 ^
  920.       @index_proc.call(@old_window_index)
    # B1 U" K% W( v7 Q, E4 n) q  ~
  921.       @refresh_proc.call
    ! _/ O1 o  a1 g7 z6 J4 J7 {
  922.     elsif is_delete
    " C2 x* ^  M# K' a
  923.       process_back
    % K1 `# j' ]9 i8 C
  924.     elsif is_ok/ n  X5 E1 R5 @
  925.       on_input_ok
    2 k9 o- [3 l+ E0 K7 W. H
  926.     end! @% V5 S+ o6 x$ H  u$ _  j  [
  927.   end
    : f' s: }$ J7 O( F
  928.   #--------------------------------------------------------------------------1 Z* j! N# P+ Y4 d/ [3 R
  929.   # ● 确定
    & t2 F5 Z  G: K* \  h! {
  930.   #--------------------------------------------------------------------------+ d; b7 Z* I7 n# g5 {; I$ o
  931.   def on_input_ok4 i. r0 W- H1 q, A; G' _) P3 f8 d
  932.     @index = 0
    2 g+ j6 u% |2 L5 \4 \1 Z- v) |
  933.     @old_window_index = 05 @( |& W2 W! s! T# L
  934.     $game_variables[@variable_id] = @number+ }/ S+ n/ r; k% b. h
  935.     Sound.play_ok% N5 V  h2 H$ M6 j( g$ k
  936.     @close_proc.call
    + y5 q1 M3 g$ w0 Q. E5 w
  937.   end% s! X) o4 Y# Q
  938.   #--------------------------------------------------------------------------5 v  P4 Y1 _6 \; x6 U
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置" ^; \. R* V9 `: K! s6 ^, o4 \
  940.   #--------------------------------------------------------------------------/ g/ Y! S9 ]$ ^7 ]' b2 M
  941.   def set_mouse_pos0 w8 }$ T9 x4 |6 X: ]* c7 r( D
  942.     if viewport.nil # necessary!
    * F- @( e* `; j
  943.       vp_x, vp_y = 0, 0
    9 L; |4 l2 }1 V  n; L# ?4 H
  944.     else
    ) W; t. I$ {9 {' @& T4 e; o
  945.       vp_x = viewport.rect.x - viewport.ox
    + s, V' y9 x0 v- d  X/ Q7 e) O
  946.       vp_y = viewport.rect.y - viewport.oy9 L4 l8 Z8 T" b& P
  947.     end! ?  U; h6 s# i& a) r7 a  |
  948.     item_x1 = vp_x + x + standard_padding
    / Z% V4 C& y  G$ T  H5 {; Q/ w) e
  949.     item_y1 = vp_y + y + standard_padding
    * R5 X7 X8 y+ q9 R
  950.     get_index = @index  0  0  @index $ ~+ C  M# m0 l$ d  `
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)
    1 ^' l; j: K$ I3 c
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)
    & z. I9 y9 g. J
  953.     Mouse.set_mouse_pos(new_x, new_y)
    5 }6 W) K0 }" P4 J. I/ ~
  954.   end
      ?. f- }- w3 W* _. D( l) J8 o, l( X
  955. end" I4 v/ Z- _8 F. w/ K5 k1 L

  956. " F8 x+ g# r# T# ]( D1 `
  957. #==============================================================================
    , T) ^2 D) Y4 u
  958. # ■ Window_Message
    8 n% \" Y, B! I. a7 W- {
  959. #------------------------------------------------------------------------------( j' v( ?9 k. A+ B1 m  m  t
  960. #  显示文字信息的窗口。/ X. j$ h$ i7 N0 [/ R- }  Q
  961. #==============================================================================
    + u! N% u4 r0 U7 c" V
  962. class Window_Message  Window_Base: W" O9 z% O& U" M! K" I
  963.   #--------------------------------------------------------------------------0 y9 \) e* M" I$ c; b" M% m
  964.   # ● 处理数值的输入(覆盖原方法)  ~8 e) G2 j7 H4 y  t* b8 i! ]; Z
  965.   #--------------------------------------------------------------------------
    ' Q" M' g9 |' h' k6 d2 v# o
  966.   def input_number
    $ q# h+ |: t% h# P( a$ W1 z0 |
  967.     @number_window.start: D" m, U) V" F$ S7 N0 }* x
  968.     Fiber.yield while @number_window.extra_window.active7 \. M( v- i) ^1 Q4 w4 w5 w/ T4 f. l
  969.   end4 v& X5 L5 U8 r& {
  970. end" p* q8 R# _* t/ y: Q9 [

  971. * o; Q* Y* G- p9 y$ p- j# @
  972. #==============================================================================
    . P" U( {( g8 N7 a- i! r
  973. # ■ Window_PartyCommand# E: f+ S3 \* k# P9 P1 T% v
  974. #------------------------------------------------------------------------------8 J1 y3 i  _( ^4 p
  975. #  战斗画面中,选择“战斗/撤退”的窗口。
    # z6 S! C" U. `7 \
  976. #==============================================================================
    " v; ]$ }! i! U9 m2 @4 [
  977. class Window_PartyCommand  Window_Command
    6 B& l# O' _% g4 O9 h9 `9 f3 }8 h
  978.   #--------------------------------------------------------------------------$ l  p* G  M  d7 q, A# J" u0 ^( M
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置, Z3 h' r; k" V" }4 x
  980.   #--------------------------------------------------------------------------
    ' D6 k* m6 o2 B
  981.   def set_mouse_pos* ^& |) K/ f+ y3 q, q% J5 W
  982.     if viewport.nil
    ' _$ S7 C& x) o' c. L$ ?+ `6 z& c6 Z
  983.       vp_x, vp_y = 0, 0
    & Q8 E4 D& k; Z
  984.     else
    $ e+ D" W& b1 U; o, Q6 x* z2 ~: \1 Y
  985.       #vp_x = viewport.rect.x - viewport.ox
    $ T3 ~1 u- `+ p% D. Y" `
  986.       vp_y = viewport.rect.y - viewport.oy
    5 B# Z3 \" [4 C2 |6 Q( I
  987.     end
    - z9 t1 L& X! e. s2 R
  988.     item_x1 = x + standard_padding 9 S( l8 ^( G3 {
  989.     item_y1 = vp_y + y + standard_padding
    ! Z( [. \1 r4 J8 ^) q
  990.     get_index = @index  0  0  @index
    ( }' m6 W: ]: K. t7 o
  991.     row = get_index  col_max - top_row
    % A3 R3 E! J+ |. }  y- n. v% a
  992.     col = get_index % col_max4 C& Q% H2 o3 ?' z7 [+ t* }
  993.     new_x = item_x1 + item_width  (col + 0.5)9 e2 V* ]* y2 Q( y, x2 G% \
  994.     new_y = item_y1 + item_height  (row + 0.5)
    - V& ~2 E9 ^" Y# a, E
  995.     Mouse.set_mouse_pos(new_x, new_y)% N0 v  `* u1 m
  996.   end
    ) b5 l9 X* B. s5 U% Y1 k- S8 w, }
  997. end# z' k$ B% ]  v8 m) `2 G, u+ Q& A

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

  2225. & o7 v/ F& `% B( M6 \
  2226. #==============================================================================
    . X7 _6 ]; t: L  f
  2227. # ■ Spriteset_Map/ `5 E- _3 _: e; b3 G
  2228. #------------------------------------------------------------------------------
    9 C& M+ ?; m' }+ W6 u. s6 I  W3 @1 Z
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。
    % [) M' I3 `8 O+ i
  2230. #==============================================================================3 y% A: a% \/ z2 B" y& p
  2231. class Spriteset_Map! z+ b* N: s) t! o! U) A
  2232.   #--------------------------------------------------------------------------( D' H- y% F, ]5 R4 q
  2233.   # ● 生成路径点精灵" b/ Q' Q) G1 j4 T1 v
  2234.   #--------------------------------------------------------------------------
    4 a2 ?6 _& X) A  g
  2235.   alias sion_mouse_create_characters create_characters
    . Q7 ~" L- O+ ~' S2 ~! N
  2236.   def create_characters! P/ b, ]/ N/ n
  2237.     sion_mouse_create_characters6 {3 _5 v9 |0 P. M
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))9 ~/ V4 ?" D& g3 N8 K
  2239.   end' R# r  @3 J( M0 s
  2240. end2 m' u, h) `5 g. A+ r
  2241. ! q  T& P- X3 P8 X: b
  2242. #==============================================================================
    , L6 L6 X  E0 D
  2243. # ■ Scene_Map
    : k" d* J& A) W0 b# `6 X8 u9 o  f
  2244. #------------------------------------------------------------------------------+ x* ?' W$ E' S# x1 t
  2245. #  地图画面" o# {, O( k: c# ~0 B8 ^; ~+ V
  2246. #==============================================================================- D8 F! Y* M# b( l8 {2 I( t& t# E8 }
  2247. class Scene_Map  Scene_Base
    ! q4 B% Z. R0 b5 [1 t( B( N
  2248.   #--------------------------------------------------------------------------$ d/ k  p$ o6 x2 q' E/ L
  2249.   # ● 画面更新
      u  s+ J4 a5 v* A* Z. E& U& k# P! ~( e
  2250.   #--------------------------------------------------------------------------
    8 R$ Z- s: l* y3 |
  2251.   alias sion_mouse_update_scene update_scene
    6 [0 s; N+ ]0 y. j. S
  2252.   def update_scene
    * y5 r- U# N7 }7 H/ H& z! H! Q/ @
  2253.     sion_mouse_update_scene2 l' [3 S. V  ^9 T
  2254.     update_mouse_action unless scene_changing1 Z) k1 \2 `* l" a- E
  2255.   end: v, |4 F  F- T5 o2 x
  2256.   #--------------------------------------------------------------------------
    % u9 K& P9 }; c! s. e3 n5 _9 B
  2257.   # ● 场所移动前的处理% F7 _1 x' {6 h) p$ }" b; z
  2258.   #--------------------------------------------------------------------------% {: K! b$ m- s0 x1 B) I3 l, `# a
  2259.   alias sion_mouse_pre_transfer pre_transfer/ q  d! f) W) N# H
  2260.   def pre_transfer
    * }+ }& L1 J# A
  2261.     $game_player.reset_move_path
    7 k" Z; U; ^+ t0 G; H1 o* B" S
  2262.     sion_mouse_pre_transfer
    . ^& _$ P7 ~2 }" t$ B
  2263.   end/ Q$ K: `$ C; w5 Q7 t! L/ v- ]
  2264.   #--------------------------------------------------------------------------3 X6 |5 ?7 O7 i2 E
  2265.   # ● 监听鼠标左键的按下+ q' P" l$ t" ]) c  m
  2266.   #--------------------------------------------------------------------------
    8 F, a# U* D* [
  2267.   def update_mouse_action
    8 c5 u% k- k7 i, @
  2268.     $game_player.left_button_action if Mouse.press(0x01)( P2 X/ ^% v! |/ z+ G7 D
  2269.   end6 J" e( h2 _+ l2 V8 A2 K
  2270. end# N2 e) p9 E  T( H

  2271. * I/ B6 d0 l% |" t) F0 q: o
  2272. #==============================================================================' G! g, f% F( ]( F8 `, n. O
  2273. # ■ Scene_File
    4 g3 X" h$ {5 E/ \- G! n  z; [
  2274. #------------------------------------------------------------------------------
    ( W6 I7 X1 ~$ R5 {4 w) Y3 L
  2275. #  存档画面和读档画面共同的父类' x. s2 w( ^0 r
  2276. #==============================================================================
    - T; `. `( z  J2 T7 Y3 {9 U
  2277. class Scene_File  Scene_MenuBase2 X2 G5 I+ ]! x, x7 H8 O, {; L
  2278.   #--------------------------------------------------------------------------( ^% Q( X( t. s; V3 j2 P3 m5 W- C8 R
  2279.   # ● 开始处理% u$ x$ y' |4 m: i! |+ G2 R" I
  2280.   #--------------------------------------------------------------------------# j& m/ t7 f$ m
  2281.   alias sion_mouse_start start! t) V* |" n) t. c' z; S8 ?
  2282.   def start9 h6 R3 s7 t. J3 L* o
  2283.     sion_mouse_start
    + [+ b! x9 l  v/ h
  2284.     @move_state = 04 |. s7 n: l$ a% g
  2285.     set_mouse_pos
    1 W7 m5 x. ]% g3 E: [1 f; M2 p
  2286.   end- r8 p( f* Q+ B5 A8 u- b3 b
  2287.   #--------------------------------------------------------------------------
    5 p& {$ D& v  U& g9 O" Q
  2288.   # ● 更新画面
    / s6 D2 v3 |$ Z3 M: ~$ _' U
  2289.   #--------------------------------------------------------------------------
    / [* P. R* U; [
  2290.   alias sion_mouse_update update! i6 ^# s- W  N
  2291.   def update$ u$ r) D/ S9 ?0 F. Q: Z
  2292.     sion_mouse_update. j  W  Q6 j$ g, @* o9 i
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos
    ! J) Y- Q; o8 q$ K1 _: E
  2294.   end! ?2 P! \, R. u5 J
  2295.   #--------------------------------------------------------------------------
    " `, k# ~% y" Y6 f. B% u! r
  2296.   # ● 更新光标' _1 t! s  o4 u4 M* M, \1 q
  2297.   #--------------------------------------------------------------------------
    ) v8 b( N9 \7 c8 k, ^3 H
  2298.   def set_cursor
    $ K9 P$ \* U! m( R$ E- c
  2299.     @move_state += 1
    ! o( H0 h# e9 u0 V# M8 l6 X
  2300.     last_index = @index& F& L. V' R7 d& V
  2301.     if mouse_which_window == -2  I6 V1 {" P3 M! @5 y5 C
  2302.       if (@move_state - 1) % 6 == 0# }4 N6 }9 u3 \) T
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1, b' k% ~5 \- A% ^9 g
  2304.       end+ b; x# s% e$ @' l
  2305.     elsif mouse_which_window == -1
    $ ~. n! f8 [3 |- F
  2306.       if (@move_state - 1) % 6 == 0
    - h  H: ?. H+ [. r  y  u' C2 M6 e2 x
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    % p: _% Y7 s' b! w0 k
  2308.       end) {1 w5 v9 B1 ?3 A( I( {
  2309.     else
    # }9 F; H+ x% G9 r( l) m
  2310.       @move_state = 0& m$ o5 _4 n3 t0 A( c, ]; g
  2311.       @index = top_index + mouse_which_window, \, r. R2 v2 _6 P
  2312.     end
    9 |: g- }6 B& i9 D2 ~: W0 N
  2313.     ensure_cursor_visible
    ' Q, H# D4 x4 D' h* P9 H+ x
  2314.     if @index != last_index/ I  L& d' s- V7 g' T  M. `* ^% _
  2315.       @savefile_windows[last_index].selected = false
    9 L9 M  f5 U- c* z+ M" a- n
  2316.       @savefile_windows[@index].selected = true; D# o* s3 X0 E4 X: z& [
  2317.     end9 v) Z: t$ B4 _7 u
  2318.   end
    * {2 L2 L8 W. v7 v2 B
  2319.   #--------------------------------------------------------------------------% D; O! R! i* D( R* `" `7 h
  2320.   # ● 判断鼠标位于哪个窗口7 C; o2 _2 ^& a7 w
  2321.   #--------------------------------------------------------------------------7 {# X4 ?. B' @2 G4 J: U* z; {
  2322.   def mouse_which_window& y$ h5 e  _/ G9 u
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y4 Z+ _8 `, f1 [+ p+ `7 n
  2324.     if mouse_y  @help_window.height + 148 x3 Z8 T, s. s8 w' H
  2325.       mouse_row = -1, X" }& B1 ^6 s2 c& y8 c
  2326.     elsif mouse_y  Graphics.height - 14. ^9 ]8 j& e) i
  2327.       mouse_row = -2
    % {; G+ {; p, z  B, [, ?3 N7 m4 l
  2328.     else
    : q& s2 l9 T& ^4 G4 m
  2329.       mouse_row = 4  (mouse_y - @help_window.height) * }! k$ S; ]( ]' g' j4 c
  2330.         (Graphics.height - @help_window.height)
    # @2 U3 h+ ^3 o( C
  2331.     end
    ) o2 L& `( @) N) f7 N  N3 K6 ~
  2332.     return mouse_row; o4 E& Q& l! W# n
  2333.   end: D. V- x$ ?/ D0 Y7 ^" x7 I: b( u
  2334.   #--------------------------------------------------------------------------+ K/ t; y8 I! V: i4 M
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置* v$ a  |) V$ j0 L
  2336.   #--------------------------------------------------------------------------1 |9 v% Y" A2 H1 d
  2337.   def set_mouse_pos
    # h! T; o4 F8 }+ ?5 h
  2338.     new_x = 409 V2 e' |& }! A, O6 [
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    + O6 {7 I* d: L3 j$ R
  2340.     Mouse.set_mouse_pos(new_x, new_y): A6 U- Q8 C, B+ l: G. [: k
  2341.   end! k+ f) T/ {/ I$ o8 o
  2342. end, y- l, B% ]0 c$ T0 t' R

  2343.   y( ?0 M1 H9 W. P  w" R
  2344. #==============================================================================
    ( R! p( K; D  `1 F; r( S; O
  2345. # ■ Game_Event; d) ^+ B9 E1 p; C
  2346. #------------------------------------------------------------------------------
    & Y* ?) U- O- K: w( p$ A/ `' @
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
    0 p& f/ G' y9 U# Y, H
  2348. #   在 Game_Map 类的内部使用。: x# {# I- _7 [
  2349. #==============================================================================
    ! l0 p- M8 b/ W
  2350. class Game_Event  Game_Character
    ) r, i& w  e# u, t! l8 ~
  2351.   #--------------------------------------------------------------------------
    + a6 Y& X( k% [/ Q% Y+ q4 W
  2352.   # ● 事件启动
    4 L, J' Y% A6 `8 \- I/ `) L
  2353.   #--------------------------------------------------------------------------2 b: ^1 `; U- C6 J2 S
  2354.   alias sion_mouse_start start4 V% t. A) `; i7 g
  2355.   def start
    8 j2 v9 \1 V9 f3 n: y( c+ A& w
  2356.     return if mouse_start && !Mouse.press(0x01)
    0 M/ V  x3 k% a& F
  2357.     sion_mouse_start
    1 t3 p$ B. G7 W8 z
  2358.   end
    9 Z# C' A! w$ Y+ }
  2359.   #--------------------------------------------------------------------------0 j1 f  k% |1 b6 d
  2360.   # ● 判断事件是否由鼠标启动
    & a7 D- ?9 ], E2 Z
  2361.   #--------------------------------------------------------------------------( T( m2 v( O6 |' t0 C
  2362.   def mouse_start( {6 i* p4 L/ I( p6 H/ p0 F5 `$ H+ p
  2363.     return false if empty
    / i1 X8 n) d$ ?1 Y+ D6 r. l- I3 {# Q
  2364.     @list.each do index& [: T' z! M+ I! U, T7 F* K) ?
  2365.       return true if (index.code == 108  index.code == 408) &&
      I. B; M3 i) h3 D
  2366.         index.parameters[0].include('鼠标启动')0 g6 x+ x0 D* J5 ~/ I
  2367.     end, t2 a, N5 D5 ~! C5 {
  2368.     return false" A' w. q! f3 @% j2 X
  2369.   end- V1 t; H- s5 g; J* H
  2370. end* q1 O% ~0 s! j$ w' `# L
  2371. 7 V- L4 ?4 ^: g- d8 ^# `3 p& z; z
  2372. ####泥煤的height: A- n! [' A8 b
  2373. # @height = height
    % P, |" `( g; J; W$ a
  2374. 5 e$ V) z# s! ?
  2375. class Area_Response5 R2 d& _4 z" O  [% B3 M
  2376.   attr_accessor type! n% n% o6 X& o- k( K
  2377.   attr_reader ox
      I7 [; O, u+ Y. A' d8 H, C
  2378.   attr_reader oy
    # A: |! ?( ^, n3 i3 U& d8 W
  2379.   attr_reader width/ I: {2 e/ o2 ?4 a2 a
  2380.   attr_reader height
      Q5 x4 c# O- S8 J/ {
  2381.   attr_reader switch_id
    ' j$ W$ G- e- o8 w% T
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)- f+ W3 j8 j& q
  2383.     @type = type
    $ o- Z9 a+ p, V4 e6 H
  2384.     @ox = ox
    * b$ ]$ |+ b8 b: E8 e- x  w
  2385.     @oy = oy
    " m( L( X5 }& K2 [
  2386.     @width = width
    ; }: L7 b. e! L( C* r% U8 t9 q* t
  2387.     @height = height
    0 G1 R: K3 e) X2 Y; f4 g
  2388.     @switch_id = switch_id
    + W' W1 _6 Y3 h  s' P
  2389.   end
    0 ?- ~+ {/ [8 k# u/ o8 |& i
  2390. end
    : I1 k% r+ l' B0 D0 i  t; h
  2391. 5 X; m. h" ^- d
  2392. $area_responses = []$ E' [. M% D. Q4 q8 g* Y
  2393. 1 F7 {: P( U  g# D0 h9 G0 L% t
  2394. class Scene_Map
    " r5 T6 g$ u1 E/ g  w
  2395.   alias update_mouse_2013421 update_mouse_action
    - {5 C( ?$ B/ ^0 {1 R( W) M
  2396.   def update_mouse_action
    % k6 t7 i& `) w9 V
  2397.     update_area_response
    , L% j6 `( `7 s& q1 N- T/ w$ q
  2398.     update_mouse_20134212 s: b$ r$ Z# x
  2399.   end, L" C1 A4 P3 k8 p" p4 C
  2400.   def update_area_response. s5 s( ]! G6 Z
  2401.     responses = $area_responses1 l7 s3 _2 n$ i8 w8 x
  2402.     responses.each {response" N; h" `6 ]0 @1 y* ?0 w
  2403.       ox = response.ox
    # u( _. X9 P% g
  2404.       oy = response.oy
    . a) r+ N- I/ h; e% C: v
  2405.       width = response.width7 b1 x) A+ L5 m8 E1 C. e, c
  2406.       height = response.height1 y, i! o" K/ U/ m) x- W( ~  Q
  2407.       switch_id = response.switch_id. x2 k" Z9 r$ D! u
  2408.       case response.type# z; ]- @& ]3 j* g" \" ?9 d
  2409.       when 08 S8 `: M' [( C) k: o
  2410.         if mouse_in_area(ox, oy, width, height). h/ a  D% J0 B. u
  2411.           $game_switches[switch_id] = true1 S0 x. J4 R9 r( q( J' T
  2412.           $area_responses.delete(response)& i6 P: x4 ]. h" X% l: ~; d2 U
  2413.         end
    6 H+ P8 y" [& y/ Q
  2414.       when 1$ x/ q. n$ I  N) G* n: s  ^+ s
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)
    $ h7 V) C- f2 v5 @8 P5 i
  2416.           $game_switches[switch_id] = true) c$ e/ Q4 w' A: s
  2417.           $area_responses.delete(response)
    + [$ J" a% t9 d4 [8 T
  2418.         end; n$ Z+ A% r3 M# A$ {$ ?( j
  2419.       when 2
    2 Y$ r1 q/ C. ~/ w$ Y2 l! N
  2420.         if mouse_in_area(ox, oy, width, height)
    ( [& ?- g* F. o3 b' r' m' t
  2421.           $game_switches[switch_id] = true
    ! w8 S8 W/ b4 V% R9 p) v+ |
  2422.         else
    $ x# ]' z' O; w+ B* d2 W
  2423.           $game_switches[switch_id] = false
    ' |" v6 Z1 I  c# c" a
  2424.         end
    ) q$ u1 @2 |% A4 @
  2425.       when 3( d8 L/ `* ~2 C- V5 V# G
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,1 B5 X" d" R8 p
  2427.             (oy - $game_map.display_y)  32, width, height)8 m$ ]5 ^. N5 C) a% `1 j
  2428.           $game_map.events_xy(ox, oy).each {event
    # n9 U7 U- \$ ~8 x2 L' o+ s
  2429.           event.start
    & d: R4 L7 d$ c% T. Y( B, s
  2430.           $area_responses.delete(response)
    - V! K* T# e$ S- j& M4 r8 w
  2431.           return
    ; S6 X" I$ h6 \/ h& }
  2432.           }
    ; U1 J. q. L) A: x0 T% F
  2433.         end
    6 F2 e2 ?" T' y; T$ F% P4 ]" J
  2434.       when 4" p5 w$ m" `$ k0 j. @3 ]0 @8 m9 E  I
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,& b* _7 N# l$ @
  2436.             (oy - $game_map.display_y)  32, width, height): h* z# K, _, i5 B' a: o
  2437.           $game_map.events_xy(ox, oy).each {event
    6 ?2 ~  x  a$ T& y7 V; a
  2438.             event.start) R/ W5 M' F3 M2 r5 N+ k
  2439.             return
    * t1 |5 t: v3 ?( R  w; X
  2440.           }
    ' K  `- _1 z- \: F
  2441.         end6 O3 I: X1 r9 @- [0 C" [
  2442.       end! ~' o& x: S9 X& f9 \
  2443.     }
    1 Q# D4 [4 {! N
  2444.   end
    , S8 I! X9 t. W, w3 h! }* \
  2445.   def mouse_in_area(ox, oy, width, height)  ^' F: F5 B# X$ z: m. u
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&6 o/ a. v/ B& q# B4 `2 \0 B* R
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height
    2 ]) T' W2 r( H9 D6 B8 R
  2448.   end
    ) |9 K' x* U2 c) L
  2449. end' O9 q4 g. [' r
  2450. class Game_Interpreter9 ]% E1 m6 d$ s; ?
  2451.   def area_response(arg)
      X; W6 a$ A' H
  2452.     $area_responses.push(Area_Response.new(arg))/ P' I9 m$ {0 y: |
  2453.   end
    " p) k! W: _: l- \+ F
  2454. end
    5 t) {" p7 f: I. z' s1 X5 p
复制代码

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

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

GMT+8, 2025-2-20 04:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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