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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================- A6 S- @0 s& W& r$ J
  2. ' p1 U% C0 T. g  P% m
  3.   Sion Mouse System v1.3e
    - K0 F  E8 Y+ S. F% `% _7 u
  4.   
    8 {8 I3 b" K& J4 m% _6 v2 r
  5.   Changlog
    ! @" L: o4 c. w4 D/ d/ [
  6.   1 V& k( `& r2 ]/ q* X
  7.   2013.4.21 v1.3f( B* Z: m' t: |9 E% E
  8.     0 k& F/ ?8 l7 Q/ ^. }
  9.     1.3f 卷动地图 bug 修正
    ( r9 N( M, g/ d9 Z# k
  10.    
    2 P1 N; O- z0 S
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口
    4 D& }' J  r8 Q0 T: C! c4 w
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内
    9 d8 C3 C: ]4 |, P  V) O  u' Z
  13.                               Mouse.unlock_mouse_in_screen 解除锁定* f- C9 ~* L) g1 O
  14. & ?* W+ `* ]  t1 V& A; I) m
  15.     1.3f bug修正1 n6 \) u5 i( u0 c# ^; m
  16.   
    8 Z& B. t8 ]. N9 O
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及$ c: N) Y- q: k1 _  W. Y
  18.           关闭菜单时,鼠标是否移动到原来的位置。4 l5 C( W6 k  y; G
  19. 5 j3 _8 y7 z6 }: k3 A
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处. _& Q1 {# h5 J
  21. - n: K* g6 F: s4 M# A
  22.     1.3b 修正一些罕见的bug;
    ! Y! p. \0 H. T% l+ N1 k
  23. 6 _3 x& N6 w" x! x5 c
  24.     1.3a 代码小修改;% N0 p9 V( i. B& x
  25.           加入了鼠标点击启动事件的功能,
    8 n- j( ~0 V$ U/ J( Y3 d7 x
  26.           在事件中加入“注释”: 鼠标启动  ,
    ; L. ~% }: q: `0 s7 l9 T0 }
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    , U2 I" d. G8 p2 P
  28.   
    # r/ h: I0 D: o2 p1 S
  29.   2013.2.12 v1.2
    5 T0 G3 s& t- Z
  30. 9 p/ E, I; ~* E% _! y; r; H' D% A$ V
  31.     寻路逻辑优化;
    7 b: M  w' l; W3 `5 p5 s) `  p
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;
    6 T7 P8 q" ~/ _) W/ h' o0 ~
  33.     现在支持用鼠标来操作载具了。. ^" b; ~! P" ]- |; O7 [

  34. % W0 j4 ^3 D: T0 u! b
  35.   2013.2.8 v1.19 [4 q" N. R! z7 s" b( F: l$ u- L) O

  36. 5 C" x/ @/ G$ y7 r3 o
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;! C0 ]8 ?. f3 K7 {
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;
    4 p! D1 `8 l4 B- q6 a) x* t
  39.     移动时,路径指示点的绘制更加稳定;
    $ j. G2 J& V. X0 r5 P
  40.     现在支持默认存档画面的鼠标操作了。
    $ Z8 C& d% H( ?, l9 b- t: v& G$ W
  41. ) L) i) r9 m/ ^3 S: q1 G1 m

  42. 0 }6 a3 \3 a. p
  43.   OrigenVersion
    ! p+ ^; T/ I9 d
  44.   : y3 T! Q$ k) i) P
  45.     2013.2.7 v1.0 ) b6 d0 w4 X  L; c' Q

  46. $ z/ _; m( i3 c: J; x% i. {' x
  47.   主要功能( W; a8 b! ~2 P. r3 m/ n
  48. ! Y+ N/ _2 e% X, P
  49.       使用鼠标进行各种操作...
    ! ]" X& i2 u5 ]% ?
  50.       将鼠标锁定在游戏窗口内
    + t' P4 U0 V, `7 L/ n7 u
  51.       自动寻路,按住 D 键可以扩大寻路的范围/ g9 q( r: v# h* M9 n
  52.       双击鼠标进行冲刺
    5 J1 e( t  {) M) R% i  b" Q) ]
  53.       更改地图卷动方式以适应鼠标移动$ g3 @0 l9 E7 _- f' @' R; x/ ?
  54.       变量输入框改良
    # b4 P2 b: M) X

  55. 2 p- ?" @! Y: u0 `$ \1 [8 c
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹* a9 a8 E2 m% V) [- X2 ~: U  v

  57. & {, n7 \+ \8 }6 Q
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹
    7 ?' ]6 m) |% m! d. V3 Z, C, T
  59. + m. t2 A5 O- v6 n" q
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭9 I( b# B, h* b6 A; n- v
  61. 1 r; a9 `* k$ P

  62. 2 a9 C1 |( D! i% D
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★) d) ~* X$ V9 u/ ^' ?/ i
  64. 9 [! C' j9 n8 ^! k- n1 e2 X
  65. 5 Y) j7 A) b+ H4 o6 E+ H
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示
    & c' ~% [& p2 n

  67. ) c6 X9 O: |  I9 L1 S9 A4 }% T
  68. #==============================================================================, o0 e; o# A( L) M( C& [) B' f
  69. # ■ 常数设置
    / M, ], [) M# B$ Y& X3 W+ y
  70. #==============================================================================, D* {9 @2 L4 e1 w( A# s
  71. module KsOfSion
    ! f' ~# f9 y0 b# \% a
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false
    5 x* O$ _7 F: D. F9 @
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑# E& n% ~/ @7 {! M8 J6 A
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    , w; z7 |. [% |# m, V
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量
    & n6 I: C! C6 ~3 v! T0 a
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    ' i2 h9 E) n; n4 \
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧: e9 M* g+ w+ l) E' q! D; j
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)
    0 d) w, H, f; Q$ Y' v
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键( n6 {+ {! k# w3 u5 V  g; a
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)0 b: E" D: ]$ e0 @6 A
  81. end0 c6 s% l1 f  m- R* g5 i- F

  82. . d) f* c7 q+ U0 U: W
  83. #==============================================================================
    , v" \) m+ i& K% _; i7 S7 o) F) s
  84. # ■ 用来显示路径点的类
    - o8 z* W! V! J
  85. #==============================================================================2 \2 K3 L; ]1 B3 @' e
  86. class Move_Sign  Game_Character: A7 F0 Q/ I/ p7 v
  87.   #--------------------------------------------------------------------------
    0 c2 O8 V4 D6 Y, @
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图# `8 m$ i% N" L3 T# t- J( l# }+ `) Z
  89.   #--------------------------------------------------------------------------& a4 k! e' J% U, L2 f1 Y3 {6 \2 u8 N# r
  90.   def init_public_members0 u$ T0 `$ u; ^' Q5 J9 F2 S: a5 h
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹
    1 q) c# F/ S0 R. j8 \+ j# a6 O
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    ' u! n4 e, u  a, q. G" w  C. g
  93.     @move_speed      = 5        # ★ 踏步速度
    6 s9 r! |# b& N5 l1 W
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    7 F" U8 ]; i1 M4 }0 i
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度* g8 W9 \2 ]% N+ r7 A
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)+ E9 M4 Q) o6 [! Z: g
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列
    ) g4 \; {' Y! l) G4 J7 U1 x
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)
    7 y& B% W9 s/ _$ D- D& k2 H

  99. 4 Y0 a) Y3 ?3 Q' D; Q% A4 O; }
  100. 7 ?& K9 P8 L. \& O5 N6 c  ]
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    1 p0 i# O; Q+ m- k' k

  102. . d. t2 `! l: G
  103. ( ^, f& P0 [; k+ W0 e9 ]: s
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
    . J( p  J$ z9 }9 [3 J- Q  ]
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    - s( @+ a( D$ W0 n
  106. $ i) k! }5 J' Q5 a  c% ?: T# I
  107.       if $no_arrowpic_warn" ?. H0 B' H/ _* o- b! j$ F' T
  108.         MouseShow_Cursor.call(1): A7 i: j/ L! D7 v, ~
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png5 B# g" ]4 G9 q. z( I
  110. 3 K& ~# [: d+ U
  111. “路径指示点”将使用游戏自带图片' _" X6 T! ]3 R; r, m( O/ o7 D

  112. - w7 l/ I/ m( P! b- f+ D1 C* H
  113. 该提示可以在脚本内关闭')
    1 m4 i/ r0 a* I9 }' ^+ g
  114.         MouseShow_Cursor.call(0)  i2 n2 [. ]8 s5 p3 m2 t. ]
  115.         $no_arrowpic_warn = false
    / O: C- l" o! M* [6 Q: p
  116.       end. Z/ O* N% O6 @/ S2 {
  117.       @character_name  = '!Flame'
    ) q5 }# ?# p0 m+ \9 h( ?* T
  118.       @character_index = 6
    4 M& u1 {8 Z. b" T7 ~. T( q

  119. ( ^4 E% H7 j3 z. F# L1 X5 O& \9 x
  120.     end& f; l0 L& U- c, d( V5 I+ ?2 r
  121.     @direction_fix = false  # 固定朝向
    3 Z1 ~* f7 E5 }% \
  122.     @move_frequency = 6     # 移动频率
    0 Y6 X/ d* K8 T; x3 L
  123.     @walk_anime = true      # 步行动画9 _6 v& \4 e) g  X) a2 X) L
  124.     @pattern = 1            # 图案
    9 A8 K; s1 A1 F
  125.     @through = true         # 穿透
    $ f) x, s9 a2 L1 H0 b
  126.     @bush_depth = 0         # 草木深度
    + e8 ~" }0 d9 i
  127.     @animation_id = 0       # 动画 ID1 F! f* N1 f+ r- S0 H
  128.     @balloon_id = 0         # 心情 ID
    ) ~: X' S% g* y
  129.     @transparent = true     # 透明5 U0 I! V- [8 g& C) {
  130.     @id = 0
    5 I# i. m/ u# v
  131.     @x = 05 Y9 i( J% i7 L
  132.     @y = 0
    " d% G" f. N; W6 Y# W6 w
  133.     @real_x = 05 I; H. v! v" |
  134.     @real_y = 01 b  c% J( }) o8 X
  135.     @tile_id = 0. L5 Q$ _1 Y2 U
  136.   end; S; ]+ x% d, G& E; I
  137.   #--------------------------------------------------------------------------% Q" p1 f9 A) }, _' N
  138.   # ● 定义实例变量4 ~' T9 Y3 N$ \
  139.   #--------------------------------------------------------------------------% [3 d- L9 w% d# J- M& a' a
  140.   attr_accessor direction
    ( f, `" N' r6 U& ]% Z! V; a+ B! ?
  141. end" o7 m$ R$ F1 k+ {5 k  C' j
  142.   _2 {6 }# ^7 H  n
  143. #==============================================================================  r0 `+ T  @9 ?8 J/ z
  144. # ■ Module Mouse
    0 l) N+ X( Q# c) ]0 N
  145. #==============================================================================" g. v- z: S5 f9 R- _" g$ Z
  146. module Mouse
    ( j  h" G, ~2 a2 E1 l$ D1 Z
  147.   #--------------------------------------------------------------------------+ _3 z! s; k6 f8 b8 G* w
  148.   # ● API) t& A. Z- Q7 l( x
  149.   #--------------------------------------------------------------------------" p, C1 M( E* z* Y0 F6 R/ O9 E8 |
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
    8 ~# x5 F: I$ p' H' V2 ^
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')/ }7 C$ [# f3 L# Z; w2 l
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')$ I5 n! b* V, A: \9 R
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')
    + t: F7 F3 N1 @
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')+ Z/ }% D" ^  R" h: S2 U# A6 ~9 T
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')( y! F& @, z  D% i0 L2 G) @
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')( E0 K; B! O6 s  O
  157.   Window_Hwnd       = Get_Active_Window.call
    & I) R. T! ^# ^% K
  158. ! s0 b+ u! C  ?2 U7 O
  159. class  self
    4 J! o( \  w( M) Y# X5 e8 `
  160.   #--------------------------------------------------------------------------0 E4 o3 |7 W. ~$ d7 a8 ~: K
  161.   # ● 初始化# _8 i/ [3 p8 K, g
  162.   #--------------------------------------------------------------------------# ^) c$ q" ^; P- h% }) x
  163.   def init
    ! a+ U' ?  W0 [) T5 ^
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor
    # u2 p# s9 ~9 O0 ~. ~. d
  165.     @left_state = 0
    5 }9 G& S  x# l. G' I" N+ K
  166.     @right_state = 0
    2 A7 @+ y: u! T* ^" J( T
  167.     @ck_count = 0 # 帧数计,单击以后从0开始) P4 e, S/ o: Y" p! I$ R3 m4 [
  168.     @dk_count = 0 # 用于双击的判定7 \# ^) r+ k7 b- X$ i$ l5 P, T
  169.     @clicked = false) u+ u2 I( H2 J; h' F; I
  170.     creat_mouse_sprite0 |7 ~  k) G2 U( J; L1 {8 S2 ?# }
  171.     update' @7 H$ o! z2 c
  172.   end
    + z/ X3 S9 n) ~$ k: x! F; e
  173.   #--------------------------------------------------------------------------
    ! ]* \; k' a3 F7 ~; Y  ^# c" K& J5 ^
  174.   # ● 鼠标指针精灵! j2 m( j% U3 {1 e% @$ |
  175.   #--------------------------------------------------------------------------
    ; r- U, b* F9 O8 R, }
  176. #~   def creat_mouse_sprite+ l' G$ V0 H9 @' @
  177. #~     8 ~: ^2 F' W: z4 [4 t: r; a
  178. #~       @mouse_sprite = Sprite.new
    ! Q) }- |! V9 S9 \: v2 z
  179. #~       panda = 2#rand(2)+1  j! O9 ^6 T) ~5 z) {5 ~

  180. : D! i; ]( x( ?# O' N5 i9 V
  181. #~      if panda = 17 Q) ]) J* ]0 h, Y$ M; D' ]
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    % D' J0 y9 y  x6 Y; X) D: L
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')- v; G) i' G, q- g' `
  184. #~        end#with if File.exist
    4 u& q1 O; S% T% j$ G$ t' B$ W
  185. #~    ' x$ O  U' X* V5 B+ ]0 Z
  186. #~     else if panda = 2 #with if panda=1; y6 V9 o/ |& r  y2 K- ?8 g( O% W
  187. #~      
    * d) c2 y* Z+ F6 y' k
  188. #~      if File.exist('GraphicsSystemCursor2.png')1 a% Z( w/ d2 Q3 S" V/ {7 ?1 a9 G
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    ; y) z& [- ^( [
  190. #~      end#with if File.exist
    , z( r$ S/ Z* N! N, `
  191. #~       ' H/ [9 z- Z! t' f- B
  192. #~     else #with if panda=1$ v& S  Y8 u  A$ Q
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)1 i( w# i& w! a" p) @$ D1 |- _9 q
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),0 p& u1 N& [# R6 P; Z7 o
  195. #~       Rect.new(5  24, 24  24, 24, 24))
    & Z: N# ~) ~6 Z$ K) @
  196. #~     end#with if panda=1
    5 w! i. u/ H7 x: b, g  V% M
  197. #~     
    ) h6 t* P+ X4 ?# C
  198. #~     #with def: A- U  J5 u* D, O) b/ @: B4 m
  199. #~   end# T: |- Q/ I4 P3 b
  200. def creat_mouse_sprite
    % {7 N# B: ~! |- C. Y: \2 p9 e
  201.     @mouse_sprite = Sprite.new
    ( M' ?- [: L! D8 ^" U5 }
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})& }5 R) ~) J6 w; e- g& H
  203.     @mouse_sprite.z = 9999
    ' w7 V3 q# Z" u$ p+ r6 U! l
  204.     Show_Cursor.call(0)
    * d* t0 B0 S5 }- U6 A. q
  205. end% v, O# A* H" A& x: Z

  206. " B& E. X( |2 Z5 P4 W" T" @3 z# m
  207.   #--------------------------------------------------------------------------) J# z0 H1 c: Q/ K( j% O
  208.   # ● 更新; e9 q, W: o9 B! \) ?; h
  209.   #--------------------------------------------------------------------------: ~. B, m, ?- |6 i% N
  210.   def update
    7 z* d$ w% v  F# Y1 Z/ w! S& r4 B
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos
    " g; L- `( B$ A1 p2 k' @. d) I
  212.     left_state  = Get_Key_State.call(0x01)  z5 \1 K) E$ Z* M
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0
    % @% {* J6 I& N# o' p& W3 A
  214.     right_state = Get_Key_State.call(0x02)
    : ^- I. ^5 F3 r1 ]$ R* X
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0: h% g; t. v& V; M! R5 W: Q% \
  216.     update_double_click7 O& Q( t& w- f5 G
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1- \5 n. r  _& k
  218.   end
    ( r4 n( y' V' }. J% @* H6 w- P: \
  219.   #--------------------------------------------------------------------------
    ; [2 }) l) R6 O
  220.   # ● 获取鼠标坐标6 K& D' Y8 h( b; \
  221.   #--------------------------------------------------------------------------- F% J, G/ R. Z0 Q: I! d% K
  222.   def get_mouse_pos
    3 x9 ?$ J3 Z9 ~# n/ W% Q# X2 `( |
  223.     arg = [0, 0].pack('ll')5 c% f+ ]+ x4 B2 W. X- X( r$ T
  224.     Get_Cursor_Pos.call(arg)
    5 r0 }* ]) r- j' x; K
  225.     Screen_To_Client.call(Window_Hwnd, arg)( V! I3 d! ]  |; x
  226.     x, y = arg.unpack('ll')
    7 t$ d6 c+ ]0 L5 [+ Y6 D2 ^; j
  227.     return x, y
    / _9 H  o, U" c
  228.   end
    8 g, X/ }" y3 ?6 O# J- ]3 U5 e9 ]
  229.   #--------------------------------------------------------------------------
    $ U! k9 I/ U3 {! V: k% k
  230.   # ● 将鼠标固定在屏幕内
    7 L$ P/ w% \6 D2 N3 G3 y% S+ ]
  231.   #--------------------------------------------------------------------------
    + I8 D: c) D& P; k* V
  232.   def lock_mouse_in_screen
    2 }* B$ ^* c0 D; K- J
  233.     arg = [0, 0].pack('ll')
    . ^; Q. A( w# G
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    + E' b9 t; J2 \% w' i3 {
  235.     x, y  = arg.unpack('ll')+ Q; B5 s8 J+ a% r) y- G
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))+ S/ p* O  [( B( D1 O: h- K
  237.   end
    * K* V5 n  N# l1 A5 u8 q1 _. m
  238.   #--------------------------------------------------------------------------
    ! Z% F2 q. F; ~; `. G* h: X
  239.   # ● 解除鼠标固定
    " w, W) D. U5 G4 O* A: Y
  240.   #--------------------------------------------------------------------------) s1 J$ b+ p4 n: h
  241.   def unlock_mouse_in_screen
      r. h* N; n( Y5 P( {4 |
  242.     Clip_Cursor.call(0)
    ! ?1 t/ [2 t) T  k% s- ?) w1 F" i
  243.   end. x0 H' z( N8 s! K
  244.   #--------------------------------------------------------------------------
    , s. k3 ~, Y7 g/ C9 \& c, T8 }
  245.   # ● 鼠标双击判定
    9 @; h6 d/ b" J, C6 \* z- \. c5 q( _
  246.   #--------------------------------------------------------------------------; [' o9 X3 P: y# P# n
  247.   def update_double_click; c  v2 j: s5 D! ]7 l& Q2 U$ a1 U
  248.     @clicked = true if @left_state == 1
    ) d+ U: P7 H% H" V/ F
  249.     if @dk_count  0 && @left_state == 1
    . h2 g4 N/ N, x
  250.       @dk_count = 0; @clicked = false
    + p# `- D' ^- ]( C
  251.       return @double_click = true
    & \! G+ Z7 u& e2 N8 z0 ]
  252.     elsif @clicked
    1 D0 O. y3 A* l/ a/ L
  253.       if @dk_count  KsOfSionDbclick_Frame
    4 R& O: B) h* U! @+ U) K% b
  254.         @dk_count += 1/ P" R1 t0 p. I" I0 q: h
  255.       else
    / l7 W& P4 C# s. F3 R" D" r4 W" }8 O
  256.         @dk_count = 0; @clicked = false6 V9 q6 }2 J9 ?& I& |
  257.       end/ |- Y( V4 r- s  `
  258.     end
    ; U% V1 y. C2 @
  259.     @double_click = false
    5 k1 c# A0 a) n; F
  260.   end
    ( C% h; w$ n" p4 {( P. G8 g7 i
  261.   #--------------------------------------------------------------------------
    7 n2 h, B& Y6 @
  262.   # ● 按键被按下就返回true) o! ~4 n/ R9 a4 B1 _& J
  263.   #--------------------------------------------------------------------------
    , c& Y' M# k! t9 Y
  264.   def press(button)) i# J  \) {$ K7 @/ z) S& U0 P  [
  265.     case button7 M; W2 X/ w) Q$ H6 N. ]% k8 a
  266.       when 0x01; return !@left_state.zero! m" n5 z2 ^" g5 X
  267.       when 0x02; return !@right_state.zero
    # _, ]1 \; z( Q$ d
  268.     end/ _1 M/ d# ?& J( f4 w" J# f1 L5 n5 _
  269.     return false
    6 `0 K+ V) Z: ]* w1 Q8 m
  270.   end+ u! ]5 o% ~! s  `( f* F9 p
  271.   #--------------------------------------------------------------------------
    ' [; T. C6 Q9 ^( J, G$ M
  272.   # ● 按键刚被按下则返回true
    * |) {# R' T% j0 `- z7 R
  273.   #--------------------------------------------------------------------------
    2 g) m+ o2 S# X8 Z6 Z
  274.   def trigger(button)
    5 `5 h( m% ?% I% Q
  275.     case button$ @& c5 B! \+ z* u7 V
  276.       when 0x01; return @left_state == 1
    - n" D5 z: c: K/ H- O$ R( r$ P) z5 d" A
  277.       when 0x02; return @right_state == 10 `5 [* i& c$ X
  278.     end
    ; o" g& y4 ?/ t! j
  279.     return false
    4 ~" G' b! _/ T' o$ |
  280.   end
    9 |1 q* |+ z" C
  281.   #--------------------------------------------------------------------------, O0 ?# m  P/ s2 i  r+ A4 S5 D
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true8 z9 L/ s6 @+ o) H1 V: j' Y
  283.   #--------------------------------------------------------------------------( u( s. h. t( V' k
  284.   def repeat(button)
    ( G* C: i* @/ }. _- p2 B# K) y# j! Z
  285.     case button
    . E/ Z$ I) K0 j5 z4 [; s( `- h
  286.       when 0x01; return @left_state == 1
    5 r' r: ^/ k- X0 c
  287.         (@left_state  22 && (@left_state % 6).zero)6 I8 q7 q" y. D
  288.       when 0x02; return @right_state == 1
    / J) K$ z% _* X9 V) e, l  ^
  289.         (@right_state  22 && (@right_state % 6).zero)
    3 a. o. `5 _7 p6 s
  290.     end. F3 v) y- e& ^# E7 G
  291.     return false
    + ?/ F3 h* d9 G' _" g9 f
  292.   end1 Y& b) ]# d  T
  293.   #--------------------------------------------------------------------------
    : K+ M$ ^( X" ?) l) ?
  294.   # ● 判断是否双击鼠标
    $ |, R( T' B! y! f- k
  295.   #--------------------------------------------------------------------------
      |  a6 X  U' B3 ]6 L
  296.   def double_click7 k& z! a% h; e0 ~& k3 F3 r* o
  297.     @double_click
    " h# l1 {" Y) x0 W
  298.   end
    0 w+ p/ R4 r9 E- c2 v, r
  299.   #--------------------------------------------------------------------------
    6 d! |, U2 q2 I3 f
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0), ^8 v( Y! D" t
  301.   #--------------------------------------------------------------------------
    & L3 Z0 t* \6 ~, T: I# p  o8 |
  302.   def click_count/ n2 `. i7 X, n+ F  C& y8 q6 a& ^- U+ H
  303.     @ck_count
    + ]& r! e) g, F( O2 f
  304.   end
    / r4 z3 \9 R, t+ q
  305.   #--------------------------------------------------------------------------2 F9 s' O# E/ I# V
  306.   # ● 获取@left_state(按住左键每一帧+=1)) M: Z! j, b  G1 @8 ^$ c
  307.   #--------------------------------------------------------------------------5 s* u; v5 @& J8 F3 T! Y
  308.   def left_state4 X9 C$ |0 C* U: I$ R4 P
  309.     @left_state" X, l! ~% @( w# N' X. R% O
  310.   end$ A4 z1 P5 m( B1 v9 o) r7 B* c
  311.   #--------------------------------------------------------------------------
    ! p, Z6 X: b/ i& c5 g
  312.   # ● 获取鼠标的x坐标
    4 w7 m" ^: {  H3 ]: J; s
  313.   #--------------------------------------------------------------------------
    6 D& D: w+ Q: p* Y! O
  314.   def mouse_x5 ~( T( X6 @! H5 \
  315.     @mouse_sprite.x
    ! q; N; D" J  Y$ Z
  316.   end
    . C+ u& M( g+ T5 z, O* J" d8 }
  317.   #--------------------------------------------------------------------------
    ' o9 \) Q5 N- _! Q6 C
  318.   # ● 获取鼠标的y坐标
    2 V% ?' O% |; i" e* t9 m
  319.   #--------------------------------------------------------------------------
    8 q0 O$ r' L* Z/ v4 C
  320.   def mouse_y
    3 L9 x" S+ |1 p
  321.     @mouse_sprite.y
    3 V" M; B5 U3 `, O) O
  322.   end
      A; b! \9 W% H. K
  323.   #--------------------------------------------------------------------------1 c9 q2 p! n2 Z% M
  324.   # ● 设置鼠标坐标
    3 k0 C4 s9 y1 S0 {
  325.   #--------------------------------------------------------------------------% W3 |# ^' @! n( d3 X9 n" f
  326.   def set_mouse_pos(new_x, new_y)8 K( D6 c! C: }; e- g6 K- C
  327.     arg = [0, 0].pack('ll')5 M+ i3 w1 L3 S: J
  328.     Screen_To_Client.call(Window_Hwnd, arg)
    2 ~" D5 a) {2 z9 R( n" \7 D
  329.     x, y  = arg.unpack('ll')
    & Y1 l3 S# V# x: x' O7 Q' i
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    4 F" r0 e6 U/ ~
  331.   end
    ' ?& @$ U9 Z) F
  332. end #end of class  self # e. U1 f& ]( K- }& S* X2 V& Z: N
  333. 2 V9 N) j6 u/ v9 g, |1 J7 [& X
  334. end
    4 L0 L% L1 U& _4 o8 s6 \
  335. 7 J2 e) w' j2 X
  336. #==============================================================================
    & w; B9 Y: K- g+ M) j+ o  T
  337. # ■ SceneManager
      u/ d, {* `% ?$ w" g
  338. #==============================================================================
    # [' u1 W. D7 Z6 D: b- m7 ?% X
  339. class  SceneManager9 h% q9 K8 E& I; N) v
  340.   #--------------------------------------------------------------------------
    ! H. R/ X$ _  n/ V+ f  ^" l* w$ I
  341.   # ● alias0 Z. a! N" I  W+ {$ U( ^; b! r
  342.   #--------------------------------------------------------------------------
    ) \# f- G* O' ~% |! @
  343.   unless self.method_defined(sion_mouse_run)  [" e/ F3 D/ N: k/ {1 l: A+ S5 j
  344.     alias_method sion_mouse_run, run% h% B0 M( b% W
  345.     alias_method sion_mouse_call, call4 _7 e, z3 `; T7 k1 u
  346.     alias_method sion_mouse_return, return7 ~' D; G* S. K; b
  347.   end7 s" d- y4 @4 n9 Q$ M3 h6 o. `$ n  z
  348.   #--------------------------------------------------------------------------
    + e0 m6 T; m7 [( _, |
  349.   # ● 运行
    % f8 s5 X4 x* F; g& o! z
  350.   #--------------------------------------------------------------------------
    % j8 L+ U0 @$ T4 ?) S7 U) }& i
  351.   def run8 i1 P3 @: O% X$ L8 |, ?  j3 ~
  352.     Mouse.init
      Z& i4 c: l% Y* \4 `2 K
  353.     sion_mouse_run1 e' X6 ^- H6 R, o
  354.   end
    6 ?8 v2 j; u9 B3 `' S2 g" a$ a
  355.   #--------------------------------------------------------------------------
    3 y) o5 z' p' L! R+ D
  356.   # ● 切换
    8 z8 S& }9 l/ O3 n
  357.   #--------------------------------------------------------------------------
    3 U/ R) S1 h$ {  n3 R7 g
  358.   def call(scene_class)
    - W; w. c# M3 ~) f2 X
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)# a& d5 X  t' W# Z! V
  360.     sion_mouse_call(scene_class)2 n5 n* n, P* R  v$ P. E$ u' W) s
  361.   end+ k/ v! }- Z  x: m, ~
  362.   #--------------------------------------------------------------------------7 e/ a" Z8 Y6 W- |
  363.   # ● 返回到上一个场景
    2 S' W" t6 S1 t5 Z4 `/ ?$ L
  364.   #--------------------------------------------------------------------------
    4 C2 T" c& b6 U- [, _
  365.   def return& b) v0 z/ s4 H6 q! \+ q/ n1 T/ w
  366.     sion_mouse_return# z$ ~1 h7 m/ ?/ ]3 [* W
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&
    4 @. `0 W5 C; z- f
  368.       @scene.instance_of(Scene_Map)
    1 m  s, B6 o+ Y- D! k+ d! U
  369.   end7 V0 a+ H; c' [! s3 k% w
  370. end
    2 y  [6 g7 i$ g& B2 l) }' n
  371. ! M4 L8 i1 m5 l2 S0 u0 V1 R) o
  372. #==============================================================================! j1 a8 B7 y( v
  373. # ■ Module Input
    * i# p( O& X9 X- ~
  374. #==============================================================================
    1 ~3 N: y1 d! e) A$ |
  375. class  Input( a( {# E6 |- U) H# U) J' j9 a
  376.   #--------------------------------------------------------------------------+ Q" k1 X+ d9 R, @) _* o, L2 }
  377.   # ● alias2 |3 V5 G1 g( Q9 g) Q
  378.   #--------------------------------------------------------------------------
    0 Z4 d4 Z% U! v) ^( v: C
  379.   unless self.method_defined(sion_mouse_update)- ~0 X6 T/ t9 a* d  m
  380.     alias_method sion_mouse_update,   update
    6 `/ b4 E3 c9 [" Q6 t  W. Z0 H& @
  381.     alias_method sion_mouse_press,   press; p! C0 R" k7 R/ R, Q9 I! P
  382.     alias_method sion_mouse_trigger, trigger
      s9 O/ J% {# g+ r& w, O! D5 I
  383.     alias_method sion_mouse_repeat,  repeat
    9 h/ w7 W; E& C6 Z' B
  384.   end
    ) T8 o5 G# K' V% u" D3 E( [# T9 R
  385.   #--------------------------------------------------------------------------
    $ [: }2 a& [; W( x% x
  386.   # ● 更新鼠标/ n& t0 ~7 B  O$ g
  387.   #--------------------------------------------------------------------------$ `) [& G7 }3 F& d+ X) G& ]2 u
  388.   def update
    ) D4 ^, U' P" _/ \
  389.     Mouse.update1 ^  ]2 I) l. T2 o! ]
  390.     sion_mouse_update
    0 C3 \' q  e- x0 K" s2 w5 q* _3 i5 l$ ?
  391.   end
    ( @  y$ U- I- U( D
  392.   #--------------------------------------------------------------------------
    6 z* B/ j2 W. Y. h) J0 Q
  393.   # ● 按键被按下就返回true
    5 l" k) L$ b/ Q, Z
  394.   #--------------------------------------------------------------------------
    $ ~& V' h: I8 L0 F2 \
  395.   def press(key)
    * M9 O- G1 A) _) P
  396.     return true if sion_mouse_press(key)7 k; o& N8 V2 a# n
  397.     return Mouse.press(0x01) if key == C
    0 W7 z7 i3 F/ D" ~6 ]" W2 o" r" f  Q
  398.     return Mouse.press(0x02) if key == B
    2 p8 J( N) S+ H. f. s( B/ B( B
  399.     return false
    ) s0 G: m' I; g8 ^
  400.   end% K- v. ~8 _- Q% w4 y
  401.   #--------------------------------------------------------------------------3 h7 n% n/ j' b6 N' h- Z
  402.   # ● 按键刚被按下则返回true
    9 M: ?/ W( Q0 Y8 W8 i
  403.   #--------------------------------------------------------------------------1 Q2 N9 a. h, ^8 Q5 L6 I
  404.   def trigger(key)* \# C. J' `$ h9 ~- I$ }
  405.     return true if sion_mouse_trigger(key)
    ; D. c$ j" H4 ]/ O
  406.     return Mouse.trigger(0x01) if key == C
    + h1 M/ O( x9 v. I
  407.     return Mouse.trigger(0x02) if key == B6 [% N/ F" H- f2 W& t
  408.     return false6 w  ]+ F+ n  `" n' u
  409.   end
    + z  h6 l8 t1 H+ C$ Q
  410.   #--------------------------------------------------------------------------
    ) b. A0 c  w; u% f; G: j
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true0 G6 Y/ D; V  f/ R% h7 V# x& a
  412.   #--------------------------------------------------------------------------
    ! L  E& `% k: C7 R( B
  413.   def repeat(key)
    - L  T$ Z: h- f5 Y/ s
  414.     return true if sion_mouse_repeat(key)
    * K9 _& o3 g. N# {# r8 s
  415.     return Mouse.repeat(0x01) if key == C* U- c# T' x% P! `6 x' j
  416.     return Mouse.repeat(0x02) if key == B
      M; e7 P% Z5 H7 C$ T8 T
  417.     return false% t' N0 b+ B: u/ G( q2 E, k8 l
  418.   end
    ; R% x2 P' F0 y6 t% B  |4 b
  419. end; [& a& e7 ~0 N( k* r& l
  420. , p- z. o9 e: h% e

  421. # Q) W$ |7 x! |( e% R/ |. A- N' A
  422. #==============================================================================3 k& G# A9 k8 C4 [, n1 z
  423. # ■ Window_Selectable
    8 P! G# r% T2 B( c- L
  424. #------------------------------------------------------------------------------8 `2 I( A0 w5 R  s& y# b# b5 W
  425. #  拥有光标移动、滚动功能的窗口
    9 ?. U6 X0 R: E1 h9 f: j) H
  426. #==============================================================================7 Z  ]* u# B0 s& e$ [* _* }8 R
  427. class Window_Selectable( w# S7 g$ R$ h0 d* r6 M3 v
  428.   #--------------------------------------------------------------------------0 `. p: `2 ?9 }; p1 n1 \
  429.   # ● 初始化2 A; l1 h6 o# C/ z5 j
  430.   #--------------------------------------------------------------------------
    $ q5 E. Z& N8 ~
  431.   alias sion_mouse_initialize initialize
    % n+ M7 a% t3 [4 t5 I7 ^8 c
  432.   def initialize(x, y, width, height)
    4 V1 u" p+ f7 B; X
  433.     sion_mouse_initialize(x, y, width, height)
    8 ?2 U$ v9 U2 i' C( |
  434.     @move_state = 0& V$ ^: b; O+ P$ y  _* `9 g, C" D
  435.   end
    : r( L" g; M# u& L  U- \2 ^
  436.   #--------------------------------------------------------------------------
    - {3 W( Q6 g* R( p6 Z" b! X1 I
  437.   # ● 更新
    $ |, B4 W+ a- U  z8 A
  438.   #--------------------------------------------------------------------------
    ; x) B# m* z$ _8 V
  439.   alias sion_mouse_update update) K* N6 K8 I; H6 C
  440.   def update
    - r0 O( c9 A7 V6 Y
  441.     sion_mouse_update
    ; h) U( k6 N! ~4 v0 B6 N5 q' b! ~# y
  442.     update_mouse_cursor
    0 `- J' ~. N( m: Z0 }. C( n
  443.   end
    ) m& h  L- U/ V' c2 F9 U
  444.   #--------------------------------------------------------------------------
    2 B4 D8 I  ]+ S. c3 v  f0 E
  445.   # ● 启动后设置鼠标到index位置
    7 @; ]# o. ]) y3 U0 j3 Z7 D
  446.   #--------------------------------------------------------------------------! n" D. M1 a0 i7 m& Z
  447.   def activate
    " S7 W5 ]5 C) |. g# b/ @, u- O9 C
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    9 h& a% B7 @' V/ w8 S
  449.     super' t7 ~. v  X0 e
  450.   end* k( s) r- u! R
  451.   #--------------------------------------------------------------------------% g0 x) k& _7 T9 y: E+ _$ Y- c& \9 W
  452.   # ● 更新鼠标和光标的位置% D* q  Z9 F* L
  453.   #--------------------------------------------------------------------------, K, t/ F# z9 n
  454.   def update_mouse_cursor: M' I- x; [$ c+ f
  455.     if active
    ; c$ q' [  @5 H7 m9 o! _
  456.       if @need_set_pos7 {& C! ~6 l( M
  457.         @need_set_pos = nil8 ^3 _% u0 z% q' q" A
  458.         set_mouse_pos
    5 B! e* L& p% T# n
  459.       elsif cursor_movable$ X0 B3 O4 U, P- V( k( R
  460.         Input.dir4.zero  set_cursor  set_mouse_pos7 i( ?! t% U! t+ u% f
  461.       end8 Z* q. U' u8 {% D; Z
  462.     end
    % V3 i  P7 y  }- A+ c9 T' G2 a
  463.   end2 @2 t" p, F& d; \
  464.   #--------------------------------------------------------------------------
    ( @+ L; b; O% d7 T! i$ f0 g! T
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能' a& y* G; R' U4 |. ]
  466.   #--------------------------------------------------------------------------
    5 @" r) ~2 @5 G, L1 Z( @9 O
  467.   def set_cursor6 w+ z0 ]3 E2 U4 b% i& j
  468.     mouse_row, mouse_col = mouse_window_area/ ~0 K. Z( A# d+ S
  469.     if    mouse_row == -1
    9 s1 Y( [5 }4 d) m. t: b. f  N
  470.       @move_state += 1 if need_scroll5 c7 Z$ [1 Q& ]
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand; u9 Y% e; O  O8 z( w/ s9 `" S# N
  472.     elsif mouse_row == -2
    , Z- o, ?0 }& Z! K0 L
  473.       @move_state += 1 if need_scroll
    5 w; h$ O& l/ t$ @6 C8 Z
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand% j! G4 g- k" i
  475.     elsif mouse_col == -1
    6 `% d' H$ i! W
  476.       @move_state += 1 if need_scroll
    / v% Q$ _* }6 w3 b5 T
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand4 N7 C& x& Z+ ^' Z2 j: ?
  478.     elsif mouse_col == -2
    / m7 v, K5 W/ A7 z
  479.       @move_state += 1 if need_scroll( I8 ~+ R0 j5 U* R$ t+ [
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand& G- w: z# d+ ^( e' b) Q& G
  481.     else2 ~  q" b1 w; a) `
  482.       @move_state = 0
    8 J4 J# R9 Y4 e  K/ G* o# ^
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col5 k, I+ A/ Z0 [/ X/ _
  484.       select(new_index) if new_index  item_max && new_index != @index- M; y0 q% H* i& Z2 @$ \5 V1 B
  485.     end2 \2 q1 E5 y( c
  486.   end
    ! a! M6 T' P9 f  t7 H  ^$ {4 ]4 I4 h
  487.   #--------------------------------------------------------------------------" i2 R0 q# p: Q' |' k* w6 m
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    $ u$ A1 d' z2 y+ W
  489.   #--------------------------------------------------------------------------
    1 [4 m9 [2 B. X
  490.   def mouse_window_area
    3 ]+ M- o+ m  v. [/ c% U
  491.     if viewport.nil # necessary!
    + h# q  I7 s" @; T: k4 g& T
  492.       vp_x, vp_y = 0, 0
    , v) F: R0 `: F) e1 P
  493.     else' V4 L& n6 O* h. {& o  m( L
  494.       vp_x = viewport.rect.x - viewport.ox
    % _+ U5 M  k: j
  495.       vp_y = viewport.rect.y - viewport.oy3 \. o0 G6 x7 ?( E  t+ x4 |/ ~+ L, N: J
  496.     end
    - H$ v  U6 a) X* V  v& {$ r
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y- F# c1 @  c1 j
  498.     item_x1 = vp_x + x + standard_padding
    9 i( g% w# K( F
  499.     item_y1 = vp_y + y + standard_padding7 C- K1 ^( s" C& a
  500.     item_x2 = vp_x + x - standard_padding + width
    0 F; R( ]) }2 |/ k
  501.     item_y2 = vp_y + y - standard_padding + height
    ; g9 Y( @! I% c0 N1 n' `. b
  502.     if mouse_x  item_x1/ [' a4 V" g" X9 _- C  C7 P
  503.       mouse_col = -1* S4 F$ B5 c( ]3 L4 o$ M/ ~
  504.     elsif mouse_x  item_x2+ K2 p5 m2 f5 F/ j1 ^! q
  505.       mouse_col = -2
    " L* T' a; R. Z/ `8 O* K' L+ y
  506.     else
    # o" ?9 l1 Y% m) t1 ?
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)
      Q4 J: S) {- T. p
  508.     end
    8 k& b* N# z* ^
  509.     if mouse_y  item_y12 u7 i% W2 L, G1 b( l3 j) g
  510.       mouse_row = -10 E  j1 k! _$ j: z1 @, G" Z
  511.     elsif mouse_y  item_y2+ Z4 W9 g& {9 D1 l+ \6 k1 N! [
  512.       mouse_row = -2
    $ h1 i: n( J- o' h
  513.     else: q) x4 O& {8 P# w2 D8 K3 Q
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)$ V9 u- H7 R/ j1 _
  515.     end
    / K# P% T. K, r" y% e) S
  516.     return mouse_row, mouse_col$ k3 u4 V# D! X4 I9 q# i
  517.   end0 r) N# G+ l$ I
  518.   #--------------------------------------------------------------------------
    - i3 @( W7 E7 U3 P7 P
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置- L% Z& C3 r$ P+ k
  520.   #--------------------------------------------------------------------------
    , f% w6 {/ u; [! J
  521.   def set_mouse_pos
    4 i0 ^) u. t9 y+ }8 l
  522.     if viewport.nil # necessary!% o# q1 S1 Z8 ]# H
  523.       vp_x, vp_y = 0, 05 n# E: ]) A) K( p
  524.     else. C' R( L6 Z, g6 u3 [; w
  525.       vp_x = viewport.rect.x - viewport.ox! s: f) ~* s( [- H+ h
  526.       vp_y = viewport.rect.y - viewport.oy
    , Y3 ~7 U4 v1 |& y/ Q/ L6 j) t
  527.     end
    * W- ]' [7 i3 b; [
  528.     item_x1 = vp_x + x + standard_padding
    / B9 [# }1 g+ V! F) _/ O
  529.     item_y1 = vp_y + y + standard_padding
    : ~  O2 z& Y. {
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
    ; L8 W# u7 ?) ?* ?+ m: e
  531.     row = get_index  col_max - top_row
    2 N1 {" y/ x/ P; n
  532.     col = get_index % col_max" B# S3 ?/ q! j! s6 V/ E
  533.     new_x = item_x1 + item_width  (col + 0.5)2 k2 P! h. l% b$ X; u
  534.     new_y = item_y1 + item_height  (row + 0.5)* `3 }# s5 ]2 ], Q  c
  535.     Mouse.set_mouse_pos(new_x, new_y)1 h& h  }, J3 I2 o
  536.   end6 d5 P3 B: U7 D- O0 W
  537.   #--------------------------------------------------------------------------. f! H# e) L" _; @1 j$ J# f) y/ o
  538.   # ● 判断菜单是否需要卷动
    7 O! n  f, z( X5 Y" o
  539.   #--------------------------------------------------------------------------
    8 Y, ^) ~- }4 q2 L7 P
  540.   def need_scroll
    1 ~3 o" p  x0 q- K! G
  541.     item_max  col_max  page_row_max% _% r7 X  Y. l7 [& A# V- E. L) k
  542.   end
    - T) e% n, W; c3 D( z8 r( ~
  543.   #--------------------------------------------------------------------------) T+ ^1 @6 w' a+ X
  544.   # ● 判断是否为水平卷动菜单% w  k# _: X, s8 q
  545.   #--------------------------------------------------------------------------$ f. N4 G  F' Z7 L$ S
  546.   def is_horzcommand
    ' G9 I. c1 y2 D9 [- \
  547.     return false+ i9 g, i" j9 C/ T
  548.   end) K* Z7 v3 T0 K6 k
  549. end+ B4 [. O( e1 `* \  ~( z- e# l9 i; X. v
  550. 9 W7 d6 Z9 T& g6 O, k- k- \+ |
  551. class Window_HorzCommand
    # q. n. L' \6 T) h1 N1 C; H3 j
  552.   #--------------------------------------------------------------------------+ a3 d9 @- M4 I- Y( Z
  553.   # ● 判断是否为水平卷动菜单- n/ B7 j: x2 S' H
  554.   #--------------------------------------------------------------------------+ Z3 H* _% C; Q+ X* E
  555.   def is_horzcommand
    8 N- {2 _; b) a# Y+ z0 J* q
  556.     return true
    8 ~+ P/ b3 j  k; z/ T
  557.   end
    - s" d( P1 L  P6 q* V7 H
  558. end
    1 p; n# {: {; i+ |( |, D
  559. * B0 \2 ^$ ^7 ^, C! ]$ D
  560. #==============================================================================4 J) y: a% c0 p" F0 E! A! q9 o
  561. # ■ Window_NameInput
    3 O6 U$ o& ]  x: d; G
  562. #------------------------------------------------------------------------------
    ( N/ D0 j6 z* b/ p# }% l
  563. #  名字输入画面中,选择文字的窗口。
    ' N6 ~( D: z# ?
  564. #==============================================================================
    ( H: k$ o( C: N$ ?- r
  565. class Window_NameInput$ s) U6 j. N: O% o; m% D
  566.   #--------------------------------------------------------------------------
    ! ]8 A, Z$ s# z: U
  567.   # ● 设置列数( c; o' y3 C; u5 W$ R& I% W
  568.   #--------------------------------------------------------------------------; c1 F) ?# P0 U5 s
  569.   def col_max
    1 N  Z+ g+ A6 j( @
  570.     return 10
    " Y6 i' N' ?$ P* {" o* ^. F7 {
  571.   end* B$ _' v6 u) l! C8 x3 }" k+ `
  572.   #--------------------------------------------------------------------------
    ! T% b; ?. J+ E" f# x$ F; d% S
  573.   # ● 设置填充的Item个数5 ^. C( [" r0 w$ |$ q* c
  574.   #--------------------------------------------------------------------------3 j8 \' T! `0 S, [; r8 n
  575.   def item_max
    , e, h: K& Z& I" G7 ]8 t
  576.     return 90
    0 o& W* \% }6 |# V" W" O
  577.   end5 `) O& P4 {, w) }* Q5 I
  578.   #--------------------------------------------------------------------------& V  z  s  x* q. b
  579.   # ● 设置填充的Item个数
    . A" _) k. M: ~* h3 N5 t
  580.   #--------------------------------------------------------------------------. z# s3 E( F/ O
  581.   def item_width
    4 r" M9 \2 [; q) c- Y: K
  582.     return 32, |' L. [8 z* C2 R
  583.   end
    + a! I2 b2 A% c/ U7 ^
  584.   #--------------------------------------------------------------------------9 g) f3 R. q& Q  ]# N
  585.   # ● 判断鼠标位于菜单的第几行、第几列
    2 j* r! U" b: [- h
  586.   #--------------------------------------------------------------------------
    4 i1 a7 \1 J3 Y$ g$ q4 P/ {
  587.   def mouse_window_area. x! ^1 B- G8 F/ D
  588.     if viewport.nil
    ( [# e) d( z- [/ |* u
  589.       vp_x, vp_y = 0, 0
    9 y0 ~/ {/ q2 ]1 b
  590.     else
    4 |9 W$ C8 L9 ~" x
  591.       vp_x = viewport.rect.x - viewport.ox
    2 |& e1 n  c: ], e9 ~7 X
  592.       vp_y = viewport.rect.y - viewport.oy
    + z$ X" s  K; B! F+ I
  593.     end) b( n) z- r" o, z$ A/ k$ B
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y6 E. x- ]$ _) H" S1 S8 P
  595.     item_x1 = vp_x + x + standard_padding
    5 w' r, v9 |6 e! T
  596.     item_y1 = vp_y + y + standard_padding
    5 R, _3 P( \  m7 A/ u7 B8 D" E
  597.     item_x2 = vp_x + x - standard_padding + width
    ; P! W, n! B3 ~
  598.     item_y2 = vp_y + y - standard_padding + height
    / W2 \, ?4 @1 S$ U
  599.     if mouse_x  item_x1
    ! _( ?8 q6 H, P4 x5 S
  600.       mouse_col = -1
    2 L# Q( Z8 ?# ~+ T1 t
  601.     elsif mouse_x  item_x2
    ; K4 B. O" k+ ^5 O2 m- i" U9 d
  602.       mouse_col = -29 G7 T$ Q. O% u/ q7 @) @
  603.     elsif mouse_x  item_x1 + 160
    5 [: I1 C7 w  v0 L5 y
  604.       mouse_col = (mouse_x - item_x1)32: \3 o/ M+ z0 K
  605.     elsif mouse_x  item_x2 - 160
    % J4 j/ p9 q( o( L, i
  606.       mouse_col = 9 - (item_x2 - mouse_x)32
    . G/ T' d4 Y% T; h: k% J" C
  607.     else* T; A. G1 w, ~) T, ?% {/ A
  608.       mouse_col = mouse_x  x + width2  5  4) P& o# s2 F7 r% k+ E) j6 ?
  609.     end
    / E$ _1 c: S5 }! C! G
  610.     if mouse_y  item_y1* l. Y. i# }" N# G
  611.       mouse_row = -1: _& l' o/ a2 g* }/ g) ~2 B% ?! ~
  612.     elsif mouse_y  item_y2" Z! o2 u( n( k3 |
  613.       mouse_row = -2
    $ j3 s" ~4 v+ G8 N4 z3 m) O% O
  614.     else
    - l4 P( }/ Q  x' x) K$ w
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)% \# J5 \; Q& ^
  616.     end- A( X6 I" i! L! [: F
  617.     return mouse_row, mouse_col4 B% k3 `  t' S  W8 T* t/ R
  618.   end8 o7 ?2 X5 D# l% T/ y% t
  619.   #--------------------------------------------------------------------------
    & [/ N) l  E- I. D
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    ' U- ^- t) W4 c2 N
  621.   #--------------------------------------------------------------------------( f1 }; O0 V: ]  J5 p8 y0 W
  622.   def set_mouse_pos
    8 S8 `) a1 m. `9 r- D6 B
  623.     if viewport.nil # necessary!
    ! u; o% K+ U  r! {4 n+ U. N4 M
  624.       vp_x, vp_y = 0, 0$ }7 T/ u$ Q6 M# C8 [: U
  625.     else
    " J+ r. S) `9 Y! g' [+ M
  626.       vp_x = viewport.rect.x - viewport.ox
    0 l+ D6 C8 A7 m: g( b+ {
  627.       vp_y = viewport.rect.y - viewport.oy
    6 S/ ^9 C$ _7 F% i5 d4 |# N5 `
  628.     end0 L& N5 W$ [/ B2 a. e
  629.     item_x1 = vp_x + x + standard_padding 4 |  C) B2 t, P" S5 C1 ?  g
  630.     item_y1 = vp_y + y + standard_padding8 ^$ |4 G4 k- x1 g; n% u# ?& ]
  631.     get_index = @index  0  0  @index
    $ P2 u6 p3 ?* ~) M
  632.     row = get_index  col_max - top_row
    ) s$ ]( k' O+ e* \, O. h8 \5 W
  633.     col = get_index % col_max) d/ u) q! J6 I! @) u
  634.     new_x = item_x1 + item_width  (col + 0.5)
    : j7 e- g2 x6 p, {+ \& @) j/ v; D
  635.     new_y = item_y1 + item_height  (row + 0.5)
    ( R3 Q+ \5 o* n6 M* |% J1 s
  636.     new_x += 14 if col  4
    * Z$ i$ a5 `8 G. `
  637.     Mouse.set_mouse_pos(new_x, new_y)
      Y3 Z' T1 v- V. v
  638.   end' `! c5 F% T7 U- J5 L  t
  639. end
    * l1 U! I% B! ]8 |+ Q/ I
  640. ' b$ M! T( {2 B9 L; x
  641. #==============================================================================8 j* l, q4 ?6 g* ]) x0 P
  642. # ■ Window_NumberInput
    7 f9 K. W: Q$ Z; s9 m1 C6 B/ D
  643. #------------------------------------------------------------------------------3 b! B( i0 o8 r6 F$ S
  644. #  重写了数值输入的方法以适应鼠标
    ! ^$ l8 w( K  Y* i) O
  645. #==============================================================================& V) Y3 Z: ~2 \' @7 W3 }
  646. class Window_NumberInput  Window_Base
    . I8 x. D: d% c3 G
  647.   #--------------------------------------------------------------------------# r4 p/ y7 G1 G% X; [7 |0 L5 Z
  648.   # ● 定义实例变量
    ; ^: L5 E% B$ h) `+ ]) b
  649.   #--------------------------------------------------------------------------9 n! S0 V! l; D6 Z: ]: e( X+ ^
  650.   attr_reader extra_window
    6 J* L( k; `7 h! n2 q/ T
  651.   #--------------------------------------------------------------------------) ^4 d, V; E; |6 C$ H
  652.   # ● 初始化
    2 W  `; D  e3 I/ n0 r' g, f( i
  653.   #--------------------------------------------------------------------------
    ( e6 Y2 o8 o: c5 \7 X
  654.   alias sion_mouse_initialize initialize0 r; S: X% J/ }, s7 q
  655.   def initialize(arg)+ D2 K+ w' R7 `- f
  656.     sion_mouse_initialize(arg)
    3 \, S( O5 @5 f! T. ?6 q
  657.     create_extra_window6 F6 E( M! X! l) M% U4 g/ R
  658.   end
    ( h+ r" K$ {" [" X
  659.   #--------------------------------------------------------------------------$ D- H% F: m8 x! l+ n
  660.   # ● 启动
    + w7 \% r% C' W6 X( z. ]+ z( j
  661.   #--------------------------------------------------------------------------+ M# l7 `8 s0 e9 ]
  662.   alias sion_mouse_start start
    * H7 e0 V* O; }% j
  663.   def start+ P( Y# |  `( k  D$ G  g* v0 J. m
  664.     sion_mouse_start
    $ F: S) G: ^* Y  |+ o: U
  665.     deactivate
    . O: K  I; m8 i3 V) R
  666.     extra_start. s; R" }3 b2 f9 R7 z- b4 G- o9 Q7 B
  667.   end$ v5 T5 W, A$ |* g% |, x. i* i" D" ~
  668.   #--------------------------------------------------------------------------) ^" `% p8 E# q2 p8 y* t) }* ?
  669.   # ● 创建新的数值输入窗口
    , Z: t7 i  N; N( A8 E( ?1 J) X
  670.   #--------------------------------------------------------------------------
    2 J' l9 j  U- g: T  D5 Y7 e. {
  671.   def create_extra_window% T. s/ }& F' N# f8 i, q2 A
  672.     @extra_window = Window_NumberInput_Ex.new
    % K0 y1 d( n3 s2 t* N( {
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2& ^0 j" f% R( H' I. ~- i1 @
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }6 t3 ?0 y$ H3 M! U9 B
  675.     @extra_window.index_proc   = Proc.new {n @index = n }2 K% u( }( h5 o# _; Z
  676.     @extra_window.close_proc   = Proc.new { close }( g6 g, s0 U2 u5 n+ W1 k3 Y& k
  677.     @extra_window.refresh_proc = Proc.new { refresh }% g) C! R3 f7 e
  678.   end
    $ r' K- n3 v, b; M7 ?8 d
  679.   #--------------------------------------------------------------------------* U0 @' }0 J: U- ~, A
  680.   # ● 激活新窗口
    5 A, ^! i% I/ I7 e" e/ d9 G
  681.   #--------------------------------------------------------------------------
    " ?; R  o; `4 R* |7 |3 S( Z' c
  682.   def extra_start
    * R- G3 Y, `7 I. ]
  683.     case $game_message.position/ Y% W3 Q( E; D8 u
  684.       when 0; @extra_window.y = y + height + 4
    . L( h6 d; ^4 z5 y
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8/ v$ l0 c( y- X- B
  686.       when 2; @extra_window.y = y - @extra_window.height - 4
    & J2 X+ C* b- Z
  687.       else  ; @extra_window.y = 8+ X) q  e* O! l- n; e
  688.     end2 _- N4 g8 w+ F0 J. Y6 t& K
  689.     @extra_window.variable_id = $game_message.num_input_variable_id
    * q( _: l0 U7 C1 ]! k- c, q3 H
  690.     @extra_window.digits_max  = @digits_max3 y6 ^$ L4 C* Z2 f& o
  691.     @extra_window.number      = @number
    ; f, _& v4 o' ?
  692.     @extra_window.open
    6 ~7 [% X1 @, |5 @. N
  693.     @extra_window.activate
    , m( L6 w& E" N1 i# E+ I
  694.   end
    9 z* A$ V' y$ T' u+ r* ?' |
  695.   #--------------------------------------------------------------------------
    . I* K; b  C7 S" |1 o& K" L
  696.   # ● 更新
    4 n# f; f1 F( z0 U
  697.   #--------------------------------------------------------------------------$ {+ J$ E1 p7 Z% o& ?
  698.   def update
    8 F# K* b+ z: v5 X! n
  699.     super
    + b& P$ I' m7 K8 Y
  700.     @extra_window.update: T8 D' `' E$ s( e- H' V  m
  701.     update_cursor, y) m' F) ~( @. U  `$ k7 s0 q
  702.   end
    , L/ D  I7 O& i, A- Z$ E& l
  703.   #--------------------------------------------------------------------------
    . G- F9 v. m* E9 b: e
  704.   # ● 关闭窗口: h$ _+ V; l2 J8 P' {% b
  705.   #--------------------------------------------------------------------------
    0 F) W* j6 V; W' h/ ^7 X, [
  706.   def close
    2 Z& H2 b6 G6 m: z, H3 u9 f. ~
  707.     super
    + p; t2 B2 l6 x2 L9 X
  708.     @extra_window.close
    " M) E4 V1 w: t% M1 q# E6 b, z; ]
  709.     @extra_window.deactivate) y7 ^, f4 H, D
  710.   end
    + m# L+ ]. ^  Z6 a' E
  711. end
    : N& s+ T# t, o5 x1 v9 U

  712. # X) b, n5 l% \5 y# z4 W% L* `
  713. #==============================================================================
    4 X) b+ O' ?" X; h# x8 U1 z
  714. # ■ Window_NumberInput_Ex
    ; s# a/ A  Z! V( @. `% }+ A
  715. #------------------------------------------------------------------------------$ N( `4 U# q/ ?% H/ j
  716. #  新的数值输入窗口(NewClass)
    * j& n3 S  _5 m( X  ^
  717. #==============================================================================
    / R# S+ E. ^0 K3 a5 Z
  718. class Window_NumberInput_Ex  Window_Selectable1 o. x( l* b2 P; f2 k% E
  719.   #--------------------------------------------------------------------------( x+ G. F4 x0 U% r
  720.   # ● 定义实例变量
    % h5 G! n2 {7 X# z: @8 Z5 t
  721.   #--------------------------------------------------------------------------. j/ f* x) S% R  g. {9 y- U/ r& w
  722.   attr_accessor number_proc9 n( t6 u6 z8 h' X4 T
  723.   attr_accessor index_proc3 Y- l! m2 y2 ^
  724.   attr_accessor close_proc  t, W: I& a& p7 ^+ v3 T
  725.   attr_accessor refresh_proc
      L8 R4 K' ]) F# j2 D
  726.   attr_accessor number
    3 z2 b- t) d; v" V
  727.   attr_accessor digits_max0 h' `+ i/ ^) k! R4 f* C6 K
  728.   attr_accessor variable_id$ T, o6 C5 y5 R; g- S7 T* N
  729.   #--------------------------------------------------------------------------1 Z+ Z* z: Y) C/ z. o0 u
  730.   # ● 数字表
    ; z# t* V9 L# f+ ~2 V1 V, l
  731.   #--------------------------------------------------------------------------5 j: A0 \/ \7 ~. L& w& ^* Q
  732.   TABLE = [  7,  8,  9,
    4 M: _8 _  g% n( u& P
  733.              4,  5,  6,  W! t8 j& ]- d
  734.              1,  2,  3,
    0 b: s9 d  s% V0 m3 l& E
  735.             '←',0,'确定',]
    0 O% v) t9 G- G& @+ X2 F, |) _8 n, n+ X
  736.   #--------------------------------------------------------------------------1 ?* I6 F: y! p0 s* l
  737.   # ● 初始化对象
    7 D4 ^6 c9 j4 Z1 [' M6 T8 N
  738.   #--------------------------------------------------------------------------, ^% T; u1 W  ]. a4 l
  739.   def initialize( W: Y* v6 _) W: U# s1 o0 t
  740.     super(0, 0, 120, fitting_height(4))
    5 ?8 ^' F& B1 P* Z
  741.     self.openness = 0+ Z4 R* c" A! F9 B
  742.     @index = 0
    0 |% A1 d2 }9 o+ A5 K; L; k8 c
  743.     @number = 05 {" o1 Q: c: K9 U, w
  744.     @old_window_index = 0
    * Z  E: W5 \2 R/ R4 \/ |
  745.     @digits_max = 0
    + p% `8 W/ v! C5 |
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }, w" p" S2 W! Q# m* B! D
  747.   end
    ! n" t. J- `( F
  748.   #--------------------------------------------------------------------------
    7 \  T$ Q- F( C: T  D
  749.   # ● 获取项目的绘制矩形2 o+ k# p. k3 L" J# Z1 \
  750.   #--------------------------------------------------------------------------
    1 h0 S4 \  ?5 i4 {8 A+ r
  751.   def item_rect(index)) z- d( \2 ^, s- G( U
  752.     rect = Rect.new) }" L; p9 i* G$ A" y9 I: A1 r
  753.     rect.x = index % 3  322 m1 l6 F. L# E! e5 a& t
  754.     rect.y = index  3  line_height' o4 T' r7 z) a6 G3 N
  755.     rect.width = 32, T3 c( Y; R6 ^% [
  756.     rect.height = line_height
    5 H! @- @* D4 g  f
  757.     return rect
    # b4 Q; Z7 p. r( r! [! A
  758.   end7 P* `8 t3 @, C5 W
  759.   #--------------------------------------------------------------------------
    0 a( q3 ^8 L  P4 o! K' m" y8 @
  760.   # ● 将光标设置到鼠标所在的位置6 _! [, c. C% P% s' Q
  761.   #--------------------------------------------------------------------------
    ! ^5 _; I" L$ k& w
  762.   def set_cursor
    7 ]* O: C3 M" c8 i- J
  763.     mouse_row, mouse_col = mouse_window_area/ f4 \8 S* m! Q; q
  764.     if mouse_row = 0 && mouse_col = 0
    / Z- |# B- u# o+ ]7 z8 V
  765.       new_index = mouse_row  3 + mouse_col
    ' O& p0 i4 S$ d, J
  766.       select(new_index) if new_index = 11
    # E  j8 p, Z) N' Q; D' v
  767.     end
      e# s: ]  I, I* q% P+ |
  768.   end. H- t6 C6 q% _& C3 {
  769.   #--------------------------------------------------------------------------
    8 g- k. i7 `7 T% |
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列
    ! G& y0 u* V% d2 v
  771.   #--------------------------------------------------------------------------
    2 ]+ D, H" q% B
  772.   def mouse_window_area" d# e( i( G, Y7 ]* d; Q$ P
  773.     if viewport.nil0 I7 [' c: a6 z5 V' B
  774.       vp_x, vp_y = 0, 0
    5 I& r4 c# u4 ?  f7 f, T
  775.     else
    8 j7 K( Q' O& x* e1 _0 ?5 t
  776.       vp_x = viewport.rect.x - viewport.ox8 i5 B1 Q2 R" N- e4 |- E1 S2 r( f
  777.       vp_y = viewport.rect.y - viewport.oy! m3 u  T, ^" e9 Y4 Z. @* S( P
  778.     end
    ' B; u0 Y: Y5 v! X* y% l' z* J
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y( o( S2 [8 P2 Z; S( J, Z, y
  780.     item_x1 = vp_x + x + standard_padding + w6 Q( ]% j9 A; Y* L
  781.     item_y1 = vp_y + y + standard_padding
    2 V3 K+ ^8 V) k1 `. c
  782.     item_x2 = vp_x + x - standard_padding + width
    ( v8 ?; H+ k/ g4 j! c- g
  783.     item_y2 = vp_y + y - standard_padding + height
    0 O! Q: W; s! K6 H0 }
  784.     if mouse_x  item_x1
    , s, @1 o8 f0 i( q. k6 [5 B
  785.       mouse_col = -14 q: r' D% t9 o3 N! x+ d- \5 L. |( D( G+ R
  786.     elsif mouse_x  item_x26 l" y$ _$ ]! Z
  787.       mouse_col = -2
    ( j) b0 S" R& q$ k  [
  788.     else
    0 a$ B: u) |5 r1 G4 L5 K
  789.       mouse_col = (mouse_x - item_x1)  32
      W" t# ^6 d6 C+ j8 S+ ~) b
  790.     end; R9 _* h; J$ o( B% S; e
  791.     if mouse_y  item_y1
    9 Z+ J$ H; H- |( r  z% T" k
  792.       mouse_row = -1
    , S" E  {$ ^! r! [4 a2 E9 P1 g
  793.     elsif mouse_y  item_y2) |  Q3 H( ~( ?' z
  794.       mouse_row = -23 a2 `2 C; v/ h, q: G7 W
  795.     else
    4 O' @0 A7 {% G5 Q* q
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)& I/ A3 j  l; C) \7 J3 t0 E% `# o
  797.     end
    : N. N6 a* W. r. \5 D0 s2 n3 l! L
  798.     return mouse_row, mouse_col
    - @, _5 e# t. `% D) [' O3 p3 m
  799.   end
    1 ?( K$ U/ C) ~4 h1 x' q7 A2 f; H+ ]+ w
  800.   #--------------------------------------------------------------------------
    $ \6 g: M0 d: M4 P4 W$ [
  801.   # ● 获取文字. G' a* Y1 R: ^6 J5 a7 N
  802.   #--------------------------------------------------------------------------
    # Y6 G% O8 T& f# [9 G& n
  803.   def get_number! M+ J" i% R5 d5 o( k
  804.     return false if @index == 9  @index == 11
    ' A4 x  o1 @+ ~( y2 X
  805.     return TABLE[@index]. {1 Q! c4 G7 ?; ^7 e0 U2 y" z
  806.   end9 L' W4 }1 i$ }  B; H4 L; l
  807.   #--------------------------------------------------------------------------
    ; T7 k. H. A0 a! k) i7 D" k# \; i, R
  808.   # ● 判定光标位置是否在“退格”上! ~1 q( g! b/ j/ F3 R/ X
  809.   #--------------------------------------------------------------------------% I$ H5 g7 G# `$ `& L
  810.   def is_delete8 Y! u0 R( R2 f* K6 }
  811.     @index == 9
    2 k% A: R& t' S, Z
  812.   end
    ) e2 G: Y. |/ D& B6 |8 ]( V+ Y
  813.   #--------------------------------------------------------------------------
    0 m0 o# v9 z9 a/ V& g
  814.   # ● 判定光标位置是否在“确定”上/ m) U) _3 @7 B+ R+ s* l
  815.   #--------------------------------------------------------------------------
    ( O* ?% t% i. C8 [( i
  816.   def is_ok( N% \/ ^9 q' L9 ^
  817.     @index == 11
    & n/ d% Y, {0 k5 v
  818.   end
    5 L/ O& p# q, n) [
  819.   #--------------------------------------------------------------------------
    9 @& x( |' }" O$ q- E/ A. _
  820.   # ● 更新光标7 |3 Y$ |; Y0 s+ g5 }% j
  821.   #--------------------------------------------------------------------------
    ; D% B. r. w; m% F9 z8 I
  822.   def update_cursor1 G% [* |8 L6 l+ z) ?
  823.     cursor_rect.set(item_rect(@index))
    ! R  ^! {3 ~* d7 w6 q! n
  824.   end
    ) q1 G" j6 B8 K0 B
  825.   #--------------------------------------------------------------------------
    " {2 y7 @( |! Z3 M' V
  826.   # ● 判定光标是否可以移动
    ( C& p4 F8 ~& M% D$ b( ~) Q7 h
  827.   #--------------------------------------------------------------------------
    " ?5 t) @, {) z
  828.   def cursor_movable3 C4 C3 W/ F, G
  829.     active9 |' w( h6 n( T9 W4 R5 P
  830.   end8 [2 r0 {6 X+ w( x
  831.   #--------------------------------------------------------------------------
    3 }9 r" e: D6 ?4 U5 m
  832.   # ● 光标向下移动  z7 d% q' x) Z7 y  ]# E* ^
  833.   #     wrap  允许循环: ~1 ?- X, q: y
  834.   #--------------------------------------------------------------------------6 Q5 T* H' k& g9 P
  835.   def cursor_down(wrap); ~* @" L8 k: B- @
  836.     if @index  9 or wrap
    : L. M1 k7 d! N& M* w
  837.       @index = (index + 3) % 12
    % J+ G" j4 K9 p# F% i/ H5 [
  838.     end
    7 c1 R  B2 O) B) w3 S9 }% ^
  839.   end
    5 o/ r% D8 I4 {8 @/ d5 ^
  840.   #--------------------------------------------------------------------------0 V* u5 ~7 B# g8 L  |: i
  841.   # ● 光标向上移动' U" t6 |- f. t+ Z2 J* Y
  842.   #     wrap  允许循环
    . C& K  |* c7 V" |# G
  843.   #--------------------------------------------------------------------------
    / ^1 `! u. Q! Z
  844.   def cursor_up(wrap)! W1 G  U' T1 ^' j  n
  845.     if @index = 3 or wrap6 i, n4 o0 Q: ^7 p; F
  846.       @index = (index + 9) % 12+ c7 v4 l( j, M: s, a8 K) h1 v9 q
  847.     end
    , k- ~: E) ]( W* ^
  848.   end
    ( a/ N9 ^& \7 I3 C8 p/ S1 c2 s# S
  849.   #--------------------------------------------------------------------------+ ?: a  H% f9 [  A$ G9 u
  850.   # ● 光标向右移动
    : M  ]4 n/ I3 U+ k# G8 k
  851.   #     wrap  允许循环
    0 ?( H: D! h/ _
  852.   #--------------------------------------------------------------------------/ a$ E  `# k# @
  853.   def cursor_right(wrap)
    2 [; ?- d7 P; b% T* }
  854.     if @index % 3  2) O6 }5 |, y+ @& u9 V9 T% ^
  855.       @index += 13 Q9 V% d  e2 k0 y* t
  856.     elsif wrap9 m+ C. a7 C* a; X! \
  857.       @index -= 2
    * {& Q( ]3 y3 n* f- q, T; b
  858.     end0 l+ H+ K# E; F  _3 g5 q
  859.   end/ D* f* }( R7 r4 O
  860.   #--------------------------------------------------------------------------: o; ?4 I. T% M' r) [& `
  861.   # ● 光标向左移动/ R. S( {- b1 O3 d) L
  862.   #     wrap  允许循环
    6 h; B5 k' j$ T' R" u+ D' c
  863.   #--------------------------------------------------------------------------
    & A( h, b3 T( q$ t" F- Z4 g
  864.   def cursor_left(wrap)
    $ L- i( ]3 \$ c0 b
  865.     if @index % 3  0
    ( X" B$ P0 @$ }2 u) q. c3 c* q
  866.       @index -= 16 Y- w4 ]8 t3 m
  867.     elsif wrap; {: M# j* }4 W$ r3 j' T5 M
  868.       @index += 2
    5 o& g9 v% Q: p
  869.     end
    9 D) X; V6 x- \; {1 o7 S5 M
  870.   end
    : P% {! ]7 ~2 Q& }8 ~
  871.   #--------------------------------------------------------------------------$ C3 e1 u% B) |1 ~( s0 g/ K4 l
  872.   # ● 处理光标的移动
    & @* G& ]! ~5 m% L0 N. \
  873.   #--------------------------------------------------------------------------
    & D: D/ D- C& K8 E0 \1 B! h
  874.   def process_cursor_move- e$ j8 o/ I* c* [& W( c& Q5 T5 }* Q8 q
  875.     super# I' u/ K) I0 s1 U* P& B
  876.     update_cursor- G  o: \9 H  d
  877.   end6 d$ x4 D9 J1 R) b
  878.   #--------------------------------------------------------------------------0 U; m5 e  N8 e4 a5 P5 N7 |5 [
  879.   # ● “确定”、“删除字符”和“取消输入”的处理
    ! ^* z+ x9 V" i4 G" |8 S0 F
  880.   #--------------------------------------------------------------------------
    + T  \1 ~6 U+ p5 n5 J
  881.   def process_handling) r/ R* I. V! J" F1 r) ^* |
  882.     return unless open && active( X# g9 ^1 y* B3 H6 n! `" s% d
  883.     process_jump if Input.trigger(A)
    1 a5 K, f& g5 }  x+ R
  884.     process_back if Input.repeat(B)
    * {# Q) j* o# ~6 u
  885.     process_ok   if Input.trigger(C)
    % _: P5 S% O3 b
  886.   end  i. f( b) w  a! o4 f7 ^
  887.   #--------------------------------------------------------------------------3 t8 `) N0 c9 X: `9 [5 [
  888.   # ● 跳转“确定”' P. c5 c- m5 c0 l! Q
  889.   #--------------------------------------------------------------------------+ u9 A5 p4 K' e
  890.   def process_jump
    ' |( @  W: `' e- n2 O( z" `2 H
  891.     if @index != 11
    ! a6 Y8 q/ }0 {9 w" y$ ^( Y$ h& q$ Z
  892.       @index = 11
    & y1 v3 U0 f3 R. v
  893.       Sound.play_cursor; s5 @0 _6 D7 d8 ~+ A6 z
  894.     end
    9 V5 G3 q  y  r. Z5 h3 h
  895.   end) N( O/ q, w* D+ I! ~
  896.   #--------------------------------------------------------------------------" P+ O4 r- [( K3 d4 R
  897.   # ● 后退一个字符# C: v0 A; c1 ]$ l' I2 I
  898.   #--------------------------------------------------------------------------$ x+ z7 d. ?0 K4 W( ?$ N
  899.   def process_back. b1 f8 }% n# Z, J
  900.     Sound.play_cancel
    " Y4 ?0 {: L6 S, O( |8 [2 e
  901.     place = 10  (@digits_max - 1 - @old_window_index); h9 @% J+ Q: P$ \7 z
  902.     n = (@number  place) % 102 w5 j, b( B$ U, f1 k. K% P
  903.     @number -= n  place& K6 z8 N! b7 F6 V
  904.     @number_proc.call(@number): G! f2 o0 R* W! S' A6 t1 Q1 j3 R: U
  905.     @old_window_index -= 1 if @old_window_index  0& D- R! U' R* u& `7 s1 o9 k
  906.     @index_proc.call(@old_window_index): v; |0 x- f+ f8 i) s" D
  907.     @refresh_proc.call# @" I* n% R; B' v* }' F7 K8 t
  908.   end$ M. w' ^  ]' u# i6 e
  909.   #--------------------------------------------------------------------------2 r0 l/ \2 x1 D# }8 f4 V
  910.   # ● 按下确定键时的处理. t3 O' a* u" M0 E5 W7 d4 V' L: b
  911.   #--------------------------------------------------------------------------% X8 Q! e) c: u
  912.   def process_ok3 L9 n" i5 J% F
  913.     if get_number" x$ Y. e. B! a) |7 k# S1 a
  914.       Sound.play_cursor
    9 W& g# b, D) d2 I) Y1 P9 Z
  915.       place = 10  (@digits_max - 1 - @old_window_index)
    / _6 y! Q& T- j, C& G
  916.       n = get_number - (@number  place) % 10
    6 G- X8 j3 C! H" C, K7 |
  917.       @number += n  place8 g3 U+ j0 U! G, n9 g
  918.       @number_proc.call(@number)0 ]5 a' x# S  |" r( c' G4 `6 n9 c
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    2 Z# P: v5 b/ m9 Y, w8 E5 }
  920.       @index_proc.call(@old_window_index)
    , L! z5 R( ^1 u$ d+ D
  921.       @refresh_proc.call
    3 h6 ], Q/ ]0 a9 k
  922.     elsif is_delete
    ! m  B: J8 T) d/ M8 h+ x, y
  923.       process_back4 C( w0 f3 x- M+ |
  924.     elsif is_ok: p  l' o% H8 Q
  925.       on_input_ok' F) C- z  r' I. h% A
  926.     end& M8 \6 a! T( C4 g/ Y& Z; y
  927.   end
    1 m5 F0 i: m/ b3 L
  928.   #--------------------------------------------------------------------------7 O9 f) U% O/ U
  929.   # ● 确定
    / S3 _# o4 ]$ a6 G$ [) P6 c" n
  930.   #--------------------------------------------------------------------------! G* B7 N% f/ D" i( |- d
  931.   def on_input_ok1 q; [/ o/ }8 c+ d3 w
  932.     @index = 0( u+ ^0 o! ]: U& ]2 `2 X
  933.     @old_window_index = 0
    - o9 F5 p  K4 N
  934.     $game_variables[@variable_id] = @number
    # B8 m/ H7 F' S+ J) g+ Z0 f  n
  935.     Sound.play_ok- L( l/ D3 q' M$ u1 k! m+ j& n9 b6 o$ ]
  936.     @close_proc.call- u5 J2 e( k7 ]; z1 l7 }  R
  937.   end* ^8 C$ S1 @+ g( h2 N3 T. V" `4 |
  938.   #--------------------------------------------------------------------------. v+ R" A+ T- U$ w9 p  v& u1 U
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    1 U. T" }/ S$ d
  940.   #--------------------------------------------------------------------------
    + S# O3 E8 G: |/ ^# g+ Z
  941.   def set_mouse_pos0 w1 T( ?  z1 v/ v+ k& U
  942.     if viewport.nil # necessary!
    3 v, n0 X2 v' _
  943.       vp_x, vp_y = 0, 01 ~% O, ]5 D( V/ w6 {
  944.     else
    9 a2 ?' l: \; ?$ g* i
  945.       vp_x = viewport.rect.x - viewport.ox
    . B. b5 d( ^, |4 v$ _. t5 j/ l
  946.       vp_y = viewport.rect.y - viewport.oy
    9 a- i7 D4 c9 _3 j' f& h2 R* T
  947.     end
    9 n- J) `# w6 M& I
  948.     item_x1 = vp_x + x + standard_padding
    ) d# V! F! }5 T1 t- S% R- T
  949.     item_y1 = vp_y + y + standard_padding5 Y! a' p4 X. N' c4 D( S8 _9 x
  950.     get_index = @index  0  0  @index
    , J/ @9 }# `: ?! x& }
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)- Z8 c+ Y* ^: Q- d/ l. o$ w
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)/ {. u2 U* b  H" w) {' Y
  953.     Mouse.set_mouse_pos(new_x, new_y)
    ; s1 }; }* J# g4 h5 a. N) J2 R
  954.   end
    ' j6 l3 i  W- K+ P+ A7 \" [
  955. end( O) o+ D' G. O5 }. f
  956. 6 A" F/ T3 L" E0 `9 o& c
  957. #==============================================================================2 l7 r4 ^. Z! F+ i6 d, I4 Y+ z* m
  958. # ■ Window_Message& k: u) k: Z( r* |. z% y
  959. #------------------------------------------------------------------------------
    4 U* w" s5 c/ f2 u' E0 F; w( |
  960. #  显示文字信息的窗口。
    # e6 L- l& r* N
  961. #==============================================================================% J$ x7 K6 }: b* Z
  962. class Window_Message  Window_Base
    & |1 j" A# ?; p* R* b' I, Y
  963.   #--------------------------------------------------------------------------
    # v5 u6 h: S* x7 g% b8 d6 U
  964.   # ● 处理数值的输入(覆盖原方法), _: K9 _1 I( f
  965.   #--------------------------------------------------------------------------+ [; J% S8 a) d4 X( V
  966.   def input_number
    . H9 m: h7 D9 U, @
  967.     @number_window.start
    * b0 q4 G1 I5 \0 F8 U7 P
  968.     Fiber.yield while @number_window.extra_window.active) a3 N' i) j% R$ x# z
  969.   end
    $ `& a* _3 d7 f
  970. end3 \# t) ?! g( ~# F7 m( a
  971. 1 K" i. r$ Z0 B) n/ f" C
  972. #==============================================================================
    6 C0 i: e+ [: X- x* D/ y, a" t- A
  973. # ■ Window_PartyCommand
    ' K! \5 @4 h0 ^0 {
  974. #------------------------------------------------------------------------------' A# Q' A0 l2 c2 V0 u! @, O/ G# d: S
  975. #  战斗画面中,选择“战斗/撤退”的窗口。! u" {* v( i! D& N  l1 T
  976. #==============================================================================
    0 D9 V) z, f4 r3 q2 e  ^2 i  A3 F0 Y
  977. class Window_PartyCommand  Window_Command" `# t% o- {/ k: y7 R; Y! [. K5 `
  978.   #--------------------------------------------------------------------------
    + Z  w0 m# A- x% D' O
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置3 {! U  U, _! o$ ~' v& K
  980.   #--------------------------------------------------------------------------9 H4 F* _* I0 R& k0 S- A! f
  981.   def set_mouse_pos
    7 v; w, o" X4 n
  982.     if viewport.nil6 |  l4 Q! d$ r- s# H( A
  983.       vp_x, vp_y = 0, 0
    . }/ K7 `* c) }. F$ d7 j* o  C
  984.     else6 r8 W( M8 a! n! h1 @0 n: w
  985.       #vp_x = viewport.rect.x - viewport.ox
    3 Z6 b" R& h, D* {" [, X
  986.       vp_y = viewport.rect.y - viewport.oy2 q$ ~4 T7 O5 x9 H. p
  987.     end, ^/ b5 G( n" _; m) f( S; y
  988.     item_x1 = x + standard_padding / X2 h% V% N1 s; V
  989.     item_y1 = vp_y + y + standard_padding! h. X/ Q( R9 A0 p+ J" V1 I& [' v
  990.     get_index = @index  0  0  @index & [& Y! P; S/ t- Y8 R) K8 y, A) O( k+ O6 Y
  991.     row = get_index  col_max - top_row
    # s$ n7 N9 s& d
  992.     col = get_index % col_max$ E$ N  h7 g7 b/ Q" W
  993.     new_x = item_x1 + item_width  (col + 0.5)
    ! _9 a# m$ @9 W8 G
  994.     new_y = item_y1 + item_height  (row + 0.5)- W) s* A0 ]4 d8 A7 n9 J
  995.     Mouse.set_mouse_pos(new_x, new_y)+ o9 X# Z; B. h) w6 [6 o( q
  996.   end
    8 t) L6 \$ j8 I7 ~& F: t
  997. end
    $ u' w5 D- ^3 c3 @

  998. . G' }% ?3 V( |. V! O
  999. #==============================================================================% ?8 z: L1 k0 ^4 Y) M& [$ o6 \) h% m
  1000. # ■ Window_ActorCommand
    1 N( E7 n* J- Z" L4 y9 p
  1001. #------------------------------------------------------------------------------7 R* {% Y* S% \9 w2 Y$ K! c/ u
  1002. #  战斗画面中,选择角色行动的窗口。
    + B: G  E4 m4 y% C7 v$ \
  1003. #==============================================================================6 C- f* \. A& J* T
  1004. class Window_ActorCommand  Window_Command
    ' q+ c  \1 k/ O. o2 N
  1005.   #--------------------------------------------------------------------------
    0 d* l- a9 l9 U1 R+ G+ P
  1006.   # ● 方向键移动光标时将鼠标移动到对应的光标位置2 s/ Q% A( C: S- F
  1007.   #--------------------------------------------------------------------------" k0 B( ~; G' {8 l9 _
  1008.   def set_mouse_pos
    . H8 f1 W9 {. {8 E- }8 c
  1009.     if viewport.nil/ b; V6 `% s: |" e  R
  1010.       vp_x, vp_y = 0, 0
    : I+ ?9 ~. U8 C  |- X( E+ J: @
  1011.     else, m: {5 |& w* }7 @2 o
  1012.       #vp_x = viewport.rect.x - viewport.ox
    0 R9 z) A% w% L2 G) q
  1013.       vp_y = viewport.rect.y - viewport.oy
    ) S. E- `6 Y6 z1 a* b& C: C
  1014.     end* a+ }' Z+ r- V" H" F2 Y
  1015.     item_x1 = Graphics.width - width + standard_padding- Y0 `" T) A% g9 s1 f, D
  1016.     item_y1 = vp_y + y + standard_padding6 |# ?3 L; I1 D* c
  1017.     get_index = @index  0  0  @index ) N/ G9 D% N% f" i* m+ S) D
  1018.     row = get_index  col_max - top_row
    $ Z5 T7 G# E% C2 K# ~0 c" a4 t1 Z, z
  1019.     col = get_index % col_max% I2 d4 {* K( W9 `5 S
  1020.     new_x = item_x1 + item_width  (col + 0.5)
    ' w3 N  _: n- W
  1021.     new_y = item_y1 + item_height  (row + 0.5)& f8 k' u4 P$ {2 S8 S9 l
  1022.     Mouse.set_mouse_pos(new_x, new_y)
    * C0 A8 Y  x; C
  1023.   end
      I* D# U: ^1 P
  1024. end
    ) k/ [: a7 q$ R: l

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

  2145. ' Q/ d# [% l3 Z
  2146. #==============================================================================
    : C4 L! g8 Q' X6 l6 I3 W( c
  2147. # ■ Game_Map& M; u$ W$ n5 ^& O
  2148. #------------------------------------------------------------------------------9 q! h; G# e# Z! m2 R( `. P- T( }
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。, s! h3 |8 x  o
  2150. #   本类的实例请参考 $game_map 。
    + z1 a0 V, s3 `" T( ]3 ?2 O! n
  2151. #==============================================================================. Y2 F) [" }4 [7 s, }
  2152. class Game_Map  _! Q2 i6 ]9 |/ r
  2153.   #--------------------------------------------------------------------------
    * f( r+ U4 @& e2 L
  2154.   # ● 定义实例变量+ u0 a8 }8 W) t* m6 v; K
  2155.   #--------------------------------------------------------------------------
    1 E; ~$ m# e/ [0 F( S8 Y" j/ B
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据2 f0 h8 u5 _% d: `+ m% W8 z' T
  2157.   attr_reader mouse_map_y # 同上
    8 c1 U6 U" X: ?
  2158.   #--------------------------------------------------------------------------! j+ c& |1 o( k! ~9 w
  2159.   # ● 初始化对象
    ' d$ P3 w' _. @3 H& @( {
  2160.   #--------------------------------------------------------------------------$ R$ M; j' M5 @7 Y
  2161.   alias sion_mouse_initialize initialize/ `- o" p1 G! H9 O, Q% c6 m" M
  2162.   def initialize& K/ n9 y$ A- L! G) z2 V# ~
  2163.     sion_mouse_initialize: a0 B4 y8 L8 O+ v
  2164.     creat_move_sign  ###9 ^! W2 }2 M+ \: s: l
  2165.     set_constants0 d' v, o) ^6 H: [2 h( a
  2166.   end9 k& K& x- @1 ]1 W+ o  b
  2167.   #--------------------------------------------------------------------------
      O( S4 T6 C1 t
  2168.   # ● 更新画面
    , g# c2 W0 d! I4 r
  2169.   #     main  事件解释器更新的标志4 y+ W' s5 ]2 w) [7 c
  2170.   #--------------------------------------------------------------------------- q( S" ?" {" S- h: X
  2171.   alias sion_mouse_update update
    / a5 H/ o3 Z1 L! C3 s- i0 s
  2172.   def update(main = false)
    + j' ?1 m2 E' ^  l/ @
  2173.     sion_mouse_update(main)
    8 W& i; {$ Q0 s9 M6 g$ R+ H
  2174.     update_move_sign& F5 U+ h7 D0 o- b
  2175.   end" }6 j( L) w% j
  2176.   #--------------------------------------------------------------------------# X9 @- |8 j% ^3 _  A" [+ H
  2177.   # ● 创建显示路径点的事件
      a4 Q7 E' L6 ?
  2178.   #--------------------------------------------------------------------------
    5 U+ o& y& b" P7 r  S% ~/ P
  2179.   def creat_move_sign1 T, {% k' v! N4 f" ]) Y! I
  2180.     $mouse_move_sign = Move_Sign.new
    ! F7 n) c$ p$ ^! O' ]7 A9 k
  2181.   end
    3 d3 u& U% A/ F6 q2 C6 Y& m4 Z
  2182.   #--------------------------------------------------------------------------
    ' I  f+ C+ T+ t, ?2 B
  2183.   # ● 更新显示路径点的事件: O. Y0 {8 K& f% }, O: G; p4 Y
  2184.   #--------------------------------------------------------------------------
    * `: a3 ~6 s+ ~
  2185.   def set_constants
    $ u) }! }' y4 Z" L' s0 C3 s$ Q
  2186.     @mouse_pos_setted = true
    ; g1 u3 X% P5 v+ o
  2187.     @set_pos_prepared = false
    " V. ?! f$ s4 |" r2 k; x4 w- ?1 j
  2188.     @mouse_old_x = 09 K9 J8 D, s: |8 F
  2189.     @mouse_old_y = 09 ]/ I' F% j  V9 G" U3 ]( J! j
  2190.   end( c& k; Z: T. C3 i. c
  2191.   #--------------------------------------------------------------------------
    7 M9 L1 {* T# I, m, s6 r
  2192.   # ● 更新显示路径点的事件
      Z7 s+ t" x) b( w6 o) m* G
  2193.   #--------------------------------------------------------------------------* ^) H7 `* B! X3 e
  2194.   def update_move_sign
    + Y2 [6 W& A- R) L: t$ I8 r
  2195.     $mouse_move_sign.update2 n; K6 c' V  Q# l+ V( p
  2196.   end
    9 x" D2 B! i' Z# L) x2 D
  2197.   #--------------------------------------------------------------------------& a' d* U; c: E# G
  2198.   # ● 获取鼠标位于的地图块的x、y坐标0 i% I) x3 i% l4 ^. L
  2199.   #--------------------------------------------------------------------------" m, F! r& w  U& O. E& ?7 U
  2200.   def get_mouse_map_xy0 d% H* L' j) }8 w( ^& E
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    * g$ i, R9 l* t
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i)
    6 W" U+ d4 z% p" O" a
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i)
    ( h+ b0 A8 X( G% N/ X$ b
  2204.   end* g. d/ U/ @( ~/ C+ y0 n5 a; E
  2205.   #--------------------------------------------------------------------------6 B) V( X# O' C, S+ W7 i
  2206.   # ● 返回地图画面时重设鼠标坐标
    4 r+ b2 c1 {  u# }1 b
  2207.   #--------------------------------------------------------------------------7 B8 ^+ e# C7 n
  2208.   def reset_mouse_pos4 ?8 J6 {) P0 w# r( u. d
  2209.     return if @mouse_pos_setted4 ?9 d0 {) z' a
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y)
    % n  e8 ?3 A6 V
  2211.     @mouse_pos_setted = true5 A1 f# B# @; j7 A: a# r4 D/ B
  2212.     @set_pos_prepared = false
    3 o/ C, t5 G7 h: q9 H2 k* }
  2213.   end6 ~) u! P* Y+ z6 T
  2214.   #--------------------------------------------------------------------------
    # c; K/ [5 t/ t5 x
  2215.   # ● 重设鼠标的坐标
    # p6 k% g9 E; c2 s  W$ n( o# s" e" |
  2216.   #--------------------------------------------------------------------------% ^' e7 [+ b+ j/ ?2 r! |: u1 L0 l
  2217.   def prepare_reset_mouse_pos8 V9 _$ `. W3 }4 m# p
  2218.     return if @set_pos_prepared  j8 Z5 q# D- i* a4 ^6 q. ~
  2219.     @mouse_pos_setted = false
    $ v0 a5 H# ?2 G( z( L
  2220.     @mouse_old_x = Mouse.mouse_x. W' \/ y# a+ g. l, T; R# Y
  2221.     @mouse_old_y = Mouse.mouse_y
    " E7 A9 J& o0 G9 y
  2222.     @set_pos_prepared = true# z$ T1 o0 e1 _
  2223.   end
    5 B0 g7 M" }! a* o  H
  2224. end
    % L3 d  N+ x1 s: Y- U- ^; j

  2225. . b5 K! `; |5 X& q% Q# {
  2226. #==============================================================================3 R1 ^0 f2 ~) ^3 Z
  2227. # ■ Spriteset_Map# D* P3 N$ f" @* L' d1 e: G, i
  2228. #------------------------------------------------------------------------------1 z# s  p* H, z* D+ H" F  B
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。% r+ u3 z) q% a( n8 h
  2230. #==============================================================================
    9 K1 b- {4 O. _0 Z
  2231. class Spriteset_Map* H0 G; G' h3 W) d0 f& D4 I
  2232.   #--------------------------------------------------------------------------4 f8 q" N$ X5 @' ~% ?
  2233.   # ● 生成路径点精灵
      {& S- e- m, X4 x" L. b
  2234.   #--------------------------------------------------------------------------
    : v4 P' S! T- B+ i7 z8 u6 n
  2235.   alias sion_mouse_create_characters create_characters0 {2 |/ }' X; o
  2236.   def create_characters2 d; O- J% d* v4 p- }8 i2 D/ J
  2237.     sion_mouse_create_characters
    & D0 `) ]0 e! S9 p
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))
    : \) z8 W2 A/ P& m; K
  2239.   end3 l& r' b$ i9 O$ E. t) o
  2240. end4 T3 R' k- }) F' |; C

  2241. " z6 F" S7 ]$ c1 S0 w1 }* E
  2242. #==============================================================================7 p' z5 p$ |! ]/ s1 r
  2243. # ■ Scene_Map
    7 u: A0 Q8 o; Q
  2244. #------------------------------------------------------------------------------
    6 r9 I2 z, v; p0 U; h& B0 C
  2245. #  地图画面: p1 X* L7 T+ b& b6 C2 h5 S
  2246. #==============================================================================
    ' t8 a' _$ K5 Q$ y+ O3 }
  2247. class Scene_Map  Scene_Base
    4 V& B  P8 P" B. u2 X! Y
  2248.   #--------------------------------------------------------------------------# w9 J' u' X+ ~/ A
  2249.   # ● 画面更新
    + Y5 u/ o6 z: b+ |$ R0 p% r
  2250.   #--------------------------------------------------------------------------) Z8 y* K( Q# z+ Q# Y
  2251.   alias sion_mouse_update_scene update_scene
      W$ y- d% w7 B. h2 \5 p
  2252.   def update_scene
      H. b8 }5 N( P0 E, S, C& m0 `
  2253.     sion_mouse_update_scene% A7 `9 K& m  _2 C
  2254.     update_mouse_action unless scene_changing& |' h' W  q8 S% R9 S
  2255.   end
    ( _( q: J) i) N, j' ~% r
  2256.   #--------------------------------------------------------------------------
    1 |) Z% ~, `2 A* e+ L
  2257.   # ● 场所移动前的处理6 I/ N" z* I5 ~4 O' c' |0 D
  2258.   #--------------------------------------------------------------------------6 _1 j4 ^. y9 ^  J# Q* \
  2259.   alias sion_mouse_pre_transfer pre_transfer3 U0 s% L7 K; j# U
  2260.   def pre_transfer
    7 Q! x, ?/ k) q6 V# n+ A
  2261.     $game_player.reset_move_path  o0 Z6 m4 l8 _) `9 C
  2262.     sion_mouse_pre_transfer
    , U/ P4 g3 g- Y* D& ^1 }
  2263.   end# o; ?6 N7 p- ~+ ^  P5 Q
  2264.   #--------------------------------------------------------------------------
    6 n* N# h) `( |5 ~: e
  2265.   # ● 监听鼠标左键的按下
    9 y- r. m3 ~) N% |7 Y. Q' }# Y
  2266.   #--------------------------------------------------------------------------7 @  ?; l$ i1 }
  2267.   def update_mouse_action
    7 i& h0 j  E0 S! Q, Y
  2268.     $game_player.left_button_action if Mouse.press(0x01)5 Z  D# _: v  [  B$ H- N# u
  2269.   end. @  ~$ |4 ]' ^. n
  2270. end. t7 i& l9 P! D& W9 [
  2271. ( `* ~9 A- A& ~: ?/ ?; n" L
  2272. #==============================================================================/ ?# s' E1 M. D1 Y
  2273. # ■ Scene_File4 V7 f& [2 B6 @
  2274. #------------------------------------------------------------------------------# X) C% h  F* d* l$ B# \: n6 W8 V
  2275. #  存档画面和读档画面共同的父类
    ( Q& m" L; V: W3 O3 x
  2276. #==============================================================================7 u- V6 E- }" v3 X6 P: e( ~' ]
  2277. class Scene_File  Scene_MenuBase8 ~$ h1 @' C1 N* d2 n2 ]2 g3 u- |
  2278.   #--------------------------------------------------------------------------
    ) d8 G8 j& Y/ x( k7 \2 `9 \3 T) b
  2279.   # ● 开始处理+ N. e+ d9 c2 P, b( N# ~
  2280.   #--------------------------------------------------------------------------7 l' j1 B9 n0 M( N# \  U. y* |2 N0 z
  2281.   alias sion_mouse_start start
    , S/ _/ N/ m! r8 S% `& W
  2282.   def start8 l/ p% k( J& S/ u  i0 v" }) ^
  2283.     sion_mouse_start9 S! H) ^* h! L. z8 O3 F1 }4 I9 S3 E
  2284.     @move_state = 0
    7 c" Q! A5 m6 {4 }3 w
  2285.     set_mouse_pos
    ) c% L4 m0 n8 s* B  @+ R
  2286.   end& f% l# f* }. L$ ^4 a) _- Q  K
  2287.   #--------------------------------------------------------------------------
    % K* p0 T" H4 X( h1 c/ ?$ M
  2288.   # ● 更新画面0 h) l! |8 T6 A
  2289.   #--------------------------------------------------------------------------
    . F$ \! G  ^; r' S6 \
  2290.   alias sion_mouse_update update
    ! b8 \+ }1 T. S# c
  2291.   def update; w' J# N( N( ?6 @0 i9 ^7 S, D
  2292.     sion_mouse_update0 p% x, Q+ }; D3 S
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos# [( s  U. y) K: E
  2294.   end
    6 f" k# E  d- Q
  2295.   #--------------------------------------------------------------------------& O& ?% {0 B( d& Z& u( M
  2296.   # ● 更新光标
    4 U# N5 t; p/ e7 p3 \/ H
  2297.   #--------------------------------------------------------------------------
      _, H3 `2 _. k! c9 F
  2298.   def set_cursor
    7 K7 G# ~/ ^' Z, _
  2299.     @move_state += 1+ o# Z6 ~1 u2 S* M# H, Z
  2300.     last_index = @index
    1 {% i4 @# @5 f# m
  2301.     if mouse_which_window == -2
    1 O  h% y* L0 p' f
  2302.       if (@move_state - 1) % 6 == 0/ f/ L- S+ N/ O9 O: ?
  2303.         @index = (@index + 1) % item_max if @index  item_max - 11 k' O5 x) g2 ?0 A# P8 C
  2304.       end
    ! S7 T: [( L0 P1 J6 L/ G
  2305.     elsif mouse_which_window == -1
    : q+ M/ z4 X! N$ P8 }# i
  2306.       if (@move_state - 1) % 6 == 0
    1 P6 h0 v9 t0 r4 ?2 S
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    1 l! w/ f. ~; [1 O& Y1 o) @
  2308.       end" w7 ^. g- S5 E
  2309.     else& B) @( _# y5 W: [; Z% t- G! n* N
  2310.       @move_state = 0' \6 u7 a7 O& c" u- v3 U. y7 D
  2311.       @index = top_index + mouse_which_window# e- I. b1 z+ c! S2 W, l
  2312.     end7 R- w9 \3 z# }) j+ X' v( p
  2313.     ensure_cursor_visible
    6 c+ z4 J1 p. ]# u- ~( i( A
  2314.     if @index != last_index
    5 h' A+ S- [  B+ D5 U; [1 ]
  2315.       @savefile_windows[last_index].selected = false
    + i4 `7 r/ ?( ?) z& [
  2316.       @savefile_windows[@index].selected = true
    ' G  U8 x9 }6 M
  2317.     end
    9 c7 l7 u/ @2 \. R
  2318.   end7 j8 L/ P; x- O$ O, c3 v
  2319.   #--------------------------------------------------------------------------
    5 o3 {0 g" m8 \  K' k8 K
  2320.   # ● 判断鼠标位于哪个窗口9 P! K- J! I' k; p2 v$ y
  2321.   #--------------------------------------------------------------------------
    9 ]7 y. P! B$ e' ?
  2322.   def mouse_which_window5 ^' h, ~$ b. p+ t' q
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    : v% x5 f+ V/ E: q1 h. C$ k0 R
  2324.     if mouse_y  @help_window.height + 14
    * v: ~1 X- \; ~6 A+ U+ s% g4 A$ h
  2325.       mouse_row = -1
    - k+ w$ ~4 [; A
  2326.     elsif mouse_y  Graphics.height - 14
    5 }+ o+ C; T6 k
  2327.       mouse_row = -20 b3 Z5 M& i4 g- e6 ]
  2328.     else& q+ j$ y' t7 C, _4 p
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    $ Y5 A3 ?( A( E  C' n* H0 v1 D
  2330.         (Graphics.height - @help_window.height)
    % s1 y+ D/ }* |! s% J
  2331.     end
    & S- _9 q1 a2 V! j+ h- i& l
  2332.     return mouse_row
    # z& }  Z1 h; y" n* C  C+ G3 |
  2333.   end
    $ P* P+ D- t: y3 H, @% U
  2334.   #--------------------------------------------------------------------------8 c# t0 g) q' `. w* w" X$ g/ D
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    9 H$ D7 o, G% K. I. `1 t
  2336.   #--------------------------------------------------------------------------
      G$ Z6 v( B1 Q! d6 k9 C
  2337.   def set_mouse_pos
    ) c, q1 Z7 ~% Z+ S
  2338.     new_x = 40: J: f/ e1 O2 N1 U+ O8 w! R: X
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    0 S! O. y5 {/ d( ?1 d# _
  2340.     Mouse.set_mouse_pos(new_x, new_y)
    5 g9 s/ Y$ t) N9 q" ^
  2341.   end
      j9 |" y6 [# h% T  x7 b
  2342. end
    - b8 q7 r& o+ b/ i
  2343. 7 i+ |+ E) F, G8 Q0 K' }
  2344. #==============================================================================) D$ i* O9 X  |4 D0 r
  2345. # ■ Game_Event+ E  D/ T& h; l' U* S
  2346. #------------------------------------------------------------------------------
    ' u: U. _4 `1 S" e# |% j
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
    # ?0 s/ C5 S  ~2 |! t" n7 t% h. \" s
  2348. #   在 Game_Map 类的内部使用。
    3 W! s/ H. R9 q' b+ w- A2 i
  2349. #==============================================================================7 h8 L8 ]+ E: K/ ^
  2350. class Game_Event  Game_Character
    ) t8 r5 _0 ?1 m  S! C
  2351.   #--------------------------------------------------------------------------3 ^! Z( N* J0 s
  2352.   # ● 事件启动: y6 ]+ C5 k' P! [
  2353.   #--------------------------------------------------------------------------6 r1 W6 {) N) f6 W* }1 Y4 F0 z% z
  2354.   alias sion_mouse_start start1 ^5 W  r% I; R$ a0 F$ G5 y
  2355.   def start
    3 ^! [! @! \4 p8 q& T
  2356.     return if mouse_start && !Mouse.press(0x01)
    4 [( u5 S; j( a) C/ I; w
  2357.     sion_mouse_start
    ( y* V9 `) s1 n% Z5 W: `9 E% n3 d$ \
  2358.   end
    # t+ B; c& c+ ]; D
  2359.   #--------------------------------------------------------------------------
    : U$ D# L' N" C+ u  F+ t
  2360.   # ● 判断事件是否由鼠标启动
    ( R+ G* R' D$ `9 U) S: n
  2361.   #--------------------------------------------------------------------------
    9 a6 d! ~8 t5 P* ?; o" Z: G
  2362.   def mouse_start
    4 d# @8 s: c$ _% M( F
  2363.     return false if empty
    8 d7 W3 |! O- v5 O
  2364.     @list.each do index
    ( G! i" W) J8 d* f5 k2 O  B- p1 @
  2365.       return true if (index.code == 108  index.code == 408) &&2 a: f' Y% J9 }/ C
  2366.         index.parameters[0].include('鼠标启动')
    9 k/ l6 ]' f5 I
  2367.     end& q# N: R3 [* y, F5 n6 V
  2368.     return false
    . ^( L! [' S) D2 N" N8 M
  2369.   end
    # G! c9 q. w& Q1 o% \4 x
  2370. end
    - ~5 {5 s" ~0 q+ `# w; i3 r/ c6 m

  2371. ' ^& X" n9 {/ \4 {  c
  2372. ####泥煤的height. R7 C7 r/ X2 R5 I8 O, d; k
  2373. # @height = height6 J8 W  l) Y  A8 Z
  2374. 9 x  f2 Q9 n; n% t8 j" M! S1 K# a
  2375. class Area_Response
    / h. Y5 f7 b& q; x5 ~4 e
  2376.   attr_accessor type
    + n- ~4 e% [/ ~$ E0 Y
  2377.   attr_reader ox
    ' `7 d9 H& R/ i- \  o
  2378.   attr_reader oy  q' w8 J6 B/ k" t: s! g. g
  2379.   attr_reader width, e% {. p$ C7 @
  2380.   attr_reader height
    8 [: J/ r/ b, C- V
  2381.   attr_reader switch_id$ w/ O- M3 H% V+ y4 o3 d
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)# W7 R8 b* y! s4 B) {9 M
  2383.     @type = type( R% a* y$ i2 r# G3 @3 M
  2384.     @ox = ox
    4 c, \0 }& r. q$ n6 t
  2385.     @oy = oy7 Z8 v  f) Y; j7 k
  2386.     @width = width
    - }3 |1 J2 @/ l" o3 q/ ]8 ?- B5 r
  2387.     @height = height$ g4 q) O* u5 `$ b! Z" g
  2388.     @switch_id = switch_id- Z8 J3 j! d) f" D" e& [) G+ h" \
  2389.   end2 ^1 I, s- E0 y- v
  2390. end
    $ N, O, ?8 ^' ?% T7 n7 M

  2391. ) ^; t2 s/ @. Z1 Y% `
  2392. $area_responses = []2 B( M, ~! h) q' q/ p
  2393. 0 H+ x3 I$ O; B+ P" X4 M
  2394. class Scene_Map
    ( l0 i1 Z& {* g' g3 F/ {# W
  2395.   alias update_mouse_2013421 update_mouse_action
    7 l. b7 J" }. ~2 L6 e
  2396.   def update_mouse_action
    6 ]. P2 z* G; m' L9 Q4 o% A$ V) B
  2397.     update_area_response
    5 W5 e5 m1 ]- [" q0 n
  2398.     update_mouse_20134212 k% y% n3 O  Y& U  P: F
  2399.   end$ s7 ?8 E% Q7 \8 c2 i$ N5 V
  2400.   def update_area_response8 M) e& d3 h! V. p( \- K
  2401.     responses = $area_responses
    7 y- n* E& A! G2 I1 r" U4 X# s
  2402.     responses.each {response) T' J$ B& |% l: T0 |" ]
  2403.       ox = response.ox
    & d0 c/ @4 _' E; g; F0 Y: b# }/ o
  2404.       oy = response.oy
    & @' ~9 h, d( p/ @- O2 n+ ]5 {
  2405.       width = response.width
    0 {; u7 f% I& \1 x. R6 a9 V* i
  2406.       height = response.height5 {0 ?) F) Q7 ^4 l5 t$ i
  2407.       switch_id = response.switch_id% {: S' P; H" z  T0 ~# s9 z9 T$ t
  2408.       case response.type
    " ~1 w& a( ], ^1 L- }' j
  2409.       when 0
    ; b- @. e9 f6 Q3 h
  2410.         if mouse_in_area(ox, oy, width, height)
    $ W1 C4 O+ R# P+ W- x9 r
  2411.           $game_switches[switch_id] = true# L- C: |6 k8 y
  2412.           $area_responses.delete(response)( t- T  T$ Q: G. g7 o
  2413.         end
    , U/ s0 z4 C! D1 [. s9 ^
  2414.       when 1
    # C# y3 ~9 y) `& w" z5 Z+ @
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)
    8 x  t* U4 M; ]" o# m6 }/ R
  2416.           $game_switches[switch_id] = true
    " b4 {, J4 j7 c  b
  2417.           $area_responses.delete(response)' I" c% M& [) o; g# K9 z! }
  2418.         end; S( B6 T3 p( x$ ?2 G
  2419.       when 2
    . U4 U2 ]1 l/ ~: g# L" y
  2420.         if mouse_in_area(ox, oy, width, height)
    ) ~1 S4 b. s7 G" f
  2421.           $game_switches[switch_id] = true0 J' B( s& Q# l* ~2 y
  2422.         else
    * z; x8 U! ?* @$ \6 K) z
  2423.           $game_switches[switch_id] = false5 D, d( X, U1 ^( @  F
  2424.         end
    4 U3 |# H- k$ p/ n5 C( l( }; h
  2425.       when 3
    % n6 A/ M8 j4 e/ u, t# R. p
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,/ r0 Q- b2 }0 C$ G" l
  2427.             (oy - $game_map.display_y)  32, width, height)
    7 V2 [. {  V. m5 f3 V; e6 y4 y( p
  2428.           $game_map.events_xy(ox, oy).each {event( ]# J0 w: U5 O/ T0 C" f" c
  2429.           event.start
    0 N' T/ m: l& h
  2430.           $area_responses.delete(response)) O3 p9 w5 b. Z9 j% t
  2431.           return
    . G9 v! }, k0 P7 ~
  2432.           } . E8 u( \* [% P% x
  2433.         end
    6 q. ^5 I: {& k1 t
  2434.       when 43 D  H6 L9 A, m5 m  C  i  e
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,( G5 [  z/ Y6 S$ }
  2436.             (oy - $game_map.display_y)  32, width, height)9 `+ m# t  `0 x  ]. Q, r& A
  2437.           $game_map.events_xy(ox, oy).each {event
    5 r2 R5 o, e9 j! t! w
  2438.             event.start1 w: @2 t0 u0 {( ?8 L$ v: z
  2439.             return
    + E! c7 B- U7 T4 `. Q
  2440.           }
    7 R3 N  t4 l- ~1 O/ Y0 s% B
  2441.         end* T( ]& I0 `8 H- h
  2442.       end
    : _  Y7 {) S7 f* p% w, q
  2443.     }
    / `- m) e! p6 b0 A/ o  q
  2444.   end( k6 v2 ?' b7 ^% E8 f- X
  2445.   def mouse_in_area(ox, oy, width, height)
    / Y6 g  Z4 f/ m* v3 {) V
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&, j- g7 \9 d! D+ _. {. B
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height9 c% P/ W% L7 f' n% b+ L+ o  v
  2448.   end
    0 C& A- Z; q; q' o1 o- j( X- P8 T
  2449. end
    % {) h& `: f& q; Q/ v
  2450. class Game_Interpreter
    2 J; b: z3 T, T8 Y) ]# ?
  2451.   def area_response(arg)- C$ ]( ?  x, a
  2452.     $area_responses.push(Area_Response.new(arg))1 T5 r. j3 A4 l! F( s4 Q) W+ H
  2453.   end5 Y4 e" ?2 h8 w0 J
  2454. end- k9 X; u& D! T* g2 y4 a5 D$ ]. x
复制代码

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

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

GMT+8, 2025-2-19 06:12

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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