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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================$ d& a& P4 P0 b" \. Q9 {0 \! e
  2. ( e) d2 V6 U( V- A; P& h
  3.   Sion Mouse System v1.3e5 S  @# Z+ {1 y& u, N! Y
  4.   
    9 @9 o! a5 U4 v  W' \) j; }0 U
  5.   Changlog: X# M" c& j# q  |0 s4 g7 ?" K
  6.   
    * H$ h: c0 U& X. a! h
  7.   2013.4.21 v1.3f  K" H* g3 j' H9 B6 s% [: `
  8.    
    9 H$ X- H, y! l% X& O8 F: D
  9.     1.3f 卷动地图 bug 修正: a3 B+ |% i7 O1 {" e- Z' S$ C
  10.     4 U6 l; `. C, g3 B6 r
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口
    ! y) O# G( q; H* W! Y
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内
    ( H- |; G7 l: J8 A
  13.                               Mouse.unlock_mouse_in_screen 解除锁定
    % C7 L" K/ v6 x  h: o

  14. 6 C) S* o; v0 f) f: s+ o0 L
  15.     1.3f bug修正/ j. M; M: m' f. c# x% p& E5 z
  16.   
    - ?1 i. E# W. R0 y* N/ E5 C
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及
    4 f( O) q9 f% ^6 A( F; G# M( e
  18.           关闭菜单时,鼠标是否移动到原来的位置。5 N$ N) o' p" H! c
  19. 5 y# {' T% l+ t" B  w" F' X/ M
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处6 c1 g8 D0 p3 P: L+ M2 B
  21.   c* y- ?- {& u- M. I
  22.     1.3b 修正一些罕见的bug;3 j' q# O: }: s- X2 L

  23. 7 L4 _0 z$ k% R) r5 g4 C
  24.     1.3a 代码小修改;% A$ k8 p, l6 z* U
  25.           加入了鼠标点击启动事件的功能,) v/ `$ e. K' ]( H( E/ K
  26.           在事件中加入“注释”: 鼠标启动  ,
    - C0 O+ Y+ ^) k' i3 W
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    2 L8 W& I; P' p! m8 `/ T! c
  28.   
    $ x( N- c, u. {" E
  29.   2013.2.12 v1.2
    ( }& b' u8 H" }$ n5 n

  30. " V. h7 ~" w! o* \
  31.     寻路逻辑优化;! r" V% c6 C  Q, p
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;% _2 o) ^, h$ f5 _" J1 l, L. r
  33.     现在支持用鼠标来操作载具了。
    1 L1 F% {& i: [  p. O& ]- J8 w! w

  34. ! Q6 A4 U5 t5 ]8 |& I# H7 t+ \/ \6 d
  35.   2013.2.8 v1.1
    2 L; X& M2 {0 ]+ S! g/ R9 Y2 I

  36. ; I; r8 p& `( J; m" J7 L' y
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;9 @1 ?% x6 W5 |! ?6 @
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;" y. r: F7 _$ e
  39.     移动时,路径指示点的绘制更加稳定;
    $ z- R% [0 V0 j1 [, Z5 r  x1 Q
  40.     现在支持默认存档画面的鼠标操作了。
    7 c9 J; S& [! o8 X

  41. 1 \) @/ |, U& `6 [( m+ U# A

  42. 9 ?: a3 j! Z  G. s( K+ w
  43.   OrigenVersion
      u+ U. {" R& N1 i5 o0 Q6 w) _
  44.   
    ! L( S8 {2 W; f) T: D) r6 r7 Q2 S
  45.     2013.2.7 v1.0
    4 E  y$ H2 q- G

  46. - J  c! A- \6 V# P1 h% \+ I
  47.   主要功能
    * W0 N9 `, l6 X

  48. 6 o6 _7 i, @! L
  49.       使用鼠标进行各种操作...9 p" [/ R# c  ^* d, V
  50.       将鼠标锁定在游戏窗口内3 w& |" V. M5 j+ s+ l
  51.       自动寻路,按住 D 键可以扩大寻路的范围
    0 {) e- ~: _1 K# \0 q" s
  52.       双击鼠标进行冲刺
    2 I  F* f& X: [" h3 F
  53.       更改地图卷动方式以适应鼠标移动
    ) v! X4 W' r' `/ P
  54.       变量输入框改良) v' k5 b' A: z' U& t# D

  55. 0 ]9 |% O9 a" q. S  T
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹% }0 y( \. h. u# m# \

  57. ' i! _; s" ^/ o/ h* U: Q
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹. _' i' L$ s" ]* o% M* x
  59. 6 G: Y0 c2 c  E) g2 V9 k
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭; K; g' ?) Y6 q# N/ ?. f
  61. ) h' Z1 Q4 _' f6 y: i  J  u; h  S

  62. 0 S- A! O0 V+ t1 X' X1 I
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★$ q0 }: M' W6 H5 C7 s3 B. z
  64. 7 Z: c0 N# Q/ o- m/ J) k

  65. + ^8 ?" J, q8 ?1 P( c
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示% X: a! O8 n+ N9 V3 W; Z4 ~% I

  67. ( I2 C7 M! n$ d& }
  68. #==============================================================================
    5 e9 p7 h. W, ~# }& d
  69. # ■ 常数设置 9 f1 }4 G5 `" \. [( @+ D
  70. #==============================================================================
    % N4 j9 [5 E- D2 j$ I% Q4 [
  71. module KsOfSion
    3 |0 D: `$ Q/ A6 J+ d
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false- X) ^& v9 ~+ O& J6 @
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑3 C( C: V1 S' A1 z
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    , Q& `1 T+ }* c: z. p, b
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量
    % b# p! ?2 S% K
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处. q) I$ a9 U# _% R. ]" n% Y
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧
    ) E- g- w* [# B, S
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)
    - p" x1 ~3 r6 @
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键
    ( q" d  L" H: }! p2 |
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)
    . R; D9 S  Y5 \6 {$ D
  81. end
    # Z5 J" b, @7 I; K' [& w6 s+ B) y

  82. 8 _& i8 d' l7 y# p' ^' J$ b) B( v
  83. #==============================================================================
    " d- V2 {4 i) z( O( a
  84. # ■ 用来显示路径点的类6 x# a( ]. c9 q. l  R
  85. #==============================================================================
    3 m( v( V, `, N1 \4 F: m% z( B
  86. class Move_Sign  Game_Character4 y# N8 ~$ c* y: d/ i8 h
  87.   #--------------------------------------------------------------------------3 G2 T" S8 g8 y& S2 W7 E8 V1 E% T' K
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图3 |( M' R) R  g0 O# R3 q
  89.   #--------------------------------------------------------------------------
    4 w& Y) w; D. f- {2 H" y+ h/ A
  90.   def init_public_members1 [" e( X4 t" O1 K5 L
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹/ a9 g" r, i- ^
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0: t$ m# H; R2 P% m9 Z
  93.     @move_speed      = 5        # ★ 踏步速度6 w+ }$ I! f8 O& M9 b
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    , n2 \+ j" i9 V" m+ w) m6 X
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度" A9 ~) N0 q' u5 t+ k) E, ~% g  |
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)* {  S  D& i9 Q* a6 b6 ^
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列
    3 G6 K/ H! @2 G; G1 H, D7 x
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)
    $ F1 f9 |! @- G: N
  99. 8 n5 L" x% a. M- @" n; \
  100. 3 {. z) c* U4 m3 Y/ T4 l) ~+ y7 V
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    ' E1 Y4 O8 B. U9 M! ~

  102. . _7 X/ f, q( t3 c$ Z. I

  103. 6 s" P! }% Q- E2 D! k
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
    . R% k2 X9 {& A5 i6 c
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    , N9 t! m) o% r5 P3 i
  106.   S7 H1 ?2 X' K8 T4 P% C/ y& \
  107.       if $no_arrowpic_warn7 a( B8 V; ^' d7 h
  108.         MouseShow_Cursor.call(1)
    ; F2 t. C+ ^" ~2 ?; J7 P: \
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png
    3 R7 k8 Q) ^$ X2 ]

  110. ; V% m8 ]  n, s. K9 R- g
  111. “路径指示点”将使用游戏自带图片
    * l0 H! R/ Z7 P' n

  112. " p1 K$ N; |8 K/ \* {
  113. 该提示可以在脚本内关闭')% B8 |* a4 h% x; W3 S; H" x
  114.         MouseShow_Cursor.call(0)
    3 K  ~% V( l+ L
  115.         $no_arrowpic_warn = false5 `' p" B, E% J1 w% s
  116.       end! e( y% s; v/ L
  117.       @character_name  = '!Flame'# o7 F, x2 j! q/ }: Q& Y0 Q' _
  118.       @character_index = 6
    # S, D# e- H2 C8 S8 V9 g( o
  119. : K" B, c) u! Z, B3 P  h
  120.     end" A% f& G) i8 x/ T6 Z
  121.     @direction_fix = false  # 固定朝向6 o9 F" l/ N$ h& U9 K, y4 ^9 t
  122.     @move_frequency = 6     # 移动频率9 r1 ~' N- X$ r' E
  123.     @walk_anime = true      # 步行动画
    4 f7 f1 ^, \  M% d5 s
  124.     @pattern = 1            # 图案
      Q. h" V3 z. O- ?' I. J
  125.     @through = true         # 穿透
    * w$ S1 H6 l( C! b3 f# o
  126.     @bush_depth = 0         # 草木深度
    ' E2 k& T& g( y' p
  127.     @animation_id = 0       # 动画 ID7 n8 f% [% R  p3 n) I. }! B, d
  128.     @balloon_id = 0         # 心情 ID; }9 q8 d) l! }' {8 j6 h
  129.     @transparent = true     # 透明
    . J6 A% d) Y8 p
  130.     @id = 0
    : f* k9 A% e% K6 i: H
  131.     @x = 04 ^1 C: t1 `8 t( J0 X5 V9 T9 N
  132.     @y = 01 o" s9 N& \, ^1 P8 R$ o: F+ ~8 S8 z
  133.     @real_x = 0
    + O8 c1 u) @" w1 X, A8 N$ N
  134.     @real_y = 0, Q( r  S4 K$ l; g( }* \3 ?
  135.     @tile_id = 0
    . H+ t# H7 Y7 D6 _  z5 ?3 F
  136.   end
    : M, n; P, c% M& p
  137.   #--------------------------------------------------------------------------
    * |- e# l6 ?8 p' v6 M+ }* l5 N! B3 H
  138.   # ● 定义实例变量+ n3 b) D- Y/ _  B( I2 j4 T  u
  139.   #--------------------------------------------------------------------------( W" o0 @# D/ Z! ^( K* C
  140.   attr_accessor direction7 j/ X' w# O( g: D4 C4 `8 Y
  141. end. Y2 `6 t3 z' K& t8 E$ q- U

  142. / K. O$ c( s0 _2 N# z3 T
  143. #==============================================================================
    , R# ^4 `! @4 Z- \
  144. # ■ Module Mouse
    7 W8 k3 m( @3 D6 s; s2 G
  145. #==============================================================================. h2 M+ N. I9 F4 ?. X% g$ T$ ?
  146. module Mouse5 N8 T$ Z5 h- t! T3 }
  147.   #--------------------------------------------------------------------------
    ; G. j+ ]2 u: B/ z! v" ?. X
  148.   # ● API9 w' s: R% @7 W! [
  149.   #--------------------------------------------------------------------------$ G$ Z% `0 C! w
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
    6 |& m5 }; ]! M" t0 X1 u& s
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
    , N3 j: V. S& G# u) Q4 t; _
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')
    & K! P& G/ g3 d4 s8 b' }' d1 l
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')
    ; k$ h/ ?/ M; P! C  W
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')# s3 p$ ^( L. W
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')
      k. a( r' A: v% ]" Q
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')6 p, `% h1 n4 h# A0 [+ g
  157.   Window_Hwnd       = Get_Active_Window.call
    ; X0 f( f3 a5 H/ ^6 W8 d% e) m% k
  158. ) _% ]1 G3 o" e8 T
  159. class  self
    . L2 v+ P7 ?% A4 z# ], B2 J3 y
  160.   #--------------------------------------------------------------------------# h0 |: l4 L/ I
  161.   # ● 初始化
    % z( L' L, U) D9 ?% S7 ^
  162.   #--------------------------------------------------------------------------
    * t1 J/ t) }2 Q! ^; |) Q" U
  163.   def init, r: o0 p: f# {) d- ?
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor( X* t6 A2 j7 u7 ?  r1 G* B; w
  165.     @left_state = 0
    3 @8 V6 R( s( d
  166.     @right_state = 04 h* E, i  t: o7 p; q9 C
  167.     @ck_count = 0 # 帧数计,单击以后从0开始
    , x! T7 K/ d  w! X6 a# {
  168.     @dk_count = 0 # 用于双击的判定
    3 ]1 Y, D" w* I1 m, X$ i2 i
  169.     @clicked = false
    2 T6 K3 B9 k1 Y8 y! I; q7 u" y
  170.     creat_mouse_sprite
    8 |* d8 Z- J4 B& R% n& u, k; s8 Z
  171.     update2 i% \! @7 Z9 j- P3 t
  172.   end# C1 g) |  [# m  J. d  }7 @
  173.   #--------------------------------------------------------------------------+ Q& f0 w8 x7 ]4 A
  174.   # ● 鼠标指针精灵
    & l4 ~% v. F4 S  R
  175.   #--------------------------------------------------------------------------9 C! O; e9 r4 ?# x
  176. #~   def creat_mouse_sprite7 T7 S+ o! ?& J& d) z) b! M; h
  177. #~     
    7 Z2 R2 I8 R9 N# D: e- r6 T
  178. #~       @mouse_sprite = Sprite.new
    8 z* C+ |1 E' t
  179. #~       panda = 2#rand(2)+1
    2 }, s& S8 `/ x: [* q7 R, W1 Z

  180. 6 s3 b, |, G( _; `- P
  181. #~      if panda = 19 ]* N) O3 w! D! `
  182. #~        if File.exist('GraphicsSystemCursor2.png'); u5 d4 P6 o' r2 x& |/ y$ m
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')& a) F  d* @" ^; |
  184. #~        end#with if File.exist" a, E( m' H' U' x* |7 T
  185. #~   
    2 ]9 B# W) T) \* a" z
  186. #~     else if panda = 2 #with if panda=1! ], S1 T! r# t
  187. #~      
    & u4 a* y, m2 J; N
  188. #~      if File.exist('GraphicsSystemCursor2.png')- d  j- S* T' ~* t9 w+ A
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    / y9 D! f0 x3 T3 ~5 Q
  190. #~      end#with if File.exist
    2 G3 g! H. d3 s6 A
  191. #~       2 {0 y% Z/ p: [; Z; \
  192. #~     else #with if panda=1
    / L( R2 _0 k% u- T# g2 P( S
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    + [9 [5 c9 x6 `+ s
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),2 x6 z' C/ B; e0 r9 v! ^
  195. #~       Rect.new(5  24, 24  24, 24, 24)); [( r0 x( q( {/ Y" U& r
  196. #~     end#with if panda=1
    $ m6 o1 Y- b" D. h
  197. #~     
    : v/ E3 Q: |/ f, [- `
  198. #~     #with def7 V& c7 w: c6 Q; j4 }$ \
  199. #~   end( k4 M6 c9 |: Z$ x/ l0 a
  200. def creat_mouse_sprite
    3 r" L) _2 u% c$ A/ q1 j
  201.     @mouse_sprite = Sprite.new
    $ A0 x, B# P, W
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})+ H) H/ _/ t. T  ^
  203.     @mouse_sprite.z = 9999
    - c, T' {4 X' {' j; I  ]5 ^* U
  204.     Show_Cursor.call(0)$ b0 O! q  P) s- ]: k
  205. end
    ( U9 F1 F& I" z1 Z/ m* E5 C0 p

  206. ( b6 `1 E6 u# m3 x% Y
  207.   #--------------------------------------------------------------------------. W" h1 l# ]% m
  208.   # ● 更新
    ' n; K7 I) o* ^2 i! [; F& ]
  209.   #--------------------------------------------------------------------------
    ( X( y, W* m' b0 v0 E
  210.   def update) ^6 X& B$ k5 R5 P2 h
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos" h0 M5 l& X: @
  212.     left_state  = Get_Key_State.call(0x01)
    ; U$ N6 r8 q- m1 S! T
  213.     left_state[7] == 1  @left_state +=1  @left_state = 09 v; D( v' r0 `! m" q! E
  214.     right_state = Get_Key_State.call(0x02)9 P& j9 |) Z8 C0 I' t
  215.     right_state[7] == 1  @right_state +=1  @right_state = 03 x) W- `8 C5 ]+ v7 z4 j. D0 y7 @7 \
  216.     update_double_click
    2 B0 z, _$ P7 ~2 ~$ Y
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1$ T' {* f3 D% b' [6 V$ n
  218.   end
    : u1 u) T) h7 y4 V! j
  219.   #--------------------------------------------------------------------------4 j& J$ e, v( z9 {  V
  220.   # ● 获取鼠标坐标% `( Y6 ^; e; A% J4 P, c
  221.   #--------------------------------------------------------------------------& w) ^+ L3 E2 l0 |2 q
  222.   def get_mouse_pos
    + x4 t) X& A2 p8 t+ \9 S5 a, ^
  223.     arg = [0, 0].pack('ll')
    . i/ [5 h0 `  H
  224.     Get_Cursor_Pos.call(arg)
    ; U. [% r! ^' w3 K: R6 @  v
  225.     Screen_To_Client.call(Window_Hwnd, arg), d3 c" c( n0 a/ y% r2 R
  226.     x, y = arg.unpack('ll')
    % N; _$ b& u8 R2 A9 n
  227.     return x, y
    4 C) t) \; K5 q* w  a* k
  228.   end
    & y* x- M* v. c8 @% j; p
  229.   #--------------------------------------------------------------------------
    1 s# v! Y+ C1 ^0 A
  230.   # ● 将鼠标固定在屏幕内
    6 m: |" A& `3 Z0 P6 ^$ d; ], ]: L
  231.   #--------------------------------------------------------------------------( Y" P5 P3 g( M8 E! }* e3 r5 X
  232.   def lock_mouse_in_screen# Q8 c) t, ?& }  u
  233.     arg = [0, 0].pack('ll')
    4 P! [$ P# k+ \
  234.     Screen_To_Client.call(Window_Hwnd, arg)" M- G( w) X# R, i( Y) ^
  235.     x, y  = arg.unpack('ll')+ T3 X5 I& \1 {' P
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))
      b5 W4 v' E# k# [0 I) m3 l( T
  237.   end
    8 t2 ~; _9 D8 a8 D
  238.   #--------------------------------------------------------------------------5 Y$ m% j  y# k4 J8 i( T0 S
  239.   # ● 解除鼠标固定1 h9 ~8 u8 v( Q6 n: K7 }" Y
  240.   #--------------------------------------------------------------------------
    & c* g* }6 d% i% b& U! G3 K) M
  241.   def unlock_mouse_in_screen
    8 w9 M8 O; ?" Q1 U# r
  242.     Clip_Cursor.call(0)& K& }' @4 g- k! x# V8 F
  243.   end
    & n* T+ a+ P& {3 y
  244.   #--------------------------------------------------------------------------5 e9 r2 g* x; z( f  v) `4 e) f5 X
  245.   # ● 鼠标双击判定
    8 k7 C% B$ ^/ x  |
  246.   #--------------------------------------------------------------------------$ W% f* v* n9 t  M+ A/ c! k, x9 e
  247.   def update_double_click
    8 c, i$ x) _' j2 X* K
  248.     @clicked = true if @left_state == 1
    : C" Z/ P' W! v  O
  249.     if @dk_count  0 && @left_state == 1
    : h7 [3 _. G$ W4 n0 \
  250.       @dk_count = 0; @clicked = false1 P; M1 E0 Z1 r  ?7 K) U  n
  251.       return @double_click = true
    2 v, }* V! P" D( {2 F8 h
  252.     elsif @clicked! f$ e* V6 N  z5 V% U# r
  253.       if @dk_count  KsOfSionDbclick_Frame
    7 Q+ i0 K* n! m- T2 e- H
  254.         @dk_count += 1$ C( c" g" t: O4 E. \; x% M
  255.       else
    ; b' L: E, w- T  u5 W& q2 U$ ^/ n
  256.         @dk_count = 0; @clicked = false
    ! h7 d- q$ p6 i9 V4 f
  257.       end& y" D# i! t& E' [8 a
  258.     end# v) ?4 W9 E" B- j* K1 c
  259.     @double_click = false, C$ F7 ~5 V' Q7 i
  260.   end
    + y6 J4 U  I8 e2 E9 [# {
  261.   #--------------------------------------------------------------------------5 @  O( H1 F; o" R/ @1 ~- N2 ]
  262.   # ● 按键被按下就返回true% ~) P  c; ?# O, h+ m
  263.   #--------------------------------------------------------------------------
    % [) x1 F/ T; J5 y, ]) R: K* [
  264.   def press(button)
      W' f$ a) x0 B
  265.     case button
    5 Z* \' l# t/ B! \# `
  266.       when 0x01; return !@left_state.zero& U" u! E1 G! y: O' Z' i
  267.       when 0x02; return !@right_state.zero
    8 A% m3 {- K6 C, F8 u4 v
  268.     end0 {6 G# g7 R" t
  269.     return false
    4 Z4 @# E: p- {6 B# t  q( x' K
  270.   end" d8 D9 S/ l2 O) x
  271.   #--------------------------------------------------------------------------* I2 l' P1 v# Q5 a  L
  272.   # ● 按键刚被按下则返回true
    7 N' R' s+ G/ |  Y  n# j( c& e  x
  273.   #--------------------------------------------------------------------------0 o  I+ |7 Z3 R7 `* W* ?3 {+ R
  274.   def trigger(button)
    4 D! A  G0 D7 q. J' H# Q" O
  275.     case button
    * M' W4 c! u% E& X& s% s# _8 E
  276.       when 0x01; return @left_state == 1
    8 h3 z6 }9 @8 i$ j! {: t
  277.       when 0x02; return @right_state == 1( H$ g+ S5 _$ v& G
  278.     end' z* U1 m4 u, W
  279.     return false, u: s: @1 }& v3 R( X) ]7 m3 }
  280.   end
    ' q6 ~- i! r0 C, z8 u+ c
  281.   #--------------------------------------------------------------------------0 _5 s$ D* J3 p9 n) ]
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    / r8 b7 [, @5 N* a2 a0 W4 c" ]
  283.   #--------------------------------------------------------------------------
    9 S3 M& s+ g4 J7 t) H1 t# ^, y2 p
  284.   def repeat(button)
    ! P7 D3 ]+ N+ ~+ z* f( D3 G4 e- |/ n
  285.     case button* Z) ?# {% R/ A8 a+ s
  286.       when 0x01; return @left_state == 1 + F# S" ^: }: N" r$ _( t5 B% K3 g
  287.         (@left_state  22 && (@left_state % 6).zero)
    / u# v& R, c% K
  288.       when 0x02; return @right_state == 1 7 E( t4 R# }" Y7 m: T6 T& [
  289.         (@right_state  22 && (@right_state % 6).zero)3 y0 p3 d5 ]# o
  290.     end
    8 h5 k3 h: u* l1 _$ s$ v6 J" t
  291.     return false
    9 \3 Q" d) u( Z+ Q/ s0 \
  292.   end
    9 j  R* {3 m1 P0 ]% g
  293.   #--------------------------------------------------------------------------9 N% C) N8 z. b/ K  q+ I# e
  294.   # ● 判断是否双击鼠标! J( R2 d3 a& n% P. k/ h& {
  295.   #--------------------------------------------------------------------------9 q7 u7 ~# O, z2 w' N* r
  296.   def double_click; c, N( E7 y  t' a8 s9 t. Q9 R
  297.     @double_click) m! s  I! N# a# _2 C
  298.   end
    " Y2 d. n& K& q! }3 J
  299.   #--------------------------------------------------------------------------
    3 N% U9 O/ Y1 [1 T: p% z
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)1 N" j( j8 }# ]4 ]  G
  301.   #--------------------------------------------------------------------------& i* {0 V) ~6 K1 J2 R# e# f! F: ^1 K
  302.   def click_count
    8 p% m- s( B( V# m! _# V" |
  303.     @ck_count
    * h  z5 I3 l) B3 ^6 f  c* X! E" w9 O
  304.   end
    ! l  A# N! w6 G( K
  305.   #--------------------------------------------------------------------------
    : ]1 m+ p( L+ o* w  r/ R: S
  306.   # ● 获取@left_state(按住左键每一帧+=1)
    % _0 h6 R1 \5 t) W! f
  307.   #--------------------------------------------------------------------------  |/ Q8 q( W6 L8 z( h' Z
  308.   def left_state
    & I" ~$ z1 @0 s" o( K; i4 m5 N
  309.     @left_state# z* @6 _6 v0 N  b
  310.   end
    8 U% g3 Z% S$ g1 Q( B4 C" J
  311.   #--------------------------------------------------------------------------
    $ A6 t" K  X5 p  V- V: d& {
  312.   # ● 获取鼠标的x坐标1 R0 B6 f4 J* [( @; X* C. f$ u
  313.   #--------------------------------------------------------------------------! X; X# L. x# u6 m" u) `
  314.   def mouse_x
    , `3 A- K- [9 a
  315.     @mouse_sprite.x
    # I2 \5 }2 A6 a" C8 D- M9 t
  316.   end
    0 a2 j- G9 u! ]9 d9 X
  317.   #--------------------------------------------------------------------------" q% J5 A. I: m
  318.   # ● 获取鼠标的y坐标# G9 s! k( ^9 M' u/ G7 N+ X  r
  319.   #--------------------------------------------------------------------------: A* u8 }  n& v% ?6 \! d
  320.   def mouse_y
    2 h4 k& |2 j! y0 ^7 Z7 M
  321.     @mouse_sprite.y0 A2 B0 O9 t. j: z
  322.   end
    + J% I8 H8 b$ o8 m8 d
  323.   #--------------------------------------------------------------------------
    ; L7 r( K% c' Q0 ~
  324.   # ● 设置鼠标坐标
    + |1 J+ m! u1 G+ Y1 x
  325.   #--------------------------------------------------------------------------
    0 I; f' e) w( z) H9 a- E
  326.   def set_mouse_pos(new_x, new_y)# Y% o% U& g. y& d2 x' `; m
  327.     arg = [0, 0].pack('ll')
    ( N/ j& Q* I9 [+ f$ @& d* ~
  328.     Screen_To_Client.call(Window_Hwnd, arg)
    " d5 ~+ _4 P4 s- {4 }
  329.     x, y  = arg.unpack('ll')6 t, A* S# ]" `( n: `4 A/ u
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    9 u4 V: v/ Y! K) q' B- v
  331.   end
    # e4 H4 I8 A! g1 {' [3 r
  332. end #end of class  self
    8 R5 ?' I& j0 H1 V" W
  333. 0 D% ~" D  W" k+ \' @% F7 L
  334. end6 ?* R2 R' S! e  A* i* U% H$ F) i
  335. 4 m( S$ W& `/ k( K& S$ y
  336. #==============================================================================
    % ?5 i  G& m  ^' m
  337. # ■ SceneManager5 x: p$ e9 r" ]- D' U4 f& Q' ]
  338. #==============================================================================
    + _5 {. Z$ m6 |& h: G# Z
  339. class  SceneManager3 D$ b/ K) x# C+ P" C% k6 q
  340.   #--------------------------------------------------------------------------$ ^) E3 |) b. n4 u0 `' n' Q
  341.   # ● alias
    6 e* o9 i/ v  X; ]; q# i0 R
  342.   #--------------------------------------------------------------------------
    , m# H! l: N0 b
  343.   unless self.method_defined(sion_mouse_run)
    1 k0 e3 U9 Z! B/ L( C+ g
  344.     alias_method sion_mouse_run, run
    3 Q! ^1 _$ O9 B- R6 Q
  345.     alias_method sion_mouse_call, call. p8 r' ~5 \9 U+ ^8 ^
  346.     alias_method sion_mouse_return, return" T& E* z! T) t6 B1 s  m. D9 Y
  347.   end
    % Q: ^3 m2 @4 l3 u* j4 l' P2 B
  348.   #--------------------------------------------------------------------------
    3 H* q% s0 U/ O) w# b% T2 A* \3 P
  349.   # ● 运行: {$ b# N- H& H: `# x* P
  350.   #--------------------------------------------------------------------------
    + O$ d3 c( H4 n" z  ?. u$ O- q2 `) p
  351.   def run, k- X( N# ]5 W+ S" r/ b
  352.     Mouse.init. x7 d$ z( {4 ^& W
  353.     sion_mouse_run; _1 L% ], X+ U% f/ `9 u
  354.   end
    . n5 r% `$ W$ w" I: l+ ?  L
  355.   #--------------------------------------------------------------------------
    * o+ g# A! ]( O
  356.   # ● 切换
    4 Z) F- d. l' w3 c: x! a0 Y
  357.   #--------------------------------------------------------------------------; m! j5 E. Q6 X  C! O
  358.   def call(scene_class)$ i5 Y  c: [& N* l
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)7 v+ g- s- R$ j
  360.     sion_mouse_call(scene_class)
    ! \+ l+ _$ Q3 E# u0 M/ v/ \$ w
  361.   end
      k  F8 Q, D. D! l( I
  362.   #--------------------------------------------------------------------------* }1 N/ n. ?0 z( P# {/ a& M6 O0 T1 ^
  363.   # ● 返回到上一个场景; I2 ?2 ~* H$ N! O1 v
  364.   #--------------------------------------------------------------------------3 j" c3 i) Y4 c3 i$ P
  365.   def return
    3 C5 }! W) B2 G4 `8 G5 r$ Q( G1 [1 \( ^
  366.     sion_mouse_return
    / L5 i. _  }8 ?
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&
    & x% O3 h7 r0 P1 u- [
  368.       @scene.instance_of(Scene_Map)
      D3 p, s% d* n: K0 @: P
  369.   end* U( A" `& F5 c( e; k- k- @  a
  370. end
    2 w, g/ [( W% w; N5 m

  371. + C% c% s0 p) d& |& i
  372. #==============================================================================& w; i; y9 B) @' K. z# [9 e- n
  373. # ■ Module Input, \2 T1 K0 N& ]# c9 l+ ?( W* ?7 A
  374. #==============================================================================& \* o# C) O5 r1 Q# K  [5 {7 M
  375. class  Input$ |( ?( `2 X* o' g
  376.   #--------------------------------------------------------------------------! B2 G, p6 A* @7 S, e) t
  377.   # ● alias  K1 T8 z, P, L% M1 w
  378.   #--------------------------------------------------------------------------% j+ I' |5 I% K
  379.   unless self.method_defined(sion_mouse_update)
    1 d2 D' U& `- @8 b
  380.     alias_method sion_mouse_update,   update; ?$ |2 K2 ~/ K' l  f+ B" ~
  381.     alias_method sion_mouse_press,   press
    + n0 M) L4 y2 L  x
  382.     alias_method sion_mouse_trigger, trigger
    3 |6 S/ B# _( x; W- j
  383.     alias_method sion_mouse_repeat,  repeat/ e, E$ a6 p  H; f
  384.   end' w# M1 \! P6 h8 d' k
  385.   #--------------------------------------------------------------------------9 U1 Y$ m, ~6 Y
  386.   # ● 更新鼠标
    0 w8 R; u& }4 v8 g" g4 c, W# Z, k
  387.   #--------------------------------------------------------------------------
    * T4 r6 F9 C; {3 x
  388.   def update0 P" R4 ?0 n5 Z) w8 s6 G1 t
  389.     Mouse.update
    # m) P2 L9 I- S5 h8 B& p
  390.     sion_mouse_update
    $ J& H" {  _& q; y# x. n8 _  z
  391.   end; f4 k! o2 V9 r6 x# T8 y2 V
  392.   #--------------------------------------------------------------------------% y- @3 x- `$ }5 C
  393.   # ● 按键被按下就返回true5 s' ^3 c. B+ V; o% M5 Q. P9 V
  394.   #--------------------------------------------------------------------------
    5 A9 N7 N% h4 B' y' {7 ^9 [
  395.   def press(key)
    # _7 P7 `3 P' W1 O& n7 t
  396.     return true if sion_mouse_press(key)
    ! h6 E) u+ \" _; @! s: m* S, `0 I
  397.     return Mouse.press(0x01) if key == C
    ) e7 ?# ~2 n" Z; r) m2 R
  398.     return Mouse.press(0x02) if key == B
    : r! l2 f) a1 V' O4 e
  399.     return false
    , C; I+ u- P9 j* o, d) @4 w2 A
  400.   end. Z! x! k1 r; b
  401.   #--------------------------------------------------------------------------- j3 }9 b0 ]" t" P5 q% f5 r
  402.   # ● 按键刚被按下则返回true$ U+ P+ ~# L& H- G" |
  403.   #--------------------------------------------------------------------------
    # w; W' ~6 o" i7 d! Q9 ?9 b% D7 h+ g
  404.   def trigger(key)
    % G: Z. s  @; P+ y0 c( V
  405.     return true if sion_mouse_trigger(key)
    . a8 @5 W; F, t# n+ M
  406.     return Mouse.trigger(0x01) if key == C
    2 ?/ c) \9 \; }3 Z$ F& j) v/ i
  407.     return Mouse.trigger(0x02) if key == B& p" f8 w& J. j
  408.     return false  c* D- T2 ?* t
  409.   end3 Q! _9 p! j$ f. Z& X4 q. U9 {
  410.   #--------------------------------------------------------------------------5 @. H9 o3 @; L7 C/ E
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true6 T2 j% T  ?: ?$ i( D
  412.   #--------------------------------------------------------------------------
    , Q" {# o/ Z' N( u4 d8 I1 y( V
  413.   def repeat(key)# q5 M5 h0 T. a& x, D- f7 P6 ]; d
  414.     return true if sion_mouse_repeat(key)
    & l; q9 t  q, y% S* b
  415.     return Mouse.repeat(0x01) if key == C
    7 Y8 b/ f7 b( Z- }  J: Z
  416.     return Mouse.repeat(0x02) if key == B3 _8 x8 g5 v1 v: p  g1 I* t
  417.     return false
    ) X5 j2 G) j- P! p
  418.   end4 D7 r# A  H8 o. s2 Z+ b2 @8 v
  419. end
    ' N: M& @: w2 Y! Y' h
  420. : K8 C- S- O/ q. f, L/ ~+ _9 z: v& c

  421. $ \7 w+ W$ i6 h
  422. #==============================================================================
      ]7 c; d1 G; z/ ]0 {& |
  423. # ■ Window_Selectable9 S2 \3 h! _8 v
  424. #------------------------------------------------------------------------------2 M- H' O6 Z% B' A
  425. #  拥有光标移动、滚动功能的窗口5 w$ u8 q1 [/ ^, z. L! n  z
  426. #==============================================================================! Y8 A( m, i, r5 n) a
  427. class Window_Selectable
    # q0 m$ m3 ~0 `% M2 C
  428.   #--------------------------------------------------------------------------
    * Q9 d# _5 O  L  b1 q
  429.   # ● 初始化
    5 a& p5 b" ^. D1 k( B
  430.   #--------------------------------------------------------------------------5 H7 |# B2 E5 C& ^! @& b
  431.   alias sion_mouse_initialize initialize
    # i; O  l3 x! R9 h( @0 ^- o
  432.   def initialize(x, y, width, height)3 T% \4 Y& W* ]1 f
  433.     sion_mouse_initialize(x, y, width, height)
    ' s  _; E, i& D, u7 O5 S+ x# C
  434.     @move_state = 0
    " S- V* W" ^% R5 W
  435.   end
      m* e$ `/ @/ f: \8 Z2 ]
  436.   #--------------------------------------------------------------------------1 p( H1 o2 C6 F5 u) ]
  437.   # ● 更新  G1 g9 X4 ?& B8 _
  438.   #--------------------------------------------------------------------------  d, v: |' n$ ?
  439.   alias sion_mouse_update update
    % O6 P# x1 j4 l4 l0 N" S! O' I
  440.   def update* k  A* ^1 {( s0 z: ^5 I
  441.     sion_mouse_update1 ?0 {0 E# H; v1 z  P; \+ I+ h- V
  442.     update_mouse_cursor
    2 q: u" N4 t6 m2 h0 x& B
  443.   end
    ! ]& q# E( P% N) C
  444.   #--------------------------------------------------------------------------
    : x1 T8 u$ `. Y& k' g7 k- p
  445.   # ● 启动后设置鼠标到index位置1 r% c; f' O; a5 c% C. a
  446.   #--------------------------------------------------------------------------0 i) w! {8 \+ T! j( J5 R; k
  447.   def activate
    ! x! G9 ^% Z4 a$ u9 T) O% y1 F+ O4 S
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos( U; c+ g- g4 u+ i& A4 e
  449.     super& d) c4 M% m* P
  450.   end. e0 f6 Z% \6 k5 K
  451.   #--------------------------------------------------------------------------
    7 _- a- E( S0 B
  452.   # ● 更新鼠标和光标的位置
    2 h/ c* E8 g8 T2 X# ~
  453.   #--------------------------------------------------------------------------, d  }# t; Y8 N: l9 ]: D
  454.   def update_mouse_cursor4 q8 D, _& N, {1 G" T1 e7 X* Z
  455.     if active3 `' o* I( f9 A. l8 o0 _  T
  456.       if @need_set_pos& ~5 G! Q' ]* w6 T
  457.         @need_set_pos = nil
    - H1 d/ n/ B. s
  458.         set_mouse_pos" m3 U' j& W* J8 `
  459.       elsif cursor_movable& m; b7 ~6 j  f( T% d  o9 W
  460.         Input.dir4.zero  set_cursor  set_mouse_pos- u4 h) V- A8 e
  461.       end  D! F+ E, e7 X/ ~5 T7 j6 v
  462.     end' x+ u" u2 D# `: @
  463.   end
      g0 M9 c7 s' Z4 |( u
  464.   #--------------------------------------------------------------------------
    9 V9 i* i$ Y* b" [/ D$ n2 a
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能
    3 \# ~6 j! J" _: X  x
  466.   #--------------------------------------------------------------------------
    1 S/ J, L+ P2 q. |6 n- |0 Y
  467.   def set_cursor
    ) v' {4 W! x( ^' f" V
  468.     mouse_row, mouse_col = mouse_window_area
    ( f! T7 N& P. |$ V' e3 ]
  469.     if    mouse_row == -11 E; o* U# O' \6 d. q$ s' \
  470.       @move_state += 1 if need_scroll
    + d2 c7 ?7 u# f) P$ }/ H
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand1 A" f! F$ S3 u( Z) |  a* I4 Z! _
  472.     elsif mouse_row == -2: D5 b! X) p  ]9 ^! H/ q  W
  473.       @move_state += 1 if need_scroll
    ! E+ i- L1 d; V# j
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    # [+ X% Y2 F" R2 C& u! d' \
  475.     elsif mouse_col == -1
    ' F( v1 Q4 t9 V1 m9 @" k
  476.       @move_state += 1 if need_scroll
    " q! F0 b3 R% v$ x- C( v
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    % o2 p' I, z+ @6 t- ?  \2 ?$ j
  478.     elsif mouse_col == -2
    1 t+ ]/ N/ b- G7 v
  479.       @move_state += 1 if need_scroll
    2 u0 Z/ P7 Q) T
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
    / v* Q' U+ h9 H# m) y" J
  481.     else
    % j, \, f: M  X# C. }7 l1 f1 z/ @
  482.       @move_state = 0
    # N6 [. v4 X! J( U+ l
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col, [/ Q/ r! {+ E: e2 F* u) C+ @
  484.       select(new_index) if new_index  item_max && new_index != @index* H; }0 x2 y; a" X4 P. a
  485.     end
    ! _* O0 s* J9 L* o5 i5 |
  486.   end
    - |7 i$ u' i: F5 \
  487.   #--------------------------------------------------------------------------
    % C& N" r+ d' _8 a
  488.   # ● 判断鼠标位于菜单的第几行、第几列
      W; \9 z, ]: v/ `
  489.   #--------------------------------------------------------------------------( I, ?. e/ {; F$ B  L; n. C0 ~
  490.   def mouse_window_area& j9 h  H5 |+ N+ B, f$ f# I
  491.     if viewport.nil # necessary!
    / R  H$ |" A  F0 M0 c
  492.       vp_x, vp_y = 0, 0! w3 ~( e4 y, H
  493.     else$ v# ]5 ^. n# ~. F' q& O+ a2 V$ i- ^
  494.       vp_x = viewport.rect.x - viewport.ox
    , A' I& m) B2 |) K& o
  495.       vp_y = viewport.rect.y - viewport.oy
    6 i- O/ ?! x% V5 I( Z
  496.     end" f* C( n( P: M7 z6 p6 N+ a
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    - v( T8 Z" r% ^) v1 e
  498.     item_x1 = vp_x + x + standard_padding
    * \* Q& y# o9 W# |# ]# T4 f" q
  499.     item_y1 = vp_y + y + standard_padding
    0 ]4 y- ~( e0 D% o, r' R% c
  500.     item_x2 = vp_x + x - standard_padding + width
    / a" ^6 g( o) c% V
  501.     item_y2 = vp_y + y - standard_padding + height
    % |; ?# I( E5 w' }% \( S3 t- r
  502.     if mouse_x  item_x15 N/ k5 W, p' E
  503.       mouse_col = -19 d8 o5 U0 \- G! c6 H+ h
  504.     elsif mouse_x  item_x20 v5 h' Z9 t' x+ y0 ?  g; r
  505.       mouse_col = -2" u  P2 M8 m8 D) X+ F1 c( m
  506.     else
    7 @# l( Y* o/ p$ H, E" f
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1). B0 z6 r% t, K# {* b. H5 O2 f
  508.     end
    ( ]$ j4 k. z4 t6 F: M
  509.     if mouse_y  item_y1& Z- h0 d* f1 R1 `
  510.       mouse_row = -16 \9 Q% D: e! G" t
  511.     elsif mouse_y  item_y2. A/ M( h( q/ @' D( h& W: I
  512.       mouse_row = -2
    9 W# {4 b# s1 E2 C$ j4 F+ d
  513.     else
    - X( ]" Q) u  c1 |
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    7 S0 ?! d0 R7 v, [
  515.     end1 w8 U8 F% S% b8 g
  516.     return mouse_row, mouse_col7 R( y0 ^' ?# s, E
  517.   end
    4 w$ n% o# t. X2 ?/ _! b
  518.   #--------------------------------------------------------------------------# t; Y+ ?0 t6 m5 t; U& x5 C
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置3 ^- c3 C* n- u  a* A
  520.   #--------------------------------------------------------------------------
    ; u$ P/ s7 }9 D7 m5 {7 W) i
  521.   def set_mouse_pos5 D3 g& S+ q* ~- T6 ]
  522.     if viewport.nil # necessary!2 K8 I/ z3 w: w6 O( ?0 E4 m# k
  523.       vp_x, vp_y = 0, 0
    , ^& A0 |6 d8 i+ O
  524.     else9 `3 g# @" C4 [5 w' ]. Q+ e
  525.       vp_x = viewport.rect.x - viewport.ox
    3 n/ [- }. e6 [, K, e% M! K1 N! g
  526.       vp_y = viewport.rect.y - viewport.oy; Q3 A2 ~1 D6 V# p6 a' f
  527.     end2 W) ~+ {  F* p# t% I* I
  528.     item_x1 = vp_x + x + standard_padding
    . E" L" F6 q) j7 C2 b
  529.     item_y1 = vp_y + y + standard_padding( T9 H" `. H* _2 s/ v, V2 `
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
    $ r2 g# S) Q; K/ N5 W
  531.     row = get_index  col_max - top_row
    9 [( X) D1 B3 {- F( Q3 |
  532.     col = get_index % col_max
    / t, J* @) c5 K: U1 s0 V  N
  533.     new_x = item_x1 + item_width  (col + 0.5)
    ; s) N0 ]. U1 K
  534.     new_y = item_y1 + item_height  (row + 0.5)
    4 q3 @- J, U% u, y. b
  535.     Mouse.set_mouse_pos(new_x, new_y)
    & V) ]- I& }$ z; y9 R5 F) g
  536.   end8 U' m5 i; ^9 d9 T
  537.   #--------------------------------------------------------------------------1 b7 J5 M' B' \" C" T& `
  538.   # ● 判断菜单是否需要卷动) w$ {% N0 i! i; q
  539.   #--------------------------------------------------------------------------
    ; P6 W* @; _. M2 _% A% N
  540.   def need_scroll! [4 {  Q2 u% _2 \, @' F
  541.     item_max  col_max  page_row_max0 Z* E9 E4 [5 Q: i  p8 K
  542.   end
    : i% B; j8 g* ]4 Z
  543.   #--------------------------------------------------------------------------
    7 D7 B" g$ j0 ^0 I+ j5 l3 a: B
  544.   # ● 判断是否为水平卷动菜单4 o9 Y* q, T0 S
  545.   #--------------------------------------------------------------------------' E5 |' E9 w; O  K9 B+ s' x% ^7 d
  546.   def is_horzcommand; \3 g4 t6 i4 }
  547.     return false
    3 N8 Q; a6 ?) X6 g2 U# i5 K
  548.   end
    8 w8 z2 C4 R4 V) J- r4 @7 P6 q
  549. end& Q  C8 U( S/ m2 G. V

  550. + F: T2 J- r4 Q% ~- R
  551. class Window_HorzCommand
    * f: N( B) e( T, S* H
  552.   #--------------------------------------------------------------------------& |* b9 S9 A' t0 [* Q) y
  553.   # ● 判断是否为水平卷动菜单
    + y2 |5 w' N8 k6 g7 k( i* @) v
  554.   #--------------------------------------------------------------------------
    6 q# J' o- T0 B6 r) I: i" E
  555.   def is_horzcommand
    2 u# f# `+ |# O8 l
  556.     return true
    7 e- K/ F! \/ c( d8 u) b
  557.   end
    ; M9 A( `; e9 I2 o6 @' |4 d
  558. end
    ) @' o5 J5 X0 j2 S# }8 [3 [
  559. " O7 e* B+ }) M; ~
  560. #==============================================================================
    2 L( m5 b0 [. V
  561. # ■ Window_NameInput
    3 S  h: e6 ^' ~
  562. #------------------------------------------------------------------------------$ p! v9 c+ K- y$ v7 W  `
  563. #  名字输入画面中,选择文字的窗口。" _/ {: c2 O% {( ~% C, X! U
  564. #==============================================================================: t) g6 l; |, W2 h+ s
  565. class Window_NameInput
    4 A: ]. n$ Q& R
  566.   #--------------------------------------------------------------------------
    ' O0 `3 Z* n$ k% E9 R
  567.   # ● 设置列数' C$ Q+ `1 @/ m' ?$ J. n2 ]" ]  s
  568.   #--------------------------------------------------------------------------+ y* p" j8 R7 u/ v6 O
  569.   def col_max
    - M6 N1 b% b/ l) c4 U
  570.     return 10
    . [/ ], @' V) F) P+ o
  571.   end$ k- t1 D/ T5 W& p4 V  \
  572.   #--------------------------------------------------------------------------
    " N6 `" @3 d6 I) k$ ~! d+ m
  573.   # ● 设置填充的Item个数5 a( X! Q6 [7 e4 Q" O$ u: [
  574.   #--------------------------------------------------------------------------' L+ r# e: L1 z" I
  575.   def item_max$ Q: U- B- X/ d# R0 l$ D
  576.     return 90& g: v, S& k" }- p. J' Z) C+ [- @
  577.   end  {! q: c1 u; y$ A8 i1 B! m2 s% B
  578.   #--------------------------------------------------------------------------; g% o) F  q) Z# B
  579.   # ● 设置填充的Item个数0 X: g7 g3 Q1 `+ g
  580.   #--------------------------------------------------------------------------
    * B6 z& A* R+ a5 T2 X. l
  581.   def item_width$ B, i) S$ Y" d7 F. t2 G$ j2 b
  582.     return 32. D3 [# Z: U) Q" Y9 ]
  583.   end
    8 O! @0 @$ d, \1 `5 K
  584.   #--------------------------------------------------------------------------7 c) h0 A! W& l1 D
  585.   # ● 判断鼠标位于菜单的第几行、第几列
    8 e1 v3 O; R0 i0 A1 k5 T/ z* m
  586.   #--------------------------------------------------------------------------
    1 e! k3 [4 z  _0 K' ^0 {- E; ^; s
  587.   def mouse_window_area
    7 V& S( B$ Z) ~# G# L2 ?+ U
  588.     if viewport.nil
    * h0 N1 [: U8 R) F+ g
  589.       vp_x, vp_y = 0, 0% R/ D# M! d% t( o" H9 A- ]  ]/ l
  590.     else
    $ X+ L; H/ R  H: T, M; {
  591.       vp_x = viewport.rect.x - viewport.ox6 Z4 {$ |5 v6 F$ J4 V2 n
  592.       vp_y = viewport.rect.y - viewport.oy$ Q/ \5 L2 M% j
  593.     end
    6 o  K6 g$ D& v  j
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    1 r" K1 F5 B$ A1 C1 R; J( S' X
  595.     item_x1 = vp_x + x + standard_padding
    ( g9 I, n0 a, V- p8 Q- w  |2 d
  596.     item_y1 = vp_y + y + standard_padding
    3 ~5 o- ?' g1 _- J5 V- O" @; R
  597.     item_x2 = vp_x + x - standard_padding + width
    : B: T  e: ?) m6 Y
  598.     item_y2 = vp_y + y - standard_padding + height
    / Y! r; K  }' n6 y' x
  599.     if mouse_x  item_x1. j" v! }$ J& F( e* V, c$ }
  600.       mouse_col = -1
    # @4 R1 q8 S' i- B7 L% h
  601.     elsif mouse_x  item_x29 g  ]6 n( p8 b/ O' P' f/ L1 x
  602.       mouse_col = -20 q: N: A5 B- h# L; R' Y  N
  603.     elsif mouse_x  item_x1 + 1607 G" D( g3 ?( X% Q
  604.       mouse_col = (mouse_x - item_x1)32
    ! H' O& B( d% ~, n& ^3 k
  605.     elsif mouse_x  item_x2 - 1609 Z# D+ ?% R' K6 i
  606.       mouse_col = 9 - (item_x2 - mouse_x)32' J4 G; G1 Y+ x" O8 ~7 q
  607.     else1 j4 Y) W+ j0 x' [5 A8 q
  608.       mouse_col = mouse_x  x + width2  5  49 G" h4 B6 \4 v2 w/ x
  609.     end) Z5 F2 _' f/ w; {: M1 A- L
  610.     if mouse_y  item_y1
    7 E% f4 g; ?, h4 g! ]+ W4 o6 U5 h, y
  611.       mouse_row = -1
    2 ~/ K# D4 [) `* r% o* |
  612.     elsif mouse_y  item_y2) i  T, I! Q0 J7 [1 }/ H: c/ y. F; ~* e
  613.       mouse_row = -28 ]' `# I0 Z" j  ~
  614.     else
    ; T% a. ^+ M6 t% x% C! K
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)/ m+ ^/ ^3 h- x4 @1 L
  616.     end4 ^& s9 `+ A6 `4 m3 l
  617.     return mouse_row, mouse_col2 A3 m9 L% _! l* H+ V; ^6 n* F
  618.   end7 M6 j) W( S7 P
  619.   #--------------------------------------------------------------------------, E; R4 n) R# W2 G
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    % j$ x) R( i, ~
  621.   #--------------------------------------------------------------------------8 V9 T5 r3 [, V( K( H+ Z
  622.   def set_mouse_pos# ]; t0 H" e- ^4 _7 x% t1 z+ H1 `
  623.     if viewport.nil # necessary!
    0 T/ Z6 q+ R* g* V; G
  624.       vp_x, vp_y = 0, 0
    ! i$ c7 L1 d, [& N2 ?
  625.     else
    # v3 F' z3 l: D0 D1 [3 q! ?
  626.       vp_x = viewport.rect.x - viewport.ox0 D% V3 d+ J* }5 P& @
  627.       vp_y = viewport.rect.y - viewport.oy3 M# T) T* n+ r( u  Y
  628.     end
      s% R7 V) t) G: L
  629.     item_x1 = vp_x + x + standard_padding
    ( l. \2 p+ e% S! T& L
  630.     item_y1 = vp_y + y + standard_padding
    ! H4 X& ]3 N* D9 m& Q2 ?
  631.     get_index = @index  0  0  @index ) r0 j! d0 b" h/ w& g8 S
  632.     row = get_index  col_max - top_row
    + g' |" @- t- m! f
  633.     col = get_index % col_max
    ' t6 d! q* c  w6 \9 O2 W2 q
  634.     new_x = item_x1 + item_width  (col + 0.5)  V/ m2 Z& U: Z% Q: R& _+ d( ^5 X
  635.     new_y = item_y1 + item_height  (row + 0.5)4 t, B1 W  Z1 A6 m9 F+ r
  636.     new_x += 14 if col  4- @: m/ k' b- @4 g+ d
  637.     Mouse.set_mouse_pos(new_x, new_y): t! d9 B& ?7 q9 y: t2 g
  638.   end
    * X7 y! s# S, z- a( K; u4 b2 X
  639. end
    " q, t9 r9 v: s) O

  640.   I2 }+ c$ c4 W) m7 N3 _0 n; h
  641. #==============================================================================
    8 K# Q5 Z' l& ?' O8 _
  642. # ■ Window_NumberInput
    % q8 ?$ `) N" o
  643. #------------------------------------------------------------------------------5 N, }, H* X4 c+ W
  644. #  重写了数值输入的方法以适应鼠标7 E" x2 f: ?$ O. a
  645. #==============================================================================  S" m. r# w# ^8 d
  646. class Window_NumberInput  Window_Base: e# `6 A3 i6 N( F, [( d& A
  647.   #--------------------------------------------------------------------------
    2 G% H* ^7 c* z2 G6 S6 c: i
  648.   # ● 定义实例变量& K% Q/ ^* z+ j& G1 K" H
  649.   #--------------------------------------------------------------------------& k8 N, b+ D7 m% t
  650.   attr_reader extra_window
    + b8 Q8 {5 K0 C" C( C) M( Q
  651.   #--------------------------------------------------------------------------* ]7 @1 U+ {+ c( l3 M' h4 c3 S: t
  652.   # ● 初始化1 V3 x( N/ M" p5 e* d7 e2 o, n  Q
  653.   #--------------------------------------------------------------------------
    5 z. x6 N6 l& w$ L( p( H
  654.   alias sion_mouse_initialize initialize  r% b$ ]% o/ W8 F4 P7 |) T1 E+ j
  655.   def initialize(arg)) H5 Y3 i1 z4 }, m/ i3 y* _/ ?
  656.     sion_mouse_initialize(arg); D9 C7 V; _0 o2 H4 v
  657.     create_extra_window% B5 z$ G. J* h) A+ J& d' d
  658.   end
    % T  c4 w7 R8 `6 F' M% Y4 N
  659.   #--------------------------------------------------------------------------
    " u: f/ Q7 S( N/ D, ^  z% c) \
  660.   # ● 启动
    2 p% P* N& w, m3 M! {; {
  661.   #--------------------------------------------------------------------------
    + P  X/ j! h, z" s) i$ e' \
  662.   alias sion_mouse_start start3 u( h  E7 i* z) P
  663.   def start6 N. Y6 |' B+ H
  664.     sion_mouse_start  k5 c8 k. g5 z2 G' Y2 g
  665.     deactivate  T- |3 l8 P( ]! H
  666.     extra_start5 u# t1 a, `! |9 z
  667.   end2 R; P& `: R( m, H- X5 A, }: q
  668.   #--------------------------------------------------------------------------' z! ^! ~2 [5 g' x$ @
  669.   # ● 创建新的数值输入窗口+ B+ G# h2 z- p
  670.   #--------------------------------------------------------------------------" u& o2 {) a& Y
  671.   def create_extra_window
    4 M: _4 N4 R! J4 I* a( v7 z8 f% `
  672.     @extra_window = Window_NumberInput_Ex.new
    1 z; W9 B3 n9 \/ V% t& U
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2
    5 _5 z, ?% ]8 C" E/ P
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }! w  V1 q9 a- L4 _. o/ C7 k
  675.     @extra_window.index_proc   = Proc.new {n @index = n }
    ) V3 M4 Z/ _0 g% @8 ^, l
  676.     @extra_window.close_proc   = Proc.new { close }
    9 Y/ {1 |) V( O
  677.     @extra_window.refresh_proc = Proc.new { refresh }
    , `" ^* v" [) E; u9 j$ i7 [- q
  678.   end
    " i# Z% P% f" @
  679.   #--------------------------------------------------------------------------; j& }9 T3 `0 i/ q1 a3 q5 V
  680.   # ● 激活新窗口
    ! Q- D, C! d5 L
  681.   #--------------------------------------------------------------------------
    8 x# D; O" G& ^. L. u
  682.   def extra_start4 t+ q6 g5 H8 d3 z
  683.     case $game_message.position: _! y. Y/ ]4 b( _0 @
  684.       when 0; @extra_window.y = y + height + 4  I% g* s% g) h) P  e: U2 b* _
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8) O4 R: n6 P+ b# c7 F/ F3 r* e
  686.       when 2; @extra_window.y = y - @extra_window.height - 4! t0 T  T/ \' g, v3 C
  687.       else  ; @extra_window.y = 82 y& j+ S- U0 }9 v
  688.     end, G* b: `% ~3 F6 N2 c1 x
  689.     @extra_window.variable_id = $game_message.num_input_variable_id
    - B8 n. ]" @3 U1 p
  690.     @extra_window.digits_max  = @digits_max+ Y# i/ j+ i) Q0 o
  691.     @extra_window.number      = @number
    ! S" Y7 r( W3 |# e
  692.     @extra_window.open
    8 t) C, T  S- t' _  u5 H- _4 U
  693.     @extra_window.activate& M& g* D% A$ D0 ~/ l3 V
  694.   end8 r& O6 a) \; c: v) u, t: ]  w. ^
  695.   #--------------------------------------------------------------------------9 R$ N& q  m" u3 Y
  696.   # ● 更新
    % w& C8 k  h1 ~: s( G
  697.   #--------------------------------------------------------------------------5 ~0 U2 H3 Q& o7 [( X7 F+ k* N% D
  698.   def update# W3 G: {! K! T; k, `( f8 F
  699.     super
    & Q5 Z. X# ^4 Y
  700.     @extra_window.update, C) }( @. F8 o7 \* K1 M1 z
  701.     update_cursor' O' r  R0 L: r* I  p
  702.   end9 Z0 E( J, R- d0 ~6 ]" n. {
  703.   #--------------------------------------------------------------------------" Z0 Q% D6 C$ f. Z5 @
  704.   # ● 关闭窗口- O5 ]/ t+ h4 ]
  705.   #--------------------------------------------------------------------------1 k) B- `9 ~: E9 n: ^
  706.   def close
    3 v$ |( k" E5 N, Z4 r7 V  \1 p
  707.     super
    " o9 G* f- n1 |2 e
  708.     @extra_window.close
    6 ~! H& M7 ]9 f4 F$ K4 q
  709.     @extra_window.deactivate  e" X) h& M) k( v. o4 s
  710.   end2 _2 q% e. j  h: g& U1 g# ~
  711. end
    4 V# u! L/ v4 B
  712. 1 P3 U. y* K& _& S
  713. #==============================================================================
    ) Z6 Z: n! l( ^0 H$ o9 s. K# @
  714. # ■ Window_NumberInput_Ex
    & }# A, N" B2 F; l( \5 |7 h+ E
  715. #------------------------------------------------------------------------------1 F" F# j$ n& d5 G
  716. #  新的数值输入窗口(NewClass)
    ! p, C! ~0 P9 W. g0 r
  717. #==============================================================================
    6 o4 a( u0 Q" y
  718. class Window_NumberInput_Ex  Window_Selectable% A8 {+ T# y  m) Z9 J
  719.   #--------------------------------------------------------------------------, `, b( J6 U& h7 ?1 j- L; A% X
  720.   # ● 定义实例变量
    & A. X3 k8 r% M7 ?! Y" K
  721.   #--------------------------------------------------------------------------: f  Y) e  q4 _; L& k5 P$ w
  722.   attr_accessor number_proc
    5 f/ p# r) g: A; T
  723.   attr_accessor index_proc1 e3 [" u. L" a
  724.   attr_accessor close_proc
    ' J" T/ \* V- T
  725.   attr_accessor refresh_proc+ p* I- \, \) Y! n% }5 R7 v
  726.   attr_accessor number
    7 M1 T1 H: h2 `
  727.   attr_accessor digits_max) Q! ^' J8 ^# W6 I7 K6 a+ x7 s
  728.   attr_accessor variable_id8 p) ~, K& Q+ }! P  P9 Y7 J' k+ g
  729.   #--------------------------------------------------------------------------
    $ c4 C/ H- [# f
  730.   # ● 数字表/ M; c8 @3 [* d  z) g# q
  731.   #--------------------------------------------------------------------------  K! P) i+ I  w' E, U& z) W
  732.   TABLE = [  7,  8,  9,
    4 z+ V, @5 F6 a, O) y
  733.              4,  5,  6,1 M+ t: L& k5 F1 X$ a" D) W9 A
  734.              1,  2,  3,
    & w* h' ~. N; z& H0 p7 `1 W3 q4 }
  735.             '←',0,'确定',]8 O: \& H0 c( c8 a
  736.   #--------------------------------------------------------------------------
    2 J5 Z; K! P. {, S+ k
  737.   # ● 初始化对象. r" {- Y9 |  Y2 _
  738.   #--------------------------------------------------------------------------- U' L0 R% P* e9 T  j3 J2 ^; U
  739.   def initialize
    # J2 I6 `4 G5 r' W
  740.     super(0, 0, 120, fitting_height(4))
    $ I9 d, x- E; a4 ]: e
  741.     self.openness = 03 c' F$ s$ {& X9 q3 Q: M) n* D
  742.     @index = 0% o9 n: W. I+ E- @  T0 ~  i
  743.     @number = 0* B) F" L' K$ t2 A  r- y. b- Q
  744.     @old_window_index = 0
    : {6 g! ?/ [. _) W- u
  745.     @digits_max = 0
    2 `" `; ^' J. ^. b
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }
    , `& f! A% a5 _1 o5 R
  747.   end1 u& d! T) H3 _2 ]
  748.   #--------------------------------------------------------------------------8 @: }! Q5 [# J' ]/ T+ R/ v  Q/ D$ O
  749.   # ● 获取项目的绘制矩形
    ' @) b( @4 q% s
  750.   #--------------------------------------------------------------------------" R7 p9 Z4 U* f: M% F* Z# E% ]
  751.   def item_rect(index)
    & [$ e% U# T% B7 H* _
  752.     rect = Rect.new; ]7 I9 q) p- R# T
  753.     rect.x = index % 3  32
    . r9 A% l( |/ q$ x
  754.     rect.y = index  3  line_height+ F4 V4 c5 }% u, l# T1 n+ p; x
  755.     rect.width = 32
    1 ~" E1 K8 H( n. q
  756.     rect.height = line_height
    : J9 L; ^1 w  ^% i; |
  757.     return rect
    2 L- ^7 }7 H7 P# j& m" s; s) n% `
  758.   end; N8 w( }" f) |) t/ d) D
  759.   #--------------------------------------------------------------------------0 p; S7 J# M/ Z8 o6 Z' B  i5 f
  760.   # ● 将光标设置到鼠标所在的位置
    + }% j9 Y* d/ `+ H( A
  761.   #--------------------------------------------------------------------------
    & ]. g/ i2 S2 ~! T
  762.   def set_cursor
    + t4 M) g- d! x8 w" G: @
  763.     mouse_row, mouse_col = mouse_window_area
    & {$ k+ t8 S9 o; D) b# H
  764.     if mouse_row = 0 && mouse_col = 0% o* I' F; j+ S4 x% ?
  765.       new_index = mouse_row  3 + mouse_col
    ; g3 I9 [, R$ W6 @9 S
  766.       select(new_index) if new_index = 11: k% W! g! h; T! v4 b
  767.     end
    3 {0 {7 ~" B# Z( r1 g- Y( G0 D  B& ]
  768.   end$ s1 w: [8 }3 R* b5 w) C: a( h% I
  769.   #--------------------------------------------------------------------------! @. @9 [4 S; i8 H
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列. G1 w7 G7 P' @- `: G/ T2 _
  771.   #--------------------------------------------------------------------------) K1 |- o' M. A3 W3 ?4 q$ z
  772.   def mouse_window_area
    ) R1 q/ n' q2 Z5 k$ m) }& n
  773.     if viewport.nil
    : M+ I) b# s; G2 _9 m6 C. J
  774.       vp_x, vp_y = 0, 0
    2 \% p0 J2 d. ^
  775.     else
    2 E  W) T  R) Q0 [# c% v
  776.       vp_x = viewport.rect.x - viewport.ox# G: V- Z7 o9 N( ^8 q
  777.       vp_y = viewport.rect.y - viewport.oy
    . l+ V2 T  i" k8 |' J& J$ [9 I
  778.     end
    - K5 H/ }, v5 g! O
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    # X# {) n9 [' F
  780.     item_x1 = vp_x + x + standard_padding 3 I; r! {/ r! \: \' m
  781.     item_y1 = vp_y + y + standard_padding
    ; y, a! |% ], k
  782.     item_x2 = vp_x + x - standard_padding + width
    + T5 q4 V8 q) x' Y' d) ^6 ~
  783.     item_y2 = vp_y + y - standard_padding + height6 W, z6 V; B: R- J! [
  784.     if mouse_x  item_x1
    0 ?, n- ^9 e5 R% t. e. l
  785.       mouse_col = -1
    + T- C4 k2 V, l0 w0 g
  786.     elsif mouse_x  item_x2
    , h2 B4 B5 Q7 e# o5 r$ \
  787.       mouse_col = -2% W# C& p: s+ O+ y2 y) t
  788.     else
    ! |& Y/ s3 u! s# B& }
  789.       mouse_col = (mouse_x - item_x1)  326 v: M3 m; U1 S5 T; o; |* o) a" u2 a
  790.     end
    ) u$ @( _5 D: p4 X
  791.     if mouse_y  item_y13 C5 e" X2 P& U, G  F- X
  792.       mouse_row = -1$ i9 _% u7 ^, `0 F/ V; l
  793.     elsif mouse_y  item_y2( o% t) h! _) J$ z" y6 \
  794.       mouse_row = -21 Z7 w; u$ a% n
  795.     else& y  d3 K: |+ q# Q/ c
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1). V. I8 w) {7 D
  797.     end8 w" n# e; K2 d8 S3 I
  798.     return mouse_row, mouse_col3 [# h/ a. t% C. t
  799.   end
    : @$ j8 W( K( u+ \5 s; d  {
  800.   #--------------------------------------------------------------------------
    5 }" c* D, q; T% `, |% \
  801.   # ● 获取文字
    * r: b* u" ^" d3 T
  802.   #--------------------------------------------------------------------------
    / a3 w3 J; z1 ]7 Z
  803.   def get_number
    . z' f+ n6 p. s; }! n+ ~
  804.     return false if @index == 9  @index == 11
    + H0 v9 n/ `9 j8 Z; o, G
  805.     return TABLE[@index]6 w) v2 P8 m+ q# D  Q
  806.   end
    , C8 Z# B* @% S; d3 y
  807.   #--------------------------------------------------------------------------7 F3 X; a# z* a6 M2 k' M
  808.   # ● 判定光标位置是否在“退格”上. z, [, w* ?4 c; Y; m" C
  809.   #--------------------------------------------------------------------------8 t) z( ^% Q# P+ P  r( t1 F' P7 j
  810.   def is_delete6 h, b: I# P3 U/ W& H% u
  811.     @index == 9/ I( e4 L- w& F7 z8 g+ @
  812.   end
    , G6 S2 Z& J! x  w3 S; C
  813.   #--------------------------------------------------------------------------
    ' m  P, u; u; T' |9 P0 p
  814.   # ● 判定光标位置是否在“确定”上
    ; v# n3 s! M' u" ]$ `+ y+ F
  815.   #--------------------------------------------------------------------------' c+ ^" S, A1 X$ ^9 p
  816.   def is_ok
    # ^8 O8 q( _3 J# U- g" W
  817.     @index == 113 t8 _- H9 U6 |" G
  818.   end  g! C, t' f- R0 c/ b  U
  819.   #--------------------------------------------------------------------------
    ( }9 E) t- j; _" r6 P  m
  820.   # ● 更新光标: \* J8 ]; F8 e$ M( K
  821.   #--------------------------------------------------------------------------/ O, w* j3 X4 V# t* h+ ]
  822.   def update_cursor
    $ a3 x  V' r- V, n
  823.     cursor_rect.set(item_rect(@index))
    ' P0 g9 a  b  X
  824.   end
    0 E- y; Z: S7 ]5 Y, F$ @( M8 F
  825.   #--------------------------------------------------------------------------& N5 r. u& ^! i" ]* b$ s
  826.   # ● 判定光标是否可以移动
    4 G2 t' O( e- O4 x  z% X0 z6 y$ n, s) W
  827.   #--------------------------------------------------------------------------$ Q0 V2 W, ^5 j  {; W, D
  828.   def cursor_movable$ ?1 T. F; K# ]/ Z# O
  829.     active9 D% C) z. Z4 P
  830.   end/ j( B+ J! [7 S2 ~) M
  831.   #--------------------------------------------------------------------------8 w" Q; r  x7 B8 I* p: y* e
  832.   # ● 光标向下移动
    # k8 s/ [; d# w4 C
  833.   #     wrap  允许循环
    ( O' H, C" `) i" K3 ^
  834.   #--------------------------------------------------------------------------
    4 P) c4 n5 F" H
  835.   def cursor_down(wrap)
    * h+ f1 P- `  q; q& v7 e0 i
  836.     if @index  9 or wrap% w, y0 ?$ ~: ]0 l
  837.       @index = (index + 3) % 12, H7 W/ w: |4 H/ W) v- S! c! d& @
  838.     end
    5 C, w/ u1 f+ I5 }' g
  839.   end
    ; ]. M" s" O/ V: J1 \. v4 b
  840.   #--------------------------------------------------------------------------
    5 s, f0 w4 a% k+ e" U# U; d
  841.   # ● 光标向上移动8 R- k/ H' [2 t$ W: h: a7 I# L
  842.   #     wrap  允许循环& Z* M- X( m5 g1 w: q1 O
  843.   #--------------------------------------------------------------------------
    5 j* x) [" l+ R- r1 G
  844.   def cursor_up(wrap)
    5 v+ A8 |+ Y( L" ~4 k0 Y
  845.     if @index = 3 or wrap& }5 M% k/ j2 [! a
  846.       @index = (index + 9) % 129 [# G9 P3 q7 S5 O8 a
  847.     end/ n8 e4 n# P7 G) H# N; ?
  848.   end: L4 c+ }# i/ h: Y7 y3 r; X" \
  849.   #--------------------------------------------------------------------------
    2 {' u$ e9 y& p
  850.   # ● 光标向右移动
      n- J8 M: e  p  u$ V
  851.   #     wrap  允许循环9 y0 t7 `7 {4 ~* g8 H3 [. ?; [5 c
  852.   #--------------------------------------------------------------------------5 ~; C2 U# c3 j4 i8 c$ j! H
  853.   def cursor_right(wrap)
    2 N' v( _) ^! O% l
  854.     if @index % 3  2
    5 V6 b- {/ `. j- F9 k$ I
  855.       @index += 1  i8 ?5 O6 Z( O2 L& S8 @
  856.     elsif wrap
    $ h, b8 {+ P3 W' r
  857.       @index -= 23 y+ ^3 u' T, `% C
  858.     end
    8 d% }) ~" U( R' H. w0 j
  859.   end4 J. B( }3 g; w! M" X
  860.   #--------------------------------------------------------------------------
    4 n1 E! _& k% X1 Z* |; W+ G
  861.   # ● 光标向左移动
    & B: c. }! z7 D9 Z6 {2 S
  862.   #     wrap  允许循环
    ! v4 `& O/ U+ b' y
  863.   #--------------------------------------------------------------------------' J$ r' ^# F8 M5 c
  864.   def cursor_left(wrap)
    ( T/ }( R6 M; {" E5 C4 A: |
  865.     if @index % 3  0+ }, |, z- t' ?' M  ]# {6 a
  866.       @index -= 1$ f) M! H1 I4 H7 q/ G6 t
  867.     elsif wrap
    5 ~  b6 v7 ]' j% F6 i9 K& S& V
  868.       @index += 25 b3 `2 _! O5 O4 {+ d5 Y9 X6 H1 ^  g
  869.     end
    ; R4 K3 _: p2 [6 O
  870.   end
    9 P1 w+ U2 ]" U9 k
  871.   #--------------------------------------------------------------------------9 V/ e. i' B# [$ M$ u+ }; F
  872.   # ● 处理光标的移动
    9 Q+ X) V6 B; @$ z: I. r
  873.   #--------------------------------------------------------------------------
    ! \# G. y9 y1 ^9 i% W
  874.   def process_cursor_move
    9 y$ U; F' A& u1 A# Y) j/ Y! L
  875.     super$ |1 w. g; {# R5 k5 x+ D
  876.     update_cursor; F" `0 F( J) T7 A
  877.   end
    ! e5 Z& n* K# w# S6 }, q
  878.   #--------------------------------------------------------------------------- ^" T/ {- E. F* I- R! @7 K) e! n5 x
  879.   # ● “确定”、“删除字符”和“取消输入”的处理
    ; N; A, B6 D. k+ T/ [8 l$ K
  880.   #--------------------------------------------------------------------------
    ; D& P) ]2 E6 m2 l
  881.   def process_handling
    $ H( i3 g8 X! N9 \0 }$ H  H" k4 x
  882.     return unless open && active4 g% ]" w8 z1 }; J1 w/ X
  883.     process_jump if Input.trigger(A)# o/ Q+ v$ P+ H: z
  884.     process_back if Input.repeat(B)
      Y3 N2 M  N9 y" E
  885.     process_ok   if Input.trigger(C)
    ; {& h/ r6 t/ X9 D
  886.   end
    2 N: b4 i/ K0 ?8 E; E
  887.   #--------------------------------------------------------------------------
    ! N* e1 C/ d5 V4 w3 b1 m  ]
  888.   # ● 跳转“确定”
    % h1 s' O) V( k7 O4 m+ [- l
  889.   #--------------------------------------------------------------------------. k$ h# l/ w: S4 C# U8 b2 b
  890.   def process_jump7 p( B$ j$ c3 _+ ~; |
  891.     if @index != 11. z' l" m! u3 s6 y3 q
  892.       @index = 11' Y4 W0 E3 H% M$ r
  893.       Sound.play_cursor
    + o! D0 g& a, T+ a
  894.     end# n1 a' u8 C: }4 A) m! M
  895.   end
    $ w/ B* B! e+ i  {  Q
  896.   #--------------------------------------------------------------------------
    " m% E* {5 R0 p. r
  897.   # ● 后退一个字符3 J  S( V5 r* F( _
  898.   #--------------------------------------------------------------------------, k& R  u$ l+ j8 `/ J! {) l5 h
  899.   def process_back
    1 h) \) N$ V, R; c& H, ]9 q
  900.     Sound.play_cancel$ l8 ~! |# E* T7 I  J
  901.     place = 10  (@digits_max - 1 - @old_window_index)
    - t6 X+ C% ~, J7 X! Y
  902.     n = (@number  place) % 104 `: ~- r2 m: I5 r
  903.     @number -= n  place- Q& M5 K+ Z0 W* d% J' c
  904.     @number_proc.call(@number)
    . X7 M! k, {4 N$ `' Y) M9 ?% D% Y4 L
  905.     @old_window_index -= 1 if @old_window_index  0
    5 |4 m( N6 G: d7 c9 _
  906.     @index_proc.call(@old_window_index). U7 X5 i% k' {& E
  907.     @refresh_proc.call
    9 Q+ \1 h$ s) Q( B
  908.   end
    ( b; N$ X! \& L
  909.   #--------------------------------------------------------------------------
    ' F1 _% \- o, A" X# s
  910.   # ● 按下确定键时的处理8 z+ V  ~0 I3 t* V
  911.   #--------------------------------------------------------------------------
    $ `+ `1 @( N1 B: f4 {  h3 P
  912.   def process_ok
    & \- i. C) E2 ~% S7 k4 B" O
  913.     if get_number
    ! J5 B, F8 K. p" M( p, f
  914.       Sound.play_cursor
    7 y  I0 X$ s: @6 {+ N. l
  915.       place = 10  (@digits_max - 1 - @old_window_index)
    $ l9 G% T9 G! J
  916.       n = get_number - (@number  place) % 10
    . h+ f- C/ ?# Q( a+ q- `9 i! L
  917.       @number += n  place
    - S9 X& H8 w. M. u
  918.       @number_proc.call(@number)
    1 _$ u: C& H& x  {5 P, I9 O3 J
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    ) }0 J. a6 x) |' C" U& t
  920.       @index_proc.call(@old_window_index)
    . t1 z: c" H+ k1 C
  921.       @refresh_proc.call5 Y8 v; a9 \5 m! a) w8 n  x! F
  922.     elsif is_delete8 y, U: ?4 w% ?4 g
  923.       process_back
    " E! K6 e: Q8 ?  ^: _4 Z
  924.     elsif is_ok
    6 |; N, `# t1 v% I
  925.       on_input_ok$ g7 N' X+ Y* {
  926.     end8 u9 x& O# d8 o* i! d& }
  927.   end
    3 P9 }9 `9 a9 P" \! b9 P
  928.   #--------------------------------------------------------------------------9 {# R* v3 l  a$ ~9 g) Z2 V) g/ W' Z
  929.   # ● 确定
    & E4 |. V7 e( ?% y1 C( L5 |
  930.   #--------------------------------------------------------------------------
    ' y1 D- g  t: C* A+ [6 q
  931.   def on_input_ok( U0 Y# u( C" M
  932.     @index = 0- m: \2 L( b& ?9 f6 b
  933.     @old_window_index = 0
    , p4 C, v* d% I: \* e
  934.     $game_variables[@variable_id] = @number( ^1 S& t2 |( ]
  935.     Sound.play_ok5 ~& D. K; z9 T- U8 |  b
  936.     @close_proc.call$ U. h1 f8 N% N3 j
  937.   end1 v& h$ T! n) @- |4 Z1 s
  938.   #--------------------------------------------------------------------------& ]% }; [# u. G, @- H
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    6 K9 {0 `* G* b* o
  940.   #--------------------------------------------------------------------------! k$ X7 [% y% X. l! ~6 F
  941.   def set_mouse_pos
    ) d$ J' S4 l/ q1 V) K1 `( t& I
  942.     if viewport.nil # necessary!
    ! P2 ]: z+ ?9 O: M1 F. X, O0 i
  943.       vp_x, vp_y = 0, 0! S8 |& s% a" S, e8 }: n
  944.     else/ A& s8 j" C9 k6 P; y0 Q4 ]6 V* G
  945.       vp_x = viewport.rect.x - viewport.ox7 w& g5 e2 T8 H: o6 \( k
  946.       vp_y = viewport.rect.y - viewport.oy6 S& A3 f: l' l. }* v/ V
  947.     end
    # _" s. O7 H! G* Z% D
  948.     item_x1 = vp_x + x + standard_padding $ ^# L. w5 A/ a. O5 [
  949.     item_y1 = vp_y + y + standard_padding
    1 d% m  `: Q3 K; O, q7 n
  950.     get_index = @index  0  0  @index : L2 m( C! A% n8 E5 Y
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)5 I- d7 a9 J8 V
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)
    / Y$ n' L4 x, \; w8 }; q/ k" a' t
  953.     Mouse.set_mouse_pos(new_x, new_y)6 f5 O* J( z0 ^* ~: z1 c- `
  954.   end8 {5 \) H0 d! [' {+ p  p+ L
  955. end
    0 M0 D, K3 O& ?

  956. : n6 s( R7 D( {- |' T
  957. #==============================================================================
    + n) T) c% j' B9 w' p
  958. # ■ Window_Message/ [7 O/ t  r7 P" `) j) R
  959. #------------------------------------------------------------------------------
    0 `1 N& D( u  Y! l/ q
  960. #  显示文字信息的窗口。9 }. V% i) \, G% N0 P0 _
  961. #==============================================================================
    1 D' ?/ n/ m! n4 J( `) F
  962. class Window_Message  Window_Base
    2 i9 r5 W- X9 B! i0 @8 Z2 E
  963.   #--------------------------------------------------------------------------
    ! x/ `6 V9 A1 `  L# V! x
  964.   # ● 处理数值的输入(覆盖原方法)
    ( D) H4 Z7 r# t0 n, S2 C5 u# v
  965.   #--------------------------------------------------------------------------
    $ ~( w/ F) y1 o3 `( ]$ _
  966.   def input_number$ ]5 E" [' R9 z3 Z" l: h( @
  967.     @number_window.start6 i9 s5 T6 [7 t) M. C- l6 s
  968.     Fiber.yield while @number_window.extra_window.active' Z+ q5 c# \& d' l; I2 W0 @/ O7 _
  969.   end
    $ o  ^5 }. W) s
  970. end# ^7 ^1 [! C& A  ^) a
  971. & R) s: x0 ~5 B( S1 Z$ Q
  972. #==============================================================================
    : B( G- u/ Q1 A2 \7 o; {# p
  973. # ■ Window_PartyCommand
    5 a. s/ Z" w" K/ D
  974. #------------------------------------------------------------------------------
    1 a$ s4 Q7 k9 t3 C# w" a
  975. #  战斗画面中,选择“战斗/撤退”的窗口。
    # x) J# N+ Y0 \, l7 z
  976. #==============================================================================, F) }+ c# J* U* P1 d) r  c
  977. class Window_PartyCommand  Window_Command
    ; z  w+ S* R' f. U# b5 [
  978.   #--------------------------------------------------------------------------
    ' @- ]% o) ^5 S* }
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置& ?0 n0 R  Q+ V8 w0 \: L1 U+ n
  980.   #--------------------------------------------------------------------------
    + P2 v- T1 C( v% L8 S- q$ x
  981.   def set_mouse_pos; F! _) l! M3 z8 T
  982.     if viewport.nil
    % S, U! S- j8 T% @+ e6 S
  983.       vp_x, vp_y = 0, 0  \9 x  q+ M% r/ R9 n: S3 }
  984.     else
    4 t( x" u( Y/ k; q6 Q
  985.       #vp_x = viewport.rect.x - viewport.ox
    1 b1 Z8 O8 S7 d' p1 P- F
  986.       vp_y = viewport.rect.y - viewport.oy" R/ C! ~$ ?% v# q1 l
  987.     end( ~! l8 r. f9 t0 r) t4 D* o
  988.     item_x1 = x + standard_padding
      W/ a2 d7 s2 [$ J9 v
  989.     item_y1 = vp_y + y + standard_padding
    # s, j; N* g: \6 R( C7 b. u; h
  990.     get_index = @index  0  0  @index
    : [% f4 k7 I: O8 V, x. Y/ T
  991.     row = get_index  col_max - top_row
    , T. q) W2 ^; n; n* Z
  992.     col = get_index % col_max
    : ~' S" t' S) ^6 j1 _0 j2 c
  993.     new_x = item_x1 + item_width  (col + 0.5)# o8 D6 S) [+ P- p" |5 V# |, s5 Y4 W: Z' Z
  994.     new_y = item_y1 + item_height  (row + 0.5)
    3 H. O! ]; E" Q6 f( k/ x1 b
  995.     Mouse.set_mouse_pos(new_x, new_y)8 U2 M" I1 r( |4 i% y
  996.   end- E; ~( U% r! p$ x, h
  997. end! H3 G2 N" a8 C
  998. ) K& D* m5 u* J! g8 x
  999. #==============================================================================
    8 U8 D6 Q' [2 A3 M0 g
  1000. # ■ Window_ActorCommand
    ) T) [3 f$ c+ w% U
  1001. #------------------------------------------------------------------------------8 K' p: \7 o+ ^+ `
  1002. #  战斗画面中,选择角色行动的窗口。$ \& h3 S3 o" G9 ]' ^
  1003. #==============================================================================
    ; b! I' s9 w+ M9 D
  1004. class Window_ActorCommand  Window_Command
    0 E# y) g" D/ s  D% w& `
  1005.   #--------------------------------------------------------------------------
    4 c) `! `, s4 P% N
  1006.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    # a* j2 a0 V$ H& x
  1007.   #--------------------------------------------------------------------------
    " T. G. y! l9 z! _1 O
  1008.   def set_mouse_pos
    ' \3 E; L+ p5 t
  1009.     if viewport.nil
    ; ?8 S; ^% u: s3 v: J; H8 e( `
  1010.       vp_x, vp_y = 0, 07 q5 n' E* W' h5 E& L$ h2 ~; M
  1011.     else+ c( q8 j7 ~# O
  1012.       #vp_x = viewport.rect.x - viewport.ox1 ?- c* t4 \8 K, @1 t0 I
  1013.       vp_y = viewport.rect.y - viewport.oy
      E" h6 M! K, B& {! t' p
  1014.     end
    ( r" L- `4 O( [
  1015.     item_x1 = Graphics.width - width + standard_padding
    & m( h. o1 \. s; z8 L' O/ M
  1016.     item_y1 = vp_y + y + standard_padding
    ' q8 n( o5 Z7 l+ k* |
  1017.     get_index = @index  0  0  @index 7 c3 E+ w* n9 m; |) D/ ]; T
  1018.     row = get_index  col_max - top_row5 I: p! \& _; f5 b; d0 ~
  1019.     col = get_index % col_max
    3 o2 W' q0 [5 v8 s) M( L7 N. N
  1020.     new_x = item_x1 + item_width  (col + 0.5); \. ?+ `- }4 D! b/ z
  1021.     new_y = item_y1 + item_height  (row + 0.5)4 w+ i8 K, ]- i) J. E
  1022.     Mouse.set_mouse_pos(new_x, new_y)4 h4 V; l) P# [- `, c: _. V
  1023.   end. K- t# f6 }% \7 }
  1024. end
    - A! J  Z7 ~- ]$ {3 U

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

  2241. / R! s0 v7 l% }1 ?* t3 t. D  G
  2242. #==============================================================================: M; Q. f) R0 @5 ^' L2 \( m9 C
  2243. # ■ Scene_Map/ q: W9 A2 U$ C) O) o# E
  2244. #------------------------------------------------------------------------------8 m0 y( K+ T; D& ?# f# H
  2245. #  地图画面( [3 |+ f( L, p# ^
  2246. #==============================================================================1 L1 g) M4 R& {5 O
  2247. class Scene_Map  Scene_Base
    ) r4 b/ b9 I) G' v
  2248.   #--------------------------------------------------------------------------, n$ G$ Q; ]- i- j
  2249.   # ● 画面更新
    - Z2 Y2 L$ T) t  _, J  i/ ^* x  f
  2250.   #--------------------------------------------------------------------------
    " z% g4 c$ }5 ^2 Y9 x
  2251.   alias sion_mouse_update_scene update_scene) n3 v& P$ @- E
  2252.   def update_scene. T+ _( H6 |# ~% E7 _, Y! @8 L
  2253.     sion_mouse_update_scene
    + b( }4 s" ~' N. u" o, k) Z
  2254.     update_mouse_action unless scene_changing
    2 i* P, S: ~" d
  2255.   end. D5 D2 N2 P: K% U- Y
  2256.   #--------------------------------------------------------------------------" b8 v1 w0 `0 w/ e0 Z* n+ l
  2257.   # ● 场所移动前的处理
    , n7 o# R* c9 l  n2 j/ \
  2258.   #--------------------------------------------------------------------------
    7 J  [% q0 \3 X/ C2 t. o
  2259.   alias sion_mouse_pre_transfer pre_transfer
    2 N2 M/ L% |/ t& t1 W$ H# C( a# J. h
  2260.   def pre_transfer
    5 _- _- Q0 N0 h& Q. R
  2261.     $game_player.reset_move_path
    ; S: d: o9 T2 b8 e( z
  2262.     sion_mouse_pre_transfer; Q! m3 [$ ]+ f/ D
  2263.   end& L/ O# n! T8 u1 h; N2 m
  2264.   #--------------------------------------------------------------------------
    8 u3 |$ h9 F4 B0 H. O) w
  2265.   # ● 监听鼠标左键的按下
    7 c$ g* j" {7 }& @$ H+ I
  2266.   #--------------------------------------------------------------------------( s) V% M( i8 s4 u, G
  2267.   def update_mouse_action
    , g2 x+ N6 p; i- B  F- Y( w
  2268.     $game_player.left_button_action if Mouse.press(0x01); W( ~% \, W- M4 D6 g
  2269.   end+ l1 B% g; C8 Z7 m. S
  2270. end& F0 h9 L; v+ R1 t2 p
  2271. . A! ]1 g2 s7 e) ]
  2272. #==============================================================================
    5 d  K7 I& I+ r$ h- z
  2273. # ■ Scene_File2 x8 U7 m6 ^% @4 L+ @0 G
  2274. #------------------------------------------------------------------------------
    7 P. O9 }7 `2 j7 p' U1 F
  2275. #  存档画面和读档画面共同的父类9 e( R5 y' {9 J2 {! E
  2276. #==============================================================================2 h& V3 w( W, g! @
  2277. class Scene_File  Scene_MenuBase3 Q: M( ~+ g; Y0 C3 V1 Y% [
  2278.   #--------------------------------------------------------------------------; A0 U2 Q/ i, s, j" b
  2279.   # ● 开始处理
    + r- a) ?% w8 ?2 {' z1 k
  2280.   #--------------------------------------------------------------------------
    ( S7 c$ _' L! V
  2281.   alias sion_mouse_start start
    6 v  S# x) B9 l
  2282.   def start; \4 `9 `% k! s  ~# W
  2283.     sion_mouse_start
    8 e8 i8 H% z- I1 u7 M% c/ I
  2284.     @move_state = 0
    6 ~" g: \1 K# R0 w$ G
  2285.     set_mouse_pos
    , G& {6 K5 h* Y  D: v
  2286.   end* f- B  ^% l5 f9 B
  2287.   #--------------------------------------------------------------------------4 v: i# U9 M  V5 Z9 N6 a9 o8 n  u
  2288.   # ● 更新画面- I- [: B. s4 ?! `( l, ?9 j
  2289.   #--------------------------------------------------------------------------, ]  |& ~  y( c$ i& p5 x$ u8 n
  2290.   alias sion_mouse_update update" M  ?. {$ K3 I; ~
  2291.   def update
    3 O9 G- D3 x' X% q2 K
  2292.     sion_mouse_update5 @% o% s3 w! E. l
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos  J; Q) {  x# k4 {% `5 W
  2294.   end
    " G" c" J) S- _5 D0 V
  2295.   #--------------------------------------------------------------------------1 s, Y+ ~, \1 ~8 R0 u" x
  2296.   # ● 更新光标
      _8 |6 K7 L7 o. H( c' ^+ s) p
  2297.   #--------------------------------------------------------------------------$ h: ?  U0 ~, J9 {3 }( O
  2298.   def set_cursor
    , S7 z5 z$ ]! K3 L; r
  2299.     @move_state += 1- {4 F5 D) L  R3 h  r) S
  2300.     last_index = @index
    2 Q) \( a; Q8 {$ T6 E: h
  2301.     if mouse_which_window == -29 I: p# ~5 T7 c' R
  2302.       if (@move_state - 1) % 6 == 06 Y% d  [- {* |
  2303.         @index = (@index + 1) % item_max if @index  item_max - 16 [9 @/ |9 Y" ^: T+ d' ~5 l
  2304.       end3 \9 K& T7 z: P9 x; s8 K% {: n1 c
  2305.     elsif mouse_which_window == -1
    + f6 r4 s0 V+ A8 M5 S6 n8 q$ A6 [
  2306.       if (@move_state - 1) % 6 == 0/ C0 O- ?) b- r, J) F0 S- {7 p
  2307.         @index = (@index - 1 + item_max) % item_max if @index  06 c4 f* K5 o/ X3 H
  2308.       end, ?( }1 I4 O  B, O
  2309.     else
    4 s0 G9 m8 W% ~/ {8 z% @
  2310.       @move_state = 08 W& N( U" C; t8 N. r
  2311.       @index = top_index + mouse_which_window0 w. h9 r3 q. b- w$ ]4 d+ Y$ P# x- J
  2312.     end( N" j) Q/ K: O3 [# J
  2313.     ensure_cursor_visible
    + [* W7 Z. [; [+ p* {5 H3 R
  2314.     if @index != last_index! [2 p% _; v# F2 e' H
  2315.       @savefile_windows[last_index].selected = false: j/ q& x0 {7 \$ i: j
  2316.       @savefile_windows[@index].selected = true% [6 h2 @# u) j! }' c# w
  2317.     end5 J: f  h& E+ H; ~0 l1 w
  2318.   end! m# T! e" D5 w4 e% V
  2319.   #--------------------------------------------------------------------------
    1 c: W2 O3 @! U  ~' ]) T+ \
  2320.   # ● 判断鼠标位于哪个窗口" x+ T) E" A0 g2 K! P- n9 b, t1 i
  2321.   #--------------------------------------------------------------------------; u9 |# X3 R; k4 v
  2322.   def mouse_which_window
    5 Y& ?6 t+ f0 f
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y5 n& \6 K* N& j/ e/ C
  2324.     if mouse_y  @help_window.height + 14
    7 a% r7 m  P- F9 x7 Z
  2325.       mouse_row = -1* b) E  I7 v) K( u4 H# \# [
  2326.     elsif mouse_y  Graphics.height - 14
    & e2 y# Z' H! n0 r
  2327.       mouse_row = -2* t1 Q" ^, |8 y$ i( T
  2328.     else
    . c2 W6 ~7 T5 O5 {# c& Q  M
  2329.       mouse_row = 4  (mouse_y - @help_window.height) 8 ~; C- [; u! G9 o$ z4 S( S
  2330.         (Graphics.height - @help_window.height)
    8 ?7 @1 k  O2 @
  2331.     end
    6 }1 f" W, c" E5 j" H  q. t
  2332.     return mouse_row
    5 P4 c$ U2 P' x: E( k: ~+ a
  2333.   end: T; y8 I- N6 b5 O1 A, z' K
  2334.   #--------------------------------------------------------------------------4 q& Z+ p/ ^' H" R' ^
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置% E3 V2 h: _- ~
  2336.   #--------------------------------------------------------------------------* G* l0 @" J, h( W7 `& N) Y
  2337.   def set_mouse_pos" r9 [2 [9 j! n" X
  2338.     new_x = 405 M% S  A# m( I
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24" _' c$ \' @/ b* e
  2340.     Mouse.set_mouse_pos(new_x, new_y)
    . s, ?  q# T! l( p( H
  2341.   end
    5 S$ Y' m0 V9 t6 s1 H
  2342. end4 Q1 b) r& a5 U4 D4 j
  2343. % R* y) z5 n4 b- O; W' X
  2344. #==============================================================================1 v, b4 ^0 M! Z, ~( i
  2345. # ■ Game_Event0 r$ {1 R% N/ z: U
  2346. #------------------------------------------------------------------------------
    : j% _3 y9 Q4 D; _% O! O
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。7 k6 B' N8 {6 t" e- m$ L" q
  2348. #   在 Game_Map 类的内部使用。6 e" p0 W* ]/ x
  2349. #==============================================================================
    $ H4 |, {) s" V; e0 F1 M
  2350. class Game_Event  Game_Character
    ; ]. z7 h( v; h+ [2 z
  2351.   #--------------------------------------------------------------------------
    ; o. L) g( \! E, x* h
  2352.   # ● 事件启动
    # e+ C) J# ]! B, j. A  F
  2353.   #--------------------------------------------------------------------------
    2 l2 l  P7 u5 j* b) i
  2354.   alias sion_mouse_start start
    % x- l% [2 }; ^' X# N3 ^4 Z& J
  2355.   def start
    7 O* j1 h+ u: e3 `
  2356.     return if mouse_start && !Mouse.press(0x01)
    ) s  k1 c( X: A+ k4 J0 k
  2357.     sion_mouse_start
    , [+ w2 h, t; X% D* l
  2358.   end
    ) R: M5 P/ j% o4 ?
  2359.   #--------------------------------------------------------------------------. K8 z0 w: \+ V- w5 ~/ y; u
  2360.   # ● 判断事件是否由鼠标启动) [: y2 e3 g! [
  2361.   #--------------------------------------------------------------------------
    1 L( R& v. B- T* p
  2362.   def mouse_start7 Z% W) [" O& {( I8 T  D
  2363.     return false if empty0 y% ?) N: ]  J( r7 d( b7 M
  2364.     @list.each do index; m) \, ]/ V7 y% |
  2365.       return true if (index.code == 108  index.code == 408) &&2 @/ z4 Y, v( M5 q" c" i* t
  2366.         index.parameters[0].include('鼠标启动')3 b( w0 F0 z2 H/ A& ]' H5 V
  2367.     end  L; B7 n8 k0 L2 n& s
  2368.     return false
    0 G3 [1 W$ }- w: t' `( C( ^3 {  F2 h& I
  2369.   end
    * |% k+ w9 S( P- |$ R
  2370. end
    ) r9 G" a# m( f2 A2 @" N8 X* q

  2371. : I% d3 t+ E3 E& v1 \' C5 ~3 @
  2372. ####泥煤的height
    4 ]  C8 L, a. a. B: [# }5 U
  2373. # @height = height
    ( E. E  i. {4 L& Y2 D, ^
  2374. - M- V, i2 A# J* z, p! l
  2375. class Area_Response/ _: g* ]5 b/ c) m  {1 _0 l0 s% }' V
  2376.   attr_accessor type5 p% I4 y: U8 `& ]! P
  2377.   attr_reader ox
    ) o: d/ L: ~9 m; m
  2378.   attr_reader oy1 o5 p* \% T, o" i3 I2 A; z- j
  2379.   attr_reader width
    $ I8 j# v7 {  T. d8 Y; m4 t: e
  2380.   attr_reader height
    6 y% D. Q; ]; C9 L# y4 v# G; N
  2381.   attr_reader switch_id
    9 t/ Y0 h: o+ S# F% L$ k' J
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)
    7 k6 a+ C% t6 h/ @+ u1 Z
  2383.     @type = type
    + Y  ~6 W- v, ], X/ t7 ~
  2384.     @ox = ox$ @) `: l- ^% x, G% I
  2385.     @oy = oy
    , J$ o1 L( k" t
  2386.     @width = width) t. i/ c. J$ d4 _& E
  2387.     @height = height' o. a6 _% Z1 r4 C, ]2 [
  2388.     @switch_id = switch_id9 v1 H! e& t, j! C" {
  2389.   end2 |# D4 s& S/ l3 d8 \3 d
  2390. end
    # F! K- Q! s" s. t: p
  2391. 4 _! W: ~! s: [& K2 |) m8 G9 X4 \
  2392. $area_responses = []
    / b- ~+ @5 Q& W# o7 u3 ^
  2393. % T/ o+ j( c' P. P0 U# o- [
  2394. class Scene_Map% g+ g3 T5 n5 x! r1 n' K
  2395.   alias update_mouse_2013421 update_mouse_action
    2 n9 W7 r& M8 y$ `4 i( Y% T
  2396.   def update_mouse_action
    ; {) N$ }; \. b$ j/ ?
  2397.     update_area_response% N9 k1 h. P: y' v7 U. ?- E
  2398.     update_mouse_2013421
    4 O% N9 B2 g/ _3 q8 r2 g
  2399.   end* y$ c/ N% E0 B
  2400.   def update_area_response
    / m: i# @/ [3 z1 p, W1 Q- r
  2401.     responses = $area_responses( o" @4 I0 m+ d) Y' A& R7 @
  2402.     responses.each {response( l6 {6 q1 q+ q$ t% x
  2403.       ox = response.ox
    2 ^; c, y& x. x. C$ i) I
  2404.       oy = response.oy$ f3 h6 ]- M% @3 t3 j' Z- Z& \
  2405.       width = response.width
    ) y- Y4 y) m( j8 u, `: Y
  2406.       height = response.height
    9 Z5 b( A1 ?2 I
  2407.       switch_id = response.switch_id
    5 q7 h. H- P! i- q' }0 Y- _1 B
  2408.       case response.type! {- r9 [4 `" o8 g8 i
  2409.       when 0) o- z8 w( r$ c% ^! v
  2410.         if mouse_in_area(ox, oy, width, height)8 O$ D! [0 V* B& P7 w. m7 r
  2411.           $game_switches[switch_id] = true) m: `( H" X% n2 m7 k0 r2 d' r
  2412.           $area_responses.delete(response)
    ! N+ k$ a6 M# }9 v1 G: D6 z
  2413.         end9 L) c7 |4 d$ I1 H  h
  2414.       when 18 c: S6 `( H: e% a* }6 e4 |
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)
    : X$ o3 I6 E" x, ^
  2416.           $game_switches[switch_id] = true
    - v, G5 X- v/ H; ?
  2417.           $area_responses.delete(response)
    $ Z# j: U: c. W3 F; v! p9 U; {+ E8 W! z
  2418.         end
    ( {6 s8 g0 \3 X: p
  2419.       when 2
    6 I. c4 C! X0 Q+ a. o6 T- h+ |0 @  `
  2420.         if mouse_in_area(ox, oy, width, height)9 x+ d6 x9 W6 ]; U: r3 ?% Q* p
  2421.           $game_switches[switch_id] = true
    3 h9 ]: j7 S$ V: W- E) x! u3 P
  2422.         else5 b5 h8 r9 Q, ]
  2423.           $game_switches[switch_id] = false
    , q6 y+ ~) F; ?3 L
  2424.         end
    7 u, W* o+ U5 i6 U/ ~: e1 U
  2425.       when 34 N: d9 h' W+ \/ P3 @/ [; M
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,
    % K3 v! P+ [7 D+ _2 o
  2427.             (oy - $game_map.display_y)  32, width, height)$ i2 s3 d! o0 O* E# b
  2428.           $game_map.events_xy(ox, oy).each {event
    + {7 k( ~3 x0 `- j* E- w* ]( h
  2429.           event.start
    1 q$ j$ v3 R3 o) G3 M  W+ a' S+ N* ?
  2430.           $area_responses.delete(response)4 U8 ^4 ^3 t% X3 m5 p
  2431.           return9 N+ q- t0 K2 x4 ^
  2432.           }
    4 q4 e7 {- Q% k+ B' P! A; {2 w! P
  2433.         end
    : o0 a/ E$ I8 q4 N5 L3 K" r+ P/ X5 @
  2434.       when 44 T6 b6 b2 n, s+ o1 m3 ~. F
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,# f2 J; n5 _4 e0 J' c
  2436.             (oy - $game_map.display_y)  32, width, height)
    . [. X1 P2 c/ U+ T- Q7 k5 y# Z4 V. U
  2437.           $game_map.events_xy(ox, oy).each {event
    : h  X  j% ]* ~. U. X5 W# D
  2438.             event.start
    ) b0 ~# k* e" o4 ]* E
  2439.             return
    % C9 `' Q+ b3 r6 y/ `( m
  2440.           }
    . S/ j2 Y: Y, Y
  2441.         end, O7 T0 c3 {% K
  2442.       end7 ^0 e6 B3 s+ o; l& W
  2443.     }
    * F- ?* r7 }( a8 f- o% Q  h$ E+ e
  2444.   end* Y; M3 n; B$ _" o4 V
  2445.   def mouse_in_area(ox, oy, width, height)* q' m& n$ s9 }3 }) i) Q+ C
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&! g1 r1 }& H( r( _# X+ W# B
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height
    $ [- U8 ]- s) l& }
  2448.   end
    $ P' z# @+ G, h1 Z9 S: u7 Q+ V
  2449. end' x9 m5 J+ R! h0 ~" S0 }! H
  2450. class Game_Interpreter
    & U3 s" T4 Y! _4 u4 r
  2451.   def area_response(arg)1 y% u+ a* X) ^( S. m2 u' G# X
  2452.     $area_responses.push(Area_Response.new(arg))8 S. C/ @3 _7 f2 ]! m
  2453.   end
    + {- |2 b+ l- S- f5 k
  2454. end
    * G8 F: I5 r" b  b/ E. v% w
复制代码

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

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

GMT+8, 2025-9-11 05:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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