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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    ) \, l6 l. y/ m# L  U- `
  2. 6 L" o# ?' Q7 g4 y" ^( H4 ?- l
  3.   Sion Mouse System v1.3e- T1 S' F% J9 H) k3 C  Z( F# _
  4.   - Z# v, P* J, L: o7 `* Y0 w# [
  5.   Changlog$ q  B" z( A% Q# a
  6.   
    - S) D* d5 e/ H+ D, h' r9 M! z: g
  7.   2013.4.21 v1.3f5 D- i1 I9 f& r5 b6 G
  8.    
    - I% K1 D+ X( \: o. u
  9.     1.3f 卷动地图 bug 修正! z' m2 u% A% ~* G7 g& Q9 c
  10.     9 |8 O+ G; h, w/ p9 H4 ~
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口, E  g$ u8 Q; M& {/ J" E. q/ X
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内3 a# U% G! l$ l7 p- x: h( b: h9 B
  13.                               Mouse.unlock_mouse_in_screen 解除锁定$ D% X* L" D0 O1 L

  14. 1 n( S4 q1 G0 C2 E. ]
  15.     1.3f bug修正
    0 M7 k( a1 U3 d$ ^3 j2 _! ^
  16.   : L0 n* W& Z: p3 c
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及
    " G$ f- p; w$ r& @  I) g
  18.           关闭菜单时,鼠标是否移动到原来的位置。7 W$ w0 t6 f5 E' a0 B! J

  19. 0 W! c- ]/ u; ~# X
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处1 @5 S* [* N4 o* u6 a& X1 H/ Y
  21. 8 y0 M" G2 N6 S; i1 p
  22.     1.3b 修正一些罕见的bug;
    8 e% y' p1 H. L; H

  23. * o; _% f  ]; f4 c& n! p4 t# T7 s
  24.     1.3a 代码小修改;" ~! f- m  D- z1 h
  25.           加入了鼠标点击启动事件的功能,
    1 n* z! x8 _+ j6 c! @
  26.           在事件中加入“注释”: 鼠标启动  ,- V, H( o2 z& b5 x0 y7 F! u# x% Q. V
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    - z: T$ x! J+ q( O5 M
  28.   
    ! s, I  ]2 i1 x
  29.   2013.2.12 v1.2
    " l( x* H: j$ p5 j% J" L' I
  30. * s6 g/ h' H( O
  31.     寻路逻辑优化;( P+ M% S5 U/ k" c' h
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;
    " Z9 ?1 u+ X% k' P$ D4 G
  33.     现在支持用鼠标来操作载具了。
    3 }' d8 M2 v" |

  34. 8 P; f+ V! O" T* Z% b
  35.   2013.2.8 v1.19 M2 w& `8 p, f! v
  36. : {0 w; O5 t! i0 w! R* `! ?
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    ! G; Z5 C5 p" _, e, `
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;8 f" t" G6 M4 ~% `
  39.     移动时,路径指示点的绘制更加稳定;7 z( e" I) P* W+ m: m
  40.     现在支持默认存档画面的鼠标操作了。/ x$ B6 a- u& V3 Z. A

  41. / D1 V* C- o$ W4 o( a; [
  42. 7 c6 j0 n7 A* f3 V
  43.   OrigenVersion7 m6 K( L1 t% Y" T
  44.   
    ; ~- X0 p4 {* e) o
  45.     2013.2.7 v1.0
    7 o! O: O  U: t7 Y9 A8 H

  46. 7 A2 a5 _$ m1 n! [) B+ g+ [  v7 y
  47.   主要功能+ w- z3 T0 Q; s; l
  48. , o! B& X3 t/ @
  49.       使用鼠标进行各种操作...
    . D; r7 C7 S0 e
  50.       将鼠标锁定在游戏窗口内) v9 R6 P% i4 T; s6 B, N  g
  51.       自动寻路,按住 D 键可以扩大寻路的范围, @& l- f) K4 z6 o3 A3 b; j2 x
  52.       双击鼠标进行冲刺
    , s  g4 ?4 X& H, P( P
  53.       更改地图卷动方式以适应鼠标移动8 e6 f. {$ w) r3 t+ O; {
  54.       变量输入框改良) a" e* d. Q4 t- x+ a
  55. / H+ |8 _: Q5 k  y& n0 A
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹  a6 u7 K- c+ C: i$ i% ]
  57. + X7 w- {* G! v
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹2 g- u, V' q4 G; |5 [
  59. : X7 n8 S$ ~& o6 F5 d- \8 ~
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    $ u: [, B# U# J, T8 S9 M
  61. 1 e) e4 z" E- _9 Y
  62. 9 ]! L) @' G+ X; Y( s+ N
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★+ E! H$ R4 [2 a* @' l

  64. 0 E9 p! _6 S5 P, E4 s( o1 n1 i5 ?- ~" k

  65. 8 D3 Y, g7 X* V) a" o: p6 ?
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示
    2 W/ W9 U6 q) b; H2 A7 Y9 X% t

  67. & t) P5 q9 `1 x, v7 i3 w
  68. #==============================================================================
    / m! _/ @! ^2 R; j: L
  69. # ■ 常数设置
    ; y  D- B' \9 H
  70. #==============================================================================) M, L) ?1 M7 {0 ?. C4 \
  71. module KsOfSion
    - l$ r1 Q6 m) V% i
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false& H4 l# B9 z; `( n$ q
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑) p  k6 Z2 d! L  L' o8 f* I
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    ( G6 R9 j2 P  D: n; s
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量
    * Q! l$ Z- F) O/ k4 E' ]6 c
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    " J2 m6 P0 C( W2 Z% {
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧0 s# B6 W. O' ?; L% T. Z. K1 ~( j
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)/ F4 S+ ^6 D3 K2 p, d, w+ o
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键5 b, p0 v5 P  [. @) K' B/ i0 p
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)
    $ ]8 J1 s# X& q
  81. end5 u$ y. K1 N" p" {1 c( u) r
  82. ( ^7 g9 j9 E& i% H( p% k
  83. #==============================================================================* `  d6 i5 `' }; f7 Y! Q
  84. # ■ 用来显示路径点的类
    1 |& \2 w3 c' A& G; e
  85. #==============================================================================
    : }. E' Q5 t" H/ W
  86. class Move_Sign  Game_Character
      ?. R/ ^" F. }0 S
  87.   #--------------------------------------------------------------------------) P  G4 i  L; t4 l9 z: s% ?
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图/ `. M+ u, L% U) L
  89.   #--------------------------------------------------------------------------
    5 D5 |/ }4 a1 n0 _( [; r/ B' m6 m
  90.   def init_public_members5 }8 k# b7 w' s9 E$ X, d! S& Q
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹
    + G# W0 j" c; M" f
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    ; s0 T7 K( b; q3 X' P* U: \
  93.     @move_speed      = 5        # ★ 踏步速度2 K2 L( F! r+ @! ^! R
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)4 \' t+ S9 a& }- c6 ]
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度0 e. X3 p5 h" |7 w  W
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)8 t$ J& d% i7 S8 U
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列4 w2 V6 g; \3 R
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)
    + s8 ?2 p, ]& G& J
  99.   `) \7 d; Z# K3 h8 I' A

  100. 2 K' P3 J1 `7 F, E5 I, p+ R
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    ! s4 p2 z7 |& `5 \- |  P

  102. - _, h! W3 i2 w

  103. 8 L! {  s( v& d2 b/ U
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
    ' X7 k0 i) I0 K
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    2 R; n' d0 q) c+ j) ]
  106. 3 ]2 Y- F7 [3 j
  107.       if $no_arrowpic_warn
    : B" \+ y. D" b0 N' ?1 u$ ?
  108.         MouseShow_Cursor.call(1)* E. K$ k+ C$ f: n: S* q2 c8 ~
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png3 ], f2 J/ t" s* C. a
  110. 4 m: }& b7 K$ e
  111. “路径指示点”将使用游戏自带图片
    3 l* Y( V2 M- Q& b
  112. 5 }! H. _% z2 ^0 }
  113. 该提示可以在脚本内关闭')$ v6 T8 B" o$ ]
  114.         MouseShow_Cursor.call(0)
    & [) Q4 ^' r3 |+ f* w% i
  115.         $no_arrowpic_warn = false# N& C, E' v+ w: l" A4 Y7 a
  116.       end4 K2 a! q( X6 c2 ~) A2 f: r* S
  117.       @character_name  = '!Flame'9 F/ y8 a6 R/ K2 r, w) v5 M
  118.       @character_index = 6
    & T8 I# ^$ |$ g# v9 ]6 F, o

  119. ) [0 a9 K/ O0 ^
  120.     end
    ( b2 A3 }6 F2 g: T& E
  121.     @direction_fix = false  # 固定朝向1 r) g5 E8 s, T3 ~- \* R
  122.     @move_frequency = 6     # 移动频率
    7 r8 C& G4 O% f5 J$ L. [0 }
  123.     @walk_anime = true      # 步行动画
    9 F. o2 I; I  ~3 b& Q. b; X" M
  124.     @pattern = 1            # 图案5 }6 t- v5 z4 j3 _& d$ Q
  125.     @through = true         # 穿透8 ]) R' y# `' l9 B# z4 R
  126.     @bush_depth = 0         # 草木深度. ~( N0 E" Y" `+ T0 e
  127.     @animation_id = 0       # 动画 ID
    ) |! z. a  {( W$ {% P' d
  128.     @balloon_id = 0         # 心情 ID9 T. C& H9 V/ D/ ^+ H
  129.     @transparent = true     # 透明( k$ |7 O! ?+ q1 V1 \/ w
  130.     @id = 06 R& o* P  C, y3 }. n
  131.     @x = 0
    $ |) {; R7 }4 x4 C3 K1 S$ o
  132.     @y = 0% K+ X& k% ~: o5 N% ^6 N% ^" Y
  133.     @real_x = 0' Y0 D5 e5 x, H; V2 A
  134.     @real_y = 02 E; T. p2 N/ f2 x4 U3 ]" a6 v: [1 K
  135.     @tile_id = 0
    2 ^9 e8 l# p7 P# V/ x
  136.   end
    6 g4 K* Z% B5 P
  137.   #--------------------------------------------------------------------------
      ~- U  p6 m: R. r" ]8 _+ y
  138.   # ● 定义实例变量
    7 Z$ y4 Y0 @, ]+ k4 d( V$ ~
  139.   #--------------------------------------------------------------------------
    , N) Y& P9 m2 X+ ^
  140.   attr_accessor direction& a! I- X/ M, ?1 [* E
  141. end
    * i5 i5 {" Z) _5 c1 T0 R. c

  142. + c, E" F5 ~7 p6 h
  143. #==============================================================================; c% \$ H, ]9 a" Q" j( x
  144. # ■ Module Mouse
    $ Y  V+ m, d' l, k! z9 V! |0 o
  145. #==============================================================================
    - d& ?7 O- L3 o. Y
  146. module Mouse, D/ H& Z3 f1 @: {0 b) Y
  147.   #--------------------------------------------------------------------------
    ; z$ w& n/ K3 |/ b) P1 {* w  Q
  148.   # ● API, C9 \: o6 _) z5 |5 F4 c! X
  149.   #--------------------------------------------------------------------------
    & B4 k8 s3 x, Z, y) j
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')' Z* S# J8 E9 |. O! v( M: y( T
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
    ' e! E3 i/ Z8 \; X
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')
    7 b3 l/ _+ @& ~8 l2 N& D
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')& s. @' [4 B" }, P2 D
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')2 w- s4 r7 b5 Z' f" {( L
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')1 K" W% @+ {0 w! H/ _: s
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i'), s& I5 g% W. W$ [
  157.   Window_Hwnd       = Get_Active_Window.call
    * @$ c- c+ ^$ ^$ w" u3 \: D
  158. / \3 Z  `7 R& Z- `
  159. class  self- d# I; }% I, E8 ]3 d- k& A7 E8 a2 X; L
  160.   #--------------------------------------------------------------------------$ T$ `& z- p$ h# U5 C* \, ^
  161.   # ● 初始化
    . r  f) |$ n& s) r  f* o5 h
  162.   #--------------------------------------------------------------------------, @$ X$ ]/ E' W# Q& X: R
  163.   def init1 B7 P+ |! O2 i0 _7 O! e# Y
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor
    ; _/ U4 X, N/ Q) ]
  165.     @left_state = 03 O9 V9 G1 t5 y2 K
  166.     @right_state = 0" U6 G8 f( l, u& B% K3 a% m' W
  167.     @ck_count = 0 # 帧数计,单击以后从0开始3 B2 m3 W3 b8 E, ^" i
  168.     @dk_count = 0 # 用于双击的判定& _8 b0 R$ R5 f6 k/ y4 O3 `
  169.     @clicked = false
    + N; k; d' Y* ?" o
  170.     creat_mouse_sprite  m2 K' b( V, [% e' a& C
  171.     update4 o- x- x% `& Z  }; ]5 N
  172.   end8 ]. g( t' a$ K9 N
  173.   #--------------------------------------------------------------------------9 ?- g: o% ^! C4 z7 y
  174.   # ● 鼠标指针精灵
    9 f: f5 z+ \. e' E
  175.   #--------------------------------------------------------------------------" R; h3 C) }4 W( i- P: Z3 j& D$ N
  176. #~   def creat_mouse_sprite
    " e" S# ]* c, t& F! v0 ?
  177. #~     
    3 C0 a. D% [+ C, C4 d1 G
  178. #~       @mouse_sprite = Sprite.new
    0 p* |, w4 z6 _. d' V' a4 t2 Z
  179. #~       panda = 2#rand(2)+1! o; O3 P) S) f

  180. / g' F# x# H2 c8 d2 R* `
  181. #~      if panda = 16 D- `9 t, g# @& x- \
  182. #~        if File.exist('GraphicsSystemCursor2.png')+ o/ x  b3 [! B( s
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    / t# j9 N! l/ R; z% o# A5 d) z3 _
  184. #~        end#with if File.exist
    ! i1 X) J  x5 g1 ~5 ?, R# E$ t8 D9 ~
  185. #~   
    1 [% U; J; V7 s6 y4 E" r
  186. #~     else if panda = 2 #with if panda=1- }- A. x0 ^) \' [
  187. #~      
    " Z/ b/ v' a/ G+ _* G" K3 I
  188. #~      if File.exist('GraphicsSystemCursor2.png')
    - {- k- \! X" |  b2 t" S5 x) Q
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')4 R6 h; h! T# e* |  f
  190. #~      end#with if File.exist
    6 _% }# F4 o6 T7 e
  191. #~       & X. E. V5 }: S: h0 P
  192. #~     else #with if panda=1
    , y/ `8 ~# K; A
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)  U/ g& O, \. J3 w/ W
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),
    / {' g& c2 A7 U" Q; B3 [
  195. #~       Rect.new(5  24, 24  24, 24, 24))  E1 P" z' V1 k$ A1 a: Z; ?
  196. #~     end#with if panda=1. P  i4 j! {/ U
  197. #~     
    9 e6 y& ^: `7 ?
  198. #~     #with def4 d4 a6 \, U$ a' k% h- B/ P+ U
  199. #~   end$ b0 M" R8 m7 t- y2 U
  200. def creat_mouse_sprite
    9 t; ]& y) O2 D0 t2 p
  201.     @mouse_sprite = Sprite.new
    / U2 F! h4 ?( U, J0 l
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})
    $ I5 Y% ~( x; D) L( V5 H! p
  203.     @mouse_sprite.z = 99999 U& Y! p& j+ @! Q4 T- x) @  x4 J) y- e
  204.     Show_Cursor.call(0)
    ( |' N- r+ q8 `+ F9 Y; M% y, j
  205. end2 k1 p: [0 b: W/ n' C5 b
  206. ' m. u! }: l" p' i
  207.   #--------------------------------------------------------------------------) i+ M: r2 a) l9 g# @, K- B
  208.   # ● 更新0 }& }+ C0 i$ G% |- B
  209.   #--------------------------------------------------------------------------5 O! s4 b! s- ]% u# Y
  210.   def update6 w* e9 h1 P% o: q* _
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos  i& a6 `& E( {5 x! W, T
  212.     left_state  = Get_Key_State.call(0x01)' U6 i+ ^, Z) s, e8 T. _( W9 f
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0$ j9 c9 `6 i4 X4 c
  214.     right_state = Get_Key_State.call(0x02)+ s( b9 l4 _/ }3 Z. R5 F- Z
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0
    6 K, Y/ F3 }: y, O( c
  216.     update_double_click9 B* [1 j2 r! F2 o8 J' g; U
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1
    ! H$ y3 r8 k+ X: g5 U
  218.   end5 O' M7 R; |  c) v5 z& z
  219.   #--------------------------------------------------------------------------& s. @0 ^' `  T5 {8 D* Q
  220.   # ● 获取鼠标坐标. a" M3 ^; ^1 l# _( K- S
  221.   #--------------------------------------------------------------------------$ ]$ i7 _  u3 ^" q) f8 Q/ A6 M! h
  222.   def get_mouse_pos
    / `/ L6 {5 o7 c% L) T; e5 Y5 N2 K
  223.     arg = [0, 0].pack('ll')
    ( [+ q! m5 w5 ]1 {: r) }
  224.     Get_Cursor_Pos.call(arg). c+ T) B0 Q+ y
  225.     Screen_To_Client.call(Window_Hwnd, arg)7 L# T$ T; a/ Q& f4 o. g
  226.     x, y = arg.unpack('ll')
    % U! [* [( h7 M1 `$ s
  227.     return x, y3 L( [8 Y* l$ R0 }) R% m( w
  228.   end5 {; j& Q; a$ f; l" y4 h! i& r
  229.   #--------------------------------------------------------------------------7 i/ X; A" J3 T" n2 s
  230.   # ● 将鼠标固定在屏幕内
    5 t# y% z, k& O& a7 Y
  231.   #--------------------------------------------------------------------------
    1 d2 @1 F. X8 G" N9 ^. W
  232.   def lock_mouse_in_screen
    - j( d! e3 m% T$ C- s8 |3 m
  233.     arg = [0, 0].pack('ll')% Q5 ?  K4 y1 D- o' V3 U
  234.     Screen_To_Client.call(Window_Hwnd, arg)( a0 O- W, Y" w3 N
  235.     x, y  = arg.unpack('ll')
    3 c2 b: c- |$ N/ G& J, I! w; @( i
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll')); q7 m0 Q; t/ @7 d: s$ u+ T. A
  237.   end% S, h9 n) F3 c1 T# V7 r. G, N
  238.   #--------------------------------------------------------------------------
    7 k" H" W8 ?9 {9 L. T. _
  239.   # ● 解除鼠标固定
    / J( T: G8 K! r, N3 _8 g
  240.   #--------------------------------------------------------------------------# I$ X* r' P1 ~% [; c. {5 j8 V
  241.   def unlock_mouse_in_screen
    7 D/ C! S# R! u6 {: ?8 }  z. ?* U5 j  j
  242.     Clip_Cursor.call(0)
    - f3 f* G: j" b7 {7 p
  243.   end$ f. `7 W4 P' Q
  244.   #--------------------------------------------------------------------------
    8 f' ]! o. U3 t8 T+ \1 Q& e$ e
  245.   # ● 鼠标双击判定
      f4 \1 ~3 v- W4 B! R8 L7 Z( o
  246.   #--------------------------------------------------------------------------5 P2 R2 [# ?# T5 ^4 u! ?9 A% Z$ C
  247.   def update_double_click
    - b9 i' M* o3 V1 k) M5 a/ A& o( u
  248.     @clicked = true if @left_state == 1
    9 b4 W- h+ u0 d* i# Z- ^
  249.     if @dk_count  0 && @left_state == 1
    , F# ^8 Q% c" L
  250.       @dk_count = 0; @clicked = false+ c* [1 U0 n' M: C# ?
  251.       return @double_click = true. `  Q3 ~0 ~" ~$ e$ l: M
  252.     elsif @clicked
    + `( @8 d$ J, S; S; }: o
  253.       if @dk_count  KsOfSionDbclick_Frame
    2 _# A& Q  S- L# c2 m/ Y* a
  254.         @dk_count += 1: A- H& G$ @3 p2 M3 S- E" T+ |
  255.       else: Z' f) E' `# e0 ~, U0 _
  256.         @dk_count = 0; @clicked = false3 t3 L5 L; ?+ s9 B9 C: g
  257.       end5 z$ N) l+ Z6 U; w8 Y' A
  258.     end
      B  M- @1 n: `& J2 Z! K3 {
  259.     @double_click = false& @  J5 w& y6 q( @$ Y9 f
  260.   end1 A, m9 z  M  t3 a
  261.   #--------------------------------------------------------------------------) s% C, N& d/ v6 a2 Q
  262.   # ● 按键被按下就返回true  c& g! Q6 J) K: b& E
  263.   #--------------------------------------------------------------------------) P" q" [3 `$ E% G9 W& w7 m- I
  264.   def press(button)
    4 p* v: V3 g  ?  Q( ~! i8 }
  265.     case button
    " a9 I" H6 ]3 e' ~% B1 D+ V4 w
  266.       when 0x01; return !@left_state.zero6 ]6 j" ?! }8 b
  267.       when 0x02; return !@right_state.zero8 F/ R* n" P' Y! o
  268.     end3 z' J  a+ `6 m5 t1 v$ `
  269.     return false/ ?$ t+ ?/ N' x
  270.   end
    ' _1 c* D) r0 I8 |, h3 y
  271.   #--------------------------------------------------------------------------9 D. S7 v% W* b! ?0 X- S
  272.   # ● 按键刚被按下则返回true( S2 @6 A) x( L& `2 W6 G
  273.   #--------------------------------------------------------------------------
    4 \$ `4 L7 a' B4 I+ ?
  274.   def trigger(button)$ K4 P4 Q; l6 E7 p8 `. o
  275.     case button
      n6 [. ?+ y6 A0 A% Q9 [9 ^
  276.       when 0x01; return @left_state == 1. o. ?  t& T) \7 u' I2 d- n
  277.       when 0x02; return @right_state == 1# q( r9 J. l' Y2 X+ t3 U
  278.     end9 ^* m% B+ r4 Y8 k" |4 t
  279.     return false
    ' Q' U" l, O1 \* O
  280.   end
    . r/ M5 b8 y, L+ e
  281.   #--------------------------------------------------------------------------
    % S! V* ?  f6 _8 p/ }% n, h; x
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true. f) o1 D% J7 S9 @. V% T0 C: w
  283.   #--------------------------------------------------------------------------4 o2 m2 @) y+ W8 `/ j
  284.   def repeat(button)6 X7 `) ?% j- u8 A( \1 B4 A; [
  285.     case button
    / A* ~! M# q* p; Y) E; s/ N
  286.       when 0x01; return @left_state == 1 7 l1 r5 Z2 a4 ^# r: d: N
  287.         (@left_state  22 && (@left_state % 6).zero)) E2 G! l: O( v6 h
  288.       when 0x02; return @right_state == 1
    2 V# Y- e; I1 H
  289.         (@right_state  22 && (@right_state % 6).zero)
    ( d% f' r% L/ Y. c: {1 P. f
  290.     end
    + H$ r% Q( G" B. S/ V
  291.     return false$ W, a% O+ j5 J
  292.   end
    8 e$ u. ]) ~9 b: O9 O
  293.   #--------------------------------------------------------------------------! z1 A+ N9 z7 |; m; r( Y$ n+ y5 N! l
  294.   # ● 判断是否双击鼠标
    4 J9 ?- X+ H0 E  y8 `" j
  295.   #--------------------------------------------------------------------------
    : W" I5 V0 L- T8 R4 n  f
  296.   def double_click7 I( S; I( h4 `- \
  297.     @double_click
    % m: l" _0 [  O7 B7 S( v) G2 h
  298.   end
    ( U  c' E$ ]4 n! S" p6 G. S$ q
  299.   #--------------------------------------------------------------------------2 d! ~/ r! h) i0 P0 ?
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)1 ?& ~+ H( j' k) E, w, D
  301.   #--------------------------------------------------------------------------
    6 z; d) _0 k# ^$ k1 B
  302.   def click_count
    & M3 l1 T: F, C  i
  303.     @ck_count1 ]; y' m; y* r( H0 R. y6 T
  304.   end, i! M5 I9 j  i0 @# S
  305.   #--------------------------------------------------------------------------
    , F1 ]# e$ e, M. c0 l+ @
  306.   # ● 获取@left_state(按住左键每一帧+=1)
    0 a5 n, O  R$ i
  307.   #--------------------------------------------------------------------------4 M' p0 ~( K0 t
  308.   def left_state0 H: @0 I* F& ~2 M
  309.     @left_state0 P7 A, L; b( {% m1 U7 z2 l
  310.   end' B( y( y3 ~. K2 W8 H6 a, v
  311.   #--------------------------------------------------------------------------9 D. ~5 [2 G1 ?4 `
  312.   # ● 获取鼠标的x坐标8 T# P+ f6 C$ O6 R
  313.   #--------------------------------------------------------------------------2 Z  ]* S/ ?/ h. K& j; i2 p
  314.   def mouse_x3 Z1 o' r: Q3 g% ^. R4 b! }
  315.     @mouse_sprite.x
    + m: j4 N# W* e6 D* @& a
  316.   end1 q9 ?* i5 T' k- X+ S) O. L
  317.   #--------------------------------------------------------------------------- K' ?1 _: d3 D' L
  318.   # ● 获取鼠标的y坐标- \7 b, M. c4 B3 W) D1 z
  319.   #--------------------------------------------------------------------------
    ) k9 x/ G6 d- g2 R7 l% B5 I* n
  320.   def mouse_y+ }- Q( G3 r# {7 L6 o4 [
  321.     @mouse_sprite.y7 a0 K3 r8 ^, l4 U4 b8 \
  322.   end
    : X8 _1 S5 E. e1 K* }$ I) ?
  323.   #--------------------------------------------------------------------------
    6 i$ w. i$ g$ K# b
  324.   # ● 设置鼠标坐标% E3 @% n0 c4 H- a, ~' Z
  325.   #--------------------------------------------------------------------------. t. }1 R$ w& s
  326.   def set_mouse_pos(new_x, new_y)
    " z' H) ~" y. `
  327.     arg = [0, 0].pack('ll')
    - _! _, [5 j" v5 h+ A: _: a+ Z* }$ t
  328.     Screen_To_Client.call(Window_Hwnd, arg)& t) I" W% e5 \- n
  329.     x, y  = arg.unpack('ll')
    : W, m/ j) N% G
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    % Y/ G2 V, G" t3 \" I
  331.   end/ L6 k( U( X( [5 Z
  332. end #end of class  self 6 g$ r9 @$ c+ q

  333. 0 t+ K) E2 ~5 V0 u* _
  334. end- |( O( S/ d* i* }" u
  335. ; R4 r6 o: ^1 I5 W( y9 }0 q
  336. #==============================================================================0 L* [# Q! H% l; e. ]5 h- v
  337. # ■ SceneManager& u3 O! e9 D' c% F( I! I' k1 Y
  338. #==============================================================================
    $ a, J; I% |' j- n: I1 R
  339. class  SceneManager
    + w* U, }/ {' r; Q0 ?$ e* u
  340.   #--------------------------------------------------------------------------
    0 y( |- Z& Q+ M; ~
  341.   # ● alias& {1 S% C6 _2 X6 h3 `% T
  342.   #--------------------------------------------------------------------------( i: b5 _! }) G9 `4 F! c
  343.   unless self.method_defined(sion_mouse_run)
    & Z$ z' K. Y! P1 H+ h
  344.     alias_method sion_mouse_run, run
    7 J, q2 @8 H* N4 n' u& M
  345.     alias_method sion_mouse_call, call7 Z5 E' D- O. a
  346.     alias_method sion_mouse_return, return# }: c) j9 E! v3 e
  347.   end
    * ~. }( ?% a. B" ?: D1 S4 ^! u! L* B
  348.   #--------------------------------------------------------------------------
    % I& B6 q/ h) E5 ?1 Y: l
  349.   # ● 运行$ E4 E. ~6 h5 n
  350.   #--------------------------------------------------------------------------/ e& z6 z4 ?8 b' N& Q
  351.   def run% c& W8 y5 v0 s* g$ l
  352.     Mouse.init  t# w- u1 f: y
  353.     sion_mouse_run! Y) Y2 Z, _) m/ N
  354.   end2 K6 Z9 H: R! ~, [1 P$ w$ Z
  355.   #--------------------------------------------------------------------------
    - C7 L7 D; _& q, v9 Z3 ?
  356.   # ● 切换6 W8 j+ N3 g" G, V' y% e
  357.   #--------------------------------------------------------------------------
    * k" g+ _( P9 r- V1 g9 T. T9 Q
  358.   def call(scene_class)( r0 o0 o  _5 B7 H; ?
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)
    $ F# U6 S! {- r& H, c
  360.     sion_mouse_call(scene_class)
    * {3 _$ v- ~, r/ J0 u
  361.   end
    & f1 J) Z' h- e! g( j3 ]1 f
  362.   #--------------------------------------------------------------------------: q1 k. D/ [  G! d6 |$ ~. p4 g/ G% A4 S
  363.   # ● 返回到上一个场景
    7 X& w2 c# x; V) p( }) g0 j
  364.   #--------------------------------------------------------------------------
    $ o6 F, `2 }+ g1 D3 Q, r
  365.   def return
    # m( J0 e9 `7 k- E
  366.     sion_mouse_return  O% c* N; R/ F  r& I% T) f7 V
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&
    0 B$ o& E: {" i' V% E
  368.       @scene.instance_of(Scene_Map)5 j- E# c6 a8 D
  369.   end5 y: n# D# u3 \8 X
  370. end2 l$ g  Y9 B9 w  o0 S
  371. * D7 j5 ?% p  h" c' r
  372. #==============================================================================
      M6 z3 L- B' p$ }' i5 E2 [8 b
  373. # ■ Module Input
      z# ]3 z$ f8 N% u% C# V5 L4 ]- P
  374. #==============================================================================
    * o9 I5 F3 e2 M8 W  D) z" {
  375. class  Input
    7 K" N8 E9 \8 A' T2 s2 t# m
  376.   #--------------------------------------------------------------------------- G3 j+ o1 Z8 G' Q' p- H
  377.   # ● alias+ ?. G; z9 D: ~7 }' S" _
  378.   #--------------------------------------------------------------------------$ g, ?$ `8 |: J  Z
  379.   unless self.method_defined(sion_mouse_update)
    / q6 z. j0 i* w4 `
  380.     alias_method sion_mouse_update,   update9 c6 X% Q4 o- L! R3 x
  381.     alias_method sion_mouse_press,   press: E9 f" |' m+ I; p- u2 w- I0 \7 K
  382.     alias_method sion_mouse_trigger, trigger
    3 v; [' j; Q! b: O3 q
  383.     alias_method sion_mouse_repeat,  repeat
    5 C! A2 m5 Z" [( {2 ?- {- M% B$ a
  384.   end
    + W3 S$ \4 C, W0 x/ ^8 K' e
  385.   #--------------------------------------------------------------------------5 ]& s  z, k* q! s- Z
  386.   # ● 更新鼠标5 L6 s+ _7 c9 X6 q5 Z9 A/ l
  387.   #--------------------------------------------------------------------------$ P% n3 I. Q1 m$ \7 _; Y
  388.   def update
    7 n% l+ P6 z# |: @" h8 r6 c
  389.     Mouse.update
    ' R  z! \( g& ?# @5 V9 n
  390.     sion_mouse_update
    5 h5 Y3 a8 c6 @! p# M4 Z) B4 x5 r- M
  391.   end
    3 }- ^* P3 T, Z, D. I) m
  392.   #--------------------------------------------------------------------------
    # a" ?! b* \2 `* t
  393.   # ● 按键被按下就返回true2 @/ @6 q/ E$ ?/ I1 A
  394.   #--------------------------------------------------------------------------1 q/ K" b/ y+ Q, F' r
  395.   def press(key)
    4 x1 S5 J5 ^' n) ~" h0 f# l: }
  396.     return true if sion_mouse_press(key)
    . K2 d8 i2 _* p2 y
  397.     return Mouse.press(0x01) if key == C
    . K) c5 V! t" p, X5 n# a$ P
  398.     return Mouse.press(0x02) if key == B
    . ?: C3 ?1 l8 Y
  399.     return false0 w, k+ O+ a; D  L( [# u& z: n7 p
  400.   end
    7 \% U6 N4 z) i' ~' V8 Y$ e  ~
  401.   #--------------------------------------------------------------------------
    8 q6 Y! s# Y# w6 H! k. R; y% M0 o
  402.   # ● 按键刚被按下则返回true. O$ I; w( ?4 r/ X
  403.   #--------------------------------------------------------------------------8 t2 u5 @& \, ~; X6 p. I
  404.   def trigger(key)# W2 ?: S7 F3 a% a
  405.     return true if sion_mouse_trigger(key). |6 b7 ^- d# a! r  {" F
  406.     return Mouse.trigger(0x01) if key == C8 p* N/ v* O. A3 v" i+ n
  407.     return Mouse.trigger(0x02) if key == B6 C4 T; s( z: q
  408.     return false1 J0 }/ g3 g, k, {3 c* I
  409.   end
    ; D4 U3 f$ d. H0 Y/ B# X6 D
  410.   #--------------------------------------------------------------------------
    ; s( M* f9 p" K3 f3 N
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    : I) m8 k- [% o& ^1 }
  412.   #--------------------------------------------------------------------------
    6 |; ?3 I( h! {+ d
  413.   def repeat(key)0 \: t7 h5 }0 z  ?# J$ _
  414.     return true if sion_mouse_repeat(key)( ]3 u) `7 @: Y2 P! F# }
  415.     return Mouse.repeat(0x01) if key == C+ m; f$ D' S1 O0 {  J! x' N) t
  416.     return Mouse.repeat(0x02) if key == B) w0 B3 T5 P0 |! I! ?
  417.     return false: m0 C* H( \! J/ N8 w- m: h
  418.   end  G$ i3 Q8 {) l7 I, o
  419. end
    % l$ H& w4 w1 g1 W1 s
  420. ) Z: v( u) z1 O- `0 W: G2 Y. {
  421. , A. g7 x' S/ H/ b
  422. #==============================================================================
    ) W# R5 P; o% ?
  423. # ■ Window_Selectable
    $ j+ y/ ~, y: H- X3 C- ^
  424. #------------------------------------------------------------------------------
    $ z" y6 [1 W6 Y2 O& y/ Z# \
  425. #  拥有光标移动、滚动功能的窗口
    ; @% b2 r6 F1 F* J5 c/ Z1 v# s
  426. #==============================================================================
    - D) P% B3 K. G7 O( z/ S
  427. class Window_Selectable
    $ D+ x# w6 p( w6 f6 H
  428.   #--------------------------------------------------------------------------
    , {6 g6 }8 o1 _4 c
  429.   # ● 初始化5 S: Q2 J* V4 w: F- x
  430.   #--------------------------------------------------------------------------0 Z: ]$ A6 {# ~! ~3 v
  431.   alias sion_mouse_initialize initialize) M7 j" Z5 f4 w* I8 e+ y8 c6 ^
  432.   def initialize(x, y, width, height)0 N6 Z% K' K" M% v3 N+ @2 f4 ]
  433.     sion_mouse_initialize(x, y, width, height)
    1 h" H- \8 k5 a* j2 q9 U2 b- ]8 D
  434.     @move_state = 0. e6 t$ P& {/ z6 Z' i/ ^
  435.   end
    9 n3 T# X0 A# }& p
  436.   #--------------------------------------------------------------------------
    0 M) e" N  R/ Z& G
  437.   # ● 更新& k: j: e9 w: v; x" X
  438.   #--------------------------------------------------------------------------# f, y( G; A6 @3 s# }
  439.   alias sion_mouse_update update
    9 |! d1 k% t; y0 p9 e3 w
  440.   def update
    0 m' F8 z6 f& m+ t* }! |) ]
  441.     sion_mouse_update  R/ A( M) B3 H3 \' K6 y
  442.     update_mouse_cursor
    8 n% @/ w- r6 K% K( r. |
  443.   end
    # `, a8 ]1 Q. t: J
  444.   #--------------------------------------------------------------------------
    * d+ c& T3 R7 A" F3 |  Z/ t1 E! C2 _
  445.   # ● 启动后设置鼠标到index位置5 z# K$ q( N% D6 d5 a
  446.   #--------------------------------------------------------------------------
    $ Y/ c- q4 s) q0 {' @
  447.   def activate
    + k' L+ ~# d/ S; S, l8 I, x4 P
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    6 m: i" U4 b" o
  449.     super4 q+ k3 U2 b0 R# S
  450.   end
    , u5 [. q3 c) k9 D2 {
  451.   #--------------------------------------------------------------------------5 R* `* b. T3 r& L
  452.   # ● 更新鼠标和光标的位置# G/ ^, c5 O* ~" L0 |7 E0 W- o5 @
  453.   #--------------------------------------------------------------------------
    1 \% k6 i7 B8 T$ N! N! R' d
  454.   def update_mouse_cursor3 p6 n4 Y5 |5 `1 b6 V  C. c
  455.     if active0 t; Q( t+ D+ u4 c# D! N1 ?
  456.       if @need_set_pos* @; _, \% Y8 Y+ [- ?
  457.         @need_set_pos = nil2 R- F% M  C9 B  J- s% E. E
  458.         set_mouse_pos7 p" p& w4 @  A: v: q* B; V
  459.       elsif cursor_movable3 M! f/ |' w3 t; ~; z
  460.         Input.dir4.zero  set_cursor  set_mouse_pos: Y9 D: S4 \$ y- A4 T
  461.       end
    % c) z; h; X/ a
  462.     end5 b# v$ G, Q  Y0 P0 }; @
  463.   end
      D+ y7 |+ ]0 [
  464.   #--------------------------------------------------------------------------
    / a5 M  J, X8 _, Y% Y& U
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能! J4 P5 Q! O5 Z' X
  466.   #--------------------------------------------------------------------------3 K0 |2 }% _0 b" x* n2 r" w$ J2 l: q! A. c
  467.   def set_cursor, f. B" X: x8 Q
  468.     mouse_row, mouse_col = mouse_window_area
    0 {  T2 ?9 Z; m+ c7 S+ _
  469.     if    mouse_row == -1) W) @& c  {: f. B$ c: P  D7 a: }
  470.       @move_state += 1 if need_scroll
    # T- z+ Y- N) S# S8 p1 p
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand
    - ^1 }$ V* F4 ]0 D9 o
  472.     elsif mouse_row == -2
    9 F7 f- I4 `1 \+ d3 M- _8 g& O( ]
  473.       @move_state += 1 if need_scroll1 j" F3 ~' c; ?( M' l
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    7 G# U; e, m" n7 A
  475.     elsif mouse_col == -1$ P! _! Y! y" y
  476.       @move_state += 1 if need_scroll
    2 S$ \3 Y7 Q2 J* w0 a
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    : m! l: O: m* g6 ~8 C1 a# ^) C
  478.     elsif mouse_col == -2
    7 n! L; c. [' ^3 j* `
  479.       @move_state += 1 if need_scroll
    $ A8 w, Z! `+ @& K
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
    7 b  [' _  {5 t) \; f" q
  481.     else& _/ l5 ?5 x, [5 O
  482.       @move_state = 0
    + y% N" @/ r$ G' U; U; _
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col  ]6 W! Y8 S/ A6 f+ q
  484.       select(new_index) if new_index  item_max && new_index != @index$ k; \8 B& ?7 n
  485.     end7 b* }+ L$ n  D& M
  486.   end
    ' \! k7 `& C$ P( D- L2 J
  487.   #--------------------------------------------------------------------------
    9 g% b- V% e6 B1 F# h
  488.   # ● 判断鼠标位于菜单的第几行、第几列2 i9 d+ O$ l* |* f0 c- A
  489.   #--------------------------------------------------------------------------. X. d# e5 M1 R$ n3 _. M
  490.   def mouse_window_area9 A' I& W8 v* i5 ?8 Q' }
  491.     if viewport.nil # necessary!
    " J. Y% e8 O6 B  b, t7 O
  492.       vp_x, vp_y = 0, 0
    3 d6 u! Y% ^& z
  493.     else
    & |1 w" M/ \. c* r3 g
  494.       vp_x = viewport.rect.x - viewport.ox: }4 K! X' E, i- q- X: u. k
  495.       vp_y = viewport.rect.y - viewport.oy
    2 U! A$ f- ]0 O1 b
  496.     end0 C/ N1 q# P% q% C: v
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y) T; b. X# l* y6 p8 j
  498.     item_x1 = vp_x + x + standard_padding ) {' p3 {: b! J+ `  \7 h# _% C
  499.     item_y1 = vp_y + y + standard_padding
    ) ?  d( k- D$ a& G$ U
  500.     item_x2 = vp_x + x - standard_padding + width
    2 E, {/ G, G7 k! t% s; p
  501.     item_y2 = vp_y + y - standard_padding + height
      ?+ I/ N8 [' @
  502.     if mouse_x  item_x1. ^7 I) g, N# X7 R) s
  503.       mouse_col = -1# j/ P) Y2 _; E
  504.     elsif mouse_x  item_x2
    6 c; M% K* W6 l* `% `
  505.       mouse_col = -2
    . Z$ C+ J$ B. ~
  506.     else& w; L; t$ i4 A4 N% {
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)
    + m( N3 h6 Z6 M  m' v- n; E# r
  508.     end
    ; v# Z9 a* X) ^& p
  509.     if mouse_y  item_y1
    / _; b5 {' }" Y; }, o5 _- N* c8 w
  510.       mouse_row = -1
    / r9 S8 E& D2 }  H
  511.     elsif mouse_y  item_y21 S4 Y6 Y$ T4 w0 N) x
  512.       mouse_row = -2! L2 F9 L0 q1 {8 o! S) N
  513.     else5 ?/ E4 A/ B/ P0 n' H! B; k
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    0 j4 f0 p) T/ B9 O  c
  515.     end+ {# O8 _2 T! k. G* D. J/ p
  516.     return mouse_row, mouse_col; m0 s4 F# l" J+ c* P
  517.   end! x/ \& J8 T9 G- n- [3 e
  518.   #--------------------------------------------------------------------------
    . M3 ^4 N6 w8 a) j
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置* l3 g; t9 c: [- \
  520.   #--------------------------------------------------------------------------
    4 _6 Q- [$ @1 `9 V
  521.   def set_mouse_pos
    : @8 J' v5 i3 }0 R' ?6 _: \
  522.     if viewport.nil # necessary!
    ( R! I6 Q9 o+ K. ?
  523.       vp_x, vp_y = 0, 0! o) E, p" r& M) a/ G" T2 S4 `
  524.     else
    - o/ E* b- D* G( n, q; u6 x
  525.       vp_x = viewport.rect.x - viewport.ox
    % f' Z! p$ q1 ^; w  Z
  526.       vp_y = viewport.rect.y - viewport.oy
    7 C$ a& h4 R3 B, E! m7 [7 {
  527.     end
    ! |+ s( |& ^: j) o  R3 A& g. w
  528.     item_x1 = vp_x + x + standard_padding
    " [9 N* Q  v$ R
  529.     item_y1 = vp_y + y + standard_padding
    , F7 R5 r- c; c# r+ m* b  C
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index % e1 n. j. @! S; T% m" q% Q$ T
  531.     row = get_index  col_max - top_row
    # b$ w5 c' P/ b8 [: x, l6 ^. V6 J
  532.     col = get_index % col_max9 u. o! U, U6 g) g4 B: M, V
  533.     new_x = item_x1 + item_width  (col + 0.5)
    ( f" D" ]* O* Q) v! s7 n
  534.     new_y = item_y1 + item_height  (row + 0.5)
    : b1 J9 C: M2 x/ w7 M& ^
  535.     Mouse.set_mouse_pos(new_x, new_y)
    # v/ A: S7 i( \4 h% g. E: l
  536.   end- K) M, D. h; Y+ e- @/ S
  537.   #--------------------------------------------------------------------------* E9 Z3 Z7 z5 i; x( L3 \2 O+ d- [
  538.   # ● 判断菜单是否需要卷动$ q) k* f% ~6 N  t& |
  539.   #--------------------------------------------------------------------------
    $ V* I0 L1 R/ ], r
  540.   def need_scroll
    2 K/ S) U8 Z* k
  541.     item_max  col_max  page_row_max
    ! U2 l. n. P+ }1 M
  542.   end! X0 `9 H$ g, \3 B+ ?, b$ n
  543.   #--------------------------------------------------------------------------# q" V) @  q( u/ R$ O, X! V
  544.   # ● 判断是否为水平卷动菜单  ~4 ]6 j0 B1 P7 u* c
  545.   #--------------------------------------------------------------------------
    * A# W6 \. K* y0 `& l$ _
  546.   def is_horzcommand
    $ y% N2 ?5 N+ S, x' A
  547.     return false
    / T8 A3 l* x- e6 G0 x! g* c
  548.   end
    , S$ j: x) [/ Y( q/ j5 _
  549. end2 z; ]6 g/ M7 {# f

  550. 5 P8 M/ f" x, Y8 F4 N! _2 }
  551. class Window_HorzCommand
    # @& `/ s+ X/ D: g
  552.   #--------------------------------------------------------------------------6 C2 l$ h2 Q) V5 t/ W) {5 Y0 [: D1 j
  553.   # ● 判断是否为水平卷动菜单( x; L0 Q) Q  m  {
  554.   #--------------------------------------------------------------------------
      C; X. i# c7 N7 ?- _( m+ R3 d
  555.   def is_horzcommand5 R! M8 ~* V2 V5 C1 p" @
  556.     return true
    / v4 U, F6 @, _
  557.   end0 [9 K9 Z' N; |/ `8 Z" K5 x
  558. end
    4 {; p" ~- ~+ O" L# X  }

  559. 4 r, D  `! H0 k0 ]8 F5 e
  560. #==============================================================================
    % p; Z, J3 U% i3 k6 V2 C6 h3 L9 D
  561. # ■ Window_NameInput
    8 j! s% D9 p3 o+ r" \2 H. ~
  562. #------------------------------------------------------------------------------4 V! g' T9 F; t* G0 Q
  563. #  名字输入画面中,选择文字的窗口。
    2 K  D# d. A! G/ |) K( w1 i- _
  564. #==============================================================================: C' ]0 W/ o$ K+ V# x1 L
  565. class Window_NameInput% R0 ^. c: L0 e+ R, m: h% f
  566.   #--------------------------------------------------------------------------# I/ {9 L; T! i0 _9 C
  567.   # ● 设置列数
      \. Q  n) N1 g0 X( s
  568.   #--------------------------------------------------------------------------
    9 p! n. s7 E/ Z2 D& Q& X1 d
  569.   def col_max
      W2 G- t1 x1 h0 ]2 [* H! `8 B( }# z
  570.     return 10
    * i6 u# X5 s; q0 N
  571.   end
    5 Q0 z( K* U8 x
  572.   #--------------------------------------------------------------------------' u8 z5 }9 ?; i
  573.   # ● 设置填充的Item个数
    1 @8 W0 @/ c2 `  W2 x  R
  574.   #--------------------------------------------------------------------------
    9 X9 R* U8 s! G
  575.   def item_max; ^: y* a% C8 e, d0 g/ ?7 `* F; I
  576.     return 90
    $ k: B' q) |9 a. l" n$ m2 {; s
  577.   end
    ( c4 }' f$ t' o( Q9 p' r% Q" A8 x
  578.   #--------------------------------------------------------------------------; @/ d. s" @* v$ @! ?
  579.   # ● 设置填充的Item个数
    + X7 x: N# I- P3 D- f
  580.   #--------------------------------------------------------------------------
    9 _. j$ x8 E' A, c
  581.   def item_width6 V6 b; O, ~8 H9 E" }/ R' M9 Z2 M* h
  582.     return 32
    ' T( \$ t, [& \3 |- L1 O9 U
  583.   end
    $ K/ Q/ r$ q7 Y# y3 g
  584.   #--------------------------------------------------------------------------
    - V& q+ Q7 |8 Q/ Z$ ^7 v' v  \
  585.   # ● 判断鼠标位于菜单的第几行、第几列1 x* J$ A: k! R6 z- M3 U
  586.   #--------------------------------------------------------------------------3 D) v* E1 T2 u5 x; \  L1 p
  587.   def mouse_window_area
    $ `& d: y6 B' D# }- w1 \
  588.     if viewport.nil( E& n. u  H* v$ q+ n; }! O. |
  589.       vp_x, vp_y = 0, 0. T! k; N- L* `4 ~- N
  590.     else
    $ n; |8 s; ~% I: c# \7 ~: S
  591.       vp_x = viewport.rect.x - viewport.ox8 e8 I7 R3 q- j
  592.       vp_y = viewport.rect.y - viewport.oy
    3 Y; ~! v$ K7 M# A
  593.     end
    9 ], P" t% U: T) D' X+ J$ M
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    9 _9 h+ I3 ]% @1 w; Q
  595.     item_x1 = vp_x + x + standard_padding 0 Z4 d0 c' u7 Q# [2 M8 K% X
  596.     item_y1 = vp_y + y + standard_padding
    , G/ x3 A* P% H( G! u  Y% O0 F1 J
  597.     item_x2 = vp_x + x - standard_padding + width
    6 z4 F/ Z# X3 m
  598.     item_y2 = vp_y + y - standard_padding + height
    ( z7 f2 c# p2 a& Y2 _" C
  599.     if mouse_x  item_x12 d) o9 J; ?" |/ k) d5 R- P- T0 H
  600.       mouse_col = -15 B+ g1 N. a6 d5 A" Z" N: u
  601.     elsif mouse_x  item_x2
    ) ?& T" g  _' q# ~
  602.       mouse_col = -20 O9 k8 G, \7 u1 t9 X
  603.     elsif mouse_x  item_x1 + 160
    . l, [* L+ Q% i' b' t6 G% Q
  604.       mouse_col = (mouse_x - item_x1)322 A8 \; |* {2 h3 D7 ^
  605.     elsif mouse_x  item_x2 - 160- t' A5 b" T) v$ B" X
  606.       mouse_col = 9 - (item_x2 - mouse_x)32' L+ r. c2 h. J, }
  607.     else
    " U" j7 e. `7 @0 s' d6 k
  608.       mouse_col = mouse_x  x + width2  5  4
    ; x* t' J) y- S
  609.     end* k) y/ l; |# N' y
  610.     if mouse_y  item_y1+ m4 I  S/ R" L0 C
  611.       mouse_row = -1
    ' K$ z* {5 S/ U# W
  612.     elsif mouse_y  item_y2
    2 @& u9 l: w; Z( f5 s& S2 a1 x
  613.       mouse_row = -21 ^1 B  J9 l; K! A$ x" A# X
  614.     else
    ; U' o+ R5 Q& K0 ?+ g2 \
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)2 V1 @" M" X. M2 v, Y
  616.     end
    5 s/ z% [+ A3 k# v' d
  617.     return mouse_row, mouse_col
    * Z1 y. m& F  Y9 x; k' t
  618.   end
    3 R$ ?* w& ^  Q: k
  619.   #--------------------------------------------------------------------------
    , r+ l, X" z( t! r8 U
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置6 i$ B0 B2 I3 u2 e' D
  621.   #--------------------------------------------------------------------------
    ( C! @. o% t! ]; g# m
  622.   def set_mouse_pos) L2 R3 I0 w- N2 I; @
  623.     if viewport.nil # necessary!, e. K3 {1 F1 H+ w' D
  624.       vp_x, vp_y = 0, 0
    . z' O; \# `2 v3 @( ?: [- E* A
  625.     else6 [6 l0 D  j0 E9 D0 X
  626.       vp_x = viewport.rect.x - viewport.ox4 y% ?% H: `0 G
  627.       vp_y = viewport.rect.y - viewport.oy! A& U0 U2 x! x" |8 B  z& ?
  628.     end6 w8 a' O$ t; ?; ^) N' p
  629.     item_x1 = vp_x + x + standard_padding * v* ^' o' J# {
  630.     item_y1 = vp_y + y + standard_padding4 p) T) U- S/ `+ I! R, t
  631.     get_index = @index  0  0  @index
    4 \1 i1 J0 O+ @4 c4 e+ u
  632.     row = get_index  col_max - top_row3 M, Q9 c2 |! q5 J2 I9 i
  633.     col = get_index % col_max2 o4 c5 j+ t4 M+ Q
  634.     new_x = item_x1 + item_width  (col + 0.5)1 m% P# c+ E  A
  635.     new_y = item_y1 + item_height  (row + 0.5)' v; I: _9 ?" `( n; a
  636.     new_x += 14 if col  40 S2 q" W+ W3 V! S3 b
  637.     Mouse.set_mouse_pos(new_x, new_y)1 z( B% D9 D# F0 O3 |" c
  638.   end
    " \0 t: Z$ v$ i
  639. end
    , k, p  J, B4 [1 Y6 u# G

  640. # ]6 q: h% v/ H. y; [/ O) `
  641. #==============================================================================
    - l2 A  T7 o6 q9 r; g( V" I7 F  A
  642. # ■ Window_NumberInput
    + U) }! ~' D' G" O7 T1 o. s
  643. #------------------------------------------------------------------------------5 w: p: ^) V* `" T+ H
  644. #  重写了数值输入的方法以适应鼠标
    0 i0 V1 J% Z" o+ y; n9 j' ?
  645. #==============================================================================
    : u; l' }% V5 c8 a
  646. class Window_NumberInput  Window_Base* z$ R" d' O5 Z  s$ t  v' w
  647.   #--------------------------------------------------------------------------( ?$ ?7 \3 O& ^$ t& z/ R" v, C
  648.   # ● 定义实例变量
    . k7 ^& A5 m# \. G/ E
  649.   #--------------------------------------------------------------------------
    - K7 h5 ?2 I1 M, n6 R) p! n
  650.   attr_reader extra_window
    ( b2 E. ~/ ^, @; Q' q2 ?2 \
  651.   #--------------------------------------------------------------------------
    & ^8 O) @0 J+ V7 V7 e* e3 U
  652.   # ● 初始化' g! J1 ?8 T% X! \# N1 A2 P. x
  653.   #--------------------------------------------------------------------------
    ' t% T9 W9 b3 X
  654.   alias sion_mouse_initialize initialize
    / E5 F# E1 F0 x
  655.   def initialize(arg)
    # P+ ~: [# s9 Z
  656.     sion_mouse_initialize(arg)  g5 M% R! X( n' ~$ Y3 o& g
  657.     create_extra_window
    / Q2 y# D: E0 L+ M
  658.   end
    5 F! k/ w3 b! W  p5 H
  659.   #--------------------------------------------------------------------------& d! ~! u" e4 ^7 w& T# \% w, j
  660.   # ● 启动) I2 ]3 p) N* s& a
  661.   #--------------------------------------------------------------------------* P$ P0 K) t! N6 |1 a
  662.   alias sion_mouse_start start
    4 x/ z; j; O0 a/ F
  663.   def start$ C" P4 t7 J" x6 _
  664.     sion_mouse_start
    % D( S0 v( x& o3 P; o
  665.     deactivate  e6 l9 R& l% }+ m* t- l" T% z2 e. a
  666.     extra_start
    ! h3 O$ _4 Y& R7 C
  667.   end; Z. p# z* J, ^8 ^% m5 B5 `  v
  668.   #--------------------------------------------------------------------------2 k% Z/ B3 T6 z( n8 V" a
  669.   # ● 创建新的数值输入窗口9 n2 S+ B5 `5 o
  670.   #--------------------------------------------------------------------------9 q/ ~+ U& q% [- G+ `) q
  671.   def create_extra_window/ D+ e, @* f) @; J7 `! u/ h, X
  672.     @extra_window = Window_NumberInput_Ex.new
    ( _1 N5 p/ G: {+ p; k4 D6 n
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  26 t5 \, ^/ r) j( \' y+ }/ c6 c
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }9 _, ^$ @0 w" H$ a% Q
  675.     @extra_window.index_proc   = Proc.new {n @index = n }
    0 Z+ L  _$ B, J, K/ Z$ }0 I
  676.     @extra_window.close_proc   = Proc.new { close }$ k; [0 v* Y1 \1 a- {
  677.     @extra_window.refresh_proc = Proc.new { refresh }2 a0 S: n% u( n; h
  678.   end
    4 o' ~2 Q( g/ t: i/ j
  679.   #--------------------------------------------------------------------------
    6 B7 H+ J( j/ Z
  680.   # ● 激活新窗口
    & A1 U7 O7 |/ X% ?  l- |/ l) ?' n
  681.   #--------------------------------------------------------------------------
    - k" D" d/ @5 O+ s
  682.   def extra_start
      x4 U. |3 |/ y8 \2 Y
  683.     case $game_message.position: `  T- j! ~; g
  684.       when 0; @extra_window.y = y + height + 4+ u* K8 ?. H$ F5 o, }2 U/ c
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
      u# c4 \  f* p; c" X1 J
  686.       when 2; @extra_window.y = y - @extra_window.height - 4
    , v, v6 n4 O4 u: i3 m' G
  687.       else  ; @extra_window.y = 85 J9 ~% ]+ x) C9 m0 \' U9 C
  688.     end- B) T. L& |# [1 t+ Y; G
  689.     @extra_window.variable_id = $game_message.num_input_variable_id9 ^6 e$ J8 U$ o
  690.     @extra_window.digits_max  = @digits_max/ c9 j* y+ O3 F* C3 x
  691.     @extra_window.number      = @number" }" {4 B* |/ p$ a  _7 j
  692.     @extra_window.open1 _1 s  U$ p% I! K: p( t1 a; @
  693.     @extra_window.activate% L; E) e+ P/ E9 h/ x
  694.   end
    " m' J. N* {0 q5 |
  695.   #--------------------------------------------------------------------------1 C! F2 q/ A0 c/ `7 Y7 X
  696.   # ● 更新
    0 r5 o6 d. r7 H* O  M
  697.   #--------------------------------------------------------------------------% P- p. H1 F4 k+ o" q+ N! d
  698.   def update
    2 C2 ?6 V! Y& ]2 H, V6 q
  699.     super
    . p; h5 g$ |) N8 Z* h
  700.     @extra_window.update  E% W0 J/ h0 }- m0 v, y
  701.     update_cursor
    . z. S& F" g/ ~  R
  702.   end
    4 a5 f- t, d0 P% O% v' P# \; B) ^
  703.   #--------------------------------------------------------------------------& u1 L" B4 \1 G0 G- x
  704.   # ● 关闭窗口# D, g( U8 v3 `( e8 X
  705.   #--------------------------------------------------------------------------
    2 |( ~" `9 h6 _) ]1 h% g
  706.   def close& p7 Z+ ?3 U. R; |5 n- ~! Q
  707.     super
    0 V$ a$ H4 I- g; H
  708.     @extra_window.close
    , M* P: p$ g; ]+ H
  709.     @extra_window.deactivate6 B. s8 q! v3 Z6 t( h! l
  710.   end' t) |2 o) w0 l% Q2 k7 d
  711. end
    7 C3 U" v3 M4 c  ?7 }: ^
  712. 9 O, }# b+ e# n% V1 s* r& n7 A
  713. #==============================================================================# Y) z( @3 N7 Y
  714. # ■ Window_NumberInput_Ex( Q# L! k# q1 s
  715. #------------------------------------------------------------------------------% G' A; d+ b% }
  716. #  新的数值输入窗口(NewClass)8 s: W% \6 }8 Q, O/ C4 n" W
  717. #==============================================================================+ {& I6 [- C* V9 f/ ~# n' y; s* F
  718. class Window_NumberInput_Ex  Window_Selectable" F1 z5 t& U2 G* R% w, N
  719.   #--------------------------------------------------------------------------
    # Q8 I0 b. |! l
  720.   # ● 定义实例变量
    9 m! M, b$ d- D% q
  721.   #--------------------------------------------------------------------------
    - M5 c1 g5 s1 m% j! T- G
  722.   attr_accessor number_proc
    : G* }# k" k! }& \$ I
  723.   attr_accessor index_proc
    ' o# ^! ^$ J7 a/ r+ f1 L
  724.   attr_accessor close_proc  Y  M$ l, Q- Y$ B( Y
  725.   attr_accessor refresh_proc
      {6 q8 ?( l: j$ E! [
  726.   attr_accessor number
    & U) a6 k2 l: u; y
  727.   attr_accessor digits_max6 l: K: \9 F: ~9 z
  728.   attr_accessor variable_id
    + t; y( ]7 e4 x; U, X$ w, ]
  729.   #--------------------------------------------------------------------------
    9 V8 v) @% ]: y
  730.   # ● 数字表
    . C/ G) K8 n# [# n
  731.   #--------------------------------------------------------------------------( c$ u. E+ L5 x
  732.   TABLE = [  7,  8,  9,
    : o8 s# }6 c6 x& C
  733.              4,  5,  6,3 x# Q, ^  D( N. ~0 @7 p
  734.              1,  2,  3,
    4 P) H/ t" N/ g
  735.             '←',0,'确定',]
    & ^& |+ K5 A6 E. R9 y
  736.   #--------------------------------------------------------------------------, Q$ V/ N+ l) G" s' e) d1 U
  737.   # ● 初始化对象
    7 l5 w( V; ^  D0 B6 x, _4 }
  738.   #--------------------------------------------------------------------------
    # ~4 F* Q& H/ {; H
  739.   def initialize
    $ B, g; M8 Z; e1 `6 c6 x( d
  740.     super(0, 0, 120, fitting_height(4))
    , H$ a3 Z+ w/ }# Z  Y+ @7 H
  741.     self.openness = 0
    9 f- {# {5 {# O1 ^- p! E' r: v8 _/ n
  742.     @index = 05 D, }) E: g- z
  743.     @number = 0
    , u3 a9 t0 Y) _
  744.     @old_window_index = 0
    ) R; a1 i6 p; A4 t3 J& f* G
  745.     @digits_max = 0
    4 B0 r: S% t" a& d& J7 I
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }
    + O/ c9 S6 H4 q6 i- ?- G9 p. ?8 P
  747.   end
    % _- q  W3 r% }3 c& G* f; a" y
  748.   #--------------------------------------------------------------------------
    9 m$ \# [9 d3 F# L  r
  749.   # ● 获取项目的绘制矩形! F; a! o' l5 a7 e+ P
  750.   #--------------------------------------------------------------------------& o( n# e9 h: ]# m. h4 I$ d$ o
  751.   def item_rect(index)
    ( K! c( D. H. A5 \1 W( ]) Z
  752.     rect = Rect.new
    + N$ r4 l) A5 s9 y
  753.     rect.x = index % 3  32$ s7 {6 ]. c. |5 ?
  754.     rect.y = index  3  line_height' ^! F6 G6 O6 j3 W+ f) ~
  755.     rect.width = 32! b# i. i4 |* |2 ?( m" {1 l0 ~
  756.     rect.height = line_height
    % [5 l! x- n( B, f. I: p
  757.     return rect( M1 R9 t- G! V- z' `  X, M
  758.   end* A6 L4 A7 q1 p& S5 w
  759.   #--------------------------------------------------------------------------
    : X. b% l4 z9 E" L8 n: ]
  760.   # ● 将光标设置到鼠标所在的位置8 x0 z! z) i1 @& w. P1 x* [
  761.   #--------------------------------------------------------------------------- }; C3 F! F1 `" j* q( ?1 o; k: h# O  Z
  762.   def set_cursor7 Y0 m8 u- B7 ]$ y3 t4 r! F
  763.     mouse_row, mouse_col = mouse_window_area
    + v/ z# n7 A0 a& K
  764.     if mouse_row = 0 && mouse_col = 0
    , }7 H: x* [( d# E' G0 t, ?! r% H
  765.       new_index = mouse_row  3 + mouse_col3 ?9 M" R9 d( y
  766.       select(new_index) if new_index = 119 T6 N4 J  N. Z. i" Y
  767.     end2 H, k0 }4 @  v  u# Z
  768.   end; N; o0 E" M) X" y0 Z9 l
  769.   #--------------------------------------------------------------------------$ n8 F2 c0 _$ M  m4 W
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列2 m8 D# }' r4 ^) H
  771.   #--------------------------------------------------------------------------
      H  G7 Q" D' A4 z& s4 \* C
  772.   def mouse_window_area
    5 v  v) {+ E- V# `# B% l2 e8 M
  773.     if viewport.nil
    ! n. q9 C1 a. g7 h% a3 F8 j; x
  774.       vp_x, vp_y = 0, 0( Y% C8 Q2 x8 y# f+ [: Q2 @
  775.     else# H2 S) B( z! w' w7 ]5 \
  776.       vp_x = viewport.rect.x - viewport.ox
    ; I2 @0 g* _' N! f, o
  777.       vp_y = viewport.rect.y - viewport.oy/ U* g  x. K& B8 C1 R. r; V
  778.     end
    . [, }/ }# f$ f; i
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y4 Q1 L, d# ?) h7 S
  780.     item_x1 = vp_x + x + standard_padding
    4 v% Q; }8 ~/ y, M6 B3 |
  781.     item_y1 = vp_y + y + standard_padding
    ; G# A- M4 R) X$ _# }
  782.     item_x2 = vp_x + x - standard_padding + width
    1 L7 o, `* R0 `
  783.     item_y2 = vp_y + y - standard_padding + height
    + N( k9 t( M3 y
  784.     if mouse_x  item_x1
    4 ?( y  n1 T; V  e
  785.       mouse_col = -1; t% Z( f! S1 S1 s7 u% Q+ X
  786.     elsif mouse_x  item_x2
    / e; V$ f+ v8 m( v& V$ H) Q. i
  787.       mouse_col = -2
    ! z* h3 Q/ y7 \- A. J; G0 u
  788.     else
    2 W: T" E8 k  W: P2 L3 W7 g/ O, ]
  789.       mouse_col = (mouse_x - item_x1)  32
    * r! `/ c* N2 h5 D7 f: V8 R
  790.     end8 W3 O" `! C$ t* ~, ?/ J/ f
  791.     if mouse_y  item_y1, j' L- N1 {& p+ M8 J% ^  G
  792.       mouse_row = -1
    % G7 m5 O5 u  p5 x+ d
  793.     elsif mouse_y  item_y2
    " M# H. P; P: Y6 Q4 a
  794.       mouse_row = -2; Y1 ~2 D' ^( n6 H# j/ E6 j; M
  795.     else0 h' ?  `8 x+ P* d- C% G& r% w
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)  f5 X+ Q7 x' L3 C9 W3 r
  797.     end
    ! [* Y1 ^1 }- z
  798.     return mouse_row, mouse_col3 o/ m* q( \" V0 R5 d  s6 g
  799.   end
    - Q# T, A+ p* \% u7 s2 ~
  800.   #--------------------------------------------------------------------------
    1 \9 K. [! r% I0 F. w: [
  801.   # ● 获取文字
    + ^5 ^* w. J1 \7 m
  802.   #--------------------------------------------------------------------------
    % J9 f; E' X- Q
  803.   def get_number" u5 H/ @7 [# h/ [$ @  V! s1 q0 ^# T
  804.     return false if @index == 9  @index == 118 G* `, O, g  }( n/ @$ h4 l" G5 R$ A
  805.     return TABLE[@index]
    ( O+ B) x+ J, o# f- f7 w
  806.   end5 q  w8 Q* g; K+ h- }
  807.   #--------------------------------------------------------------------------& h8 d9 s# g! x$ Z
  808.   # ● 判定光标位置是否在“退格”上
    4 s/ x! a. _5 V9 s
  809.   #--------------------------------------------------------------------------
    8 ]# R( v8 P6 G( l
  810.   def is_delete
    ' ]: c& _; ]* H4 T
  811.     @index == 9+ o, w2 W+ m+ y+ d  N5 v0 d9 L
  812.   end
    5 Q" Z4 O/ m& I5 k7 d
  813.   #--------------------------------------------------------------------------
    " x: [$ ]# Q3 w0 p. a  Z
  814.   # ● 判定光标位置是否在“确定”上
    ! j4 V; {. S6 w( I+ [8 V: h
  815.   #--------------------------------------------------------------------------, t$ d  ]- j5 ~- Y6 S* z
  816.   def is_ok
    7 v' n7 T) T+ Q. S0 F& E
  817.     @index == 11
    ' b: C6 z3 L$ o
  818.   end
    5 }5 z' S  C9 x8 t( ~+ L; U
  819.   #--------------------------------------------------------------------------
    , V) H" }  V% Y# N2 Y' P/ k7 d
  820.   # ● 更新光标
    3 r0 l3 c1 y% P% q: F. P
  821.   #--------------------------------------------------------------------------
    8 v" t' L( Z2 B& B
  822.   def update_cursor
    ( t5 U1 _9 C5 C: A' I
  823.     cursor_rect.set(item_rect(@index))
    6 _, N2 a; z7 `, ]7 V) E2 m0 {8 G  J
  824.   end
    3 c0 W4 ]. j/ i! ^* ~
  825.   #--------------------------------------------------------------------------
    # |7 F/ k6 b* [5 e7 t* i: ~
  826.   # ● 判定光标是否可以移动
    ' b: _* W* Q$ U+ x
  827.   #--------------------------------------------------------------------------' E6 o) ?& `: T' M- T
  828.   def cursor_movable) `/ `( F2 J  x# K
  829.     active2 x6 ?) D" d, a1 B, Y
  830.   end
    * H3 C1 E( o1 C" }6 _% H' n
  831.   #--------------------------------------------------------------------------/ o( e6 x6 p6 ~+ I
  832.   # ● 光标向下移动/ L# \; x0 d$ k3 I
  833.   #     wrap  允许循环& o. Y& z2 e$ B4 U3 T3 ~1 C
  834.   #--------------------------------------------------------------------------
    1 c8 s& c$ Q' R5 v3 k5 e/ e2 t
  835.   def cursor_down(wrap)) O. i* r/ J  P& p. G- X
  836.     if @index  9 or wrap
    / ~7 v0 B* n  S' ^2 A, w0 D
  837.       @index = (index + 3) % 12
    ( _1 b" t* G/ c- N5 E
  838.     end, ?- Q3 n6 x# a9 S- T$ k6 l
  839.   end* g" g1 W, _( y8 ~6 N
  840.   #--------------------------------------------------------------------------
    ( q( ]) m" @1 q7 R+ [  \; c9 Q& R
  841.   # ● 光标向上移动+ i4 {2 K; l# s. z7 {" x
  842.   #     wrap  允许循环
    / N8 F5 Z! [7 V4 I8 B, B1 x) p
  843.   #--------------------------------------------------------------------------
    , c0 J% n% a! x% ?+ K4 g
  844.   def cursor_up(wrap)
      C5 y' l7 m7 Y5 L" p( _
  845.     if @index = 3 or wrap
    + Z$ o7 i+ r3 X2 y& T' T  B
  846.       @index = (index + 9) % 12
    1 ?8 e$ w' q* N  H( B
  847.     end4 S5 e0 \- }/ A( _- `+ h! ~$ U
  848.   end
    . h4 f7 q) K3 I
  849.   #--------------------------------------------------------------------------! [# k2 _" @: Z/ x8 f
  850.   # ● 光标向右移动
    + T, Z- d2 B: I9 J" k
  851.   #     wrap  允许循环  p8 Y+ V) O  x' }" t
  852.   #--------------------------------------------------------------------------6 W9 P' y/ x1 W$ j! D
  853.   def cursor_right(wrap)
    9 o+ ~+ N( }4 v' c* V" s0 c
  854.     if @index % 3  2
    & ^& B- O5 \! g  _4 a( `0 i
  855.       @index += 1% _2 D$ Q, o4 t: b5 l5 Y8 [) _
  856.     elsif wrap6 I5 [, A7 Y2 N4 m% }+ A
  857.       @index -= 2
    6 \* }0 Q, X9 D: }
  858.     end
    8 l3 z8 w* U! U8 L! g7 y& |5 ~: j
  859.   end
    1 j) p4 K; q+ I1 ?; [* W- h  X; z
  860.   #--------------------------------------------------------------------------
    9 F4 O) y, r3 [# G$ c8 L; _
  861.   # ● 光标向左移动0 `9 t- f1 W8 L7 n& h3 K" V3 r
  862.   #     wrap  允许循环( b9 ~- }# e  H: v
  863.   #--------------------------------------------------------------------------# W+ a5 N( q/ M$ v8 }- w
  864.   def cursor_left(wrap)$ b7 ]6 F- H* V: z" i9 P
  865.     if @index % 3  0& M! |& @6 a' ^# r' X0 Z
  866.       @index -= 1; V4 O5 b  R8 P* |
  867.     elsif wrap
    3 N' h2 ?! g7 A  i& l! s/ d( L
  868.       @index += 2
    8 `* ~" F. @0 r! ^5 w: N6 @$ K
  869.     end9 }/ D3 Q* Q- r& G- c6 F) ^
  870.   end" |( P6 C9 X# q* B4 W0 ^3 c/ J
  871.   #--------------------------------------------------------------------------; L8 ~! n! J- Q
  872.   # ● 处理光标的移动$ F% y; Z  r4 v: r, ?8 E, k
  873.   #--------------------------------------------------------------------------2 k* w. Q5 `* c! \. \
  874.   def process_cursor_move
    ( y. D0 |/ d/ I
  875.     super
    0 ^$ I: ?6 M7 A& U. o: Z# N+ b
  876.     update_cursor
    4 R' N: A! Y# F) s
  877.   end
    $ S+ K# i7 a8 c$ |* L8 @- [/ V
  878.   #--------------------------------------------------------------------------5 ~9 ]$ N: e9 W! e2 n. {* N
  879.   # ● “确定”、“删除字符”和“取消输入”的处理
    , E! _* J2 z3 w, G, Z& ^
  880.   #--------------------------------------------------------------------------* b- v) Y7 a. \$ N
  881.   def process_handling5 ]" H) X7 Y) m' {" ]3 ]
  882.     return unless open && active$ I- g8 d( C/ |/ P" _% o# e
  883.     process_jump if Input.trigger(A)
    + \& `, G7 q$ k$ q
  884.     process_back if Input.repeat(B)2 q: f9 D% \0 r  f: I0 c7 O
  885.     process_ok   if Input.trigger(C)/ u& Y1 Y$ ?0 R' i) h
  886.   end
    8 s- w, {! d' O0 L, |8 \
  887.   #--------------------------------------------------------------------------
    . \! d2 U4 G9 s1 ?) \6 p
  888.   # ● 跳转“确定”
    . Z0 |5 H0 F  B  k7 `
  889.   #--------------------------------------------------------------------------
    2 b( o2 r% H# d$ d: Z: [) t6 o
  890.   def process_jump
    ! H9 i0 X( e/ i* E$ M6 c
  891.     if @index != 11: C6 M( q: Z8 G) m4 z' x
  892.       @index = 111 t; m8 @+ k# y* ~6 o
  893.       Sound.play_cursor6 l4 M) @% w  h$ e7 c
  894.     end
    3 L; t# I, v4 G2 B  G
  895.   end
    - |  ^6 |0 J3 E1 s
  896.   #--------------------------------------------------------------------------4 Q4 ?8 o. Z3 D' |+ U3 `
  897.   # ● 后退一个字符
    / g* l7 u, m0 B  H% d* _
  898.   #--------------------------------------------------------------------------1 H5 \6 l6 ]& C
  899.   def process_back8 W7 K5 s7 S8 m/ r2 t) x- y1 S: d
  900.     Sound.play_cancel$ H$ d* ~6 O5 d' w8 R( ?
  901.     place = 10  (@digits_max - 1 - @old_window_index)
    . I3 p9 c/ M) K& Z4 j8 W
  902.     n = (@number  place) % 10
    ' U5 N. Q: C2 g& T. f
  903.     @number -= n  place
    : [+ Z0 Y- P9 m* c3 q
  904.     @number_proc.call(@number)2 Q7 P9 v- I. I2 M. l" \
  905.     @old_window_index -= 1 if @old_window_index  0
    # V  i2 o$ V% u0 }3 ]* Y( G
  906.     @index_proc.call(@old_window_index)
    ' y! B- W' z4 `6 D
  907.     @refresh_proc.call
    1 ^" [( U& r; n7 X. ~/ U
  908.   end
    2 R/ b( Z7 k- ~5 H% J4 w
  909.   #--------------------------------------------------------------------------
    % @( y4 z' n9 ?8 O$ A( o9 t, |
  910.   # ● 按下确定键时的处理8 I6 h" x' e# ^( s) _+ X
  911.   #--------------------------------------------------------------------------/ n9 s) z, X1 h" {' P& R" P
  912.   def process_ok
    + \4 k6 ~) O/ p; m4 @2 g3 Z( b6 f
  913.     if get_number% Q1 d' V( E6 s$ o
  914.       Sound.play_cursor: T% |1 _: {- U( t
  915.       place = 10  (@digits_max - 1 - @old_window_index)
    8 H+ N5 s. X. E0 a3 x* [
  916.       n = get_number - (@number  place) % 10
    ' Q/ O7 Z9 H! q* [6 E
  917.       @number += n  place- q: C6 f: h; k  \! `
  918.       @number_proc.call(@number)
      r$ Q; F, b2 J$ a: q
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1
    , _7 p/ N1 Q: q: h9 D( ?
  920.       @index_proc.call(@old_window_index)
    0 {6 k" a1 x% Q
  921.       @refresh_proc.call1 V& ?1 a2 y6 Q; @
  922.     elsif is_delete. t  j3 I" }: R+ T# Z
  923.       process_back& ]; r9 b7 y% ?2 b6 r
  924.     elsif is_ok9 \+ G' M5 L0 [- h' O# V. ?
  925.       on_input_ok0 D; ?& z! @" t  y2 @! }
  926.     end
    * e" H) O2 `' w3 [
  927.   end! ^# @  V* m0 T) O) ^0 n
  928.   #--------------------------------------------------------------------------
    " |* b/ J7 c$ q- a# q. x9 \, E
  929.   # ● 确定
    , i, y8 ~$ a$ x" a9 P9 Z
  930.   #--------------------------------------------------------------------------( t8 u, x$ {/ x: U
  931.   def on_input_ok5 c5 V$ k$ B3 q  C
  932.     @index = 0
    % P$ `: E2 Z% F! h4 O7 V
  933.     @old_window_index = 0- P# G0 x3 |! E- E1 E
  934.     $game_variables[@variable_id] = @number, R4 n& D0 v/ R$ W
  935.     Sound.play_ok! b9 q3 o. W4 e2 K# q- k
  936.     @close_proc.call+ V5 f" p/ z+ @3 Q
  937.   end
    " T) z) e9 O. u6 J# c/ z
  938.   #--------------------------------------------------------------------------
    7 g$ i$ O) Q! F8 N& k1 E
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置+ o4 z3 U1 Z5 X! S. g. v9 w3 A
  940.   #--------------------------------------------------------------------------, z' ], ?; x& L& i* I
  941.   def set_mouse_pos8 e  X$ e7 d8 [; |: }
  942.     if viewport.nil # necessary!2 ?, o$ ?' F0 K- f7 b* Q; v, M
  943.       vp_x, vp_y = 0, 0
    - l+ ?# L# R& Z8 C
  944.     else; S0 B- M1 J- ^' s+ r5 Y
  945.       vp_x = viewport.rect.x - viewport.ox
    / b6 z+ X. L1 d# ^' e* D' M# @( F- v
  946.       vp_y = viewport.rect.y - viewport.oy" C6 G$ V; I& ^# o) D: K
  947.     end
    8 C9 i4 E2 _$ ?3 ?& Z: t
  948.     item_x1 = vp_x + x + standard_padding
    5 F& d1 Q+ x, a1 U1 I
  949.     item_y1 = vp_y + y + standard_padding
    " d/ {4 n6 x# u3 ^
  950.     get_index = @index  0  0  @index
    3 Z7 D! S/ t; l3 w6 V* R5 B
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)
    ' ^: K! L+ R  x7 J" w
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)
    + S" R5 M" U# V; Y3 ]* ^
  953.     Mouse.set_mouse_pos(new_x, new_y)
    % E7 p9 |- |$ ?, F0 X. j5 T) ]
  954.   end
    : z: O6 S  [) W
  955. end
    % Z9 h5 p' X8 T, I1 c" g, P: H; I
  956. 9 Z0 B' D0 N$ I; z# w
  957. #==============================================================================
    ) X+ f, r5 i7 f, @6 t  \- v
  958. # ■ Window_Message
    . r' |  B$ j2 C5 ~
  959. #------------------------------------------------------------------------------4 t' G; O6 c" Z/ T
  960. #  显示文字信息的窗口。
    + c2 y/ I) S$ t6 C. |; q; A' z
  961. #==============================================================================$ g. P. W9 m! W" t) L
  962. class Window_Message  Window_Base4 ~+ i* C& k5 l$ F( G4 ]
  963.   #--------------------------------------------------------------------------
    6 p9 e* D2 E8 r8 p, l
  964.   # ● 处理数值的输入(覆盖原方法)
    3 F3 Z' a& w: `& D* L
  965.   #--------------------------------------------------------------------------
    % Z- J( z! N% J
  966.   def input_number; ]" {7 Y, ^" Q! \1 H
  967.     @number_window.start
    4 d2 V6 K7 @0 `
  968.     Fiber.yield while @number_window.extra_window.active9 K7 d6 f. ?0 `1 l- c0 a: q
  969.   end6 g# E6 Q2 j* r5 c  ?! u, A
  970. end
    & k8 N; c* k! ?7 Z
  971. ; r3 g: M) a2 D1 L& N
  972. #==============================================================================' [# l3 \+ w, k3 |5 x1 l
  973. # ■ Window_PartyCommand
    % X. S9 [* d+ F; g- W
  974. #------------------------------------------------------------------------------9 ]9 H& G' q- @3 |- \* R
  975. #  战斗画面中,选择“战斗/撤退”的窗口。0 ~: j  s8 \9 Z8 ~9 ~
  976. #==============================================================================; ]( d0 M  d; [- y; u& |6 ^7 k
  977. class Window_PartyCommand  Window_Command
    ( O; }6 `, q5 E* b
  978.   #--------------------------------------------------------------------------
    ) B2 K0 T/ `# n6 N7 `
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    , }; F2 N- g! ^" I: ^6 u8 |0 b
  980.   #--------------------------------------------------------------------------
    2 @8 C: Q) a) X% I: D
  981.   def set_mouse_pos
    5 k- F. \1 ~# w+ @0 b( f
  982.     if viewport.nil' p1 t9 Y) N) i3 i; }
  983.       vp_x, vp_y = 0, 0
    ( n1 c" }9 {5 y( @
  984.     else! D# y1 `- n' ?
  985.       #vp_x = viewport.rect.x - viewport.ox
    ; {# V7 q! s6 N% X: J" x3 O2 e, S
  986.       vp_y = viewport.rect.y - viewport.oy
    2 x6 s2 v# l2 Q2 `5 X6 n9 h
  987.     end9 h: M" h8 ^# `# w0 G5 [
  988.     item_x1 = x + standard_padding
    / N; b/ C/ ]/ I/ a" ?  h3 P% z0 M
  989.     item_y1 = vp_y + y + standard_padding
    2 l0 G7 d% X5 F4 U& _( b- Z
  990.     get_index = @index  0  0  @index
    " W! g8 a( s" G' j& s
  991.     row = get_index  col_max - top_row
    9 w7 a: u2 ?9 t8 ?
  992.     col = get_index % col_max% Q0 [8 \7 I4 P. X+ g: _, v
  993.     new_x = item_x1 + item_width  (col + 0.5)% u- y% q( h: e
  994.     new_y = item_y1 + item_height  (row + 0.5)
    9 \, u. p' {+ c4 {$ B$ G) F4 V
  995.     Mouse.set_mouse_pos(new_x, new_y)  C6 Z1 z3 j# f7 Q
  996.   end
    ) h3 g$ U, c8 y8 U' D
  997. end; o* s) W( t+ x  O) K
  998. & g& ~( O6 O, N# e' v
  999. #==============================================================================. n3 ~( L$ M5 y' G; y! W3 K
  1000. # ■ Window_ActorCommand/ @4 d3 C+ R% E  Q+ K
  1001. #------------------------------------------------------------------------------
    : V) C9 `  n- M8 l" Z# ?
  1002. #  战斗画面中,选择角色行动的窗口。1 e6 S9 g, g( U+ a# q
  1003. #==============================================================================
    & D; l/ [3 f3 a
  1004. class Window_ActorCommand  Window_Command
    8 u- ~- a! v  F; P
  1005.   #--------------------------------------------------------------------------6 a5 I# i. a' c0 G9 D
  1006.   # ● 方向键移动光标时将鼠标移动到对应的光标位置% y4 L( t7 V2 H6 j: y
  1007.   #--------------------------------------------------------------------------9 L% `1 b$ B( m. }
  1008.   def set_mouse_pos
    0 x7 [: L' ^) g6 N/ Z
  1009.     if viewport.nil
    ' Q/ I$ I, b! y" m/ \4 F/ G
  1010.       vp_x, vp_y = 0, 03 n( \2 P+ o) K. E& }
  1011.     else
    5 G( F5 ?% A) k* I, |- R
  1012.       #vp_x = viewport.rect.x - viewport.ox
    ' }* {' x% b- H( {% t$ d1 g
  1013.       vp_y = viewport.rect.y - viewport.oy  N1 `* ?( v+ B' V' G3 U: B4 ]/ ?
  1014.     end' _1 @9 t! s4 d, p5 s# `1 I
  1015.     item_x1 = Graphics.width - width + standard_padding
    " _) c+ G: s) ?, G. F
  1016.     item_y1 = vp_y + y + standard_padding  l4 }6 `7 a7 c$ l2 ?% E$ N3 m
  1017.     get_index = @index  0  0  @index : D5 F' q. L: R/ _* p& Z* @
  1018.     row = get_index  col_max - top_row  l( h/ {2 K* ~# L( n5 L0 K
  1019.     col = get_index % col_max  `+ N. j( h, D7 S& }  }( W
  1020.     new_x = item_x1 + item_width  (col + 0.5)+ L0 _5 c# S7 ]+ t
  1021.     new_y = item_y1 + item_height  (row + 0.5)1 F  K9 G/ w: ]- r5 @- i
  1022.     Mouse.set_mouse_pos(new_x, new_y)& W# G" A* A% R3 {! @
  1023.   end3 M. G. b. |! |0 O
  1024. end+ y! {' [. T- p4 F2 s, t5 p
  1025. 2 ]4 Z* k/ V) K
  1026. #==============================================================================
    & F3 G2 w- g# f& J; g' ^  K# J6 D
  1027. # ■ Game_Player" _7 Y7 g- `$ K
  1028. #------------------------------------------------------------------------------! s5 @. a( k7 F' x/ ?
  1029. #  处理玩家人物的类。拥有事件启动的判定、地图的卷动等功能。' g, E. [1 p% O, ?  N
  1030. #   本类的实例请参考 $game_player 。1 b: d# b' V0 r. K: y' c
  1031. #==============================================================================3 C) S& p( Q( U; H  `) U
  1032. class Game_Player  Game_Character. k2 M1 }) G! K  {
  1033.   #--------------------------------------------------------------------------- t0 Z4 _" s9 m5 f1 j. H% M
  1034.   # ● 由方向移动(覆盖原方法)
    % B! m3 W7 l, @4 o2 M+ p# L
  1035.   #--------------------------------------------------------------------------, I8 ^0 f( U% c  w/ o1 H0 f; j
  1036.   def move_by_input
    - E1 N2 h1 L9 l! z' O4 o) W
  1037.     return if !movable  $game_map.interpreter.running
    % d9 W. j8 H: ~9 k# e
  1038.     if Input.dir4  00 P* S7 N6 W& j% m) x. N7 X1 c
  1039.       move_straight(Input.dir4) 2 b: T% E3 Q2 q/ C* F6 W( j4 g5 H
  1040.       reset_move_path
    ' c4 t* j, i0 b* t. E  F4 [2 [
  1041.     else
    , u6 ]+ y) A7 O, j' `# n' J
  1042.       move_by_mouse
    ; v% M9 v6 F$ K1 {( o6 Y3 }
  1043.     end
    ! M( l3 ~* F/ e5 c0 l3 e
  1044.   end# u* Q& x2 S2 @# g4 }  o
  1045.   #--------------------------------------------------------------------------
    9 N8 F8 e! A9 M( g5 s
  1046.   # ● 非移动中的处理(覆盖原方法). D5 U1 C% `8 J- d% [
  1047.   #     last_moving  此前是否正在移动
    + j* g- F# g& i3 a
  1048.   #--------------------------------------------------------------------------# ?  Z5 M: Z7 A+ \3 w& O5 N& d+ o* p
  1049.   def update_nonmoving(last_moving)
    ) ]- T9 U' J5 d+ o7 Z1 G9 ~4 {& U
  1050.     return if $game_map.interpreter.running, i1 A# @( z. }
  1051.     if last_moving
    & F: k5 J- s; U+ I) e2 L# n) v
  1052.       $game_party.on_player_walk
    ) a5 W  j7 }& I  X/ D7 h$ s
  1053.       return if check_touch_event
    8 l* b( o) p$ ~7 {9 P
  1054.     end
    % g0 z" M& S$ z( m' D2 c3 i
  1055.     if movable && Input.trigger(C)  T1 c; ^) |, G3 {2 e  i) G" o
  1056.       return if Mouse.press(0x01) # 防止按下鼠标左键绘制路径时触发事件或载具切换
    5 M6 b' T. l4 ?) J
  1057.       return if get_on_off_vehicle
    ) s/ w+ x+ |' m+ L
  1058.       return if check_action_event* w, p( ^1 o6 _2 r: F, s
  1059.     end$ z/ Q$ m6 l" ]$ L
  1060.     update_encounter if last_moving! K8 s# |0 Z3 U: h7 p+ O
  1061.   end7 t* S4 Z9 H- `8 C
  1062.   #--------------------------------------------------------------------------3 h- [( O) k) z; \, b& U2 i
  1063.   # ● 判定是否跑步状态(覆盖原方法)7 |# [* m4 n* L( n, ?
  1064.   #--------------------------------------------------------------------------' Z' p8 F$ b# d) S, ]1 r
  1065.   def dash0 ]: S  m5 v- T0 n. O
  1066.     return false if @move_route_forcing
    * T6 l( E( B& z8 K
  1067.     return false if $game_map.disable_dash  l7 {5 @5 y& H+ B! ?
  1068.     return false if vehicle
    , s- `1 E" q' G4 |4 A5 Q  f% X
  1069.     return Input.press(A)  @mouse_dash& d' D8 t! w, y  T
  1070.   end
    : W8 K! n# |( f+ T
  1071.   #--------------------------------------------------------------------------! d$ w6 U) y' [# Y1 z3 |
  1072.   # ● 初始化$ b$ D) i* U0 ], c
  1073.   #--------------------------------------------------------------------------% D. S) ~- @% p
  1074.   alias sion_mouse_initialize initialize
    4 J; T$ \& D8 d/ c) k' E# ?
  1075.   def initialize4 ~$ V4 P& O( j0 b( [% T5 l
  1076.     sion_mouse_initialize
    - Z/ g1 F/ `, e1 H% D
  1077.     reset_move_path; j9 f2 v) I+ m+ T, m0 E
  1078.     @moveto_x = 0
    4 z* \1 P: B0 ?% ~; J1 W
  1079.     @moveto_y = 0% Y: o  k' C; G5 ~
  1080.   end& L2 O" X# h" u+ g# l
  1081.   #--------------------------------------------------------------------------
    # J5 w+ m5 U* u0 G  A* T  R
  1082.   # ● 更新& Z" y- ^8 A; I9 t" w7 M& @4 T
  1083.   #--------------------------------------------------------------------------) d$ }3 _) c+ [" n0 [. `
  1084.   alias sion_mouse_update update. k0 |" n& b& \. c$ r# R
  1085.   def update
    * w" y$ x7 {) a6 O* j* x, z, D! @
  1086.     sion_mouse_update. R. }* }, {4 P; ?) m6 G0 W% D) H' J
  1087.     clear_unreachable_sign
    3 u6 X/ @8 D5 u; Q6 ?
  1088.   end& r' X( j5 n4 `; K6 c# V
  1089.   #--------------------------------------------------------------------------
    , ^& m! p9 V  [6 c% T
  1090.   # ● 处理卷动- k! B' |3 ^: [
  1091.   #--------------------------------------------------------------------------$ c! m" s: N; `5 T8 [
  1092.   alias sion_mouse_update_scroll update_scroll
    % {5 g4 V4 R' j
  1093.   def update_scroll(last_real_x, last_real_y)
    : X% I/ }) ?9 ]9 V  T6 K
  1094.     return if $game_map.scrolling
    . a; I$ l- R" a5 a$ Q
  1095.     KsOfSionNew_Scroll  new_update_scroll 0 s8 H5 L/ S0 U9 Z
  1096.       sion_mouse_update_scroll(last_real_x, last_real_y)" Z! W2 O' e/ S+ F# E) z* v8 l: u
  1097.   end
    2 l& ~' k! G! ?- l$ F  B. ^
  1098.   #--------------------------------------------------------------------------
    & h( b, x4 N( O7 b
  1099.   # ● 重置移动路径相关信息
    + R$ [% A4 r1 F. R8 x  i6 R
  1100.   #--------------------------------------------------------------------------
    . U& s9 v0 E: y' k
  1101.   def reset_move_path
    0 |* ?$ Q( J, A! N5 Y% r* X+ D0 b/ B
  1102.     @mouse_dash = false8 L" K+ x: I' i$ o- N2 T/ `
  1103.     @mouse_move_path = []
    $ N9 z/ g: g' v
  1104.     $mouse_move_sign.transparent = true+ T' w2 }  i6 u; X
  1105.   end" e' W5 ~9 W1 \# u
  1106.   #--------------------------------------------------------------------------! f; a8 J2 b8 m' }/ j" [3 G6 {- d( \
  1107.   # ● 新的卷动地图方法$ _- V9 [7 j+ p
  1108.   #--------------------------------------------------------------------------
    " c4 c8 E8 L7 ?
  1109.   def new_update_scroll8 z' P4 G" m4 N# O. U
  1110.     horz_speed = 2  @move_speed  KsOfSionMap_Scroll_Spd  Graphics.width
    3 W0 r( ^6 v1 R5 K
  1111.     vert_speed = 2  @move_speed  KsOfSionMap_Scroll_Spd  Graphics.height
    , y& }$ ^# M1 b/ T2 b2 z! J
  1112.     ax = $game_map.adjust_x(@real_x)) `' a5 e* j1 a9 b+ N
  1113.     ay = $game_map.adjust_y(@real_y)1 k- o$ h, c8 J$ N8 |
  1114.     $game_map.scroll_down (vert_speed  (ay - center_y)) if ay  center_y
    % z- K8 `6 z: a2 L7 x7 V
  1115.     $game_map.scroll_left (horz_speed  (center_x - ax)) if ax  center_x/ T# z! \3 D) J6 q" Y" S( c
  1116.     $game_map.scroll_right(horz_speed  (ax - center_x)) if ax  center_x
    ) W. [5 M: J% P) w1 p
  1117.     $game_map.scroll_up   (vert_speed  (center_y - ay)) if ay  center_y
    ; M6 o& @& I9 I% x4 g+ u
  1118.   end
    ) \1 p7 g  U( g% }. v( t. ?& N
  1119.   #--------------------------------------------------------------------------' L, L6 j: {1 P
  1120.   # ● 消除不能抵达图标, |' E" \: _6 @# C. z9 |/ N+ W
  1121.   #--------------------------------------------------------------------------* w" O1 L; F  q5 x$ H
  1122.   def clear_unreachable_sign7 @  F0 M4 c8 f8 n4 J
  1123.     return if Mouse.press(0x01)
    4 J9 @( {; w+ v9 }: L
  1124.     if $mouse_move_sign.direction == 4 && Mouse.click_count % 20 == 0* W( y- o. }3 c7 R7 K4 n0 z% n- ^% Y
  1125.       $mouse_move_sign.transparent = true
    & k3 {$ I: y6 v3 a! m
  1126.       $mouse_move_sign.direction = 2; }- ?0 X( Y# Y) g
  1127.     end) m2 }+ G% H# @, k& d# A
  1128.   end
    7 C" b: s3 z1 a
  1129.   #--------------------------------------------------------------------------
    . e( n' k3 L2 s
  1130.   # ● 由鼠标移动# ^! W& y# m, V+ p7 t+ U. R
  1131.   #--------------------------------------------------------------------------" r, v2 e* w- c, H5 s" H$ s
  1132.   def move_by_mouse( i$ r  X6 _( w$ A" c9 E$ ?
  1133.     unless @mouse_move_path.empty # 移动路线数组不为空则执行移动8 v; Q  ]% [" u' c+ Q
  1134.       dir = @mouse_move_path.shift
    " B' R& P4 k3 M% v7 ^8 y
  1135.       if passable(x, y, dir) && !@mouse_move_path.empty7 Z+ J0 Z0 A* _4 l# k* Q
  1136.         move_straight(dir)& f; t4 l+ d7 A! h" `
  1137.       elsif @mouse_move_path.empty # 判断是否是最后一步
    6 H/ H, t/ D" U9 n% m
  1138.         x2 = $game_map.round_x_with_direction(x, dir)
    7 P0 N& G, |6 P3 o' ?3 z/ s
  1139.         y2 = $game_map.round_y_with_direction(y, dir): J( w5 v/ A0 n" g( q. c
  1140.         move_straight(dir) unless dir.zero
    , f3 T$ s- Z& @5 f  _3 i7 y
  1141.         unless x == x2 && y == y2 # 如果移动失败,检查是否启动前方事件、上下载具3 ?1 @2 ^1 S( p0 j$ ^- V6 N
  1142.           check_event_trigger_there([0,1,2])
    + V+ H  l! j: S- W! f' A( {3 F
  1143.           get_on_off_vehicle unless $game_map.setup_starting_event
    ; k) t, r  h7 R
  1144.         end2 T! F4 I1 V' o3 N$ Y: T
  1145.         $mouse_move_sign.transparent = true if $mouse_move_sign.direction == 20 _4 K* K. Y* i4 }
  1146.         @mouse_dash = false
    , t9 g* w; T0 e7 j* }) ~& d
  1147.       elsif @mouse_move_path[0].zero # 目标点无法抵达,调整朝向→目标点
    3 l6 `# G+ ?) M+ h8 Y! p+ \9 W
  1148.         @mouse_move_path.shift
    : b& S: C6 P/ j% h
  1149.         @direction = dir2 t9 f9 D; A; ~0 M  }3 v, [8 e: Q
  1150.         @mouse_dash = false
    ; }. w& c& ]' n5 K' o8 s7 ^
  1151.       else/ R; i, f9 t/ w4 M2 `$ Z% ~
  1152.         draw_move_path
      U2 [; h# `' m6 f% ~
  1153.       end
    " Z6 D2 l, [2 d7 |- S4 P
  1154.     end" O& I. }3 c  g$ u# b  R
  1155.   end3 @. y5 X, x! [' p: I
  1156.   #--------------------------------------------------------------------------
    & c* }3 L5 W# W, }6 C
  1157.   # ● 地图界面按下鼠标左键的处理  e2 `$ [* @8 h
  1158.   #--------------------------------------------------------------------------
    0 B( M: a$ u5 V2 q5 s8 ?
  1159.   def left_button_action
    1 N, }( ]: v- o3 Q0 `* u
  1160.     return if !drawable  $game_map.interpreter.running9 ^$ r, o+ i$ w& g# J
  1161.     get_mouse_pos1 V% c1 ~+ v  I4 ^
  1162.     $mouse_move_sign.moveto(@moveto_x, @moveto_y) # 移动路径点指示图
    4 H1 L+ b% |9 a$ ?& z/ d6 x
  1163.     if @shift_event
    + p4 T/ G0 ?; N' P- T1 ?
  1164.       if Mouse.trigger(0x01)
    3 E2 @: h5 X; j- g; F
  1165.         @shift_event.jump(@moveto_x - @shift_event.x,
      }& w- ~% v# D
  1166.           @moveto_y - @shift_event.y)
    " p: q% K: @$ M6 O8 J. p) S0 t6 B
  1167.         @shift_event = nil
    0 f; f: S9 O" F5 V4 u2 w2 U
  1168.       end) i4 G6 W: \8 o1 R$ @* w7 i
  1169.       return+ \4 T; b/ N: p: j3 t
  1170.     end0 \/ g! ^8 f) z% z& D7 o
  1171.     if @moveto_x == x && @moveto_y == y # 判断目标点是否与角色重合
    ) A- {3 [2 t/ c! r6 b, l$ ~/ G4 G
  1172.       return if moving  (vehicle && !vehicle.movable)& z* x  Y6 b, N& B1 S6 b7 g
  1173.       check_event_trigger_here([0]) # 判断是否触发重合点事件
    + Z: o3 o4 b  K: @( e7 ^7 j
  1174.       get_on_off_vehicle if !$game_map.setup_starting_event &&
    9 X$ b# h3 b- \/ O
  1175.         $game_map.airship.pos(x, y)  # 判断是否要上、下飞艇
    . f' A0 n  S+ j: }* K
  1176.       return
    ; z9 D6 p& s0 f2 P0 N' ~
  1177.     end
    ( e0 f; \% `% n  K  Y
  1178.     # 判断是否用鼠标启动事件. M1 m+ V- \: H% l1 l) P
  1179.     $game_map.events_xy(@moveto_x, @moveto_y).each do event
    ' m# K4 E# l+ ^6 `# h* `3 C& b
  1180.       if event.mouse_start2 K( _, s. i! J8 V1 f# t" j. A9 w
  1181.         reset_move_path( R+ f% X3 Z' U2 H* Q
  1182.         event.start if Mouse.trigger(0x01)
    ' A' U" D& T" ]+ r# b5 e
  1183.         return
    % [& X+ C& e  }
  1184.       end% m) @- u4 k  B* I5 h  Q
  1185.     end
    ; n! P0 `/ s6 Q( ]" v
  1186.     @mouse_dash = true if Mouse.double_click # 双击冲刺: o; s. z( [+ a: \- n
  1187.     return if Mouse.left_state % 10 != 1 # 按住鼠标左键10帧绘制1次路径) A. O, w, h) U6 C2 ?
  1188.     for i in 1..4 # 判断目标点是否为角色周围四点+ A9 ]& [' F# v8 M& K
  1189.       if x == $game_map.round_x_with_direction(@moveto_x, i  2) &&; o$ p, D: h! Y9 h
  1190.          y == $game_map.round_y_with_direction(@moveto_y, i  2)# V% ^$ o( X( e
  1191.       $mouse_move_sign.transparent = true
    & k9 h( |. v2 v- z! W, G
  1192.       @mouse_move_path = [10 - i  2] if Mouse.trigger(0x01)
    ; r0 o, I& U$ f& S# X( a3 O
  1193.       return; end
    $ k* ~* M9 m3 k& B# W2 X
  1194.     end, p1 x2 T' ~; H, D) b- o
  1195.     draw_move_path0 N7 C  e% w# U6 j# [
  1196.   end. b" h/ W) F6 K! K5 e7 t3 ~7 g
  1197.   #--------------------------------------------------------------------------
    " T& g& G0 G2 E1 B1 c1 w9 X
  1198.   # ● 取得鼠标处对应地图坐标点
    / p1 `& m8 e' w0 f& G6 I+ ?; `
  1199.   #--------------------------------------------------------------------------
    / g7 D7 q: t" _* X6 Q
  1200.   def get_mouse_pos
    7 Q1 V! {0 R3 _6 q
  1201.     $game_map.get_mouse_map_xy
    " y9 W$ G' X4 d0 p5 G; [
  1202.     @moveto_x = $game_map.mouse_map_x4 N  w# \6 R3 m1 ?) m+ ?% _3 x
  1203.     @moveto_y = $game_map.mouse_map_y
    ( j+ ?  X- u7 q& U* s& u' v+ r; @
  1204.     #mouse_x, mouse_y = Mouse.get_mouse_pos) o. e" Z& x! H  m+ H. ?2 P  Z0 I
  1205.     #@moveto_x = $game_map.round_x(x + (mouse_x - ! i# P8 A8 c4 x  `3 X" T
  1206.     #  ($game_map.adjust_x(x)  32 + 16).to_i + 16)  32)( B+ W- V% p* H# C. \
  1207.     #@moveto_y = $game_map.round_y(y + 1 + (mouse_y -
    6 e5 A) m( e+ F
  1208.     #  ($game_map.adjust_y(y)  32 + 16).to_i - 16)  32)
    5 D. |. z7 ^$ c0 e) x
  1209.   end( R" B- {1 ?% u6 L, P
  1210.   #--------------------------------------------------------------------------% R3 W8 f8 G/ Z3 Q( t; N2 m
  1211.   # ● 绘制移动路径 @array[move_directions...]
    2 N2 S- ]( f8 R8 X$ Z
  1212.   #--------------------------------------------------------------------------
    / M) q$ k  e# }: H8 u; a. D
  1213.   def draw_move_path3 p& y; h& u4 L# H0 x- ^' z7 A
  1214.     #temp = Time.now
      B# ^2 k! S6 ~" C8 K7 K# g
  1215.     case @vehicle_type
    5 ]; S6 e4 e* b& ~4 J3 G7 N
  1216.     when walk
    0 f2 r! t, n0 \4 c! n
  1217.       draw_walk_path
    * M1 Q9 l/ j; X& _  _
  1218.     when boat
    & d( ~- P/ j6 o* ]; Z
  1219.       draw_boat_path
    2 o, [+ \9 k- P& y/ u. g1 \# \
  1220.     when ship
    9 d* r" E: q0 a" _
  1221.       draw_ship_path0 V4 I2 H* q+ U7 J
  1222.     when airship
    5 J; r0 `( M0 z$ Y( G
  1223.       draw_air_path. q$ ^) f+ T. \3 M( K7 M' ?
  1224.     end" u; D0 l6 z8 O* C6 A/ a
  1225.     #p (Time.now.to_f - temp.to_f) # 测试效率
    , j, |. i7 n. W
  1226.   end
    2 @5 Y4 l' ?# \% _$ y; C: u* {# c
  1227.   #--------------------------------------------------------------------------# w5 f) Y& e" X0 Y: j( o4 H
  1228.   # ● 判定是否可以绘制移动路径
    3 \2 `1 c7 U& ~- ]' Z
  1229.   #--------------------------------------------------------------------------
    ( S- \. d2 r/ C2 w- }) E! p
  1230.   def drawable$ }; l5 b/ @& \; l+ b' s- W, f/ Y
  1231.     return false if @move_route_forcing  @followers.gathering
    7 f  t+ P$ [2 h
  1232.     return false if @vehicle_getting_on  @vehicle_getting_off
    - E( Q  X0 o0 |% t& G& w' ^) S
  1233.     return false if $game_message.busy  $game_message.visible0 w/ H( z5 W- y) q& W* K) |
  1234.     return true- r! o, L4 n9 K) {, y( b: [
  1235.   end
    ' A; P# f2 z* b' r4 J5 B' {
  1236.   #--------------------------------------------------------------------------
    & f2 S6 b- M9 s# J8 I
  1237.   # ● 绘制walk移动路径 @array[move_directions...]
    # u: ^0 e, p! X. m& P1 d: U
  1238.   #--------------------------------------------------------------------------
    " `% Z9 r- g' h" ~& l6 H
  1239.   def draw_walk_path  \# O9 |' G1 p; E3 }
  1240.     # 准备绘制路径表格8 m  A- [! T( p; I+ r# W, t( _
  1241.     sheet = Table.new($game_map.width, $game_map.height)5 ]3 h; O% W! C" Z4 r8 v
  1242.     reversed_chase_path  = []; chase_path  = []+ X3 p# C. ^& g! K5 Z
  1243.     reversed_chase_point = []; chase_point = []
    + \0 Y( Q& k7 ^7 z- k6 z2 O
  1244.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]
    1 \% }& q9 |7 t# S$ x
  1245.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2
    + t* y! F; d& h2 j: q! x& R4 T
  1246.     reach_point = false
    4 g2 X4 c& o0 `( j
  1247.     step = 3
    0 a. F! j6 W6 [& P4 _; D
  1248.     loop do #loop1 开始填充表格
    1 p" r* h" B, @2 ^: C& s4 `
  1249.      draw_path = false
    1 ^$ u0 t8 G0 v
  1250.      check_points = new_start_points
    . Q- w" v- n' H% ?2 A1 H
  1251.      new_start_points = []& q8 u4 @6 ^4 [! ?/ N
  1252.       loop do #loop2 从起点开始正向填充
    8 ?- [/ a9 f* |  p# N3 Y
  1253.         point_x = check_points.shift
    ) }7 R. N) ?* N
  1254.         break if point_x == nil
    & V6 P4 I6 f4 e4 s9 \7 h
  1255.         point_y = check_points.shift
    5 K  M' Q7 e6 e+ Z
  1256.         left_x  = $game_map.round_x(point_x - 1)  a) S1 z" ^. T2 S
  1257.         right_x = $game_map.round_x(point_x + 1)* p# G- V4 `. }6 Q4 J) G- K
  1258.         up_y    = $game_map.round_y(point_y - 1)
    7 h* |0 K- ]: b) N
  1259.         down_y  = $game_map.round_y(point_y + 1)* L0 n* q! j% Z: b& E
  1260.                     # 判断路径是否连通
    # I: ~* _4 u0 y6 ]
  1261.         path_step = step - 1
    " D$ g1 E) \: G* ~- ^# v
  1262.         if sheet[left_x, point_y] == path_step     &&
    / j! ^+ U% J' R' Q, G
  1263.            $game_map.passable(left_x, point_y, 6) &&
    3 N" M0 x* ^% R. k* S. u
  1264.            $game_map.passable(point_x, point_y, 4)
    # v( V( a2 o7 B$ G! ~0 |) w
  1265.           chase_path.push(4)
    9 X( z7 y- _  q1 r. _) m) ?# R9 H
  1266.           chase_point = [left_x, point_y]
    : b- {! h: d  g, F4 w) H
  1267.           reversed_chase_point = [point_x, point_y]: B& E/ ]  t( m% J8 @8 v
  1268.           reach_point = true; break3 v( B9 G& E8 _  ?* ^8 A
  1269.         elsif sheet[right_x, point_y] == path_step     &&7 G3 \" T3 z$ v3 m
  1270.               $game_map.passable(right_x, point_y, 4) &&7 o# ?8 Y- B* m7 n. M
  1271.               $game_map.passable(point_x, point_y, 6)5 Q% c; `% L6 U  V8 x. c
  1272.             chase_path.push(6)2 f6 o: H; R5 H# Z0 e
  1273.             chase_point = [right_x, point_y]% e3 b# G- B' l1 B
  1274.             reversed_chase_point = [point_x, point_y]6 H* |' `& r/ y
  1275.             reach_point = true; break
    ' ~; S% r% Z5 L. K. R1 k5 E8 h
  1276.         elsif sheet[point_x, up_y] == path_step     &&8 J  C# g0 _- a0 y9 P, w
  1277.               $game_map.passable(point_x, up_y, 2) &&7 G& H. W! h8 U- \- x: c) G; @
  1278.               $game_map.passable(point_x, point_y, 8)& u$ |1 y+ M  p
  1279.             chase_path.push(8)
    0 |) r2 Z) Q2 g; O0 e/ H* ~& t
  1280.             chase_point = [point_x, up_y]/ f+ i" r0 D. |% Y1 l/ ?, [' Z
  1281.             reversed_chase_point = [point_x, point_y]
    / |0 B% K# ]  \8 u6 e9 L
  1282.             reach_point = true; break+ z; e; m" u+ l* i7 l1 J
  1283.         elsif sheet[point_x, down_y] == path_step     &&
    ' m& r# {2 n' u- |
  1284.               $game_map.passable(point_x, down_y, 8) &&
    8 S8 ?- {3 P, K0 r4 ?) F* \
  1285.               $game_map.passable(point_x, point_y, 2)% s7 e9 Y4 \" \8 E' \' G( U
  1286.             chase_path.push(2)- _/ g3 X$ ]6 {
  1287.             chase_point = [point_x, down_y]6 C: o) q2 {9 F+ ]# l: V5 V# y
  1288.             reversed_chase_point = [point_x, point_y], M5 g/ j8 I! i! c! U! ~& m
  1289.             reach_point = true; break# _% r6 `# x. [0 H# v/ E+ B
  1290.         end# u. I; m/ W+ K2 ~* M
  1291.         # 以需要抵达该点的步数填充路径表格 #
    7 ]! @6 s. Z, b, \/ M* ~+ c
  1292.         if sheet[left_x, point_y] == 0              &&7 c0 d+ m1 n# r
  1293.            $game_map.passable(left_x, point_y, 6)  &&! _7 {0 o' L1 A2 t( N3 O* \
  1294.            !collide_with_events(left_x, point_y)   &&
    : s! _/ I, t# s" o( c
  1295.            $game_map.passable(point_x, point_y, 4) &&3 I  m4 z$ V( v& R9 w7 [# X
  1296.            !collide_with_vehicles(left_x, point_y) #judge_end8 y0 `% f' X% S. M/ ^3 y# @
  1297.           sheet[left_x, point_y] = step
    ) F7 v7 `! A5 r2 A; @* X
  1298.           draw_path = true
    ; M: A# H7 W" ?4 C! T& p% a
  1299.           new_start_points.push(left_x, point_y)+ q# N1 |& X  O  T, G/ [# o
  1300.         end
    & U) J. H: T& N* m
  1301.         if sheet[right_x, point_y] == 0             &&
    0 Y3 W1 Z' O( U/ x0 C
  1302.            $game_map.passable(right_x, point_y, 4) &&: l9 l! n3 {0 {0 U8 a  C
  1303.            !collide_with_events(right_x, point_y)  &&
    % N& _" s# t4 d
  1304.            $game_map.passable(point_x, point_y, 6) &&3 g* s$ N* N% A0 ^) N
  1305.            !collide_with_vehicles(right_x, point_y)#judge_end
    ) \* x: ^8 x( A+ c* @
  1306.           sheet[right_x, point_y] = step
    . @1 L( j6 F- \9 k
  1307.           draw_path = true" \; a: b( z( C7 A: K& j# a& O2 S: s
  1308.           new_start_points.push(right_x, point_y)
    ; o( i# Z% h/ O* N
  1309.         end$ [% R0 w, B5 h  X- S& E
  1310.         if sheet[point_x, up_y] == 0                &&7 i( T3 t9 b7 }+ j& h
  1311.            $game_map.passable(point_x, up_y, 2)    &&& @* h# P! U1 o1 S% J4 f  C
  1312.            !collide_with_events(point_x, up_y)     &&
    ! h" @5 t, G- `/ h/ N0 \
  1313.            $game_map.passable(point_x, point_y, 8) &&
    5 I) k9 r' M4 a5 v
  1314.            !collide_with_vehicles(point_x, up_y)   #judge_end
    6 H4 q6 |% ^6 l8 {
  1315.           sheet[point_x, up_y] = step
    * B  {( ^$ l1 H! j
  1316.           draw_path = true
    9 `  b- o1 ?$ K# u1 C* ?' o( H+ t
  1317.           new_start_points.push(point_x, up_y)
    & E- {$ j+ W5 I
  1318.         end6 a$ |. t0 ~: w' p& r
  1319.         if sheet[point_x, down_y] == 0              &&
    : L  W' w6 V' ~, J5 _
  1320.            $game_map.passable(point_x, down_y, 8)  &&, \8 `4 z8 L1 Z3 x& y* r
  1321.            !collide_with_events(point_x, down_y)   &&
    + j4 E: x' B% [7 [8 T3 ]/ E
  1322.            $game_map.passable(point_x, point_y, 2) &&
    # n" b; ]1 p* Z) B- j
  1323.            !collide_with_vehicles(point_x, down_y) #judge_end& G& b# L4 C+ Y5 Y3 L. T
  1324.           sheet[point_x, down_y] = step
    4 J. X+ W  ?! E: ]# m6 V' {
  1325.           draw_path = true
    ( s/ B5 o6 h  |7 ]# o
  1326.           new_start_points.push(point_x, down_y)
    ; W! Z/ {0 n6 O. C% x: q
  1327.         end3 g3 U3 `! f4 c
  1328.       end#endOfLoop2- @0 Y/ O# T6 e; o1 Z
  1329.       break if !draw_path  reach_point7 W5 [+ k2 Q$ J
  1330.       draw_path = false  j0 Q8 }; \. y
  1331.       check_points = new_end_points# s/ D/ s) A7 C# f
  1332.       new_end_points = []
    * B3 Q% {2 [  r7 |
  1333.       step += 1+ ~5 v7 D# j. X. e
  1334.       break if step  KsOfSionBreak_Steps &&
    3 \- v( q+ \3 p& A' T9 A
  1335.                !Input.press(KsOfSionFind_Path_Key)
    ' x3 w0 ]% I8 T% t- v# i! f
  1336.       loop do #loop3 从终点开始反向填充( k" V! o9 ^2 y* L' l
  1337.         point_x = check_points.shift8 `5 ~! k3 p, H* N) v) G
  1338.         break if point_x == nil0 q4 [) ?3 f+ [3 X8 B- `# }
  1339.         point_y = check_points.shift
    , }' f3 l" [$ }
  1340.         left_x  = $game_map.round_x(point_x - 1)
    / D% v# X3 y2 N# d2 B
  1341.         right_x = $game_map.round_x(point_x + 1)6 U3 d/ \0 q9 e' z( W
  1342.         up_y    = $game_map.round_y(point_y - 1)
    7 F% q  h- O% H/ p& X$ }; f) T
  1343.         down_y  = $game_map.round_y(point_y + 1)
    ' z" Q) i9 o9 M1 _6 ]1 C6 L6 n
  1344.         # 判断路径是否连通
    7 q* {  J4 A* ?; j6 j5 |
  1345.         path_step = step - 1
    4 J% p  J6 v$ ]8 b- w: J5 ]
  1346.         if sheet[left_x, point_y] == path_step     &&
    9 n- H+ W& R2 B5 h7 q& b" J
  1347.            $game_map.passable(left_x, point_y, 6) &&
      f8 u; E4 _& O) P" |7 V8 X9 }
  1348.            $game_map.passable(point_x, point_y, 4)5 q6 f3 \' }* N" t: s
  1349.           chase_path.push(6)2 L7 ]; v+ q9 b$ B7 F
  1350.           chase_point = [point_x, point_y]( f# L8 E# ]) h* b+ o. P" p' b0 z
  1351.           reversed_chase_point = [left_x, point_y]8 M. o( L9 S) c9 r8 P
  1352.           reach_point = true; break. E( F4 i3 D0 _$ f$ a8 Y3 D8 J/ S
  1353.         elsif sheet[right_x, point_y] == path_step     &&
    * B( W! W" G% B! I
  1354.               $game_map.passable(right_x, point_y, 4) &&4 s1 g! ^) L. o( Y
  1355.               $game_map.passable(point_x, point_y, 6): i; o9 e; `, d/ T4 z6 o
  1356.             chase_path.push(4)
    ' e2 j% l% Z1 ^  j" s
  1357.             chase_point = [point_x, point_y]" I" c* G) A; g
  1358.             reversed_chase_point = [right_x, point_y]
    ) [$ R3 v! j; A6 S0 P
  1359.             reach_point = true; break
      M. p1 d& R* k( T  Z+ K( n# t* i; ^5 n
  1360.         elsif sheet[point_x, up_y] == path_step     &&
    9 ]) u' \* q# _  Z1 m1 o) ^5 I& X
  1361.               $game_map.passable(point_x, up_y, 2) &&
    " \4 z; C: b2 n! X5 y: L( }% d  _
  1362.               $game_map.passable(point_x, point_y, 8)  E; S2 ~5 K6 r, G, r) M
  1363.             chase_path.push(2)
    ' M+ n8 Q: j! W7 G6 \5 _* J
  1364.             chase_point = [point_x, point_y]- r  O9 I, [0 ]/ s
  1365.             reversed_chase_point = [point_x, up_y]9 E  y+ _$ `) P% l/ M+ E0 g$ \
  1366.             reach_point = true; break
    7 _) p# Q1 e% b! Z2 v
  1367.         elsif sheet[point_x, down_y] == path_step     &&
    2 K1 l+ A* h' ]3 o
  1368.               $game_map.passable(point_x, down_y, 8) &&
    7 P- b7 S) i: z8 F0 w2 q
  1369.               $game_map.passable(point_x, point_y, 2)
    . `& M/ a& r- o$ T
  1370.             chase_path.push(8)
    % C1 x& m! m8 @( x+ a
  1371.             chase_point = [point_x, point_y]5 m/ L# |5 z0 `, ~( }0 f
  1372.             reversed_chase_point = [point_x, down_y]
    & {9 N" c" l/ I4 b  w7 t
  1373.             reach_point = true; break
    0 [! t& g6 f$ T
  1374.         end" o# Z9 o) d! H4 Y' X# C3 _
  1375.         # 以需要抵达该点的步数填充路径表格 #
    * v; F: n: i5 n) q! e' _$ j9 w
  1376.         if sheet[left_x, point_y] == 0              &&
    , v3 Q, f% X# m# G" o
  1377.            $game_map.passable(left_x, point_y, 6)  &&
    % N0 m( O" h. f: @2 I
  1378.            !collide_with_events(left_x, point_y)   &&
    # o1 C3 j: z2 @$ p
  1379.            $game_map.passable(point_x, point_y, 4) &&
    " C7 o" n* s2 @  Q! S
  1380.            !collide_with_vehicles(left_x, point_y) #judge_end+ m3 y2 j& E: b+ o9 z
  1381.           sheet[left_x, point_y] = step
    1 a) m1 ^; n* h! S# `9 A7 x+ F
  1382.           draw_path = true
    1 v6 A1 i: G5 ~0 x4 E
  1383.           new_end_points.push(left_x, point_y)+ M7 t8 \' }- ?6 P8 O- d* J9 B
  1384.         end
    8 u- P# n' U# f% Q+ f: s- z% R8 }
  1385.         if sheet[right_x, point_y] == 0             &&5 H# o$ |4 a$ @: {: _& Q, d
  1386.            $game_map.passable(right_x, point_y, 4) &&! l, A1 m/ g: y
  1387.            !collide_with_events(right_x, point_y)  &&7 t2 i$ k" t+ n: T
  1388.            $game_map.passable(point_x, point_y, 6) &&
    " d5 y! y3 B: p2 H5 _* k
  1389.            !collide_with_vehicles(right_x, point_y)#judge_end4 a. S0 M- G, ]# }- W7 N9 g
  1390.           sheet[right_x, point_y] = step5 ~5 j& M/ J5 ~1 ]" _1 e
  1391.           draw_path = true
    % y5 v; V( Z% P; o$ ~8 U/ K# ~
  1392.           new_end_points.push(right_x, point_y)
    0 z' ]  m/ g% w* q- R
  1393.         end
    4 n# G5 T% m1 ?2 s( I9 q, j; p- f
  1394.         if sheet[point_x, up_y] == 0                &&
    % v) o" o4 u5 ]/ C5 h, w+ L* a) @
  1395.            $game_map.passable(point_x, up_y, 2)    &&
    % K; b) \! @  l7 O# J: v. e
  1396.            !collide_with_events(point_x, up_y)     &&
    2 h: g! ^, Y/ p+ A: w! v
  1397.            $game_map.passable(point_x, point_y, 8) &&0 S& }3 w8 s8 t
  1398.            !collide_with_vehicles(point_x, up_y)   #judge_end+ x0 t" P8 P. ^) E6 Y2 k, B
  1399.           sheet[point_x, up_y] = step/ D. Z: \* ~+ J6 ?
  1400.           draw_path = true
    . h% z& L4 f0 e4 p. m3 R+ r/ F4 H" [$ j
  1401.           new_end_points.push(point_x, up_y)
    4 P( \/ y% {% K. X
  1402.         end! }1 V6 _' w# b2 N
  1403.         if sheet[point_x, down_y] == 0              &&! r* v. m6 m& ~3 j+ n
  1404.            $game_map.passable(point_x, down_y, 8)  &&$ D* m) t  X1 z  F3 D, o+ U" b
  1405.            !collide_with_events(point_x, down_y)   &&" Y0 W  V* y9 J) f9 ?9 F) E9 a
  1406.            $game_map.passable(point_x, point_y, 2) &&
    2 r: w/ N2 B( v6 A
  1407.            !collide_with_vehicles(point_x, down_y) #judge_end; j& ]2 p4 k& A- Y6 q+ [
  1408.           sheet[point_x, down_y] = step% v9 q4 `4 E# k
  1409.           draw_path = true7 L; f: f! ?1 ^4 B6 H/ X
  1410.           new_end_points.push(point_x, down_y)8 k# ^# v& T* f9 v# a( @
  1411.         end
    & t" Y& Z9 i, h$ K9 U( i
  1412.       end#endOfLoop3! K$ o& `$ l! @7 G
  1413.       break if !draw_path  reach_point8 ]* K& `( c3 [5 Z
  1414.       step += 1( J/ {, q' V1 v4 |* _+ }& t% B+ b7 c& V
  1415.     end #endOfLoop1 路径表格填充完毕* h7 @: h8 P6 ~# t: s4 ^& z) ]
  1416.     $mouse_move_sign.transparent = false
    # o# y3 Z0 X0 ~$ T' n( n. |; V$ J. r
  1417.     # 判断指定地点能否抵达
    ) ]$ \0 q; A2 G. I; Q' G! \; U
  1418.     if reach_point# o* H( b; L& |: s
  1419.       $mouse_move_sign.direction = 2
    * K3 h0 f) k. u+ [6 [8 y8 Q
  1420.     else+ k8 |( a& C: g5 g
  1421.       not_reach_point
    ( r3 C, E9 q) p: j# v# l: L9 z
  1422.       return
    " b! u0 n- Y7 P! n# T- i
  1423.     end
    5 z7 i1 s7 ~+ k! L
  1424.     # 根据路径表格绘制最短移动路径(反向)
      _& N. _+ V, F$ M! ^" K7 W
  1425.     steps = step  2  2 + 1% X- d: P: C% g+ X9 S. c, E
  1426.     loop_times = step  2
    6 J. c0 z) ^1 Q! Y: H  i
  1427.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]3 P# B6 `' b1 M& R  I. v1 `
  1428.     for i in 1..loop_times # forLoop2 ^7 S; h8 {7 R" U/ M
  1429.     steps -= 2/ a2 \" x- W6 \2 Y$ v! S
  1430.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs #反过来?蛋疼了……9 j( r; n, s" X$ p
  1431.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
    + g0 l3 G- a  m! Q
  1432.             $game_map.passable($game_map.round_x(point_x - 1), point_y, 6) &&
    % R8 M: ~8 A8 @% v  d# L
  1433.             $game_map.passable(point_x, point_y, 4)                #judge_end
    ! t: I" G1 M9 `: W9 p8 O7 p& f1 t* J
  1434.         reversed_chase_path.push(6)4 r( ]9 v& j2 R; |" D3 [1 c
  1435.         point_x = $game_map.round_x(point_x - 1)4 J/ r0 ]; D% c' P
  1436.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&, Q2 c% O% c8 l0 V- |  {& v+ {
  1437.             $game_map.passable($game_map.round_x(point_x + 1), point_y, 4) &&' u+ E$ {) {! p* T
  1438.             $game_map.passable(point_x, point_y, 6)                #judge_end. ^( m; x  x% s/ k) M
  1439.         reversed_chase_path.push(4)
    & t$ F  ~+ S6 Q# |
  1440.         point_x = $game_map.round_x(point_x + 1)$ V$ \( C6 f- k) C! Y3 O+ Y
  1441.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&! Z; L, z. {% G( p9 K; W! D- X
  1442.             $game_map.passable(point_x, $game_map.round_y(point_y + 1), 8) &&3 a$ }3 ^0 v1 E
  1443.             $game_map.passable(point_x, point_y, 2)                #judge_end
    ' h9 R* q9 W$ X5 B! L
  1444.         reversed_chase_path.push(8)
    7 q: Y# E, `4 Z1 }) \
  1445.         point_y = $game_map.round_y(point_y + 1)
    & c. M8 z; e' D! _
  1446.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
    . F: U2 U( `8 ^& g" o3 j/ a; h& @! d
  1447.             $game_map.passable(point_x, $game_map.round_y(point_y - 1), 2) &&
    + t! S2 Y) X' b( s$ t( E0 W
  1448.             $game_map.passable(point_x, point_y, 8)                #judge_end
    3 h( h' W" W0 A9 e6 Q& w2 q
  1449.         reversed_chase_path.push(2)
    3 E" E# R9 f" j& V7 m: t
  1450.         point_y = $game_map.round_y(point_y - 1)& n, \7 Z8 Q+ x2 j+ v
  1451.       end
    , W% m9 m2 D: f( M! M, D' l
  1452.     else
    : h, N" K8 T- R3 P9 D% U
  1453.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
    3 `* c1 q4 c6 f
  1454.             $game_map.passable(point_x, $game_map.round_y(point_y + 1), 8) &&# U4 Q  B/ m/ ^* ^1 q( s
  1455.             $game_map.passable(point_x, point_y, 2)                #judge_end
    ; A, {, z% d% `6 Q( I; o/ P" g
  1456.         reversed_chase_path.push(8)- B1 a, A6 x" |  ^
  1457.         point_y = $game_map.round_y(point_y + 1)
    # t# P( p, g% q& o5 \8 T
  1458.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
    2 Y, O4 w6 \4 t4 Z' a7 J' X" u
  1459.             $game_map.passable(point_x, $game_map.round_y(point_y - 1), 2) &&% m7 S6 R2 J0 ~) m9 \* x
  1460.             $game_map.passable(point_x, point_y, 8)                #judge_end
    ! ]) \) c4 K9 x7 N7 G) S1 Q
  1461.         reversed_chase_path.push(2)
    5 s7 L7 j5 |) ?* |. `! J2 e
  1462.         point_y = $game_map.round_y(point_y - 1)
    ! {! J4 i8 z2 {5 e6 ^: f
  1463.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
      E3 h( a3 d5 X* p
  1464.             $game_map.passable($game_map.round_x(point_x - 1), point_y, 6) &&
    7 J0 u1 |+ Q( K: y+ y
  1465.             $game_map.passable(point_x, point_y, 4)                #judge_end
    & f/ m; X/ R  H: [+ V& t
  1466.         reversed_chase_path.push(6), n- o2 [% }1 R& z6 e( Z
  1467.         point_x = $game_map.round_x(point_x - 1)
    6 v2 P9 i* N* e9 y% ~6 I* P
  1468.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&0 C2 ]: {' t7 h' T3 e
  1469.             $game_map.passable($game_map.round_x(point_x + 1), point_y, 4) &&% f8 M) |5 _" h. }5 @! h6 L" A
  1470.             $game_map.passable(point_x, point_y, 6)                #judge_end
    ( W0 B4 s! Y& w6 b+ @
  1471.         reversed_chase_path.push(4)7 n. k' h) h9 s9 D  c, y( D
  1472.         point_x = $game_map.round_x(point_x + 1)
    7 K. p1 P' Y# R
  1473.       end
    7 l) h# N4 N. ?4 w! b1 R6 c
  1474.     end
    ( O8 k6 b0 t# V) g
  1475.     end #endOfForLoop0 G8 J" }" ^  q1 ~
  1476.     # 根据路径表格绘制最短移动路径(正向)
    . N6 j* n: I4 u. n
  1477.     steps = step  2  2
    3 @, p9 G0 s* O9 x8 e  U2 [
  1478.     loop_times = step  2
    5 ?4 `  m2 f$ Y0 r
  1479.     point_x, point_y = chase_point[0], chase_point[1]# E& p" g; a( R$ o
  1480.     for i in 2..loop_times # forLoop5 ?  K# C( Z; f2 G$ n/ F
  1481.     steps -= 2+ J. T4 h, R; f4 K& V  ^1 b
  1482.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs
    2 U0 t- C1 W0 S* Y( I* A; m3 l
  1483.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&+ r3 Y: |! l1 `4 t0 m2 {9 y
  1484.             $game_map.passable(point_x, $game_map.round_y(point_y + 1), 8) &&- R2 ]& q' c2 P% u
  1485.             $game_map.passable(point_x, point_y, 2)                #judge_end
    ) s  |1 z2 [0 n" D
  1486.         chase_path.push(2)3 c6 z2 ?+ e8 j/ M, M- O
  1487.         point_y = $game_map.round_y(point_y + 1)
    : g4 _" h' c1 \8 `5 a
  1488.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
    4 Q" j' D+ e* N0 A. [  D
  1489.             $game_map.passable(point_x, $game_map.round_y(point_y - 1), 2) &&: V1 A% n! ^* ]$ f( i0 X
  1490.             $game_map.passable(point_x, point_y, 8)                #judge_end' z4 `" K1 g4 }4 ~6 O8 i
  1491.         chase_path.push(8)' i5 I9 n7 A. K+ d2 g& Q1 \0 l
  1492.         point_y = $game_map.round_y(point_y - 1)
    ' @8 Z; v8 t) o( G2 b
  1493.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&
    & j7 t2 ^" R& Y3 V8 `' l: {
  1494.             $game_map.passable($game_map.round_x(point_x - 1), point_y, 6) &&' U2 g$ I8 E( @: {8 S# l
  1495.             $game_map.passable(point_x, point_y, 4)                #judge_end
    & [" Y7 O4 X  L5 K7 J7 W1 E
  1496.         chase_path.push(4)' x# d8 U" K, |. s: F( M  `7 E
  1497.         point_x = $game_map.round_x(point_x - 1)! w3 Z. W$ V+ `) M4 o& j2 ^
  1498.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
    , [4 w/ V/ K* l1 m9 W
  1499.             $game_map.passable($game_map.round_x(point_x + 1), point_y, 4) &&
    % O$ p6 k  G; s  T1 ]) L. r: D
  1500.             $game_map.passable(point_x, point_y, 6)                #judge_end& w  H& u. r4 h4 D9 B$ c" G
  1501.         chase_path.push(6)
    - S! d& ^2 c* Z1 U5 x
  1502.         point_x = $game_map.round_x(point_x + 1)' C( w$ x6 @( F* F: Q- \
  1503.       end
    1 ?& x4 c4 X5 M2 v1 C
  1504.     else
      H+ v( f- y8 w. ?! z/ X
  1505.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps         &&& L. G$ U- Y5 C- g
  1506.             $game_map.passable($game_map.round_x(point_x - 1), point_y, 6) &&! v- v8 ~: ~. |+ @( ?
  1507.             $game_map.passable(point_x, point_y, 4)                #judge_end
    , n0 B( z" O- E# z9 n7 [
  1508.         chase_path.push(4)
    ; m7 [: ~: {, D
  1509.         point_x = $game_map.round_x(point_x - 1)
    2 K; R$ d& _' d9 z8 [( e+ t
  1510.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps         &&
    4 N0 S9 Z9 P6 o) W' t3 p( }
  1511.             $game_map.passable($game_map.round_x(point_x + 1), point_y, 4) &&
    6 j3 u/ t& ]: f) @# s
  1512.             $game_map.passable(point_x, point_y, 6)                #judge_end! l- v$ X3 m0 B* K& B
  1513.         chase_path.push(6)
    # H3 p% U! U# j5 q; o' a1 n
  1514.         point_x = $game_map.round_x(point_x + 1)
    9 k; R$ U5 p: D" D( q, W! B+ A: M
  1515.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps         &&
    # b# [( \+ I: B* l! m
  1516.             $game_map.passable(point_x, $game_map.round_y(point_y + 1), 8) &&6 Q. o8 N3 }/ |9 O8 J2 J
  1517.             $game_map.passable(point_x, point_y, 2)                #judge_end' h8 T3 f, q3 W; i' G0 {
  1518.         chase_path.push(2)
    & [5 R# v& M- s: x
  1519.         point_y = $game_map.round_y(point_y + 1)
    2 Z' z4 q! u* l' w& l4 T
  1520.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps         &&
    4 f; i' v0 q- ?& B1 \
  1521.             $game_map.passable(point_x, $game_map.round_y(point_y - 1), 2) &&, d) D8 U2 |8 t. V+ q
  1522.             $game_map.passable(point_x, point_y, 8)                #judge_end
    ' z9 |3 ?+ K4 i: e: Q* J7 B( A1 Q* H4 D
  1523.         chase_path.push(8)1 w( y4 H4 R1 n6 j. G, c
  1524.         point_y = $game_map.round_y(point_y - 1)4 A* f% }( T2 M
  1525.       end
    # }% o7 F; q' C8 w8 d% i6 n; B
  1526.     end
    ; M, E: f) q5 w
  1527.     end #endOfForLoop/ Y& [* P2 w* C! H
  1528.     @mouse_move_path = reversed_chase_path.reverse + chase_path
    9 q+ @0 e# y( j# ^
  1529.   end#walk) h/ H( \4 y9 X3 q+ ~/ H0 `
  1530.   #--------------------------------------------------------------------------
    7 I! o% b! e8 Q. f2 o. o4 I, M
  1531.   # ● 绘制boat的移动路径 @array[move_directions...]1 w+ {( B. r" M& E8 {  W
  1532.   #--------------------------------------------------------------------------
    - s2 t9 C) ~7 @# B6 q/ f
  1533.   def draw_boat_path& @" F; W7 P% q- b: ~# _& F, f
  1534.     # 准备绘制路径表格
    ' v& W6 d: a$ q/ V! C: r
  1535.     sheet = Table.new($game_map.width, $game_map.height): J( s5 T/ ?" L+ n8 o
  1536.     reversed_chase_path  = []; chase_path  = []
    * i3 Y$ l( w! z
  1537.     reversed_chase_point = []; chase_point = []& V# \  L0 c% v( A$ G7 o) o2 q7 P
  1538.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]3 j: Q; _* [* Y2 F
  1539.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2* U& ~( A9 }! I5 V9 y6 w' L
  1540.     reach_point = false  [2 [$ @0 O8 }" x" S" b
  1541.     step = 3
    0 c4 d9 b8 D! h+ ?9 |  t
  1542.     loop do #loop1 开始填充表格) {4 y7 m! _" n8 m' {
  1543.      draw_path = false! H6 k& F( |* Q4 x: ^
  1544.      check_points = new_start_points
    6 N2 K& t5 D8 y; |0 ^; A* N8 s( i  b
  1545.      new_start_points = []
    + ^8 c; W* x) f0 ~6 R1 y) ^; e- T
  1546.       loop do #loop2 从起点开始正向填充
    0 v! L# y1 [0 \2 R
  1547.         point_x = check_points.shift$ J( r- u% h8 B" R+ y' k
  1548.         break if point_x == nil0 Z, y5 S3 B0 y5 w/ R* L: i  y1 ^
  1549.         point_y = check_points.shift/ \! v2 B) U' v8 d6 e- r% V, w+ W3 k
  1550.         left_x  = $game_map.round_x(point_x - 1)0 m' b# Z6 ~1 }
  1551.         right_x = $game_map.round_x(point_x + 1)
    4 e0 a6 }: v* p7 U( c
  1552.         up_y    = $game_map.round_y(point_y - 1)! \# ]! K, R- k$ c* r  o
  1553.         down_y  = $game_map.round_y(point_y + 1)5 y+ l" [$ {8 |
  1554.                     # 判断路径是否连通
    / x6 i6 u' n5 v. @1 g: I
  1555.         path_step = step - 1# F2 i; U  P9 ]" @
  1556.         if sheet[left_x, point_y] == path_step
    - z- ], r2 X( s6 s, U! M+ I8 y, N- Z
  1557.           chase_path.push(4)
    5 b" Q! r: I9 U) e
  1558.           chase_point = [left_x, point_y]
    * F" c* M  B+ r6 K' @
  1559.           reversed_chase_point = [point_x, point_y]
    / g7 p. V3 d1 G! N+ ^' b
  1560.           reach_point = true; break
    ' A: \" f/ g# Z* }7 ?+ V
  1561.         elsif sheet[right_x, point_y] == path_step: [" A4 S0 Q) S3 K4 `6 M& P; }
  1562.             chase_path.push(6)9 P8 L( n3 k/ H' N
  1563.             chase_point = [right_x, point_y]
    3 L8 W6 u; P/ \* j3 ?2 ]0 U
  1564.             reversed_chase_point = [point_x, point_y]5 u/ U% C4 w# T! g/ t" J# K7 e$ m
  1565.             reach_point = true; break
    0 _7 \& T% ^6 |3 h6 f% ]
  1566.         elsif sheet[point_x, up_y] == path_step) W' R+ N3 k# t) G
  1567.             chase_path.push(8)
    # N6 C$ N4 [4 G5 p! X) `) O
  1568.             chase_point = [point_x, up_y]( Z6 F5 m7 p6 i
  1569.             reversed_chase_point = [point_x, point_y], G. S" G; Q8 z  ~% g5 |+ W+ }: s
  1570.             reach_point = true; break
    6 z3 k" Z3 T% B0 r1 L
  1571.         elsif sheet[point_x, down_y] == path_step
    ! s2 O9 b; q5 q% w4 V
  1572.             chase_path.push(2)
    ! U+ F1 e9 w' D/ s' ?
  1573.             chase_point = [point_x, down_y]! O6 e8 B0 Q  Z% @
  1574.             reversed_chase_point = [point_x, point_y]* d4 r* {+ k/ S( n" S
  1575.             reach_point = true; break1 A4 k1 l( Q# u8 x* G* L" ^; h! C
  1576.         end, c$ |5 Y2 x6 @- T3 P: w8 \
  1577.         # 以需要抵达该点的步数填充路径表格 #
    $ f( ?( u0 S' S$ r, h
  1578.         if sheet[left_x, point_y] == 0                &&$ g7 i  B6 a& y& v$ N% q; K
  1579.            $game_map.boat_passable(left_x, point_y)  &&
    7 w$ \3 w. D( Z. J* ^0 }" O
  1580.            !collide_with_events(left_x, point_y)     &&: ?- ^' ^5 K  E
  1581.            !collide_with_vehicles(left_x, point_y)   #judge_end
    % Y$ L6 F. d* _6 ^: Z' w; O2 }4 w
  1582.           sheet[left_x, point_y] = step. K& K9 m  d: A* h( L, r
  1583.           draw_path = true2 X) V- m7 J( m# y
  1584.           new_start_points.push(left_x, point_y)
    & A+ x  s5 n; H
  1585.         end
    9 @% U2 S  D1 ?# @/ Z9 Z
  1586.         if sheet[right_x, point_y] == 0               &&
    * s/ f9 O) r% ]' u# e
  1587.            $game_map.boat_passable(right_x, point_y) &&
    $ V& b, p1 ]4 L( I6 s0 L( A
  1588.            !collide_with_events(right_x, point_y)    &&, ]6 P- R0 d% x
  1589.            !collide_with_vehicles(right_x, point_y)  #judge_end
    & \& t, U$ c$ t
  1590.           sheet[right_x, point_y] = step+ u; j- E% f7 \6 x/ ?
  1591.           draw_path = true
    $ V5 l- W. z, C: Z
  1592.           new_start_points.push(right_x, point_y). u7 b2 F- O0 R0 }5 ?
  1593.         end8 O6 R. Z/ j& t" |; @! _7 ^, h" u6 W
  1594.         if sheet[point_x, up_y] == 0                  &&1 c1 u9 E! q/ y. Z5 A5 x
  1595.            $game_map.boat_passable(point_x, up_y)    &&7 A( E4 _& F& n5 |8 R
  1596.            !collide_with_events(point_x, up_y)       &&! k+ V/ ?- H4 F5 W7 f
  1597.            !collide_with_vehicles(point_x, up_y)     #judge_end! n9 t) \# }) h8 V  [' q+ z8 ]
  1598.           sheet[point_x, up_y] = step
    2 B0 p. F' [" j/ Q8 O7 c1 ^
  1599.           draw_path = true1 ]& \! t& u. ~/ N! T4 c7 {( s
  1600.           new_start_points.push(point_x, up_y)
    $ _  Q/ H3 y. u# V3 g- q
  1601.         end2 v# b( @7 [. O$ S# [1 C, v: u  E
  1602.         if sheet[point_x, down_y] == 0                &&5 C  Y  q/ F3 d) t, s5 X4 s
  1603.            $game_map.boat_passable(point_x, down_y)  &&
    # _. [5 X; z/ }3 O2 p, L+ V
  1604.            !collide_with_events(point_x, down_y)     &&
    , x% d$ Q. c& `! k* `
  1605.            !collide_with_vehicles(point_x, down_y)   #judge_end
    , w; B0 j, R+ M6 F' Y
  1606.           sheet[point_x, down_y] = step
    5 T" i2 j9 n8 H6 ~- {
  1607.           draw_path = true& i8 a$ s, A% K2 R( a1 d. ]
  1608.           new_start_points.push(point_x, down_y)( \( x1 T5 j+ D/ ?3 q( L& Q
  1609.         end1 M) F7 g* Q$ Y- ^
  1610.       end#endOfLoop2' V- Y/ }. f  M4 C9 s4 a$ v
  1611.       break if !draw_path  reach_point
    ' i9 c! J! s3 n. x# k. M
  1612.       draw_path = false9 l, O' M. @6 P, S$ Z3 T
  1613.       check_points = new_end_points
    : H) ], b7 X7 O
  1614.       new_end_points = []
    6 E7 w8 {, t" G3 P( {% q
  1615.       step += 1
    * i4 i9 k5 p+ C/ ?% L" T& i: W2 X
  1616.       break if step  KsOfSionBreak_Steps &&
    . S% j% t% ?- I1 D8 \% _& K
  1617.                !Input.press(KsOfSionFind_Path_Key)/ \8 G* j# e) v! p& ^
  1618.       loop do #loop3 从终点开始反向填充2 \% w1 s6 V' L: I. n
  1619.         point_x = check_points.shift; b' I% G% Z/ H6 |1 m* S
  1620.         break if point_x == nil
    0 ?3 s# k5 x  a9 v# l+ a* U$ b. n
  1621.         point_y = check_points.shift
    # @% l: p- }1 C( I7 G8 p. X, P, ?* j
  1622.         left_x  = $game_map.round_x(point_x - 1)
    # b" G9 y1 z3 C' d  Q' M
  1623.         right_x = $game_map.round_x(point_x + 1)
    ! v$ Q6 W# a- M" m) W
  1624.         up_y    = $game_map.round_y(point_y - 1)
    1 s, G" s. F$ c2 X
  1625.         down_y  = $game_map.round_y(point_y + 1)
    # s- s' ?1 q. d# b7 `
  1626.         # 判断路径是否连通
    * y* K$ p/ d. u0 b
  1627.         path_step = step - 1
    4 }/ a7 E) G3 r: n/ B
  1628.         if sheet[left_x, point_y] == path_step3 j' ?2 s; B. @  @
  1629.           chase_path.push(6)+ I# h( C( n2 {
  1630.           chase_point = [point_x, point_y]
    # w, _" `1 W, z, Y5 ~9 l% ^; M
  1631.           reversed_chase_point = [left_x, point_y]
    / s6 O/ }, U  r8 W2 n6 D/ G! |, n3 _
  1632.           reach_point = true; break
    $ v" W3 O7 i  D9 \
  1633.         elsif sheet[right_x, point_y] == path_step; m; p) |& w6 `6 G
  1634.             chase_path.push(4)
    ( O# A, U- g. m% A/ J# y
  1635.             chase_point = [point_x, point_y]
    ' y# H0 E- ^3 `: `
  1636.             reversed_chase_point = [right_x, point_y]
    $ o  s9 H3 _' O% L& m0 a7 f* T+ A" c
  1637.             reach_point = true; break
    0 H; Z0 S, f- H4 E2 j' c
  1638.         elsif sheet[point_x, up_y] == path_step
    $ O9 t" _& G2 B4 L6 B/ E1 R  X
  1639.             chase_path.push(2)2 ^% {" n' h" D! I) B4 I: T% r
  1640.             chase_point = [point_x, point_y]
    8 x3 a. G5 k' g
  1641.             reversed_chase_point = [point_x, up_y]2 C7 D# U  n8 N; B
  1642.             reach_point = true; break, m' P! v9 R1 O2 Q5 i: z
  1643.         elsif sheet[point_x, down_y] == path_step$ C0 e* N2 ~7 I( J0 T% P
  1644.             chase_path.push(8)
    * e* b' _4 S% `
  1645.             chase_point = [point_x, point_y]- g* y* b9 \# V% D
  1646.             reversed_chase_point = [point_x, down_y]' r( E! M; H5 v) J5 H9 D( R+ q
  1647.             reach_point = true; break/ _+ d- |7 H( D* A& Q
  1648.         end$ B; ^# @8 h( q2 R2 s( j- s
  1649.         # 以需要抵达该点的步数填充路径表格 #5 T9 x9 x/ e! O# |0 d
  1650.         if sheet[left_x, point_y] == 0                &&8 e  p# K3 f/ D7 Y8 b. T: |
  1651.            $game_map.boat_passable(left_x, point_y)  &&
    # {. O+ }- ^% \
  1652.            !collide_with_events(left_x, point_y)     &&
    2 l6 }! I  F) X% B& a: A, a7 _
  1653.            !collide_with_vehicles(left_x, point_y)   #judge_end
    ' f/ x; y5 \5 M- o1 P$ ^
  1654.           sheet[left_x, point_y] = step5 h6 F& d- W. J$ ~' y( y0 L
  1655.           draw_path = true
    4 u+ Y2 E1 L' d
  1656.           new_end_points.push(left_x, point_y)4 R; ~" e" e) v6 m2 l4 j
  1657.         end2 C! @0 U( s9 f, D& f4 e
  1658.         if sheet[right_x, point_y] == 0               &&( u7 h8 @& K( f& [! i+ U7 z4 I$ x
  1659.            $game_map.boat_passable(right_x, point_y) &&3 c4 e' `2 P6 _/ S
  1660.            !collide_with_events(right_x, point_y)    &&0 V: l4 l1 y, x: {) G1 Q2 |8 N
  1661.            !collide_with_vehicles(right_x, point_y)  #judge_end0 P; w/ U4 |5 G' r! |
  1662.           sheet[right_x, point_y] = step0 }, \3 s. J. i# X6 z6 [
  1663.           draw_path = true
    - n* i" R$ g/ I! g3 Q
  1664.           new_end_points.push(right_x, point_y)2 p* W9 [/ E: n
  1665.         end
    : d5 L) D. [+ w( ~7 z8 n! m
  1666.         if sheet[point_x, up_y] == 0                  &&0 a  S! g! s9 B. \' X
  1667.            $game_map.boat_passable(point_x, up_y)    &&
    * v4 O7 J/ o$ g
  1668.            !collide_with_events(point_x, up_y)       &&" W- ^4 L( @/ S  Y
  1669.            !collide_with_vehicles(point_x, up_y)     #judge_end
    ; O! }0 g1 E$ R: @2 Q
  1670.           sheet[point_x, up_y] = step
    % X6 Y. r! f" f2 l- e" H
  1671.           draw_path = true
    : X: I5 ~, ]. W6 z  ?9 g) a+ U
  1672.           new_end_points.push(point_x, up_y)# K2 N2 f. G# J5 B* v3 y/ y3 X; |6 f
  1673.         end1 i( j) j: I6 m1 l. [: o+ j4 l4 ?
  1674.         if sheet[point_x, down_y] == 0                &&
    1 r' E' j% q+ T7 B% `- K& H
  1675.            $game_map.boat_passable(point_x, down_y)  &&# {/ I; A3 `9 u3 ]9 \
  1676.            !collide_with_events(point_x, down_y)     &&
    , Z6 g, _; t6 L( Z( m/ l. Y+ E0 I( V
  1677.            !collide_with_vehicles(point_x, down_y)   #judge_end3 z- `) B5 |# h- W
  1678.           sheet[point_x, down_y] = step6 `9 H" F3 i$ y/ T  m
  1679.           draw_path = true
    7 D7 d9 `# R6 ~5 j* u* |5 F
  1680.           new_end_points.push(point_x, down_y)
    ) N5 H$ {4 k. e5 h
  1681.         end& @+ `5 t: {0 n
  1682.       end#endOfLoop3
    8 ^0 ^) X( |0 {8 S& p: Q
  1683.       break if !draw_path  reach_point. ?. y& E" V4 V( h" D) J0 X) {
  1684.       step += 1
    5 z  s# ]: D( T# g) R! x
  1685.     end #endOfLoop1 路径表格填充完毕
    4 E& r  U/ }% x% M8 `: \* ~$ J. g7 K
  1686.     $mouse_move_sign.transparent = false
    : p2 D- T! _* G( z
  1687.     # 判断指定地点能否抵达
    # f; A( w# t$ w3 B! I; q: ^
  1688.     if reach_point
    2 x+ c& y- M7 O# K" \8 D/ z
  1689.       $mouse_move_sign.direction = 2
    # V  \; d5 W) F9 S
  1690.     else
    - E- ]0 {, t. w, b# X- l: c* s
  1691.       not_reach_point- m! Z8 P) k0 e" g) R0 |
  1692.       return! \# r' T7 U2 M6 \, p" h
  1693.     end8 Y3 r9 [  B7 F- X
  1694.     # 根据路径表格绘制最短移动路径(正向): P7 W3 \, o& W
  1695.     steps = step  2  2/ k1 b( [3 p6 {4 Y! u- v/ P' N5 J
  1696.     loop_times = step  2! i5 a/ I" b0 D$ O5 i- C% Q( ^
  1697.     point_x, point_y = chase_point[0], chase_point[1]
    + Q# ^* e4 E% W4 z$ u4 f) C' R, _
  1698.     for i in 2..loop_times # forLoop
    ) M  L2 @9 O+ u; {! ?7 t
  1699.     steps -= 2
    8 a8 |" Z' {, u$ x0 l
  1700.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs5 `9 [! |  q  y6 l. }/ A2 I
  1701.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
    $ N' D( ^6 B" w
  1702.         chase_path.push(2). J& y$ w+ |4 k( ?8 G: H
  1703.         point_y = $game_map.round_y(point_y + 1)
    7 O$ g! ]9 y& a# m$ E: l
  1704.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
    9 s6 P) i; M" B! ]" m
  1705.         chase_path.push(8)
    1 v, v# i5 ?5 u
  1706.         point_y = $game_map.round_y(point_y - 1): f( r: [4 m" X( z( Y
  1707.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps: w- k. o$ X) ?6 a
  1708.         chase_path.push(4)1 K& z/ r+ P0 d" g9 ~. \6 m# _& [
  1709.         point_x = $game_map.round_x(point_x - 1)
    $ D: {0 t. T7 M' Y
  1710.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
    9 l2 H( N3 `8 d9 ?6 H) P  J
  1711.         chase_path.push(6)
    4 W- D1 L% y, j, |% \+ p! K/ g4 E
  1712.         point_x = $game_map.round_x(point_x + 1)
    # `! M0 E+ B4 }9 x$ \- ~: M* n
  1713.       end
    & W$ m; i- @7 X- o! J3 `5 b( l4 t2 g
  1714.     else
    ' Q) h7 b- P# r
  1715.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps. ?9 A( b- l: T5 ^; U
  1716.         chase_path.push(4)8 S% `) w2 q6 k
  1717.         point_x = $game_map.round_x(point_x - 1): C1 C1 y: i; y; }6 ~$ @
  1718.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
    , s$ l* |& H' W6 S1 `0 i
  1719.         chase_path.push(6); W( h7 ?& N* \9 t/ H! L
  1720.         point_x = $game_map.round_x(point_x + 1)
    9 Y8 C3 y- U2 W
  1721.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
    # {& k! I; O, S3 f  |2 p6 b$ f
  1722.         chase_path.push(2)
    & s0 P4 P: @9 H
  1723.         point_y = $game_map.round_y(point_y + 1)
    , c& n( ^" S! j  y% w
  1724.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps5 F" G* b1 L% E2 ?& C4 j) U, V) X
  1725.         chase_path.push(8)
    ' s  y& @$ G+ t
  1726.         point_y = $game_map.round_y(point_y - 1)
    ; p" Y, F9 n- a: c1 J
  1727.       end
    2 V# |4 W, x8 [* g. W- y
  1728.     end7 \  x+ O& L0 u3 T0 r
  1729.     end #endOfForLoop% U( \# a1 ^8 j4 K' T# e1 B- ^! U
  1730.     # 如果指定点无法抵达或者登陆3 Z; @: L4 }# n
  1731.     return not_reach_point unless landable(@moveto_x, @moveto_y, chase_path)+ e9 f4 V1 h) p+ A
  1732.     # 根据路径表格绘制最短移动路径(反向)
    ! g% B; _  ~% l4 {
  1733.     steps = step  2  2 + 1! ?# p& L! {; b# N% T# F& b1 o0 d
  1734.     loop_times = step  2
    + _( z9 k9 Y7 I8 t' N
  1735.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]
    . a1 r4 A1 o8 H. W- Z' Z
  1736.     for i in 1..loop_times # forLoop
    8 l1 q- Y' d8 T$ o  R  z
  1737.     steps -= 2
    1 ]6 i- p$ Y4 Q( i3 l0 X
  1738.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs: O; @0 ?- r$ a, ~4 B
  1739.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps% S$ |8 L) Y6 H) t4 |) U9 {9 c& {
  1740.         reversed_chase_path.push(6)
    2 F5 X6 V9 M9 y$ a4 b( k; G$ t( j4 f
  1741.         point_x = $game_map.round_x(point_x - 1)9 G8 d$ l) l3 E
  1742.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps) S) V  A1 a; H4 R5 e+ ?, L
  1743.         reversed_chase_path.push(4)  T& G- }6 O6 H/ F5 ~
  1744.         point_x = $game_map.round_x(point_x + 1)7 T& }* f. w" c5 x
  1745.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
    % T- h5 `/ j( I
  1746.         reversed_chase_path.push(8)
    6 L8 @; {$ R/ i: Z$ B/ N; b. ~
  1747.         point_y = $game_map.round_y(point_y + 1)/ a# C& L) K$ M, [: \, @
  1748.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
    , Z. ~) |% \2 z/ f& [) l+ U1 ]
  1749.         reversed_chase_path.push(2)
    * I3 Z7 X* x- ?. r, o; f$ M
  1750.         point_y = $game_map.round_y(point_y - 1)
    8 [/ b# c+ w% g8 X' r- I! u
  1751.       end- E$ N+ J2 x6 K& W" o. P) K' @
  1752.     else
    ! b8 P. d! P. Y8 l+ ?0 P
  1753.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
    5 Q5 B2 _1 z  W9 u
  1754.         reversed_chase_path.push(8)
    , h+ P: K0 s, D* G8 [
  1755.         point_y = $game_map.round_y(point_y + 1)8 |" ]" G7 s# E) D9 C6 r
  1756.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps2 [/ L' Y; O( A
  1757.         reversed_chase_path.push(2)
    8 D8 S( }, D4 ^  g; o& ^
  1758.         point_y = $game_map.round_y(point_y - 1)9 y* D3 V+ U. a! @8 n; Y
  1759.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
    ' l4 Q- o! ?9 V+ Q' \
  1760.         reversed_chase_path.push(6)' z# s) v% u0 p# H" I, n" y  S7 r
  1761.         point_x = $game_map.round_x(point_x - 1). y2 U( m  ?" Q+ Q: d: z
  1762.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps, F3 o4 L) Z8 o, |4 z
  1763.         reversed_chase_path.push(4)+ z7 M; n1 ~# X5 k- m
  1764.         point_x = $game_map.round_x(point_x + 1)
    ; \( O6 a7 p  X, K6 f& R! \: t
  1765.       end
    6 p* }, |$ e/ e/ p; V
  1766.     end: [' H9 U# e3 P3 [6 x; e) V; v) Q
  1767.     end #endOfForLoop" m" F" p# t6 ?6 L
  1768.     @mouse_move_path = reversed_chase_path.reverse + chase_path2 U, p2 G, }1 O' N  f. P8 x
  1769.   end#boat
    , f/ Z$ m8 n2 V
  1770.   #--------------------------------------------------------------------------( F: u% c' H6 X1 D  _
  1771.   # ● 绘制ship的移动路径 @array[move_directions...]% ]0 r# z. g' V# x! [
  1772.   #--------------------------------------------------------------------------
    ; Q8 m6 n" R# {3 d% L
  1773.   def draw_ship_path. W* z4 f: w1 X  c6 u/ s" ~
  1774.     # 准备绘制路径表格1 G; Q& V  F1 y+ H5 P/ P+ W: d
  1775.     sheet = Table.new($game_map.width, $game_map.height)4 u) O" K4 m" A& J: C# g
  1776.     reversed_chase_path  = []; chase_path  = []3 u* R# m7 l% w$ r  a0 P- O7 g
  1777.     reversed_chase_point = []; chase_point = []/ J, C  k+ \' f' z- F
  1778.     new_start_points = [x, y]; new_end_points = [@moveto_x, @moveto_y]3 O( e1 p# }; u9 C
  1779.     sheet[x, y] = 1;           sheet[@moveto_x, @moveto_y] = 2: l# x% ^2 e: p4 Z- s
  1780.     reach_point = false7 s0 I% w. l$ ~# c# |
  1781.     step = 3
    & o* A4 y. Q% e: C/ [
  1782.     loop do #loop1 开始填充表格) j8 D- ~: m3 r* Z5 K; Q  J3 L
  1783.      draw_path = false9 N; z$ q7 K# R9 ~' e' |6 ?4 t
  1784.      check_points = new_start_points
    , z/ r- l) W7 y# |2 A+ \( P* o
  1785.      new_start_points = []% j/ Q. [  i5 ?' l+ ]
  1786.       loop do #loop2 从起点开始正向填充1 i, x) H  o+ X! v. ]; C+ i
  1787.         point_x = check_points.shift
    5 S  v; O# P1 s$ I* l8 g8 L
  1788.         break if point_x == nil
    ) [3 R2 t$ ^2 ?: ~
  1789.         point_y = check_points.shift
    7 d& p& p' E! H2 V. J
  1790.         left_x  = $game_map.round_x(point_x - 1): ], Q/ M% Z4 b/ j, O6 @
  1791.         right_x = $game_map.round_x(point_x + 1)
    * y$ Z' h- S2 p
  1792.         up_y    = $game_map.round_y(point_y - 1)( l* i* S* m3 t0 [4 s) M
  1793.         down_y  = $game_map.round_y(point_y + 1)
    9 M* B4 b# T0 H* g5 C* ?# H% \$ d
  1794.                     # 判断路径是否连通/ |) U% A# q3 m3 k2 w
  1795.         path_step = step - 1
    : X6 r$ J& M7 y& L( O
  1796.         if sheet[left_x, point_y] == path_step
    8 W& w; W7 l2 Y, _( p' O
  1797.           chase_path.push(4)
    ! ^( {$ u* a9 s& W6 Q
  1798.           chase_point = [left_x, point_y]- u8 p8 V0 y( l5 W% n9 z& W: n
  1799.           reversed_chase_point = [point_x, point_y]  J4 P7 J  t; l/ H0 t0 `, P! T3 L
  1800.           reach_point = true; break
    8 h, O& p# [/ l) [& q- I1 w6 l9 _
  1801.         elsif sheet[right_x, point_y] == path_step3 f% r+ J' X% S' h3 _
  1802.             chase_path.push(6)
    2 f9 w0 ^% D& l  Q
  1803.             chase_point = [right_x, point_y]/ u. F& F5 m6 g0 J/ m6 K/ t9 I
  1804.             reversed_chase_point = [point_x, point_y]
    7 _/ M8 ?6 @; F, ^5 I
  1805.             reach_point = true; break
    ) ^* c# @$ @* }) W0 [0 K- K
  1806.         elsif sheet[point_x, up_y] == path_step* e& {0 [6 d7 G3 v0 ^- I- G' k; \9 D
  1807.             chase_path.push(8)
    % A+ I' Q+ P* t5 D5 P& w- [/ O
  1808.             chase_point = [point_x, up_y]+ ~7 |: f! t* D5 h" h, V6 t9 N; ^
  1809.             reversed_chase_point = [point_x, point_y]
    / C! e" ~! q; Z% @0 n7 z
  1810.             reach_point = true; break
    8 m* b9 d+ j. R% f: N
  1811.         elsif sheet[point_x, down_y] == path_step
    ; x5 ^: d" v9 i) [, B6 r: e
  1812.             chase_path.push(2)
    8 X& a# r, D9 F
  1813.             chase_point = [point_x, down_y]
    0 |( ~0 C0 O1 w, T
  1814.             reversed_chase_point = [point_x, point_y]; n6 m3 @* e3 ~
  1815.             reach_point = true; break
    / b) u% A. {) X
  1816.         end
    , D; Z/ ?! z9 |7 Q- g
  1817.         # 以需要抵达该点的步数填充路径表格 #( \! V, E- M/ o% g9 `* F
  1818.         if sheet[left_x, point_y] == 0                &&
    ( Q5 U7 H1 p% F# A; c
  1819.            $game_map.ship_passable(left_x, point_y)  &&% ~4 W8 |: [# d5 O. z) f: I
  1820.            !collide_with_events(left_x, point_y)     &&0 W+ j- J- a. j! h$ S
  1821.            !collide_with_vehicles(left_x, point_y)   #judge_end& y3 M" e1 ]: d# I# ^
  1822.           sheet[left_x, point_y] = step. Y3 a1 M* `+ q- I6 N5 x! ~% A
  1823.           draw_path = true# m" q5 t: ]8 O- f1 d4 E8 ~
  1824.           new_start_points.push(left_x, point_y), q* u" m3 `5 y: r2 f" ]* p$ [
  1825.         end+ ?/ O. t2 \) ?8 c3 U
  1826.         if sheet[right_x, point_y] == 0               &&
    2 R) F- D1 b7 E2 N
  1827.            $game_map.ship_passable(right_x, point_y) &&5 I& d- G( R' p  A  D
  1828.            !collide_with_events(right_x, point_y)    &&
    / W% Y; o; t1 z0 W4 P
  1829.            !collide_with_vehicles(right_x, point_y)  #judge_end5 B5 j8 }* S4 W& h/ `/ h- f* G: I
  1830.           sheet[right_x, point_y] = step) T5 x0 X1 @8 M: K
  1831.           draw_path = true& R4 u2 r8 j2 i" \- z2 a
  1832.           new_start_points.push(right_x, point_y)
    1 J( E% D8 p  Y7 ^/ f
  1833.         end
    / u$ y0 \! m' g! _
  1834.         if sheet[point_x, up_y] == 0                  &&
    % J. o1 _+ T+ I8 L5 ?. ~4 u, h- r
  1835.            $game_map.ship_passable(point_x, up_y)    &&
    4 C$ V. x5 Q" m0 Z7 ?  X; P
  1836.            !collide_with_events(point_x, up_y)       &&
    5 Q& \! x. B' @& D* h
  1837.            !collide_with_vehicles(point_x, up_y)     #judge_end3 b/ b) f0 o8 z" f
  1838.           sheet[point_x, up_y] = step
    8 O' J/ i+ A/ Y. i8 m, c" [
  1839.           draw_path = true, b) t) \( \0 D' G# o- @) R% q, C
  1840.           new_start_points.push(point_x, up_y)0 _9 H' |: h! s0 u
  1841.         end* N( Z8 l6 j1 s
  1842.         if sheet[point_x, down_y] == 0                &&
    5 P0 k  s; K, O( q
  1843.            $game_map.ship_passable(point_x, down_y)  &&* y, |" i* i$ L' T) n5 o4 |
  1844.            !collide_with_events(point_x, down_y)     &&
    8 b9 h* v/ q! r7 j* g5 n% Z: G/ `
  1845.            !collide_with_vehicles(point_x, down_y)   #judge_end
    / K$ p) x! A' _8 a
  1846.           sheet[point_x, down_y] = step
    / q. }6 {% p5 S# m6 V, A0 ?
  1847.           draw_path = true6 u& t3 n$ A, ], j1 p. I2 z: O
  1848.           new_start_points.push(point_x, down_y)9 k1 J1 e3 X9 a0 d+ V: j  j. Q
  1849.         end
    % p" K0 g" k* C+ m
  1850.       end#endOfLoop2
    , Y* I6 D$ b% X
  1851.       break if !draw_path  reach_point' Y# V' d( @$ Z1 ?$ `
  1852.       draw_path = false, T9 o  C! r% o( M. u' J2 d6 A) D
  1853.       check_points = new_end_points% {- S6 ]" K' _
  1854.       new_end_points = []: |- d: p/ `/ s; W3 \
  1855.       step += 1
    6 U+ J8 q5 d; ~* E: m8 T+ L5 p9 O
  1856.       break if step  KsOfSionBreak_Steps &&
    8 P$ I, p( p4 T7 z" U5 U! F
  1857.                !Input.press(KsOfSionFind_Path_Key)
    * b- m: z0 `- |0 e% t* d
  1858.       loop do #loop3 从终点开始反向填充, H9 ~7 g1 _; n  s" g( w7 s7 B
  1859.         point_x = check_points.shift  T3 w! H  U( u1 I* P
  1860.         break if point_x == nil9 e1 Y& O, W7 B! s* r9 R
  1861.         point_y = check_points.shift1 d: o0 ^1 N4 a  Y; v, ]4 D
  1862.         left_x  = $game_map.round_x(point_x - 1)
    : m4 }, q. G9 l3 T1 }
  1863.         right_x = $game_map.round_x(point_x + 1)" ^- s" e+ O; J: v1 C" `$ Q" ^; s
  1864.         up_y    = $game_map.round_y(point_y - 1)) h8 a1 ?& D3 v+ K
  1865.         down_y  = $game_map.round_y(point_y + 1)
    & V( f% t& @3 B6 Z+ d+ ~! ]8 e& q. D
  1866.         # 判断路径是否连通
    : R0 P4 z" c) Y+ m3 j2 T
  1867.         path_step = step - 1
    + N4 ]0 u! z5 y0 }' h
  1868.         if sheet[left_x, point_y] == path_step! ]; L" F1 `0 E
  1869.           chase_path.push(6)
    6 p) Z4 U" k9 x# h& d" c
  1870.           chase_point = [point_x, point_y]" S9 z" @7 l7 J& V! V6 a
  1871.           reversed_chase_point = [left_x, point_y]0 [% B6 ~5 h' x1 i' z! Z+ ^
  1872.           reach_point = true; break
    % H0 l2 X9 o0 y/ v' ?+ F9 S- w/ D$ ~
  1873.         elsif sheet[right_x, point_y] == path_step  _; i9 B; q- M: ^& M0 ^
  1874.             chase_path.push(4)* ^! g3 U# C9 ]" a9 t4 t
  1875.             chase_point = [point_x, point_y]% c0 p# X# A9 S" R5 C3 u
  1876.             reversed_chase_point = [right_x, point_y]
    6 i1 o! u7 \' R: Q3 ]1 A, n
  1877.             reach_point = true; break  r$ p$ O4 I1 k5 y' n
  1878.         elsif sheet[point_x, up_y] == path_step" H' g9 {& G: X& d3 u' ~% K
  1879.             chase_path.push(2)- {2 |& G; c0 j9 [* ~
  1880.             chase_point = [point_x, point_y]
    8 m' N2 `6 g0 [6 z6 R4 ]2 O
  1881.             reversed_chase_point = [point_x, up_y]8 H, E* Z# v+ t4 v% x' B' ]
  1882.             reach_point = true; break
    " U; Y2 j/ J3 m' a- k8 c7 z
  1883.         elsif sheet[point_x, down_y] == path_step- B* ^0 O% I  M) I( W1 |
  1884.             chase_path.push(8)9 c) j$ Y7 m( N  s
  1885.             chase_point = [point_x, point_y]3 K1 T  w) q( w! @7 b4 i/ N$ Z& C) f
  1886.             reversed_chase_point = [point_x, down_y]
    ; X. T) H9 X0 U
  1887.             reach_point = true; break" l' [$ `# P* [5 H0 `4 a
  1888.         end: m* ?0 }! Z- @0 t! Z3 Y
  1889.         # 以需要抵达该点的步数填充路径表格 #
    0 ]% P; b6 |( Z% a4 h; _
  1890.         if sheet[left_x, point_y] == 0                &&
    $ w7 z* b% p# W: d6 `6 l; J
  1891.            $game_map.ship_passable(left_x, point_y)  &&
    & N6 c+ T, Y9 w* M6 u+ d9 x& }
  1892.            !collide_with_events(left_x, point_y)     &&$ Z: p1 T. Q, R) Q. B
  1893.            !collide_with_vehicles(left_x, point_y)   #judge_end! k3 ~1 G2 d4 R5 m# @0 p( F# \
  1894.           sheet[left_x, point_y] = step2 D" R  T9 r  M5 [1 P! q/ o# o
  1895.           draw_path = true. s7 s  n4 B1 r7 \
  1896.           new_end_points.push(left_x, point_y)
    . Q6 C$ l$ \) N8 K  N9 _3 m
  1897.         end
    ; b( }! b9 w9 O; Z8 h
  1898.         if sheet[right_x, point_y] == 0               &&
    3 D* `' K8 B2 Q5 z: h
  1899.            $game_map.ship_passable(right_x, point_y) &&& P5 A- ~+ o0 ]( y/ f( c
  1900.            !collide_with_events(right_x, point_y)    &&
    . r, L: c0 R. X' V: h; @( `, B% a
  1901.            !collide_with_vehicles(right_x, point_y)  #judge_end
    8 L# `3 `2 S3 r, l
  1902.           sheet[right_x, point_y] = step  w* j' W5 o( s8 ?0 |
  1903.           draw_path = true
    7 y1 i7 o6 z2 T0 _& {
  1904.           new_end_points.push(right_x, point_y)
    , }) B( r' Q9 v4 W
  1905.         end; n1 ~) ~6 v! y4 e# m
  1906.         if sheet[point_x, up_y] == 0                  &&
    . |& F  j) G- ^2 z# t
  1907.            $game_map.ship_passable(point_x, up_y)    &&
    + |; |: ]1 a2 M4 X
  1908.            !collide_with_events(point_x, up_y)       &&; O% w; c& G  c& L6 u0 E9 Q
  1909.            !collide_with_vehicles(point_x, up_y)     #judge_end
    6 m7 u0 E. h+ g& Q3 u
  1910.           sheet[point_x, up_y] = step4 ], J8 Q7 \" i
  1911.           draw_path = true
    . Z; ?6 B" g0 Z3 ?3 O6 |
  1912.           new_end_points.push(point_x, up_y)
    ) W1 Y( ]8 d% G7 `0 {# L. M
  1913.         end
    ; p+ J% q* Z7 U
  1914.         if sheet[point_x, down_y] == 0                &&
    1 {, r; W# d: J$ `& U7 d& T
  1915.            $game_map.ship_passable(point_x, down_y)  &&
      }! n- E* X; O3 x$ j
  1916.            !collide_with_events(point_x, down_y)     &&
    & @) ^8 p% t8 F; y
  1917.            !collide_with_vehicles(point_x, down_y)   #judge_end" {+ [% z0 m0 G) Y) z3 w" p3 L
  1918.           sheet[point_x, down_y] = step+ s1 c& P2 ^$ Q+ f, f8 C0 {
  1919.           draw_path = true
    # }. y, y( C# J: Z9 Z
  1920.           new_end_points.push(point_x, down_y), l; X/ X2 T4 J1 ]9 {# q
  1921.         end& W( h6 a0 f& k0 W2 l# d8 Q
  1922.       end#endOfLoop3
    8 }& O$ R4 q; K6 a# y0 w
  1923.       break if !draw_path  reach_point4 [8 u7 g, A* v1 o6 P- T9 A
  1924.       step += 11 ?% y. K$ L5 z: E( u# B
  1925.     end #endOfLoop1 路径表格填充完毕% X9 {' Q- E+ U3 l' j
  1926.     $mouse_move_sign.transparent = false% e4 G3 q# D6 {" o, a, E' C3 g/ r% J
  1927.     # 判断指定地点能否抵达/ B1 O& B1 v2 B. ^5 _7 k9 G2 r7 E9 f
  1928.     if reach_point+ H. w- |. u7 L. ~
  1929.       $mouse_move_sign.direction = 2
    3 g! B) ?! `# ?! w- C: \2 m0 J9 F
  1930.     else
    ; k) P! ]6 O/ i; \7 z
  1931.       not_reach_point
    / c5 h3 r' q7 N! [. u2 x8 x# d1 @
  1932.       return/ ~. X/ A4 [" \/ K' `
  1933.     end
    - k- \1 T* e2 `
  1934.     # 根据路径表格绘制最短移动路径(正向)
    4 V' X$ {2 T. b
  1935.     steps = step  2  2
    . D1 P5 k6 j$ |- k4 f4 s: b( o
  1936.     loop_times = step  2% w5 O- S, Z  Q* ^$ B: \5 W
  1937.     point_x, point_y = chase_point[0], chase_point[1]" U5 D7 C  j' x2 O8 C* Y9 C- @
  1938.     for i in 2..loop_times # forLoop
    $ Y& {* F6 O, N1 M; H" n- v- c
  1939.     steps -= 28 T! s# ?! F4 Z! h% b* l
  1940.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs: f, @* U0 R1 O. ]7 ~" Q& q$ x
  1941.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps
    / n& c' T1 M/ n# G6 A8 [2 F
  1942.         chase_path.push(2)7 n  J9 Q( s2 y
  1943.         point_y = $game_map.round_y(point_y + 1)& q; Q! U; a' D% K$ f
  1944.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps. t& v# V" B& E' {
  1945.         chase_path.push(8)
    - m) e7 i$ a2 P5 L5 T
  1946.         point_y = $game_map.round_y(point_y - 1); T% @6 }7 r7 ^# z, i9 X
  1947.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps  P3 `8 a1 c# F! {
  1948.         chase_path.push(4)
    9 W- S6 M8 l6 c9 _
  1949.         point_x = $game_map.round_x(point_x - 1)
    ) g+ X. z: V0 L
  1950.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
    ) Z+ a' L: i9 ^" Z
  1951.         chase_path.push(6)
    ( @: K# Y1 b. {' J% J! T
  1952.         point_x = $game_map.round_x(point_x + 1)
    ( m8 M. w  N, V" E
  1953.       end3 F5 m9 U2 y8 C3 R% y1 L/ W
  1954.     else+ C% C- }# f) n
  1955.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps
    , g' n4 I# Y" u7 v& g) r. }1 E
  1956.         chase_path.push(4)# T4 M$ i2 _( c3 T
  1957.         point_x = $game_map.round_x(point_x - 1)
    . v' w! a1 ^9 J9 d2 y
  1958.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps, F, k4 \, h. h! j0 A
  1959.         chase_path.push(6)
    4 e2 _( _3 C* d  q9 C: X
  1960.         point_x = $game_map.round_x(point_x + 1)
    1 R" U4 Q- C1 F- J/ V
  1961.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps
    : b5 H0 a+ ^6 `) e5 I3 O7 Q
  1962.         chase_path.push(2)
    2 e3 w6 l2 |  U- M9 Y/ H9 ~
  1963.         point_y = $game_map.round_y(point_y + 1)& T' F& G- s5 D# [) l; E
  1964.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps/ n0 X/ M# }. A! H5 }
  1965.         chase_path.push(8)
    ) [" w  w; I7 Y! A  R
  1966.         point_y = $game_map.round_y(point_y - 1). x# ?+ R. ^+ X2 j) W
  1967.       end
    , k$ H) z6 I+ }& t
  1968.     end# x. {4 n. b" B8 U1 p1 Z; u* X4 q
  1969.     end #endOfForLoop# P3 Z5 f0 Q' k: i3 F3 ?  F, n4 O
  1970.     # 如果指定点无法抵达或者登陆
    ! P/ ^& N2 ?: t( y
  1971.     return not_reach_point unless landable(@moveto_x, @moveto_y, chase_path), f' p# T- j9 c% ]3 V9 ]+ x
  1972.     # 根据路径表格绘制最短移动路径(反向)
    3 A2 y; a( _* `
  1973.     steps = step  2  2 + 1
    ! r5 b8 P. A2 C! M% R
  1974.     loop_times = step  2. |7 M$ X; w, e8 t% |
  1975.     point_x, point_y = reversed_chase_point[0], reversed_chase_point[1]
    0 t9 Z" E6 W& R7 \+ }1 W
  1976.     for i in 1..loop_times # forLoop  V. z+ E3 U2 J+ A1 y. [  ~( ?  T0 h
  1977.     steps -= 2
    ' e8 p% J' c5 z8 U* \$ H( b+ K
  1978.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs
    ' U, @) ]; w7 A$ V2 Y9 }4 C9 D# P
  1979.       if    sheet[$game_map.round_x(point_x - 1), point_y] == steps1 F, ]- ]  Y' O& [$ _2 J) B
  1980.         reversed_chase_path.push(6)6 P  z! {  C9 _3 J" z3 p2 X: t) C
  1981.         point_x = $game_map.round_x(point_x - 1)
    ( L* Q8 X7 W! n
  1982.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps
    ( I( f3 x0 B2 T
  1983.         reversed_chase_path.push(4)
    - S# w# x: Z8 w
  1984.         point_x = $game_map.round_x(point_x + 1)
    5 P0 g# L+ F7 f7 f( I- Y$ q
  1985.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == steps% Y. N6 I$ q) J+ K( [  y
  1986.         reversed_chase_path.push(8)/ }+ g; c4 c# K: m* E
  1987.         point_y = $game_map.round_y(point_y + 1)* Y4 h9 R+ v+ N; W
  1988.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps
    ( ~4 \6 C2 \$ I7 g4 q% N1 [
  1989.         reversed_chase_path.push(2)
    0 {. u% q1 X( [) R' V6 H
  1990.         point_y = $game_map.round_y(point_y - 1)2 J: o& K$ Z- p* N9 M: k% E. Q
  1991.       end
    $ v1 C* o8 J5 ]+ v1 b: v
  1992.     else
    9 X1 z4 [* [' L  r9 |9 e  i
  1993.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == steps: C5 i* U2 E5 |
  1994.         reversed_chase_path.push(8)
    " [* R/ |  S! {
  1995.         point_y = $game_map.round_y(point_y + 1)
    / c, L$ h& ^8 F/ _
  1996.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == steps: u& g- M& l; G& E- b0 d
  1997.         reversed_chase_path.push(2)1 i: s4 K' s, V- |4 J' j
  1998.         point_y = $game_map.round_y(point_y - 1). H+ N! w3 K1 M, }
  1999.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == steps
    ) I: x7 g; G6 r/ I* N+ ?+ |- F3 u
  2000.         reversed_chase_path.push(6). `" _/ @' m4 U- Q5 ~
  2001.         point_x = $game_map.round_x(point_x - 1)
    - g) ?, ^9 G, M6 K
  2002.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == steps( w4 @/ @, H" A) |9 U
  2003.         reversed_chase_path.push(4): i1 v( V7 e* t9 Z% l
  2004.         point_x = $game_map.round_x(point_x + 1)
    $ ?$ [3 l: u, c0 d3 n: r
  2005.       end
    - ~9 \0 w' n4 c3 ^# ^- s
  2006.     end* S' b3 ?- T4 K) O$ P* M
  2007.     end #endOfForLoop4 d; G0 h$ e/ e& H" g
  2008.     @mouse_move_path = reversed_chase_path.reverse + chase_path' t: U* q* {7 Z
  2009.   end#ship7 {8 `3 C; \( o
  2010.   #--------------------------------------------------------------------------
    3 w0 z( z$ f; Z3 M0 E2 N2 Q
  2011.   # ● 绘制airship的移动路径 @array[move_directions...]4 `; y  t* m6 c& e+ U& U
  2012.   #--------------------------------------------------------------------------
    " e8 {! c2 J4 N* x% ]- o
  2013.   def draw_air_path4 Z" a- n2 z9 ?+ `" T( J( X
  2014.     $mouse_move_sign.transparent = false
    / r) r! j2 Q8 T- b# ?& L
  2015.     # 准备绘制路径表格
    ( Y) ~( d5 Q' K0 C/ B
  2016.     sheet = Table.new($game_map.width, $game_map.height)+ s4 R3 p6 b* n4 K" Q
  2017.     new_check_point = [x, y]; sheet[x, y] = 1
    8 w  a( q$ e: t% A( D
  2018.     reach_point = false;      step = 2
    5 G2 g+ J6 D& v' U
  2019.     loop do #loop1
    8 L2 w- O! Y% `- B2 N
  2020.      check_point = new_check_point$ \% S: ^1 [: ?; m, s) j
  2021.      new_check_point = []( x+ Y" R1 E8 Z4 ~+ K% w
  2022.       loop do #loop2
    5 e: V8 e* E* A# S1 g
  2023.         point_x = check_point.shift6 k$ W1 ~& t7 {; j+ @# H0 B
  2024.         break if point_x == nil
    ! C* F/ N4 x& w
  2025.         point_y = check_point.shift* }3 u- S$ L" H# a3 y+ d5 Q# F
  2026.         if point_x == @moveto_x && point_y == @moveto_y
    ! f4 N' ~6 b. y/ `% X) _
  2027.           reach_point = true; break/ q/ m# _- Q( ~) e, o
  2028.         end
    - D) F* }4 s  z/ |; t* Z' l8 U
  2029.         left_x  = $game_map.round_x(point_x - 1)
    ' b( K4 j! }% \& u8 k& k( o
  2030.         right_x = $game_map.round_x(point_x + 1)
    0 Q/ }$ R+ L' n7 t0 w; r
  2031.         up_y    = $game_map.round_y(point_y - 1)% \! h9 D, ^3 l1 n5 S4 t+ O  O! _3 A
  2032.         down_y  = $game_map.round_y(point_y + 1) * P4 d+ n$ z5 T9 C/ R
  2033.         # 以需要抵达该点的步数填充路径表格 #
    ' y( X, m* O, @: f
  2034.         if sheet[left_x, point_y] == 0! r% r4 J! }/ K; t% \0 a
  2035.           sheet[left_x, point_y] = step
    - p* ^& \# m" }; O4 f. Y
  2036.           new_check_point.push(left_x, point_y)
    " r3 W. B7 K, S& R7 g& [
  2037.         end
    + ?( \( B3 ^0 H" Y' O4 V: K7 a
  2038.         if sheet[right_x, point_y] == 04 q0 |2 _; v3 r! b
  2039.           sheet[right_x, point_y] = step# y* U1 U7 s9 P7 x3 f! ?" S
  2040.           new_check_point.push(right_x, point_y)- S1 Z5 Z2 T/ Z7 M3 t
  2041.         end
    ( f9 ~, ~4 L: g, z/ A3 A& ~4 O5 U
  2042.         if sheet[point_x, up_y] == 0. F: u; s; `: d7 @
  2043.           sheet[point_x, up_y] = step
    2 f1 l8 J5 L* F, ?; I5 m
  2044.           new_check_point.push(point_x, up_y)
    " c1 }) [8 ]3 J+ z* B$ E
  2045.         end# c: x" A9 R, _8 }, L$ _( `+ l
  2046.         if sheet[point_x, down_y] == 00 ]( d. m8 s7 E
  2047.           sheet[point_x, down_y] = step& _' \+ l. L! J: M* n$ D
  2048.           new_check_point.push(point_x, down_y)
    6 I7 Z  Y# U/ q9 m2 a+ p
  2049.         end
    3 P5 W) _8 ]3 f* n
  2050.       end#endOfLoop29 `. t; ~  [- N  m$ D; c
  2051.       break if reach_point' H7 i. G+ [, G% Y% M7 ?0 u
  2052.       step += 1, h! g9 X, T% ]+ T. D
  2053.     end #endOfLoop1+ P7 z1 C# K- Y- u
  2054.     # 根据路径表格绘制最短移动路径 #
    9 T6 y$ k* k0 ~
  2055.     reversed_chase_path = []; step -= 14 F! e% q2 ?1 [4 k8 }; j
  2056.     point_x, point_y = @moveto_x, @moveto_y
    - N# z' j6 N: O0 S) g6 D
  2057.     for i in 2..step/ g4 P- D+ ^! V+ M3 ~0 c3 o
  2058.     step -= 1
    6 x( C6 c: D# s6 ~/ J
  2059.     if (@moveto_x - point_x).abs  (@moveto_y - point_y).abs$ Y: _) @0 q3 {6 L; |- M. Y
  2060.       if    sheet[$game_map.round_x(point_x - 1), point_y] == step2 i2 t/ E. U" I7 p# F9 ]# @6 d
  2061.         reversed_chase_path.push(6)
    + i' U7 t; ]' a2 k% ]! S
  2062.         point_x = $game_map.round_x(point_x - 1)
    2 s6 d2 Y- o: k$ a! Z% |
  2063.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == step7 U( J# B$ k+ [+ A+ E- V) e4 c1 K
  2064.         reversed_chase_path.push(4)* n  ?* o2 k' \! d8 [3 A
  2065.         point_x = $game_map.round_x(point_x + 1)+ M# v2 x$ F- e7 a. B9 L. ]1 P# A
  2066.       elsif sheet[point_x, $game_map.round_y(point_y + 1)] == step
    " i; y2 V) P7 H, [3 @
  2067.         reversed_chase_path.push(8)
    7 b. F5 o4 ^- E! L# F/ G
  2068.         point_y = $game_map.round_y(point_y + 1)
    6 \. Q; `4 @& F4 U2 C9 R+ ]
  2069.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step( Y2 z% F/ \' v# d
  2070.         reversed_chase_path.push(2)
      a+ K( |+ W- r0 g$ m* A
  2071.         point_y = $game_map.round_y(point_y - 1)6 y5 A  {, W+ c- O4 M* A: d1 {9 c
  2072.       end1 `& S! a$ X! A: Y2 A
  2073.     else" x3 q( h, j7 x% w  _: P( m7 p
  2074.       if    sheet[point_x, $game_map.round_y(point_y + 1)] == step- C) P1 M9 P! z# O3 k9 Q
  2075.         reversed_chase_path.push(8)
    . g1 U, O/ M5 ]$ i/ t, ]
  2076.         point_y = $game_map.round_y(point_y + 1)3 L# t; i6 c, j
  2077.       elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step
    ) J& {$ w; ?+ i( ^  Z5 N
  2078.         reversed_chase_path.push(2)
    ( ]. n: {2 f9 Y& ^
  2079.         point_y = $game_map.round_y(point_y - 1)  L$ k4 A' B; \7 G5 z
  2080.       elsif sheet[$game_map.round_x(point_x - 1), point_y] == step
    6 x2 v# R& H2 `" p3 s" x+ i0 q) G( O6 q
  2081.         reversed_chase_path.push(6)
    4 j7 u% K8 c$ j! G+ |* k4 D) y
  2082.         point_x = $game_map.round_x(point_x - 1)3 K% F& H0 u8 ~/ ~+ G! x* l5 N
  2083.       elsif sheet[$game_map.round_x(point_x + 1), point_y] == step3 Z7 \$ ?3 I+ |% |
  2084.         reversed_chase_path.push(4)
    1 v! q9 n# E, N1 F; |
  2085.         point_x = $game_map.round_x(point_x + 1)2 i/ s( ?/ q: @- r! f4 f) ]! A
  2086.       end
    8 |8 \$ m" _9 c, x
  2087.     end
    ' T4 H- i& v0 ~* H
  2088.     end #endOfForLoop
    2 p& h1 @, D( O5 m8 Y
  2089.     @mouse_move_path = reversed_chase_path.reverse
    9 z. d& m' W% U
  2090.   end#airship
    ( }' A0 J5 B, g: |
  2091.   #--------------------------------------------------------------------------
    , W6 }6 c: a- G0 e7 L/ G
  2092.   # ● 目标点无法抵达时的处理,用于各路径绘制方法内部2 ^/ F3 r) v! v+ O- J
  2093.   #--------------------------------------------------------------------------
    ! k" F. l* R4 n. B4 @& x
  2094.   def not_reach_point( z; i; y' K6 R- N: t
  2095.     $mouse_move_sign.direction = 49 }: t( G. D! D: S* h2 j
  2096.     dx = 0; dy = 0; dir = 0
    " z8 B6 @$ q9 x, D3 z& O) W0 D& [
  2097.     if @moveto_x - x  0
    " [% ~, Q. R, [1 r$ j- t
  2098.       if @moveto_x - x  $game_map.width - @moveto_x + x &&* G% D# h8 Z4 U/ D6 R
  2099.           $game_map.loop_vertical
    5 \* c  m7 o1 z% H  N& D
  2100.         dx = $game_map.width - @moveto_x + x; dir = 4+ k' Y( M* i, u$ ~* D+ ~( S
  2101.       else+ Y5 ?' Q0 T8 j3 X, H
  2102.         dx = @moveto_x - x; dir = 6
      z) |/ g, E( G" j; q: `, H1 v
  2103.       end4 m4 ?, f# m; [+ e, Y; n# P2 ]$ W
  2104.     else0 \# g$ r0 J' ^9 z) C1 `
  2105.       if x - @moveto_x  $game_map.width - x + @moveto_x &&
    . j! r7 R( B1 ^; S& c
  2106.           $game_map.loop_vertical" Y) S5 B) ^  ?$ O% L: w) @: a& X
  2107.         dx = $game_map.width - x + @moveto_x; dir = 6
    % Y/ n; @6 K7 c8 f4 h
  2108.       else
    9 O  M9 \+ ~9 q" {: w/ Z/ d
  2109.         dx = x - @moveto_x; dir = 4% ]- x; F3 d& S: X
  2110.       end# ], q2 i# `$ }$ n
  2111.     end1 V, C7 S( N3 E. V
  2112.     if @moveto_y - y  0
    # B& J6 a9 `; w6 d* L/ j: t4 N
  2113.       if @moveto_y - y  $game_map.height - @moveto_y + y &&8 M& k! N. m( u3 p4 i9 C
  2114.           $game_map.loop_horizontal
    2 n4 C& t; b" H, m% P' L+ b
  2115.         dy = $game_map.height - @moveto_y + y4 n/ k" y' v/ v8 e) B" o0 E5 Q
  2116.         dir = 8 if dy  dx
    0 T9 g+ u/ D0 p& x" [' y( b
  2117.       else! W  v3 ?0 }5 l5 Z
  2118.         dy = @moveto_y - y; Z5 n4 b/ h  K% e8 p- e, n/ b& B; J
  2119.         dir = 2 if dy  dx
    / E2 K2 t* e$ F  g  {7 R
  2120.       end
    / J- e- Y5 e/ K+ L2 w$ Y" B, D
  2121.     else( T7 Z2 h+ c1 d: E4 v, w: l
  2122.       if y - @moveto_y  $game_map.height - y + @moveto_y &&
    ; C/ r# @5 V2 D8 n3 C/ Y* l
  2123.           $game_map.loop_horizontal
    & x) \/ d* L& B- h1 @9 L3 ?
  2124.         dy = $game_map.height - y + @moveto_y6 C8 Q* j5 G$ j* s- f. z( T
  2125.         dir = 2 if dy  dx 6 P, @2 X9 z! H
  2126.       else8 {7 C, ~+ A2 j6 ]- Y# n( F
  2127.         dy = y - @moveto_y2 |6 s: Q* D; W1 e! L
  2128.         dir = 8 if dy  dx
    $ k8 w9 p; U' b" e. @% p
  2129.       end( q# T- F7 x( E' q) `
  2130.     end
    3 w/ E0 l! D. Y* B
  2131.     @mouse_move_path = [dir, 0] # 0方向用于防止移动过程中触发事件
    0 ?1 g7 C7 S: B$ R, A
  2132.   end
    9 J+ j% S+ v3 g2 H% `
  2133.   #--------------------------------------------------------------------------
    8 ~: o. a( R( Z1 D
  2134.   # ● 判断目标点是否能抵达、登陆,用于船只路径绘制# V* {) f  l% ^4 R
  2135.   #--------------------------------------------------------------------------
    + P2 i8 X% F. y4 R
  2136.   def landable(x, y, path)
    . j/ ^6 V' y0 l9 c
  2137.     case @vehicle_type' p. b: M6 z' ~1 r' P* |
  2138.       when ship; return $game_map.ship_passable(x, y)
    1 Q" G% V8 c. ]3 ~0 J+ ~" g1 g
  2139.         $game_map.passable(x, y, 10 - path[-1])
    + L! G) H" ]# V
  2140.       when boat; return $game_map.boat_passable(x, y)
    5 X5 h  p7 {6 o& ^+ Y) b" K
  2141.         $game_map.passable(x, y, 10 - path[-1]), z8 |) `( l& l4 S8 N( C' {& N
  2142.     end+ E  P2 ~; F1 k" l5 H5 V* }
  2143.   end
    2 P5 [, _' _# V* V
  2144. end: }' c! \; d( J% R4 z

  2145. * a- G+ Y+ z4 d5 y/ I& \1 V
  2146. #==============================================================================
    ( }" b# H0 `( ?2 s8 W, S, x
  2147. # ■ Game_Map
    1 J8 z! x) n6 p$ |  m7 l
  2148. #------------------------------------------------------------------------------
    0 I7 g1 h. n. i
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。
    2 l5 ]% n/ B1 p8 O
  2150. #   本类的实例请参考 $game_map 。: N# L$ w" E7 s0 d% x% F
  2151. #==============================================================================
    ; T* \9 e4 g. D9 V/ k- p1 O) |0 F
  2152. class Game_Map, n) Q7 O5 M& H" |
  2153.   #--------------------------------------------------------------------------7 _- u' T  r3 G; T3 y
  2154.   # ● 定义实例变量
    - O- e+ m& j$ g7 V. D2 r
  2155.   #--------------------------------------------------------------------------
    # f& o- g" K% k  y+ _' N
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据+ l" `" ]; L+ s) L* X1 d) ]
  2157.   attr_reader mouse_map_y # 同上
    ( y0 J: i! u$ `/ a& E3 O
  2158.   #--------------------------------------------------------------------------4 O. X! c2 d% E' V: g4 D
  2159.   # ● 初始化对象
    5 ^& w9 Q/ ]1 S* O
  2160.   #--------------------------------------------------------------------------( ]% L! z5 X- t' ?
  2161.   alias sion_mouse_initialize initialize, P4 V6 f+ U# [2 A% k3 `: t! Q" d' L
  2162.   def initialize
    7 s: |/ j$ ]2 A/ Y7 @4 t
  2163.     sion_mouse_initialize. C9 y7 H. m" c; j) U
  2164.     creat_move_sign  ###
    " O  Q7 J) r& u2 J/ n/ K; g1 s
  2165.     set_constants1 H% @* h- Z# X5 s1 U7 c: O
  2166.   end4 X5 D) `% W4 Y" }  \2 u9 [
  2167.   #--------------------------------------------------------------------------
      e9 B* p4 s6 K- p/ x6 I6 \
  2168.   # ● 更新画面3 T. d( j! F6 b9 Z. w! ^  x
  2169.   #     main  事件解释器更新的标志5 z9 ~! U* l7 X0 T7 `3 j
  2170.   #--------------------------------------------------------------------------
    , n, w- F7 g9 {
  2171.   alias sion_mouse_update update
    , A! |' T" O7 j/ F0 v0 ^) @
  2172.   def update(main = false)" X% A4 e  T3 \$ [0 }
  2173.     sion_mouse_update(main)
    5 g2 ^" L" [! k3 y3 `
  2174.     update_move_sign% d' g3 s1 Z, n" `( G) o/ e
  2175.   end, \, {8 r4 `0 g; v
  2176.   #--------------------------------------------------------------------------
    $ R; N+ V0 u& d$ H  E5 n* Y. ?- m" a
  2177.   # ● 创建显示路径点的事件
    ) J* ?) n1 j' ]- m' R# K% P& J! R
  2178.   #--------------------------------------------------------------------------
    , Y1 D. D) a5 M! [$ ~
  2179.   def creat_move_sign
    $ d. r0 |/ o+ a# s' l
  2180.     $mouse_move_sign = Move_Sign.new
    ( j3 G5 L# q$ l( @9 }( w6 w% L
  2181.   end$ l7 f2 D$ ?& V  N. h
  2182.   #--------------------------------------------------------------------------
    3 u  H0 v3 b1 _' R
  2183.   # ● 更新显示路径点的事件( ?5 t* s% }6 u- d- t& \* \  n5 [
  2184.   #--------------------------------------------------------------------------' i7 K+ A: ?0 M) D8 n/ n3 M/ r
  2185.   def set_constants
    & p5 q6 K0 v; ]. A, F, P* k
  2186.     @mouse_pos_setted = true
    - h$ F. w7 \; u, l
  2187.     @set_pos_prepared = false
    1 ^: f$ D% M( j+ j: H
  2188.     @mouse_old_x = 0
    + a) B* _) C  K! t' p7 f
  2189.     @mouse_old_y = 0* A1 r$ O3 h; P2 _
  2190.   end
    7 Y) s6 h" j! W# R, V: P1 O
  2191.   #--------------------------------------------------------------------------
    5 B( o+ q4 z$ b4 F. W: M
  2192.   # ● 更新显示路径点的事件8 {* Q- B5 I0 R$ [  f
  2193.   #--------------------------------------------------------------------------0 h2 Q+ P' w; n5 `
  2194.   def update_move_sign
    ( M' N( p- q! e5 e( \: x' T
  2195.     $mouse_move_sign.update! k- u8 d( K- \7 d
  2196.   end
    - v/ D, L1 s* ^0 W- W$ @8 I- U
  2197.   #--------------------------------------------------------------------------! A6 B$ ]9 o; m3 N& h
  2198.   # ● 获取鼠标位于的地图块的x、y坐标
    # ~( b  S' Y3 p1 `3 b7 C9 \" N
  2199.   #--------------------------------------------------------------------------" i* C/ \1 q) {2 l( I" q! w) M# |
  2200.   def get_mouse_map_xy
    $ j2 k0 N2 Q  ]" U2 a& J/ U2 r
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    ' }& ~* v# m( y. m; \; D
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i)
    , i1 w4 ?6 G; S9 |) X' U, N
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i)
    - W9 U: w% v# R# k
  2204.   end
    $ B7 N" N! Q8 z5 J7 \0 h7 e+ P
  2205.   #--------------------------------------------------------------------------4 m+ j& v" O9 H& G
  2206.   # ● 返回地图画面时重设鼠标坐标
    7 ?7 R  M0 N6 w* d
  2207.   #--------------------------------------------------------------------------
    0 W4 M- }4 z- e% x5 c$ F; y3 b/ S
  2208.   def reset_mouse_pos: Z, g1 g: s" l* H1 {; D/ T
  2209.     return if @mouse_pos_setted- ]" Q8 d7 {  O2 ~. m
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y)
    - ]$ C& W4 c( ?1 z6 R% |0 m1 c
  2211.     @mouse_pos_setted = true3 f9 F$ h4 o2 S9 q6 h
  2212.     @set_pos_prepared = false  G/ ~  e+ [  I  E3 O' `- B# B
  2213.   end
    6 a. W  A% x6 O: S
  2214.   #--------------------------------------------------------------------------8 K: v$ H4 d5 R( M4 c
  2215.   # ● 重设鼠标的坐标
    7 f" p/ i/ T5 U$ o1 H* c9 M
  2216.   #--------------------------------------------------------------------------$ m5 j1 W9 M1 @. R
  2217.   def prepare_reset_mouse_pos7 y0 |: `# y# B1 J( j
  2218.     return if @set_pos_prepared" M! L, f& @6 I, l4 Y. Z: a
  2219.     @mouse_pos_setted = false
    5 |  {2 ^/ l7 p  x
  2220.     @mouse_old_x = Mouse.mouse_x2 w% [. p9 U3 _
  2221.     @mouse_old_y = Mouse.mouse_y+ V( \# C0 C+ p+ }' Y4 I9 h! D
  2222.     @set_pos_prepared = true
    $ N1 h. i  T4 P- t& K
  2223.   end
    7 D0 @- F2 S. V  Q9 L
  2224. end2 G- r+ p+ h8 V! I1 }

  2225. + Y% }9 n! b6 c
  2226. #==============================================================================$ R. d2 T: |2 s3 H  |, `. B$ g
  2227. # ■ Spriteset_Map* P% b% @1 s& w- E; w  w% _, c3 _' U
  2228. #------------------------------------------------------------------------------
    % U: }1 ~: D' |
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。8 K2 I& i! ]+ J, C! W3 h! u2 L
  2230. #==============================================================================5 D0 r3 Z( C; T& h6 b! D
  2231. class Spriteset_Map
    8 x! v2 l/ J' [) X/ N( T
  2232.   #--------------------------------------------------------------------------" N* _1 G/ R9 P1 o; ]
  2233.   # ● 生成路径点精灵2 B6 Q+ N$ F. f- J1 I
  2234.   #--------------------------------------------------------------------------! o' g+ C6 Z2 e$ C9 ~0 g6 t! |2 W
  2235.   alias sion_mouse_create_characters create_characters! T1 E. U" m0 y6 A! j0 a
  2236.   def create_characters
    - B- Z, D* R( ?9 f; H
  2237.     sion_mouse_create_characters
    7 c. x9 f5 e0 c
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))
    " H3 g0 }8 a5 L
  2239.   end
    2 u& L1 T$ x+ D* V7 u; e* u
  2240. end7 @; E9 j- }  }' q( y+ Y+ a  l
  2241. , Y- E+ n! a3 M$ m4 w
  2242. #==============================================================================, |/ O+ ?/ W4 k4 F; v
  2243. # ■ Scene_Map
    ( k  Y$ K# G) i% P. R
  2244. #------------------------------------------------------------------------------) f* X. j- j1 X$ H$ z  F
  2245. #  地图画面
    : @* @% L+ V9 ^9 L
  2246. #==============================================================================2 j3 O/ v# i# @: f8 u- l+ ?; D
  2247. class Scene_Map  Scene_Base
    , ~1 R& [; E8 f
  2248.   #--------------------------------------------------------------------------
    ) l  n; `( q! I- f0 r
  2249.   # ● 画面更新
    ) w9 w) A- S+ X( s2 E
  2250.   #--------------------------------------------------------------------------9 Y; W2 S: O+ L6 r! H9 \5 x# V
  2251.   alias sion_mouse_update_scene update_scene- {$ F' l. R1 d4 w% p) ]; _
  2252.   def update_scene
    7 B5 [( ~+ `2 H$ {
  2253.     sion_mouse_update_scene$ ?# d9 d) D8 `$ h5 j) D
  2254.     update_mouse_action unless scene_changing
    ( j/ S7 p- Z2 `$ u  D. a3 _
  2255.   end
    $ e$ A! Z8 A! [1 C4 v
  2256.   #--------------------------------------------------------------------------  J( r  _7 B2 ]. s5 F6 d" W
  2257.   # ● 场所移动前的处理" `) }- R5 f9 ^  W  O5 ^# G
  2258.   #--------------------------------------------------------------------------0 \! C/ O* j$ X5 d  {: S" I
  2259.   alias sion_mouse_pre_transfer pre_transfer- ~4 @7 R/ i) C! l% ?
  2260.   def pre_transfer
    , M# c, F5 |" X
  2261.     $game_player.reset_move_path
    # |- [' L- z4 d- W4 |
  2262.     sion_mouse_pre_transfer
    : C9 a. u* U$ |/ h. |( s( `
  2263.   end2 y+ ~; _2 E- Y' p" ?( \  a
  2264.   #--------------------------------------------------------------------------! R0 x4 K/ _5 x* F# D0 q5 P% e: k3 d
  2265.   # ● 监听鼠标左键的按下
    ; p0 g2 x" F4 u* U# |- y) t# S
  2266.   #--------------------------------------------------------------------------
    6 j" L  _: S; E- q$ Q8 d( y) O- h
  2267.   def update_mouse_action
    1 J) d, D; e- z* b+ `0 ]
  2268.     $game_player.left_button_action if Mouse.press(0x01)9 n0 j, F) l4 q( }/ h
  2269.   end) p  \+ e. {5 |8 V( @9 D; K% c1 G
  2270. end& p+ C* F; h& @
  2271. 6 h! S+ n2 U, w" P1 r
  2272. #==============================================================================
    ! M( a# L8 i/ @( k( d
  2273. # ■ Scene_File
    & [$ Z2 ?, J$ s5 |3 h" e5 F
  2274. #------------------------------------------------------------------------------3 ?3 A, C& L9 [! ^5 V7 q) K5 q
  2275. #  存档画面和读档画面共同的父类6 M5 w! t- {& m: o
  2276. #==============================================================================
    + B: k! u+ s2 t. ]; W8 m
  2277. class Scene_File  Scene_MenuBase
    4 J# w/ z" a) _* T) n5 q
  2278.   #--------------------------------------------------------------------------$ z  A0 q+ d* b' _. U
  2279.   # ● 开始处理
    ) D+ X& {" f3 C! k
  2280.   #--------------------------------------------------------------------------9 \, B9 ]" Q) m2 M! k# d
  2281.   alias sion_mouse_start start
    5 G1 ~6 e7 h: k( L9 t
  2282.   def start
    1 b+ }1 w& B2 ^% V- w& C
  2283.     sion_mouse_start
    6 L. k; m: R* g
  2284.     @move_state = 0
    & J) I) R; U. _& m/ j
  2285.     set_mouse_pos
    8 s! y4 l2 f0 L+ j, B2 W- b
  2286.   end
    $ Q0 `3 v" d% ~( z
  2287.   #--------------------------------------------------------------------------0 t' S! e! c  z1 W( n
  2288.   # ● 更新画面
    * k+ Z9 T- W" e& w  P2 A
  2289.   #--------------------------------------------------------------------------
    / ?* |/ a: @6 r5 e$ w& o0 ~- w
  2290.   alias sion_mouse_update update* B: D0 @6 N# C$ H; }
  2291.   def update
    ; [# }; Z1 f# W) r' r
  2292.     sion_mouse_update' }  {' k* v# [
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos! q# f5 D3 M; P* Y
  2294.   end
    0 `4 v' h' `# O/ B+ M# M& ~
  2295.   #--------------------------------------------------------------------------5 }2 c, ~+ D+ h8 q
  2296.   # ● 更新光标* D3 m9 A, E3 k5 |- U2 G
  2297.   #--------------------------------------------------------------------------: a9 I* [' t4 C$ }& i" e+ C! ?
  2298.   def set_cursor2 ?* U; D  G" v& A; k
  2299.     @move_state += 1
    0 F( g8 Q  a$ X. m" D. r
  2300.     last_index = @index
    6 \: Z: h8 Q) V# h$ ]6 E
  2301.     if mouse_which_window == -24 g! f: v( o8 `; `) T
  2302.       if (@move_state - 1) % 6 == 0
    ) m! P9 @  v7 F9 X
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1/ |0 {/ N4 y+ C
  2304.       end
    & [/ }, ^2 W# o1 \0 `! Q
  2305.     elsif mouse_which_window == -1: B8 D- x9 F' z! t
  2306.       if (@move_state - 1) % 6 == 0
    5 [% g: p3 C- Z* z. W
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    ; R# |" f, M9 Q  }6 Z3 p
  2308.       end
    # D% V/ d/ g! q
  2309.     else
    ( [) g! R2 H% P4 V1 b  z0 I  Y
  2310.       @move_state = 0
    " O9 q8 @% Y7 D( ?# ]
  2311.       @index = top_index + mouse_which_window& Z$ B5 P2 l6 `* N  |$ b
  2312.     end
    ( p$ _1 K1 V) k& _3 P$ x% z
  2313.     ensure_cursor_visible+ t+ v3 G* [% w4 _
  2314.     if @index != last_index6 a2 J: r- i( Z) @+ R5 N
  2315.       @savefile_windows[last_index].selected = false$ l* F  G& `+ @- Q# p. R
  2316.       @savefile_windows[@index].selected = true, U3 F' L9 B: X7 U6 G
  2317.     end+ |" O7 R3 @, l2 i
  2318.   end
    , M: V$ X: ?% f3 _( z
  2319.   #--------------------------------------------------------------------------7 M1 G% I' D$ u$ H
  2320.   # ● 判断鼠标位于哪个窗口
    4 F1 N: W8 y9 z7 `& L
  2321.   #--------------------------------------------------------------------------
    0 P7 O7 j- ?* `4 _- o8 ?; W& t
  2322.   def mouse_which_window6 E3 P0 L- G" L8 J( x; ^/ ^/ i
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    1 S% O2 _: Y( j8 I
  2324.     if mouse_y  @help_window.height + 14
    ' m: S7 |9 s( W* |0 z$ q& H2 W- @
  2325.       mouse_row = -1* Y; k0 U5 A9 ~) m' h/ [) e: u2 Z
  2326.     elsif mouse_y  Graphics.height - 14
    . {( V, \. q' ^# a  z1 N
  2327.       mouse_row = -2! `; e1 v/ D7 l( p" K- Y- c$ }
  2328.     else
    ; n+ |/ c$ [3 W% Q, H- D
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    ) A) H/ @7 G, W- n* |( n8 ^- q
  2330.         (Graphics.height - @help_window.height)! ~; a0 D: E# b
  2331.     end
    ; `. {& S% B9 D6 `  d2 Z
  2332.     return mouse_row
    % l$ ?6 j" R2 E9 ?4 X
  2333.   end0 e3 u$ J% N% w/ _. f: D
  2334.   #--------------------------------------------------------------------------
    / u( u: i* V3 p8 _
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置" N: N+ C$ i$ x% {+ Z
  2336.   #--------------------------------------------------------------------------
    9 K! x+ f# }+ D, n
  2337.   def set_mouse_pos
    " F! [7 E  D& I
  2338.     new_x = 40# I1 a  R3 w9 X. N' K
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24/ |; m6 }  C$ G% O) m0 F; P2 H
  2340.     Mouse.set_mouse_pos(new_x, new_y)" o4 l1 Z# h5 E6 w: \
  2341.   end; \9 }+ E1 V" g
  2342. end$ A; o9 ^+ w  M$ c! ~

  2343. 7 p3 {0 {% G1 q; k6 V3 G6 A8 f( T
  2344. #==============================================================================
    & }% N' G5 m" _7 r
  2345. # ■ Game_Event" Y5 V; y+ R! X# c: W! N; Q* _
  2346. #------------------------------------------------------------------------------
    4 D* C- Q% J5 z) O
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
    ( \& r, J+ d$ ^% v4 C. v
  2348. #   在 Game_Map 类的内部使用。
    9 e2 o, y/ |' `. o- F: |
  2349. #==============================================================================
    / o5 c: {" o1 I% M; K9 w$ z% _) S
  2350. class Game_Event  Game_Character- Z  y7 c* z: c2 C+ w
  2351.   #--------------------------------------------------------------------------
    / e* C4 T" c: d& @) L
  2352.   # ● 事件启动* y5 N# O7 ?7 m" v! I8 ~" I
  2353.   #--------------------------------------------------------------------------, P7 |2 Q, {/ r) Y4 _1 u- \
  2354.   alias sion_mouse_start start. \$ v" F9 ]( P$ s% u+ @" g# g: X
  2355.   def start
    1 ~% ^6 c6 S; n* A# P
  2356.     return if mouse_start && !Mouse.press(0x01)
    : H  m$ E! I( a7 ?1 T1 {
  2357.     sion_mouse_start
    * {  E  n8 T% s% z& N5 W
  2358.   end
    * b; T' E1 D+ i( V6 s6 J3 V
  2359.   #--------------------------------------------------------------------------8 S7 P7 D' `5 b' {$ {3 ?) h9 ^
  2360.   # ● 判断事件是否由鼠标启动+ G7 q. w2 R$ `" ]- ?7 Y
  2361.   #--------------------------------------------------------------------------. t1 Q1 c1 Y' J5 H/ U- h) Q2 p
  2362.   def mouse_start
    , P' O) ?4 y/ j
  2363.     return false if empty
    0 Z$ X3 ^5 O7 ]) h5 X
  2364.     @list.each do index( y% _  ]9 k6 X( j1 T# F
  2365.       return true if (index.code == 108  index.code == 408) &&
    : P5 j+ n. C" @) Q) a* u2 N0 @
  2366.         index.parameters[0].include('鼠标启动'). L( S9 f4 ]% B3 |$ e, O
  2367.     end8 `* ]$ F& G6 G: [2 x( q
  2368.     return false
    7 u! j& q7 r0 q
  2369.   end3 E/ r4 R4 W! z- u) n8 K( h
  2370. end. q1 U' H3 x6 y" t) m/ r2 A
  2371. ; d- R# g! i4 w
  2372. ####泥煤的height
    , V: T. z1 a- O5 l8 N2 M  G
  2373. # @height = height
    0 h7 M2 ]' f! l; T
  2374. . P  S3 Y/ @8 X3 j
  2375. class Area_Response8 \/ p, d  P* C% c, V6 e8 ~/ d/ T
  2376.   attr_accessor type: L, ^0 t" |* r. e' \
  2377.   attr_reader ox
    % P( j# |( i5 Q4 t6 m( W
  2378.   attr_reader oy
    - ]  [: s5 n7 K- M  b  v
  2379.   attr_reader width. y9 A  L7 f* M, D5 u3 H
  2380.   attr_reader height
    " E  K# x6 ^, [- Q( J7 j
  2381.   attr_reader switch_id; d/ ?' ]) q0 a/ {% e# _& N5 B
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil), L& Y0 D% |$ {' j1 B
  2383.     @type = type
    / d) ?. o% w( z5 ?* ~: ?- s
  2384.     @ox = ox4 t* u( ~( d) z' e# o
  2385.     @oy = oy
    6 [; P7 B1 l6 z' y" S0 u3 T
  2386.     @width = width
    # i/ k9 e* X" c/ d, @4 i5 a( J  f
  2387.     @height = height
    3 j; g2 X1 `" Y
  2388.     @switch_id = switch_id
    5 R2 l7 k7 u( f* Z$ W2 z
  2389.   end* Q) C3 h3 B, `2 L/ t
  2390. end
    % [5 ?% a. b, ]: C! Z

  2391. - z- n' G" }+ E/ [
  2392. $area_responses = []# p0 K4 Y# U* B% u0 C: @

  2393. # V3 M' `5 y( `& z5 O2 L' S+ Q7 f
  2394. class Scene_Map0 j* g; D3 U3 M2 a! f4 a# C& D# C
  2395.   alias update_mouse_2013421 update_mouse_action5 D( }! [# W) Z
  2396.   def update_mouse_action7 z* I: K/ O; @( N8 y' e
  2397.     update_area_response
    1 s! g7 r; ?5 r& c' M
  2398.     update_mouse_2013421# B5 h& B$ v" [; \
  2399.   end* h0 c2 ^1 q5 n& e
  2400.   def update_area_response; z0 d4 C# o+ _. q# z2 `  u
  2401.     responses = $area_responses
    / y9 A4 b; T4 o: L: V
  2402.     responses.each {response
    + l  K% ]4 B2 A7 U5 Y9 q' e
  2403.       ox = response.ox) U/ C3 J% f6 I6 L+ Q
  2404.       oy = response.oy
    3 K% R% c3 ~" ?# {7 n# Z
  2405.       width = response.width5 p4 u1 |2 g5 |) o6 k# U
  2406.       height = response.height  l7 }2 A6 w+ z5 J+ j
  2407.       switch_id = response.switch_id
    7 Y# `" K% H4 m1 L* f7 R
  2408.       case response.type1 G8 _+ t1 H; \, N" {3 P, J
  2409.       when 0
    3 j) C1 R' x8 z$ T9 F
  2410.         if mouse_in_area(ox, oy, width, height)! R+ k! s! N/ M+ D- Z
  2411.           $game_switches[switch_id] = true. t: p7 W7 E3 v" p6 m$ R
  2412.           $area_responses.delete(response)
      W* V. y- ?4 Q% |. Z
  2413.         end" W7 s# ^. A' \  n) O
  2414.       when 1* j% G5 `, P; b, ]3 b
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)5 L7 W& U8 \8 z0 W7 z2 R6 w
  2416.           $game_switches[switch_id] = true
    1 n9 Z; M0 g$ |" C6 P
  2417.           $area_responses.delete(response)
    : T1 m* A, q4 P+ e6 W
  2418.         end
    5 I- E6 J' V) W$ E
  2419.       when 2
    ' r! f9 g1 F% l- ^1 o
  2420.         if mouse_in_area(ox, oy, width, height)
    8 A1 Y% R" r7 {- o/ v( D
  2421.           $game_switches[switch_id] = true9 r( m8 @9 N, [6 K, e
  2422.         else
    2 D8 {0 ]2 a2 @
  2423.           $game_switches[switch_id] = false
    3 u  j' X8 t! {$ X1 f$ {1 U
  2424.         end
    & f2 D/ i$ C& `- Q
  2425.       when 3' x9 D: W3 G. }' w2 s
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,; f* y! T( N1 s
  2427.             (oy - $game_map.display_y)  32, width, height)" ?% \5 Q6 y, W/ U; l" X+ k
  2428.           $game_map.events_xy(ox, oy).each {event5 Y" N3 ~3 I( P) {) i
  2429.           event.start
    + k+ v& z0 ~, x7 e" C5 K
  2430.           $area_responses.delete(response)
    5 a( i' _; X( J+ h  r; @/ h. ?
  2431.           return
    6 d) K: G, F6 O- V4 ?
  2432.           }
    6 R+ b. J/ M4 f
  2433.         end/ C* W* L" P$ a7 p! T9 M
  2434.       when 4
    9 g0 B! N4 f) `' m! Z/ m
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,
    # N1 y- D0 @' N: `9 C3 P: l1 F
  2436.             (oy - $game_map.display_y)  32, width, height)8 C9 {0 F( v+ m" |* |  T4 g
  2437.           $game_map.events_xy(ox, oy).each {event8 B( X- P% J( k( k3 ^- x% W
  2438.             event.start
    3 F0 p% g" V7 P
  2439.             return
    * n1 e. A5 P2 u
  2440.           } 3 n; G, m9 [$ \) F
  2441.         end* h, r/ k8 l8 X7 r8 [2 w! u
  2442.       end4 X# ]0 k+ u" k6 ]  }1 ?/ c
  2443.     }3 ^8 j7 Q6 I6 j1 L& l4 J' Z" w2 g/ q
  2444.   end
    $ }, y% ]; Q: W, S, T; f
  2445.   def mouse_in_area(ox, oy, width, height)5 ~! J% L& T8 H8 ?2 G9 y  V$ v: k* H
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&
    9 Z+ T. E, ]6 C; t0 }
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height
    . f. S) r! m. m. ?
  2448.   end& ^% g. C. T8 R; q# v
  2449. end
    5 O5 l+ _: ?0 x
  2450. class Game_Interpreter* E$ z: O+ `. r* a" Y0 }6 a* o$ a
  2451.   def area_response(arg)
    & {( h$ Q! X6 a# s& I/ _& e9 ]
  2452.     $area_responses.push(Area_Response.new(arg))
    & J$ [4 V( C; r% n. q
  2453.   end+ D+ b6 q9 R" }2 N
  2454. end
    4 e8 H" l5 K1 F1 n( k% a) B
复制代码

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

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

GMT+8, 2026-6-5 11:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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