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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    3 e5 y- _: Z, d. [3 |2 U1 e
  2. 5 r5 h: ?; b$ [& U( c# G% `
  3.   Sion Mouse System v1.3e' l/ X$ G* g# G2 @
  4.   0 w- W: x# M7 V: e* w" K
  5.   Changlog
    " y9 W6 r! h( A, r4 {5 |$ l
  6.   
    ; K4 F! l6 J' U
  7.   2013.4.21 v1.3f; Y* e$ h* P" Z! k, `
  8.    
    - q. q/ @6 p* i, m: `2 R6 k! R
  9.     1.3f 卷动地图 bug 修正: I4 ?9 M- B- E5 n# v9 H5 N+ w
  10.    
    " R( _+ M' x) ?  e
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口8 O$ Z$ @! n7 n! [6 y+ A
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内
    7 h- f/ J5 ~3 u% s. J1 K7 S8 E: B9 l
  13.                               Mouse.unlock_mouse_in_screen 解除锁定
    * B: S) v. X0 s% U6 w! Y2 X

  14. 6 {% q  z( |, O- @) A
  15.     1.3f bug修正' g  P- m' ^! t. x. j  A3 B- y
  16.   ) g& X8 [9 ~3 P& ?% F& ^. s& q# Q, E
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及$ P7 u, R6 y/ H9 y2 X1 q* i
  18.           关闭菜单时,鼠标是否移动到原来的位置。
    ( w+ j1 s$ o) [

  19. 8 e) |# V/ O# N3 n
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处
    , k& [% E: n1 O! h" e# O

  21. $ ~* b( I9 W+ ?3 {
  22.     1.3b 修正一些罕见的bug;
    $ C9 m8 b% M: n+ Z/ B1 ^- o

  23. ( D8 o; [) b  E% n
  24.     1.3a 代码小修改;  V' f; O0 H! b' h0 {  A: j/ h0 P( r
  25.           加入了鼠标点击启动事件的功能,& i# d+ U3 o5 U: K6 S8 h) v, ~
  26.           在事件中加入“注释”: 鼠标启动  ,
      L! E6 g$ o5 h: B) c
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    9 e( y) i: |6 k* `: b* d
  28.   
    0 l6 P/ O& y2 F4 N: Q) s: K9 g( |
  29.   2013.2.12 v1.2
    1 h; k6 F( M9 h# `, x) a) h) {1 k

  30. 0 D+ y& w- k0 I& x2 r4 p9 n6 \( [9 ~
  31.     寻路逻辑优化;! n6 `, ~2 E& a: }' X  d. q* ~1 o
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;
    ) e  d# y5 i, s% o
  33.     现在支持用鼠标来操作载具了。
    ! W7 ~4 D& l) V! V4 r8 f. P. F

  34. ; ]5 o0 X/ d0 h" i% w, x
  35.   2013.2.8 v1.1
    $ O4 b& m4 v5 o3 _& G' |
  36. - X* a: O* e- M8 D1 [5 L
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    3 q% N; w7 f. z( }
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;
    ; b+ s0 A5 L4 P) f: B; j
  39.     移动时,路径指示点的绘制更加稳定;. c' r9 l3 ~/ n# q- R# Y! Q
  40.     现在支持默认存档画面的鼠标操作了。
    6 ~6 H6 W, k( @* C

  41. ! J% [2 f  ?" n) d. Y% g
  42. ! c0 `3 u% V- i8 L7 K5 o
  43.   OrigenVersion; r9 w( C+ ~  T7 X
  44.   
    7 y$ w; J9 h9 W9 A: }3 v
  45.     2013.2.7 v1.0   s$ {2 M5 j( L
  46. 4 n; H/ G# E& I
  47.   主要功能% Q: ?+ }: @2 C8 \$ k( v
  48. 7 u' P- a7 C1 I$ p
  49.       使用鼠标进行各种操作...) U6 ~; U5 {) ]. p8 {( B
  50.       将鼠标锁定在游戏窗口内  i' I& k; l) k: {& ~4 R
  51.       自动寻路,按住 D 键可以扩大寻路的范围
    - i1 n& ^: J! e8 \+ A
  52.       双击鼠标进行冲刺6 ]) H# }0 Z' N8 ^  x, B" I7 J- ]2 d
  53.       更改地图卷动方式以适应鼠标移动9 \! f6 x9 k0 k4 o2 g- z$ b* ^& \$ F( c
  54.       变量输入框改良
    ( f( F5 w' [/ V& H# s, v5 d* B! L3 a

  55. % U6 C. l. h( X) h4 I
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹
    " h$ j, Q+ n( g& b8 [8 I% }! G
  57. 9 o! J1 R; Z2 b/ s; j# g# M8 t
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹, j- s7 [- v4 n4 p! ^
  59. . c1 p% P% I8 i8 Z1 T" r4 K4 [
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    2 ]; m3 {! q- A

  61. + c0 g, D$ N' Y1 o
  62. ( z. U; {1 ~- \' D% J' o  M
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★
    , K  q' M  O6 @3 p" N( p
  64. # G& q0 V4 }! h3 X$ m( ?

  65. * |8 O: r! b" Z( S
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示
    , G# }: ^& M# R* F1 r- j& `

  67. : A* Y5 W" I1 d5 g
  68. #==============================================================================  s% T9 {! p0 e& J) A+ v4 u  y
  69. # ■ 常数设置 % N+ S/ e* u- n* ]
  70. #==============================================================================- U2 I- [8 a) y( F
  71. module KsOfSion
    / Y& }# }. V. H9 U+ n
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false
    . [7 x2 e; S. g. S) L
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑/ i% P' Q! X/ h; v
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false5 a9 l0 @$ k4 V
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量" ~+ k; v$ ?9 R
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    1 [8 M7 u3 }  n* B  l' P4 P
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧+ u0 N' p' e7 q0 R  E
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)0 l7 b! \& b0 s3 J
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键4 j( J+ _& P. t; v& h: D
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)
    ; P$ z& h/ p9 ]! U
  81. end" W" G/ `; V2 _7 q' O, \
  82. ( n. S% ~! n4 n6 L8 l
  83. #==============================================================================* e# p8 }* P% I' C; P
  84. # ■ 用来显示路径点的类0 ?$ \" W4 N/ G0 d
  85. #==============================================================================
    # i+ T; o: p$ o" X+ k
  86. class Move_Sign  Game_Character& v& J  ~8 g1 F$ t' C* F2 K+ H
  87.   #--------------------------------------------------------------------------
    ! ?7 m  s$ j" m+ K' j) U; d6 q+ P1 I" a
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图7 a; G& A& ~. n( t" t. t7 A
  89.   #--------------------------------------------------------------------------+ l6 ~6 y5 s' j6 s7 ~/ \
  90.   def init_public_members
    % o0 G6 u* W" \$ g4 t( m# S
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹
    2 X% t8 o+ v7 B4 k: ~: t: F
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    ( M( ?% U1 Y) u4 Y1 V) m. s6 v! m  V
  93.     @move_speed      = 5        # ★ 踏步速度
    2 O: ^3 p( A. C) E5 t- S1 p- H2 g
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)4 I( n" l* H2 i/ u5 l! e* l" q
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度& x, x' f, S# q9 R' q: q
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)" a) U/ C: M6 S! {1 C( }
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列
    5 v# Y/ ]* c# y; M: U
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)2 H5 r' p) ^0 K- v

  99. 6 o7 b' t1 z% r
  100. 1 n+ O. S1 j: ]
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★" w' W8 _5 \" h+ i7 V/ c$ S* n

  102. 9 z. B/ o& ]/ `% |

  103. * \1 k3 D- h( z
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图  ^, p; y) T9 \( A8 \- i8 j9 y
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    . Q5 t! A3 [  R- T
  106. " A! W+ ]1 `* z* c5 q
  107.       if $no_arrowpic_warn
    8 P6 a2 v0 d+ M* M3 w2 {
  108.         MouseShow_Cursor.call(1)" J( [5 F' P" e3 r% m: o% D
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png
    1 ~" Y; I' m; C0 C& o! y
  110. 4 Y+ b2 y- n# ?% J- a5 Q
  111. “路径指示点”将使用游戏自带图片# z) o, M3 H3 I. \2 f

  112. " g* B. i- K8 y+ d0 Z- p) z
  113. 该提示可以在脚本内关闭'): Z* X, |# W5 A* E
  114.         MouseShow_Cursor.call(0)+ i/ G* V9 K6 z/ Z$ @
  115.         $no_arrowpic_warn = false
    ( s- _' G# K# q6 ?; z: E  V' h& B
  116.       end
    : X% r4 d1 M$ o. C
  117.       @character_name  = '!Flame'
    & w0 }0 i1 \' B, f3 |5 g
  118.       @character_index = 6
    1 G% k4 o& G- p! h2 C# d+ t
  119.   E* D: ^! [3 i- b: c
  120.     end
    - j3 P5 m3 x3 t$ |
  121.     @direction_fix = false  # 固定朝向( s( M& B3 p% {7 F- m
  122.     @move_frequency = 6     # 移动频率" o* ^2 u4 U$ Q. }: g! n) ?
  123.     @walk_anime = true      # 步行动画: _' C4 f1 I# t/ W  J4 z* t
  124.     @pattern = 1            # 图案
    : x: Q. N7 K) ^0 x  y4 @
  125.     @through = true         # 穿透9 M6 G, w! K& b% b6 Y1 L& i
  126.     @bush_depth = 0         # 草木深度
    / v9 L- i/ ~9 }: u  d  q; t
  127.     @animation_id = 0       # 动画 ID
    1 D& C7 S  N- O/ q6 d- d
  128.     @balloon_id = 0         # 心情 ID+ E. G4 H/ K4 t' ^
  129.     @transparent = true     # 透明
      N* A. s# @4 Q+ i, O
  130.     @id = 0
    9 _8 `  H. q+ r9 J) Z& n
  131.     @x = 0
    ' k( z! T' b8 o
  132.     @y = 08 q3 f$ X5 i' z/ u3 _  I* K
  133.     @real_x = 0- {2 |. U* F" z0 i
  134.     @real_y = 0& A9 l  m( {6 D
  135.     @tile_id = 00 }7 S; \* n; E' H8 O6 U1 g
  136.   end7 ~& E3 C5 Y: I+ R) Q# N5 H' R
  137.   #--------------------------------------------------------------------------) K! {7 g0 {* j$ S3 w7 T
  138.   # ● 定义实例变量
    4 M- D# D: v5 Y5 @3 y% E
  139.   #--------------------------------------------------------------------------& J, q' K6 Q: |9 c; y5 n. B
  140.   attr_accessor direction! C9 U/ K! s9 E' x( C, ~& r* z3 K/ X
  141. end  |4 {. t& t7 F' n  s3 s

  142. , X) ]3 s* }8 _: T
  143. #==============================================================================4 v$ N3 z$ i" Z  J7 z% k6 j
  144. # ■ Module Mouse
    . b) ]6 p: V7 D
  145. #==============================================================================
    2 f! s5 u* C* R+ D- \% M; u
  146. module Mouse
    ) m+ l8 a; _/ z: [* _
  147.   #--------------------------------------------------------------------------
    * y: H3 j. C$ ~& N, q" z3 P
  148.   # ● API, t" A" S' H4 o$ }
  149.   #--------------------------------------------------------------------------
    3 F: p+ t; \" y* q1 Z6 B9 B* H
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')5 E5 t8 x$ g: C, F
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
    " x( H. M& ^. u  Q
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')
    9 d- C& D, n1 Y) ?1 b) r4 J- _
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')3 v* a' a% ?7 N
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')" s& @1 e  U- p+ C+ q9 u
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')0 I; x& w/ N3 r' o6 X: U
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i'), f$ i# f8 D1 _! \% v
  157.   Window_Hwnd       = Get_Active_Window.call
    . \% e2 V, q! L: `
  158. ; e' R4 e: U1 D- q7 I8 h
  159. class  self3 ]( z2 _- r1 S- X! t! d
  160.   #--------------------------------------------------------------------------
    5 ]% @9 e- M8 o, h
  161.   # ● 初始化0 u  y: q2 I/ M3 g6 ~5 n
  162.   #--------------------------------------------------------------------------
    ' R3 T# o9 F( E' Y. j' u) N
  163.   def init
    1 g% p# A! b: Y- `
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor
    3 S  _* K! ^9 ^$ a
  165.     @left_state = 0
    3 Y9 p0 i5 s7 K' Q; S
  166.     @right_state = 0
    % P8 z4 W: l/ Q
  167.     @ck_count = 0 # 帧数计,单击以后从0开始& a2 ?$ N/ s# y, f2 m
  168.     @dk_count = 0 # 用于双击的判定! d" g' f/ _7 e' P" m/ W/ k
  169.     @clicked = false
    9 ]* m7 ~8 ?$ s4 K/ g
  170.     creat_mouse_sprite) c6 X* ?8 |! n$ K/ `' h2 V
  171.     update
    ( m/ k4 D" \- i/ m6 g7 e
  172.   end3 u8 A0 g5 Q1 L" @9 D
  173.   #--------------------------------------------------------------------------! b- V& t1 O) J+ H3 R5 A$ q
  174.   # ● 鼠标指针精灵4 _/ ~- `! I" G1 L
  175.   #--------------------------------------------------------------------------2 r9 n+ v2 ^7 i0 _" \
  176. #~   def creat_mouse_sprite
    + F7 W+ N8 K) i, Q+ W  S0 X" k, L
  177. #~     
    8 G7 G# e$ W/ J' x0 f' H' x9 e: z
  178. #~       @mouse_sprite = Sprite.new0 ]9 |1 S. f0 Y5 K' r& _6 w
  179. #~       panda = 2#rand(2)+15 U% d( Y+ e5 a, M+ f

  180. 9 g, {) M5 t, O% [8 j
  181. #~      if panda = 1
    - i1 {* V) `0 y6 u. c3 X
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    " {6 m* h& v$ u
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')  B6 F8 n4 L2 N4 {8 @. \5 M( V
  184. #~        end#with if File.exist) e! I; c- O  k0 ^4 _( k' V6 M5 i6 {
  185. #~    5 ^' G' Y6 L/ A2 Q) V
  186. #~     else if panda = 2 #with if panda=1$ l" y  c! c: y1 s
  187. #~      " V7 z( f9 i3 s3 x, t- K, g% P  [
  188. #~      if File.exist('GraphicsSystemCursor2.png')
    ! f: ]4 Z( F$ N
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')# v" u5 [  Y, s. O% ~4 K
  190. #~      end#with if File.exist$ J: {) a3 ?: A6 y  D+ U1 q
  191. #~       , _/ F3 U; Q* D; m
  192. #~     else #with if panda=1
      `9 s8 u9 {+ G9 A2 z% `8 L
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    5 g, O5 l! G! Q" J( f- a" X4 y
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),
    2 C' ?6 x  d8 v5 z! u! A2 l, U2 s
  195. #~       Rect.new(5  24, 24  24, 24, 24))
    9 h9 e. Z  ^6 c( ^+ ?+ _
  196. #~     end#with if panda=1
    ! v- ]% [1 ~6 \' d5 k  h6 Q
  197. #~     
    7 w, T* ]8 c& O' @5 a, C
  198. #~     #with def- C% N' Z$ M% }" c) d
  199. #~   end
    ; W* m0 Q# `, o- H# y% a7 C
  200. def creat_mouse_sprite- |: {" {8 ]+ W% a0 K; O5 w
  201.     @mouse_sprite = Sprite.new
    8 u0 w6 D) X* h6 L9 r9 q. i7 I
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})7 ?) H- S4 F0 [- i8 x
  203.     @mouse_sprite.z = 9999: P5 {( M" l5 P1 }
  204.     Show_Cursor.call(0)
    ' T9 e4 s/ X  B: L! v5 R
  205. end
    0 Q  M: q5 Z5 K9 h

  206. / |2 d/ i6 _2 x. n+ W6 f6 h+ S' B
  207.   #--------------------------------------------------------------------------
    + n7 t2 x7 [! M" C$ f$ _
  208.   # ● 更新; k9 A) W& a. N2 X4 @0 |; d  v  V
  209.   #--------------------------------------------------------------------------( K( G$ r/ `0 r7 B3 T( D
  210.   def update6 d1 U: k2 C, t) S: z7 W
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos9 [1 H9 W/ X% ?& P
  212.     left_state  = Get_Key_State.call(0x01)( k1 Z6 J7 z3 I% k# J5 }
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0
    # q  R2 C0 V6 e5 P0 S& Y
  214.     right_state = Get_Key_State.call(0x02)( V: t. G4 F. F* }# q! {
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0
    , N. |/ x, T& o: _# ^
  216.     update_double_click
    , X; j/ D$ K/ Z) P$ A
  217.     @left_state == 1  @ck_count = 0  @ck_count += 12 M" X# ^6 p+ R0 Y7 y2 q  F
  218.   end
    7 r  Q$ x! \4 v2 a& I& w/ Z9 ~
  219.   #--------------------------------------------------------------------------( t+ L: C* t3 \* c( q; q
  220.   # ● 获取鼠标坐标4 }- v& j6 Q" r  D; i  w2 ^
  221.   #--------------------------------------------------------------------------
    1 w" s- e' B- d! Y' y9 u5 ^) u
  222.   def get_mouse_pos' t# t. t' ^4 g: S  U- N" S" _
  223.     arg = [0, 0].pack('ll'), s. c5 q, e2 j$ X( N: g
  224.     Get_Cursor_Pos.call(arg)3 T1 U5 k& @/ C( x2 t
  225.     Screen_To_Client.call(Window_Hwnd, arg)+ }6 d: h# S) N- Y) Z- u: t) W& p
  226.     x, y = arg.unpack('ll')
    1 P+ M2 \" o" w+ I8 ?
  227.     return x, y; H0 L  m/ T0 v. a# r
  228.   end2 C6 G6 ^) C* g* J
  229.   #--------------------------------------------------------------------------2 l+ b8 u: L$ [# \' z
  230.   # ● 将鼠标固定在屏幕内
    4 Y$ j& N& H! L$ J$ m
  231.   #--------------------------------------------------------------------------
    ' q% z8 R3 O5 Q% i0 Y5 p
  232.   def lock_mouse_in_screen
    , ^1 U; Z# r7 z1 X% W. Z& s% s' n
  233.     arg = [0, 0].pack('ll')
    ( K" Q2 G3 C' B2 D
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    1 y* c! j4 @( u! f& Y; B
  235.     x, y  = arg.unpack('ll')& H  N9 I( ?1 i; }: i) H
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))9 p( Z  A1 |6 [# y  I6 q
  237.   end! C( `5 u' {7 ^' ]% g7 l; S4 ?, ~
  238.   #--------------------------------------------------------------------------% C) V: _) j0 I1 u$ B
  239.   # ● 解除鼠标固定# K. `* h* _' \7 n; A: p( @
  240.   #--------------------------------------------------------------------------0 t9 \' R% y& N7 j: @% I
  241.   def unlock_mouse_in_screen' I! b: L& y9 c4 `' X% W
  242.     Clip_Cursor.call(0)
    / a+ Z( T( G' ]( X
  243.   end
    ; J+ s2 j1 G6 O% u: a
  244.   #--------------------------------------------------------------------------
    ' T7 s9 t* X' y' t5 H: u
  245.   # ● 鼠标双击判定
      [- h8 v+ D6 M! r# Y- P- u" d! \
  246.   #--------------------------------------------------------------------------
    + `- y, K* W4 ?: k) |" H
  247.   def update_double_click2 |/ R3 d! c2 V: k. B4 k/ S2 p7 n1 R
  248.     @clicked = true if @left_state == 1) d( O& z7 K- m& J
  249.     if @dk_count  0 && @left_state == 1
    + Z8 C2 x7 k; N% F! I6 M* R* U7 v! M
  250.       @dk_count = 0; @clicked = false0 k& q5 A9 h& ?! w: ]
  251.       return @double_click = true
    7 ?8 v1 [  z4 Y: G* s) y
  252.     elsif @clicked
    6 H) r3 c1 q# p* G
  253.       if @dk_count  KsOfSionDbclick_Frame* A0 [% p# h. {2 ~5 |( B3 {( F
  254.         @dk_count += 1& ~, `. _2 E" c7 q* Z
  255.       else
    * g3 k" ]7 Z. a
  256.         @dk_count = 0; @clicked = false
    # E' Q+ k6 k, p+ H8 ^
  257.       end
    8 T7 x0 S0 G- g; J; S' j8 b5 k7 K
  258.     end
    " F; y2 o7 t( e
  259.     @double_click = false
    7 R6 E& s- R+ n  ]
  260.   end
    , J/ i! d8 R; g& d' {9 ?6 J1 o, l
  261.   #--------------------------------------------------------------------------
    0 @! B8 G1 X. s: t
  262.   # ● 按键被按下就返回true" ^# O! Q$ ^, ^5 m2 s! o
  263.   #--------------------------------------------------------------------------
    $ T$ |/ j% t# M. @
  264.   def press(button)
    7 t$ y$ }+ m- [7 F! y
  265.     case button
      a& P+ A# L( c" V" X' b! D
  266.       when 0x01; return !@left_state.zero
    5 ~) p; l0 E% o3 m2 ?1 W
  267.       when 0x02; return !@right_state.zero3 `! C  I) g, u: ^
  268.     end
    4 |+ S8 `0 }9 P# `7 G
  269.     return false& Z, U% B- ?. h) L6 }4 I0 k3 X
  270.   end
    ) w; {( |0 K: j& q* J
  271.   #--------------------------------------------------------------------------0 d; a" Y) |; }0 p) e0 G
  272.   # ● 按键刚被按下则返回true/ ~  R* A5 R0 Q/ H) d! d
  273.   #--------------------------------------------------------------------------# O& S/ |9 Z' t: v/ o" C4 w5 c
  274.   def trigger(button)6 }! b* c8 f: U+ `
  275.     case button
    4 y5 T0 {$ H6 H( {1 J
  276.       when 0x01; return @left_state == 1$ I. F5 B  t9 O  e' F
  277.       when 0x02; return @right_state == 16 }* x1 e3 {2 ^
  278.     end, U! r) ]* I! N2 E4 D  }3 i7 S: }
  279.     return false
    6 t1 N  a( i) X' O7 m* M) i! \2 [
  280.   end
    + X/ B% Y$ K; ?# x
  281.   #--------------------------------------------------------------------------
    ( G5 B7 b$ n: x& F% O3 l4 }2 V8 s
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    1 D4 x& ~2 h4 z% Y
  283.   #--------------------------------------------------------------------------
    3 W, ~- v$ W0 A& E( P* w
  284.   def repeat(button)
    ) L' s* r3 n* U( T! q; C
  285.     case button, Y1 N$ G5 m/ @3 r
  286.       when 0x01; return @left_state == 1
    : Z2 b* V* Y2 U6 L8 P' w: G( {
  287.         (@left_state  22 && (@left_state % 6).zero)
    % W# O- S7 r5 Q! ~% x/ n, f) W! t
  288.       when 0x02; return @right_state == 1
    8 k2 ^3 W% S0 y* {  r
  289.         (@right_state  22 && (@right_state % 6).zero)$ j7 j; ~8 H& u7 H$ \/ J
  290.     end
    $ J: z/ c. _4 ~  |: ]
  291.     return false
    $ W( Z9 w0 v2 F! \- x2 i' N
  292.   end
    4 G1 j4 S4 X- D2 M
  293.   #--------------------------------------------------------------------------% u. g' r- z4 c8 m' H) x
  294.   # ● 判断是否双击鼠标
    ! ^1 w' I4 w' w2 c( H7 t+ G
  295.   #--------------------------------------------------------------------------* P/ V5 w& m( v( G+ P
  296.   def double_click
    7 v5 P4 L0 @7 B
  297.     @double_click  _* ^" z# b6 A) ?8 U2 G( L0 j  i' H
  298.   end( M4 C( S" s, e( O0 F
  299.   #--------------------------------------------------------------------------7 j. \+ N" G! d& r
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)5 h' M  G2 M9 N! e$ l. `
  301.   #--------------------------------------------------------------------------7 g. R& h8 e4 d8 T  J$ d
  302.   def click_count' b; i6 O6 m6 n; w! ?0 ]" e- ^2 J
  303.     @ck_count
    " [4 c  H3 W8 R/ S
  304.   end9 J# f/ `+ o5 o1 V6 n/ J. t
  305.   #--------------------------------------------------------------------------
    : m8 N! L' Z/ ?( A5 g
  306.   # ● 获取@left_state(按住左键每一帧+=1)
    9 t4 s& d2 D% ?# A' f4 h
  307.   #--------------------------------------------------------------------------! c7 S3 w/ n3 @' m& q
  308.   def left_state1 b9 R+ J3 J! I7 m( K
  309.     @left_state7 C0 w- N0 q, `5 z- s
  310.   end/ ^. `8 N. [! E
  311.   #--------------------------------------------------------------------------
    " W& t" G9 `# n) X& ]% N
  312.   # ● 获取鼠标的x坐标0 e9 ?( f; G4 q# @
  313.   #--------------------------------------------------------------------------  \8 o. _2 E& u  p
  314.   def mouse_x4 y* E2 k% c3 K7 e8 t
  315.     @mouse_sprite.x
    $ W6 Y( r1 b5 e* k+ o* u
  316.   end
    5 M& j2 n! r  p7 a8 V% ^0 r3 U
  317.   #--------------------------------------------------------------------------% X* n3 u( l& a# D6 n; q$ ~/ V; [. C+ M
  318.   # ● 获取鼠标的y坐标
    & a( O: L/ {6 P0 s; O  m! H, s: U8 P6 C: G8 Y
  319.   #--------------------------------------------------------------------------; L8 ~' n: b! N: r8 o2 }4 _9 ]( \9 \' |
  320.   def mouse_y
    * m! I9 ~3 o  N6 `
  321.     @mouse_sprite.y
    ) B2 d- y! w4 W5 c- F
  322.   end  P. W* d# {+ v$ n2 o2 A
  323.   #--------------------------------------------------------------------------
    - V0 C0 ]' q" A( k" |6 X& G4 H
  324.   # ● 设置鼠标坐标
    , ?  \! x9 T3 ~' `
  325.   #--------------------------------------------------------------------------- k" {: s! f* O) p+ x6 w
  326.   def set_mouse_pos(new_x, new_y)3 }9 v& a# i1 A* U
  327.     arg = [0, 0].pack('ll')
    8 p4 v; q9 t# Q4 I# O, l# B
  328.     Screen_To_Client.call(Window_Hwnd, arg)4 X$ `$ x" P" K6 Q! x
  329.     x, y  = arg.unpack('ll')
    + M2 f  u: k9 ^% m6 d
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    ( m) O7 ]; b8 C, W4 |! |' W8 V- L
  331.   end  ?9 L' @, q: K
  332. end #end of class  self
    , H$ g/ b$ U, ?8 F- ~) q9 y
  333. # J" {' F, P, C5 q
  334. end
    ' [& U. Y  D2 T* E3 {
  335. ) D) R. ~: O# m: p
  336. #==============================================================================
    " _4 ]9 ]- X. J9 U! i
  337. # ■ SceneManager
    + J6 B2 d& Y7 ]9 |& b
  338. #==============================================================================
    2 K. @  r) R; E5 v5 p! E
  339. class  SceneManager
    9 ~" c0 P/ E2 u# L: g
  340.   #--------------------------------------------------------------------------- h% y4 R* T4 F7 i: q& C& m( O* N
  341.   # ● alias
    # W3 T9 w& i( a: t8 k
  342.   #--------------------------------------------------------------------------
    # \1 o' U  G( V- n$ ~
  343.   unless self.method_defined(sion_mouse_run)! H5 |6 l4 }" d2 y" g* o
  344.     alias_method sion_mouse_run, run
    9 s$ A# C  Z* B; o
  345.     alias_method sion_mouse_call, call% d1 M' Q: o# Y7 E& s
  346.     alias_method sion_mouse_return, return1 R8 [. K' ~! B6 b9 b4 p
  347.   end0 Y" Q* J1 e+ q: c- k
  348.   #--------------------------------------------------------------------------0 E* v) a$ Q) R+ R
  349.   # ● 运行# h! J, q+ v! m- Y; L$ E
  350.   #--------------------------------------------------------------------------
    2 ~: C; F8 @' ]2 Z
  351.   def run4 N2 c" q, ^' w- ?( h- r5 J$ w5 V+ p
  352.     Mouse.init
    " r. V7 s! h9 U/ h* _% F* d' }
  353.     sion_mouse_run1 X8 s0 h7 t9 L+ {
  354.   end
      }4 T3 a' k1 @- u( j
  355.   #--------------------------------------------------------------------------6 x+ Q" c( Y% w- }$ ~
  356.   # ● 切换) d; l" k0 I3 o8 v" H- G/ z
  357.   #--------------------------------------------------------------------------  e4 c& z& T; g9 r" b
  358.   def call(scene_class)8 J  @) G  |9 n7 f$ n
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)
    # a# g' p6 w% y  h2 g) _! L8 e; ~) Z& i
  360.     sion_mouse_call(scene_class)9 \* p- S( P0 R7 {$ R5 y. H6 I2 m: `
  361.   end. b: K5 r% K" a
  362.   #--------------------------------------------------------------------------& \* [+ L  g' E( y, F, x
  363.   # ● 返回到上一个场景' J% D$ d2 F2 Z" C$ h
  364.   #--------------------------------------------------------------------------, T! [7 j0 A5 r
  365.   def return
    % Q" q% u# e4 c! D$ s# q) Z
  366.     sion_mouse_return
    ' x+ P- y: _- i# k0 c) x
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&& O( t; }, i3 ~+ E5 s; \
  368.       @scene.instance_of(Scene_Map)% h! O  T1 f( g7 ]! N2 Z
  369.   end
    / Y: r+ C/ F- j7 c7 A
  370. end
    ; H2 v# s$ c% D4 F; P& u

  371. ' s6 C  @" K7 f5 `5 K0 u6 {+ K
  372. #==============================================================================6 S# S6 w# `, ]
  373. # ■ Module Input/ x% I  W$ @( \0 ]
  374. #==============================================================================
    % _- [7 l! l' H1 g
  375. class  Input# Z/ P5 ?1 ?6 y0 \
  376.   #--------------------------------------------------------------------------
    6 |! o! U3 a- o9 D" ^, n1 C/ o
  377.   # ● alias# W/ S. G$ D% G- V8 M9 L
  378.   #--------------------------------------------------------------------------
    ; |  W! P! S$ ]  ~5 [
  379.   unless self.method_defined(sion_mouse_update)' k  v' U9 O) _  d
  380.     alias_method sion_mouse_update,   update
    5 V3 s/ R5 Y1 f1 O8 |" `
  381.     alias_method sion_mouse_press,   press
    - K$ g7 f/ u" {2 d! W( Y4 G
  382.     alias_method sion_mouse_trigger, trigger) B& t3 J! A  t" H$ c- N
  383.     alias_method sion_mouse_repeat,  repeat) T7 b  x) ~( v  M. Y9 }
  384.   end
    9 I3 V2 w. ^0 J# s" n
  385.   #--------------------------------------------------------------------------: B: f) s& q! `* o- b. Z1 f: Q
  386.   # ● 更新鼠标
    1 [( u; ]4 }" n1 x
  387.   #--------------------------------------------------------------------------7 V# A  M4 M. k* j/ j0 D8 {
  388.   def update
    8 t9 ~4 Q+ j# O# d1 t1 y
  389.     Mouse.update0 D" s  R$ A# ?* N8 i
  390.     sion_mouse_update
    / f1 {; P4 Z4 F0 \' F3 u
  391.   end
    % m5 S- A2 V3 N- P  i
  392.   #--------------------------------------------------------------------------3 l. |% F. `! I' b/ r! P9 f# {( U  K
  393.   # ● 按键被按下就返回true
    5 a% ?- l+ `9 ^7 l0 A8 S
  394.   #--------------------------------------------------------------------------
    + ], l8 v+ B" T# d' _: Q
  395.   def press(key)$ Z- R' B/ t* t  s
  396.     return true if sion_mouse_press(key)' V& Y; W- O* k" R7 E9 ^/ i
  397.     return Mouse.press(0x01) if key == C
    6 s4 k- I* D5 J7 u5 n+ t
  398.     return Mouse.press(0x02) if key == B
    2 O& Y+ I# i3 j* {* F
  399.     return false8 Q  _6 R0 ?$ }# V% K' P" ]
  400.   end
    & g( k& w0 m( V$ Z0 q# F! U3 v* L  D$ }* v
  401.   #--------------------------------------------------------------------------
    - x7 a9 c$ l& O' z
  402.   # ● 按键刚被按下则返回true
      ]( ]3 x  C% p% A. w9 u! p
  403.   #--------------------------------------------------------------------------
    % e" H( Q! Q+ z: N; H
  404.   def trigger(key)
    0 U4 L& `" H4 M
  405.     return true if sion_mouse_trigger(key)7 A) H# }, X6 x+ E! L$ k$ ^
  406.     return Mouse.trigger(0x01) if key == C  P) w4 v3 `. E/ g
  407.     return Mouse.trigger(0x02) if key == B: {/ {- p* i+ n* `5 p# \
  408.     return false
    , U" O( z+ u  t
  409.   end
    % X, c; k9 y# m; A/ M: v: g
  410.   #--------------------------------------------------------------------------
    2 {; ^8 }) T- \  W
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    , {4 {; v! G$ h/ @. x4 F, U
  412.   #--------------------------------------------------------------------------
    " e* D+ `' t  y2 g" m- w
  413.   def repeat(key)  Q- `0 Q; s# U/ d% n3 P
  414.     return true if sion_mouse_repeat(key)' m9 x7 M" L6 G1 X* A. \3 K" K
  415.     return Mouse.repeat(0x01) if key == C
    # j; }5 ?( x% {( e% e, K
  416.     return Mouse.repeat(0x02) if key == B; X' {. [9 U7 u- Y
  417.     return false" M; X# J3 u2 U
  418.   end7 U- B7 R% @8 r6 T. D; Q* E
  419. end6 ~9 J+ ^9 Z4 D% \! D, w/ V: D

  420. 1 P5 z, T% V+ w
  421.   ~! b. n- N$ u8 ?5 G7 G
  422. #==============================================================================
    6 o/ e4 z( m3 {4 y8 Q
  423. # ■ Window_Selectable& g! b" y7 j/ C* D
  424. #------------------------------------------------------------------------------
    1 ]3 V; m3 S: `5 P- M
  425. #  拥有光标移动、滚动功能的窗口
    # S; ^  V% e! T
  426. #==============================================================================
    ) R7 C& _, v  j
  427. class Window_Selectable7 A/ i; V4 m! M0 I% R  B
  428.   #--------------------------------------------------------------------------
    + M( R: Y! F3 Z- ?, `" E
  429.   # ● 初始化
    / f( Y8 q; `+ {3 N) ]+ Q
  430.   #--------------------------------------------------------------------------
    8 t- F* Q# ?+ K; C) X
  431.   alias sion_mouse_initialize initialize$ E* a* I9 s0 b+ E
  432.   def initialize(x, y, width, height)" s$ z/ {' ?7 I+ C7 F4 |  H
  433.     sion_mouse_initialize(x, y, width, height)
    0 ~3 Y/ ~; |' v! i% z. _
  434.     @move_state = 01 M) X. d1 j3 M$ |0 K- H+ e& `% o
  435.   end
    - \) n& L3 }) s# f: a; p
  436.   #--------------------------------------------------------------------------
    ( ?9 d; Y& D* k& [; j. Q/ U
  437.   # ● 更新
    $ R/ e( }& O7 \0 L) ]
  438.   #--------------------------------------------------------------------------/ p5 g. `3 \0 S' s2 \. l! |. Y
  439.   alias sion_mouse_update update: A/ A) z9 n2 r+ P
  440.   def update
    5 E: t4 l0 m! `7 o. P1 B8 Z2 Z
  441.     sion_mouse_update5 z% i  z" J! x" h  r
  442.     update_mouse_cursor) W3 @  e: |& }2 T% ~. {
  443.   end$ y* z5 g$ Y& V- G$ b, \* L
  444.   #--------------------------------------------------------------------------, m. F2 D8 w7 `# P( W9 q" a
  445.   # ● 启动后设置鼠标到index位置
    - g9 T: o5 K9 g' a
  446.   #--------------------------------------------------------------------------
    + U; o. r% V. a. b
  447.   def activate0 O$ J+ O/ W5 U- d3 A
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    * J( z. C5 U5 {, y- d
  449.     super- L1 y8 n5 |% G( X5 B  w4 d
  450.   end3 Y* V5 d3 Q: p* i8 M6 L0 t* Q
  451.   #--------------------------------------------------------------------------. s. j# M7 N$ l
  452.   # ● 更新鼠标和光标的位置6 N9 j* n! j2 W4 ^
  453.   #--------------------------------------------------------------------------
    . o$ X; W3 y) p3 ]5 m
  454.   def update_mouse_cursor/ [9 i/ ?3 m1 F
  455.     if active
    * q  e5 U9 ?9 h
  456.       if @need_set_pos% g( w" h- T0 m  H9 s4 q
  457.         @need_set_pos = nil
    / h3 j# w4 t4 v$ X8 W0 P; i$ `" v
  458.         set_mouse_pos
    * }3 D+ x8 i1 ~: Q, m' l% F" y
  459.       elsif cursor_movable
    ) n3 }' Y, W" w/ Q6 d
  460.         Input.dir4.zero  set_cursor  set_mouse_pos
    , q' R( Q6 o) n- {# ?0 \$ V
  461.       end% ~  z, i9 g4 n
  462.     end. _0 O- K6 s) `8 E4 w6 {
  463.   end
    9 o5 s5 `# P/ \0 Z0 b5 ]
  464.   #--------------------------------------------------------------------------+ E9 o' O6 L  g$ D
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能
    + }" Y- y. ~; ^" m- u, k9 d4 Z
  466.   #--------------------------------------------------------------------------
    $ j- ~- m; E( ]2 o1 m4 H- I
  467.   def set_cursor) M; X- `9 ?  @. `6 F/ g# L
  468.     mouse_row, mouse_col = mouse_window_area
    $ o) B6 D8 J# J! N8 j
  469.     if    mouse_row == -1
    2 I: z7 I1 I5 P- ~
  470.       @move_state += 1 if need_scroll
    . m& R/ P* J9 f! M" O6 R
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand
    1 A2 {& v# f0 I0 m) r, N" ^
  472.     elsif mouse_row == -2
    8 m% P* ~3 y8 X. m
  473.       @move_state += 1 if need_scroll
    ( {" @6 H, }" _5 r
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand, J* G9 g4 c; n2 o
  475.     elsif mouse_col == -1. ?4 R' o7 |' M
  476.       @move_state += 1 if need_scroll$ ^( \2 v- `7 R# T  S5 q
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand
    4 U4 I2 j) ]3 R$ {# z# k
  478.     elsif mouse_col == -23 u  f2 Q. l. \9 s
  479.       @move_state += 1 if need_scroll# G! k- z/ x( S, I( N
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand7 E: q1 x  n; L9 `! \
  481.     else6 r) B+ \5 v2 @; N9 {3 d
  482.       @move_state = 0, ?# Z, g. `, T
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col2 ]5 j! N" ?5 o. T
  484.       select(new_index) if new_index  item_max && new_index != @index
    ) `2 C+ \$ b/ P+ w' C0 @
  485.     end2 p* y0 _' p6 y/ l
  486.   end
    , I4 l- Y( ~; ~& Y
  487.   #--------------------------------------------------------------------------
    ; R) f4 G5 E1 K2 e
  488.   # ● 判断鼠标位于菜单的第几行、第几列: \8 p+ B1 i8 t/ m0 J2 `
  489.   #--------------------------------------------------------------------------
    ' `- ]! M  l$ U+ V1 |
  490.   def mouse_window_area0 E& a% i, x" ]5 A# ~( {
  491.     if viewport.nil # necessary!, I/ n2 }7 @2 B+ P  }' _5 c
  492.       vp_x, vp_y = 0, 0
    / }4 ?. t5 B* P# ^* q" C
  493.     else
    % }7 R- Q2 z* n9 m5 `, h0 o' G
  494.       vp_x = viewport.rect.x - viewport.ox- x$ ~5 [9 f+ }
  495.       vp_y = viewport.rect.y - viewport.oy
    ( P# ~5 A7 t1 }6 B. b) O" h/ j0 v* H
  496.     end
    & r5 ?+ v; ~+ o  B1 |- v
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    / u5 h( t9 j# x' a7 t- L  U
  498.     item_x1 = vp_x + x + standard_padding
    / x$ Y4 V% M) \- ?4 ~/ i7 u0 b3 G) o
  499.     item_y1 = vp_y + y + standard_padding% g/ P& `/ J& h9 V( V3 A+ q7 Y
  500.     item_x2 = vp_x + x - standard_padding + width- j8 B' h7 f* w5 {7 g! ^. V$ @( Y
  501.     item_y2 = vp_y + y - standard_padding + height- F- T( y9 W" U% E7 z1 c
  502.     if mouse_x  item_x1
    3 z) ?) C+ t8 p* h3 Y& Y
  503.       mouse_col = -1
    8 i* y+ d) ]  P1 O' h' K3 _6 h
  504.     elsif mouse_x  item_x2/ e! E% z- O3 M1 E5 I* \5 ^6 r
  505.       mouse_col = -2
      f. M! _: C1 P$ k: f  }/ [
  506.     else, b! N) d1 j9 ^( k* l
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)
    9 K0 J9 O( B, G9 L1 z) w8 U6 H
  508.     end
    + l2 K' t3 @7 C" i5 {
  509.     if mouse_y  item_y1# V/ _; D" @- t6 ~7 c7 O( N
  510.       mouse_row = -17 W& V  z7 n2 ~( z+ i8 z
  511.     elsif mouse_y  item_y2% N! u" d0 U; C1 \+ H- q
  512.       mouse_row = -2+ w# n' _: m- \, ?, ?
  513.     else
    , @) m4 P# N( u2 b
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    9 }% C% a! L5 d% p
  515.     end  ^( x" C# Y& T& y, `1 L& X
  516.     return mouse_row, mouse_col
    3 R& r# F8 y+ }8 h- f3 Y
  517.   end0 k* A  F0 C/ x0 h% [1 x% v) B
  518.   #--------------------------------------------------------------------------
    3 }9 s& S7 X& B; F9 ?6 p* |
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置8 L1 J4 T6 k2 @3 W8 \1 S' j9 N; r
  520.   #--------------------------------------------------------------------------# @$ `6 U; s2 R3 b
  521.   def set_mouse_pos% [) ~( S; t% Z% l
  522.     if viewport.nil # necessary!6 a/ x6 U0 a/ r9 y# A; r: J% t
  523.       vp_x, vp_y = 0, 0* U* ^+ c0 ^9 U+ w, S
  524.     else
    # A- a, H6 H& B7 r0 {1 t
  525.       vp_x = viewport.rect.x - viewport.ox! K: x* @4 o$ _1 K$ v9 e
  526.       vp_y = viewport.rect.y - viewport.oy1 @* j7 \' H( Q; r
  527.     end) L) Q& g9 v& @
  528.     item_x1 = vp_x + x + standard_padding 0 H5 b5 k9 o( S* H
  529.     item_y1 = vp_y + y + standard_padding! c+ r0 y9 a! o, P/ E' y
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index 3 S# {( V/ |& ]* v8 k
  531.     row = get_index  col_max - top_row
    ( l' i5 G1 G) T- ^, N' s8 ~
  532.     col = get_index % col_max7 [3 G$ E, w" s. j' U, Z0 V. }4 E
  533.     new_x = item_x1 + item_width  (col + 0.5)# Z$ Y* c( p7 I9 y
  534.     new_y = item_y1 + item_height  (row + 0.5); c  G( u! @+ q5 {6 N: v
  535.     Mouse.set_mouse_pos(new_x, new_y)
    ( f" k0 j( [, Z' x: T4 Y
  536.   end, v! P* O( g' n: ^
  537.   #--------------------------------------------------------------------------
    3 l2 q$ n1 J" x: u: F- w' V5 ?
  538.   # ● 判断菜单是否需要卷动8 b, q- F1 A9 c" A6 m  I+ ?8 `# @
  539.   #--------------------------------------------------------------------------
    ! o5 R; Y3 Z4 r7 r3 |" N/ ?
  540.   def need_scroll
    ' ?7 H8 \+ j3 L2 Z7 U/ a
  541.     item_max  col_max  page_row_max
    % A0 Z5 f# \- \! y
  542.   end
    . b8 g0 D- P8 c. a! ]" w: T3 ]
  543.   #--------------------------------------------------------------------------
    8 l3 m- A) T* D0 `. n& c
  544.   # ● 判断是否为水平卷动菜单' h2 S+ j! ], A  h* j' W
  545.   #--------------------------------------------------------------------------
    ! V9 s6 H9 q: g/ E. j
  546.   def is_horzcommand
    , w$ _9 v( @. \1 Z, \2 a
  547.     return false( ^  V$ l4 r) i$ D" i* C. l
  548.   end8 G+ Q! Z% t1 u" i
  549. end
    2 _9 R3 ]; D+ A1 y9 Z
  550. 0 E) N! v; u; N
  551. class Window_HorzCommand
    , o* k8 i! F. g! A+ W, s9 w
  552.   #--------------------------------------------------------------------------" H5 k; ?" {0 _0 B6 Q& m7 L
  553.   # ● 判断是否为水平卷动菜单8 Z* s- ~7 G: b. t3 ^
  554.   #--------------------------------------------------------------------------
    ( F9 r) A/ z1 J9 O
  555.   def is_horzcommand. }; X3 a3 T' T( s' c" }0 Y" J
  556.     return true% j! A3 \  n) g4 m! y
  557.   end5 Y5 o: `0 D. U' K6 z: p
  558. end
    ) H# a# Q# M1 Y: b0 S2 d
  559. 5 W6 t3 k0 b/ [( |+ y' e
  560. #==============================================================================' O7 X1 K3 Q  n3 ^3 k' f$ Q
  561. # ■ Window_NameInput
    : }9 }3 Q6 k( h4 ]( T
  562. #------------------------------------------------------------------------------
    5 n! \% U2 l* _: B8 N
  563. #  名字输入画面中,选择文字的窗口。/ f0 L$ W9 Z7 T# H/ p5 B! i% D( X2 q
  564. #==============================================================================
    $ Z: e4 p4 j! r: Q& h( U# {, N
  565. class Window_NameInput
    * L. r- e* b$ t% C1 {0 A+ Y5 p8 t
  566.   #--------------------------------------------------------------------------" Q3 t; I3 Y! @7 W9 p
  567.   # ● 设置列数9 T0 k. r5 \5 S' I- C
  568.   #--------------------------------------------------------------------------& @% K! H2 Y1 |. X. T% J& o7 b' u
  569.   def col_max$ L: i& ~3 ]/ x
  570.     return 10
    2 r1 G, P+ E& N' [( U/ f
  571.   end
    ! x- l) W, s% t$ m
  572.   #--------------------------------------------------------------------------# M' p' e/ d7 s6 A1 o( F% o
  573.   # ● 设置填充的Item个数
    6 r$ ~% Q# U% v0 I4 U5 V4 @! t
  574.   #--------------------------------------------------------------------------
    " y. Z4 n) v. ^; K7 J# a
  575.   def item_max
    6 [% D; x0 Y, y- G# h, z
  576.     return 90
    9 y1 ]9 T9 I- j/ e' E  ~
  577.   end
    / G) f0 s, w& ]
  578.   #--------------------------------------------------------------------------. R% `- i4 I8 f0 w/ U& c! y
  579.   # ● 设置填充的Item个数
    - V0 ?: S0 E9 _' m# g: W5 K: t# b
  580.   #--------------------------------------------------------------------------* i1 o% n+ D* R* }& n
  581.   def item_width
    7 _& F% K9 z9 a) y- Z6 O, H
  582.     return 32' R: s# R; F5 v
  583.   end
    , }1 r; M; Y$ k  X, ^# z8 \9 A" L
  584.   #--------------------------------------------------------------------------# r7 v8 w  c! [3 b& b# ]+ W3 j
  585.   # ● 判断鼠标位于菜单的第几行、第几列% m, I# ^& _' w9 w9 z
  586.   #--------------------------------------------------------------------------% k. z" c3 T- M  D& K
  587.   def mouse_window_area
    * J+ ]0 c1 P4 o* e
  588.     if viewport.nil. A7 ]% k0 ?" O& A5 i/ X* |8 T9 |5 L: k
  589.       vp_x, vp_y = 0, 0' T$ D; s# g+ A9 A4 ?! T4 B+ p
  590.     else# m( y! R; M: T" V+ H# w
  591.       vp_x = viewport.rect.x - viewport.ox, M" m8 f, L* r. L5 n4 o, ~" e6 S
  592.       vp_y = viewport.rect.y - viewport.oy
    5 u+ e' d1 p( w; z0 M! B# o
  593.     end2 H& ~8 W3 k+ W' j0 R* Y$ n. x6 H
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y! s- v/ g5 D; c. f; W) c% _
  595.     item_x1 = vp_x + x + standard_padding 4 W: I; t$ N2 g. K' Y
  596.     item_y1 = vp_y + y + standard_padding+ ^- y# q: A5 p1 N. N8 `
  597.     item_x2 = vp_x + x - standard_padding + width
    + {' B* ?, \2 A, V
  598.     item_y2 = vp_y + y - standard_padding + height$ E7 z& d. z: S, H% j6 S
  599.     if mouse_x  item_x1! }  a& t$ n2 F6 D  j" }
  600.       mouse_col = -1
    * @9 b4 Q( k9 }1 \
  601.     elsif mouse_x  item_x2# \+ J- A5 Y. n& O, p9 f( |
  602.       mouse_col = -2
    , }8 H8 e1 W( q6 G- G" k4 P  s! u7 L
  603.     elsif mouse_x  item_x1 + 160' r* H( [+ r8 r0 C( g  b1 e7 Q5 R
  604.       mouse_col = (mouse_x - item_x1)32
    6 Z. |( i  L% T8 C3 O/ E* {
  605.     elsif mouse_x  item_x2 - 160
    ; |& h( ~5 w; D4 z( p7 S% B2 {9 h
  606.       mouse_col = 9 - (item_x2 - mouse_x)32$ w; t' o- Q( q8 b, Z) H
  607.     else
    & _7 I- U8 n& n" M3 Y  g; z
  608.       mouse_col = mouse_x  x + width2  5  4! c. p8 n+ E6 y
  609.     end
    . P' N8 v. |8 `2 E
  610.     if mouse_y  item_y1
    ( w# W5 d3 \8 [
  611.       mouse_row = -1
    6 k" R: z$ G3 M1 c. r7 ?' [
  612.     elsif mouse_y  item_y2
    . d* }1 U; R% h* v- C
  613.       mouse_row = -2
    9 \5 r- E; V0 e" [0 {
  614.     else, ]4 K  \) n& M' E
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1), P6 h( @( d" F( O
  616.     end% }2 `6 T& O4 [' J3 v
  617.     return mouse_row, mouse_col% L! Q- e- s4 W0 X/ `
  618.   end$ n, C: M  l3 Y4 E# }$ X
  619.   #--------------------------------------------------------------------------/ ?7 v8 q. w$ c4 S1 m  q
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置+ \. O5 F; E- m. {" U. D2 P
  621.   #--------------------------------------------------------------------------
    / Y0 I' q& h6 |) |" F0 m4 n
  622.   def set_mouse_pos# I9 A5 U, w9 I) ?0 v+ U% H3 T
  623.     if viewport.nil # necessary!
    - O9 u5 [9 R( P, N7 q8 F
  624.       vp_x, vp_y = 0, 08 T2 e# c$ b) R9 J2 b# V# D
  625.     else
    ; B8 t# n" O8 z5 a; x
  626.       vp_x = viewport.rect.x - viewport.ox
    $ Q. r5 J+ d* I. o8 ]/ d; h
  627.       vp_y = viewport.rect.y - viewport.oy
    " r; d" L/ V4 ^. W! L! W2 C
  628.     end
    2 R- l7 }* r! f
  629.     item_x1 = vp_x + x + standard_padding
    0 Q/ Y  A0 s3 k% v$ D+ q1 @% I5 g4 R" C
  630.     item_y1 = vp_y + y + standard_padding* H* F. J0 [; b* U% p
  631.     get_index = @index  0  0  @index
    * k. l$ Y3 L: Y0 e
  632.     row = get_index  col_max - top_row5 s( h/ r# E+ G3 h% b# t0 r3 c$ o. Z; m
  633.     col = get_index % col_max4 x  h0 `  w" n% ^
  634.     new_x = item_x1 + item_width  (col + 0.5)4 D  g0 x* l% O7 J8 f( ^. S( d
  635.     new_y = item_y1 + item_height  (row + 0.5)
    * h( P' F1 [9 r% u; f$ a, H4 O9 C. e
  636.     new_x += 14 if col  40 l# h7 u0 }$ s3 W, @; R( W
  637.     Mouse.set_mouse_pos(new_x, new_y)/ Y0 x: @& E4 N! B: y
  638.   end
    7 U  `. p3 X6 q- p
  639. end
    / E8 {6 ]7 ^4 t+ U: ^3 Y; I
  640. 9 a+ [  C7 ]! _. r. X8 o. b! Y
  641. #==============================================================================
    2 v$ i) V# n3 K* w* i) ^- F
  642. # ■ Window_NumberInput
    8 B7 f" _4 X- ^$ \$ e2 k* h
  643. #------------------------------------------------------------------------------
    ( D$ p0 n7 H$ m. j' F: r5 C. y
  644. #  重写了数值输入的方法以适应鼠标
    - k' R! {5 x2 y* V. O, v
  645. #==============================================================================
    ; K7 G. D+ @- h" L2 h; c' `
  646. class Window_NumberInput  Window_Base2 X8 N3 |+ _' d. T& \& s! ^% W( d/ f0 ?
  647.   #--------------------------------------------------------------------------3 ^/ _( L! ]2 q
  648.   # ● 定义实例变量
    " [! h, W( B* ?7 q/ U( J
  649.   #--------------------------------------------------------------------------
    : M$ c6 o2 J8 _
  650.   attr_reader extra_window
    1 m$ o/ e/ g8 l: e8 C
  651.   #--------------------------------------------------------------------------& V, e, P2 S$ L# f! K
  652.   # ● 初始化
    % r* H4 W, a; u4 w7 T; c
  653.   #--------------------------------------------------------------------------
    ( x/ }- j1 Q# ^7 f7 D% H
  654.   alias sion_mouse_initialize initialize4 G% Y7 s1 Q1 z
  655.   def initialize(arg)9 K& t0 f! \' r$ d
  656.     sion_mouse_initialize(arg)
    % `- g* \2 ^: [, U7 P
  657.     create_extra_window( ?; X% I9 J3 f9 ~: T* d& V5 [
  658.   end
    $ k& z  W3 V" g/ Q
  659.   #--------------------------------------------------------------------------
    ) W/ {$ T+ l' Y* z% u5 r  Q
  660.   # ● 启动6 t2 F8 l5 R" |2 U) L
  661.   #--------------------------------------------------------------------------+ U1 t' F; f, t8 L& Q0 d$ L
  662.   alias sion_mouse_start start
    ) j/ {- e  |, k# V7 E. k/ C
  663.   def start
    # M: X1 B9 t. P, r
  664.     sion_mouse_start
    % g: t! j0 ~( T
  665.     deactivate
    4 T" o4 o9 b6 }0 b3 J+ P
  666.     extra_start- K1 D, c% P, v
  667.   end
    4 U) n+ V" `- p' f9 M" K
  668.   #--------------------------------------------------------------------------
    / F8 B3 @* r  h" A
  669.   # ● 创建新的数值输入窗口
    / B/ f  V3 \, Y" [$ h/ g5 s" v
  670.   #--------------------------------------------------------------------------5 h4 z; A, d' g
  671.   def create_extra_window
    0 w" m  O- e, x8 [$ `: P5 f
  672.     @extra_window = Window_NumberInput_Ex.new6 Z# L- O9 |: Q: F5 M0 q
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2" {# O& Y" b2 M$ p4 m+ v
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }% V; r4 u( T( r( ?% r/ u, G
  675.     @extra_window.index_proc   = Proc.new {n @index = n }3 ], j" e7 {% m0 Z
  676.     @extra_window.close_proc   = Proc.new { close }
      h5 s0 [0 ]. e( D) y+ Y
  677.     @extra_window.refresh_proc = Proc.new { refresh }# t4 a$ h$ b9 Y/ A# a5 s6 S
  678.   end! W- r5 g2 n3 X; z6 _, b; ?9 o
  679.   #--------------------------------------------------------------------------
    ' s0 v: i9 B; G5 c( ^  \* K% [
  680.   # ● 激活新窗口( ^7 q( t* y3 W5 F5 F8 T
  681.   #--------------------------------------------------------------------------
    . m9 d7 `( K, X) A
  682.   def extra_start
    - `6 G7 ~* [7 j6 V6 }
  683.     case $game_message.position$ S5 }8 l: _0 g3 b) q7 i; k
  684.       when 0; @extra_window.y = y + height + 4
      S( \! b2 H, O  \% U: U, j7 L/ Y
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
    8 F4 K4 U) w) q
  686.       when 2; @extra_window.y = y - @extra_window.height - 4& q" M+ z; N3 R; ?4 y+ r0 ^6 ?
  687.       else  ; @extra_window.y = 83 Y, U9 j- u) {; l; }
  688.     end
    ! S$ r' a" h! g, u9 k* H
  689.     @extra_window.variable_id = $game_message.num_input_variable_id
    : x: L& C$ ^; z, ?' }5 o. V  {
  690.     @extra_window.digits_max  = @digits_max& w8 w- o' P3 v0 h6 m% N+ w$ S
  691.     @extra_window.number      = @number
    , R$ A* g7 i/ p. q
  692.     @extra_window.open
    1 P: r. M. t  N- t5 [
  693.     @extra_window.activate; s8 F0 |9 o! B- @
  694.   end
    ( i; |9 J) M) H$ n% R) t" h
  695.   #--------------------------------------------------------------------------
    # N0 w' i2 H& Y& @
  696.   # ● 更新: ~' k  y+ a: a' E, f( v7 r
  697.   #--------------------------------------------------------------------------2 D+ ?6 f, d* U0 e% w3 {  e( W0 C
  698.   def update; a3 ]9 V5 W; ]# {8 I& \( h
  699.     super$ ?! l2 v; O+ k7 N& H& m4 _' Q' v
  700.     @extra_window.update
    8 P" B! P. P* l! M$ Y
  701.     update_cursor
    " e6 b1 o7 E, c8 Z( ?
  702.   end
    ! h5 B- y* O) W6 e
  703.   #--------------------------------------------------------------------------
    ' s( q. o! h& B
  704.   # ● 关闭窗口, [; C/ {5 l2 W* E" G
  705.   #--------------------------------------------------------------------------0 s, l+ y' a; r
  706.   def close! {7 z/ q9 M9 [3 H8 J
  707.     super/ |4 n& a( l- R3 ^' d
  708.     @extra_window.close7 w' l/ O9 ?" W6 F/ E6 V8 h- U
  709.     @extra_window.deactivate
    ! f; B: r# J0 e2 a1 F' s
  710.   end
    + z3 z2 n7 W% ?% \6 _/ O
  711. end
    8 f2 W0 E$ D. N2 \9 _0 e2 Z
  712. + M3 W# Z: P# C( ^( E' I5 r
  713. #==============================================================================
    , m3 A* W4 a4 j; O
  714. # ■ Window_NumberInput_Ex
    + e% h/ s3 d9 D& R% p! N
  715. #------------------------------------------------------------------------------" R$ {6 \' [) @
  716. #  新的数值输入窗口(NewClass)
    ) f  c: W$ t  K. K
  717. #==============================================================================) h. _' D7 M* `: o
  718. class Window_NumberInput_Ex  Window_Selectable
      A) F) c7 G' r! W, s3 B& [
  719.   #--------------------------------------------------------------------------
    * X0 }7 e: Y0 i; X
  720.   # ● 定义实例变量
    2 S9 X2 Z) [7 G) Y
  721.   #--------------------------------------------------------------------------7 d: y0 [8 H. U) X4 g1 ]
  722.   attr_accessor number_proc
    1 w3 x/ r. W2 }* h
  723.   attr_accessor index_proc# N. C5 f8 L0 p
  724.   attr_accessor close_proc
    ( c( y( K7 k: u: h; S
  725.   attr_accessor refresh_proc
    3 c/ [$ R: u, Z1 d# m
  726.   attr_accessor number
    , _* [8 L) J7 r, O
  727.   attr_accessor digits_max
    + j. ^2 q3 v6 G
  728.   attr_accessor variable_id9 H% I! _7 V9 r" ]
  729.   #--------------------------------------------------------------------------
    3 J8 _& h- u* ]3 W$ g
  730.   # ● 数字表' ^3 Q/ z6 \! \: I- j
  731.   #--------------------------------------------------------------------------: R* F/ @2 ]- P- O+ Z- O( q& Q+ |/ p
  732.   TABLE = [  7,  8,  9,4 |; k8 W6 s1 r/ C+ K) R
  733.              4,  5,  6,3 |6 k* H! i) C8 Q1 x# o% ?' a4 y
  734.              1,  2,  3,$ X6 R5 [# }$ t% }& ^
  735.             '←',0,'确定',]
    " q" F2 @' d9 M
  736.   #--------------------------------------------------------------------------
    5 J/ X) F% b9 d2 K$ q' R# W
  737.   # ● 初始化对象
    7 a+ M' I; @& L' ?9 Z' Z" ]# I( M$ b
  738.   #--------------------------------------------------------------------------
    - g! G% `! B' t: d( n, F7 o5 U
  739.   def initialize5 b& z* m5 ]6 t
  740.     super(0, 0, 120, fitting_height(4))
    : S% l; {' O. S+ n+ g
  741.     self.openness = 0+ s/ b& z5 a# A) R) ]
  742.     @index = 0
    6 m- Y2 k: P: j- s$ i: E2 }
  743.     @number = 05 e3 }3 n* Y" a( n# X1 Y/ I
  744.     @old_window_index = 0. B/ M: v% y. M: B% M/ g7 A
  745.     @digits_max = 0% \! y3 I7 E6 c& F# L% Q9 M8 m; O
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }
    * B3 }3 v0 i4 ?
  747.   end& o8 @, S. K) w  S; k% p0 P4 s) d
  748.   #--------------------------------------------------------------------------
    ( H+ t$ K2 m/ M0 M7 j- |% u% m
  749.   # ● 获取项目的绘制矩形+ {( c4 K) Q" ?! d6 B
  750.   #--------------------------------------------------------------------------
    # W2 E  G$ x( S" [" P! d/ {' m0 w
  751.   def item_rect(index)
    $ g" t* k6 Q0 J8 K5 B) `* d4 |
  752.     rect = Rect.new
    * N( ], X* k! i3 v, U
  753.     rect.x = index % 3  32& I5 O/ k  s0 L$ ?3 b( w( i
  754.     rect.y = index  3  line_height' N# `- \, D" L- ^3 X! E
  755.     rect.width = 32
    . P- Y9 T4 ]9 Z
  756.     rect.height = line_height5 h: ~. ^: n; ?% J% h
  757.     return rect& @2 B; `( {* |  n7 ?. p
  758.   end
    / ?8 V3 ]( i* x& \9 d0 h
  759.   #--------------------------------------------------------------------------
    ; q& ], r+ z" m' X4 u7 c3 ]
  760.   # ● 将光标设置到鼠标所在的位置1 y6 l+ E: }7 T. j
  761.   #--------------------------------------------------------------------------
    " Z' K1 {7 J7 B% j  R; p3 v
  762.   def set_cursor
    , P$ ?" q* X* i& O
  763.     mouse_row, mouse_col = mouse_window_area9 M- J/ U+ @2 U8 `3 R; Y( x' g! r
  764.     if mouse_row = 0 && mouse_col = 0# v5 V  T3 ]) s- q- H' _9 N+ R
  765.       new_index = mouse_row  3 + mouse_col
    ) w. q0 |( f, j6 t7 u
  766.       select(new_index) if new_index = 111 R  o- ]/ Y9 h: m( g$ ?+ g  G" C
  767.     end% B# V' V! Y# z3 M; C
  768.   end& y! F9 A  b! {( r: j! Q( `
  769.   #--------------------------------------------------------------------------
    ' |4 p( A7 v% _  W% U* `8 r
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列. e6 ~3 r8 D7 {
  771.   #--------------------------------------------------------------------------  l' l. {# h: O# z" T
  772.   def mouse_window_area
    ; }; w+ _; H4 Y/ ~( ^
  773.     if viewport.nil0 Z9 r# H. \5 W% b6 W+ a
  774.       vp_x, vp_y = 0, 0% t" @: D. I7 V: m
  775.     else
    6 y3 P2 t0 F9 v5 l) ^# B
  776.       vp_x = viewport.rect.x - viewport.ox2 o/ t- S4 j. a2 h
  777.       vp_y = viewport.rect.y - viewport.oy
    ; e$ g! s; ?, I; C
  778.     end
    * F2 [+ r; l- R2 [
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    & D) d' Z/ g4 m0 }3 s1 [, I
  780.     item_x1 = vp_x + x + standard_padding / p7 j. c- K: m# T( Z! c4 W0 g1 x
  781.     item_y1 = vp_y + y + standard_padding
    # x0 d; |! p9 b# f
  782.     item_x2 = vp_x + x - standard_padding + width# }9 N, E6 L( C4 B
  783.     item_y2 = vp_y + y - standard_padding + height6 H; a/ M3 {9 D3 q/ X  A
  784.     if mouse_x  item_x1
    5 C. w  i; F% Q
  785.       mouse_col = -1( v$ U; H0 o. x
  786.     elsif mouse_x  item_x2
    / v' [8 f% k1 L, ^
  787.       mouse_col = -2) B1 O2 @$ Q* w# Z) F
  788.     else
    : h6 e3 g0 u3 I) J3 G
  789.       mouse_col = (mouse_x - item_x1)  32
    7 v6 G$ }5 P9 _' B) U
  790.     end- l0 ]6 |0 X3 X! [
  791.     if mouse_y  item_y1  y' t* h9 Q- F$ e+ c
  792.       mouse_row = -1
    5 E5 f* z$ U1 e0 o6 x
  793.     elsif mouse_y  item_y2
    , K1 z2 p0 A% Z' m; g/ W. i! z, q
  794.       mouse_row = -2
    ' A$ l9 f$ g* a) W' G0 o! h
  795.     else7 t( u6 }- \* q) L: K( O/ o8 B! c8 r2 Y
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    & q" y$ c' ]6 J- c! K* w" B2 L
  797.     end: H- r1 X$ V/ z7 `
  798.     return mouse_row, mouse_col  S, p' v2 S: {# \: }' F
  799.   end
    6 k/ w* U! _1 Q7 C, t) f1 z0 l) _( p0 S
  800.   #--------------------------------------------------------------------------
    : A( j5 k% R& H( R7 O% Q0 U& x# V
  801.   # ● 获取文字
    , Z/ @8 o+ y7 `) [: R  ^
  802.   #--------------------------------------------------------------------------! t# q9 c6 [/ ~2 A0 s5 q
  803.   def get_number7 E3 Y: E) ?" g* g& ^9 C
  804.     return false if @index == 9  @index == 11  a) I, f# ~8 B! n  `
  805.     return TABLE[@index]" y* x0 J& y. [
  806.   end
    ) k! ~  L& h/ z8 M4 \4 `
  807.   #--------------------------------------------------------------------------
    / E" _) l9 O+ R$ `% n
  808.   # ● 判定光标位置是否在“退格”上/ L% G: @; K" z# b
  809.   #--------------------------------------------------------------------------% P: x% a' y1 f/ n
  810.   def is_delete
    0 K; c- H0 r& H  A% d7 }
  811.     @index == 9
    ' c# X' u- b$ }" p
  812.   end( x. M) P8 e2 K9 F' ~+ k- Z
  813.   #--------------------------------------------------------------------------+ _7 e" Y8 C/ \/ Y* V/ b3 t
  814.   # ● 判定光标位置是否在“确定”上* c# w! F) W, U# Z+ \+ X
  815.   #--------------------------------------------------------------------------
    " ~. B& o5 c; V3 x& n, S1 J
  816.   def is_ok; \2 V' T, G- O' p+ Q$ J/ S/ b
  817.     @index == 11. k' ?1 T- `3 e9 n5 ^3 w# _
  818.   end
    , v5 Y' ?% M0 P% w  N. p
  819.   #--------------------------------------------------------------------------
    ; x. B5 ~' b, V$ M
  820.   # ● 更新光标) m* x( A5 C- |' m
  821.   #--------------------------------------------------------------------------6 Q/ `! M( A2 x$ |6 d
  822.   def update_cursor
    $ j2 s6 R7 Y9 x+ e/ t
  823.     cursor_rect.set(item_rect(@index))( t: f* O3 Z: a, D$ ]9 I- J5 i
  824.   end! z3 O: c2 s2 S" Y& B% r+ o9 s
  825.   #--------------------------------------------------------------------------
    6 ]1 P5 o6 v9 w4 Q: P3 m
  826.   # ● 判定光标是否可以移动% L0 }! T: N- r  j
  827.   #--------------------------------------------------------------------------5 ?2 T6 Q  j: X0 n9 a* d
  828.   def cursor_movable
    , J" k' n7 f# ~1 H$ D1 ?/ V* }$ f/ @
  829.     active
    + j- W  u/ N0 R! D
  830.   end
    8 ^# B2 J& ]( T0 u# @
  831.   #--------------------------------------------------------------------------3 _6 r1 J% M' d: o: ]7 l
  832.   # ● 光标向下移动6 n- y( c5 Y$ Y8 K; w" q
  833.   #     wrap  允许循环
      b! A+ D& l/ D% l
  834.   #--------------------------------------------------------------------------
    & n9 d1 z8 O3 B2 A. r9 V& z
  835.   def cursor_down(wrap)
    8 s2 W  T# W. |: _# D) _1 M2 e3 Z! o
  836.     if @index  9 or wrap
    2 Y, D  _' |  }/ c& l) T
  837.       @index = (index + 3) % 12
    " K  s3 N; c( _1 `$ T
  838.     end
      q& G8 v  d% N) A
  839.   end5 [% c7 W* d5 G. O8 U) Y" S* _; L
  840.   #--------------------------------------------------------------------------
    ! [7 d$ i- m, Z; r
  841.   # ● 光标向上移动) S6 K( G, _5 R; e# O' b4 K
  842.   #     wrap  允许循环& y1 R0 e1 ]' h4 D
  843.   #--------------------------------------------------------------------------* b& Y: ^: k9 n- l* `+ j$ p/ m
  844.   def cursor_up(wrap)+ P* ~  z. r- a9 U
  845.     if @index = 3 or wrap
    3 s3 Y0 r- n* g$ H: {! J
  846.       @index = (index + 9) % 12
    0 D' C' U& M+ M5 [; z
  847.     end
    # B- w1 v1 n% j4 w9 x& G
  848.   end
    ) x7 x. d% j; U# Z  r
  849.   #--------------------------------------------------------------------------
    % |( M9 D7 o4 ]  b" E# C% v
  850.   # ● 光标向右移动5 a3 w. b6 t# F- c- w) c+ n
  851.   #     wrap  允许循环
    ! S( K% ]+ w1 o9 n4 T" c
  852.   #--------------------------------------------------------------------------
    " x5 [' l$ {3 Z
  853.   def cursor_right(wrap)
    % Z. J) J/ h5 J" W, M+ R
  854.     if @index % 3  24 K4 P: ]) {+ k& M, }, H% G& w
  855.       @index += 1
    ! R' C. U5 l8 g( i$ r
  856.     elsif wrap' ]% y3 G+ [1 H$ S1 b4 n' o
  857.       @index -= 23 X  ~3 @! P$ r9 Z
  858.     end; B4 a2 Z. W/ R
  859.   end
    # G+ O( z# p& S- f( @: K
  860.   #--------------------------------------------------------------------------' W! G% C4 C1 \% t7 M
  861.   # ● 光标向左移动: H1 z. T5 j5 J6 R: \: I
  862.   #     wrap  允许循环
    7 u1 x6 j9 r( v8 y
  863.   #--------------------------------------------------------------------------
    % {0 r# a+ q' |1 W( t& j6 q3 y! w
  864.   def cursor_left(wrap)! V% X: a! m3 U( R
  865.     if @index % 3  0
    5 m  [+ }! M& V! c
  866.       @index -= 1
    3 i8 u# I) w4 }, D( M7 ]5 J
  867.     elsif wrap
    . ~8 [0 |8 k( e4 R1 n8 Q
  868.       @index += 2
    # n0 z" r# V) Y* L. m1 Y' |
  869.     end& y: \* c7 b2 p  o% X
  870.   end6 A. r+ E; J( z
  871.   #--------------------------------------------------------------------------' P( H1 w( F8 B, [* p. W
  872.   # ● 处理光标的移动
    ) [. \: @" n* t7 R( V
  873.   #--------------------------------------------------------------------------
    6 @' F& {, ]1 j/ G5 I
  874.   def process_cursor_move) u; V3 L) e: H7 i5 \, [0 a
  875.     super/ _0 t1 I7 G. ~! ~. o: F
  876.     update_cursor, T$ F  {% Q  L% ~3 o, x- o
  877.   end
    2 a0 l1 W3 }, u1 R3 l
  878.   #--------------------------------------------------------------------------3 L0 F3 Z+ Q  D) ]  Z+ {
  879.   # ● “确定”、“删除字符”和“取消输入”的处理" u, I( t6 r, \# b. A
  880.   #--------------------------------------------------------------------------
    6 o9 \6 C/ j7 a$ f) t* f
  881.   def process_handling- D  k0 Q+ R3 i; k3 c" ^3 b
  882.     return unless open && active* `7 x9 Q8 O5 u3 x. v! W& |
  883.     process_jump if Input.trigger(A)' K5 Z; c+ N* F) N, {
  884.     process_back if Input.repeat(B)
    0 C/ i& a: w) e% L
  885.     process_ok   if Input.trigger(C)! ^% n+ E" \1 ^6 }6 O# t1 j
  886.   end; j% {3 U; x* [# ]) q( y) ?
  887.   #--------------------------------------------------------------------------- G/ e4 {4 H4 k/ V2 x3 O/ T
  888.   # ● 跳转“确定”5 \/ V" G+ `0 C' g/ `7 e
  889.   #--------------------------------------------------------------------------+ ]" z$ }- j9 w6 E' X" o, M
  890.   def process_jump  G# Y( s& X- d9 m! V& X3 x
  891.     if @index != 11: `4 K1 e% S* d4 L& r
  892.       @index = 11( b2 }! \3 z) Z( n; X
  893.       Sound.play_cursor
    : |6 l! p; \# l* |7 y: E3 |
  894.     end6 l8 T. K$ C$ I, w
  895.   end; w( B: o% i2 [( m- {
  896.   #--------------------------------------------------------------------------
    . M. \) h4 A; l+ I" V6 K; F
  897.   # ● 后退一个字符( x4 F% Z0 }  M! R1 A" H5 I2 }: z
  898.   #--------------------------------------------------------------------------: I( S- v5 f  k* z, Q
  899.   def process_back
    % \2 K3 g* s8 H* k3 O# D, B
  900.     Sound.play_cancel( Q  W/ c  q0 w
  901.     place = 10  (@digits_max - 1 - @old_window_index)
    - a( B+ _- v7 l) G3 \8 q) k
  902.     n = (@number  place) % 104 `2 m, d, ~, a. c" @+ |" Y9 z
  903.     @number -= n  place4 J7 U, W) a3 U& c0 J
  904.     @number_proc.call(@number)9 b1 U/ J1 W, A# n9 n8 L, h
  905.     @old_window_index -= 1 if @old_window_index  0
    5 p) i2 I3 @( |, Q
  906.     @index_proc.call(@old_window_index)
    2 w8 w9 Q9 f. }
  907.     @refresh_proc.call" o  S3 i" W5 r
  908.   end4 i2 ]- [& m5 |9 K$ V
  909.   #--------------------------------------------------------------------------
    . ?, \( d- B* u- M  B/ |) Z0 C
  910.   # ● 按下确定键时的处理7 [8 C2 f1 o; Q* Q
  911.   #--------------------------------------------------------------------------
    $ F: T* H! c; }0 |/ V' n# W
  912.   def process_ok" _  {( {8 y. p) T! |: H
  913.     if get_number, b9 c8 r4 c$ c; K" z$ \
  914.       Sound.play_cursor
    4 }0 x- u2 z9 z
  915.       place = 10  (@digits_max - 1 - @old_window_index)
    " ^; K5 P) R6 V4 h/ _0 Z2 l# g  ]
  916.       n = get_number - (@number  place) % 10. P  u0 s5 `* `" j9 u7 N: J
  917.       @number += n  place
    2 Z5 f4 }6 X+ }3 f# I: [3 S
  918.       @number_proc.call(@number)  ^" S: N2 b" h. {8 @
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1) R& g& J, T; M& j( {6 o& e) q
  920.       @index_proc.call(@old_window_index)
    5 P$ v7 g3 p; e, g; i- E$ r
  921.       @refresh_proc.call# G7 F" p  o: o0 d8 p, O
  922.     elsif is_delete
    2 O2 S. ]- y/ N9 P/ r. a# r
  923.       process_back
    9 Z1 x6 D1 z2 ~# _0 |- K
  924.     elsif is_ok5 V8 }5 R& g6 V) B: M
  925.       on_input_ok
    9 Z+ y% n7 V; b
  926.     end
    / N( f0 M6 ]1 q+ |0 @
  927.   end
    9 f" F) N- b6 W" v( V1 B
  928.   #--------------------------------------------------------------------------& r- m5 M3 R* I& O# P
  929.   # ● 确定9 x% z* K% z# F+ u/ e% v
  930.   #--------------------------------------------------------------------------
    3 {  |/ q+ T+ U& v9 M+ `
  931.   def on_input_ok
    2 X; B' v* ]" b
  932.     @index = 0" n7 N# L/ g, k8 w* Z2 \7 H
  933.     @old_window_index = 02 C- g- _2 q, \( k! a/ h
  934.     $game_variables[@variable_id] = @number5 x8 I1 S, `" v% r) N
  935.     Sound.play_ok3 G% @; {! w2 J
  936.     @close_proc.call
    9 d' m! R. W) B3 ?
  937.   end
    & |) q1 B+ a- g$ @1 L# Z/ K; J
  938.   #--------------------------------------------------------------------------
    * W) L. O) @3 C! f, q
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    7 v* |+ j0 [: u
  940.   #--------------------------------------------------------------------------
    ( o3 z; }$ f5 G  z% T
  941.   def set_mouse_pos
    ) q: e" t6 m9 G/ F- b7 P7 m
  942.     if viewport.nil # necessary!
    " o# v" Q8 M! u) q( \( k
  943.       vp_x, vp_y = 0, 0
    , b' c$ p3 s( @: R: O$ b, T5 U' m
  944.     else* W' d2 Z3 u& n
  945.       vp_x = viewport.rect.x - viewport.ox
    ( s. c0 L8 p+ B5 d4 |
  946.       vp_y = viewport.rect.y - viewport.oy" ~- @) s$ ]( J$ J! ?2 u- W
  947.     end
    : J+ e. |4 F! n5 X) v5 g
  948.     item_x1 = vp_x + x + standard_padding
    , [6 H! ?' l; p
  949.     item_y1 = vp_y + y + standard_padding$ p9 w( c! F& b) {$ [
  950.     get_index = @index  0  0  @index $ \& w- g9 N; v/ V8 h1 R- S
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)
    1 F$ t: k) j1 v/ Z- y4 p9 P
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5), ?  i$ R4 r8 O5 R. e( Q% S0 N
  953.     Mouse.set_mouse_pos(new_x, new_y)
    ; i# i4 t& i; c& K: f
  954.   end
    ) y8 f& P! o+ v' P1 R6 g6 X
  955. end1 _( G7 S- @2 E* P1 P

  956. 1 \, b! B& h- F4 c( K
  957. #==============================================================================
    8 g) A+ ]2 ~+ A8 n
  958. # ■ Window_Message: F  r1 y, F# c, y
  959. #------------------------------------------------------------------------------
    + L  w, B+ [7 t1 Q
  960. #  显示文字信息的窗口。
    ' j' h7 C8 c" \5 `" G
  961. #==============================================================================
    6 v$ Y' M2 m; U
  962. class Window_Message  Window_Base
    - |6 k5 B; g, s( o! T! X# q
  963.   #--------------------------------------------------------------------------
    2 ^% z! i% U( D1 g0 m# L
  964.   # ● 处理数值的输入(覆盖原方法)" H$ ~) |* Z  s7 [! e$ w0 a
  965.   #--------------------------------------------------------------------------& X. m( L7 O3 ^2 I
  966.   def input_number
    $ L) V4 w4 w% z
  967.     @number_window.start: U, M# _0 H% v' p- t* d
  968.     Fiber.yield while @number_window.extra_window.active
    ( j0 V  C3 Q2 v4 i
  969.   end
    9 a: S" ?" G- }% A3 V
  970. end
    / n& h8 y5 w8 Q0 l
  971. 6 Y; H# ^: H. i5 i. u0 F9 e
  972. #==============================================================================  b1 w! |) b$ d; o" ^8 e
  973. # ■ Window_PartyCommand/ w3 l+ V( T; g+ g
  974. #------------------------------------------------------------------------------
    ' l" `1 A0 \+ g0 m/ C
  975. #  战斗画面中,选择“战斗/撤退”的窗口。
    % I' y) O! {. |7 h% g: L
  976. #==============================================================================" A" v0 X% ~2 g5 Q$ l; R' L
  977. class Window_PartyCommand  Window_Command
    " x5 \& n. Y! L! n) \1 t
  978.   #--------------------------------------------------------------------------. {; x; W/ x6 G" v
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    * n( F5 i* C- B* v
  980.   #--------------------------------------------------------------------------1 G( b6 Y* r% k
  981.   def set_mouse_pos9 U8 [$ v3 F0 t5 }! w# ?7 N
  982.     if viewport.nil
    : k) T( {( @3 B3 ]
  983.       vp_x, vp_y = 0, 0
      r5 I/ r  s1 l: f; o: d
  984.     else
    % }  i9 i; D: x6 e! y* {
  985.       #vp_x = viewport.rect.x - viewport.ox
    - H' |7 a0 m+ g" f
  986.       vp_y = viewport.rect.y - viewport.oy
    4 s5 ]6 ^  f1 M
  987.     end7 p+ T. {% ^! G( a4 e
  988.     item_x1 = x + standard_padding
    0 d- a1 d/ b. S3 f
  989.     item_y1 = vp_y + y + standard_padding
    8 T/ w: n( A5 b$ |- q
  990.     get_index = @index  0  0  @index ) b8 R: N2 _. H* `
  991.     row = get_index  col_max - top_row% F  G  L. U8 @9 I1 ]5 \& t
  992.     col = get_index % col_max, F3 e5 W/ F. W' V7 x
  993.     new_x = item_x1 + item_width  (col + 0.5)$ o  n8 R( G7 t; ?7 ?5 h: H
  994.     new_y = item_y1 + item_height  (row + 0.5)0 p9 E- h: M! H- i4 ~% J
  995.     Mouse.set_mouse_pos(new_x, new_y)
    0 _) B5 k4 f! Y0 n, y' H
  996.   end: Q* m# W" Y- X
  997. end
    4 m* Z. S) z) s8 N0 d

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

  2241. 5 N  i" o" V0 _* Q5 W7 D
  2242. #==============================================================================: @3 B% u$ ^; P# k4 c4 E3 i
  2243. # ■ Scene_Map
    1 Q9 N/ u% A8 {+ s8 D4 N& {; O
  2244. #------------------------------------------------------------------------------
    : J$ a( N0 b& R! G' }( g
  2245. #  地图画面
    ' f6 g; W1 P* n+ t% M
  2246. #==============================================================================
    & V4 O8 T/ j* ^
  2247. class Scene_Map  Scene_Base
    0 \& P! I$ C' v' d
  2248.   #--------------------------------------------------------------------------1 m8 g9 J$ A3 B
  2249.   # ● 画面更新
    6 h8 m1 ?# }6 @
  2250.   #--------------------------------------------------------------------------8 E2 c+ Q9 J& x
  2251.   alias sion_mouse_update_scene update_scene$ |! l( J2 B) V# |( Y
  2252.   def update_scene$ O! W$ v7 M' a9 [* j  L5 I
  2253.     sion_mouse_update_scene
    6 A2 Q- S' W* z9 W9 W
  2254.     update_mouse_action unless scene_changing1 ]' U, _7 M7 M  I. j$ M' O6 b3 V
  2255.   end
    9 d2 f$ k2 {6 j* L8 f  L/ c
  2256.   #--------------------------------------------------------------------------1 J/ i$ F+ M6 k9 D* {
  2257.   # ● 场所移动前的处理/ s% J8 S# `" p7 G1 v' U
  2258.   #--------------------------------------------------------------------------+ s7 e  H& N' [0 T5 y' W$ e% |* C
  2259.   alias sion_mouse_pre_transfer pre_transfer0 ?0 Z3 J  r" B& t% T
  2260.   def pre_transfer; H+ Z. v) n9 m0 ]% ^& P4 D
  2261.     $game_player.reset_move_path
    " d) H2 z# r, ~( _; m
  2262.     sion_mouse_pre_transfer
    # z: C" D) l! w: p% e. R
  2263.   end
    ' K5 f$ z4 X" v# D( O8 Z2 t
  2264.   #--------------------------------------------------------------------------
    ; M! W7 J! N7 M7 b3 U# n. Y
  2265.   # ● 监听鼠标左键的按下
    # s$ }) c) [0 v) c" s" X
  2266.   #--------------------------------------------------------------------------
    " Z% z: G' a: `& n7 E# F1 {2 P
  2267.   def update_mouse_action, Z9 x& u" f) G
  2268.     $game_player.left_button_action if Mouse.press(0x01)2 c! l$ B3 t, r$ B7 x. N
  2269.   end
    , Y, h1 j8 n2 v
  2270. end; ~# r5 l3 Z: k; u( {( \
  2271. - R3 U0 M- I' H
  2272. #==============================================================================" M! [8 j( w& O7 A6 I7 h$ o% I3 R
  2273. # ■ Scene_File5 k8 K! ?7 H( O8 \
  2274. #------------------------------------------------------------------------------
    % I. Z, W% A! X
  2275. #  存档画面和读档画面共同的父类7 `, s9 p' x3 Y2 q3 S. V
  2276. #==============================================================================! @- L3 m$ m" E: n# I0 |
  2277. class Scene_File  Scene_MenuBase
    8 e4 S: a9 I' |' {+ x" T
  2278.   #--------------------------------------------------------------------------
      J2 |- c+ P$ M, A2 t' f
  2279.   # ● 开始处理
    2 \* [, P# J. H" c* y% E
  2280.   #--------------------------------------------------------------------------
    * m: g/ d0 a0 u
  2281.   alias sion_mouse_start start
    / f' q0 x) H. ^% u4 C
  2282.   def start9 m: D4 K5 ^. d) y* |
  2283.     sion_mouse_start
    % A: Y- S7 R1 @0 |( N
  2284.     @move_state = 0
    8 f. ~  {# t* M" D1 V
  2285.     set_mouse_pos% C1 j8 R6 F! c1 A$ w. s
  2286.   end
    : v3 l- \* g6 J: N: E. I
  2287.   #--------------------------------------------------------------------------
    & a+ p, {, ?9 H( g4 V
  2288.   # ● 更新画面. @" `: \9 U& F; J  X
  2289.   #--------------------------------------------------------------------------/ B2 C) h" ~( i
  2290.   alias sion_mouse_update update! k+ t9 w  `% H! ~
  2291.   def update
    * j8 G/ I* B; \1 V# o
  2292.     sion_mouse_update
    4 y- D6 y0 H0 n
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos) q+ J8 C1 _9 @" ~! q# `% K
  2294.   end
    ( q% }9 {( V, n/ n4 @+ y
  2295.   #--------------------------------------------------------------------------4 {1 z$ a2 }. \
  2296.   # ● 更新光标
    2 }8 N; A0 n' b; j
  2297.   #--------------------------------------------------------------------------
    $ j) O8 `+ I: |/ O' D) e: A5 S# W& i
  2298.   def set_cursor
    6 K1 U' N# N; ?! N" |. W
  2299.     @move_state += 19 d4 W3 w5 I; F9 S# W4 r. X8 b9 }) g
  2300.     last_index = @index
    2 c- J! ?/ A: o; k' \$ W
  2301.     if mouse_which_window == -23 T' Q7 @! t3 {; q- v
  2302.       if (@move_state - 1) % 6 == 0
    , ^% R9 J8 V) ^. _2 V% L
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1
    3 N1 i$ Y! ?, {: \4 k
  2304.       end
    7 o+ j& Q& W# S0 b: S
  2305.     elsif mouse_which_window == -1
    7 I1 _3 S& L# v5 M8 R
  2306.       if (@move_state - 1) % 6 == 0
    0 ~2 [  K: Q* v  T( Y6 w& }
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    9 M3 @) w/ v7 u) {
  2308.       end
    , c" t0 H1 o" Q9 W1 X
  2309.     else1 J! {. R' Z6 h
  2310.       @move_state = 0$ @( K& h( c4 f& k" D
  2311.       @index = top_index + mouse_which_window
    ) ?% _8 V' P. V! F( G+ n
  2312.     end( |0 C( X; \5 d4 b( D9 c
  2313.     ensure_cursor_visible
    # F7 ^- ^3 s+ x. ?( P
  2314.     if @index != last_index" f5 z8 T3 m" p1 w
  2315.       @savefile_windows[last_index].selected = false, X4 J, z1 `8 \, y/ v: g# D6 A
  2316.       @savefile_windows[@index].selected = true
    1 |* M9 ]# c% M0 m
  2317.     end
    3 q( W2 B( S3 R* l8 `: G
  2318.   end
    9 J; v( e4 C1 B: V( t# }
  2319.   #--------------------------------------------------------------------------
      }6 K0 R6 v+ D  ?4 T3 x9 o
  2320.   # ● 判断鼠标位于哪个窗口5 g) p- j% @6 I2 S6 ?. m2 X
  2321.   #--------------------------------------------------------------------------1 Q0 J& C0 J5 s2 G( i! Q
  2322.   def mouse_which_window
    & {2 n- O4 ~" \9 w: a$ c1 O
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    0 ?! z$ p" `3 r0 Q: ?( s, k, Z
  2324.     if mouse_y  @help_window.height + 14
    . Y. x& }+ ?1 Z7 z; i
  2325.       mouse_row = -1
    $ v; g7 a* C! z! [
  2326.     elsif mouse_y  Graphics.height - 14) M) V. E" |7 S8 Y3 q* e4 M
  2327.       mouse_row = -2! h, i3 b9 N9 e' Y' I9 p  \
  2328.     else
    # ^8 w: g9 q3 T* i* i4 E9 N  r
  2329.       mouse_row = 4  (mouse_y - @help_window.height) % o1 b- ^: X0 Y$ a
  2330.         (Graphics.height - @help_window.height)$ q; }: a& \' k5 b3 }# S! @6 d. J* N
  2331.     end
    ' g8 ]+ x7 S- I. b* U. b  M
  2332.     return mouse_row
    / Q) ^0 H  n; D+ X7 M8 r
  2333.   end" X6 ~- m5 d: A5 i( U! g+ X
  2334.   #--------------------------------------------------------------------------
    * @% a; R& W" C
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    0 r4 B: Q. x: G# v6 I
  2336.   #--------------------------------------------------------------------------+ M) [+ ~& K2 j5 t) M, K& g: ]# A
  2337.   def set_mouse_pos
    4 ?9 }0 y: V8 Q$ [
  2338.     new_x = 40
    0 w! O, s3 z8 K3 f" P( Y, a. R
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    - B% [& R$ E7 u; f* j7 c/ ^- X
  2340.     Mouse.set_mouse_pos(new_x, new_y)* w2 Q: Q0 \+ d1 J: o' W! k4 U/ h4 l
  2341.   end7 K9 e! R  a# K- ?8 ]: s! u
  2342. end/ n+ p5 a5 H. L9 O# F( _

  2343. 5 w4 x' w; \2 T8 g% d
  2344. #==============================================================================
    * P/ G% f6 l8 t  A8 P. K. k% D) G
  2345. # ■ Game_Event7 t" v4 @- o. y8 C  ]# v4 ^
  2346. #------------------------------------------------------------------------------' H$ e1 m3 F2 _- p
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。+ P1 ]' b" g, b5 N8 A
  2348. #   在 Game_Map 类的内部使用。
    3 S0 i- a. W" a3 k0 n4 P" g& V
  2349. #==============================================================================' d# n" z% K7 p
  2350. class Game_Event  Game_Character
      x+ w/ R0 f* z2 R, w! f
  2351.   #--------------------------------------------------------------------------
    " n# [  ^& g# F9 k
  2352.   # ● 事件启动
      a8 r0 V6 Y* z6 }: I( j
  2353.   #--------------------------------------------------------------------------
    / ?0 f( @9 R2 Q/ J% g
  2354.   alias sion_mouse_start start
    4 g  [8 D1 J) c; i4 R
  2355.   def start; C0 M& z; X5 r9 Y# }% u
  2356.     return if mouse_start && !Mouse.press(0x01)
    * q1 V2 l5 ]% y8 _7 d
  2357.     sion_mouse_start
    ! O! l! r5 c7 V1 ~5 N' f
  2358.   end& B, ?; ?0 D/ I$ ]
  2359.   #--------------------------------------------------------------------------
    - n" }  X% _, r5 G! y; l! f- b* k
  2360.   # ● 判断事件是否由鼠标启动
    2 Z4 W2 S/ a% A2 {
  2361.   #--------------------------------------------------------------------------
    - _( f3 c1 f) v# r
  2362.   def mouse_start0 s" G  I  C: B, f& j: v! S
  2363.     return false if empty" u0 V$ w. I4 @( E# N3 O1 H: c
  2364.     @list.each do index0 D' e  D/ _' ~
  2365.       return true if (index.code == 108  index.code == 408) &&) s' y7 `* b& y( U" l+ ?# Y
  2366.         index.parameters[0].include('鼠标启动')
    - {# ~0 s+ u* G( `! V" Z
  2367.     end
    / {0 }: g& J) V, A
  2368.     return false
    2 w5 t! F! ]- c' P% M
  2369.   end* E9 h' W- I6 z; u1 k& M* k' ]
  2370. end
    . b4 ]: N, P( F: ?

  2371.   L4 [+ R8 a0 f  F* P2 k
  2372. ####泥煤的height" U2 T5 ~7 F; F
  2373. # @height = height
    6 a: W) {" s9 {. k- y% M
  2374. 9 Z' H5 L: U! r9 b: n/ ~
  2375. class Area_Response
    4 {- R8 Y$ c! e/ u, b
  2376.   attr_accessor type2 L1 ?2 E* Y; r6 P8 |
  2377.   attr_reader ox/ J& q' M  p- ]; i1 E* c
  2378.   attr_reader oy
    . T0 J8 u- c0 c
  2379.   attr_reader width
    ; ?6 F; L3 Y& Q3 y9 i) B
  2380.   attr_reader height$ I" r9 I" i. \! l
  2381.   attr_reader switch_id
    9 _! r0 R& U/ D8 l/ g$ }) K
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)
    % o' j, R+ q4 k
  2383.     @type = type
    2 ]( A  B* R8 v. n8 j
  2384.     @ox = ox
    : ]7 Z- W. |* X' {, @
  2385.     @oy = oy
    + w; w; u1 ?# H  }* h7 Y! Z1 ]
  2386.     @width = width
    ( G* b, X' h. ?
  2387.     @height = height0 q: Y) ]8 b# h  y
  2388.     @switch_id = switch_id' [* F' h  P0 F; f0 g
  2389.   end
    & |" j5 ]  A4 k& [# Z' b
  2390. end: e) k: T! d4 ]& B' w) F8 l9 t
  2391. 9 b9 |8 `  k1 Z$ v" f
  2392. $area_responses = []
    $ \% v, p) D! C5 R

  2393. 8 l' o. ^& D: n5 t7 j1 [& v
  2394. class Scene_Map
    + W& h9 v* s" @
  2395.   alias update_mouse_2013421 update_mouse_action
    # o" ]2 `/ ?7 ?: @# `! d* p0 k
  2396.   def update_mouse_action/ {2 ^% ?9 X( W, J% f0 @
  2397.     update_area_response9 K6 o2 j/ Y$ \' K0 k, H0 L
  2398.     update_mouse_2013421
    4 v, n, T2 [7 r1 Y
  2399.   end
    ; @9 E0 ~# q* P6 W# K8 g* ]. u+ S3 a
  2400.   def update_area_response
    ( I0 y5 m" o1 X& C8 W5 @
  2401.     responses = $area_responses
    0 N; M6 N8 L1 r
  2402.     responses.each {response
    ; P& f+ V; _1 Y) {6 }2 k; @0 p
  2403.       ox = response.ox
    $ d* m; [. U0 @2 x1 ?  n3 T& }7 p; J
  2404.       oy = response.oy
    0 s7 z3 K% t6 z4 O" v; T
  2405.       width = response.width4 ?; L# q9 {- ?: g: ^/ o. {
  2406.       height = response.height
      g5 n7 W: S9 b" M, ~
  2407.       switch_id = response.switch_id
    3 P& Y8 v4 V' C( V  W" Q
  2408.       case response.type6 w0 M9 l( C. O1 D2 O/ r
  2409.       when 05 D; T1 B. R* o# u6 `
  2410.         if mouse_in_area(ox, oy, width, height)
    * b0 @, ~1 S' e9 G- l' A/ y5 d
  2411.           $game_switches[switch_id] = true! R  @6 c$ ]& Z! h, M; ?# \
  2412.           $area_responses.delete(response)
    " z  O& l$ `+ F8 J& O, n" H4 b
  2413.         end
    & B2 n6 o$ u! q6 G& V/ F
  2414.       when 1
    " p; w) e8 A5 L- N$ l* m
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)3 A0 N) x. Z& A. ?. a
  2416.           $game_switches[switch_id] = true
    7 x$ W7 h2 x( a! S6 t, {
  2417.           $area_responses.delete(response)
    ! S; ~7 _6 p; c, f+ }
  2418.         end8 k7 T7 w4 ?; o) g+ U0 B
  2419.       when 24 l( ~/ t4 \8 E' |" f( v& ]
  2420.         if mouse_in_area(ox, oy, width, height)
    4 M6 u' x4 y' Q/ t
  2421.           $game_switches[switch_id] = true
    4 _# N9 R0 s5 h' h9 E
  2422.         else* ?& ^0 p6 n4 f$ {  F# {% F
  2423.           $game_switches[switch_id] = false5 ], n" P0 x, v
  2424.         end
    - H0 g8 w2 S1 z
  2425.       when 31 P5 u1 ~/ K/ H+ u! G7 i
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,/ Q3 r( x; D9 f) S$ E% z
  2427.             (oy - $game_map.display_y)  32, width, height)
    * r- y% j* t" c3 @$ S5 G& P3 \( f
  2428.           $game_map.events_xy(ox, oy).each {event
    2 d1 L1 Y% ?5 T1 {- d" I. |
  2429.           event.start
    7 J  X* Q- n) }3 J
  2430.           $area_responses.delete(response)  s8 r8 `, ]1 ?. g% n2 z2 s: f) ~
  2431.           return
    0 y: N4 n# j* ~! I( P3 a
  2432.           }
    ( n) f/ L0 G- i  C+ |
  2433.         end+ {' U; y4 E1 j& u, s& Z  j* p: u, l
  2434.       when 40 R8 P+ C8 ?3 {/ V
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,
    ! @5 w: w4 p% i, c3 r2 y
  2436.             (oy - $game_map.display_y)  32, width, height)
    + ]- x& L: y/ r; L; _
  2437.           $game_map.events_xy(ox, oy).each {event1 h- m0 K. F' B
  2438.             event.start: e4 C& I. e0 O) f7 w/ f% C( A: Y
  2439.             return$ n- l  N8 g* |7 \; n- G7 W+ R+ V
  2440.           } * j4 R" C8 Q% _6 @
  2441.         end
    1 p% n: u6 f2 Y/ X2 a
  2442.       end
      E2 {! q/ @3 n, I& m8 y
  2443.     }! S/ q# U  ~2 q5 a  `) K4 L- w- K% K
  2444.   end: h3 _9 @0 y# X" z' O& K0 i3 m
  2445.   def mouse_in_area(ox, oy, width, height)
    # \" Q: l4 n: N; s: ?
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&
      ]) Q  M1 H/ f6 Q
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height
    1 q$ r6 e* s9 z! |
  2448.   end4 ^3 B2 {; a  ~. Q
  2449. end1 j' E/ Q+ t, H' F8 P
  2450. class Game_Interpreter
    " S) O( p! G$ `1 Z4 s
  2451.   def area_response(arg)
    : A% x0 `! Y" q5 j( p# `$ |
  2452.     $area_responses.push(Area_Response.new(arg)), U" y- k( v7 O; v
  2453.   end
    ; k$ F* P) L2 g" p
  2454. end
    6 ^9 p  U4 Y( [  `& k
复制代码

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

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

GMT+8, 2026-6-5 09:04

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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