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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    $ ~3 K5 i" i# u9 c
  2. % c, p, Y1 ~0 p! e
  3.   Sion Mouse System v1.3e" k6 A; _7 N+ ]  u4 c9 C
  4.   
    9 C% }/ h2 L5 B! U/ X+ j. b3 v5 r
  5.   Changlog9 n$ L* z7 `# t8 J( i' Y/ j
  6.   
    ; m; s& P  z& K9 J* d' I
  7.   2013.4.21 v1.3f
    % D) w  s" [2 X) C" O3 V
  8.    
    " Q. a  Y. D5 V1 I! H8 R
  9.     1.3f 卷动地图 bug 修正
    # `2 k" t8 |$ z! ^; G
  10.    
    9 U/ }( \* ~9 H  D2 X
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口7 ]3 N& |% Y' y' Z
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内
    9 w& S3 N, P* y
  13.                               Mouse.unlock_mouse_in_screen 解除锁定0 H9 \- d9 C5 k0 x- j. G. M

  14. 4 R* n% t; q, L2 G+ I1 _: E
  15.     1.3f bug修正# B. w! B5 t. s% c1 k9 G; U7 ?
  16.   
    0 ?" D/ y3 j! {5 s8 d  M. a
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及; g3 Y) T1 \- B/ H
  18.           关闭菜单时,鼠标是否移动到原来的位置。$ y2 R9 a' T! h2 G$ I
  19. & s' M) S% G& C) ~! Y& W
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处
    - V; d3 ^: c% E% g' C7 i1 }6 [
  21. + X6 [- ]$ I6 c7 C! n
  22.     1.3b 修正一些罕见的bug;
    * z) M0 F5 z- x4 f, ]  E" |6 {
  23. 3 e6 a4 x$ d0 ^
  24.     1.3a 代码小修改;
    2 H! W0 s; x2 Y+ k; m
  25.           加入了鼠标点击启动事件的功能,) b8 }3 M( j. X/ ?, N
  26.           在事件中加入“注释”: 鼠标启动  ,
    : v' N- X; j2 p4 Z6 {% r
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    1 v/ b3 N+ ?% Z  e9 W. I$ t# ^
  28.   1 B( W+ q' V# T+ J; C
  29.   2013.2.12 v1.2, \3 u7 K. F; O. N, H5 A  M
  30. 6 y* |) s, O* w# n: c3 L
  31.     寻路逻辑优化;3 |2 s* k4 ~+ i- I( r  ~7 d
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;
    / B7 j7 Y1 M& N! J; A# H: O
  33.     现在支持用鼠标来操作载具了。( K2 ~, r7 u4 l; v  j1 ?

  34.   e: ^6 Z6 h( C
  35.   2013.2.8 v1.1
    " z" ^  `' t2 O7 L% |

  36. & e: {8 l5 C6 C. t1 M! y3 b
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    - M3 n. I5 x  w% e1 v9 q, X( q6 q
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;: |$ H6 @6 }$ c; T) z
  39.     移动时,路径指示点的绘制更加稳定;6 U) }8 \( y8 Q% o
  40.     现在支持默认存档画面的鼠标操作了。; n7 {% h2 o2 k

  41. / T# i9 m0 {: R8 N$ r6 `& j
  42. - c6 {9 q( e" C4 i* m( [1 ?
  43.   OrigenVersion1 J4 ]2 F& ]! C" F
  44.   7 d& U$ G/ M+ {- H1 C0 j
  45.     2013.2.7 v1.0 / {6 G& d, q& ^+ @
  46. 7 ]8 N# h1 ~* w/ V
  47.   主要功能
    . o3 A' b9 H7 s  S
  48. 7 _* y) B  M5 y" U" |6 c
  49.       使用鼠标进行各种操作...( E# L0 b) Z% J# A+ H  I4 m
  50.       将鼠标锁定在游戏窗口内6 P& B& V$ o1 y" S$ r% k
  51.       自动寻路,按住 D 键可以扩大寻路的范围
    9 a( R6 F& g1 g& U
  52.       双击鼠标进行冲刺9 @. k5 ?/ T" i7 a( m" ~9 g' z
  53.       更改地图卷动方式以适应鼠标移动( S, K! {' }6 B8 {' N! z. [3 a8 H1 w" |
  54.       变量输入框改良4 ]' c3 I' Q! Q0 ~9 t. M

  55. 2 W, t% f% x) j& C/ W6 e
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹4 C+ X3 o# Z( K! O

  57. ) ]0 ~, y9 v$ {* j! @  K- M, u
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹" t) Y) H2 G; N( F
  59. 0 s, k" Y3 d9 @
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭, a! f, R; }' ]2 Y' Z4 u( `
  61. $ n* m# g3 j; K& i

  62. 5 k( b8 a, K& d  B6 m6 e1 u
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★5 \. f7 P7 |. D- F( R; p$ _

  64. 9 N' `+ B1 l+ L, Q$ J
  65. ( E) u" }3 _& E
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示) S1 I' \5 R* U1 P  |1 ~0 l1 n7 p

  67. ( {- j: \8 G8 N
  68. #==============================================================================% ]# D2 N) {) M
  69. # ■ 常数设置 5 o' a! m: d7 `/ d. V0 ^/ t% A
  70. #==============================================================================8 I! C8 w& z  K* j9 p8 O" O8 o
  71. module KsOfSion3 }! r5 P. B; U/ I- y) q
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false3 Q/ A2 H* l9 T. l5 u
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑
    . M5 a3 w5 v/ R, N+ _8 J
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    0 v  J: o  L/ b0 T! @  n
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量4 J" X0 R* ~1 Q+ W( z0 |
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    ; H5 K7 i' Z4 u
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧
    ( s6 I) U' h2 E3 F9 Q& i- e
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)
    ) E1 a, `/ b& B! G, D& Y2 W- K1 e
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键9 ]7 K, q1 J, c2 ~# Z, [
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)1 H( l; V! ]  \, ]- R
  81. end
    7 e4 |: y5 |8 g0 N' d& o( Y
  82. / w6 b# J/ w# A% M! @' a0 _3 N; }
  83. #==============================================================================
    % m/ \/ B) _- I5 v
  84. # ■ 用来显示路径点的类& ^' c8 C7 c, T2 m, [
  85. #==============================================================================
    ! \3 x# d9 p7 ?& O
  86. class Move_Sign  Game_Character2 y8 q4 h. _4 I0 h5 E9 W3 Z! w
  87.   #--------------------------------------------------------------------------
    7 M! C$ c% d( ^3 N$ q: A% X4 _
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图
    / l! j3 {- S% Y/ M
  89.   #--------------------------------------------------------------------------/ |$ h8 O8 M5 a4 ?1 w  e# \& f
  90.   def init_public_members7 T+ l' [* q# _* y# a5 e, ~8 U7 F  S
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹
    % g/ k' G! `6 J+ B) d1 z) r) d
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为00 o! I* l9 ~' J) m
  93.     @move_speed      = 5        # ★ 踏步速度1 t' @  ^* Q. v
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    5 I8 l6 K! N5 p7 N1 C7 e
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度- h' Y( _. G2 d+ ]6 H
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)
    ) I, M3 k) k, r1 n. j9 ?4 u
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列. x7 g1 `' K) I6 {( f$ R0 x0 R
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)! }2 [2 C& C/ t, T

  99. 4 ]+ ^. X4 b1 L3 Y4 T0 q: v
  100. / c, P, j& `! m; w: m/ d. ?
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★* q% f/ R+ G" u4 {

  102. ( S4 R( {) H5 l
  103. ' ~5 F. {& K/ @1 a; c" t
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图. M3 X2 \* N) ^
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')% h9 j% i3 X8 N' e6 H  {

  106. $ D3 N2 s" Y2 R( Y+ }
  107.       if $no_arrowpic_warn
    8 D' ?" H, ]# D) u
  108.         MouseShow_Cursor.call(1)
    $ a7 i, z1 f! [0 S) ^, r- L" m( u
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png8 I6 J0 q7 z: T; W$ H
  110. % c8 d5 W' o' U' f( @5 D) ^
  111. “路径指示点”将使用游戏自带图片! Q. T* E8 u4 b7 I% O' i6 C# Z+ t. @
  112. , d  J, w0 M7 f/ x# h. i
  113. 该提示可以在脚本内关闭')
    ; G- w3 O; V) B% O" ?& L
  114.         MouseShow_Cursor.call(0)
    0 c; X; M/ V  K; j
  115.         $no_arrowpic_warn = false- U5 {# b: r7 c
  116.       end
    4 t0 e  ^: p6 N8 }. \  k
  117.       @character_name  = '!Flame') s# n& f3 c( z7 h
  118.       @character_index = 6
    / t& |2 ]* i* }" j
  119. 3 W# h( n4 s/ \* O6 x9 m, ]1 ?
  120.     end
    0 I/ [: A. ^) n$ a5 @9 ~- |
  121.     @direction_fix = false  # 固定朝向
    & A* v, X( ?& l# f; U6 R
  122.     @move_frequency = 6     # 移动频率3 y8 i2 G: ]( \. N7 s' ?  ]3 p
  123.     @walk_anime = true      # 步行动画
    0 }2 S; P: I% N& [; N' `! b
  124.     @pattern = 1            # 图案
    5 o- N/ V% U4 Z- l
  125.     @through = true         # 穿透. G$ J* r- Q3 t- _8 }2 G
  126.     @bush_depth = 0         # 草木深度
    ) U; w, F& Y, f  D& T' B+ h% H
  127.     @animation_id = 0       # 动画 ID
    ) T! F; M7 E! f1 I
  128.     @balloon_id = 0         # 心情 ID
    0 q. c* H; e, r! i* O7 c
  129.     @transparent = true     # 透明- M9 \- n# F/ [) w, l$ y" U7 W$ e
  130.     @id = 0- B/ r2 ?- L1 V; ~' S; g) s
  131.     @x = 0
    " A+ J( M5 f* U) ]
  132.     @y = 0
    : t4 B# M& v/ x: H% ]! s
  133.     @real_x = 0# Q* B9 r9 x. b5 x' d1 T
  134.     @real_y = 0
    / i; _( M/ _6 E5 a5 ~
  135.     @tile_id = 00 @# |8 N' t" x8 b6 ]9 z! N* L
  136.   end
    ' z' p6 c) C4 W. @: u1 \1 }
  137.   #--------------------------------------------------------------------------
    ( m4 ]6 W; }: v: U
  138.   # ● 定义实例变量
    % h8 f9 C" T  Q4 g& K% u" B) w8 m
  139.   #--------------------------------------------------------------------------
    . Y6 p2 [, \" P+ g. p6 Y& `
  140.   attr_accessor direction$ |6 `6 A! v- ^/ i; a9 {/ v
  141. end1 \' r/ Q- r* U

  142. $ ?' l( ^. @+ r6 g" t
  143. #==============================================================================
    & r& y  B( ~$ |- t6 g: M5 a, {
  144. # ■ Module Mouse
    7 V- Z2 g. D1 I8 {9 k# j
  145. #==============================================================================2 f. m0 H; S) [7 Q4 d
  146. module Mouse# q$ W- l/ x  B9 f4 `) m3 W' A
  147.   #--------------------------------------------------------------------------' n9 @7 P4 s1 v3 |: g$ l& b! c  K2 Q
  148.   # ● API
    9 {$ K- \, v# G5 I
  149.   #--------------------------------------------------------------------------- P3 F0 w9 O4 P. C+ d6 W
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')- I  c( ~3 V  k# A; z# q& o# V& n) k
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
    * K$ m) |0 F9 G: g+ f
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l'); Z" [/ L( [/ B1 }
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')
    & [8 P; V" j1 ]) m$ ~4 b' J2 I
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')6 [% d: {; k6 {- t  ]
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')" w+ s; e5 r" ]1 Z
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')
    " i% h: ~; ~! _) n
  157.   Window_Hwnd       = Get_Active_Window.call. K. u! g" T2 N8 Q

  158. ! b1 H: {) a/ m
  159. class  self
    / _- L9 I& |5 a/ x" F' M
  160.   #--------------------------------------------------------------------------  q; b( h5 L. F2 n0 |, a
  161.   # ● 初始化
    3 t# P8 L  E& f8 s
  162.   #--------------------------------------------------------------------------& G5 ?1 w& V. G
  163.   def init  D6 b7 Y' r; W
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor
    6 \- p1 Q' M% ]" p
  165.     @left_state = 0" j9 W/ I( U2 U9 S9 O/ g0 A) x
  166.     @right_state = 0
    & Z4 {( [6 |: c# y% C2 d! H$ B
  167.     @ck_count = 0 # 帧数计,单击以后从0开始
    + s! `& {; o  o& s
  168.     @dk_count = 0 # 用于双击的判定+ v  Q. I; Y% A6 M  s
  169.     @clicked = false
    ) T. O0 X$ j  {& _( ~& Q
  170.     creat_mouse_sprite$ v& E0 E2 O% Q) r2 X
  171.     update- l% W" m) t2 {9 X) S7 I
  172.   end
    2 M, u& R) O/ K9 s! F$ s
  173.   #--------------------------------------------------------------------------
    9 X# ]5 e; a  R+ F: m' `# L6 b. {
  174.   # ● 鼠标指针精灵* _2 `/ |6 M) g: z; s
  175.   #--------------------------------------------------------------------------
    # K( s2 z5 G$ ]3 {2 }
  176. #~   def creat_mouse_sprite
    ; N/ @5 \- r" I( I
  177. #~     
    : ?  X0 {- n! g  L( ~
  178. #~       @mouse_sprite = Sprite.new
    6 o. G0 R7 }) o3 ^
  179. #~       panda = 2#rand(2)+1
    . M0 o( G. M1 j* N
  180. # C6 P1 ~6 P, V! m5 ?
  181. #~      if panda = 14 m' j* D  n" [& K- O: J) E
  182. #~        if File.exist('GraphicsSystemCursor2.png')
    7 d+ ?" E! U  g/ }
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    2 x2 G' \/ R# t& P% G
  184. #~        end#with if File.exist" {5 u3 F: u* J( H; G7 [
  185. #~   
    " P, m3 X% b1 z. V6 n  P
  186. #~     else if panda = 2 #with if panda=1
    2 Y+ K8 t9 r% S
  187. #~      
    , W5 d* S+ J2 |9 }! N  a9 W
  188. #~      if File.exist('GraphicsSystemCursor2.png')) g2 F! e* I# Y+ @5 g
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
    8 T9 u1 J1 c# ?  j  I
  190. #~      end#with if File.exist8 W$ G7 L, ~* m! W
  191. #~       & v  X$ }7 W$ |: \2 e; {
  192. #~     else #with if panda=1: g, p8 t# c, y, M5 P) u
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)
    $ A" |* j: `2 F( W9 p. E6 I
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),
    # d$ |; m  w2 P6 g6 t2 H4 G! _
  195. #~       Rect.new(5  24, 24  24, 24, 24))5 g! A7 F7 Q8 `# y6 K( E) _
  196. #~     end#with if panda=1. ^$ W: B! R/ w. H3 Q
  197. #~     0 ~1 E$ Z( [& ?$ K( [$ T
  198. #~     #with def
    $ f2 [  b5 H: ^7 c0 J
  199. #~   end
    0 o/ ?4 P$ U# h6 b4 r
  200. def creat_mouse_sprite
    % |( @4 d* T. T4 ?
  201.     @mouse_sprite = Sprite.new
    0 {$ \; F3 C+ U! H# M5 L
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1})$ y5 N( p" F- w" z
  203.     @mouse_sprite.z = 9999
    ! a% q' G. S* ?* c, U& Y* A& `
  204.     Show_Cursor.call(0)" n+ X2 A. g. x/ O2 Y) x
  205. end: o! _6 Z. V( N/ K

  206. , w! ?" m3 G+ n  v5 e
  207.   #--------------------------------------------------------------------------
    * |7 e9 d9 I+ ^3 L( D0 V. z
  208.   # ● 更新
    4 ~- P4 z8 h- j: D# Y
  209.   #--------------------------------------------------------------------------
    * m7 ]/ J7 F! W' S/ N& `5 A  o* R- ?- x
  210.   def update+ s4 u' @* S: }
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos
    / S2 k# \# i5 U+ X; p; _4 H
  212.     left_state  = Get_Key_State.call(0x01)& w" o) B! g! z, K; [2 m; Y+ L  j0 B
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0
    1 |& @  J$ K  U9 r
  214.     right_state = Get_Key_State.call(0x02)& [, H1 Q0 m: b4 ]. F: ?/ {& I" {" E
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0
    ; s6 [! J3 f/ u. [& n4 O7 j* g" D
  216.     update_double_click
    0 B: J1 w! o7 A1 B4 [9 V
  217.     @left_state == 1  @ck_count = 0  @ck_count += 10 u' J% X6 F0 v1 X3 Q
  218.   end
    9 b) l4 o6 `* T$ [0 \$ O
  219.   #--------------------------------------------------------------------------
    + Q( ?9 W: i  m
  220.   # ● 获取鼠标坐标
    # h0 H9 ?- p: [7 \
  221.   #--------------------------------------------------------------------------* T, q# y3 n0 J9 F# z3 O2 ^
  222.   def get_mouse_pos7 R' w5 U4 W8 S
  223.     arg = [0, 0].pack('ll')
    * E/ B2 c. H/ x5 c
  224.     Get_Cursor_Pos.call(arg): X* E$ v9 f4 N1 {' S# j' @3 _: C: V
  225.     Screen_To_Client.call(Window_Hwnd, arg)- O+ U  @3 Y  \& b# h
  226.     x, y = arg.unpack('ll')
    * [$ d3 F: G- M0 k" i
  227.     return x, y% T6 q& K5 ^0 ~4 P0 s
  228.   end
    # ^0 ^. ?2 M8 T- N2 S! l9 `
  229.   #--------------------------------------------------------------------------' M- x4 s% ^) m0 t8 I' `. _1 M+ c
  230.   # ● 将鼠标固定在屏幕内
    . ]; O) L' U0 W
  231.   #--------------------------------------------------------------------------
    6 V# {; i; ^; t4 `9 ]$ J
  232.   def lock_mouse_in_screen
    8 t6 f& D' m- Y/ {- u
  233.     arg = [0, 0].pack('ll')" R$ F1 y4 {8 i" _* s
  234.     Screen_To_Client.call(Window_Hwnd, arg)
    ! o+ @- m+ g( I4 Z# l1 }3 j1 Z
  235.     x, y  = arg.unpack('ll')
    4 ^; J; R3 M$ G# Z  H3 g
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))
    * ^4 I7 N# d3 ~" b% K
  237.   end0 z' @, ~% c. M. s$ Z
  238.   #--------------------------------------------------------------------------
    % N% g( d4 e" }
  239.   # ● 解除鼠标固定0 L9 L. W1 @* c8 T5 m; O# E
  240.   #--------------------------------------------------------------------------
    8 @; Z5 P+ S9 W' ?9 {
  241.   def unlock_mouse_in_screen1 X! ]$ `1 t! a& H
  242.     Clip_Cursor.call(0)
      @4 |9 z5 T* I5 p5 M3 t- s
  243.   end
    ( R3 s6 s7 T$ j* j) e- l& K! }# D
  244.   #--------------------------------------------------------------------------
    / ^5 a$ Y% A5 b7 ^5 ]
  245.   # ● 鼠标双击判定3 J# B$ _! N/ X  A# Y% y
  246.   #--------------------------------------------------------------------------& J; ^- S; Z  D* b
  247.   def update_double_click
    ) q7 e2 I9 ]% n0 Z
  248.     @clicked = true if @left_state == 1
    - y& M5 J6 e$ F1 J5 F3 g
  249.     if @dk_count  0 && @left_state == 1* z  K' W) D1 a& i
  250.       @dk_count = 0; @clicked = false: z' a* u9 I9 h* \  e  f
  251.       return @double_click = true
    + T, Q8 `. y! l
  252.     elsif @clicked
    + n# K; `" I0 C8 I* b8 q+ I
  253.       if @dk_count  KsOfSionDbclick_Frame
    6 }" m9 n' B+ u1 C$ J2 c6 z- e
  254.         @dk_count += 12 ^' X+ u$ K$ K$ u2 E) v$ A# X1 b
  255.       else; a+ S8 p( X4 [4 y1 h
  256.         @dk_count = 0; @clicked = false
    : L8 y; O, u8 p( c# I6 Y
  257.       end# K) l! w" {, ?1 o- d( l2 u5 W
  258.     end+ W' r: S5 j: D8 `& p' }
  259.     @double_click = false
    - i  @/ o2 i# L) A" ]1 {; v
  260.   end
    / U9 |- I6 s0 @; ?7 u
  261.   #--------------------------------------------------------------------------, D" _" d+ d6 m
  262.   # ● 按键被按下就返回true
    * X8 [! O" k4 ~+ X
  263.   #--------------------------------------------------------------------------( I: M- t) ^" n& x5 G8 B
  264.   def press(button)
    * I, a, r" Y* P; o
  265.     case button$ H3 `( D# e; y5 X7 A8 j/ r
  266.       when 0x01; return !@left_state.zero7 Y( _2 @$ _9 C, k  ?
  267.       when 0x02; return !@right_state.zero
    * s% ~9 i3 d; Y. c- R% ~
  268.     end
    " P% E, D/ w* O  S
  269.     return false
      |0 }9 D: ?# L3 Y9 B2 t
  270.   end
    ) g4 k, Q* o) c( ?9 r( @
  271.   #--------------------------------------------------------------------------
    ' O5 }4 {9 \- a2 z
  272.   # ● 按键刚被按下则返回true4 e. `5 P! ~% R8 b1 z, N% e
  273.   #--------------------------------------------------------------------------
    8 f: M; R2 R$ u
  274.   def trigger(button)
    $ A+ c$ u  I" c& J
  275.     case button, V# K% S$ P  t; R3 [
  276.       when 0x01; return @left_state == 1
    ; e' B$ G( y9 a) t% X1 G
  277.       when 0x02; return @right_state == 1
    ) Z1 C! Z8 L: j+ _
  278.     end
    ( e, S& }) ]5 ^. X: |  C9 ?6 F
  279.     return false4 V+ h! m0 v6 t. {; K' B
  280.   end- i. a. c6 X% j' {
  281.   #--------------------------------------------------------------------------: N- a$ C1 m  N. D" j+ Q
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true* q7 ?, w! |) a+ U  h
  283.   #--------------------------------------------------------------------------/ U0 l! X1 Q4 ?
  284.   def repeat(button)0 ~; L$ C9 S' C) [  \
  285.     case button6 B* n/ e* j; m7 @- u
  286.       when 0x01; return @left_state == 1 7 Z; C- i/ W; R1 R
  287.         (@left_state  22 && (@left_state % 6).zero)1 Y- H+ {+ }) ^2 c4 H) o" g6 Y
  288.       when 0x02; return @right_state == 1 ( v  {; ^$ }7 [% g
  289.         (@right_state  22 && (@right_state % 6).zero)
    , q: I6 j% @+ c! A
  290.     end2 V+ J* J- Y% X; r6 q; K# D
  291.     return false
    4 f" u9 D  `0 S: W1 a& D( G8 k
  292.   end
    # k1 D' S) ^8 Y) p3 T/ |# ~
  293.   #--------------------------------------------------------------------------
    0 y* q5 n4 `9 K4 h
  294.   # ● 判断是否双击鼠标- [0 K  ~- ]4 `- {2 r# q
  295.   #--------------------------------------------------------------------------$ x6 i/ g: N* q: j
  296.   def double_click
    2 ]6 I' o+ ]. y) a5 `
  297.     @double_click, F( B+ ^  ^  h1 ?" \7 K' E7 G2 A
  298.   end
    # ^/ E  M4 Z& e6 o. V, m, j
  299.   #--------------------------------------------------------------------------
    ' r& [8 c7 ~. h, n
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0). y. i4 y8 b  Z; O; M
  301.   #--------------------------------------------------------------------------
    4 Z! G! Y, V! t
  302.   def click_count
    ! E  Q' E$ {$ p
  303.     @ck_count3 t: ^; z  N* c
  304.   end
    ! y  N6 b3 J2 ?4 y' r$ R6 X7 |! |" O
  305.   #--------------------------------------------------------------------------  b* |* h5 t% e2 b3 q& @6 h
  306.   # ● 获取@left_state(按住左键每一帧+=1)+ h5 L$ y& d( @% S. W9 P
  307.   #--------------------------------------------------------------------------3 v  E5 r6 \3 H" I0 l+ ?8 n# U
  308.   def left_state; \- @' b; H6 Q: q
  309.     @left_state! u$ O2 N; R/ v1 G! j) J- w
  310.   end
    0 p% ?; N% A; }2 l  F
  311.   #--------------------------------------------------------------------------
    6 p( U  q' @( ^  r3 Q1 j
  312.   # ● 获取鼠标的x坐标
    ) n$ U+ M# _# a5 y/ @  q* u
  313.   #--------------------------------------------------------------------------
    ) s$ a  T- w" O  v3 V; d7 O
  314.   def mouse_x
    + U9 ~6 L( `" k4 x) g# Q
  315.     @mouse_sprite.x
    ( q+ T5 W, h( R
  316.   end
    . n' L; H- ]# F
  317.   #--------------------------------------------------------------------------
    , t; l( w) ~, B% L, l: {
  318.   # ● 获取鼠标的y坐标/ I3 L: u0 d. M" y9 b
  319.   #--------------------------------------------------------------------------
    5 _: Z/ x2 G2 {- W
  320.   def mouse_y( u) H( P% {9 X
  321.     @mouse_sprite.y
    8 u/ |* K1 t( q! `! v/ v' H- Z
  322.   end  i+ N" A! G9 a) v% U' ^
  323.   #--------------------------------------------------------------------------3 O- v  O; V' S) ]5 [
  324.   # ● 设置鼠标坐标1 P6 p$ k$ w9 G
  325.   #--------------------------------------------------------------------------) C0 E; D# v: @" g: N
  326.   def set_mouse_pos(new_x, new_y); [, r6 i- w$ K
  327.     arg = [0, 0].pack('ll')
    6 E6 g' [8 W' r6 }
  328.     Screen_To_Client.call(Window_Hwnd, arg)5 w# {$ E4 v( w) H5 h# ]( l7 N4 d5 d
  329.     x, y  = arg.unpack('ll')# \5 h0 Y  L% w6 {; o; g  P
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    ' F& z( t% C* _  ^9 u: t/ x4 u
  331.   end% K6 Z/ l7 T5 ?+ ?+ g0 ]/ ]- w
  332. end #end of class  self
    0 W2 H- A) d& |2 D

  333. . d4 {& p( T9 [5 {$ V' O7 ]
  334. end. D0 g3 I6 e( L5 i( t. U' v. ^

  335. $ @4 {2 z" S9 }- \- x' {
  336. #==============================================================================8 L/ W/ S+ Y  C, T( `" m; |
  337. # ■ SceneManager
    + N8 Y% k0 M9 Y$ i
  338. #==============================================================================
    # U  Y# |' @% _/ ?  s; H+ x7 k
  339. class  SceneManager
    2 `3 W' e: ^/ F. D
  340.   #--------------------------------------------------------------------------# a& [) ]4 b, ]6 m7 s& i' u+ V. H) r
  341.   # ● alias
    & [+ t& K4 a( R6 X
  342.   #--------------------------------------------------------------------------
    1 e  G- O2 m6 u$ d- t) [" A
  343.   unless self.method_defined(sion_mouse_run)7 L# ]+ E  N  t( ?2 X3 m
  344.     alias_method sion_mouse_run, run
      N) ?, n1 l  A# Q$ i
  345.     alias_method sion_mouse_call, call+ M2 S2 v) h$ M( ]8 D
  346.     alias_method sion_mouse_return, return+ d! W! J: X4 l* ~- A" [2 p* Y- {$ j# Q+ A
  347.   end
    * \' r# {$ X# a7 M
  348.   #--------------------------------------------------------------------------) `9 r1 j/ a: L, u" n2 g) j
  349.   # ● 运行
    / S" C2 \) F7 d  C7 e0 P* c
  350.   #--------------------------------------------------------------------------' E' @$ P1 L! M9 ^* S6 B
  351.   def run% N9 E+ L$ q# h: k6 l
  352.     Mouse.init
    1 f; e2 m( U1 C
  353.     sion_mouse_run! z; u5 x1 Q9 H" J) @" J& I! y
  354.   end& T% m( S4 t* P* c! M: C; c$ p
  355.   #--------------------------------------------------------------------------% c$ [2 P, @8 p. B
  356.   # ● 切换
    5 T+ t# k3 X" H% X* c. s
  357.   #--------------------------------------------------------------------------
    2 z" C6 `  c$ g
  358.   def call(scene_class)
    ) K! I7 S6 _7 h  X- ~+ R
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)4 X2 t0 Z4 s- s$ Z/ Y) @
  360.     sion_mouse_call(scene_class)
    % c7 {! a( ?( p. i$ W
  361.   end3 e! y. q# p, X; H" I5 P5 a1 U
  362.   #--------------------------------------------------------------------------
    " @; `% O& X2 e/ Y' |2 I. `
  363.   # ● 返回到上一个场景
    2 m3 E5 N* Q+ _+ X6 l
  364.   #--------------------------------------------------------------------------+ G: w3 n: h4 Q1 D) m6 s8 W
  365.   def return& W& m3 y: s9 e
  366.     sion_mouse_return
    : R8 l6 T9 L9 g: a' y2 b
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&( p* ~0 W% Y" n3 C) x
  368.       @scene.instance_of(Scene_Map)
    ' z2 n- Q6 u. r5 b! G" E% N
  369.   end
    : t3 X, d! n1 h9 {
  370. end
    6 G9 u& u4 I9 h; c5 c8 E; J

  371. ; |- |8 {/ q+ O. \+ N) |
  372. #==============================================================================
    : r' @+ l1 b3 j& E& b9 @
  373. # ■ Module Input! e' I& O. w. J3 B, B- G
  374. #==============================================================================
    % y2 m( O. h: ]: ?* P9 s% H0 I
  375. class  Input
    ( [4 B9 N8 o- T  g. U' V0 m( \# j
  376.   #--------------------------------------------------------------------------
    ! Q6 f; D7 D; C+ I! T+ N
  377.   # ● alias
    0 u0 A' K4 g6 z& ^3 c7 R' P' j* I
  378.   #--------------------------------------------------------------------------
    8 ^  W; x/ n' h, |5 |
  379.   unless self.method_defined(sion_mouse_update)
      |  v& _. K1 U- t5 h* u; n: J/ v
  380.     alias_method sion_mouse_update,   update$ Z9 }! M9 V  C$ _5 E+ @9 ]- A3 `
  381.     alias_method sion_mouse_press,   press: `; X6 E* d" g5 E8 M- t. ]! f
  382.     alias_method sion_mouse_trigger, trigger
    ' ~& r5 m# Y3 O0 m. b: z
  383.     alias_method sion_mouse_repeat,  repeat! l8 [, a8 j" D" S& A/ a) n; d
  384.   end
    ; m: v+ v: P) L# ^0 x2 n. v3 |7 y  k
  385.   #--------------------------------------------------------------------------
    & m7 [, G4 T. Z+ c
  386.   # ● 更新鼠标
    ! i% d1 f2 l1 u5 Z# j0 E$ k+ H
  387.   #--------------------------------------------------------------------------) }3 e( i, c- D
  388.   def update
    1 Y3 k* m/ L: s
  389.     Mouse.update. a4 \1 N4 ~7 Y% f
  390.     sion_mouse_update6 M4 c+ h* w# V2 A9 S9 Z3 V& F
  391.   end
    8 b( p! g& f" O
  392.   #--------------------------------------------------------------------------: z5 w" r$ l! b% n4 z$ e% ?1 j
  393.   # ● 按键被按下就返回true7 z- j% X3 k# g; t
  394.   #--------------------------------------------------------------------------
    8 e9 q, \+ s8 N" }
  395.   def press(key)
    0 m" p: x; e( z; U. b7 N7 x+ l( y
  396.     return true if sion_mouse_press(key)
    + L7 }- u# ~7 n1 n8 N7 g4 \5 J
  397.     return Mouse.press(0x01) if key == C  Y1 m! F- L$ u# b
  398.     return Mouse.press(0x02) if key == B
    $ t! d( r% m! ?: A$ J0 `2 p: ?& o/ P
  399.     return false7 {9 F; N9 u7 ]6 J
  400.   end& N1 _2 J  Q) B% h  G
  401.   #--------------------------------------------------------------------------3 z6 D( O, [7 C; k  u
  402.   # ● 按键刚被按下则返回true! F/ r* L2 E4 M( z% F
  403.   #--------------------------------------------------------------------------# T$ |& u% c0 h) v
  404.   def trigger(key)
    % b7 t/ o  O+ D5 Q4 {
  405.     return true if sion_mouse_trigger(key)
    ! w9 V( ?7 t* ^9 B( E& f. U
  406.     return Mouse.trigger(0x01) if key == C
      k  E. W1 f+ `* C. S. S
  407.     return Mouse.trigger(0x02) if key == B
    + C+ L  L+ P. V5 W3 Z5 g! f9 O
  408.     return false
    1 ]6 A. ^6 G! D
  409.   end
    % H9 L3 g5 [* C, M8 t
  410.   #--------------------------------------------------------------------------
    ; S6 }* m$ _3 l$ ?3 P( I( `' O
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    5 o5 O% X/ @% c. V5 X
  412.   #--------------------------------------------------------------------------
    & i  r! c' w, I9 \! Y6 u% G
  413.   def repeat(key)7 ?9 M+ W4 u6 k& R4 {- n" h
  414.     return true if sion_mouse_repeat(key)
    3 [% K: S: g" ~( q; L: P. t* i# }
  415.     return Mouse.repeat(0x01) if key == C# v& `' u" Y6 s& D. m* m# E
  416.     return Mouse.repeat(0x02) if key == B
    ) ~. i+ S' o/ s% ^; p2 x% k9 ^
  417.     return false
    3 D3 ]: [$ b/ L# K
  418.   end& H4 c3 {2 C$ L/ M, f4 a
  419. end
    * C& O; [( |/ ?  i4 g* D
  420. ( h/ B. H, ]  ]0 O6 N, m; T

  421. 4 c* X4 Q) f6 u& k9 u0 c
  422. #==============================================================================, T: ~" ]; d/ i) P: S% ]
  423. # ■ Window_Selectable
    1 s4 ]. V" i$ ]0 x# j7 _- a) x# b, {
  424. #------------------------------------------------------------------------------
    9 _/ V1 L7 h$ s  M1 N
  425. #  拥有光标移动、滚动功能的窗口% |, t% u8 }+ C5 L2 m4 {% {
  426. #==============================================================================
    ) s9 J& q3 `  {( i
  427. class Window_Selectable' {0 o5 x) U# z! i, S% i& s  A% w
  428.   #--------------------------------------------------------------------------
    * t' i- t" W& @6 K6 G" Q' V8 H0 _
  429.   # ● 初始化0 E! J8 J: S% I. w7 u+ K8 F
  430.   #--------------------------------------------------------------------------
    * l6 ~+ }# u, {6 F8 f( o
  431.   alias sion_mouse_initialize initialize
    ) Y1 V3 j, X( R
  432.   def initialize(x, y, width, height)
    - {8 {. m7 G. S. R
  433.     sion_mouse_initialize(x, y, width, height)
    ( O8 ~" w5 s, r( g( A& T
  434.     @move_state = 04 x/ W8 ~8 u) [9 ]
  435.   end
    1 u5 T% z3 ^* g' P- j8 t$ a& F
  436.   #--------------------------------------------------------------------------  }, q  ?1 i: y- J  n5 N
  437.   # ● 更新
    % ^; R$ E  s" Z0 c
  438.   #--------------------------------------------------------------------------! L& y1 D+ a2 B" y# G
  439.   alias sion_mouse_update update9 u- }: `) x  Y7 G* B; l3 F
  440.   def update4 I* p+ N2 T, u" W, J+ \7 j
  441.     sion_mouse_update
    & P2 R5 q$ k+ {& r# x6 a
  442.     update_mouse_cursor8 @4 \& A& j( @* ?0 H; @
  443.   end
    4 \' d( D9 y! ^; d- L; r
  444.   #--------------------------------------------------------------------------; J* q! F% n3 B* n6 ~+ j- Z0 B
  445.   # ● 启动后设置鼠标到index位置
    4 p) h7 A2 c" K  p
  446.   #--------------------------------------------------------------------------( T/ T! l+ s1 C
  447.   def activate, e% e$ B3 `' \3 n8 }% D
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos# b8 E+ I" L" G8 i- ^7 p& \6 U
  449.     super5 e/ T/ C7 w9 ]* g
  450.   end
    5 h+ I/ P! [1 e/ W# ~
  451.   #--------------------------------------------------------------------------
    8 Y; ?! w  A) B" D6 r+ e
  452.   # ● 更新鼠标和光标的位置
    . X# y2 C* U" G, \: ~1 f: R+ O" h
  453.   #--------------------------------------------------------------------------9 c4 H' p5 u3 G! x
  454.   def update_mouse_cursor
    + i& d. ^: p9 a
  455.     if active
    * g6 k% m! z) d* C4 F
  456.       if @need_set_pos
    - _* R) z% E! g
  457.         @need_set_pos = nil
    5 X8 x% m! k2 N9 Q$ e* F3 i
  458.         set_mouse_pos
    4 b1 F( M( K& a3 x. m% i2 L
  459.       elsif cursor_movable
    5 [, j2 g4 ~3 t! H, H
  460.         Input.dir4.zero  set_cursor  set_mouse_pos/ |; a& N" k' y& C% L
  461.       end
    # Z7 n" ]% I+ c* H. [: W* {
  462.     end2 U6 e+ I8 }9 j, a
  463.   end8 o7 C( N9 W0 R* b: K# l, J" s
  464.   #--------------------------------------------------------------------------
    ( h, B& o! ]; L. X; L1 i$ ?
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能
    0 P6 p4 M- O2 D
  466.   #--------------------------------------------------------------------------; i$ C, K0 y: J2 v# W
  467.   def set_cursor
    ( c( o7 d  c4 M% C/ a/ S; ]
  468.     mouse_row, mouse_col = mouse_window_area. b9 ~( i7 r& j1 _- s0 ?( V( u9 Y: i
  469.     if    mouse_row == -1
    9 X5 |/ \* t. l6 t6 S; r9 b
  470.       @move_state += 1 if need_scroll
    " v* H* P: P5 T/ u
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand
    ( j# s" p6 ]  \% ]/ K, H) M
  472.     elsif mouse_row == -2' n4 `7 o2 x% ?# M$ V4 \+ v
  473.       @move_state += 1 if need_scroll
    , D5 K2 e' z. g% s) v8 e
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand6 i1 [0 X4 H7 L$ ^7 ?8 i9 [( J, T
  475.     elsif mouse_col == -1+ w2 ]8 W: m" V! @! b& L% W* I1 X; G- _
  476.       @move_state += 1 if need_scroll( [/ ^8 S% _6 M; b" a
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand+ R. A: i+ m, r/ C- x" c; K3 s8 v
  478.     elsif mouse_col == -2! K, E0 {* W5 Q, M3 E
  479.       @move_state += 1 if need_scroll" H' l+ w  g. o
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand! L& U( w2 `) f
  481.     else2 _1 u/ J! f/ H
  482.       @move_state = 0
    7 ]% Y/ o3 V+ O& d3 g& \
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col; c4 U0 X( Y4 m, p# B: f5 P
  484.       select(new_index) if new_index  item_max && new_index != @index" F9 }% |+ o( g% |# c
  485.     end6 k, y0 z. W; G& O4 n. ?0 k0 K% n
  486.   end
    + ^7 Z/ w% O) A0 l
  487.   #--------------------------------------------------------------------------
      L1 _' k6 x$ J2 ^" I
  488.   # ● 判断鼠标位于菜单的第几行、第几列2 N( M0 [2 v5 E
  489.   #--------------------------------------------------------------------------
    : J2 ~% W3 A9 k# [3 Q
  490.   def mouse_window_area
    7 Q$ p( A# W/ n% {5 O3 f
  491.     if viewport.nil # necessary!. W& o9 B" |# k0 _  e
  492.       vp_x, vp_y = 0, 0# W% w9 H2 [4 v! B/ C
  493.     else
    * m2 B/ ?8 D# l: Q
  494.       vp_x = viewport.rect.x - viewport.ox
    1 {5 Y7 _5 t% q' z5 R
  495.       vp_y = viewport.rect.y - viewport.oy% v& p: G. o  z. c; ~( z
  496.     end' `, l) Q1 v) u: w* ]. F) X$ @( {
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
      y4 ?4 E& e* V9 ^  F. z" P0 d
  498.     item_x1 = vp_x + x + standard_padding
    9 V& q7 f+ W$ M" ?
  499.     item_y1 = vp_y + y + standard_padding: i9 q5 n3 T* m0 a
  500.     item_x2 = vp_x + x - standard_padding + width
    $ ~( [$ [: N+ s+ L3 |$ H* D
  501.     item_y2 = vp_y + y - standard_padding + height/ |6 w7 h+ M8 g
  502.     if mouse_x  item_x1
    ) |1 [  z; R! G! @# T
  503.       mouse_col = -12 [4 S9 e5 f4 z% N- D- B
  504.     elsif mouse_x  item_x2
    * e: t) P9 n! K9 E
  505.       mouse_col = -24 r' p* }9 c2 e9 ]: s/ c+ z
  506.     else
    6 ]2 V- b3 j, R* d; i/ v
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1)- ^: I' P" [  a* O' ^
  508.     end
    1 w% |& [5 X' }( Q) j. F
  509.     if mouse_y  item_y1
      J9 L( D4 L- G7 ]* P
  510.       mouse_row = -1
    ! n2 }. t. m  n" Y
  511.     elsif mouse_y  item_y2  {& @. {  E' D0 a% Y% H& r5 c
  512.       mouse_row = -2+ K6 ]5 O. q/ u% x1 N
  513.     else. ]: p' c$ U1 H' k6 z& q4 u/ |* g
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    * O1 B' k4 o: v5 `, _& C, G
  515.     end
    0 _; @5 m6 ]# C7 d! r& f; W
  516.     return mouse_row, mouse_col
    5 l) @6 b$ c; M; m- H# v) n
  517.   end2 J5 a3 h% m+ K' D; q8 L
  518.   #--------------------------------------------------------------------------: }2 _$ b- o; Z* ~  r4 ^+ i
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    . g3 R8 K! e' K* |) R
  520.   #--------------------------------------------------------------------------+ `1 M7 ~$ W  A
  521.   def set_mouse_pos$ t/ L1 q# W( y' g. S0 V$ ?! {
  522.     if viewport.nil # necessary!
    ! I3 P& X1 Z8 v2 F
  523.       vp_x, vp_y = 0, 0
    0 O$ A: Y+ C  j. L: i7 `
  524.     else
    # ~/ I! Q) Y3 l5 W8 B- W- ?+ x
  525.       vp_x = viewport.rect.x - viewport.ox5 f$ Q! U) N- H
  526.       vp_y = viewport.rect.y - viewport.oy
    # X: g& R. ~, Z4 W( R% y: q( I
  527.     end
    8 U. Y6 ~9 j! b! @4 I4 u% A0 O. v2 z  t
  528.     item_x1 = vp_x + x + standard_padding
    : Y0 W$ D7 e- i! A" \
  529.     item_y1 = vp_y + y + standard_padding; t3 @5 Y; Q2 p( E7 r7 ?
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index ! W. e. K  _. L
  531.     row = get_index  col_max - top_row
    ) ]+ R, V( |. Y& }" n) ^+ ]
  532.     col = get_index % col_max2 ~: K- a, }' P6 v
  533.     new_x = item_x1 + item_width  (col + 0.5)
    * O$ _3 N& M& p- R# K3 m: u
  534.     new_y = item_y1 + item_height  (row + 0.5)+ H. ^3 {( N- r3 _: F5 b
  535.     Mouse.set_mouse_pos(new_x, new_y)
    7 B  p# T9 u6 O
  536.   end
    $ v8 C. R7 l  u+ j" K
  537.   #--------------------------------------------------------------------------& I1 h8 J3 ?7 x* G( A
  538.   # ● 判断菜单是否需要卷动
    ) K( w) }( X" F# `
  539.   #--------------------------------------------------------------------------
    $ t4 b+ z/ i7 |) y  d3 @
  540.   def need_scroll
    3 O6 Q$ F2 _. ]- C* [: l* W6 s' s6 N
  541.     item_max  col_max  page_row_max
    , M7 C. h% Q+ J1 _% w
  542.   end9 ^- t$ B$ s4 _6 \' X: y- \& x' Y
  543.   #--------------------------------------------------------------------------8 E8 i' [. b* d3 e: h  ^
  544.   # ● 判断是否为水平卷动菜单
    7 b' t$ Q2 ^8 l6 m
  545.   #--------------------------------------------------------------------------6 i% s2 S* t5 ^9 p* Z3 p& V# y
  546.   def is_horzcommand0 s3 P: Y5 G! E1 W6 F6 w; M9 p4 ^
  547.     return false
      F6 P: u+ B; g, A6 j
  548.   end8 ^$ T5 Z) {( B  z  P
  549. end6 {) ?' m$ I/ E$ w

  550. 8 b$ m1 ?+ S) l2 m" _2 u8 y
  551. class Window_HorzCommand( m( n7 J( ]: p1 y6 K
  552.   #--------------------------------------------------------------------------
    ) h' d$ }* l, P; n
  553.   # ● 判断是否为水平卷动菜单& q7 H. S$ b8 p  E% T
  554.   #--------------------------------------------------------------------------: M5 N/ S+ a9 S9 w, I
  555.   def is_horzcommand
    % H* A% h  j& k
  556.     return true: o9 g* o) a; V. m
  557.   end
    : h- y& y6 j9 @  u
  558. end
    , l9 y) Q' _9 G6 y5 b' d0 m, v  ^& r

  559. 9 B( }/ `+ j6 B. Y: n! [8 P8 z
  560. #==============================================================================
    1 q+ p( k9 z3 J$ N! j1 X
  561. # ■ Window_NameInput
    2 ]8 }7 v% c( A6 U7 j
  562. #------------------------------------------------------------------------------+ g. F. `  [8 u2 |3 d
  563. #  名字输入画面中,选择文字的窗口。
    2 {8 c1 z* U, N
  564. #==============================================================================
    , x6 \3 b7 S* V" q. _* M
  565. class Window_NameInput4 ?9 t1 Y8 H. b% l& ]
  566.   #--------------------------------------------------------------------------  c2 a5 r! X7 L
  567.   # ● 设置列数& L: \. N( L6 d! @1 u& K& _4 }: j
  568.   #--------------------------------------------------------------------------
    8 O6 v/ L0 P, ]  \, t
  569.   def col_max
    # |& o. H, E: T' F) V! u
  570.     return 10
    ' J# Z5 K4 Z. m6 L
  571.   end% A1 M. v' O; v, L; U
  572.   #--------------------------------------------------------------------------. e2 ^: d# V4 C$ D& b
  573.   # ● 设置填充的Item个数
    - M$ r/ B' \+ Z  y+ J% x4 Z
  574.   #--------------------------------------------------------------------------
    ; E6 C6 }4 e5 N9 l$ l6 X
  575.   def item_max7 s8 J5 F+ R3 B5 C6 U  X' _6 h& s
  576.     return 90$ p$ q! }0 n; P; n+ E- `
  577.   end! e* v: N$ |3 j- A5 A) x: k
  578.   #--------------------------------------------------------------------------; {/ ~2 G; a, x- x& e
  579.   # ● 设置填充的Item个数
    . `( u  j2 s8 j' f: _
  580.   #--------------------------------------------------------------------------
    5 m1 \& D* h! [$ K0 R& `
  581.   def item_width$ o$ H# R. H# b
  582.     return 32
    9 T: E$ b; M$ r- g* @  D( V) r
  583.   end. a/ z& P; ?" W
  584.   #--------------------------------------------------------------------------
    6 F$ i; e0 g3 e; ~9 M, a8 U. z+ l
  585.   # ● 判断鼠标位于菜单的第几行、第几列
    4 E! h% l3 ^9 h3 @) O' C- W
  586.   #--------------------------------------------------------------------------' l3 _' {& Q$ O$ ]4 B
  587.   def mouse_window_area
    & j1 G0 t2 Z& f
  588.     if viewport.nil$ o, e/ c+ l8 u" P. ?/ c5 H" c
  589.       vp_x, vp_y = 0, 0
    # O3 |& m) L# v  d* C
  590.     else  F" Z4 n( U* T# P  l, e
  591.       vp_x = viewport.rect.x - viewport.ox
    + x, ~7 H- h, e
  592.       vp_y = viewport.rect.y - viewport.oy; A3 O# Y5 ~- u; b
  593.     end7 v7 v5 d; ]" x! V% A' N- c' J5 J
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y$ _) \. ]2 `5 k8 T: j
  595.     item_x1 = vp_x + x + standard_padding
    7 d& r, O. E7 J/ H) E* W0 g8 R
  596.     item_y1 = vp_y + y + standard_padding; B0 b* n- }3 t2 ^) ]4 }4 z  D
  597.     item_x2 = vp_x + x - standard_padding + width
    4 |' Z' y$ @3 I' X) Q" X0 d
  598.     item_y2 = vp_y + y - standard_padding + height, a6 y3 a* `) G8 A- p7 Q1 p
  599.     if mouse_x  item_x1$ ^+ X7 B+ u1 |% i* Y1 h; [
  600.       mouse_col = -1& c2 R+ b+ N; U) W3 B
  601.     elsif mouse_x  item_x2
    2 E& Y. ~" ~' q! P1 K! \
  602.       mouse_col = -2
    ( i* F% q' n0 }- p
  603.     elsif mouse_x  item_x1 + 160
    3 h. a" H& I$ f+ q( l4 i
  604.       mouse_col = (mouse_x - item_x1)322 q; K$ L3 y6 v- \2 K# f3 v6 P' s( K4 R
  605.     elsif mouse_x  item_x2 - 1606 e  ]5 I7 s5 E  c. k: ^% B; I6 r
  606.       mouse_col = 9 - (item_x2 - mouse_x)32
    , u6 R0 M0 W6 [. z
  607.     else
    % N) U/ D3 m5 J
  608.       mouse_col = mouse_x  x + width2  5  4
    9 c; ]6 M/ @3 h( C, J
  609.     end
    : o9 ^1 O' d; {  d! ?' q
  610.     if mouse_y  item_y1
    % r9 V: ^* L  o2 \
  611.       mouse_row = -1; L" S0 F5 r, w4 l& }
  612.     elsif mouse_y  item_y2
    / {# S; `: Y. M/ T. ~! k- ^
  613.       mouse_row = -2
    # \7 S2 @9 h& |3 I
  614.     else/ F- O0 k9 I% Z" k* y
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)0 S" w/ g" f' Y6 y; ^* c2 ^4 @
  616.     end
    ! t$ v. U; `' L; Z# F& Y
  617.     return mouse_row, mouse_col
    & v2 R/ |! y/ c3 a' }+ i
  618.   end$ ^3 c  {0 p3 S2 M2 E4 Y
  619.   #--------------------------------------------------------------------------7 u" n0 P, }" ^) t, @
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置' G* g1 _7 ]" j7 N% j4 N5 Y
  621.   #--------------------------------------------------------------------------
    ) ]: k. O8 i& [3 t4 X; O& L
  622.   def set_mouse_pos
    * v2 b7 F0 u! x! a& ~& a
  623.     if viewport.nil # necessary!" y6 X7 _# w( {; n8 L- x& J5 v
  624.       vp_x, vp_y = 0, 0
    " A8 |7 D# `( x/ V/ z' W
  625.     else0 W4 \- G  F0 N+ G/ Q1 W; g
  626.       vp_x = viewport.rect.x - viewport.ox
    " b5 t5 ^$ u( J! [' h
  627.       vp_y = viewport.rect.y - viewport.oy" b8 k" E) u8 k" h; j! X+ q
  628.     end+ r4 d+ x9 V8 @- ]9 z1 t
  629.     item_x1 = vp_x + x + standard_padding
    3 `# Z$ [9 ^$ Y: o4 a
  630.     item_y1 = vp_y + y + standard_padding- ?, u# O' H' N3 `
  631.     get_index = @index  0  0  @index
    / q5 T8 V0 x0 M. l9 m
  632.     row = get_index  col_max - top_row
    % b5 B- m  K1 {: J
  633.     col = get_index % col_max. v) W5 N! S/ |& B6 v+ n2 J
  634.     new_x = item_x1 + item_width  (col + 0.5)1 D+ U% |7 ]1 k' ?
  635.     new_y = item_y1 + item_height  (row + 0.5)
    4 x, S$ g* n9 `! q
  636.     new_x += 14 if col  4
    ) N( M, }9 s3 S  P/ {6 `& _% C
  637.     Mouse.set_mouse_pos(new_x, new_y)/ _+ t; H, y1 c9 Y( ^0 y1 j8 b
  638.   end7 P8 q" {3 Q4 w# C+ B: \$ ^/ ~: L! g
  639. end7 a3 t* Y9 d0 |% [) }9 ~
  640. 8 n$ x* ^- A  p
  641. #==============================================================================
    ( S2 M# J; \5 j
  642. # ■ Window_NumberInput9 K2 m1 I! R. T- H
  643. #------------------------------------------------------------------------------
    ' }8 v. l% i+ e1 y8 j, i" ^! R/ d3 ]- s
  644. #  重写了数值输入的方法以适应鼠标9 B/ U# Q$ |: ~: n; q# x% ]
  645. #==============================================================================1 d" S6 Z* P) p0 W9 t
  646. class Window_NumberInput  Window_Base
    + H3 v! ~# J; _7 j  E
  647.   #--------------------------------------------------------------------------
    # Y( P2 x$ v/ [# m
  648.   # ● 定义实例变量; N, L8 v5 {" W1 C. x# g. f3 ~
  649.   #--------------------------------------------------------------------------; N& d! L0 C+ x( _
  650.   attr_reader extra_window' d. A# X. N5 L7 t6 e9 k4 g! R
  651.   #--------------------------------------------------------------------------
    & |" t9 D; N$ @
  652.   # ● 初始化1 O/ j# Z# q" V/ v& H9 H( s1 u* [* e
  653.   #--------------------------------------------------------------------------! }* [; B0 X% B) Q/ o+ J8 h# _
  654.   alias sion_mouse_initialize initialize8 D# o8 T, r. K+ I9 M1 ^# ?
  655.   def initialize(arg)
    6 ?* p5 }( ]- f  Q
  656.     sion_mouse_initialize(arg)
    ) O6 s3 T. @% x/ j. l7 {: d
  657.     create_extra_window; X8 M* L/ b' o* K" F) v' `
  658.   end2 J6 ^8 {, l5 g( i, i6 j
  659.   #--------------------------------------------------------------------------
    4 E) n) `5 K6 R: ^3 D
  660.   # ● 启动$ n+ ~- a+ {' W
  661.   #--------------------------------------------------------------------------8 Z# L& U) O6 u5 h
  662.   alias sion_mouse_start start
    ! n4 k! n1 q% r/ O
  663.   def start
    , B4 X6 F5 `! [. ~! |! V
  664.     sion_mouse_start
    5 m6 ]1 M! f' G; u6 I
  665.     deactivate8 m, j& R& D: t
  666.     extra_start: \2 c5 m# Q2 v& F$ d
  667.   end$ ?& ?2 A! y0 A. g5 K( O  x0 d! S
  668.   #--------------------------------------------------------------------------: W5 f) A6 [; ^( B0 G. M4 c
  669.   # ● 创建新的数值输入窗口. {5 P' P/ K) p, I
  670.   #--------------------------------------------------------------------------! G) R7 v& y( M" ~" t
  671.   def create_extra_window
    + I' I, m: r0 |- u! C: H. Z9 |
  672.     @extra_window = Window_NumberInput_Ex.new
    6 `/ e& J& A* _
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  2
    ) [" O% D; p' I! f" Y0 F0 M! T
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }
    & c/ j4 D2 ~/ I1 ^8 d
  675.     @extra_window.index_proc   = Proc.new {n @index = n }6 a/ U' u. ~% z0 ?4 i: b4 s
  676.     @extra_window.close_proc   = Proc.new { close }
    9 S* x3 p! v- B( I
  677.     @extra_window.refresh_proc = Proc.new { refresh }. [. U/ n/ |6 ~9 p3 Q2 o
  678.   end) a+ ]) M( ]6 q. P  M) D5 u
  679.   #--------------------------------------------------------------------------2 H! r* R- W' d2 @- E
  680.   # ● 激活新窗口
    4 R. k: J7 _, N$ y" c" y2 S
  681.   #--------------------------------------------------------------------------# v) S, j6 |+ K& k4 R) X
  682.   def extra_start$ |- ^6 v' `, E6 i( g9 g
  683.     case $game_message.position
    5 r2 Y* v% }9 x% a" \1 N4 a3 f
  684.       when 0; @extra_window.y = y + height + 4# c  J0 t/ t, W6 K& v
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8' T3 q! F* v+ J+ N: [
  686.       when 2; @extra_window.y = y - @extra_window.height - 4# C/ s/ T: F1 ]0 o8 Z
  687.       else  ; @extra_window.y = 8: c3 O) M& c  B& h5 f
  688.     end
    . ]) P: A+ x7 c2 M( g' U
  689.     @extra_window.variable_id = $game_message.num_input_variable_id
    ! s* f8 [% ^7 J0 N/ L- Z
  690.     @extra_window.digits_max  = @digits_max9 m0 g/ K$ I; j* D2 U2 w7 [- y* P* w
  691.     @extra_window.number      = @number
    : l7 w1 t1 Y+ o3 `7 d
  692.     @extra_window.open
    & R$ e! }5 U! x/ w2 d/ P9 {
  693.     @extra_window.activate
    ; {1 O. ^. C2 n" Q
  694.   end1 y. D% ]6 D+ K( n- E" z
  695.   #--------------------------------------------------------------------------1 j7 Z1 r) s/ F6 ]/ a7 k& S( z
  696.   # ● 更新
    " z% ~: s+ O- y6 l
  697.   #--------------------------------------------------------------------------
    ( d. t% n+ @; c5 A. v
  698.   def update
    . ]9 T$ w4 X. B: b3 G
  699.     super6 a! X& Z" K% ~0 V( J( }6 |
  700.     @extra_window.update4 ~' x9 J6 \6 O' }) v; J+ J( Z. R
  701.     update_cursor
    - ?  E6 B" ?: ~/ G# Z
  702.   end
    , B2 c+ ~  |: ]7 p7 J2 J' @" I9 T
  703.   #--------------------------------------------------------------------------
    $ V) r" I) M; X5 C3 ]
  704.   # ● 关闭窗口
    ; `  q8 q; n( z6 b. {
  705.   #--------------------------------------------------------------------------
    9 V5 z3 f/ f* K2 M: i( y
  706.   def close6 {& J/ q$ ?3 n
  707.     super
    , d8 F) K! X; q( }5 D* d& @
  708.     @extra_window.close
    $ Z) s* H8 e2 v
  709.     @extra_window.deactivate
    2 i9 ^- p: F9 ~
  710.   end( m5 J( J* o- j7 m9 c1 X
  711. end
    2 _. E- n# D5 _

  712. . r9 E3 |/ V+ F" }9 e* U7 s4 Y% l
  713. #==============================================================================
    / T& }/ F; m8 B) q+ @
  714. # ■ Window_NumberInput_Ex
    * b7 O; z, {4 z" q# w1 V0 v& ]
  715. #------------------------------------------------------------------------------
    0 p3 ^5 @- I2 m8 a
  716. #  新的数值输入窗口(NewClass)
    : G! R2 V9 o( t: c# _1 \) Z; r
  717. #==============================================================================
    5 A% t4 K0 }5 I. j4 L; m; R2 v
  718. class Window_NumberInput_Ex  Window_Selectable
    ) Z+ m) c3 E/ {  d
  719.   #--------------------------------------------------------------------------- r" Q. i' J  r' X. y& T
  720.   # ● 定义实例变量" T* }4 ?6 Q2 T0 g/ I% d$ ^
  721.   #--------------------------------------------------------------------------1 Q6 S5 x! a7 M, m' M6 P+ S+ \# m
  722.   attr_accessor number_proc0 K# A5 Q8 ^, s. s8 T. g! J
  723.   attr_accessor index_proc
    : l# m7 w0 P, [: F% O1 \( Y
  724.   attr_accessor close_proc. q% K0 V/ n, e, g
  725.   attr_accessor refresh_proc% |: z! b8 ~* _+ ^  o
  726.   attr_accessor number; q, f- {! `" p+ k% Z' R5 H( l# X1 H
  727.   attr_accessor digits_max' S0 |% x" ^5 j7 V1 _
  728.   attr_accessor variable_id" n7 _2 p( O/ e1 B7 c7 k1 i& Y
  729.   #--------------------------------------------------------------------------
    9 ], z0 u, t# K( r4 I
  730.   # ● 数字表$ y& k! `+ X0 w- r& i2 ^
  731.   #--------------------------------------------------------------------------
    - t5 W% E9 y' c3 z7 L
  732.   TABLE = [  7,  8,  9,
    5 d; Z1 ~2 Q7 ?7 X- a' V
  733.              4,  5,  6,7 Q) l1 H/ g$ F4 e; V
  734.              1,  2,  3,4 }! }5 z2 V  e# t' s- z
  735.             '←',0,'确定',]
    ; T" j$ L2 i- f* H
  736.   #--------------------------------------------------------------------------
    9 Y9 O$ H4 B0 ~, W
  737.   # ● 初始化对象
    . W; S8 T: x; [: v' g- d
  738.   #--------------------------------------------------------------------------' W4 ]2 m  M6 j% z
  739.   def initialize
    / R) y+ O1 y( K( q& t" q
  740.     super(0, 0, 120, fitting_height(4)); D" }0 b# K! d3 E4 Z% p7 X
  741.     self.openness = 02 q' J8 b# c1 ~) s
  742.     @index = 0
    + f3 w7 x2 U/ N# L
  743.     @number = 02 ~8 f. c" r! q- y: [
  744.     @old_window_index = 0
    % Q) l' w8 L  c) M, j! z) B
  745.     @digits_max = 0! e/ |9 ^0 E4 |" X: M' F
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }/ T9 c3 P4 J* ~; D- s
  747.   end) W" P1 f7 `, O" q2 S
  748.   #--------------------------------------------------------------------------
    ( }  c% m7 ?5 W# f9 z0 U# C
  749.   # ● 获取项目的绘制矩形( i& T1 ?% }$ s  @/ q# R3 u/ k+ c
  750.   #--------------------------------------------------------------------------
    ' L$ @; ?* g$ Z# O: k6 d/ p* }
  751.   def item_rect(index)% F, {. e) P% N# K" K' P
  752.     rect = Rect.new
    / r. P6 d+ W7 r. |# }4 b+ n
  753.     rect.x = index % 3  32
    , p$ S& X6 ~# h0 @: ~' X7 l
  754.     rect.y = index  3  line_height
    8 A; q, n( b' p5 P: \* W3 |( `3 M* X
  755.     rect.width = 32
    0 g$ `0 |3 D1 S" B4 E. y$ O
  756.     rect.height = line_height, ~8 E; C+ Y. ?! T& m; K
  757.     return rect7 ?% i, I# t4 U$ H, T( s
  758.   end
    . Q* o" M2 X4 u, U
  759.   #--------------------------------------------------------------------------# u- D/ I! l/ L9 M
  760.   # ● 将光标设置到鼠标所在的位置
    . Y0 T7 d* w( G7 [
  761.   #--------------------------------------------------------------------------
    ! X1 h4 G' ~3 ^5 i
  762.   def set_cursor# n- f" m$ ^- Z" s
  763.     mouse_row, mouse_col = mouse_window_area9 T5 W( U: Z1 W, N# q) X% ~7 B( [
  764.     if mouse_row = 0 && mouse_col = 0
    4 b, N2 f- t1 ?
  765.       new_index = mouse_row  3 + mouse_col
    3 h: \% O5 Z) w6 x
  766.       select(new_index) if new_index = 115 f$ b* u3 p  }: ]9 q* O0 }% @$ q
  767.     end) t0 e3 m0 D9 L$ `
  768.   end
    % g5 h7 [2 o* z; g3 a
  769.   #--------------------------------------------------------------------------4 R9 L  a: O) U+ J% C; F7 I8 Q
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列. i$ U+ X) G. k+ N
  771.   #--------------------------------------------------------------------------
    , n. D8 n) p$ @& a7 g
  772.   def mouse_window_area
    * A1 g$ N* r/ d" k, Y
  773.     if viewport.nil
    + c  V2 u- k. B! o
  774.       vp_x, vp_y = 0, 06 J5 N; m. a+ G
  775.     else
    . [" |0 q7 L; X4 h2 j( h
  776.       vp_x = viewport.rect.x - viewport.ox
    " S8 c; z  X7 E; N4 @
  777.       vp_y = viewport.rect.y - viewport.oy
    ; o+ l, L# U, n2 n8 \  B% m; O
  778.     end
    4 i9 N! }: ~& z- k( ~
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y/ F6 ^4 V+ {  k2 F9 z, M
  780.     item_x1 = vp_x + x + standard_padding
    & I/ E: f- P1 Y( ]/ J! [+ O) }
  781.     item_y1 = vp_y + y + standard_padding
    ! h  V2 a' b0 r# U$ j
  782.     item_x2 = vp_x + x - standard_padding + width
    6 }! E- E- ~- m+ }8 l  }' X
  783.     item_y2 = vp_y + y - standard_padding + height
    1 V' a: X/ o( p9 n: i3 S
  784.     if mouse_x  item_x1
    . X% V+ L  }: t1 K/ E+ E/ d" Y+ x
  785.       mouse_col = -11 b9 Z4 w9 D  V4 r* r- p
  786.     elsif mouse_x  item_x2
    4 `: J: J! F3 s: x9 _
  787.       mouse_col = -2/ A; d3 ^9 V( `6 t! z+ m
  788.     else
    ( f7 v3 m3 G' \( e' N
  789.       mouse_col = (mouse_x - item_x1)  32
    2 n) a- K: Q- S5 m8 [7 H5 s
  790.     end
    # A8 ^: B  e9 _1 f/ `' c: z; e
  791.     if mouse_y  item_y18 l# B. p- F  V+ Y  `) L
  792.       mouse_row = -1- ^: _8 @: X& T1 j1 s
  793.     elsif mouse_y  item_y2
    $ j: ?* W# n/ r6 I- L1 x- B0 z
  794.       mouse_row = -2
    , p2 Y  ?: ~. a9 `5 p
  795.     else" W9 [9 k& B3 z' r# C' S9 M' o
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    & \4 h  b) J8 G; \0 E1 Y
  797.     end8 x  d% R3 L2 r1 k& v7 }; {- H
  798.     return mouse_row, mouse_col
    8 [  A. o& W. X6 t. E9 `
  799.   end
    3 x( ^9 |- A; e' h; y
  800.   #--------------------------------------------------------------------------
    - ^! H6 ?+ L) M9 G4 u
  801.   # ● 获取文字
    1 K4 v% N5 j6 x! x4 l- Q
  802.   #--------------------------------------------------------------------------
    - t# T, C$ P4 J: I2 [8 o: p, O
  803.   def get_number+ l8 i3 c  f: i: R) c$ C
  804.     return false if @index == 9  @index == 11* X1 h+ ]  H$ W& G8 r" x
  805.     return TABLE[@index], E, \4 b) _' E" [
  806.   end0 X  S2 }' {# n- T
  807.   #--------------------------------------------------------------------------6 a2 S) G0 k. P* g) q
  808.   # ● 判定光标位置是否在“退格”上4 V+ C# v+ i6 d1 C- s4 q; I
  809.   #--------------------------------------------------------------------------; E- ?' H" B/ \8 _  f$ V9 I$ t( e& i1 }
  810.   def is_delete
    - C+ n" O. J- e
  811.     @index == 9
    ! k* c0 Q. {6 U' v8 p
  812.   end
    8 P; F- N! _9 n
  813.   #--------------------------------------------------------------------------/ a) f6 D4 g) m2 s" ^$ B( W
  814.   # ● 判定光标位置是否在“确定”上
    . X+ J* L1 W* n9 |
  815.   #--------------------------------------------------------------------------
    * s! ]3 O) W, z' N
  816.   def is_ok
    0 ?. D  S) g+ y( Q
  817.     @index == 116 s+ V7 A4 Z. p' q6 F! H( K% ^
  818.   end
    8 c; T' ?/ }6 _4 J( h" L, Y/ g. ?
  819.   #--------------------------------------------------------------------------
    9 s1 @) i* M1 z: C8 _9 }
  820.   # ● 更新光标
    3 ~- Y: N* k/ {
  821.   #--------------------------------------------------------------------------" v  t7 Y. j9 I# b# \# q/ U7 N, D' y
  822.   def update_cursor# L  n& K$ V- A
  823.     cursor_rect.set(item_rect(@index))' w& B. G/ D2 H' n4 K4 c8 t
  824.   end
    3 Q* {& V( \8 t* Y
  825.   #--------------------------------------------------------------------------
    . C& R! k- d( r2 ?) F! n
  826.   # ● 判定光标是否可以移动
    & W% j0 F( h  E$ L
  827.   #--------------------------------------------------------------------------
    ' U* D! j% N9 s3 W/ {! m( _6 O
  828.   def cursor_movable; c1 x6 z$ O7 |8 T( m/ X
  829.     active
    8 Z! f7 J7 R+ J% e. f
  830.   end/ D9 Y& ?0 |* i2 F- v- T( G
  831.   #--------------------------------------------------------------------------
    0 S( [& }: S6 P7 E0 ^4 \7 J1 N
  832.   # ● 光标向下移动
    5 t# X+ e) ~( D: p$ V4 I& L9 @
  833.   #     wrap  允许循环+ q6 J$ y# ^! L  n# R
  834.   #--------------------------------------------------------------------------
    ; S7 t2 o* H7 J; _- k# ?
  835.   def cursor_down(wrap)- ^9 W7 s* Z/ t) f9 z5 h4 X
  836.     if @index  9 or wrap
    . i+ n4 {5 v8 f: U: |6 L8 y- t( [/ y5 i
  837.       @index = (index + 3) % 12
    ! K0 n7 Q; h( k: Y
  838.     end
    & r  T* T! Z" I
  839.   end( ^: G4 x  Y( W# p; e: z) ]
  840.   #--------------------------------------------------------------------------' ~# l" @4 t8 e# D
  841.   # ● 光标向上移动
    4 ^) K( \+ ~/ |% ?7 d, V$ }, {) A
  842.   #     wrap  允许循环
    ' d) v  P9 T+ v+ {; H
  843.   #--------------------------------------------------------------------------) c5 D  M# |, x# k$ n' }
  844.   def cursor_up(wrap)
      w; z8 r/ Q, L
  845.     if @index = 3 or wrap3 O' P& s7 b5 K/ I
  846.       @index = (index + 9) % 12
    & c7 g, `: [: E4 `2 Z3 z
  847.     end
    % J( H5 S, O9 x$ h3 J
  848.   end+ o8 |+ A( i3 W9 p
  849.   #--------------------------------------------------------------------------2 h: d1 b' j- P
  850.   # ● 光标向右移动- E. ?- z- Q& K$ }" s- E
  851.   #     wrap  允许循环
    ( z) O0 j8 e; y5 B# J
  852.   #--------------------------------------------------------------------------
    5 `9 D2 A+ c0 E+ O
  853.   def cursor_right(wrap)4 u( }2 h+ f0 O! W# b8 Q6 @* }# H
  854.     if @index % 3  2
    : c2 A4 ]2 S1 S5 X( k2 s
  855.       @index += 1
    . t) d- {0 ~$ k9 n* c
  856.     elsif wrap
    8 R: f* d$ L2 S
  857.       @index -= 2. I' o, t2 i8 l5 ~3 \+ E, p+ f1 j
  858.     end
    5 S3 x5 G+ o' [; f5 A3 ?$ M! b' `
  859.   end
    7 n3 ]+ g3 Z& O9 {, m4 q
  860.   #--------------------------------------------------------------------------7 O1 d. {1 N& U
  861.   # ● 光标向左移动& [9 f4 q  y6 X( h; L+ c
  862.   #     wrap  允许循环; U4 b* Q+ |9 B4 o
  863.   #--------------------------------------------------------------------------
    , U$ N  ]9 R1 `& T
  864.   def cursor_left(wrap)2 f9 X3 z: Q* p! u- }
  865.     if @index % 3  0
    ) J; U! M, Y) b0 [6 m. a
  866.       @index -= 1
    - H% p4 z+ ~/ U- j8 A
  867.     elsif wrap
    2 h0 h% j7 F1 v5 T3 P. A
  868.       @index += 2! A+ l# b# l' O2 j$ P
  869.     end
    0 w8 H7 y# v2 y3 P* b: c& @; H
  870.   end: [6 ~6 D& I* A, g+ @, _
  871.   #--------------------------------------------------------------------------! T4 Y3 P9 F' x6 y/ B" G
  872.   # ● 处理光标的移动
    ; h) R. t$ N& D
  873.   #--------------------------------------------------------------------------
    / L) X" n  z, t/ M3 t
  874.   def process_cursor_move
    2 u3 C4 |# a8 o; P
  875.     super
    * Q& i/ a. n/ Q+ J
  876.     update_cursor5 t- ]$ Y4 Y& R9 M! s& G
  877.   end
    & O  x5 o9 r$ I' d, Q7 A
  878.   #--------------------------------------------------------------------------
    % N& S& G+ R" w
  879.   # ● “确定”、“删除字符”和“取消输入”的处理& _% l' W; @; E& V& L/ _
  880.   #--------------------------------------------------------------------------  L  Q/ a8 i; k( l+ v
  881.   def process_handling
    1 I7 w+ j6 O1 A- N8 I
  882.     return unless open && active
    $ ^+ }' S% `8 S1 G$ ^' E, V
  883.     process_jump if Input.trigger(A)
    . C( ^2 n1 e: h% l' V
  884.     process_back if Input.repeat(B)) x+ N, b( R9 P6 L7 W$ W- E
  885.     process_ok   if Input.trigger(C)( O. u- ?7 ?% b( t9 j, D$ i
  886.   end$ t) G, S2 a+ h* S- h- H
  887.   #--------------------------------------------------------------------------
    8 _3 Y' n# }# f( Y! }
  888.   # ● 跳转“确定”
    4 R: h9 |( \' w4 J
  889.   #--------------------------------------------------------------------------, ]* b9 d+ _* q  c0 j
  890.   def process_jump, e( p3 d$ f9 k3 K
  891.     if @index != 11; P- x0 V9 e. D: M" h2 o
  892.       @index = 11
    4 L- S$ M( e" _/ R3 V
  893.       Sound.play_cursor3 O+ d" p9 C' ^
  894.     end
    1 h+ Z) {5 O$ j
  895.   end
    7 v6 @+ A8 R& Q4 {
  896.   #--------------------------------------------------------------------------
    ' p. a* N# i8 n8 L. c
  897.   # ● 后退一个字符
    7 C! ^; `' a6 I
  898.   #--------------------------------------------------------------------------) H' q7 F+ L( v$ F$ i* @
  899.   def process_back
    - X* V) M+ i0 E4 k- c2 f" L5 X
  900.     Sound.play_cancel+ w4 x. l$ ]+ e" }' K
  901.     place = 10  (@digits_max - 1 - @old_window_index)
    & D: ~3 f/ u( i. }3 l( T
  902.     n = (@number  place) % 10
    " ~4 }: Y8 f  o, \5 k2 U; t4 [" D
  903.     @number -= n  place. ]* T6 F. F4 o* _* n3 L" {
  904.     @number_proc.call(@number)4 P: x- e, [  T' r1 U, g
  905.     @old_window_index -= 1 if @old_window_index  0' j& j: }! c/ V/ `$ f
  906.     @index_proc.call(@old_window_index)1 s8 C5 `3 s% }
  907.     @refresh_proc.call
    . w, ]6 v6 z' K3 l4 b
  908.   end
    4 N  k0 n. V: Q6 W* E0 J! o
  909.   #--------------------------------------------------------------------------" _. j' p* |$ }* H
  910.   # ● 按下确定键时的处理7 [5 p. G! |( ]9 P4 i3 r8 }
  911.   #--------------------------------------------------------------------------
    * P, |2 u2 F- U1 T
  912.   def process_ok
    8 F: t5 J: M% z2 ^$ h* U
  913.     if get_number
    9 _0 Y' ?6 K: v- x* P, u
  914.       Sound.play_cursor
    4 U# S- [6 F& z+ A9 Z/ L$ W/ j
  915.       place = 10  (@digits_max - 1 - @old_window_index)
    / n' f% {' u2 J5 z* L) C2 Q7 J
  916.       n = get_number - (@number  place) % 10) M* I$ a' M) D: k$ i
  917.       @number += n  place
    5 I% i$ W3 D: d# `
  918.       @number_proc.call(@number)
    2 _& m8 F9 s) p2 h: J% s
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 1( e% a1 W4 m% H) e. L# {
  920.       @index_proc.call(@old_window_index)) S% A- A) e4 k2 ^' g( \, m6 J
  921.       @refresh_proc.call; \3 V( U) [% S
  922.     elsif is_delete
    # T# e# z" v# [2 P! `4 z; Z, b8 I
  923.       process_back
    2 @5 M2 E* i2 |
  924.     elsif is_ok
    ( e5 C' P: U! \& N" Q" Q2 H
  925.       on_input_ok# l9 t1 E: q5 j/ k( L1 V+ f; q
  926.     end
    . m/ E2 h0 k! }3 o3 n$ ^
  927.   end7 F: P5 l9 G5 C
  928.   #--------------------------------------------------------------------------+ Z, ~% @+ w, o" V
  929.   # ● 确定
    & g. {+ d( M2 u1 v/ m) f
  930.   #--------------------------------------------------------------------------
    ; ]# R4 p5 B# Z( V1 M, O
  931.   def on_input_ok
    - q4 l8 a9 ]# u3 n& C- _4 ~
  932.     @index = 0/ \, S/ H# L+ ?5 ^
  933.     @old_window_index = 0
    % K/ [1 J) M1 ]. P
  934.     $game_variables[@variable_id] = @number% I; a: {/ s4 S
  935.     Sound.play_ok7 K- W0 [; a- @( t3 q0 \% H
  936.     @close_proc.call
    ' [  U% w: U1 |7 t* M6 l& k
  937.   end8 h9 Z! }$ ^! l) C5 U9 P, M
  938.   #--------------------------------------------------------------------------
    7 G7 p* S) F2 F  d  r
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置" o# E6 x. _8 H9 ?$ L, x" j+ @
  940.   #--------------------------------------------------------------------------
    6 |7 G& @. y" b$ I
  941.   def set_mouse_pos8 o# J5 M6 L4 F5 u; {" r9 h
  942.     if viewport.nil # necessary!
    , P$ A8 R- y( }! T# [# C, Z" m& r5 |
  943.       vp_x, vp_y = 0, 0
    7 l3 u+ A( l+ J& b
  944.     else( Y9 M1 Q: H, t2 X- A# u
  945.       vp_x = viewport.rect.x - viewport.ox& u" ~- T# z* p; x5 S8 |
  946.       vp_y = viewport.rect.y - viewport.oy" c) y) W- T3 q4 e6 r7 ]
  947.     end* I  T+ M+ R* Y0 v6 l# `
  948.     item_x1 = vp_x + x + standard_padding
      B+ D  B7 ^9 ~
  949.     item_y1 = vp_y + y + standard_padding" x) T& m5 ]: b6 v) {
  950.     get_index = @index  0  0  @index
    , E/ V9 E- x0 {7 z* h0 [6 H% V- y
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)/ N+ }* \1 i# W  f( ]5 i
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)9 I. g' T9 J- o' E2 F# g$ v' v- {
  953.     Mouse.set_mouse_pos(new_x, new_y)
    , L3 l" f' z* b: W! i
  954.   end
      L" Q0 A' @2 {3 b& h
  955. end
    ) c, q$ f' u1 F5 N7 g# }8 X9 r

  956. ) ]% W  l# ~! ~- Z9 `+ P
  957. #==============================================================================( \" m3 W$ t2 Q: e: N  o
  958. # ■ Window_Message
    ) ~4 y& H6 O- D' c+ v" m# F: y3 V
  959. #------------------------------------------------------------------------------
    + n: u. s3 N% L6 S) }
  960. #  显示文字信息的窗口。
    + Q$ W6 K0 z) g# ~9 H
  961. #==============================================================================
    ; P9 E1 C7 S- G+ @# S( r
  962. class Window_Message  Window_Base
    * u# h5 M& F. m6 c0 L4 d
  963.   #--------------------------------------------------------------------------
    5 @) j0 p+ i* B4 w8 F7 m
  964.   # ● 处理数值的输入(覆盖原方法), T6 M/ [% C, f+ r
  965.   #--------------------------------------------------------------------------
    " j( u# N/ b& q# p; e: o  F! Y
  966.   def input_number0 @+ d' j$ U- s" ^2 M
  967.     @number_window.start8 J* |! D, h! g# B
  968.     Fiber.yield while @number_window.extra_window.active1 X3 |+ Q3 c( l* M- e
  969.   end0 V) U5 R  h7 ^8 t9 i& z
  970. end
    6 z  F9 V! _: g- Z4 C7 D* m  x
  971. / `: ~, T$ h, l' w# G* ]
  972. #==============================================================================& q- w/ |6 }( c& {. ?
  973. # ■ Window_PartyCommand$ f1 b5 E% O  j8 x: ^
  974. #------------------------------------------------------------------------------9 b8 _$ b3 L. }2 J) e" A
  975. #  战斗画面中,选择“战斗/撤退”的窗口。! P7 {* y( L$ E  w
  976. #==============================================================================: Q) u% q% q* i; Q
  977. class Window_PartyCommand  Window_Command
    % A$ i4 P# w# V( z
  978.   #--------------------------------------------------------------------------
    ) S0 K4 z4 {: k
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置  u) v* U0 g2 {5 u) s7 j
  980.   #--------------------------------------------------------------------------  S& O3 z( [; ]& m0 T: u; H( Z
  981.   def set_mouse_pos
    0 U) B% A) @6 s- ^5 p6 y- _
  982.     if viewport.nil
    / w) j' E- `" R1 R
  983.       vp_x, vp_y = 0, 09 F  k; Z$ V- W1 M4 _+ n
  984.     else
    8 q: y  D2 k( I8 \# s: Z2 M
  985.       #vp_x = viewport.rect.x - viewport.ox
    ( _. e9 K+ z0 ^
  986.       vp_y = viewport.rect.y - viewport.oy3 y7 T  i/ @; r) x% ~+ m9 I' s
  987.     end* r: A3 Y4 T3 s; n+ }1 F" b+ j
  988.     item_x1 = x + standard_padding ! g5 i, z/ z/ \0 {: o5 W4 k
  989.     item_y1 = vp_y + y + standard_padding
    % D6 F/ Z, ]5 W9 e# k" @3 V
  990.     get_index = @index  0  0  @index
    1 T4 A6 n* u1 L5 ?7 c- l
  991.     row = get_index  col_max - top_row
    ) g: ~) t8 `2 q9 Z$ U" Y! d
  992.     col = get_index % col_max
      {0 ]4 N) z% b0 k7 S9 R
  993.     new_x = item_x1 + item_width  (col + 0.5)
    & M; X" P' k0 c7 `
  994.     new_y = item_y1 + item_height  (row + 0.5)$ r. W" s1 u2 ]: t* C& L
  995.     Mouse.set_mouse_pos(new_x, new_y)
    ) ?8 l: d7 b  I+ j
  996.   end
    & H7 E8 _/ H& R2 q+ p
  997. end) a# v. ~* U; e& v* w# @

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

  2225. 2 k' ^- y1 }4 ~' W/ h
  2226. #==============================================================================
    5 I4 v1 C' ]4 L! h+ w; g/ N
  2227. # ■ Spriteset_Map
      P$ t2 C7 W. j  _9 `
  2228. #------------------------------------------------------------------------------, K' {# ]9 @' a7 E
  2229. #  处理地图画面精灵和图块的类。本类在 Scene_Map 类的内部使用。6 d" y* w$ B; b" P& {6 F
  2230. #==============================================================================+ t) I7 w6 N+ E, n3 s  p( ?
  2231. class Spriteset_Map+ C0 {6 J( Q0 W  U# c/ l
  2232.   #--------------------------------------------------------------------------- q2 y  [' e/ v* R0 B" I" {
  2233.   # ● 生成路径点精灵
    8 E) c+ f+ c0 T6 K( s
  2234.   #--------------------------------------------------------------------------7 z: i: }& e8 ]* d/ r# @- G7 M
  2235.   alias sion_mouse_create_characters create_characters/ d. E' W+ ?/ n3 a: w9 t$ P
  2236.   def create_characters
    7 x$ t  Y& \1 M5 J
  2237.     sion_mouse_create_characters
    0 U' d1 C6 c, D, s
  2238.     @character_sprites.push(Sprite_Character.new(@viewport1, $mouse_move_sign))* `& y3 w+ u' }/ f" u8 S* l
  2239.   end
    * {7 I& p0 q( `: d
  2240. end
    1 S( a* Y7 V* J6 A
  2241. 2 F: J4 {$ N5 j& I, P
  2242. #==============================================================================3 ]1 s( K( w, ?" y0 B+ ~; Z7 d
  2243. # ■ Scene_Map' d3 x2 H  S0 e, {+ M/ S
  2244. #------------------------------------------------------------------------------; S  m9 J! c2 ]; s4 x
  2245. #  地图画面
    ! {7 s5 _; _! `! K; t7 I
  2246. #==============================================================================
    7 a* W0 P# k  A9 _# b: M8 O7 @
  2247. class Scene_Map  Scene_Base2 b2 x; X. w  [! x: y/ @6 B
  2248.   #--------------------------------------------------------------------------
    , b; }# f7 D0 A1 J
  2249.   # ● 画面更新
    ( _& n" C9 s7 m# a
  2250.   #--------------------------------------------------------------------------
    $ I$ v+ m3 v: n4 y. e: `% w
  2251.   alias sion_mouse_update_scene update_scene
    2 w' _; ~: g/ k/ }! Q4 u' G- ~
  2252.   def update_scene
    . K5 s+ s+ Y" ~* B8 P
  2253.     sion_mouse_update_scene& [# F6 ~  G' {: M
  2254.     update_mouse_action unless scene_changing2 P; S2 |* Q. ]! m4 P( y
  2255.   end
    : g8 ^( ^7 x/ g* L; I
  2256.   #--------------------------------------------------------------------------
    2 Y- O- C! _7 G9 u8 X, h1 |" W
  2257.   # ● 场所移动前的处理
    , X* z2 I0 ^3 D
  2258.   #--------------------------------------------------------------------------8 l. c/ W# m3 Q  a/ q1 j
  2259.   alias sion_mouse_pre_transfer pre_transfer6 l; g: B6 H: |$ k2 b
  2260.   def pre_transfer9 F7 L( Y, g# Y1 r9 K1 n
  2261.     $game_player.reset_move_path4 P7 D  x+ b' j( E5 W
  2262.     sion_mouse_pre_transfer% F& n% H5 J# p9 A! M1 _
  2263.   end
    - ]  x9 m( Z2 W8 |
  2264.   #--------------------------------------------------------------------------9 j3 ~$ m, [$ F* f) Q* ~
  2265.   # ● 监听鼠标左键的按下
    0 G# |0 N4 U9 g  i
  2266.   #--------------------------------------------------------------------------
    % ]# c! s" g; e! k8 u+ x3 L
  2267.   def update_mouse_action( l; l0 B3 C5 K* x8 F& o% H6 P
  2268.     $game_player.left_button_action if Mouse.press(0x01): i% l; C# N9 G) K
  2269.   end9 g. m% h: t6 ?: s) @4 L4 @- Z( t
  2270. end! {$ s* e& R7 q: k' B
  2271. : |) t: l0 C9 i; `9 S1 {* n+ n+ I
  2272. #==============================================================================3 L% V. T# B3 J5 e: K& e, E
  2273. # ■ Scene_File
    6 Y2 v0 Z0 S! q6 o
  2274. #------------------------------------------------------------------------------
    " |5 W- K) D1 c* l. u3 @
  2275. #  存档画面和读档画面共同的父类. V' j* O9 G1 e1 c+ Z! d( _
  2276. #==============================================================================
    ( G$ t* m9 I7 Y0 g8 Z1 p
  2277. class Scene_File  Scene_MenuBase
    8 f6 j" j! e5 H
  2278.   #--------------------------------------------------------------------------$ \% e2 J; |+ V/ v6 y
  2279.   # ● 开始处理
    , t& Y8 _" a$ j. y7 y9 a
  2280.   #--------------------------------------------------------------------------' |4 R9 f* b  j! O( X% p
  2281.   alias sion_mouse_start start
    $ A* i( B. `$ V+ r/ @3 G. q
  2282.   def start
    8 w) F% x( D% Q) c
  2283.     sion_mouse_start
    . A# }) }( J9 `. g; C
  2284.     @move_state = 0
    3 c0 o1 y1 n) r! Q" j. r7 K+ Q0 z' i( s
  2285.     set_mouse_pos8 w! ]& z2 j3 @9 N0 x. w. @3 a* p+ `
  2286.   end/ b. n  F2 W, W9 V! q
  2287.   #--------------------------------------------------------------------------
    ' o) K9 ~, K8 w, f! j2 H
  2288.   # ● 更新画面0 F+ x: A& u  k( r
  2289.   #--------------------------------------------------------------------------
    7 I, C3 b) u1 V0 x, |: y
  2290.   alias sion_mouse_update update
    8 h+ ?# W% C( H/ h& \4 y
  2291.   def update6 X* e, [9 P1 }3 `# C& `
  2292.     sion_mouse_update0 C! w/ D: O3 F1 [% s/ j
  2293.     Input.dir4.zero  set_cursor  set_mouse_pos
    4 I! Q7 Z% G  O6 f9 M0 `8 P
  2294.   end
    . z6 \3 u, {( q5 m( E8 p* w7 d
  2295.   #--------------------------------------------------------------------------
    ; G& |* |$ P9 s  |: t( k% i
  2296.   # ● 更新光标
    : l+ n( S4 q# J' h+ z
  2297.   #--------------------------------------------------------------------------& a: c6 t. I! l5 W+ ?- M# s
  2298.   def set_cursor# n' V: E9 j* F" F" X( N& S
  2299.     @move_state += 1; Z" z& t% {) `# v: x1 b
  2300.     last_index = @index
      \7 e- j" ]) W5 ^/ s* I" A0 C: g
  2301.     if mouse_which_window == -2( |* h% k1 a. k# o2 D$ H: v
  2302.       if (@move_state - 1) % 6 == 0
    4 S7 X3 @8 Z# E2 v( F$ N
  2303.         @index = (@index + 1) % item_max if @index  item_max - 12 {3 B+ a2 G- c1 q- U
  2304.       end7 ]( f5 Y$ h+ r$ N; r. f6 }( a
  2305.     elsif mouse_which_window == -1
    , c5 e9 P% l$ ?6 O/ C: F# q; i
  2306.       if (@move_state - 1) % 6 == 0- q) ]4 c3 ~1 _0 d; R" `: M
  2307.         @index = (@index - 1 + item_max) % item_max if @index  0
    ! \# R# y/ r  T" b7 E) x
  2308.       end
    1 [; p9 Q0 r0 \# p
  2309.     else
    8 v. v8 [3 l5 F# I5 [5 V2 ~
  2310.       @move_state = 0* d% m+ y$ y& ~) r9 n) E
  2311.       @index = top_index + mouse_which_window- h+ ?! |) R) r) {
  2312.     end
    0 U" D: o+ z* O, U
  2313.     ensure_cursor_visible/ Q/ L" Y: d' W
  2314.     if @index != last_index" {% w0 |$ f% v9 s5 k: W
  2315.       @savefile_windows[last_index].selected = false
    5 K& W( ?: a# C+ _( U5 S
  2316.       @savefile_windows[@index].selected = true" w) f* F- S) R7 a4 ^+ d* u
  2317.     end' V& Q# A) j& d( u5 i( w
  2318.   end
    3 ]$ a8 R& L" I# ^
  2319.   #--------------------------------------------------------------------------
    3 |$ u) ~1 F+ q/ o' D! w3 x$ a
  2320.   # ● 判断鼠标位于哪个窗口
    7 h, W' k* j4 S( \0 F  w
  2321.   #--------------------------------------------------------------------------
    ! h( S3 r  r* _7 m  s3 O
  2322.   def mouse_which_window
    . [$ V- r' Q! c' X. e
  2323.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y
    ) X( I) V/ p% H! R$ I( Y; o
  2324.     if mouse_y  @help_window.height + 140 y9 M1 M8 O! ^! E: u
  2325.       mouse_row = -1) J  P1 M$ T# X8 j4 `" Z! p2 R
  2326.     elsif mouse_y  Graphics.height - 14; ]! I! p9 D/ N8 Q+ l% Q. r
  2327.       mouse_row = -2
    ' W. C8 }. s* O" n2 P  b
  2328.     else  p' G  ?; N: G+ T6 Q2 L3 b4 Y
  2329.       mouse_row = 4  (mouse_y - @help_window.height)
    + a7 H7 B( A8 e) h/ t' m
  2330.         (Graphics.height - @help_window.height)
    1 {. a+ J6 @: [
  2331.     end
    2 F6 i0 N2 ]2 ~8 t! V. `
  2332.     return mouse_row
    8 k2 {+ f# i8 }' D/ e
  2333.   end
      p/ s1 E2 M; f( S9 t
  2334.   #--------------------------------------------------------------------------# i. [! ~- X& E) w& z+ r
  2335.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    ( c5 q& |+ A6 c5 q
  2336.   #--------------------------------------------------------------------------! f5 _5 h, w6 ]9 I1 K
  2337.   def set_mouse_pos: y: T6 n5 ^  K' l0 O
  2338.     new_x = 40
    1 Z/ w/ ?8 p: W& @( y
  2339.     new_y = @help_window.height + savefile_height  (@index - top_index) + 24
    + \. [3 z3 }/ }5 c$ Y
  2340.     Mouse.set_mouse_pos(new_x, new_y)* P3 O* x8 @, m" H$ Q2 t" q% ^
  2341.   end8 V4 G2 d5 |( P& h
  2342. end* f: f0 o) J0 K
  2343. : o5 [: l; f2 z, k- G+ c  i
  2344. #==============================================================================. X) S9 E6 A9 i4 H# v/ H* ]0 \
  2345. # ■ Game_Event$ L7 f$ h1 h- F, r, }! x
  2346. #------------------------------------------------------------------------------
    / i+ [/ o. k. C- d4 C/ u
  2347. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。7 t/ y& k+ Z2 m) y
  2348. #   在 Game_Map 类的内部使用。" r. p7 L- k5 E. @8 L2 K
  2349. #==============================================================================" c4 _7 s# Y- X  D
  2350. class Game_Event  Game_Character  v0 S- U/ }" n: T& r0 i6 v
  2351.   #--------------------------------------------------------------------------7 C5 I* `9 r$ ~
  2352.   # ● 事件启动
    " y& x8 J; y2 {& p" ~: m
  2353.   #--------------------------------------------------------------------------$ J& f3 S/ z: e# |& g0 L+ l! a' h
  2354.   alias sion_mouse_start start. F. ^. l" F4 C5 o9 l# @) `
  2355.   def start6 Z- n; y! g0 k; F  ^# n, V
  2356.     return if mouse_start && !Mouse.press(0x01)
    + z; |- M5 d5 B7 Z
  2357.     sion_mouse_start/ h8 L8 f1 v6 ~( n8 t
  2358.   end
    . s1 i- W' C7 a, W
  2359.   #--------------------------------------------------------------------------0 k/ s2 C) i# E) ~% \- ]
  2360.   # ● 判断事件是否由鼠标启动! F! C& a$ \$ x  C# S/ \
  2361.   #--------------------------------------------------------------------------1 p6 H  b  q3 T9 f  k
  2362.   def mouse_start5 t) j$ j  Y# Z/ Y" w
  2363.     return false if empty& N$ |* w4 Q) v% K4 N8 s4 @2 \
  2364.     @list.each do index
    . h: c1 i2 Z. v. ]' ?
  2365.       return true if (index.code == 108  index.code == 408) &&( w+ f, S+ o2 b8 t& {# ?" t
  2366.         index.parameters[0].include('鼠标启动')( }- z- w% S2 Z& n4 S" R
  2367.     end9 k( z; e, ]& O1 Y2 _
  2368.     return false
    0 x; ~: F. L& l6 t( k( X: v, L$ D
  2369.   end
    9 e& q7 q' t5 S5 g! i
  2370. end; Y5 y- E. v8 h
  2371. 7 q/ r% y0 h2 H' u/ v8 L
  2372. ####泥煤的height7 {' W- j: j9 o
  2373. # @height = height/ H8 L6 F: X9 F+ R4 N8 X

  2374. - D1 O. |; n9 ]. g6 g$ M1 E
  2375. class Area_Response! U& Q$ @( k6 \' c3 ~3 q
  2376.   attr_accessor type
    2 t) N7 t" B" X/ c! r
  2377.   attr_reader ox
    1 [5 i4 J3 x7 \0 _2 J4 f( I( J# w
  2378.   attr_reader oy  g' i( I9 s( Y: _+ \1 J' l
  2379.   attr_reader width
    4 L; y. `6 c1 m7 g% L) I! ^
  2380.   attr_reader height
    9 d8 w( u' T: F& n0 g5 k
  2381.   attr_reader switch_id
    % B: K: f3 p  q
  2382.   def initialize(type, ox, oy, width = 32, height = 32, switch_id = nil)
    4 j4 w& p' T; Z7 |/ D
  2383.     @type = type  V/ h9 o3 A/ Z! X; b- ]
  2384.     @ox = ox
    4 S6 R6 I1 K# D* u; ?
  2385.     @oy = oy
    ' T% u( G# J) m1 N2 D$ o5 f
  2386.     @width = width
    - e8 j: c! M" m. i# J0 {% u
  2387.     @height = height
    ( D8 p, |: z7 Y
  2388.     @switch_id = switch_id+ q( v2 U: q0 s# v! _; f! O
  2389.   end) s  E- B+ l. Y! S$ W
  2390. end3 C& b& u, a* R! |

  2391. 8 ~. X1 B4 }0 ^9 V7 i8 w( k
  2392. $area_responses = []; r) F0 M# D: X9 V* [2 L

  2393. / B8 s/ S) {. B' @1 _+ ^5 _
  2394. class Scene_Map) s/ _# T8 h8 k! r3 O2 {: x' p
  2395.   alias update_mouse_2013421 update_mouse_action
    % k) {1 @2 E* x4 ~
  2396.   def update_mouse_action7 T2 ]: x  i% t) L7 b3 k; t! x6 w
  2397.     update_area_response! [6 d: Y8 R" z1 s. P# \
  2398.     update_mouse_2013421+ n- M4 i( y) i/ V/ Z! j. V
  2399.   end% d: u% f1 W: H/ I; V6 e0 T( Y( d* a: C
  2400.   def update_area_response
    * [3 ^. j! H% m$ u
  2401.     responses = $area_responses
    ) s" M" s' |" j& P* r
  2402.     responses.each {response
    5 E  ~; P6 @& F
  2403.       ox = response.ox" T0 h% c; R8 j4 f
  2404.       oy = response.oy/ q' O) A& [  J8 O" B9 Q) \2 h
  2405.       width = response.width3 J( \( R: K9 P9 _0 Y7 x7 m3 |
  2406.       height = response.height, ^6 u- v- B$ `+ a- s2 k
  2407.       switch_id = response.switch_id
    , h8 q5 g( s( G% ?, m
  2408.       case response.type
    ( }9 Q" y1 ~, {) k3 j
  2409.       when 0  _6 [! B; P6 |6 ^
  2410.         if mouse_in_area(ox, oy, width, height)! }! @1 H6 I4 w, Y! ]* K
  2411.           $game_switches[switch_id] = true
    ( |0 _& O3 S" ?2 V: n- ]1 e& e0 S
  2412.           $area_responses.delete(response)
    * t$ T3 E; Y6 o0 d8 ~- I% E- \
  2413.         end
    6 r( G- m1 f; w5 E  d5 F9 S' A
  2414.       when 16 j/ G4 [3 L% Q. t$ R5 K; z
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)
    $ p& m2 u3 r% f) p
  2416.           $game_switches[switch_id] = true! o+ Z1 l% E2 `3 k+ z* k- J* s
  2417.           $area_responses.delete(response)
    ' x* q& S1 ^4 X4 n, a  L2 n
  2418.         end5 z, ?  W1 Z+ Y: E2 N. F0 ?
  2419.       when 2' D: O+ Q. J, w+ F, M* V; [& h% F
  2420.         if mouse_in_area(ox, oy, width, height); ]( j( A' l& w. p
  2421.           $game_switches[switch_id] = true" \1 x. K* o6 ~
  2422.         else
    ' y. W. l! {+ C
  2423.           $game_switches[switch_id] = false
    6 g0 b1 A, c5 R8 d9 c9 C
  2424.         end# ]! i  H- m* S# I! [$ \" m; z
  2425.       when 3
    + H- l4 p9 P; N0 q) T
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,0 s# I, s) J  }* P& w
  2427.             (oy - $game_map.display_y)  32, width, height)# b9 Y. f( s8 T, O7 l
  2428.           $game_map.events_xy(ox, oy).each {event
    5 O1 a1 \/ Q4 L/ p0 ]; M7 W
  2429.           event.start& b' F2 v4 H. W
  2430.           $area_responses.delete(response)
    ) _* K% P) X" R: ?6 Q
  2431.           return
    , m4 U0 M$ h# z
  2432.           } 7 r( H1 B, E' L- M; F% A1 h. `+ A* k
  2433.         end; N6 w1 @6 B$ d/ V9 O( T2 K" d
  2434.       when 4
    7 d! ]+ b" _9 T  {
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,
    3 L! F" A, T6 m- Q0 {% K" r
  2436.             (oy - $game_map.display_y)  32, width, height)
    / G$ o" i# l: r7 F# H) N$ h
  2437.           $game_map.events_xy(ox, oy).each {event2 Q: _( x3 Y6 w' t: G% G, `
  2438.             event.start
    4 A9 F/ h: y7 m0 R
  2439.             return0 u& R- k0 P( j! B9 k+ \( t
  2440.           } : b; {8 H  ?+ d3 r( q
  2441.         end* d, J% y& P7 R/ p1 L8 _8 v% T/ B5 M
  2442.       end
    7 C( o4 G: \4 ~/ q
  2443.     }
    # s* a' u; E0 }2 u! E
  2444.   end6 ~2 k8 p. g. a( ?; I( ~
  2445.   def mouse_in_area(ox, oy, width, height)
    ) c& t5 v& x# ^" D9 w
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&0 i( J; Y* f  H0 d
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height0 f& \: J) }7 ~4 r
  2448.   end
    4 n# {- c. Z( k$ Q8 Q
  2449. end
    * u7 f7 o9 F+ L/ `: O
  2450. class Game_Interpreter
    ( C! O# G8 m. g7 F! W$ I
  2451.   def area_response(arg)
    1 t) j, t* D% X$ W; r4 I
  2452.     $area_responses.push(Area_Response.new(arg))( I" Q, s6 q1 \+ D7 E% ~' A
  2453.   end
    / ?! h. n* \& y( c2 U( `- k
  2454. end
    # o1 S0 T. A0 k# d# x: m
复制代码

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

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

GMT+8, 2026-6-5 18:25

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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