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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    " Y0 M+ I! e$ [+ k, U
  2. 7 N% b8 w# j5 r9 e% c9 W* z3 a
  3.   Sion Mouse System v1.3e
    " S, T( c7 L! F" K2 p/ ]9 N
  4.   9 Q$ W/ I% `2 q4 S7 c& x
  5.   Changlog
    * d* L2 a! ~) C( L8 G
  6.   2 U5 P* h9 \$ G
  7.   2013.4.21 v1.3f
    $ I% e/ {0 l4 b1 B2 A# D& C
  8.    
    # d- F6 x. R  V: s+ t7 M
  9.     1.3f 卷动地图 bug 修正
    . A: g- Z3 ^' v' s- L6 Y2 e5 N: K
  10.       O0 M- _  B' ?; I( r6 j& c% W* X
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口2 E& ^! n2 x1 d; O# X4 m3 a
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内9 h. E; z9 I: c4 h3 m; n
  13.                               Mouse.unlock_mouse_in_screen 解除锁定
    5 f+ J* W! \; C, [! z  @% p1 |

  14. + M9 \, [  |# N+ S) U* t
  15.     1.3f bug修正4 m: B; m1 l6 a4 A! Z
  16.   - U. w' z# V9 l4 a
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及
    ! h# s# k( y! ^9 A( p/ w' V5 q# z
  18.           关闭菜单时,鼠标是否移动到原来的位置。
    ' e* s8 Q, X* R/ I7 {
  19. $ M9 ~5 @  V# F8 @) k
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处
    % T/ A. m) e0 C' \- C( T

  21. ' D' k' L0 K5 B, C# a
  22.     1.3b 修正一些罕见的bug;9 \) I( E/ ]! M0 x+ ]  L

  23. 0 Q2 n* P/ G- n. ^4 D. Y
  24.     1.3a 代码小修改;
    7 G( F, X. K$ ~* x& t( d/ c
  25.           加入了鼠标点击启动事件的功能,5 M8 G% O/ ]. Q# d; e
  26.           在事件中加入“注释”: 鼠标启动  ,( `+ N" p7 v3 u3 M/ M  H1 M
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    8 }7 \: A2 l7 s  j  g
  28.   
    ' k9 U& l% `( {# O5 [
  29.   2013.2.12 v1.27 z) r0 s  q- m0 s( w7 j! g

  30.   ^- l1 m" {9 U, u
  31.     寻路逻辑优化;
    4 Y2 W- S* {/ f, O
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;1 m+ U  J$ A( K! w3 C( h- f+ M
  33.     现在支持用鼠标来操作载具了。; y- f1 g9 p# C: S, V. Z3 p! ^% X
  34. & l2 N  b. Q+ V- T* [
  35.   2013.2.8 v1.1
    6 X$ i5 l: t; m! X1 S- M5 D! N
  36. $ j  b! u) @& i$ h; p
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    5 _7 L% U- M5 w) G) m# y2 X5 x
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;
    ' ]9 U, D* y4 V2 S# M
  39.     移动时,路径指示点的绘制更加稳定;
    1 ~/ w: J  H3 q* T# k8 `
  40.     现在支持默认存档画面的鼠标操作了。
    % H8 X& ^5 |( a' m% l% B; a8 w7 @

  41. ) L2 c9 k) R, B2 ^! G

  42. 1 K! Q: e+ e9 M0 q3 q
  43.   OrigenVersion
    7 Z% N! G( z% H+ W2 S8 N* A
  44.   9 p/ V8 C) Y+ M9 g" q9 Y. y
  45.     2013.2.7 v1.0 ) [. b% s+ @; D1 A  x

  46. + G5 ], g9 M% c+ K8 Y. M
  47.   主要功能! m4 b3 ]7 r- R/ w3 V$ M

  48. . T$ W1 K  L; v' C# J( ^
  49.       使用鼠标进行各种操作...1 A6 J7 [$ v5 o) T
  50.       将鼠标锁定在游戏窗口内
    2 [7 Z/ M8 i2 u/ _, I
  51.       自动寻路,按住 D 键可以扩大寻路的范围) H* w1 y" q3 y6 j
  52.       双击鼠标进行冲刺  V1 y2 l5 v, _& [" Y( q" p
  53.       更改地图卷动方式以适应鼠标移动1 G- y: D7 T; K- i- d2 t& V
  54.       变量输入框改良
    : o: o. V) l9 j

  55. + e' p& _0 u  t( Z
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹
    # X) Y; Z) u+ r, v/ f! ]
  57. ; K; R) R3 J9 K; c2 \$ y
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹  T! j0 b' Z& E* J( O1 J. @6 t
  59. 2 }0 R& B: H! `) y
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    % C- Q6 E( s% C" G; ?1 o
  61.   Z3 z  a  m) s& t

  62.   V% i& f; R9 i7 S9 ^
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★7 c! ^6 F8 e& y+ k2 h% V% G: i
  64. 3 L, O, O- b0 z# N4 p/ |: j
  65. ' l2 H# y5 S/ Z8 ?
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示9 o* }, G6 ^1 a/ \
  67. - j# d! q! y0 |
  68. #==============================================================================
    7 m3 _/ R; W5 L: X5 Q- O! g& a  R
  69. # ■ 常数设置 * A- e% L- M; z
  70. #==============================================================================
    , r% C' L  c8 l2 ?1 P0 ~. i
  71. module KsOfSion
    # A) C9 w, r+ j% m" m; S, T3 m- v
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false+ U! t4 N% X7 l2 ~2 `1 x  K
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑' @: P3 Q/ ~) r- [: F
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false: `: r& k% ~) q; R
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量+ g" W9 `3 ?2 ^) X! k6 t, n3 G1 h. t- \
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    * h) n# h- O" ]1 P" S- U1 m9 {' l
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧7 J" V- c$ ^; u! u  \5 O9 B
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)8 M, [' t2 b* K
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键7 E: m$ {/ K4 w6 C2 C+ P
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)
      j  T4 |1 |: R0 ^: L' ~, G
  81. end: }2 Z* j; ^0 \- u" |! u% w
  82. ! |" Y/ e2 i8 R* I! j: B3 I
  83. #==============================================================================
    ) Y& O1 b4 ]/ L; \3 _, E
  84. # ■ 用来显示路径点的类
    % R3 @+ s: ]! ^& i
  85. #==============================================================================0 m4 @$ R/ o7 L
  86. class Move_Sign  Game_Character
    % l) q. a- K$ Y9 l/ B4 S
  87.   #--------------------------------------------------------------------------
    1 L. b, ?, I% ~" ], e* T; A& C2 m# l
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图; g" |; `4 o& c; k+ E5 g
  89.   #--------------------------------------------------------------------------
    % w6 {' |& Y/ r( A% s
  90.   def init_public_members- x* x; U* C  C6 M( G
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹* a, s$ y. f) k% {8 P
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    / r) [9 f+ A" n6 Z/ A
  93.     @move_speed      = 5        # ★ 踏步速度
    . G% K' Y: V! j1 [  B  h6 _
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    / M9 k1 n- K& l* L
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度1 x. }/ Z( S& S- H
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)
    3 S: P9 E+ z1 j$ ~
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列1 B, Y. c$ p! x1 z
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)
    $ I" i. l4 I6 e+ f  W1 A

  99. 1 b* }+ Z2 i) g; E/ A) P: y

  100. 9 f! G1 d9 }1 i  `! u- P7 \
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★
    3 |; O' S3 q% l- h- e% K8 }

  102. ; k+ K, E; A5 Q/ q
  103. 4 `8 P$ t4 x& y$ ~7 x
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
    ; A/ ?1 L/ s! ?5 q% J# k* ]1 P- Y
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')+ }; M8 ?4 t# ^9 w7 z( }$ h4 U

  106. ( L" S$ g$ v. A4 L0 a# y
  107.       if $no_arrowpic_warn4 @8 o: d" d" p
  108.         MouseShow_Cursor.call(1)
    : V5 s& z. [1 K5 W; a6 {$ U( u
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png- J2 R) B. N- N+ \+ h1 r0 q
  110. % a! y! u* Q# Q9 G8 a& R
  111. “路径指示点”将使用游戏自带图片
    3 \, Y% I. R& j( q

  112. 4 o* l( V/ f+ h! J* ?& U; r1 o8 s7 H
  113. 该提示可以在脚本内关闭')
    ! ~. a6 j9 k0 }" |8 k9 s
  114.         MouseShow_Cursor.call(0)
    * a. u2 y; p2 o
  115.         $no_arrowpic_warn = false
    4 ^, r% \7 r( Y4 r) f% _
  116.       end/ _$ ~7 ~2 [$ ?( ~2 D% L+ U# j
  117.       @character_name  = '!Flame'/ ?" {1 [( q  h) D3 `/ K* }, [7 {% @
  118.       @character_index = 65 d$ O. I# b* u
  119. 0 _( A& [( E: X' v
  120.     end+ p7 \* F8 _) }* h
  121.     @direction_fix = false  # 固定朝向3 M9 d5 |" S% a! I4 x# S/ v
  122.     @move_frequency = 6     # 移动频率1 \. |& P6 J, @" R. o& d
  123.     @walk_anime = true      # 步行动画, X5 y8 y+ k. P' K7 K/ m% t
  124.     @pattern = 1            # 图案0 O* K+ |9 A$ i. W5 T1 S
  125.     @through = true         # 穿透
    : {4 ?0 x4 i4 ?
  126.     @bush_depth = 0         # 草木深度
    ) M! F$ ^" b: u" V5 v
  127.     @animation_id = 0       # 动画 ID
    8 K0 s& ~3 I4 O0 S- V$ J
  128.     @balloon_id = 0         # 心情 ID8 {9 j2 T! R! q3 |# e
  129.     @transparent = true     # 透明2 N) I) a2 a6 ^8 [6 L
  130.     @id = 0
    ! S: ]  F. I$ |; T) w  q+ `
  131.     @x = 0
    ( r& m; M/ Y3 n3 X
  132.     @y = 0
    / }) J, M2 P$ X+ t7 B/ q
  133.     @real_x = 0$ @& P# R; q$ N- J) v
  134.     @real_y = 0
    ( }' L# z' a  `
  135.     @tile_id = 05 i# [+ Z* E% }9 K" x( A
  136.   end
    ) ^0 T# U/ n/ a% ~; Y' m
  137.   #--------------------------------------------------------------------------
    , \7 O7 \0 s4 G
  138.   # ● 定义实例变量3 m1 E/ \6 k6 q4 O3 b  H
  139.   #--------------------------------------------------------------------------
    % R! S0 v7 U: [
  140.   attr_accessor direction
    . Q9 C4 y. g% ?3 t; U
  141. end1 ?: x) R) m8 x: c! Y8 L

  142. ' g3 Q& g2 Q( C: p3 _
  143. #==============================================================================1 H4 t- M/ u% j2 X7 m, G
  144. # ■ Module Mouse5 t3 p; P9 h' w" k: C
  145. #==============================================================================6 x+ }2 v# {0 r7 G2 h9 w/ Q; o5 P! n
  146. module Mouse
    " V& @' w: N# l- n+ |
  147.   #--------------------------------------------------------------------------
    0 q3 l4 }" V) B/ R8 ?0 J
  148.   # ● API
    2 F! `5 l% d7 H7 w- s+ m+ n
  149.   #--------------------------------------------------------------------------
    % G' {. o! h$ P& l' A
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
    + ?0 t$ x+ K( ^4 \. I% J
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')$ z  P) L$ P* l8 m* \0 l: ]
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')
    " K6 D- m( `0 i) T3 t  S( b
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')
    / |- i. D- Y' I" p
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    9 Y% k6 b; t/ _' f3 }) ]
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')% g( m8 j% [0 `! ~) r& W: ]0 O
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')
    0 c* h7 h# b3 C$ h3 d9 H
  157.   Window_Hwnd       = Get_Active_Window.call
    8 ^/ b) W9 k6 s* K2 V
  158. ) A3 I  ]0 I- r  `1 T- `
  159. class  self
    8 |& @0 W/ T; D; k. z
  160.   #--------------------------------------------------------------------------2 P5 x3 u: q  X2 s
  161.   # ● 初始化
    ) s& Y7 S, T- s& i& g
  162.   #--------------------------------------------------------------------------* ]; O6 d# w+ B5 Y  {* C9 D" I
  163.   def init% h7 G2 ], d+ o$ ~
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor* e' ^$ G4 @2 c0 j
  165.     @left_state = 0  u# ?7 }" _* w5 ^# S8 \' G& D
  166.     @right_state = 08 p1 b$ q( r( L
  167.     @ck_count = 0 # 帧数计,单击以后从0开始
    2 p! g4 R( X+ }) _' O) @
  168.     @dk_count = 0 # 用于双击的判定
      ^: p; `' }. c! d7 S/ j# I5 M
  169.     @clicked = false
    8 L2 J  a, z( M/ T! L
  170.     creat_mouse_sprite
    , n4 B. i$ O! L; r( W% i! V6 Y
  171.     update
    # O  Z! J  `) m6 B1 S0 ~
  172.   end% S9 }( u( C! N
  173.   #--------------------------------------------------------------------------
    : D2 U8 i  f& o" Y2 V2 h
  174.   # ● 鼠标指针精灵
    6 j- p- }5 G2 C7 [2 f* E$ e
  175.   #--------------------------------------------------------------------------
    7 c6 d6 x7 q# N. m
  176. #~   def creat_mouse_sprite
    8 _- T; ?- L7 g2 u8 l: a! f
  177. #~     ' ?! O+ C& q  O
  178. #~       @mouse_sprite = Sprite.new
    5 a4 [: }& C; k, h9 i3 _8 A& F  Z; d+ ?
  179. #~       panda = 2#rand(2)+1+ v5 I! k2 K) o2 [4 L
  180. $ H1 K. h+ v5 {6 H. ?$ H3 Z
  181. #~      if panda = 1, D8 X  d7 I  |/ ]3 M1 i: y
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    6 F9 C& {# I! W
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    # y. z( r" }2 T! d* P% l" ?
  184. #~        end#with if File.exist
    : c9 M5 W( c( M. [* ]
  185. #~   
      I$ T: d7 C0 r1 B( R
  186. #~     else if panda = 2 #with if panda=15 M" K% j( P9 u6 Y  P0 H5 r/ \% U
  187. #~      
    7 z* I: I7 o" X8 k: l1 {
  188. #~      if File.exist('GraphicsSystemCursor2.png')
    " A- f/ `: f2 V' u  w. ^4 \0 h
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')& Z/ n4 r; A1 Q
  190. #~      end#with if File.exist1 ]  E0 _! e7 t$ h
  191. #~      
    1 _- S% q: K  b2 |  h  m+ n
  192. #~     else #with if panda=1
    & @2 H& {4 O# _
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    % J- v1 M; [9 k
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),$ J" H+ r; o$ p2 f
  195. #~       Rect.new(5  24, 24  24, 24, 24)): e  C: i! E* J& {& c7 G
  196. #~     end#with if panda=1
    4 U% ~+ _/ |/ U; O. H# d/ u! L
  197. #~     6 {* ]' `; z% @& k/ E9 T6 s
  198. #~     #with def
    2 l4 n7 i; h1 J$ |- a, Q
  199. #~   end7 q: {* e2 \. W# r/ @" u" Q. J6 t
  200. def creat_mouse_sprite# k$ X- ^6 v2 N; U/ P
  201.     @mouse_sprite = Sprite.new: f3 m0 C7 ~! g4 F7 N7 K
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})" d, l  u2 v' j' P! i
  203.     @mouse_sprite.z = 9999* M( G; ?2 u! C. H
  204.     Show_Cursor.call(0)6 {4 d0 S# d- {0 j1 }" {3 y
  205. end7 R, ?6 k, G/ o3 p* P, ]  a

  206. , T# [: T. j% p6 S# M+ x2 O+ k
  207.   #--------------------------------------------------------------------------+ \5 _' z+ t1 B  H+ k" |2 P
  208.   # ● 更新
    ' u: l1 H+ d  X# V
  209.   #--------------------------------------------------------------------------
    6 s% D: u5 @1 w+ ]  V+ M4 s8 V7 H, p
  210.   def update
    . G) H6 I- V4 }9 l
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos2 E! Y4 Y% \1 y- M, p) [) s
  212.     left_state  = Get_Key_State.call(0x01)
    1 L  }- G: G& l
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0; ]+ ]" {4 g$ d
  214.     right_state = Get_Key_State.call(0x02)
    $ h) h2 D8 \1 D' o1 B% W) \
  215.     right_state[7] == 1  @right_state +=1  @right_state = 00 y4 T$ \5 s- l& A  b( _
  216.     update_double_click) w4 N/ g/ n% g: A( J  `! ^& a
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1, ~. z2 Z; u5 h/ ~0 h" k
  218.   end8 K: ~8 N7 [) x1 J' ?) k. Y
  219.   #--------------------------------------------------------------------------
    : ]: t/ @9 h" E" m5 C9 n
  220.   # ● 获取鼠标坐标
    , l  |7 R2 U9 g& W3 f+ Y* e( E. ?
  221.   #--------------------------------------------------------------------------
    ; D: }& K" q4 m' L
  222.   def get_mouse_pos8 [( f) D* t6 J) ~4 |7 k* v
  223.     arg = [0, 0].pack('ll')
    ' A7 u" ]" v# z3 L; `! Z# |
  224.     Get_Cursor_Pos.call(arg); d9 t$ M- _, }( d1 Q
  225.     Screen_To_Client.call(Window_Hwnd, arg)
    ' C5 Y& o6 M0 N7 n! F7 M0 Z: @$ I
  226.     x, y = arg.unpack('ll')
    5 @9 ?- h& w: ?: O) q0 ~/ G
  227.     return x, y. q4 t" R' j, }3 `  o3 P
  228.   end
    $ N4 g" A& ?( q4 [4 T% q( E
  229.   #--------------------------------------------------------------------------8 n, x7 Y# x+ F$ {# s/ A( p" I) M7 k
  230.   # ● 将鼠标固定在屏幕内
    1 p1 \) ]# e  M3 }0 |0 D: L
  231.   #--------------------------------------------------------------------------
    2 z# e. g0 }( O  R$ R
  232.   def lock_mouse_in_screen2 P( q! U/ u- T% ?, p1 i
  233.     arg = [0, 0].pack('ll'): ?& R0 R3 X" Z& V$ u
  234.     Screen_To_Client.call(Window_Hwnd, arg)* O9 @' ?6 v& F' K* X
  235.     x, y  = arg.unpack('ll')* m1 Z( I% t" ^7 T
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))
    1 h" M- b* N) C. g% P
  237.   end
    9 A: I' N" f; i# J$ A: N
  238.   #--------------------------------------------------------------------------
    & l$ B6 k4 V3 v$ j1 x5 B9 f
  239.   # ● 解除鼠标固定
    ; d: F- h6 ~0 D& v7 `1 m
  240.   #--------------------------------------------------------------------------+ n8 q! ]6 P1 `
  241.   def unlock_mouse_in_screen
    ' {' u$ d" q5 f
  242.     Clip_Cursor.call(0)! {4 ]1 Z1 _/ P; b. Y8 f
  243.   end
    + A1 e  I4 _1 ]( z( q" u7 p
  244.   #--------------------------------------------------------------------------
    3 ]0 Y' r' G- I9 v! V) l
  245.   # ● 鼠标双击判定& n$ F) ?0 J5 V& G8 Y
  246.   #--------------------------------------------------------------------------
    : p- u0 ^; G6 P- c5 z/ o# u% _' Y; }5 _
  247.   def update_double_click4 a; [4 N+ M/ W( y
  248.     @clicked = true if @left_state == 1
    " S1 I$ ^5 n$ k6 j$ T
  249.     if @dk_count  0 && @left_state == 14 ]' {4 \, o* I/ _/ w% Q# V# n! `
  250.       @dk_count = 0; @clicked = false
    . w/ Y3 i& }$ X* ?3 O7 F
  251.       return @double_click = true
    # `0 r" _1 M7 |5 \  K7 m+ N) }  @5 Q
  252.     elsif @clicked. q; }' Q8 F+ ?* x3 T- N  C6 J1 z
  253.       if @dk_count  KsOfSionDbclick_Frame
    - p/ q7 W. H2 l& Z, \; H
  254.         @dk_count += 13 j% h9 t9 m$ ?9 S# j& s2 n$ S; _
  255.       else
    ; ~; \2 Y9 b6 t' w9 x9 X
  256.         @dk_count = 0; @clicked = false* G/ r& ~/ @) X& O% T
  257.       end  q+ k. \& @6 i1 S  j. u; V3 V
  258.     end% [2 f1 ~/ W0 R9 O& o( h6 Q8 H) T' u
  259.     @double_click = false1 w! s7 ^( I* \& I6 y# X0 E9 H5 u
  260.   end  W# J2 D* z: J' y: U4 v
  261.   #--------------------------------------------------------------------------( ^5 I5 n9 b* ~# _# m
  262.   # ● 按键被按下就返回true; [/ d# Q, x) O) }  X  s" V- W
  263.   #--------------------------------------------------------------------------
    - M% i* r; g6 V8 L; n( p
  264.   def press(button)
    & c4 |7 b5 y8 j5 o# L& }
  265.     case button3 T1 [+ Y  |1 x5 x3 {0 O' w' B
  266.       when 0x01; return !@left_state.zero
    ; x6 C1 ]  N9 s0 l
  267.       when 0x02; return !@right_state.zero! u! v: @% L3 n5 `
  268.     end
    $ |6 g1 y3 C3 {! n
  269.     return false
    % P4 }5 J7 }; O- B( i) J3 h
  270.   end2 U5 Q- {' R4 n; T  \7 e
  271.   #--------------------------------------------------------------------------1 E% |% n' `( P) y+ ^
  272.   # ● 按键刚被按下则返回true
    ! \( {  g$ P4 B/ U) @/ }
  273.   #--------------------------------------------------------------------------
    1 V6 j5 o3 U4 J: R
  274.   def trigger(button)
    3 d; r- O8 k# F; ^' W
  275.     case button
    5 v0 J! P% t0 E) B' t& Z. W& {: e
  276.       when 0x01; return @left_state == 1
    : J" L9 d  I8 k2 X" n7 u
  277.       when 0x02; return @right_state == 1  ]# [0 }' j4 ~0 t* Y6 I& u4 X
  278.     end9 O. P# P2 S, P, a3 \# h- y9 T
  279.     return false
    $ V' z2 A+ H4 V/ u" x& [
  280.   end9 `$ |: Z! J$ a( B! c
  281.   #--------------------------------------------------------------------------1 z& r+ ?. f/ p0 ]! i  G- c
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    : k2 e% v* J6 K+ O" z  c
  283.   #--------------------------------------------------------------------------6 ~& v1 t2 }& w: X7 q& a8 C
  284.   def repeat(button)
    & _$ U6 [+ K. i4 F, t( D4 E* F
  285.     case button
    9 W4 Q/ Z/ ^  `* |9 X
  286.       when 0x01; return @left_state == 1
    8 @+ R4 s' i& g3 D0 F
  287.         (@left_state  22 && (@left_state % 6).zero)3 }5 Q5 a2 Z7 V9 ?. E
  288.       when 0x02; return @right_state == 1
    & _& i% R7 L- q- g1 }7 y- P- |
  289.         (@right_state  22 && (@right_state % 6).zero)
    # N5 ~  s6 U  h. {! h
  290.     end' L7 G/ T3 T( O
  291.     return false
    , `  d3 l8 O. C& b: h+ t' `
  292.   end& @3 d2 E1 d1 n" J$ l' p, b! I
  293.   #--------------------------------------------------------------------------
    " l6 P2 b- I" i/ s( S  c6 x* I  @
  294.   # ● 判断是否双击鼠标  `1 r5 g- e: h6 j& D# O) e$ t# m
  295.   #--------------------------------------------------------------------------! {5 _% b& }6 s; F/ P
  296.   def double_click- H9 {7 \( l% F0 |# l, Y+ ~# a
  297.     @double_click% M/ s9 V: b/ Z4 D; n- j
  298.   end- q, L) C% N( C7 c! \
  299.   #--------------------------------------------------------------------------
    , _7 {- e% p) p/ k
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)
    6 e" l8 g. O, ^
  301.   #--------------------------------------------------------------------------
    4 x, {& S: x  Q1 ]  B
  302.   def click_count
    9 S1 \# J  C$ j* _
  303.     @ck_count
    # ~( ^, z+ k1 G' q
  304.   end  X7 l8 P9 c! k0 {0 }  c
  305.   #--------------------------------------------------------------------------
    - V6 P+ C! ~2 C$ p  U4 c8 @
  306.   # ● 获取@left_state(按住左键每一帧+=1)4 R0 h! h9 H2 W
  307.   #--------------------------------------------------------------------------
    7 f  g$ m/ w' D0 J2 ?
  308.   def left_state
    " c$ S2 s: T, L( d6 j
  309.     @left_state
    " e. \9 U; X- ~
  310.   end
    5 A: I- U7 J& F4 S4 n
  311.   #--------------------------------------------------------------------------
    $ @' W+ Q- ]' k( k1 u4 W
  312.   # ● 获取鼠标的x坐标
    ( v4 l& s+ D- w
  313.   #--------------------------------------------------------------------------
    3 Y: m, N; e% B
  314.   def mouse_x* V1 q' h9 `* \
  315.     @mouse_sprite.x$ E: D' l" Q: y
  316.   end
    0 q5 D; L5 m8 D' b9 X" M0 t; j
  317.   #--------------------------------------------------------------------------* h/ k* M, ?8 a/ w# p( L
  318.   # ● 获取鼠标的y坐标
    4 r& z9 G; z4 k* h$ h
  319.   #--------------------------------------------------------------------------
    - b3 M/ @* N, v5 U: R
  320.   def mouse_y% s: h9 v* I0 ~! B, \# t
  321.     @mouse_sprite.y! z" G8 @$ T' I2 ^0 f) ^
  322.   end
    . _, X5 h1 K' E. b! f" J( Y
  323.   #--------------------------------------------------------------------------3 u7 p4 t! r- m* Q6 C/ Y
  324.   # ● 设置鼠标坐标
    ' y" X6 c& Z+ T
  325.   #--------------------------------------------------------------------------
      j) Y1 d6 j* r2 n
  326.   def set_mouse_pos(new_x, new_y)( n" M2 I& t$ ]1 A- ~+ N
  327.     arg = [0, 0].pack('ll')$ B, j6 k5 m5 Y) u4 Z
  328.     Screen_To_Client.call(Window_Hwnd, arg)
    ! ~0 B$ w5 ~% ~4 F( D  e
  329.     x, y  = arg.unpack('ll'): n. ~+ v4 U5 {- ~! T. G! R
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)  M$ _, \1 J' _6 G& W' L
  331.   end9 {. ?% s1 j+ ?5 |
  332. end #end of class  self
    ; d* r4 Q& ~" B6 @, m6 ~4 c: M
  333. $ N# M/ |7 T% S; ~- M3 H
  334. end+ v  t3 K/ `7 {9 l- G5 z: U/ `
  335. , S" i: b7 k8 K1 E6 H
  336. #==============================================================================" Q/ X2 q+ h$ F" `% l5 |
  337. # ■ SceneManager" W  R, |( P, A9 Y) j) @
  338. #==============================================================================. O, g0 o2 W" W/ \- D+ A
  339. class  SceneManager
    3 X4 L: N: D* `- ]- h. f& y' {! h/ D
  340.   #--------------------------------------------------------------------------' P% C2 y$ |: w: R
  341.   # ● alias
    ! N0 Y  G" j& K" E
  342.   #--------------------------------------------------------------------------! e  a2 }% l. o% ?2 |! j. U
  343.   unless self.method_defined(sion_mouse_run)
    # I+ X2 j/ E0 b# ?# {; z
  344.     alias_method sion_mouse_run, run
    / L  ^" E8 S$ o, ?) y6 n8 ?
  345.     alias_method sion_mouse_call, call
    * y, _( E0 v: k
  346.     alias_method sion_mouse_return, return
    ) J, Y8 s* \' p
  347.   end7 A! x6 ^8 w% g
  348.   #--------------------------------------------------------------------------5 C* i6 y; k5 y6 Y
  349.   # ● 运行
    $ I% f6 F9 E8 r; G, F  h, T
  350.   #--------------------------------------------------------------------------
    1 c' h; v" N  C- y2 O
  351.   def run0 T" H! d: }8 Z) l  e- T
  352.     Mouse.init0 k; r9 g& D5 b3 ?
  353.     sion_mouse_run
    / d8 t8 Z. C( }# Q0 F% |! Z9 X
  354.   end  u* f2 |0 |5 S9 M& o  `
  355.   #--------------------------------------------------------------------------
    % U/ ?5 D7 m. G; r# X
  356.   # ● 切换
    6 y3 Y0 E, i$ D: x
  357.   #--------------------------------------------------------------------------
    2 o0 e0 W1 S: Z. Z6 n( k; r' T
  358.   def call(scene_class)
    ' [% S7 ~2 e/ g, i
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)5 b. D9 V) F8 U  ~
  360.     sion_mouse_call(scene_class)
    ; _$ J# s) f9 n* x$ g  X- v
  361.   end
    # R+ Z9 Y& U. E) G) J2 U: N' M9 c0 i& u
  362.   #--------------------------------------------------------------------------- j4 N) |; B2 E2 M( M) [- V- R
  363.   # ● 返回到上一个场景3 N( X! I. ^- }/ v' n4 j% ^
  364.   #--------------------------------------------------------------------------
    8 J8 L* M8 w  D8 y5 t3 u
  365.   def return
    * G; B& k$ r0 U
  366.     sion_mouse_return
    ( N: b* d- [4 I
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&
    / s+ v, {. q& T4 k& r
  368.       @scene.instance_of(Scene_Map)2 S6 E! r5 H+ Z6 u+ ^
  369.   end
    7 p, Z- i* w! T/ ?+ W6 f& O. U5 Q4 J
  370. end- @! Q' @3 S, H# ?! [0 V

  371. & D; z+ W6 D* e* T$ U
  372. #==============================================================================
    9 o) d0 O* S/ T3 K
  373. # ■ Module Input) o. f9 x& q9 S! X1 ]6 E# Y
  374. #==============================================================================- {" O# j! r1 a( U* |/ M2 M! ]
  375. class  Input5 P; `% ?( n5 R, ~2 M
  376.   #--------------------------------------------------------------------------  g- |" _7 `) W! `& \" u! Y
  377.   # ● alias
    8 Z+ L+ |+ I7 V  G
  378.   #--------------------------------------------------------------------------
    7 c1 R+ t+ J( R4 z
  379.   unless self.method_defined(sion_mouse_update)1 J: D0 ?5 Q. [0 B7 f( F
  380.     alias_method sion_mouse_update,   update! Q& A& n6 g" h2 f0 Q& a
  381.     alias_method sion_mouse_press,   press
      P! B  d. L7 [; G# j; P3 H
  382.     alias_method sion_mouse_trigger, trigger
    0 B1 v5 o2 r  _6 E8 b+ e
  383.     alias_method sion_mouse_repeat,  repeat
    # J8 H8 ]( O  q0 ]& j( N" s
  384.   end4 b  L7 `2 Y$ W
  385.   #--------------------------------------------------------------------------
    ( w" l" q0 e& }5 U, w
  386.   # ● 更新鼠标
    & P4 `: w7 B: s. c$ F9 ~
  387.   #--------------------------------------------------------------------------, T& m- A# G1 n
  388.   def update
    3 J7 `0 q1 V- S* S7 C* c" l" A
  389.     Mouse.update/ p- |  P" o7 c) d; ?
  390.     sion_mouse_update7 @2 D% A' ?, [8 ~" T0 [
  391.   end# h; ?: k. Z. n. k
  392.   #--------------------------------------------------------------------------  Q; C  F& \' v& p* \& @
  393.   # ● 按键被按下就返回true0 M. s1 {2 Z7 M% [' v" P
  394.   #--------------------------------------------------------------------------
    9 l! W$ A+ i  W- k) v
  395.   def press(key)  @# M8 a- {; c
  396.     return true if sion_mouse_press(key)  W5 e! Z2 n( t) k
  397.     return Mouse.press(0x01) if key == C
    , M% i* E: u$ t
  398.     return Mouse.press(0x02) if key == B
    , h. v" j8 _) S
  399.     return false
    " L9 x- V# O4 L+ ~# c5 M: R2 i! ^
  400.   end. m) L6 t# m5 j- k: z6 L
  401.   #--------------------------------------------------------------------------
    0 R; h% L6 F5 e
  402.   # ● 按键刚被按下则返回true' G4 P' n6 O- D! J% M
  403.   #--------------------------------------------------------------------------
    ) Q; h9 K! q  F! |2 h
  404.   def trigger(key)
    2 v) e4 s, R* c# `7 R+ Z5 q
  405.     return true if sion_mouse_trigger(key)
    / l5 Y# \4 w7 B  T
  406.     return Mouse.trigger(0x01) if key == C
    , L# I8 U5 s' W
  407.     return Mouse.trigger(0x02) if key == B
    ) I& p" f; k8 c7 v
  408.     return false, `; U- y: a/ K/ n; F
  409.   end' a4 W8 K, p% k  t
  410.   #--------------------------------------------------------------------------
    , o. @/ \' Y5 l6 u
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
      M' a  G1 N4 C9 P/ \# V3 {
  412.   #--------------------------------------------------------------------------
    % @6 b' n: u6 V" ?
  413.   def repeat(key)
    + ]) ^2 F- V( Q6 N! i/ t: r3 ]- A
  414.     return true if sion_mouse_repeat(key)
    9 M# e' l- ^! \: G
  415.     return Mouse.repeat(0x01) if key == C& a$ L. u  v! w$ p, U$ W: R
  416.     return Mouse.repeat(0x02) if key == B
    ! K$ u* K- t8 z* X
  417.     return false
    ; R* y: m3 E! t" q8 F
  418.   end4 g  z/ j+ m2 |- @$ k" L
  419. end
    5 ~3 T3 P5 b) C8 B  T
  420. & M1 ]' Z) r; B2 z

  421. 7 M1 V. V1 m# O3 U( F
  422. #==============================================================================& t4 i2 O( Q7 `6 Y/ C
  423. # ■ Window_Selectable
      C9 f8 [7 L2 Y$ E/ f' T
  424. #------------------------------------------------------------------------------
    ' J8 E- Y. _$ I4 q& }
  425. #  拥有光标移动、滚动功能的窗口
    ) Q0 q# R! j% d% O; e
  426. #==============================================================================( l9 B5 a7 c$ f
  427. class Window_Selectable3 Y7 k# m6 Z. o, Y/ c# {/ F
  428.   #--------------------------------------------------------------------------
    ) P2 j  ^. E) P6 ?
  429.   # ● 初始化
    $ W1 l8 q% ?; {
  430.   #--------------------------------------------------------------------------
      v3 t7 D5 j% n+ V
  431.   alias sion_mouse_initialize initialize( Z3 C+ q/ T# O, C' x9 x7 `- u
  432.   def initialize(x, y, width, height)
    ' ^2 b7 K! b/ ]* |  q
  433.     sion_mouse_initialize(x, y, width, height)! i% Q' Y  S6 T, q
  434.     @move_state = 0
    4 E( a1 I) U) f& F* G4 ?" T
  435.   end
    / K4 h% ~1 d3 C# J0 O  j+ J; z" n2 K  d3 U
  436.   #--------------------------------------------------------------------------) t$ c: _' X9 i# T5 A, d
  437.   # ● 更新+ }' W9 m  I  E/ [
  438.   #--------------------------------------------------------------------------
    8 @. r1 c% H% d8 a' N! b
  439.   alias sion_mouse_update update6 D" i9 X2 g+ |! `% s( L/ q$ {
  440.   def update8 N3 ]# |8 D; V* s! ?! b( K+ I# b
  441.     sion_mouse_update
    , w7 i2 h: z& q  F0 c4 p
  442.     update_mouse_cursor
    % f3 J; n7 ?- [' U/ O# n
  443.   end3 g6 e% P+ C/ }- G+ R" B2 F
  444.   #--------------------------------------------------------------------------4 J% b  n- k& v: U
  445.   # ● 启动后设置鼠标到index位置# d7 |% c6 n! s4 o; u1 H) J
  446.   #--------------------------------------------------------------------------5 u# {! f4 p) Z" S
  447.   def activate# z% [" ~7 w2 j! i6 F
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos' t1 ^1 U3 L* T2 q2 R! I1 R
  449.     super% |' D! V; Q/ [' K
  450.   end) B# u6 f. w+ X8 H% Z
  451.   #--------------------------------------------------------------------------: y5 }0 {2 C' v
  452.   # ● 更新鼠标和光标的位置
    . t+ y" Y! z. A. ^' W' b$ H) f
  453.   #--------------------------------------------------------------------------
    + ?* S* h( E3 `% Z& S
  454.   def update_mouse_cursor, N* g: u7 L: a3 b
  455.     if active
    2 V0 p- J1 g7 B7 g7 v
  456.       if @need_set_pos1 Y" x2 j+ X0 b4 y, [, j4 r$ p
  457.         @need_set_pos = nil
    3 K, x# a! T- @5 Q* \
  458.         set_mouse_pos
    % a0 G3 @9 v4 B0 n) B* ^
  459.       elsif cursor_movable
    0 E( ]' f7 ^( R$ `' B/ @6 f
  460.         Input.dir4.zero  set_cursor  set_mouse_pos# ^( n% q4 R' ]; _9 T
  461.       end
    % M7 N$ [+ W3 m- j' A, V
  462.     end9 m7 g: Z4 L5 |3 v$ T
  463.   end
    - H3 a  w$ [/ ?2 _( K- D
  464.   #--------------------------------------------------------------------------; c/ [" [' ~/ N4 Y3 i# M' f
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能+ F8 `6 J: n+ R* I
  466.   #--------------------------------------------------------------------------/ s6 Z! L! g( Y0 d9 D
  467.   def set_cursor9 Q2 x9 ]; a1 W# I0 |# q
  468.     mouse_row, mouse_col = mouse_window_area7 C3 g* E: s7 I6 p  P
  469.     if    mouse_row == -18 r, \/ ~& Q: R) L  S
  470.       @move_state += 1 if need_scroll
    8 K) r2 p, p- q: @
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand# C+ ]& g; n' k1 H: Q( Z
  472.     elsif mouse_row == -2$ r1 c6 B  `! r- v3 p% I
  473.       @move_state += 1 if need_scroll. j* h' z8 U. x6 X8 z
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand. w  f: {! w4 E' D1 }6 G, f  I
  475.     elsif mouse_col == -16 \' s8 O8 {1 t; }- S) V3 {: b
  476.       @move_state += 1 if need_scroll
    - s( N8 F# L# }4 q
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand# P8 v+ a- i; N& n9 N
  478.     elsif mouse_col == -2( M8 n; P& V6 l1 g: ~' N6 R
  479.       @move_state += 1 if need_scroll
    8 f( E9 L( n( p: b4 i
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
    0 w7 S6 g* |  `/ q- D! P, U
  481.     else
    $ K' @& q; D% @
  482.       @move_state = 0* C( v! N4 I( R, c2 `& d
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col9 k  H3 E5 \  B/ R
  484.       select(new_index) if new_index  item_max && new_index != @index
    9 Y& N: Y! p& U" ^3 t
  485.     end+ o. ^, b, M8 K7 d
  486.   end$ `  `2 T  Z! _% i/ z
  487.   #--------------------------------------------------------------------------8 b: B. C  u' N% F: @+ P
  488.   # ● 判断鼠标位于菜单的第几行、第几列' s$ s+ ~2 C. S+ ]9 o- ?
  489.   #--------------------------------------------------------------------------
    1 w6 s1 ?" b/ X4 Y
  490.   def mouse_window_area" F2 c6 @  Q: q8 T8 P1 J
  491.     if viewport.nil # necessary!
    8 H/ }& u6 i. ]
  492.       vp_x, vp_y = 0, 0
    5 F% W$ @0 U* w3 V
  493.     else9 d: t3 ]% T0 ~  c( X/ S
  494.       vp_x = viewport.rect.x - viewport.ox) @; M7 y! [* e! j, s
  495.       vp_y = viewport.rect.y - viewport.oy
    6 o) V( J0 ~3 X  ~/ {% |( H7 E* f
  496.     end( [* M' x2 k+ x3 Y  W% {9 N
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    3 o' C. v, H  S% ~: D& U1 r) \( f7 R- M
  498.     item_x1 = vp_x + x + standard_padding 9 t) P7 B  e2 _$ h
  499.     item_y1 = vp_y + y + standard_padding) v: [( N# A  m
  500.     item_x2 = vp_x + x - standard_padding + width
    / |8 ?+ y+ H& S4 P' \$ W- Q  a
  501.     item_y2 = vp_y + y - standard_padding + height3 S5 x! u; Y) z: l5 N9 p$ Q; e
  502.     if mouse_x  item_x1
    & J1 ~! b* t4 j2 j' o6 }- R
  503.       mouse_col = -1
    + h3 j1 ~, A5 ~0 x
  504.     elsif mouse_x  item_x2! W; G+ K- e# x/ N7 Z) N
  505.       mouse_col = -2
    + Z2 L& O$ H) [9 a, ~" h' }
  506.     else) _1 I2 @: v7 `: k' }% S/ f
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)& W  W+ Z- m: M  Y" A, x
  508.     end% S7 J. K, U1 |1 E
  509.     if mouse_y  item_y15 p( o5 D) N! B. v& P
  510.       mouse_row = -1
    $ L$ @( ^; N. o% T6 L) p% m7 w. _
  511.     elsif mouse_y  item_y2
    1 z) U: g0 z, o' u- m
  512.       mouse_row = -2+ u  ~- [: I# l- X
  513.     else* I6 w% F# F' g1 D6 m! C, E3 U; @
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)$ e7 G2 u. g' ?3 S* o
  515.     end
    ' P& v7 C2 R2 L/ h4 x% ?& h
  516.     return mouse_row, mouse_col5 v5 Z$ ]( J: ^
  517.   end+ W  q& b' \  K4 w; _. R
  518.   #--------------------------------------------------------------------------
    $ D8 N/ B9 p. C- @
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    . c- G2 t) k3 z& ]; z
  520.   #--------------------------------------------------------------------------& t( K$ d+ S) ^5 K; {  R1 D
  521.   def set_mouse_pos
    ) J! M( @' l* p
  522.     if viewport.nil # necessary!3 M7 E8 h1 S$ V/ |; Y
  523.       vp_x, vp_y = 0, 09 R9 T) T* L9 s9 B5 p" e2 j5 N7 W, k! F
  524.     else
    % N) O& L* D) j( E" e6 e
  525.       vp_x = viewport.rect.x - viewport.ox7 U* E: Z9 m& s. \- r; L- {
  526.       vp_y = viewport.rect.y - viewport.oy
    - Y3 b: V" p9 U. J% e. F
  527.     end. w( i  q) v5 z& g
  528.     item_x1 = vp_x + x + standard_padding
    / R8 z6 F  H  ^' U- ?* m  e
  529.     item_y1 = vp_y + y + standard_padding
    7 C& M$ J$ u4 V
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
    . \8 I& |9 f- T8 q6 n* k/ Q7 w$ I
  531.     row = get_index  col_max - top_row
    8 @+ h1 h- K, U& D7 p
  532.     col = get_index % col_max
    ; N8 A1 @# s* N4 v2 t* S  ]1 O1 R( p
  533.     new_x = item_x1 + item_width  (col + 0.5)
    ( O! P1 _5 F8 O; F
  534.     new_y = item_y1 + item_height  (row + 0.5)
    0 n  V& h& _7 |+ Y3 T- t* ?
  535.     Mouse.set_mouse_pos(new_x, new_y)+ @0 {# |6 B8 s3 b
  536.   end/ L7 x6 |) W2 ~$ X% A% G" H* K: d/ I
  537.   #--------------------------------------------------------------------------
    ! P$ \* p1 Z% C
  538.   # ● 判断菜单是否需要卷动
    7 R' @% M1 j. i- Q8 B- F
  539.   #--------------------------------------------------------------------------, h1 r4 j7 q  q: u+ v# A
  540.   def need_scroll
    ) z6 E! J9 t; I4 q' T
  541.     item_max  col_max  page_row_max3 |7 G3 }9 Z" `6 ~) d, R" d: F
  542.   end( q$ l! G4 h9 `4 x7 F" Q
  543.   #--------------------------------------------------------------------------
    $ w- ~3 Z% @5 t' Z
  544.   # ● 判断是否为水平卷动菜单/ [& f1 ]# A% @4 |% ]
  545.   #--------------------------------------------------------------------------) n0 M. c# z/ p9 s
  546.   def is_horzcommand& p) ]0 B/ d! [0 k
  547.     return false
    # G9 ~' S$ g; C% M
  548.   end- m* G8 @$ a  L4 ]& g' X( _; z
  549. end1 s, F7 @- x* ~9 ?' Q
  550. - E' f# w/ H2 b) @, P+ j  V, `
  551. class Window_HorzCommand4 n' b0 T0 n# b4 s$ w
  552.   #--------------------------------------------------------------------------: A$ f: j. r6 G
  553.   # ● 判断是否为水平卷动菜单
      `/ l: s3 h+ N0 ]: G- l' _* d5 Z
  554.   #--------------------------------------------------------------------------
    ) i- \* {( n* B# j  {
  555.   def is_horzcommand
    / i+ Q: F* J& v5 Q6 ^5 c- T
  556.     return true" z3 v. D, R6 R5 ]& ?5 g
  557.   end1 s# w- f  m! Y9 F
  558. end
    ) o+ w% b. y2 g5 _8 e5 M
  559. 0 o+ {' {' K7 u" c1 {% L$ T: e* A6 s9 k
  560. #==============================================================================
    2 \9 w! _  D7 O7 U
  561. # ■ Window_NameInput
    2 u$ V9 p- Z: o2 @/ W7 n1 g
  562. #------------------------------------------------------------------------------
    8 o( c: m0 L7 h% ~
  563. #  名字输入画面中,选择文字的窗口。
    2 H! N( r$ Z+ \) v! |
  564. #==============================================================================+ V1 i7 {0 S2 y4 x) Q0 H) k! H
  565. class Window_NameInput
    - y8 D9 d) N2 R% l1 T
  566.   #--------------------------------------------------------------------------
    0 N4 D$ ~  l* e6 ]" p
  567.   # ● 设置列数$ f1 [( T5 e, s6 f
  568.   #--------------------------------------------------------------------------/ F: b/ s' {: r9 a0 ^( R: f
  569.   def col_max8 V. C) k+ A. G" q* f8 V
  570.     return 10
    , w# U# `$ f( c3 p
  571.   end
    0 `* i9 K# O) b  ?0 I. f+ i$ r
  572.   #--------------------------------------------------------------------------
    6 g' |+ C+ p( J5 G( M
  573.   # ● 设置填充的Item个数
    * N- v1 |# h5 [: p9 l
  574.   #--------------------------------------------------------------------------2 f: ?$ W0 t) t! N1 v
  575.   def item_max! b  J0 X5 }5 d: K9 P
  576.     return 90( W* V/ c2 x7 K! J# i2 x; R( i
  577.   end- L# u2 C- Q( y" M! Q
  578.   #--------------------------------------------------------------------------
    * t* R( `5 ~: V# m3 g+ d: ~* k! F
  579.   # ● 设置填充的Item个数6 b$ \! P4 z# e, H
  580.   #--------------------------------------------------------------------------
    ; u. s  d8 o% {9 k, v; Z0 V  P
  581.   def item_width
    : b. U3 b/ Q+ x; _, a- U* J
  582.     return 32! P* t( e9 X2 n- F
  583.   end
    * V  R# V) B# r" h# d: R& L+ z
  584.   #--------------------------------------------------------------------------" T/ W% l0 w' g! o2 S: B0 y
  585.   # ● 判断鼠标位于菜单的第几行、第几列: e6 E  u6 k% W) ~
  586.   #--------------------------------------------------------------------------
    5 j2 e; U* F7 c4 r3 Z
  587.   def mouse_window_area
    ; p& F4 k( z" A% p6 Z" R1 R8 z
  588.     if viewport.nil
    ( t' i( h) ^$ |* N+ u  N2 @3 z
  589.       vp_x, vp_y = 0, 0% S) h/ E8 i0 Z7 i+ U  J2 @( b
  590.     else. k  g% \1 O" ~; p! P
  591.       vp_x = viewport.rect.x - viewport.ox
    + p/ J( G0 O7 ~, p& \
  592.       vp_y = viewport.rect.y - viewport.oy# ^! M, S- \$ N( q" m: V: u
  593.     end
    : i* q% S: x8 y
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y$ b2 {/ u+ ]* P$ |
  595.     item_x1 = vp_x + x + standard_padding & T# _, i5 g; A% D" X) {7 N( [
  596.     item_y1 = vp_y + y + standard_padding
      k! _' r/ I$ t* p2 j4 |0 A
  597.     item_x2 = vp_x + x - standard_padding + width
    . b6 J9 U" G3 \1 o% D0 |
  598.     item_y2 = vp_y + y - standard_padding + height' B! j0 U6 o( _. Y7 D3 L
  599.     if mouse_x  item_x1
    " c( h$ p! D4 t2 b( s& X
  600.       mouse_col = -1+ W# x' \0 ]  Y! y
  601.     elsif mouse_x  item_x2+ @+ K) k9 _$ F/ @" X; X
  602.       mouse_col = -28 y; G: a, p2 G! g; S( m
  603.     elsif mouse_x  item_x1 + 160
    % z' G6 A6 W; o, v  J* B3 A* l* {8 e
  604.       mouse_col = (mouse_x - item_x1)326 f: X9 u) H- A( J8 R: D5 H
  605.     elsif mouse_x  item_x2 - 160( [0 }$ n. g9 |
  606.       mouse_col = 9 - (item_x2 - mouse_x)32
    ( i6 b  b9 a" ]: r6 m: Y
  607.     else
    . z$ _) ^/ ]5 M# Q3 `- T
  608.       mouse_col = mouse_x  x + width2  5  44 v& ?' }: E2 p( k/ @* x8 T
  609.     end: O# n0 d( h5 a+ \
  610.     if mouse_y  item_y1
    2 X$ T3 R! d! a! X
  611.       mouse_row = -10 h1 [% `% n( p9 y8 e  S; l+ W! C
  612.     elsif mouse_y  item_y2
    " l; m7 _+ ]5 H, j- x4 Y
  613.       mouse_row = -2" C  W9 X0 o( Z
  614.     else7 j. N6 q4 W6 `  E) {
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)
    0 }+ u2 B0 N& \7 {
  616.     end7 r( u! r! L! ?
  617.     return mouse_row, mouse_col. i' {: u* j+ R$ b9 w. H7 J
  618.   end/ L# d0 P9 [: C& n- w
  619.   #--------------------------------------------------------------------------+ W8 {6 `1 u# p" o. u
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    " o, I, J* Y) d1 V, X
  621.   #--------------------------------------------------------------------------7 k8 @' N6 w7 P+ h3 r
  622.   def set_mouse_pos7 q- \8 B7 N  b& [
  623.     if viewport.nil # necessary!% H: I. D4 C/ h: y2 I# G
  624.       vp_x, vp_y = 0, 0: d# V* |9 K5 T6 h
  625.     else
    & p! _6 \3 U" g
  626.       vp_x = viewport.rect.x - viewport.ox
    2 l" b1 m" ?% N/ S* l/ b
  627.       vp_y = viewport.rect.y - viewport.oy
      {" C$ c% L/ u: t! r9 ?+ k
  628.     end" |0 |9 X& z  d. P$ Q2 L
  629.     item_x1 = vp_x + x + standard_padding / `/ ~+ E1 \% y; a/ L$ g; Z+ c
  630.     item_y1 = vp_y + y + standard_padding& V! A8 y7 v. E& `
  631.     get_index = @index  0  0  @index
    ; M  A; r# F* W, M) Y) S+ s2 S! C
  632.     row = get_index  col_max - top_row
    , I; s8 }. P- r. z3 L6 g5 U4 h# W
  633.     col = get_index % col_max- V/ ^7 c1 B6 i- |& t( J
  634.     new_x = item_x1 + item_width  (col + 0.5)) ~9 t% d3 ~' J( L4 h6 X7 K
  635.     new_y = item_y1 + item_height  (row + 0.5)" V: E* w  z4 ]/ L, j/ }, y& [8 V
  636.     new_x += 14 if col  4" W' w+ w- @3 e' c# \# F
  637.     Mouse.set_mouse_pos(new_x, new_y)
    / k+ U1 v- h$ D6 m& @2 f0 C3 \3 U" M
  638.   end
    # @* r$ B9 L7 P/ U* L- q
  639. end$ e$ e0 H3 R8 A2 Z/ j2 s# g8 b

  640. 2 [3 {/ i, G" V6 S, B' Y. v
  641. #==============================================================================
      O6 z2 z# P8 A( c. w9 j, z
  642. # ■ Window_NumberInput- O* f$ m5 m( P7 S3 W  I
  643. #------------------------------------------------------------------------------+ ^, V  E- ^  A9 P$ j$ e
  644. #  重写了数值输入的方法以适应鼠标
    2 \# s" m2 V. M' B
  645. #==============================================================================
    0 K% ^% v# \8 K0 d
  646. class Window_NumberInput  Window_Base
    / ]3 U4 l5 y) `0 |! o* U" P
  647.   #--------------------------------------------------------------------------
    1 {+ M0 ^) }1 w9 R5 y* o, u  N
  648.   # ● 定义实例变量
    1 q8 Z' O* \  s$ ?% y" w6 w
  649.   #--------------------------------------------------------------------------
    - i, d) P9 @1 z, j5 W) [
  650.   attr_reader extra_window
    ; B- f$ B/ [! S! |0 q
  651.   #--------------------------------------------------------------------------
    " Y3 Q5 O6 C& c
  652.   # ● 初始化
    / @3 f+ }0 F" R/ Y" }- ^2 U) ?
  653.   #--------------------------------------------------------------------------" L9 Z" x- s# |* R) |) u
  654.   alias sion_mouse_initialize initialize( F1 L; G, H. A$ V8 q1 B$ S5 H
  655.   def initialize(arg)2 N8 d" O( z& J& a
  656.     sion_mouse_initialize(arg)
    * t9 ^5 ^- X8 a3 d
  657.     create_extra_window9 c9 S9 ]1 o) p5 J0 T
  658.   end
    $ G. Z, o5 j, J: j6 [  X
  659.   #--------------------------------------------------------------------------: p) p+ F: f$ ^! v/ C+ Z, L% y
  660.   # ● 启动
    0 g# ?& k) Y, ^, W
  661.   #--------------------------------------------------------------------------5 |6 I0 A& ^* o  c0 o
  662.   alias sion_mouse_start start5 \$ i6 L4 g- T( Z0 t
  663.   def start2 n* P1 p8 k0 e/ L! k
  664.     sion_mouse_start0 a# n9 P1 j' X, _# k
  665.     deactivate* V$ a  f* }. k8 j2 s. m4 n
  666.     extra_start
    : N4 B$ A' ^1 p  Y; n6 n- o" V
  667.   end8 g& H) c# i( ?7 x* ]
  668.   #--------------------------------------------------------------------------2 U2 O7 {! R9 ?+ O6 t7 Y
  669.   # ● 创建新的数值输入窗口' Q4 _; i2 Y% P
  670.   #--------------------------------------------------------------------------
    - L) C4 M" ?1 k5 d, T/ J7 P
  671.   def create_extra_window; v! h% r# `: z& y# V
  672.     @extra_window = Window_NumberInput_Ex.new
    . Z- z$ `( j' l
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  28 }$ w, e: W6 l
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }
    1 [& q" ~: f5 p) h3 c) g
  675.     @extra_window.index_proc   = Proc.new {n @index = n }* K; q. C$ q# W- U5 h/ Q( B5 }
  676.     @extra_window.close_proc   = Proc.new { close }5 i$ U4 A. M( G
  677.     @extra_window.refresh_proc = Proc.new { refresh }( l+ z) P- y& A% g
  678.   end& E( Y9 B) U3 v' _3 ?
  679.   #--------------------------------------------------------------------------% e" h* [; k) A# g0 f3 m4 d5 q
  680.   # ● 激活新窗口4 M+ [: q# O! T. t+ Z& v
  681.   #--------------------------------------------------------------------------( p  p6 ]( {! I9 |) W+ L
  682.   def extra_start6 C2 x5 l9 U7 A8 E
  683.     case $game_message.position
    / t: B% J5 m0 ~. ^4 j
  684.       when 0; @extra_window.y = y + height + 4
    / r5 t0 G5 v3 _
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8
    - ^% U: e/ r* J: U
  686.       when 2; @extra_window.y = y - @extra_window.height - 4# l; W& M, H8 W4 K8 A, J
  687.       else  ; @extra_window.y = 8
    : `; L6 F* I' o* ?( k* D# b0 H
  688.     end3 A4 c7 \) `' _4 X9 v( Z
  689.     @extra_window.variable_id = $game_message.num_input_variable_id
    0 B  M% I% G8 ^' t
  690.     @extra_window.digits_max  = @digits_max
    ( l9 E. W+ b( a& \  s
  691.     @extra_window.number      = @number
    , Z* O( k9 e+ \/ a6 \1 n3 v
  692.     @extra_window.open
    % N( |  L3 [: ~8 e
  693.     @extra_window.activate
    " E0 p9 m. t6 d% i& q1 z5 o
  694.   end# d) B, R! o2 f' V  }: L  k
  695.   #--------------------------------------------------------------------------8 G8 [# |& t( W
  696.   # ● 更新+ k1 L0 {& Y% D* [5 Z. c4 c
  697.   #--------------------------------------------------------------------------
    . D& v; S& J: G+ t# c
  698.   def update0 @9 K) r/ ^) j
  699.     super
    ' j6 u% G0 U; n! E& E8 b( B0 r
  700.     @extra_window.update5 M$ ?3 t. x& p. V# C8 Z' b
  701.     update_cursor
    8 L1 F( ], h  c0 E
  702.   end
    + N. P" k" j/ {
  703.   #--------------------------------------------------------------------------) P" g! M# g) K' [9 G
  704.   # ● 关闭窗口' i9 a- U. g. S5 U: |
  705.   #--------------------------------------------------------------------------
    5 c; s4 r: R. y* J' A# y) B4 H: W- _
  706.   def close- Z6 H( \/ j3 Z3 p% d8 L$ S
  707.     super0 H( o* ^; j( b- }9 q! e! x
  708.     @extra_window.close
    ( I7 H, z3 B- z' q% B) ^; A5 F
  709.     @extra_window.deactivate
    1 j$ Z* k$ {4 x& |1 R8 k* d3 {
  710.   end" q! `# ^9 D9 A6 t7 F" g
  711. end
      L, G, E! c/ B0 ?' A& ~

  712. 8 h1 ^  `- N! C- V% Y4 e3 T
  713. #==============================================================================
    8 l& V- b) |8 j, {/ ~. v. x- T
  714. # ■ Window_NumberInput_Ex0 Z+ }" l  u& W9 J( f5 ?) X- t
  715. #------------------------------------------------------------------------------3 E* O% u* a! f- c8 `
  716. #  新的数值输入窗口(NewClass)
    6 s; j  Q3 b  [+ O: N1 ^5 Q6 H
  717. #==============================================================================/ Q! l6 b1 b- [: ]/ o, Y! n( G: n8 \
  718. class Window_NumberInput_Ex  Window_Selectable
    + g) D0 M, X, z5 o% [9 o
  719.   #--------------------------------------------------------------------------/ X, [/ P; Z& i+ g
  720.   # ● 定义实例变量( v' z+ R- i& B8 A# ?5 X; }
  721.   #--------------------------------------------------------------------------$ B3 V4 r+ ?$ m' N* @" X+ e
  722.   attr_accessor number_proc
    + i( p' F5 [3 N1 c/ `
  723.   attr_accessor index_proc
    3 s8 e+ V. a- `4 k) z0 H
  724.   attr_accessor close_proc' h, }* T5 d: a5 }8 i5 v1 t7 H4 Q
  725.   attr_accessor refresh_proc
    ; S  a. [4 i4 V2 ~
  726.   attr_accessor number
    7 {0 f5 F1 x+ o
  727.   attr_accessor digits_max
    : T6 S7 B) y# E* b, j1 i
  728.   attr_accessor variable_id/ {) L& t6 w: n1 ?, v
  729.   #--------------------------------------------------------------------------
    $ C: }! I6 K# ]& u' c
  730.   # ● 数字表* v: d% s, b  W
  731.   #--------------------------------------------------------------------------( I& t4 e0 m$ E, v! F& [7 D" p
  732.   TABLE = [  7,  8,  9,
    # w3 `4 Q& U1 o
  733.              4,  5,  6,- j, d8 G2 m1 [2 E. e  D3 Q/ K+ k; v
  734.              1,  2,  3,! ^. F. q# |& Z0 [( p
  735.             '←',0,'确定',]
    0 K3 _: W1 Z5 ~2 Q
  736.   #--------------------------------------------------------------------------
    ( P6 e3 |$ t. v! A3 T) I( A: O
  737.   # ● 初始化对象* B, Z/ p  y8 H. {* ~' Q
  738.   #--------------------------------------------------------------------------
    1 G- e  n! g" j/ N" Y
  739.   def initialize0 v: i3 {; i9 V
  740.     super(0, 0, 120, fitting_height(4))4 j+ V! Y8 a# X/ O
  741.     self.openness = 0
    2 |. p) o: [* h, x( e
  742.     @index = 0* s3 [/ o5 @5 i
  743.     @number = 0
    0 d1 b3 R0 N3 G* ?1 {
  744.     @old_window_index = 0
    6 _0 s/ v7 P# z8 J# C0 [2 t3 J
  745.     @digits_max = 0; \+ M0 q/ v/ r1 M9 I
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }" r6 m' M! R1 e" z' h
  747.   end
    ' B9 n- a2 r8 e: p! L2 a4 p; `
  748.   #--------------------------------------------------------------------------; ]- ]1 m  X4 I/ b5 b+ e! f( k
  749.   # ● 获取项目的绘制矩形
    3 Y$ c2 ]* S$ ]( c/ F
  750.   #--------------------------------------------------------------------------( q5 [. J2 `% W! G, u- S, k
  751.   def item_rect(index)% Q: w9 w! ^% X4 o* U) X
  752.     rect = Rect.new
      l9 \0 u4 f  Z2 u7 W
  753.     rect.x = index % 3  32* C/ S; I" }3 [
  754.     rect.y = index  3  line_height
    2 H! @2 a; x1 ]/ ~$ M
  755.     rect.width = 32
    1 C! A7 s$ |# s
  756.     rect.height = line_height
    ; T* r4 r: ]% e
  757.     return rect
    1 z/ B/ ]2 T) Q5 q, P3 G6 Q' n
  758.   end. V+ K" k4 c( H! @% ~0 \: n
  759.   #--------------------------------------------------------------------------
    + e" f, ~; Q8 G3 I) E5 P
  760.   # ● 将光标设置到鼠标所在的位置: |" P  T2 W/ J- D) F7 z; S" D
  761.   #--------------------------------------------------------------------------
    - z4 O5 e7 I! D0 p3 ^/ X% U2 z4 f
  762.   def set_cursor' ]9 ^) Z, ?% c0 l0 }( g2 P
  763.     mouse_row, mouse_col = mouse_window_area
    ) \2 o; i  k. v+ u. p
  764.     if mouse_row = 0 && mouse_col = 02 i# [" r9 @1 C! G; `
  765.       new_index = mouse_row  3 + mouse_col
    - A* T6 V7 i5 y3 H8 I0 w+ E( P
  766.       select(new_index) if new_index = 11
    0 \+ i3 m6 ^6 u
  767.     end
    # z$ [4 J/ l' S# x. k+ k
  768.   end
    : T) x- y6 j8 Q; @% k
  769.   #--------------------------------------------------------------------------
    ) N* d: e3 ~& k4 \. s& w$ ]6 l9 {
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列
    % e( G+ W1 H% j. ~6 [
  771.   #--------------------------------------------------------------------------- Y. f1 T. k$ S" r7 H1 C% Z% F' u
  772.   def mouse_window_area: o! `3 C+ |2 y, P
  773.     if viewport.nil
    ' ]; i- t/ [" I4 x! V/ Z
  774.       vp_x, vp_y = 0, 0
    & @7 k% w/ k/ g$ y+ I2 p7 Z2 a! |  D/ A
  775.     else
    9 X4 }; e2 M0 B
  776.       vp_x = viewport.rect.x - viewport.ox
    + d, @) ], n& c4 s( J
  777.       vp_y = viewport.rect.y - viewport.oy1 M4 k9 a2 J2 E4 c; K1 h) |8 W
  778.     end. m0 F* w( U3 _# P
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    & O4 T) V5 E% S7 b+ F* L$ @+ d
  780.     item_x1 = vp_x + x + standard_padding
    # b. l% I+ N  u6 u+ j9 J
  781.     item_y1 = vp_y + y + standard_padding# S: _1 j) ]0 x+ q$ h, u4 E* G2 Q
  782.     item_x2 = vp_x + x - standard_padding + width
    7 G$ m/ \8 o7 l0 q# i% V: N
  783.     item_y2 = vp_y + y - standard_padding + height, B- K8 |1 e: H3 `
  784.     if mouse_x  item_x1
    , Z0 M1 ~; \( D. n) P4 ]
  785.       mouse_col = -1( o& }. T# A6 }
  786.     elsif mouse_x  item_x2
    - y6 B+ f7 d# {& S3 Z7 |
  787.       mouse_col = -2
      T6 X% e8 R* I: l) ]1 |2 E
  788.     else
    $ l1 L. s* k, V5 R* @, f. S6 E
  789.       mouse_col = (mouse_x - item_x1)  32
    / @6 ?' t" h) ^$ U) q; |" a
  790.     end& q' e! \( Z( q+ {
  791.     if mouse_y  item_y1
    # i4 u* G7 r% S# J4 E) j
  792.       mouse_row = -1
      C- Y' U/ z; I) m% i6 G# m
  793.     elsif mouse_y  item_y2
    7 E$ a. M6 P: [
  794.       mouse_row = -2$ H5 X/ L" s" `
  795.     else
      Y+ ]4 A4 T) z4 J/ B. n
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    " V& w7 J4 }$ k
  797.     end9 u( f' R7 q# U4 J$ n
  798.     return mouse_row, mouse_col
    ! k# J: B3 o9 m0 r3 V' W
  799.   end' R# n! L2 k1 ^& G3 n! j% v
  800.   #--------------------------------------------------------------------------" x0 u. |0 c# w1 t9 a) I' v. A
  801.   # ● 获取文字
    ; @( m( F) [5 O! B- K, f9 z
  802.   #--------------------------------------------------------------------------
    + o- P* s& s3 P( w, O/ x
  803.   def get_number5 l( w) t% f+ ]( @9 [
  804.     return false if @index == 9  @index == 11
    2 S  V# g* w1 v" R
  805.     return TABLE[@index]1 B6 T4 Z9 {2 u; c- n
  806.   end5 |  w! f/ X9 W+ l2 ^- h, `
  807.   #--------------------------------------------------------------------------! F! {3 {" h5 W; `1 H/ B/ x
  808.   # ● 判定光标位置是否在“退格”上$ t& {* m4 O4 S2 u
  809.   #--------------------------------------------------------------------------9 v* l5 X+ k$ ^4 j
  810.   def is_delete
    * v6 J1 f& e, D8 L$ Q! |* J
  811.     @index == 9
    - F: k/ }# }5 S
  812.   end
    ! M% ^5 |: L! j* Z/ t; x: c6 `  j
  813.   #--------------------------------------------------------------------------1 S  y3 t# L/ |) p
  814.   # ● 判定光标位置是否在“确定”上/ w7 F; T5 k9 Q
  815.   #--------------------------------------------------------------------------% s1 F* D* J1 G$ J: w, p9 ^
  816.   def is_ok" k/ {3 H% N. m& {# H: M+ c
  817.     @index == 11
    * K$ ?3 b; p# p( v+ y" j1 I# x: Y
  818.   end
    ) }1 g) |! p7 f+ ?) J) Z
  819.   #--------------------------------------------------------------------------
    & m" Q8 G2 M* z7 j
  820.   # ● 更新光标
    # T: I  j: s7 e
  821.   #--------------------------------------------------------------------------
    . z, G1 V% _( L4 e0 u' H: Z
  822.   def update_cursor
    1 O. O& F* D' o0 K8 g; E: f( |
  823.     cursor_rect.set(item_rect(@index))" s& d$ Z9 [9 |% m: B- q7 f  [
  824.   end6 f9 G; F  S: a$ x( ^
  825.   #--------------------------------------------------------------------------
    ) |8 {8 M+ _+ `% T6 E3 T
  826.   # ● 判定光标是否可以移动' K$ @1 Y" Q$ L- d, K# M
  827.   #--------------------------------------------------------------------------# K' @/ j( X, l; o
  828.   def cursor_movable
    ! s$ ]: V% O3 Q
  829.     active& O# j. X# U2 H4 V3 `
  830.   end; R( x3 M. Z# [. I$ k2 x, p0 o0 l
  831.   #--------------------------------------------------------------------------( ?% @0 b% t9 f: T  @
  832.   # ● 光标向下移动
    * w- Z$ s; S" v! n: X- R
  833.   #     wrap  允许循环8 ~( l. \0 c) U9 E! L) r* @) A
  834.   #--------------------------------------------------------------------------  K& D+ H3 r+ J- t
  835.   def cursor_down(wrap)4 @* M" r6 @. [, P. o+ N& u' U, f. m
  836.     if @index  9 or wrap
    5 b8 V# h6 ?. j
  837.       @index = (index + 3) % 12
    ; U+ Y% e9 C7 U; f5 C$ B! t3 E9 [) V
  838.     end
    * e! h# F5 Q" P( V
  839.   end
    7 k) ~& u. A6 U* A
  840.   #--------------------------------------------------------------------------
    6 ~' r7 e! Z+ O  g* h
  841.   # ● 光标向上移动
    ) c9 ]3 `0 c6 T+ L+ o* C. l
  842.   #     wrap  允许循环
    " b; ]5 Y/ Q1 z
  843.   #--------------------------------------------------------------------------0 C! [9 m* t7 K3 e# B4 p
  844.   def cursor_up(wrap)
    / }* O; ?: G  G" o3 d3 D4 Y
  845.     if @index = 3 or wrap
    0 Q) R% x5 l/ u2 T8 i+ W4 @+ W
  846.       @index = (index + 9) % 12
    / z, y1 l& d7 _% ~
  847.     end
    8 S3 U: V5 |) ^! @4 S( ^! j- Q6 L
  848.   end$ t, ^8 L: K5 k& k8 O
  849.   #--------------------------------------------------------------------------
    / i/ r! V4 y* |5 J
  850.   # ● 光标向右移动
    9 ?, h6 k, x9 x& y8 M* o; s
  851.   #     wrap  允许循环
    & J  v" t& a2 U" e# p7 u
  852.   #--------------------------------------------------------------------------
      M5 L+ @) ^& g+ a" S& m+ F* q
  853.   def cursor_right(wrap)# F0 l; X* e' Q1 V, y5 e
  854.     if @index % 3  2
    $ s+ R2 @# Z2 }& E, w
  855.       @index += 1* P- S, _+ {. \2 S3 w# G* ?
  856.     elsif wrap8 c! U* y3 ^9 l* y7 y
  857.       @index -= 26 N+ N# M" O6 T2 R/ s+ Y
  858.     end
    3 z1 I' K3 R3 L5 K
  859.   end
    ( V  E8 f5 h! a) E6 A( q2 ^
  860.   #--------------------------------------------------------------------------7 t5 W$ Z' {, m- z, N" h3 \$ Q
  861.   # ● 光标向左移动$ ~- p- N8 e$ ]
  862.   #     wrap  允许循环) r" K5 g- v% n- V  E8 v
  863.   #--------------------------------------------------------------------------
    9 r; X3 Q0 e5 e- B: D% n+ q9 i
  864.   def cursor_left(wrap)- l/ a; E  a/ N# g: ]9 H
  865.     if @index % 3  0# p5 j, X* k7 P7 u5 f4 k
  866.       @index -= 1: _% z& f) ]9 T  P' J7 ]! F6 i
  867.     elsif wrap
    7 V1 w, P# s* }5 L- M! ?6 \' q8 z# y
  868.       @index += 2
    0 S8 l9 E0 k5 J6 |& U
  869.     end, N4 {9 D0 ?* ^' R. X6 x
  870.   end7 O# p& v$ }9 @: n/ ?8 f9 U4 q
  871.   #--------------------------------------------------------------------------
    5 d8 _9 U4 O. f( M% X1 T0 q& m$ z
  872.   # ● 处理光标的移动
    # T0 W' @7 r( G% M3 d
  873.   #--------------------------------------------------------------------------
    7 N( `. I* W  Q4 Y, h4 x
  874.   def process_cursor_move
    0 s1 O" g* t* j7 z% r$ h2 N( `
  875.     super3 e& V* P, `( H6 j, L6 _4 x+ ?
  876.     update_cursor- \) B4 [& l. y! v9 U) s. Y' W7 v
  877.   end, g4 G7 u% q2 Y( H9 M1 v4 _
  878.   #--------------------------------------------------------------------------
    ! L, D  M, m3 R  c5 T
  879.   # ● “确定”、“删除字符”和“取消输入”的处理1 t9 {' G- O) f. D5 R
  880.   #--------------------------------------------------------------------------
      ^  ^9 }1 A0 F, m  d
  881.   def process_handling
    3 f# {+ c, O4 X% f" R0 b* F" {
  882.     return unless open && active
    1 ]  F* O! \/ C% P
  883.     process_jump if Input.trigger(A)9 o* [  ]: }. P- ^* F- d
  884.     process_back if Input.repeat(B)
    7 S+ `9 C: {4 y5 y8 ]' G
  885.     process_ok   if Input.trigger(C)
    . v  ?" W" B( T6 S! M
  886.   end9 J" n6 h$ N  g2 o) X5 k: u
  887.   #--------------------------------------------------------------------------3 {0 B" ]# Y& [% ^
  888.   # ● 跳转“确定”
    " I2 J8 W  a4 C$ W
  889.   #--------------------------------------------------------------------------
    & ~0 i4 b) ]* r6 Y0 S# s- O4 R! Y
  890.   def process_jump2 m- G8 p! M6 L) ]3 R7 s9 s
  891.     if @index != 11% r. m7 {  w: z1 k) B
  892.       @index = 11
    % R  F9 r+ h6 M% g7 z% X
  893.       Sound.play_cursor* H  R! n0 N/ s% E
  894.     end/ q4 s  T+ h" W* w3 h/ W
  895.   end
    1 h3 W5 x. O2 t4 R
  896.   #--------------------------------------------------------------------------; z3 a5 u4 h3 @3 Z) ~& ~& u  `: A
  897.   # ● 后退一个字符
    % r: {# p( f. p1 N% |" j! P! l7 c
  898.   #--------------------------------------------------------------------------
    * i/ P1 K: ?& U6 W- B
  899.   def process_back. M; H3 ]+ R5 i( b5 p
  900.     Sound.play_cancel
    , J6 C0 h* o. R9 d8 P& ]
  901.     place = 10  (@digits_max - 1 - @old_window_index)0 }1 @% c2 u3 f3 ~1 J* T- D
  902.     n = (@number  place) % 10
    5 g# _1 y8 {4 C0 a' D3 C5 g0 q. R
  903.     @number -= n  place
    : X4 O9 W& k% H5 S4 D: N
  904.     @number_proc.call(@number)
    2 J2 C1 `; w5 {' X
  905.     @old_window_index -= 1 if @old_window_index  0
    # E* |$ F, r& k" M# D9 K5 a+ S
  906.     @index_proc.call(@old_window_index)
    6 s' J% H& c. W1 n+ \4 y
  907.     @refresh_proc.call
    ! j4 d$ |7 C7 ^8 E# \
  908.   end8 l0 l5 Z" K5 s' B; L4 ~
  909.   #--------------------------------------------------------------------------
    6 s& o! q/ Q. e9 m9 G4 M
  910.   # ● 按下确定键时的处理4 J- C0 z, x' C; Z4 W
  911.   #--------------------------------------------------------------------------
    8 {5 s; e, J6 }2 X3 r# l. l
  912.   def process_ok
    ' ^. p4 K0 ]4 J! X; s4 h5 `  A: C" ^
  913.     if get_number- Q* u! h. u8 Y; d
  914.       Sound.play_cursor: H' a9 n0 {( V$ L  y4 C
  915.       place = 10  (@digits_max - 1 - @old_window_index)
    . N- T7 Z7 k: I
  916.       n = get_number - (@number  place) % 10
    4 ~8 ^. B' Z( @  ?( ~, x0 l
  917.       @number += n  place
    3 a. }! j* r7 |/ e$ _
  918.       @number_proc.call(@number)
    & u6 R# s% x* S/ U& z% h$ Y
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1. a9 I. [8 S+ J( J
  920.       @index_proc.call(@old_window_index)
      a3 Q2 b$ h( R2 b, V
  921.       @refresh_proc.call2 f+ y) i2 j6 }7 }6 r, Y
  922.     elsif is_delete3 u) E$ @/ i/ T3 Q  e
  923.       process_back
    5 f4 i* S, m/ g; E% R. b8 C3 S
  924.     elsif is_ok, ^8 j6 R& r! Q6 d! I
  925.       on_input_ok
    : M2 L+ P. Z. w
  926.     end
    * a" G7 J* u7 Q, n- @* @
  927.   end# G3 ~& N! t: ^/ h' J% Y
  928.   #--------------------------------------------------------------------------
    8 B/ a: ]6 O! Z( Z# V& u& B
  929.   # ● 确定
    5 w) ~7 n; a% I  a  c
  930.   #--------------------------------------------------------------------------
    : J* w0 `; W5 I* B
  931.   def on_input_ok; d1 P5 D7 C& M1 ^: i
  932.     @index = 0
    5 g! p* a9 D" E/ D! z6 c
  933.     @old_window_index = 0
    9 n9 v$ e1 s" E4 H
  934.     $game_variables[@variable_id] = @number5 P( c/ F7 [% h' p
  935.     Sound.play_ok; u2 U5 h% K& K9 F0 ?7 i, F$ u, e
  936.     @close_proc.call
    & V  A6 S% V, y+ Q
  937.   end
    5 B" @( {$ c2 p, E
  938.   #--------------------------------------------------------------------------& _3 H/ \! C* {- }7 n, y0 T8 M
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置) f( w) S* a1 L: [. w$ }
  940.   #--------------------------------------------------------------------------
    / K8 h* m9 `5 O+ q9 \
  941.   def set_mouse_pos
    - F8 h2 Y4 {) E0 s! k2 u- I
  942.     if viewport.nil # necessary!
    4 B1 y1 l' P' N% J
  943.       vp_x, vp_y = 0, 04 N3 d$ r4 c2 W) b+ j
  944.     else
    1 D0 V$ E# z, Q
  945.       vp_x = viewport.rect.x - viewport.ox
    & X) l# W  M# {; u
  946.       vp_y = viewport.rect.y - viewport.oy
    4 h# s- z' \4 G+ [2 a! {
  947.     end
    6 M& C3 {# {! ^8 F3 k5 c; @: N
  948.     item_x1 = vp_x + x + standard_padding 1 |$ S# l7 V2 |% r! k/ T- y
  949.     item_y1 = vp_y + y + standard_padding
    : C: A9 }' x7 j# K* I
  950.     get_index = @index  0  0  @index 0 s8 _* n2 ]9 N) o# }" k  n8 U
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5). s7 {, ]7 R/ u6 d4 o& F% Z
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)
    8 r( H7 y- r5 B
  953.     Mouse.set_mouse_pos(new_x, new_y)5 E6 `, `1 ^7 g2 e/ p2 R$ s" e
  954.   end
    : O/ p/ _2 V" ~+ D. j2 J* e, J
  955. end
    4 S5 D7 v' p2 M, |
  956. 0 b) Z' \% l+ Z2 i% `9 \
  957. #==============================================================================/ M4 i5 V5 }% |' z( D* m8 [
  958. # ■ Window_Message
    . S. `. c/ w; J" L  W0 b% Q1 n
  959. #------------------------------------------------------------------------------
    9 }4 \! N& T9 n
  960. #  显示文字信息的窗口。  B9 Q( t) V3 @& k" d, X. o
  961. #==============================================================================
    4 S) i; y. h0 Q% E+ G3 N
  962. class Window_Message  Window_Base
    # B; r: k& B1 e! a$ p' x6 I+ `
  963.   #--------------------------------------------------------------------------
    " Y8 E  y/ ^: b4 v2 k) p
  964.   # ● 处理数值的输入(覆盖原方法)3 D: p" z: Z' H, N) V
  965.   #--------------------------------------------------------------------------  J" g" Z4 w. i# Y( S
  966.   def input_number* u& R" c! S1 n# U
  967.     @number_window.start* p! y. e" Y1 y6 A- d2 S  J# k; \
  968.     Fiber.yield while @number_window.extra_window.active
    / d: ?2 o1 H4 d
  969.   end
    . M) x& L& ?' p" m$ J
  970. end6 _( ]0 U% D7 f" Y% S  ?
  971. % ?) b) M5 u% K% A
  972. #==============================================================================
    # z$ e6 I( y$ n& Q% ]3 b# x
  973. # ■ Window_PartyCommand; f, M- M# \8 A; Q5 g
  974. #------------------------------------------------------------------------------2 \7 M& h$ D% G0 X; U/ n
  975. #  战斗画面中,选择“战斗/撤退”的窗口。
    & r% R" v4 q8 U
  976. #==============================================================================
    0 I5 M9 @: G/ x2 b; b- H+ L" D( j
  977. class Window_PartyCommand  Window_Command: y' r4 E! g6 R" W( x
  978.   #--------------------------------------------------------------------------
    3 I! |) R% e! M. ?' r
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置% ~  M+ e0 m/ T
  980.   #--------------------------------------------------------------------------9 ^0 z4 F% G5 @" a
  981.   def set_mouse_pos
    % p% {/ L4 c2 y$ Y1 h
  982.     if viewport.nil( O+ c* \& a2 X' s, h5 a: N
  983.       vp_x, vp_y = 0, 0* i8 n  i1 Q9 ^  w$ }0 K
  984.     else
    ' M: A+ n. R! n9 h* R2 V
  985.       #vp_x = viewport.rect.x - viewport.ox
    # E% I* G7 C, y0 ^) a9 J/ a
  986.       vp_y = viewport.rect.y - viewport.oy
    8 j* V! N3 Q6 G4 F3 z$ [5 U/ [
  987.     end
    5 u+ U# |" L  Y, i0 F! r, }3 x: M
  988.     item_x1 = x + standard_padding $ n! h& g# z6 i1 r6 u" f
  989.     item_y1 = vp_y + y + standard_padding
    9 s+ i8 J# t$ r
  990.     get_index = @index  0  0  @index
    * t, D6 o" H1 M3 e% t  R- t
  991.     row = get_index  col_max - top_row
    9 I+ `: C% R& {( J
  992.     col = get_index % col_max1 ^$ _* p& P  A( [
  993.     new_x = item_x1 + item_width  (col + 0.5)
    ! [/ z- F% ^: G# Z4 n. X8 A6 n2 Q
  994.     new_y = item_y1 + item_height  (row + 0.5)( S0 b  n) a. T: Y. A
  995.     Mouse.set_mouse_pos(new_x, new_y)
    # M' U* h! r0 P' p
  996.   end
    ) `5 i* b8 \& D/ b! F; b( B) {
  997. end
    / [! ?6 Q5 P5 R- e5 c" o
  998. ( K8 _, p  C; w8 u# N
  999. #==============================================================================
    * I5 _, g% k2 [6 p6 X1 k2 }
  1000. # ■ Window_ActorCommand- x; Z: g! Y  s% F2 S" o
  1001. #------------------------------------------------------------------------------; H! t" O. c3 ~) d" B
  1002. #  战斗画面中,选择角色行动的窗口。& E" @0 V3 p1 g8 U. `6 _; a  B
  1003. #==============================================================================
    ' ^8 W6 b2 R' p7 P4 S' j; ]: A
  1004. class Window_ActorCommand  Window_Command% B7 P+ M. _# {4 x5 N5 \- d* f
  1005.   #--------------------------------------------------------------------------2 R" f; a% L1 W8 w, i
  1006.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    ' N! ~+ i0 m4 `) P7 Z% _
  1007.   #--------------------------------------------------------------------------, H9 q* o! p& W% i7 I& `
  1008.   def set_mouse_pos
    ! g7 y# z5 Q6 c$ q0 s
  1009.     if viewport.nil
    , y5 D8 z: u6 E
  1010.       vp_x, vp_y = 0, 0
    : z. M, P) w# }3 r0 m9 d4 m$ B7 a
  1011.     else( I9 _/ j2 c' s
  1012.       #vp_x = viewport.rect.x - viewport.ox3 d1 \) A0 j. \% g' P
  1013.       vp_y = viewport.rect.y - viewport.oy" D$ K1 k8 y0 ~
  1014.     end) ~, V! ~$ B6 x- m# q2 h
  1015.     item_x1 = Graphics.width - width + standard_padding
    : a, ^# b! v$ x. z, E
  1016.     item_y1 = vp_y + y + standard_padding+ n0 h9 i3 k9 e% R1 o" g* g" @, `
  1017.     get_index = @index  0  0  @index 6 p" J+ q( c4 F0 h+ q! l
  1018.     row = get_index  col_max - top_row
    * t" Y* l- G( ], R: \
  1019.     col = get_index % col_max5 G$ t4 }8 X. v' u7 Z+ P$ p% ^
  1020.     new_x = item_x1 + item_width  (col + 0.5)
    0 X- L$ [- M" {: U! O: v% c, D
  1021.     new_y = item_y1 + item_height  (row + 0.5)
    ! w& V- x8 P. J* W( j- g+ \
  1022.     Mouse.set_mouse_pos(new_x, new_y)- {1 l; o, A. L# ]+ M  W* ^  {
  1023.   end
    ( Q4 J, H( l) w4 u
  1024. end" {1 g: x9 J" T0 S& W

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

  2145. , u# i! f& q+ D" N# S
  2146. #==============================================================================
    ' X. Z2 @* D$ r# W
  2147. # ■ Game_Map( q  E/ F, a9 G; _# B& A+ Y
  2148. #------------------------------------------------------------------------------% K) B3 `) A  H/ O2 _5 u6 T
  2149. #  管理地图的类。拥有卷动地图以及判断通行度的功能。) V  }# C$ F( O+ H% x; q' O9 M. A2 R
  2150. #   本类的实例请参考 $game_map 。$ J. {! N! K8 _1 {: K5 J* m9 d% W( ^
  2151. #==============================================================================
    1 |- _) H' O. z) o( r
  2152. class Game_Map2 U, c( B# s, E# g3 Q
  2153.   #--------------------------------------------------------------------------
    5 D& ?' `% r) ?/ V& |7 {* m: Z; v
  2154.   # ● 定义实例变量% F! v0 j6 h6 A
  2155.   #--------------------------------------------------------------------------
    1 t6 }* n0 U8 b. T( s
  2156.   attr_reader mouse_map_x # 使用前需先使用 get_mouse_map_xy 方法来更新数据9 {0 E: U+ u, B2 Z
  2157.   attr_reader mouse_map_y # 同上
    0 E! V" H$ e: t. o1 o! j) s
  2158.   #--------------------------------------------------------------------------/ {0 I" S6 w& |/ E; ?
  2159.   # ● 初始化对象
    1 M: @. [; r6 a- o
  2160.   #--------------------------------------------------------------------------9 c% K* V- i( G7 B5 q
  2161.   alias sion_mouse_initialize initialize
    % k/ Z& M4 d& c* {4 m
  2162.   def initialize
    5 i. Y3 y2 n3 J: H; q
  2163.     sion_mouse_initialize" e- |; K  |8 r5 }
  2164.     creat_move_sign  ###
    / w) N* w: Y  [' F; M
  2165.     set_constants
    3 F+ ^+ S9 t4 _$ R
  2166.   end1 j" E' c6 }6 Q5 V
  2167.   #--------------------------------------------------------------------------( d" z' m- M! a
  2168.   # ● 更新画面
    ) e: Q* O' B- z, ~) M3 V! _/ g
  2169.   #     main  事件解释器更新的标志! ~3 z! h0 y  I+ F4 E
  2170.   #--------------------------------------------------------------------------
    2 _9 e3 J7 c: D! w
  2171.   alias sion_mouse_update update
    ) S2 o. u8 x( ?/ x$ G  n" K
  2172.   def update(main = false)
    7 K( S2 ~& o6 r% Q
  2173.     sion_mouse_update(main)
    4 _* h2 g5 m, K% ^% I
  2174.     update_move_sign
    4 R, p% J" ?/ U& {# I
  2175.   end: J+ p; L: q8 K3 e* a: t# m0 i
  2176.   #--------------------------------------------------------------------------
    6 p4 P" V* P  O/ \  _6 q
  2177.   # ● 创建显示路径点的事件% o; Z1 n; F. G) a3 Q/ e  L
  2178.   #--------------------------------------------------------------------------
    # L  ?( U( h8 }
  2179.   def creat_move_sign
    ; r) z5 w+ |; p5 @& g% Y
  2180.     $mouse_move_sign = Move_Sign.new
    " q! [6 s  J- G! K  F. w
  2181.   end
    6 x# Z- `( d% N  S/ M0 Z2 l9 g! f; q1 `) q
  2182.   #--------------------------------------------------------------------------
    0 W0 `5 w) y' f" F
  2183.   # ● 更新显示路径点的事件
    1 g; V% j6 j' X" N; T0 o3 @
  2184.   #--------------------------------------------------------------------------# M' }4 i) w) t; i6 H3 X/ t
  2185.   def set_constants
    $ k# q: v3 [% o0 V
  2186.     @mouse_pos_setted = true7 j- e2 o/ ^8 e3 U# r; D& C2 x
  2187.     @set_pos_prepared = false# l( |% k. H5 |
  2188.     @mouse_old_x = 0
    + [, w' ^# Z1 i9 }0 k. C
  2189.     @mouse_old_y = 0$ K4 P8 J1 a8 F- }6 N
  2190.   end0 b* Y  T; X8 h* s! e! s
  2191.   #--------------------------------------------------------------------------3 R) Q4 h1 I; k5 I
  2192.   # ● 更新显示路径点的事件% E, l; f" J1 d4 P; C3 o* S6 h0 k. f  ?" z
  2193.   #--------------------------------------------------------------------------
    ) |1 t, L8 J( N
  2194.   def update_move_sign1 d2 j* Q0 E1 S2 X- e  ]' w
  2195.     $mouse_move_sign.update2 F' n8 q$ _2 R
  2196.   end5 c! J) e% _; W. W8 J
  2197.   #--------------------------------------------------------------------------
    $ K2 Q6 j( @- @8 w4 p6 l
  2198.   # ● 获取鼠标位于的地图块的x、y坐标
    4 w1 l. R# \8 W) _' A+ E
  2199.   #--------------------------------------------------------------------------2 x- h2 s6 J  `# _7 x2 l4 U
  2200.   def get_mouse_map_xy
    + ^+ Z+ B. k0 F4 ]) j2 F& A
  2201.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    # G# i7 G1 i8 C9 K3 C
  2202.     @mouse_map_x = round_x((@display_x + mouse_x  32.0).to_i)7 P& p( `" \# J$ R6 w
  2203.     @mouse_map_y = round_y((@display_y + mouse_y  32.0).to_i)
    3 b) Z2 K" X) O
  2204.   end* A7 S8 T; @# m: U3 U; {: D8 o9 P3 m
  2205.   #--------------------------------------------------------------------------7 A8 b* ~, j& i$ O: b; {; ]
  2206.   # ● 返回地图画面时重设鼠标坐标
    ! M' Y+ b' r5 U: P# u0 L  B
  2207.   #--------------------------------------------------------------------------; y' b2 e+ W  u
  2208.   def reset_mouse_pos
    , k) B4 H& K# A% l# r2 k$ W
  2209.     return if @mouse_pos_setted2 ?  }3 N& n( e: F5 e; Q
  2210.     Mouse.set_mouse_pos(@mouse_old_x, @mouse_old_y)
    / C+ i6 E: S$ `- M* O8 o' d
  2211.     @mouse_pos_setted = true2 c4 l+ I0 I6 r7 S* F" s
  2212.     @set_pos_prepared = false
    " M6 v( g5 ^- R! X! \7 B
  2213.   end
    2 Q5 v( G/ H" Q4 Y& \4 O! ]& n
  2214.   #--------------------------------------------------------------------------
    2 l! F" `  u9 Q7 O. Q9 ^
  2215.   # ● 重设鼠标的坐标
    0 {5 R4 `. ^$ ^' t+ r
  2216.   #--------------------------------------------------------------------------
    % E3 @  j, o2 H. o7 g1 i
  2217.   def prepare_reset_mouse_pos9 v& l) h* z1 \4 a1 }. J) h6 v
  2218.     return if @set_pos_prepared
    5 i/ V  j2 h7 L  I
  2219.     @mouse_pos_setted = false, }* J% {+ |4 z/ t$ X
  2220.     @mouse_old_x = Mouse.mouse_x
    0 s1 R+ i  Y" y+ t
  2221.     @mouse_old_y = Mouse.mouse_y6 `0 U+ L* W1 H2 K& c$ t
  2222.     @set_pos_prepared = true
    # ~, w" t4 l% V# b% J
  2223.   end( p6 ?- v7 }3 U
  2224. end
    - U, }& y+ h% F' n0 q. E9 A0 Z7 ?

  2225. . o/ J# [# d* B  i' `+ C% q5 E0 m5 m: j
  2226. #==============================================================================
    / @2 _: G" `# u3 M- n- v
  2227. # ■ Spriteset_Map8 `# O& }' L, m! C* w6 ?& J
  2228. #------------------------------------------------------------------------------- U8 z! E: O" H. o' U6 h  |
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。; t! O8 O1 a- w) `. \- I0 Z. `
  2230. #==============================================================================
    , ~% e1 p% C9 C' @$ E  V$ ?2 P/ k
  2231. class Spriteset_Map
    ) Q' z' Z8 D1 r# c
  2232.   #--------------------------------------------------------------------------
    ( b& w" r" W% ?8 h
  2233.   # ● 生成路径点精灵
    1 k- H) S) R: y. j0 e/ j) b- y
  2234.   #--------------------------------------------------------------------------: d+ r. B0 A. f
  2235.   alias sion_mouse_create_characters create_characters
    ! T0 U' J+ `3 I; P5 g
  2236.   def create_characters
    ' \% v1 N- z& Y9 L- @! x* H' v
  2237.     sion_mouse_create_characters
    5 w+ V5 [# e% Y
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))' I  t7 a3 X* Q6 L9 q
  2239.   end
    ; U5 ^% c# T  ]& q7 {
  2240. end! J* E3 Y5 `. C/ P+ y1 M

  2241. " O4 F" {& b5 \7 e
  2242. #==============================================================================
    3 }' \. k5 |9 J9 _) u1 j9 t
  2243. # ■ Scene_Map
      n9 S) w; P* m) i/ w) ^
  2244. #------------------------------------------------------------------------------! p9 |( k6 t2 A  J' d1 i$ D
  2245. #  地图画面
    " X* t8 e, _0 q- m) [- k* y0 [# C+ u
  2246. #==============================================================================4 |( e  G8 w! K& R7 }4 _. e* C
  2247. class Scene_Map  Scene_Base
    6 ?6 @8 h' j# S# T. h2 N
  2248.   #--------------------------------------------------------------------------
    ' ~# P2 E  `* t9 F1 F/ Q! O
  2249.   # ● 画面更新
    # l) S, `& I) n& a+ g& U5 O6 S
  2250.   #--------------------------------------------------------------------------4 B) x- ~: w5 N
  2251.   alias sion_mouse_update_scene update_scene
    : _! d- h: L5 V  H% `* h
  2252.   def update_scene
    " b$ y2 T, x/ j7 C0 P8 Y& }
  2253.     sion_mouse_update_scene
    3 D* r  n7 T7 g
  2254.     update_mouse_action unless scene_changing
    2 z2 J0 S0 e! C( l; W& v
  2255.   end
    6 F5 @$ ~- f5 N. W4 w0 S
  2256.   #--------------------------------------------------------------------------
    ' l( L4 M: S; r
  2257.   # ● 场所移动前的处理$ r% d5 @$ p, T5 F% ]" C
  2258.   #--------------------------------------------------------------------------
    $ d7 _8 l' i. h1 Q$ E. v/ g
  2259.   alias sion_mouse_pre_transfer pre_transfer) B- i3 g/ A; `9 s9 r6 `7 }
  2260.   def pre_transfer
    - R  U9 N. X9 t6 G. b
  2261.     $game_player.reset_move_path, ]5 o" K4 j6 A% d: Y
  2262.     sion_mouse_pre_transfer- i5 i( J% P5 Z: l
  2263.   end
    . S$ `) q# B# s; D* `! v
  2264.   #--------------------------------------------------------------------------
    / |" z5 k8 {7 s9 p" }
  2265.   # ● 监听鼠标左键的按下
      Q  G7 J! H- h& N
  2266.   #--------------------------------------------------------------------------  t5 ~4 k! O# Z5 z+ Z
  2267.   def update_mouse_action
    $ u5 G- [, P% L9 @% q
  2268.     $game_player.left_button_action if Mouse.press(0x01)% e. D, D, _0 O  F/ ?' y5 h* D  W
  2269.   end/ C  R/ T' T4 F" L6 h: R/ a
  2270. end; p7 v: Q6 @1 a: b8 Z

  2271. 8 y4 t9 l& J# Y; L. e; c
  2272. #==============================================================================1 A( s- s/ I6 O# R
  2273. # ■ Scene_File
    2 o# m$ C7 J# |% U# T, q& j
  2274. #------------------------------------------------------------------------------. w2 v+ H1 A# {$ W1 b- H
  2275. #  存档画面和读档画面共同的父类
    3 A6 N9 y& ~. v6 _9 z, h3 B8 N
  2276. #==============================================================================
    0 [; T+ ^1 t! f. k$ {6 N" r
  2277. class Scene_File  Scene_MenuBase2 U" T! }% }- ^+ F1 f
  2278.   #--------------------------------------------------------------------------
    3 p7 X# A- S) ^7 k% B, `. P- y
  2279.   # ● 开始处理# {3 d6 ^( K* }' o5 H) q% i
  2280.   #--------------------------------------------------------------------------4 g2 a& k: ^0 `; n! T6 j
  2281.   alias sion_mouse_start start# z8 t4 p, E4 k9 ~" V1 \" n* I3 k5 z
  2282.   def start
    % C& y* |2 B& j) K0 c) ~7 f/ M* o# Q; M
  2283.     sion_mouse_start
    & \" M8 B5 `/ k/ i
  2284.     @move_state = 02 d, E) Y2 u# C! X0 X
  2285.     set_mouse_pos9 _" i2 o! v% J
  2286.   end+ s1 A( X1 n1 T! h
  2287.   #--------------------------------------------------------------------------, m7 n5 O4 Y" ]7 p) b, n6 \9 p$ Q7 t
  2288.   # ● 更新画面# k4 ?2 {4 l! p
  2289.   #--------------------------------------------------------------------------& K. ~* T+ i" S$ M( L
  2290.   alias sion_mouse_update update5 G: R* A* a5 S2 i
  2291.   def update& P. v) @$ @5 ~' h" |' P
  2292.     sion_mouse_update7 u" A: M) [! F& E0 J8 I6 o
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos
    3 y3 n: v" X) ^/ {0 Z& _1 m6 v/ C" @
  2294.   end
    ' J- h; g" B$ @) C: P  r& o
  2295.   #--------------------------------------------------------------------------
    7 J9 c% @' P# m! z7 |5 e
  2296.   # ● 更新光标8 b. E/ k! r9 h( D1 o  V
  2297.   #--------------------------------------------------------------------------# l) f  C  ]) }' f$ G7 t
  2298.   def set_cursor1 R# G- K: T3 _+ J: H0 y
  2299.     @move_state += 1
      m5 V/ ~! h: b9 p# t7 |# i8 |
  2300.     last_index = @index: l# o7 H# P* Z3 c- e+ p0 |
  2301.     if mouse_which_window == -2
    : q- I% H* D) o
  2302.       if (@move_state - 1) % 6 == 0
    3 e$ Y* ?! @/ R. L: w$ B& b- _) e
  2303.         @index = (@index + 1) % item_max if @index  item_max - 1
    ' U+ L# p+ y6 `8 [7 e1 a
  2304.       end
    ! F  F( ^+ h# c. v4 Q  a
  2305.     elsif mouse_which_window == -1
    7 p  r; U: F' h* @0 a
  2306.       if (@move_state - 1) % 6 == 0
    6 V2 p  ~1 s- u$ C
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    % d2 e0 b0 E5 g- Z9 U+ V7 _
  2308.       end
    8 Z$ R# q5 R0 I7 F
  2309.     else
    0 O7 Z7 u$ |) I' a8 ?$ P- q
  2310.       @move_state = 0' s9 V1 f/ T4 F' W, c! s
  2311.       @index = top_index + mouse_which_window
    - \: Y- {% x0 U" q% d# t
  2312.     end
      D( m& x% F6 d& B* g5 J
  2313.     ensure_cursor_visible
    # t: [  l4 ^1 h" G+ r
  2314.     if @index != last_index/ R/ h( H, K' D# y6 j
  2315.       @savefile_windows[last_index].selected = false7 y) x# ~0 G8 r2 l3 P1 W
  2316.       @savefile_windows[@index].selected = true
      y, R: v, S3 [& y1 K
  2317.     end$ M$ n" v' B$ Z( l9 ~' s6 u+ m
  2318.   end  T' s" B4 D' c
  2319.   #--------------------------------------------------------------------------% H7 ?6 i/ r1 h& k9 D. e
  2320.   # ● 判断鼠标位于哪个窗口) d0 B/ S# z6 I7 q# F- N
  2321.   #--------------------------------------------------------------------------
    3 c% T) P, d6 V, d* `. S' m" }
  2322.   def mouse_which_window( F& \' ~  p% t( `8 g& N  `0 d
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y! w( f+ X9 {& b7 ~- L3 I
  2324.     if mouse_y  @help_window.height + 14
    3 ?( G7 G/ P2 I2 r0 Y5 s0 k
  2325.       mouse_row = -1. E" |: A- s+ D, |; V' X
  2326.     elsif mouse_y  Graphics.height - 14
    2 N5 ]) h) d, T
  2327.       mouse_row = -2
    ; Y* r) @$ E& L
  2328.     else1 ], s. b& \3 r6 I: F8 C
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    ( [; h% |6 z% E/ b+ L9 h& C
  2330.         (Graphics.height - @help_window.height)7 @1 ~& p' l1 z$ J: U8 H0 E& q$ A
  2331.     end/ Z& [5 J- v$ t
  2332.     return mouse_row
    ' s2 p. |7 k$ b! {# q8 F: o: @" h4 W2 {
  2333.   end% V8 u5 t- A9 D3 o+ X
  2334.   #--------------------------------------------------------------------------
    # v4 [$ \3 ^0 O" D' Y! h1 }
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    * E  R/ K( L6 z, ~/ i  y
  2336.   #--------------------------------------------------------------------------" f2 E* O( ^( f5 s# a) y8 V, ~
  2337.   def set_mouse_pos
    4 N$ V2 \. D3 r8 X! U) z& b
  2338.     new_x = 40
      K% p! H$ `$ ]+ ]5 V/ S3 j
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24  V7 i3 b9 R, W6 g0 o" }# j' E. i
  2340.     Mouse.set_mouse_pos(new_x, new_y)
    : n6 G# g- B' i$ o( T8 b
  2341.   end( J4 m7 u5 d) U9 I  x
  2342. end9 i& t5 t" h9 ?$ {

  2343. 3 @8 d* F7 j& W
  2344. #==============================================================================
    6 t1 V& U4 \) ^3 X
  2345. # ■ Game_Event: t9 G7 P7 l$ A- j# H; j- E
  2346. #------------------------------------------------------------------------------
    & v9 N4 W, f) l% x( L
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。0 d" r4 U) T4 h. Z# [% j
  2348. #   在 Game_Map 类的内部使用。# p/ g+ `2 _; Y& ?  ?6 M9 E
  2349. #==============================================================================
    9 Q8 W* a# r0 C- ]$ [+ @
  2350. class Game_Event  Game_Character4 G: S! M/ _+ g& E$ w# s0 E7 }3 }
  2351.   #--------------------------------------------------------------------------
    5 H" R' Q- m+ Y4 F$ ^# ]& v
  2352.   # ● 事件启动
    : p; o- C( \9 J. H" @& f
  2353.   #--------------------------------------------------------------------------6 o2 s1 v3 z; ^* s$ _
  2354.   alias sion_mouse_start start% H9 c- J$ g- o7 Q0 R5 E
  2355.   def start
    ( ]) N7 e. d4 k( H* ~+ J5 X& t
  2356.     return if mouse_start && !Mouse.press(0x01)
    3 D- z" e/ y; O4 j+ D0 ~. X5 Y, q
  2357.     sion_mouse_start
    & O. K3 K  }4 J/ T
  2358.   end) b* v3 d0 e4 y7 Y6 D0 |; d  G- {
  2359.   #--------------------------------------------------------------------------
    % E3 L' q# c- B) i, [* A1 ]. l
  2360.   # ● 判断事件是否由鼠标启动- f+ E5 [$ o' k' x  p
  2361.   #--------------------------------------------------------------------------1 k' K  n6 k  M. G+ i/ U' L
  2362.   def mouse_start
    # t" X) P% f" s" a) o+ T6 q$ m$ ~
  2363.     return false if empty5 i7 R8 B3 `8 c& M
  2364.     @list.each do index
    1 V; I: U3 X; D4 e' f1 v5 k( _
  2365.       return true if (index.code == 108  index.code == 408) &&% R: t( c* X: f  a( D
  2366.         index.parameters[0].include('鼠标启动')# R' l) L0 l6 g- q. S! I$ a
  2367.     end
    % `+ p- J0 ~7 l/ Q$ g7 W$ s. O
  2368.     return false
    # j; y2 b, R/ Z- f9 O: @) @
  2369.   end
    2 e3 h/ c1 u8 W$ N% g/ s& |
  2370. end2 S2 H. q5 m7 G7 J% k/ x7 y

  2371. $ M; }9 H& |6 ^
  2372. ####泥煤的height5 F! u8 f5 L' G- f* U) v/ q
  2373. # @height = height0 J/ v. ]. n0 C
  2374. * Q* w1 ^7 c2 j$ v: F2 P
  2375. class Area_Response
    , `9 R" m+ v* A/ q
  2376.   attr_accessor type
    $ k# J: n+ A9 ^1 Z
  2377.   attr_reader ox/ @! u  ^1 }" E
  2378.   attr_reader oy0 [& K4 @3 k- R- q7 r& M$ E5 e
  2379.   attr_reader width
      \" X8 ], @/ L
  2380.   attr_reader height
    + q: h. T* d: B% g
  2381.   attr_reader switch_id+ u! e+ v6 M, r- t1 }- b# Y
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)
    & w, w5 m  n$ [0 V. d! A2 @* d
  2383.     @type = type
    3 N  J. o! L: A6 F% t! m
  2384.     @ox = ox& s1 N1 m) T# d% i' \; b" _
  2385.     @oy = oy
    6 |/ k7 [: A5 n
  2386.     @width = width  m: V* O& H! y0 m5 ?
  2387.     @height = height
    / l" n/ H8 r# c. r8 u
  2388.     @switch_id = switch_id7 H: s3 m0 w4 r; t, f
  2389.   end% A1 N% c6 m4 r: [* T6 W8 T8 {
  2390. end
    7 r& @2 @1 T5 z: W% E! h

  2391. + _% M0 r8 f1 N" A9 e
  2392. $area_responses = []
    , @- q$ p# p* X. X6 k
  2393. 7 }& T! v& `; p4 Q" ?+ U( _$ L
  2394. class Scene_Map/ ?& V! Y# Q1 j# B. U4 x7 C' x
  2395.   alias update_mouse_2013421 update_mouse_action
    % ^; S- w* k5 T* l6 `. t6 F) T
  2396.   def update_mouse_action% c" @! U- Y7 ]& L
  2397.     update_area_response
    $ i  k! K' e; O; o! l
  2398.     update_mouse_20134217 o4 h4 e2 a, G* j
  2399.   end( V- z0 h3 y. F0 h$ G/ W4 V
  2400.   def update_area_response6 X1 y; k# Z2 P% i: [8 |
  2401.     responses = $area_responses
    9 L; h8 t# @/ ^+ a0 j
  2402.     responses.each {response
    + ^2 r" N7 k$ c3 B# ~2 F! z
  2403.       ox = response.ox
    ) o& c3 q; m" N! W% {  t  Q
  2404.       oy = response.oy
    9 d6 L1 Y2 d1 g% N. c# X- O1 m+ {$ f
  2405.       width = response.width
    ! M2 d5 ^  G" t) d; @/ T
  2406.       height = response.height
    : ?9 Z  y0 H# B, P
  2407.       switch_id = response.switch_id
      m, b" ]2 B/ W7 A- m
  2408.       case response.type
    / K- C7 c( A" f4 h* k- B+ i
  2409.       when 0$ r# V7 w, F7 E- Q* [
  2410.         if mouse_in_area(ox, oy, width, height)1 M8 F. a1 m) a3 s  N
  2411.           $game_switches[switch_id] = true( w; F: Y! Z# F2 Q' n
  2412.           $area_responses.delete(response)
    & Z1 y. k$ P; n' |  z
  2413.         end2 P* t" Q6 q( _2 w& L
  2414.       when 1
    4 f6 p4 w# o3 v1 g* w# _
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)
    + c+ a5 L4 T9 e) c# d2 l5 T8 Q
  2416.           $game_switches[switch_id] = true
    % S% l9 f; h& B. V( q7 P* j; x3 d$ \# Y
  2417.           $area_responses.delete(response)
    / y% a7 R% I/ P& x* _
  2418.         end
    % Z. N3 W; j# a' y1 [
  2419.       when 2; U: m- D5 j7 k! h7 V1 i# |5 ]
  2420.         if mouse_in_area(ox, oy, width, height)# m0 E: ^& v+ k
  2421.           $game_switches[switch_id] = true4 N5 Q  v0 ?7 f8 w9 l# f! v4 ~
  2422.         else
    9 U0 n- r3 o2 a# x. t
  2423.           $game_switches[switch_id] = false( d- g: r; C4 |4 U
  2424.         end" a6 K2 F" Z% D7 s( T1 B
  2425.       when 36 d1 @$ u" [0 z. z# [
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,# W  q7 m! n! X! G7 D. r% _
  2427.             (oy - $game_map.display_y)  32, width, height)0 x8 ^. k3 G$ l. `: i- z4 ]( E
  2428.           $game_map.events_xy(ox, oy).each {event
    ) \8 b% `  q1 m  Y
  2429.           event.start
    0 e7 \/ X0 L+ n* N
  2430.           $area_responses.delete(response)1 ~0 r- f( R5 l8 U% P; C
  2431.           return0 U" A/ u  I/ e, j
  2432.           } 7 f3 {5 u* m% C! w3 Z
  2433.         end
    ) O! o, y# p( p' y
  2434.       when 4  k. Q& h, ~( A+ z* B6 }5 ~4 z
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,! }* q! M& y! y2 ^. A4 Y8 X
  2436.             (oy - $game_map.display_y)  32, width, height); c) P! g4 J& b+ D/ v, a; z4 t3 e
  2437.           $game_map.events_xy(ox, oy).each {event7 ^3 t, u9 a. e* i/ I) k- f
  2438.             event.start
    - C  [: Q- V0 ]$ w$ x8 [
  2439.             return
    2 x( ]# |% R; p! X$ O; T$ A
  2440.           }
    - d* D2 l1 _+ U3 Y9 ?4 O
  2441.         end
    * {( S3 m; ~+ F& Z
  2442.       end( @( ~  {' w8 {$ p* x) k3 m9 T
  2443.     }
    . L! m% t+ T9 E0 P" F$ S. s1 Y( M
  2444.   end& J# P% D0 v# k. S, r: z
  2445.   def mouse_in_area(ox, oy, width, height)
    ) S# q. W! Q: r2 G1 r; _0 D
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&, t9 V. ]: G/ v, M. A
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height
    1 ]% x  a! D" i0 X5 L$ p; z2 Y4 j
  2448.   end
    0 d+ _: B9 u2 M( {
  2449. end
    ; ^. {8 F; B) q9 b9 i  y+ P
  2450. class Game_Interpreter
    7 W; L0 Q, V1 B% ^
  2451.   def area_response(arg)) h9 u' s6 n# q& d5 k
  2452.     $area_responses.push(Area_Response.new(arg))+ k4 y, k5 {6 U+ W( D3 U+ ~# c9 S
  2453.   end1 b* V3 g: Z" V4 v+ E! a. p) g5 t9 @0 i
  2454. end, _  M. j$ m2 S1 _4 ]! R) |
复制代码

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

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

GMT+8, 2025-7-21 05:12

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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