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

Project1

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

存放腳本

[复制链接]

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

贵宾

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

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

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

x
純屬給LBQ腳本:
  1. =begin #=======================================================================
    ; C0 r& S2 E# I: }  @

  2. 1 e6 g/ k+ {* Z: k# f4 U8 H8 K
  3.   Sion Mouse System v1.3e
    & j, D0 l* g$ E* v+ N9 j: @$ _2 T
  4.   
    ' @, `# O1 Q, K( V9 O
  5.   Changlog, Y9 H" d5 a1 W4 P/ x
  6.   $ P" ~) {# _  R8 G8 ]) J5 Q  Z1 p
  7.   2013.4.21 v1.3f) W5 ^# g! j6 v# |- U
  8.     6 Z$ |: ^/ j4 k% n% q* X0 H% R
  9.     1.3f 卷动地图 bug 修正9 W! c  h0 K$ i8 g- X
  10.     ( ?" x) ]5 w4 G
  11.     1.3e 逻辑优化;提供解除鼠标固定的接口9 w3 c) G# T9 L. \: J" C2 {& y
  12.              在事件中执行脚本 Mouse.lock_mouse_in_screen 将鼠标锁定在屏幕内
    6 E: x* B" j% ?$ i, ^
  13.                               Mouse.unlock_mouse_in_screen 解除锁定2 d+ b7 k8 Q7 e, ?+ U# j$ O

  14. 4 [8 l  C) W( k3 L
  15.     1.3f bug修正
    - m! O2 N  c+ w4 i. a
  16.   
    6 L$ A' s& x& W9 |
  17.     1.3d 常数设置增加:Menu_Set_Pos,用来设置打开菜单时鼠标是否移动到光标处以及
    # H! t) m9 E) }- D0 V9 J) k
  18.           关闭菜单时,鼠标是否移动到原来的位置。4 L9 D: R3 A$ M2 a% Q8 Z
  19. : G% c; C: x; C
  20.     1.3c 打开菜单、光标移动时鼠标会移动到光标位置处3 I5 _* @& N! j1 A; y( N
  21. + C: h3 B( V2 g, D
  22.     1.3b 修正一些罕见的bug;3 `2 l9 f+ w9 L

  23. 9 O7 l$ c" x5 ~+ A! n2 h) `
  24.     1.3a 代码小修改;  y& ]- E- s7 z% \# `
  25.           加入了鼠标点击启动事件的功能,- i% `* Y& J1 g+ {9 y
  26.           在事件中加入“注释”: 鼠标启动  ,
      y/ R6 Y# a, y7 V
  27.           该事件将无法用其它方式启动,只能用鼠标左键点击启动。
    : G' I/ U" ]" q
  28.   ; n! `5 @; t* a+ [+ f- I+ H. {
  29.   2013.2.12 v1.2/ [6 G0 t* P/ ^5 a& @9 Z1 R+ A0 Y
  30. / C* W  @4 {8 J$ X1 m( N
  31.     寻路逻辑优化;
    % X0 f; B  L8 B+ q: f  k0 F  _
  32.     优化了事件判断,现在点击事件附近的格子,移动到指定点后不会触发该事件了;% ~; P9 S5 f% K5 h. @7 B' R
  33.     现在支持用鼠标来操作载具了。5 v0 y4 P0 i2 t# V9 U
  34. . S' A4 g9 o! ?( t; d
  35.   2013.2.8 v1.1
    4 b( F9 K3 s0 S- D2 [$ A6 H# B+ ?. `4 b
  36. ( \+ ^9 ]; M. U! [
  37.     优化了事件判断,现在可以方便地启动柜台后面的事件;
    . X% R/ p3 w1 f; B1 }& B, v& g
  38.     修复了某些菜单(例如更换装备的菜单)掉帧的问题;' G, U' A) j9 d+ p% z
  39.     移动时,路径指示点的绘制更加稳定;/ w+ H- w! s+ f& l$ c& e
  40.     现在支持默认存档画面的鼠标操作了。
    4 y; |/ B  I3 O8 m& U
  41. 7 d1 N  v3 `4 S' N
  42. : D1 j" e1 B4 g. W0 F, J" r
  43.   OrigenVersion; x. R+ X: N# F0 ]
  44.   9 u: w9 F& `6 X+ |: h$ B" L. E
  45.     2013.2.7 v1.0
    8 m7 o/ b% G8 J6 S  Z7 s

  46. . N4 V6 u4 |% E2 Y' C6 J
  47.   主要功能! g* l2 T) l1 ]* H

  48. ! W( X9 h# y3 E3 F- B
  49.       使用鼠标进行各种操作...! S0 S' Q5 o6 E& F4 J/ \: p/ _
  50.       将鼠标锁定在游戏窗口内* q+ n6 F0 v# J+ i
  51.       自动寻路,按住 D 键可以扩大寻路的范围
    ( ?3 s4 T* ~: N3 r6 T! d& B. |
  52.       双击鼠标进行冲刺' S) K8 b1 P1 ^. j  t
  53.       更改地图卷动方式以适应鼠标移动
    1 \/ a7 Q" C2 ?. l
  54.       变量输入框改良. N+ F2 |2 E3 U! U5 z  O
  55. ! N! g4 _' g% L, D- O0 s
  56.   ★ 鼠标指针图片 Cursor.png 放入 GraphicsSystem 文件夹7 e+ c1 ?/ f( M% L3 c! W6 C2 Y- Z0 J

  57. : {- {. H0 X8 o! K6 D, L
  58.   ★ 路径点指示图片 $Arrow.png 放入 GraphicsCharacters 文件夹  ~8 h# @7 ?' P& {  F4 \& s$ ]

  59. 9 N7 _+ ?- Y# Y& x; t' b
  60.   ★ 如果未放入会弹出提示,并使用RM自带图片代替缺失文件;该提示可以在下面关闭
    ; l4 i6 w. c8 T

  61. " V# j) h, C+ f! o: T& Z8 e* g" e
  62. / c2 _2 v2 i4 M; D; @* M7 t
  63. =end #★★★★★★★★ 可能需要设置的参数都在下面用“★”标出了 ★★★★★★★★★★, X3 b% Z1 u. i0 S$ s

  64. % a. E7 h9 {/ m( b' T, `

  65. ( `2 V4 h) [) u+ N; e' Y- D
  66. $no_arrowpic_warn = true   # ★ 设置为false不弹出图片缺失提示3 L0 Y) Z2 B( g; x3 z0 L2 h
  67. $ b! e$ @* W4 x& ]/ I
  68. #==============================================================================
    5 `, W% ]. [& M9 V* n# }
  69. # ■ 常数设置 , H- @* H7 I  J2 W- y' X+ F  p4 s
  70. #==============================================================================! O" m3 B' F8 x$ r
  71. module KsOfSion8 S' p1 J# S. T5 e( D3 d3 D! m
  72.   Clip_Cursor    = false    # ★ 鼠标锁定在游戏窗口内,需要关闭设置为false$ M7 ?5 _4 E- W' F$ N7 X, J; X
  73.   Dbclick_Frame  = 20      # ★ 双击的最大间隔帧数。在地图画面双击进行奔跑
    . j3 E, ~  p4 v3 F
  74.   New_Scroll     = false    # ★ 更改地图卷动方式,需要关闭设置为false
    4 Z8 A, x, x& J
  75.   Map_Scroll_Spd = 1.0     # ★ 更改地图卷动速率,请确保此值为大于0的float变量
    7 Y1 o% @# N' Z8 O+ b2 O
  76.   Menu_Set_Pos   = true    # ★ 打开菜单时将鼠标移动到光标处
    . R) B( C: L# h3 J9 w7 L6 u, L: z9 {4 w
  77.   Break_Steps    = 30      # ★ 鼠标寻路最大步数,防止路径太长导致卡帧
    , M2 v, c4 d! Z
  78. #                             “30” 是默认显示格子数 长(17) + 宽(13)
    - y4 O3 S7 C& A
  79.   Find_Path_Key  = Z      # ★ 扩大寻路范围至全地图按键 Z 对应 D键
      l* v% {3 ?" c! u7 I
  80. #                               RM几个内置的空键位 (X = A)(Y = S)(Z = D)3 ]% I$ q! y0 L. G2 t6 ?& T8 N
  81. end; O" p$ `$ v5 p
  82. " V" K, p6 M% G4 m
  83. #==============================================================================& k' ]& v- g# K; X& O
  84. # ■ 用来显示路径点的类5 u' _8 M2 C& Z1 c' p% w: l* A
  85. #==============================================================================" h3 X: `# P" }2 u0 s
  86. class Move_Sign  Game_Character
    4 n/ Z) b% O0 C' w
  87.   #--------------------------------------------------------------------------* u' `# k& N/ I: k, j7 s, o
  88.   # ● 设置目标点指示图的各种参数,请注意要使用的图片是行走图
    ) d0 d- e1 I8 {4 u- g
  89.   #--------------------------------------------------------------------------
    - W6 Z5 ]: G, C  T
  90.   def init_public_members) R; Z  c6 a1 s1 Q- h- n
  91.     @character_name  = '!$Arrow'# ★ 路径点箭头,置于.GraphicsCharacters文件夹7 S- K5 x0 E# G8 j& [
  92.     @character_index = 0        # ★ 图片索引。$开头的行走图设为0
    + L* [% N2 E& l# y& Y
  93.     @move_speed      = 5        # ★ 踏步速度' K+ b1 i4 X" e/ g, m
  94.     @step_anime      = true     # ★ 踏步动画(如果想使用静态图标就关闭这个)
    5 P; i0 @4 R; B2 j8 b$ {& N3 A! C
  95.     [url=home.php?mod=space&uid=316553]@opacity[/url]         = 255      # ★ 不透明度
    1 M. |$ }( p% c8 H7 h7 a
  96.     @blend_type      = 0        # ★ 图片合成方式,默认为0(正常)
    9 |1 i- r+ o4 f9 P6 ~
  97.     @direction       = 2        # ★ 朝向,2 4 6 8 分别对应行走图第1 2 3 4 列; e* d$ K2 I6 g5 I
  98.     @priority_type   = 1        # ★ 优先级(默认与人物同级:1)# g0 d+ @8 q  Q1 L- S

  99.   H1 ^; Z) k! R

  100. , K0 J7 f  h7 f) H
  101. # ★★★★★★★★★★★★★★★ 参数设置完毕 ★★★★★★★★★★★★★★★★★★★; m* H( p8 n& n; I
  102. 1 \' B- Z1 i& j) u2 k# T
  103. . R9 f6 C3 H5 h# {/ N- N7 G
  104.     # 如果 $Arrow.png 不在对应的文件夹内,弹出提示,并使用游戏一张内置的行走图
    ( S4 R: b3 F$ m7 e
  105.     unless File.exist('GraphicsCharacters' + @character_name + '.png')
    3 i- R/ J5 M: ]% p( \6 I

  106. 8 ]9 ^, T5 I+ z2 z
  107.       if $no_arrowpic_warn  ?/ X7 d( r# `4 s5 b0 w
  108.         MouseShow_Cursor.call(1)2 d* y3 S+ J; A6 b5 u3 K2 c
  109.         msgbox('未找到文件:GraphicsCharacters' + @character_name + '.png
    4 m3 G8 I8 y, p; T

  110. : j$ J2 y7 i# P5 {# U4 j
  111. “路径指示点”将使用游戏自带图片
    $ @  E3 d5 \" @

  112. , U% q: O4 J4 G& v
  113. 该提示可以在脚本内关闭')
    7 e" }6 j$ l  [: U: w5 a- W$ _
  114.         MouseShow_Cursor.call(0)) o- `6 `) A. I+ Q: ^. n
  115.         $no_arrowpic_warn = false( d" h  M, u$ }6 K
  116.       end, T# l7 T# r8 v
  117.       @character_name  = '!Flame'2 y$ N5 n. C! u2 Z
  118.       @character_index = 67 d' o9 W' V3 G+ w" `

  119. - r6 c# T1 s6 ?1 t/ ^% J
  120.     end7 G- ~7 G# T+ N. M6 O0 r* m7 E
  121.     @direction_fix = false  # 固定朝向
    8 |, z3 a/ ]/ |
  122.     @move_frequency = 6     # 移动频率
    % R& m! K' Q  d
  123.     @walk_anime = true      # 步行动画
    * P7 w8 P, B( U# n3 r
  124.     @pattern = 1            # 图案
    5 r( J* [# [5 H0 s: |$ K4 t8 a* R' L. `
  125.     @through = true         # 穿透
    4 X  `( A' y7 e5 y* Q
  126.     @bush_depth = 0         # 草木深度
    ( U/ k/ b3 ]* e% H" s' o
  127.     @animation_id = 0       # 动画 ID
    ) _# i1 _; c* O) ]* X
  128.     @balloon_id = 0         # 心情 ID$ B& d  z( i, I# M) Z2 D8 f
  129.     @transparent = true     # 透明, ^  \" x, _: c! r' r
  130.     @id = 0
    1 f' B0 [5 |7 Z# `% t' ^
  131.     @x = 0
      `6 f0 C8 g- _+ k" h! D( i' G6 T
  132.     @y = 0! Q4 Y. `2 t: W4 ]6 |( v
  133.     @real_x = 0
    5 i' `! k  X3 G* _: G3 y" }
  134.     @real_y = 0
    9 g5 v* J: M3 \4 Y0 L: _5 F( ~
  135.     @tile_id = 0
    $ z8 a' \& Q( h& N; L$ v
  136.   end% y$ I3 x, d5 r) x( z
  137.   #--------------------------------------------------------------------------0 z) t; t9 M2 z; F( R: T: w8 d
  138.   # ● 定义实例变量
    9 l$ {- o$ ]2 O& M& N
  139.   #--------------------------------------------------------------------------
    0 s' `) ^0 h7 p7 y5 U+ }- ^
  140.   attr_accessor direction: s4 z4 P$ B4 [: A2 l
  141. end
    ; r! B1 i5 ~8 m" F2 a; X
  142. & K) w1 t$ q: {
  143. #==============================================================================& O. C& B! b& ^
  144. # ■ Module Mouse
    * Y1 U7 U7 s9 B. L9 e% G/ R9 ?6 g2 d9 m
  145. #==============================================================================
    ; k( {0 {& [8 i0 h. K/ J
  146. module Mouse
    5 m0 C4 Y$ X# S5 C& y* Z
  147.   #--------------------------------------------------------------------------' {9 s$ I: m1 G0 ?
  148.   # ● API4 Y: c( ^4 `% y' w, G
  149.   #--------------------------------------------------------------------------' J7 k" I1 w% C" a! J. D( `
  150.   Show_Cursor       = Win32API.new('user32', 'ShowCursor', 'i', 'l')
    + I+ K8 ~2 {3 W. t6 U. D
  151.   Get_Cursor_Pos    = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
    1 L- F  X4 `' F
  152.   Set_Cursor_Pos    = Win32API.new('user32', 'SetCursorPos', 'ii', 'l')
    ' B5 }. |( \: }9 Y4 }. C
  153.   Screen_To_Client  = Win32API.new('user32', 'ScreenToClient', 'ip', 'i')
    # A( k: Y8 F, ~6 J* W3 R
  154.   Get_Active_Window = Win32API.new('user32', 'GetActiveWindow', nil, 'l')
    2 [% J+ j' g' `) e# O" M
  155.   Clip_Cursor       = Win32API.new('user32', 'ClipCursor', 'p', 'l')& I2 k, }6 K# R% n5 z# {% c" U$ r
  156.   Get_Key_State     = Win32API.new('user32', 'GetKeyState', 'i', 'i')5 P8 U: A4 D% l, o8 R9 H
  157.   Window_Hwnd       = Get_Active_Window.call- U6 t3 K8 w& a8 T* H  v/ P% ?8 C" t8 Z
  158. ' Z3 t. f% s) T, E$ |
  159. class  self; x- W" f! W8 S2 t; n) }# b
  160.   #--------------------------------------------------------------------------. a3 K; b8 M& F* O$ G1 h# W
  161.   # ● 初始化
    # o+ W) N: C. R' R2 E5 g
  162.   #--------------------------------------------------------------------------
    + [& [! D2 ^' S" |+ |7 O
  163.   def init
    6 U( u3 L# ]6 [2 \
  164.     lock_mouse_in_screen if KsOfSionClip_Cursor5 F8 h) x! P) Q( @
  165.     @left_state = 0
    ; R' L: m8 M3 w3 B  P* U
  166.     @right_state = 0
    9 \; ]# Q) ]! A2 G" ~
  167.     @ck_count = 0 # 帧数计,单击以后从0开始
    , \4 c/ \/ m. |% K; i. `
  168.     @dk_count = 0 # 用于双击的判定
    , [# F# A/ ~' I1 T3 e
  169.     @clicked = false
    * v0 ~! S' V: Q2 T! R# K* i: [
  170.     creat_mouse_sprite
    6 E5 ?  j: k1 @/ \8 W! R
  171.     update! @, }. Z* P7 \) F9 e. y
  172.   end
    3 ]) Z( w. I0 i" j
  173.   #--------------------------------------------------------------------------6 d* W1 Q* Q7 z
  174.   # ● 鼠标指针精灵* r" w& q6 K  b  w! ]/ J5 |0 H
  175.   #--------------------------------------------------------------------------, Y" j3 t: N, {  L1 g1 s  a) N; H  c) \
  176. #~   def creat_mouse_sprite
    1 M" H$ f" a9 g2 t. i6 a
  177. #~     
    9 |2 J, D# M5 @- v! n' r
  178. #~       @mouse_sprite = Sprite.new/ o0 P  }# t1 Z' v6 l
  179. #~       panda = 2#rand(2)+18 c, Q! F& {( g# E

  180. & Y/ m. O3 h! p0 b
  181. #~      if panda = 1
    5 g! P) U0 V, j& t, r+ H& H
  182. #~        if File.exist('GraphicsSystemCursor2.png')9 N: H6 P7 @$ }6 C3 {* b
  183. #~         @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')( o) L6 Q  N- `! l' S. \" W
  184. #~        end#with if File.exist
    9 F8 z8 F+ q! ^9 L
  185. #~   
    ' L$ E6 F( p0 h% [1 x+ F* V
  186. #~     else if panda = 2 #with if panda=1
    2 C2 P- M/ r/ v* @+ Y
  187. #~      
    7 f! i% s6 ]0 j- q8 ]7 l9 k' y
  188. #~      if File.exist('GraphicsSystemCursor2.png')) q0 z$ i& [# n) `5 C5 Q
  189. #~       @mouse_sprite.bitmap = Bitmap.new('GraphicsSystemCursor2')
      s: `& q6 R6 j2 \
  190. #~      end#with if File.exist# J( m6 n4 n5 p; J: T$ J
  191. #~       # V4 [5 G6 ~: v+ C: Y- l
  192. #~     else #with if panda=1! j/ d* ?$ u" }- W
  193. #~       @mouse_sprite.bitmap = Bitmap.new(24, 24)2 V6 J5 n, d. p( u& W9 ^
  194. #~       @mouse_sprite.bitmap.blt(0, 0, Cache.system('Iconset'),* e" l' ~/ J& b% W2 q1 c
  195. #~       Rect.new(5  24, 24  24, 24, 24))  g' M8 f  u; J5 q
  196. #~     end#with if panda=1
    ' q4 g# p" x1 T' H& I
  197. #~     
    ; Z) j: o2 ?' r2 G, X! D. R) o! @
  198. #~     #with def
    . i6 J( n' y/ X$ A8 P
  199. #~   end; O5 b. M: h9 ~$ m
  200. def creat_mouse_sprite
    - s. ]! f, W& r9 u) b
  201.     @mouse_sprite = Sprite.new2 l) M2 q( Z; o4 Q3 [
  202.     @mouse_sprite.bitmap = Bitmap.new(GraphicsSystemCursor#{rand(2)+1}); p/ j; C4 A* b) |  O: ]
  203.     @mouse_sprite.z = 9999
      S3 B- B( P0 _% ^& I3 R
  204.     Show_Cursor.call(0)
    ; k+ ~$ {$ Q4 m% `2 ?
  205. end
    ) p' n) \2 v7 ~& o
  206. 2 ?; L8 F9 u" H3 I& K4 }$ F
  207.   #--------------------------------------------------------------------------
    9 O  H/ t5 O) S7 T
  208.   # ● 更新
    # l- n- S4 u- Y/ y& X+ l) q3 b+ V
  209.   #--------------------------------------------------------------------------" [; N: H! }9 f9 w! m7 \0 _( M
  210.   def update6 H& d: k9 l" f
  211.     @mouse_sprite.x, @mouse_sprite.y = get_mouse_pos9 ~; W. }  F" f$ R3 e
  212.     left_state  = Get_Key_State.call(0x01)
    - o9 N% b3 |( U8 T. P6 g0 X. `6 |
  213.     left_state[7] == 1  @left_state +=1  @left_state = 0( C1 q* ~$ }2 x- D% Z9 u
  214.     right_state = Get_Key_State.call(0x02)
    . N3 u; e1 K4 }( d3 F. r
  215.     right_state[7] == 1  @right_state +=1  @right_state = 0
    1 i* L" A' a! {! F
  216.     update_double_click( w6 _# N; I" |- C: }
  217.     @left_state == 1  @ck_count = 0  @ck_count += 1
    , S6 [  g5 q& Y6 e
  218.   end/ Z* ^$ W0 r' m3 [+ P# Z! E
  219.   #--------------------------------------------------------------------------
    8 {# [" A' S& b' @% F4 P
  220.   # ● 获取鼠标坐标* x: n8 F1 W) a& \: l6 Y
  221.   #--------------------------------------------------------------------------. x+ y& x3 P0 p, g) _
  222.   def get_mouse_pos/ u  C) g8 U$ E
  223.     arg = [0, 0].pack('ll')
    8 S- d; J7 o5 r3 ]9 |# ]% W& E; D6 U
  224.     Get_Cursor_Pos.call(arg)
    8 C  Z( u0 G$ }2 S) p8 j, E  X+ Z
  225.     Screen_To_Client.call(Window_Hwnd, arg)5 E' Q( |! X8 Q- J
  226.     x, y = arg.unpack('ll')
    % N. ]2 N0 d7 R# v# N2 U
  227.     return x, y! L+ L1 g! e' z$ h3 ~. I$ E
  228.   end3 B2 K1 U. j3 [9 V
  229.   #--------------------------------------------------------------------------; O) g. X% b- {( p, l/ W
  230.   # ● 将鼠标固定在屏幕内6 S3 r: g4 x0 p0 D- r) f
  231.   #--------------------------------------------------------------------------2 e# o; k7 }. L% s( B# n$ H
  232.   def lock_mouse_in_screen" y& K+ u& \+ M& J' v2 D
  233.     arg = [0, 0].pack('ll')) r/ Q; \7 W& S& E
  234.     Screen_To_Client.call(Window_Hwnd, arg)4 s; y1 ^9 d7 ]& p6 x
  235.     x, y  = arg.unpack('ll'): ?) A/ |' l# p! g/ J, q6 q/ y
  236.     Clip_Cursor.call([-x, -y, Graphics.width-x, Graphics.height-y].pack('llll'))
    " g; ~. J* n* G! n$ W/ ^
  237.   end
    3 q( J8 D. K5 ^$ B' Z
  238.   #--------------------------------------------------------------------------
    9 u! s! l9 r, S8 t7 a: Q
  239.   # ● 解除鼠标固定0 t# s; g! v* F1 y, R& J9 V
  240.   #--------------------------------------------------------------------------
    $ R! |- v0 T  w
  241.   def unlock_mouse_in_screen
      h! T  F( `6 w. r/ ?3 o7 [( V
  242.     Clip_Cursor.call(0)
    % V8 `# J) L' a3 c
  243.   end
    " j% U$ R* H' G% h% G" ?
  244.   #--------------------------------------------------------------------------2 O/ P  J2 I6 @0 O; E* B
  245.   # ● 鼠标双击判定; k+ Z0 b2 E: f. s* K+ @3 I# C7 J
  246.   #--------------------------------------------------------------------------
    + ?. K* p" ]3 \" X
  247.   def update_double_click" Y9 F  J0 h9 f! C
  248.     @clicked = true if @left_state == 1
    2 e  v. t/ x: h+ c* Q  z- n) n
  249.     if @dk_count  0 && @left_state == 1
    1 K1 e$ E! O1 L$ \7 S
  250.       @dk_count = 0; @clicked = false4 m2 E! O! y# R2 Q
  251.       return @double_click = true: G8 Q" a5 t& g1 L# l
  252.     elsif @clicked, g; e* C' ?3 f+ H0 ~: d# {
  253.       if @dk_count  KsOfSionDbclick_Frame
      F% {" `3 r" Z- S( N1 I3 g6 c+ C
  254.         @dk_count += 1
    ' v# R4 s9 F3 w0 n  a7 x5 \
  255.       else
    : A! H5 X, m$ e' X; s5 L
  256.         @dk_count = 0; @clicked = false) A1 ?9 k; \& l$ D; b+ c% f
  257.       end! P; L8 S% l7 G0 N9 A
  258.     end! L8 D+ w: M  L9 R8 m; y0 P: p
  259.     @double_click = false
    7 ?" W. V. p: j; ?: h
  260.   end8 o# b) R1 B$ |9 ]  I7 ~/ E% h
  261.   #--------------------------------------------------------------------------
      X1 o2 m1 P6 ]% e0 ?5 G/ |
  262.   # ● 按键被按下就返回true
    4 x/ m" `% v& k$ \. B: h6 U& u
  263.   #--------------------------------------------------------------------------
    # i$ E* y9 M& h, y7 {, s& G
  264.   def press(button)# `" S5 J; h$ X, T  [8 t, {
  265.     case button
    3 b0 L# m& I6 ]7 l4 X  m% p  j( w
  266.       when 0x01; return !@left_state.zero9 f$ G7 b" U" H) Y# _
  267.       when 0x02; return !@right_state.zero
    3 ~+ [7 I) ~% s8 }# M5 p0 P- V
  268.     end# M7 R2 j3 q  N4 i) H
  269.     return false" O. V- a6 }/ X' F, v2 n8 T# ?: Y
  270.   end0 j9 c" {1 g% d' y
  271.   #--------------------------------------------------------------------------2 n' [  T- z* t
  272.   # ● 按键刚被按下则返回true5 W0 l, i# H9 p7 P( T
  273.   #--------------------------------------------------------------------------
    1 u3 c7 F1 X- r2 O* e/ k9 Q/ C
  274.   def trigger(button): f7 \- w# ~8 F# e& f
  275.     case button- P* T3 \; f4 e6 E" x9 a, b! h0 R
  276.       when 0x01; return @left_state == 1! `+ `0 R% V  E& f
  277.       when 0x02; return @right_state == 1$ C6 i0 s- a0 U9 i2 U/ N+ r
  278.     end4 ?8 P4 h' P; u* k6 I( t
  279.     return false
    - S2 w; B4 f9 ~. E1 {+ J
  280.   end
    1 y7 s" H6 V) F- F3 X" t$ q2 P
  281.   #--------------------------------------------------------------------------* z$ L* e- ^) c+ N: J2 b  Y
  282.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    * s( y6 [( M2 n' c& m, W& t) c' V4 v
  283.   #--------------------------------------------------------------------------) U- h' f4 P. ]& S
  284.   def repeat(button)5 l5 g- U0 I) A; U
  285.     case button& |- ?/ K5 ?' Y# W& S! Q
  286.       when 0x01; return @left_state == 1 , _) g# y/ J' Z/ X
  287.         (@left_state  22 && (@left_state % 6).zero)
    3 R. O' L( e  R) o
  288.       when 0x02; return @right_state == 1 + j5 A' l0 ]- X; {
  289.         (@right_state  22 && (@right_state % 6).zero); U' S! D3 Y0 k$ ~
  290.     end0 S& J+ n- t" C7 ^8 Y7 q5 ^
  291.     return false
    ; r/ W# M# D0 c' G& V3 P; O( w
  292.   end+ @- k' m4 I9 I1 O" V; ]
  293.   #--------------------------------------------------------------------------
    7 Q1 a2 @6 [' r" i
  294.   # ● 判断是否双击鼠标
    0 `+ K+ `2 R& O( T( m4 h
  295.   #--------------------------------------------------------------------------  Z$ |) C1 @5 C7 g6 R- \
  296.   def double_click' |/ P+ i. O5 x2 _2 p' R
  297.     @double_click
    4 i1 d9 N' |. S$ `# b
  298.   end
    3 _9 E, I3 \4 }7 \* \* I
  299.   #--------------------------------------------------------------------------( U- z& y2 ~. Y2 @; ]
  300.   # ● 获取@ck_count(每一帧+=1,单击后重置为0)! p$ y* Y& B' N8 n# H$ {
  301.   #--------------------------------------------------------------------------+ M( i5 W4 z- v( B# V8 {
  302.   def click_count
    % d5 X5 K  @* b2 b
  303.     @ck_count2 Z) z& L7 _: W% |3 [! G
  304.   end
    $ n0 k$ i1 G1 G3 G
  305.   #--------------------------------------------------------------------------
    ; X% X! A& f7 t6 H) R, P; C; w
  306.   # ● 获取@left_state(按住左键每一帧+=1)
    ( A( p& U' A( s" n$ N- \
  307.   #--------------------------------------------------------------------------% l, v% S& F+ B0 s  [- h" l
  308.   def left_state
    7 l6 g2 i! t: k
  309.     @left_state  E/ [6 U" c/ w+ s/ ~
  310.   end* S: R+ R' O! k! ^+ H9 n, H
  311.   #--------------------------------------------------------------------------
    $ M& H4 E  f; L
  312.   # ● 获取鼠标的x坐标: e- [$ Z4 A8 q7 |$ r' L2 n( ]
  313.   #--------------------------------------------------------------------------4 I* h* R8 E: {/ F5 S. c. U, W
  314.   def mouse_x8 ~( D( \! T+ K
  315.     @mouse_sprite.x
    : _7 T( x# r0 P/ q) X
  316.   end" [& @1 ]6 V  ]: g' h
  317.   #--------------------------------------------------------------------------+ l  o5 j- k: r$ e( N' D: h: M
  318.   # ● 获取鼠标的y坐标
    7 y: F6 m% b+ Y# c4 C
  319.   #--------------------------------------------------------------------------0 P( A0 Z' ^$ I# d, o6 `
  320.   def mouse_y4 i9 I# F6 @7 r/ O
  321.     @mouse_sprite.y
    & M6 f  e1 Q8 b
  322.   end' a- z8 g; y  {, ?
  323.   #--------------------------------------------------------------------------
    $ G: o! s8 o1 f0 _
  324.   # ● 设置鼠标坐标
    1 \# w" S# q. Z1 `2 g; w& S. ~
  325.   #--------------------------------------------------------------------------
      L9 g1 C- q9 M; {$ j" s7 X2 C7 ]
  326.   def set_mouse_pos(new_x, new_y)
    . O7 L9 a8 i  K# T6 q+ ^! j
  327.     arg = [0, 0].pack('ll')5 C6 W/ T1 p: a% }5 j
  328.     Screen_To_Client.call(Window_Hwnd, arg)' r  ~; ^: t0 k* @) N
  329.     x, y  = arg.unpack('ll'); r0 t8 i7 O% W
  330.     Set_Cursor_Pos.call(new_x - x, new_y - y)
    * g  E0 ]2 e6 s- ?# E
  331.   end
    # d) ~+ z. k2 g  d0 [) e
  332. end #end of class  self
    - Y5 s3 g& p5 ]+ s7 A( }$ V; A) c
  333. $ H/ Z1 i8 `! Y8 M2 A
  334. end) A, ^; u* U/ y& \2 [; K0 ^

  335. , v" G! k4 B% j& I
  336. #==============================================================================4 Q! i- W/ A3 p  r
  337. # ■ SceneManager( N" @4 t  g7 L6 u. W
  338. #==============================================================================
    ) a' P4 i9 Q2 f% g0 q
  339. class  SceneManager- F' ]8 W/ [/ @3 y
  340.   #--------------------------------------------------------------------------
    6 W4 R: J8 J- k% u/ u" {% A
  341.   # ● alias
    / ^; s6 [9 O: Y4 U- \( w
  342.   #--------------------------------------------------------------------------
    2 Y: z. G' ~  J% A' `0 Q5 B7 E
  343.   unless self.method_defined(sion_mouse_run)
    $ @: @3 {- B& ~  N  U6 q6 o6 q7 F
  344.     alias_method sion_mouse_run, run
    ( x' h3 }' J  a! y4 t) B* ^1 l2 L
  345.     alias_method sion_mouse_call, call
    8 w  W( L/ [4 V6 _9 x% b
  346.     alias_method sion_mouse_return, return
    8 t2 Y" o4 Z& ^2 c3 ?
  347.   end. y# K& M! X5 S8 [8 O2 K
  348.   #--------------------------------------------------------------------------
    0 O  P' W6 v9 U2 A& Q" o, s( r: ]0 h
  349.   # ● 运行8 |/ ~4 R- [5 |
  350.   #--------------------------------------------------------------------------1 F* C" V" W7 K, a
  351.   def run) j3 |$ W% t( m- X  W
  352.     Mouse.init' J# x! a" m% b! j* }
  353.     sion_mouse_run  D5 S7 U3 ?6 J+ ~3 }! W( k
  354.   end9 `2 [5 y- R5 W* B2 \+ C
  355.   #--------------------------------------------------------------------------, P  r. B0 A/ ?
  356.   # ● 切换6 V) J9 d) d( j# g" ]
  357.   #--------------------------------------------------------------------------
    , E: \1 b& B. K* ~# c# q; ~
  358.   def call(scene_class)
    + Y+ O2 r1 Y& m$ z1 J/ J; X
  359.     $game_map.prepare_reset_mouse_pos if @scene.instance_of(Scene_Map)
    5 {4 q0 B' }$ E8 w* M- M( P4 m' q" ^
  360.     sion_mouse_call(scene_class)  Y/ S& F, P; B6 U) _& m5 `
  361.   end
      B) ]- U& T5 \; k' R
  362.   #--------------------------------------------------------------------------
    2 W' o4 ?: a5 [7 q. L9 p% h, B: Z
  363.   # ● 返回到上一个场景9 e& r2 f! {- {5 a
  364.   #--------------------------------------------------------------------------
    9 X+ n3 P, J3 t$ V" [/ c9 q+ V7 n# C
  365.   def return
    ( l- Q& R7 m9 [/ Z( {
  366.     sion_mouse_return4 [( j7 t- G' f8 l5 s* [5 e
  367.     $game_map.reset_mouse_pos if KsOfSionMenu_Set_Pos &&5 o* i, h5 b% W) ~  j+ i
  368.       @scene.instance_of(Scene_Map)
    . K* L: \: [! x
  369.   end
    ) Y# C- ~8 J8 I8 c$ P
  370. end, w/ r2 O  Z, m

  371. 5 S! s; x7 Y. p8 P- s* q. K  ?/ {% [
  372. #==============================================================================' T4 J. j" ]( i2 h1 f
  373. # ■ Module Input
    / H: Q* h9 @' V) ~, s
  374. #==============================================================================/ o5 \# A. F; S% j8 y
  375. class  Input
      Q* V% e* P, s7 I- r
  376.   #--------------------------------------------------------------------------: q% N% F  u9 J- X
  377.   # ● alias
    ; S7 @/ a0 C% r
  378.   #--------------------------------------------------------------------------1 a# L3 p& \& ]! y! U$ @
  379.   unless self.method_defined(sion_mouse_update)4 v4 _' ~- P% x* R. a3 v# I
  380.     alias_method sion_mouse_update,   update* H/ e2 y$ ~$ V5 `
  381.     alias_method sion_mouse_press,   press0 y( i( B3 y1 O6 l6 E
  382.     alias_method sion_mouse_trigger, trigger" G& @; s* U5 u5 N
  383.     alias_method sion_mouse_repeat,  repeat, M' _1 t# R& u' a. E( ~3 t2 W  {
  384.   end
    ; s% N1 J9 l3 ^/ U5 c- w! k
  385.   #--------------------------------------------------------------------------4 `4 ?$ {0 c2 u! c  ^$ o
  386.   # ● 更新鼠标
    & q4 u  i1 e) S4 a" T
  387.   #--------------------------------------------------------------------------
    1 P: g, g; d$ U, Q- Q) H8 j; v
  388.   def update
    + R9 W1 n0 ^- v
  389.     Mouse.update
    ' k, w$ Q8 m0 a& x: Y2 X# A" U* r
  390.     sion_mouse_update8 d" t+ W" j/ j& ]+ V
  391.   end
      T- D5 r2 m) N" }7 m. L
  392.   #--------------------------------------------------------------------------
    ' w. D. h! P2 M7 c
  393.   # ● 按键被按下就返回true: I0 v" V# E/ v  ^* V3 O" [* U
  394.   #--------------------------------------------------------------------------
    ; V+ G" ?  n3 V# R
  395.   def press(key)
    6 v$ D- n6 S9 u- i1 e1 N
  396.     return true if sion_mouse_press(key)
    ) g2 z& L; E! |
  397.     return Mouse.press(0x01) if key == C' G" V5 |! L: b2 A" t4 W- A
  398.     return Mouse.press(0x02) if key == B
    3 b" e1 y! O, t$ U* d' {  s
  399.     return false
    8 I3 g1 x3 E( w8 F2 G8 k6 P5 v5 _
  400.   end  ^! f" j' I* G  n& t& E
  401.   #--------------------------------------------------------------------------
    ' `' t- Y, C4 D. h9 @( d
  402.   # ● 按键刚被按下则返回true! ^6 q% ^8 P2 J3 H  M
  403.   #--------------------------------------------------------------------------$ K* s+ i7 @" o. z& s$ z, i
  404.   def trigger(key)
    - b3 i( Z5 o$ V! x! A% p
  405.     return true if sion_mouse_trigger(key)  k" e* a5 R. S) {1 @, f- `6 n
  406.     return Mouse.trigger(0x01) if key == C
    ' x! E; }  _% K- t9 X7 \4 `
  407.     return Mouse.trigger(0x02) if key == B8 s5 ~9 e5 q& J2 x% ~
  408.     return false& }  ^  d: p7 Z0 h
  409.   end
    8 @* Y' V/ b  ~0 _& w9 O
  410.   #--------------------------------------------------------------------------
    ( l  e. \& B2 g( P% r$ @! l& ~
  411.   # ● 持续按住键一段时间的话,每隔5帧返回一次true
    / L" T5 j2 U) V
  412.   #--------------------------------------------------------------------------. S8 \: N& s9 h- K, m2 |2 v
  413.   def repeat(key)' ^3 R; ]: t% A) Q8 S, `1 l! b2 n" {
  414.     return true if sion_mouse_repeat(key)
    ( j9 T: `* `3 D8 I: O% c
  415.     return Mouse.repeat(0x01) if key == C
    8 [8 E9 d* ]' c1 q3 S
  416.     return Mouse.repeat(0x02) if key == B4 [4 R! {8 N! f  f% r
  417.     return false
    4 z8 F. @& Q9 b0 w8 ^
  418.   end
    ) d9 E. _4 N) e% p( f1 u
  419. end; K* x3 N( B3 I9 y$ B

  420. 4 @& V" S8 D% z; `- P) h

  421. # M+ l, ^/ u' E. ?: G: I
  422. #==============================================================================3 {3 ~6 t! Q$ b" r% _
  423. # ■ Window_Selectable% r  h1 F  p3 m& V
  424. #------------------------------------------------------------------------------* K. p" D) c1 P1 u9 e$ P- @4 }
  425. #  拥有光标移动、滚动功能的窗口7 E% \. r2 k* ^( T
  426. #==============================================================================: U' }% a4 B' P
  427. class Window_Selectable
    6 x' S4 e, g6 `5 o% y
  428.   #--------------------------------------------------------------------------
    5 [6 U% ~" {: {5 ^0 S+ F4 D9 G9 _
  429.   # ● 初始化3 T2 c, G. T: a0 b/ Z, E
  430.   #--------------------------------------------------------------------------8 x. }3 C, g- y) |4 D9 j6 H
  431.   alias sion_mouse_initialize initialize
    * F  O7 A8 T% P$ F
  432.   def initialize(x, y, width, height). c8 \0 R# `( K1 [( ^1 T
  433.     sion_mouse_initialize(x, y, width, height)# n4 A5 Y% K. i4 t4 T' m$ ?! F) Z$ X
  434.     @move_state = 0! {6 h" H# K: P
  435.   end
    9 c3 p9 A/ i7 P& g
  436.   #--------------------------------------------------------------------------
    0 ~+ Y' @" t# a/ G& Y
  437.   # ● 更新# B2 z9 C+ a( u, k( G
  438.   #--------------------------------------------------------------------------: o  S- I: h: s# m% P
  439.   alias sion_mouse_update update' _% ~, k9 V' z
  440.   def update3 @7 t' `& {+ U% B, C
  441.     sion_mouse_update, _8 |% v$ q# p( S, M
  442.     update_mouse_cursor. F3 t! J" y# t/ F8 v% F
  443.   end3 e/ J( K$ i* d+ h" \" f
  444.   #--------------------------------------------------------------------------( m5 `$ O6 t! K( q  {5 K
  445.   # ● 启动后设置鼠标到index位置' p8 K  ?* w, ?  X
  446.   #--------------------------------------------------------------------------
    8 b; F  E; P7 ?8 c6 [. \
  447.   def activate) B2 N# P6 V/ W: M' }) R( h
  448.     @need_set_pos = true if KsOfSionMenu_Set_Pos
    - m& I: C4 f0 ]2 u4 v3 e
  449.     super/ j# i6 [6 k$ |$ u+ q
  450.   end
    * V- _5 v/ t/ b/ \- l
  451.   #--------------------------------------------------------------------------
    5 P1 l- T/ O- e5 ^' J
  452.   # ● 更新鼠标和光标的位置. @: v: y7 K$ c, d
  453.   #--------------------------------------------------------------------------0 o( [5 _( A2 Q, N: Y
  454.   def update_mouse_cursor2 S1 l6 d+ N, g, r
  455.     if active1 K: ~+ e/ B6 R) x
  456.       if @need_set_pos; I7 v4 i# Y8 f3 f" O2 B7 ?/ H
  457.         @need_set_pos = nil
    9 g/ e3 ^& V$ }* M# ^2 t  n/ }1 g
  458.         set_mouse_pos
    1 [, _. K  z0 h% O3 P
  459.       elsif cursor_movable/ y, e+ f7 H/ B3 p
  460.         Input.dir4.zero  set_cursor  set_mouse_pos3 M" y1 T9 v3 T) g; b  Y
  461.       end
    % i( O, w' K) r4 F5 j
  462.     end
      J6 p/ g3 o  D# Z
  463.   end
    . ^  Z: O: ?# r5 c/ j( B
  464.   #--------------------------------------------------------------------------- {1 b; w$ I' V& E
  465.   # ● 将光标设置到鼠标所在的位置,附带卷动菜单的功能& f7 f3 J. Q( s! T0 g- q
  466.   #--------------------------------------------------------------------------
    / h; x2 y8 h" w) ]1 r: o9 ]7 I
  467.   def set_cursor: F$ m; ~3 Y. U+ A* H& I
  468.     mouse_row, mouse_col = mouse_window_area! p* U/ T) b2 M9 ~
  469.     if    mouse_row == -1- ^  F7 K' x) ~! z$ b
  470.       @move_state += 1 if need_scroll& x% O  V! g) Y; v4 R8 [+ j
  471.       cursor_up if (@move_state - 1) % 4 == 0 && !is_horzcommand+ m: m9 U) Z! U" w
  472.     elsif mouse_row == -26 C0 n6 [, R6 E0 x, v. T
  473.       @move_state += 1 if need_scroll' }0 E% u6 V/ s3 J  r8 `1 l1 G7 b
  474.       cursor_down if (@move_state - 1) % 4 == 0 && !is_horzcommand
    , Q6 @# [# i8 @  l3 L! g0 Z/ S- v
  475.     elsif mouse_col == -1( F0 T& ^7 y1 Y1 o& |% F
  476.       @move_state += 1 if need_scroll3 x. Q: u3 O4 M6 r9 v* q
  477.       cursor_left if (@move_state - 1) % 16 == 0 && is_horzcommand* p$ t/ Q$ u8 h4 U
  478.     elsif mouse_col == -2; }) c" }0 b, Z. F" U
  479.       @move_state += 1 if need_scroll
    : V, s5 _" p# e
  480.       cursor_right if (@move_state - 1) % 16 == 0 && is_horzcommand
    # \- l0 C7 {2 d+ p# U6 h" y
  481.     else1 \' g) T+ J% ]( i+ O3 j
  482.       @move_state = 0+ E! k: |. D  T7 J. M
  483.       new_index = (top_row + mouse_row)  col_max + mouse_col
    8 i. I6 s& W/ _& Z! f. [
  484.       select(new_index) if new_index  item_max && new_index != @index4 a, k: u% ]- o. D
  485.     end
    / c$ l5 |6 s6 r5 M" J
  486.   end
    " m/ g- I% U. A; s. x7 M+ I
  487.   #--------------------------------------------------------------------------3 p$ v  s2 X. A! {/ u
  488.   # ● 判断鼠标位于菜单的第几行、第几列
    ) l# p1 a1 G& n
  489.   #--------------------------------------------------------------------------
    " c% u+ `9 l: ^6 R* r
  490.   def mouse_window_area; x7 N! X" y3 \6 p; j7 U
  491.     if viewport.nil # necessary!
    4 j9 t, T5 N# z6 I+ M! h9 k# `
  492.       vp_x, vp_y = 0, 0/ P' T& b( Y4 ]- r2 H; w3 p
  493.     else
    : ^! t4 ^, R" _+ y- p
  494.       vp_x = viewport.rect.x - viewport.ox
    * f) ~  y6 f9 Y
  495.       vp_y = viewport.rect.y - viewport.oy5 w4 n9 {0 M  v3 g) B6 H" a
  496.     end& s+ C% J+ G& J+ I2 U
  497.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y- o1 l2 f( j! q( B6 t
  498.     item_x1 = vp_x + x + standard_padding ! q7 H5 h% b1 u3 G% b
  499.     item_y1 = vp_y + y + standard_padding
    / b, K3 M) w) S" [
  500.     item_x2 = vp_x + x - standard_padding + width
    ! J6 U' S7 A4 u/ m; f( _& O
  501.     item_y2 = vp_y + y - standard_padding + height6 h2 Z- p' x+ S) f( b* x, S" _
  502.     if mouse_x  item_x1
    ) k# l4 f. H) c9 c2 f$ h
  503.       mouse_col = -1
    3 n5 _5 B/ ]# Q' `' E
  504.     elsif mouse_x  item_x25 U( l& ?8 H9 m3 Z! s( Z5 W- E
  505.       mouse_col = -2' b& Q' x' L8 g% g$ `0 O8 Z
  506.     else, a: G: V- [$ e- S, I+ X# r- k7 D
  507.       mouse_col = col_max  (mouse_x - item_x1)  (item_x2 - item_x1): ?: P& o. ?2 m/ Z5 \* |) e4 L
  508.     end- h( u$ _- l7 a8 u9 m0 b" q
  509.     if mouse_y  item_y1
      p: f# ~' H. {, M- ~# u
  510.       mouse_row = -1
    * M5 }7 V1 X' `$ N- o* o5 m# k
  511.     elsif mouse_y  item_y2/ G0 O/ ^4 [6 j8 n0 J! o
  512.       mouse_row = -2
    9 V+ l* G2 ^5 D/ ]
  513.     else; F9 |, M3 f* \% Q& V4 L; V7 _9 h
  514.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)
    ' h  t/ _' S6 M% u; T& C0 A
  515.     end
    2 f. X% b+ N$ W* n9 @3 F7 j1 p+ G
  516.     return mouse_row, mouse_col6 X. C' T+ f1 `4 z
  517.   end
    # f7 U& i5 P& C: r6 J1 z
  518.   #--------------------------------------------------------------------------8 \3 p1 {6 h  p# ]- P5 t, t7 u% E
  519.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    ) A0 |( W8 M: [
  520.   #--------------------------------------------------------------------------
    2 Q: {% J( j6 A- V5 w
  521.   def set_mouse_pos
    ! U7 _4 R! C+ q8 h  T" j
  522.     if viewport.nil # necessary!- N$ ^0 ?1 Q: C" O0 b  U
  523.       vp_x, vp_y = 0, 0
    7 C  c% R3 E7 ~- `$ c0 I8 {# R
  524.     else- r' q8 p8 F9 v! G, v
  525.       vp_x = viewport.rect.x - viewport.ox# w6 ~: \9 N# |7 L3 l' Z' c6 ^# r
  526.       vp_y = viewport.rect.y - viewport.oy5 V! R6 }) [) Q2 K( z9 _9 u
  527.     end
      E- t' |. J7 L
  528.     item_x1 = vp_x + x + standard_padding 8 g3 F& o: h  \
  529.     item_y1 = vp_y + y + standard_padding
      x' Y" l$ I. o0 |& n2 I9 _* O
  530.     get_index = [url=home.php?mod=space&uid=370741]@Index[/url]  0  0  @index
    ! _3 z  i- N) p- K4 Z8 T- r
  531.     row = get_index  col_max - top_row
    ( c" T% O) n: L/ e/ S8 {
  532.     col = get_index % col_max
    ) a  R. c8 b( S9 @( B$ `- n
  533.     new_x = item_x1 + item_width  (col + 0.5)
    ) V, d2 w9 N9 Q* @- e7 ^. c
  534.     new_y = item_y1 + item_height  (row + 0.5)+ T. b5 Y! {2 p3 C! n
  535.     Mouse.set_mouse_pos(new_x, new_y)
    0 _) C$ C; D2 L( a6 Z5 n. `5 R
  536.   end
    7 j; X+ o$ Y0 f2 m4 B" o
  537.   #--------------------------------------------------------------------------
    ! p( u9 p2 y; j2 S$ e
  538.   # ● 判断菜单是否需要卷动
    6 `3 A' t6 o+ X& N7 }$ K
  539.   #--------------------------------------------------------------------------
    : S+ Y. C$ H3 D, Q$ G" O$ l; u
  540.   def need_scroll+ }( `" e: V. J- @4 b  U
  541.     item_max  col_max  page_row_max* Z5 G: k3 L6 q# y7 F4 @
  542.   end  {) Q* `$ n# ~
  543.   #--------------------------------------------------------------------------
      @9 W; T) y* ~  F: A
  544.   # ● 判断是否为水平卷动菜单, k& I' I5 g$ O, Y8 L
  545.   #--------------------------------------------------------------------------. g* p; @# g7 K6 M
  546.   def is_horzcommand
    , v/ l+ m# t- w" e7 i5 L: y0 |: @
  547.     return false, Y7 C# z, O/ C& o5 \! u/ A
  548.   end
    " x0 I6 o- U6 S
  549. end. T/ K' l2 j0 c% I! i- H

  550. % Y3 ~8 t+ p# S7 h. K; R
  551. class Window_HorzCommand
    ' b! U8 u% G) r/ H% ^
  552.   #--------------------------------------------------------------------------; S3 c- |" j* h/ R7 i( x
  553.   # ● 判断是否为水平卷动菜单
    8 n. n2 A; w6 a% z7 L8 g
  554.   #--------------------------------------------------------------------------2 \' w: Z2 b% i  E* p) N' ^/ G
  555.   def is_horzcommand. x6 F4 e  d& s) S
  556.     return true
      r  [5 c' E4 u
  557.   end
    ) Y/ m$ l1 L* ^* I& ]- `% d
  558. end
    ; H7 S$ {7 ?8 M$ ?& J) ]6 a: D2 \
  559. & F. ^* w/ |( j
  560. #==============================================================================' |1 ]5 q! z0 r9 n
  561. # ■ Window_NameInput& H" _) _9 d4 G# n+ k
  562. #------------------------------------------------------------------------------
    4 R3 a! r! a3 o7 Y! w
  563. #  名字输入画面中,选择文字的窗口。+ _( o# v; ~; z0 Z0 [! S
  564. #==============================================================================$ Z+ _. @) f  f* N1 ]3 [% B
  565. class Window_NameInput* |' t$ T# d1 `& b' [
  566.   #--------------------------------------------------------------------------
      V; R1 w0 L. u8 K6 X! H; u- @
  567.   # ● 设置列数
    6 d& w% P8 g6 g* K* A# ?2 H/ Q
  568.   #--------------------------------------------------------------------------. S: G0 ~  V" b/ {" O
  569.   def col_max! N) w+ e& j+ z2 G" S0 z" a
  570.     return 107 y- `# P; s- B- P' F' k
  571.   end
    ; C2 B: J6 `' d  J, e8 i. ?  Y
  572.   #--------------------------------------------------------------------------$ L) b% U. }1 J9 w! w
  573.   # ● 设置填充的Item个数
    5 a, o+ A4 F5 W7 u* v7 a7 m1 G
  574.   #--------------------------------------------------------------------------
    7 Y9 b5 M" |# n- m& J/ g$ T% [
  575.   def item_max1 r2 m9 ?2 {6 U# S8 q
  576.     return 90
    7 D/ W# E: j+ [0 m
  577.   end- Y" l% M# s* T2 y( _
  578.   #--------------------------------------------------------------------------3 x! {' Z9 M3 ]/ |: _  W2 Z
  579.   # ● 设置填充的Item个数
    1 t8 f0 a. k- u7 L  e" A2 l
  580.   #--------------------------------------------------------------------------  U$ W& Q6 N4 F  ]  n' B
  581.   def item_width
    5 g9 B* Y" U2 Q. Y2 V6 U8 u2 W8 @/ \
  582.     return 32
    ! U5 d7 P. ~/ C: i" ~
  583.   end$ Q' C/ L+ {; Y! B0 Q# H0 x
  584.   #--------------------------------------------------------------------------
    % ^  v. Z+ y' C6 [/ g* q
  585.   # ● 判断鼠标位于菜单的第几行、第几列- o2 k+ u: ^  ^5 k0 G" p
  586.   #--------------------------------------------------------------------------
    ' D3 e# b1 u, h' B6 X# j
  587.   def mouse_window_area
    4 ?/ `$ W+ q8 ~" u) N& a
  588.     if viewport.nil
    # ]/ K% U  M2 }5 d! M8 e/ w
  589.       vp_x, vp_y = 0, 02 L. j6 t  f- ?5 m
  590.     else* F' ]: F+ _- @, n1 L
  591.       vp_x = viewport.rect.x - viewport.ox- V5 h  x. }6 o, b. S
  592.       vp_y = viewport.rect.y - viewport.oy. \; g' z' L7 J% @$ S" [; M
  593.     end
    / l# n: t9 K7 b: ?; N2 d8 g! K
  594.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y# c4 p. {, a# B7 J  n+ X" j% }8 p
  595.     item_x1 = vp_x + x + standard_padding
    . T# ^2 O  v0 D& `
  596.     item_y1 = vp_y + y + standard_padding% Y& U% ^5 _5 e# K1 I) L! Y4 V
  597.     item_x2 = vp_x + x - standard_padding + width! E' D& _, F# H/ ]8 b
  598.     item_y2 = vp_y + y - standard_padding + height
    # u. i, X% R" W/ I4 ^) _4 m* W+ l- z
  599.     if mouse_x  item_x1
    : F: |" P# ^2 E1 c% `3 L. P
  600.       mouse_col = -1& ~7 `4 U3 K2 F4 e0 x; M( ?9 K# A  W- t
  601.     elsif mouse_x  item_x2
    : z/ m) U; r& S0 z9 D1 z
  602.       mouse_col = -21 P3 \/ O/ }; I& s9 @4 ~
  603.     elsif mouse_x  item_x1 + 160
    . s+ h5 F, W) y
  604.       mouse_col = (mouse_x - item_x1)32
    % O+ k7 \  a  E1 ~0 R* r* v
  605.     elsif mouse_x  item_x2 - 1606 g( M" s$ ]5 _9 A- A
  606.       mouse_col = 9 - (item_x2 - mouse_x)32
    ( C+ O3 Z- o; d. i( g2 P
  607.     else% y  z( T% j6 I* F; h5 ?) `* k
  608.       mouse_col = mouse_x  x + width2  5  4& [* @1 ?, Y. Z
  609.     end- ?( ~! [3 @0 M, c1 h9 A) `
  610.     if mouse_y  item_y1
    " M( V; ?; U( r2 ]. c- A
  611.       mouse_row = -1
    ; R  ?9 A2 d/ L
  612.     elsif mouse_y  item_y2
    8 \- g/ Z3 h# ~- `  j& ?
  613.       mouse_row = -2; `) t( v4 F  N- @( i8 D3 Q
  614.     else; n6 a1 _, N; S# D
  615.       mouse_row = page_row_max  (mouse_y - item_y1 - 1)(item_y2 - item_y1)
    : l  X( s: V& ~1 W" L9 r+ ]& }, R
  616.     end
    1 l( \3 r4 V# t/ n" a
  617.     return mouse_row, mouse_col/ Q3 [6 q. i5 Y; F5 S" z
  618.   end
    ! ]4 y" x+ }* T5 G$ L8 B1 f( q
  619.   #--------------------------------------------------------------------------' Y* y  U; X7 ?: P+ y
  620.   # ● 方向键移动光标时将鼠标移动到对应的光标位置9 }& _/ }) n+ d0 A# Y
  621.   #--------------------------------------------------------------------------
    8 l  [; A8 t" C" w$ F$ Z, h& ]$ O9 C
  622.   def set_mouse_pos
    ) |# B1 D. k. d
  623.     if viewport.nil # necessary!& F& J3 b0 P( Z5 @
  624.       vp_x, vp_y = 0, 0  U) u. t* z9 d" t
  625.     else
      F0 S+ n# C& I3 V
  626.       vp_x = viewport.rect.x - viewport.ox
    9 _9 r- u9 M, m! @: T+ K+ l
  627.       vp_y = viewport.rect.y - viewport.oy
    ! w4 }) s- `. I7 K8 k  l7 V8 M  i
  628.     end
    1 f! i" Z9 t) {: h
  629.     item_x1 = vp_x + x + standard_padding
    6 J4 B5 y5 v# n& k- @& N/ v
  630.     item_y1 = vp_y + y + standard_padding0 n5 @/ t+ E$ L8 Q
  631.     get_index = @index  0  0  @index : g% F  B, d& T/ I
  632.     row = get_index  col_max - top_row3 P7 @- q  x+ F( G/ p6 M, x3 l
  633.     col = get_index % col_max
    4 f  ^% m# m( u$ W3 V( T5 i3 j
  634.     new_x = item_x1 + item_width  (col + 0.5)
    ; Z( ]0 o' z5 E3 U
  635.     new_y = item_y1 + item_height  (row + 0.5)8 t# s/ K/ }, l: {  q' w, b0 R) I+ `
  636.     new_x += 14 if col  4
    6 p# `8 j8 y7 o& u
  637.     Mouse.set_mouse_pos(new_x, new_y)9 c8 I: g" v$ C: y4 x
  638.   end
    ( [/ k* ~' k" B8 e
  639. end
    ! `' }; |* i9 I$ ~

  640. / ]) `$ |" x5 b0 V/ {
  641. #==============================================================================
    ( S8 E# F4 ^2 q2 \  Q& J! H
  642. # ■ Window_NumberInput" W* c  M, w# e; W
  643. #------------------------------------------------------------------------------
    - f" v& E/ Q4 v; x7 `
  644. #  重写了数值输入的方法以适应鼠标& _; z: X! J. S/ R8 T
  645. #==============================================================================
    5 ?$ L6 ^9 u$ j% `9 v' q% y
  646. class Window_NumberInput  Window_Base
    # {  a. I/ w/ f7 Q* ~+ {) i
  647.   #--------------------------------------------------------------------------
    ( S" |% D: E- M2 N
  648.   # ● 定义实例变量3 m% ^5 w7 o' m' \
  649.   #--------------------------------------------------------------------------# z  K  Q/ a/ Q5 p8 p
  650.   attr_reader extra_window; e& W, C/ a1 i- k' B5 T, K
  651.   #--------------------------------------------------------------------------/ H) V* G# I/ a/ ~/ e0 G
  652.   # ● 初始化' s' F, }% I2 j
  653.   #--------------------------------------------------------------------------. T# u& f) {0 R1 {* M. `( z# Y
  654.   alias sion_mouse_initialize initialize
    3 [/ ]) m% i' M  j) k! M
  655.   def initialize(arg)) R1 X2 P% _$ B( G' t
  656.     sion_mouse_initialize(arg)
    : M; t& r7 d& U- |9 i3 K
  657.     create_extra_window
    , y) ?: f: L+ P/ {7 @
  658.   end  A; w! V/ V9 F# O. j  s
  659.   #--------------------------------------------------------------------------
    , e+ S  e. g2 C. O* H: X, `0 {
  660.   # ● 启动
    7 j$ v# [" W' J/ x1 w
  661.   #--------------------------------------------------------------------------
    # m0 U" x/ L  ]  S: d
  662.   alias sion_mouse_start start- G' K8 k& C6 b9 ?
  663.   def start
    " x+ ?; N; Z- h% p5 N  z
  664.     sion_mouse_start
    $ @& K7 ^( V# M) ^" v% M
  665.     deactivate
    8 G4 \& s& t& x
  666.     extra_start
    ! x2 Z+ K$ W+ }* i# e( Q
  667.   end
    5 C/ F9 H( w$ Z0 K. S
  668.   #--------------------------------------------------------------------------
    ! ?# E+ m: H! `0 G
  669.   # ● 创建新的数值输入窗口; ~* u% E, V2 [9 V7 _4 O- H! n
  670.   #--------------------------------------------------------------------------8 W$ ?6 y" G* ^& j. P2 T
  671.   def create_extra_window$ N& i5 ^* E1 M3 c) P5 A0 {
  672.     @extra_window = Window_NumberInput_Ex.new
    0 w8 o4 V/ Q4 h/ X  t
  673.     @extra_window.x = (Graphics.width - @extra_window.width)  26 r4 o$ M4 C9 J3 [, [4 u
  674.     @extra_window.number_proc  = Proc.new {n [url=home.php?mod=space&uid=27178]@Number[/url] = n }
    " p- o9 b7 u) k
  675.     @extra_window.index_proc   = Proc.new {n @index = n }
    ( [/ Z* L5 Y+ N, o5 L/ y
  676.     @extra_window.close_proc   = Proc.new { close }5 L, I1 ]+ ^) V! }/ L1 @
  677.     @extra_window.refresh_proc = Proc.new { refresh }# ?" k' `, ]* W( u0 [
  678.   end/ }- ?5 n# z8 j# o
  679.   #--------------------------------------------------------------------------
    3 B2 {: l" w; P
  680.   # ● 激活新窗口
    ( T. J5 K4 c- o) ]- b+ o. P
  681.   #--------------------------------------------------------------------------
    ! i. d6 {" |# k, @& I8 {6 ~
  682.   def extra_start* a2 _; A1 \  F" D. l4 z
  683.     case $game_message.position
    ; T; z. r( C7 b+ q) n
  684.       when 0; @extra_window.y = y + height + 4
    . |. }8 |5 K; [+ v
  685.       when 1; @extra_window.y = @message_window.y - @extra_window.height - 8- E- K# N0 C, {! b( S7 r
  686.       when 2; @extra_window.y = y - @extra_window.height - 46 K( M/ E/ q, J7 G$ J
  687.       else  ; @extra_window.y = 85 N9 }- p, u' W! |9 [7 _
  688.     end
    6 R) w, {! n5 {, p0 x1 Z; c+ W
  689.     @extra_window.variable_id = $game_message.num_input_variable_id+ s+ ?2 s" k6 e2 J/ d3 D
  690.     @extra_window.digits_max  = @digits_max8 c5 {, V- p8 I: r3 c
  691.     @extra_window.number      = @number
    7 @7 v* m4 F, Z6 I  @0 D1 U
  692.     @extra_window.open6 ?, X9 R) l6 ~- \# P$ C
  693.     @extra_window.activate" O3 D9 ~8 G$ b2 S8 M4 e0 Q
  694.   end
    7 s( H8 ], x( O  u  E
  695.   #--------------------------------------------------------------------------
    3 M+ N) k$ _* d( p) Y
  696.   # ● 更新; P$ s7 o1 f3 p. b2 ^6 o2 O; m
  697.   #--------------------------------------------------------------------------
    ' O9 H( z' M; Z9 j! L
  698.   def update
    4 ~9 Y; H) e3 a" X# N
  699.     super
    % q% U7 i+ }  C+ a1 f/ M& Q, _
  700.     @extra_window.update
    ) E# C" g* O# r9 `( g
  701.     update_cursor
    " X0 X  W( @$ P9 \
  702.   end: Y# o; h! `; v: H" ?  _
  703.   #--------------------------------------------------------------------------+ g) V! ~! v$ V: \4 n! @- b9 V
  704.   # ● 关闭窗口$ L4 ?8 ]# U. @9 W) {
  705.   #--------------------------------------------------------------------------; v( O/ e6 i- B
  706.   def close& O3 v1 a3 ?. N: ~  h
  707.     super
    4 g( V! o7 P7 Y7 b
  708.     @extra_window.close
    9 L' K  r% Q& t1 Y
  709.     @extra_window.deactivate9 C% A6 a- P. M; Z4 b
  710.   end
    " |# z% C2 r- m- \
  711. end
    * C: v- \; o  i- r0 M5 F: }
  712. ' n4 s9 _  H+ ~8 |
  713. #==============================================================================
    6 g& C/ h, D9 P  @  {" _
  714. # ■ Window_NumberInput_Ex# Q9 R# [4 G1 e% O4 M) V0 O
  715. #------------------------------------------------------------------------------6 y# y4 P! M4 @  ]
  716. #  新的数值输入窗口(NewClass)
    & ]% U3 P5 w/ s- p/ o3 l
  717. #==============================================================================
    ) e- B: h( I& a. n1 T
  718. class Window_NumberInput_Ex  Window_Selectable  V/ _  _! d) L6 `/ X/ _/ S7 t
  719.   #--------------------------------------------------------------------------: g& v7 L0 P4 z3 i  [
  720.   # ● 定义实例变量
    ) ^  k- B' e' J6 c4 o' _: P$ o
  721.   #--------------------------------------------------------------------------
    / b, d- ^- v: U) q
  722.   attr_accessor number_proc- g0 c: d. @% L! Q
  723.   attr_accessor index_proc9 E, Y3 _, S! Z/ O, m
  724.   attr_accessor close_proc
    1 r- ]; V. z: A$ K8 I. S
  725.   attr_accessor refresh_proc
    & c( F+ O0 R+ H- k: y- Q
  726.   attr_accessor number
    2 G$ f: `2 B1 f; H7 W: l* F4 N2 z6 h
  727.   attr_accessor digits_max% f2 h/ @* A( U7 v4 f
  728.   attr_accessor variable_id2 s$ V1 N0 Q) `% Y9 q6 E/ I& t
  729.   #--------------------------------------------------------------------------7 _% [8 q' E5 ^9 N% r
  730.   # ● 数字表1 Q0 Q# o4 D. ]6 P
  731.   #--------------------------------------------------------------------------
    2 ^& P3 K$ Y8 M: k+ Z* Y5 ~, V
  732.   TABLE = [  7,  8,  9,
    * e% r) P8 \( U' m, i
  733.              4,  5,  6,% |" `! f3 n! F) @, U" d
  734.              1,  2,  3,- c' [- Y7 @8 {) s6 m; \
  735.             '←',0,'确定',]: Q+ s6 E: r" f- w$ ]: b% T
  736.   #--------------------------------------------------------------------------
    5 p  e1 i8 b& X+ p% K% B( P* L
  737.   # ● 初始化对象
    % ?# t7 G1 t, h- b7 d
  738.   #--------------------------------------------------------------------------
    * Q7 Z; |6 Y5 ?1 V; J5 u
  739.   def initialize
    4 Y2 h" L# h% s1 |' S! g: R4 [
  740.     super(0, 0, 120, fitting_height(4))
    % Z( |8 g$ c4 A$ K) i5 m* @; y
  741.     self.openness = 08 q5 F4 x6 m6 k% W  s  l/ Y) P
  742.     @index = 07 ~5 \9 R; Z9 g& Y1 J0 [# M
  743.     @number = 0
    % \* E$ v, u9 \7 F; F: D
  744.     @old_window_index = 0' _8 z6 b# d3 [2 n* J1 `7 V
  745.     @digits_max = 0
    % }  X& S% w/ X. ~" p3 [
  746.     12.times {i draw_text(item_rect(i), TABLE[i], 1) }
    * W% h' j5 b$ J. K* `4 G
  747.   end
    7 O3 Y0 E, x6 w# E
  748.   #--------------------------------------------------------------------------
    ) u5 R7 i& y' s* ~  C9 c6 H$ E
  749.   # ● 获取项目的绘制矩形- T0 l) j# o1 F  e4 D/ X
  750.   #--------------------------------------------------------------------------
    4 x+ u! b$ [  C. y  j* X
  751.   def item_rect(index)
    0 b! ^3 G  {; _- a
  752.     rect = Rect.new0 w0 I5 s7 J- U3 d; S
  753.     rect.x = index % 3  32# {% T9 k( v& K4 G9 I
  754.     rect.y = index  3  line_height% W; u1 w( [  Y) g2 j+ `8 P
  755.     rect.width = 32
    + [: s& M( G. l2 R5 J: S  Q- f
  756.     rect.height = line_height, A7 n& f0 `# o* ]3 J: m6 j2 f
  757.     return rect: W, r; `9 W- A! v8 w
  758.   end/ W* S: {) Z, A! G: w4 ^0 p/ L
  759.   #--------------------------------------------------------------------------4 Q( @& h' V1 d, `" V
  760.   # ● 将光标设置到鼠标所在的位置% K9 ?' W( k2 p' t0 X+ V& l
  761.   #--------------------------------------------------------------------------2 T; w% B' m$ X! M( r
  762.   def set_cursor
    7 A; f8 z' l& Y( k& v4 n
  763.     mouse_row, mouse_col = mouse_window_area' V; [0 A1 Y$ g) p+ }
  764.     if mouse_row = 0 && mouse_col = 0. n- U4 y2 R7 V3 m4 B
  765.       new_index = mouse_row  3 + mouse_col+ d9 \/ W/ y8 T0 w! R0 L
  766.       select(new_index) if new_index = 11# {# R' I( m7 {  P- W; x7 H5 }3 f
  767.     end
    ) E2 Q: I1 Y# n
  768.   end
    + l1 y8 q9 v% L
  769.   #--------------------------------------------------------------------------
    6 r4 `! a0 y+ m% V( o1 ?" r
  770.   # ● 判断鼠标位于新数值输入窗口的第几行、第几列+ T+ ~4 g' K: P
  771.   #--------------------------------------------------------------------------4 v2 J! R* a4 A9 K
  772.   def mouse_window_area
    / g' K% }& R9 h! n- _9 j9 D
  773.     if viewport.nil
    - Y) E: x" R  I9 H- ?. C
  774.       vp_x, vp_y = 0, 0
    3 {8 ?/ f7 T3 p- d- v- S
  775.     else) M, c* R' p( D& G1 [6 [3 e
  776.       vp_x = viewport.rect.x - viewport.ox  N2 w1 Y- D, n$ H" F  B# y/ R
  777.       vp_y = viewport.rect.y - viewport.oy
    3 W5 G, r0 }* c" s1 ^
  778.     end
    ( `8 x  S' {' P4 m
  779.     mouse_x, mouse_y = Mouse.mouse_x, Mouse.mouse_y# B/ G8 v% s( ~4 C$ G$ H
  780.     item_x1 = vp_x + x + standard_padding   n* `  {( T; v2 _! |. j  y! O4 Z6 \
  781.     item_y1 = vp_y + y + standard_padding  _( i8 ^( d" ~6 l0 d9 j0 o
  782.     item_x2 = vp_x + x - standard_padding + width
    + o! y7 X) V( O% C0 f/ q
  783.     item_y2 = vp_y + y - standard_padding + height
    * z/ y9 a: {: Q  D; W* b
  784.     if mouse_x  item_x1$ A0 i" G6 a1 L% p0 {# W
  785.       mouse_col = -1% l" s* d# W( W, c% W' x2 F5 e
  786.     elsif mouse_x  item_x22 j$ _- C! l8 O; m' {( |
  787.       mouse_col = -2
    % t6 j# g  F" [
  788.     else
    & |+ }/ _" i, H2 |
  789.       mouse_col = (mouse_x - item_x1)  32* T' H$ O' O; a  X* ~
  790.     end; a- w' e6 F& B3 H+ F9 M
  791.     if mouse_y  item_y1) r' Y1 w6 v+ _$ j9 i# i
  792.       mouse_row = -1: c4 ^6 ?; {' C" Z+ B" a& M* ^) [8 f
  793.     elsif mouse_y  item_y2
    2 N* @" D, Z- B, J' y% d$ z/ b& _
  794.       mouse_row = -2
    6 L( G7 `6 t- x, }. l
  795.     else
    # g% P! q9 r8 [- P( u
  796.       mouse_row = 4  (mouse_y - item_y1 - 1)  (item_y2 - item_y1)/ ^, \/ N2 r+ N% l' H
  797.     end- G; C. ~% Z$ f, g3 V# ?
  798.     return mouse_row, mouse_col3 _7 O* K( H% }- O. ]7 [0 Z
  799.   end8 C$ D0 \  |2 k* }, ]6 G' \& u
  800.   #--------------------------------------------------------------------------$ l# M1 f" d7 i
  801.   # ● 获取文字
    1 j! z& ^( [: d( u, \& J' b8 |
  802.   #--------------------------------------------------------------------------
    / A5 O8 L( a; r: H& Y
  803.   def get_number
    : ]! V0 Q2 P5 f8 o4 f6 h; n6 O& q6 E7 _
  804.     return false if @index == 9  @index == 11
    ) v4 R, }# Q/ V/ g0 |2 z+ n
  805.     return TABLE[@index]
    ) `6 ^7 i8 i; f% i
  806.   end& h$ q+ W3 i5 H4 k0 R. m# S
  807.   #--------------------------------------------------------------------------
    " c0 U6 X, j6 ?( a' ~
  808.   # ● 判定光标位置是否在“退格”上
    ' }9 K& J6 m) M' V' ]/ h2 G
  809.   #--------------------------------------------------------------------------
    4 ?: Z! _; a2 V) K( M. V" A; S
  810.   def is_delete& O; ~0 |2 r: c2 t: A0 L' k! O
  811.     @index == 9
    ; C9 G- x, w' a; w! [
  812.   end
    - a' `8 O* X( V& N3 I
  813.   #--------------------------------------------------------------------------
    0 j; K! g: |  t/ t
  814.   # ● 判定光标位置是否在“确定”上
    / _, L) H+ D. _' w2 G  @9 `
  815.   #--------------------------------------------------------------------------6 \' R; K+ R$ X9 H" m$ [
  816.   def is_ok3 B0 E: ]8 a$ R. u5 K" Z! N
  817.     @index == 11$ W) @$ [# x" _  v) I. F- p" g
  818.   end
    + ~+ `2 L( i( [5 y8 r/ p: n5 H
  819.   #--------------------------------------------------------------------------
    8 }2 b, [4 a: H7 C$ V: f+ W% u
  820.   # ● 更新光标
    8 a+ Y: c7 |( P2 [
  821.   #--------------------------------------------------------------------------
    3 p& z1 h: |' X$ w8 @8 G; Q# ^7 R
  822.   def update_cursor* t$ O* M! q6 C% ~' p
  823.     cursor_rect.set(item_rect(@index))
    & x9 K; V( y4 p8 D- `
  824.   end" o$ z+ k2 A0 w! V& u+ n- ?6 O
  825.   #--------------------------------------------------------------------------
    1 t& _1 I) I5 ?+ H
  826.   # ● 判定光标是否可以移动7 l9 j- \3 Q) T$ j
  827.   #--------------------------------------------------------------------------
    ) I) q: T% g$ u7 q) G
  828.   def cursor_movable
    ; ]2 I% A6 y3 a9 F2 |0 w* g/ i
  829.     active$ M9 v9 e' @, E, o
  830.   end* ~2 i  M' z; E
  831.   #--------------------------------------------------------------------------
    5 O2 N' _1 c# H' S* W9 e
  832.   # ● 光标向下移动
    * y9 u/ d5 m( j3 ]3 q% P
  833.   #     wrap  允许循环! [& A+ {, H8 a3 O
  834.   #--------------------------------------------------------------------------
    * K8 x# _0 u1 b6 h" U
  835.   def cursor_down(wrap)4 N% b. N$ ^/ S6 }6 K+ E7 \1 J: ^, ]
  836.     if @index  9 or wrap
    % r; S  k: f7 L+ a; n" r
  837.       @index = (index + 3) % 12
    7 b1 `, I; a4 i% D! A- q* w
  838.     end* W8 l; j" l  Q. C# D1 u3 j  `
  839.   end
    # A- K  W6 b" Y* Z4 Q" B
  840.   #--------------------------------------------------------------------------
    , Y$ i! S  {* `: ?" B. R" B
  841.   # ● 光标向上移动
    8 z! h. E1 K" C
  842.   #     wrap  允许循环" W) e1 e1 X: H) |; u. e! t+ k
  843.   #--------------------------------------------------------------------------1 Q* t9 s4 i, G8 Q3 B
  844.   def cursor_up(wrap)
    , f: N6 W8 c4 w' m3 o
  845.     if @index = 3 or wrap
    $ J, `/ i; D/ K( |
  846.       @index = (index + 9) % 12
    6 K- d4 S" K6 I& B7 |7 g8 E/ u
  847.     end
    ( \) {% U/ L1 D. @1 `
  848.   end! R+ n9 [$ J) O& e9 x) o
  849.   #--------------------------------------------------------------------------
    ! j! ]/ E7 }" P4 d# q4 O2 e4 Y; J
  850.   # ● 光标向右移动
    ) ^7 q8 ~6 I2 e; F. `: V
  851.   #     wrap  允许循环2 Q4 _3 m' \  [6 m8 i
  852.   #--------------------------------------------------------------------------$ h6 V7 m2 [4 }0 \( M# T5 O. B- Y# L
  853.   def cursor_right(wrap)5 x" t1 C4 o) ^* [
  854.     if @index % 3  28 b* s8 c  K9 c9 O, m2 h) U
  855.       @index += 17 i, f$ Z+ U! i8 ?
  856.     elsif wrap
    " i5 u. }: r! H
  857.       @index -= 2' @, r& g  n0 ^/ i
  858.     end% ^2 t/ a4 g7 x; b$ q
  859.   end
    6 Z" [, y% A- ~7 C/ {) y8 S- m
  860.   #--------------------------------------------------------------------------
    . G7 Z$ u8 c3 r" A
  861.   # ● 光标向左移动
      |8 ^) }0 H! _2 A: x
  862.   #     wrap  允许循环& j' t! M( P: ?
  863.   #--------------------------------------------------------------------------
    + t- |  ?& g9 i, Q, e- @
  864.   def cursor_left(wrap)
    8 j. c$ O6 D# W; I% U5 F- _& K
  865.     if @index % 3  0
    ) {: |. `( B' o5 J3 @1 y: T
  866.       @index -= 1' J4 ?  f* b, _' a# N* t: d9 _
  867.     elsif wrap
    ( X! D; x! b% {! ~
  868.       @index += 2
    * @- O2 k& J( ?. W/ D
  869.     end
    , @; C& j% |# h. g+ u
  870.   end
    ( d8 ~& T. G7 N9 g  u& E9 l' P
  871.   #--------------------------------------------------------------------------
    ; F9 _1 X2 h5 P& y7 Z: H9 \
  872.   # ● 处理光标的移动" f+ @  w. K) n  H. M" c, q& c
  873.   #--------------------------------------------------------------------------* ?# u0 L" d3 U# W0 @
  874.   def process_cursor_move
    7 Y& u* {% q5 ]6 e' E- A8 a
  875.     super0 {: l$ L' P" R3 t+ T( R7 O
  876.     update_cursor* c% `+ `: `& d2 A8 _. a
  877.   end
    4 c# Q( Y/ b4 ^1 l) w9 u3 V
  878.   #--------------------------------------------------------------------------
    $ h4 c. w2 F! M! i& T( P* D' w
  879.   # ● “确定”、“删除字符”和“取消输入”的处理& u: H" e. ~- r
  880.   #--------------------------------------------------------------------------
    7 y5 n; h8 Y. |
  881.   def process_handling" y4 I! N& q5 G3 W$ L7 l7 @' u
  882.     return unless open && active7 J. @5 ?% Z( D
  883.     process_jump if Input.trigger(A)$ b' z* b) l. J, U$ t% k
  884.     process_back if Input.repeat(B)# Z! y, R" g: g/ u
  885.     process_ok   if Input.trigger(C)" k2 o9 Y6 \* m, _% c
  886.   end  b3 b( T" }! {
  887.   #--------------------------------------------------------------------------
    , M* Y* s6 o- e) {: _  f8 Z
  888.   # ● 跳转“确定”! {! L& p$ r5 M1 P- E- F' M( k
  889.   #--------------------------------------------------------------------------
    $ N' {( [& y# n# X3 Y% f: L% l, P
  890.   def process_jump
    ; P0 Y! E* J" d. U' B9 z1 S1 D5 p
  891.     if @index != 11
    % ~  _3 Q# l8 B8 O/ ~/ o! s
  892.       @index = 11
    $ |9 h  S, f" A$ W: Y: M- T
  893.       Sound.play_cursor7 D% k2 G1 m5 n+ k, u
  894.     end2 p% A% m3 @  p) r+ T, F3 e
  895.   end
    + c/ h2 [" _4 U4 ?/ i
  896.   #--------------------------------------------------------------------------$ _7 \& ~) {/ y: ?/ h
  897.   # ● 后退一个字符& @2 ^. r* I5 U6 c5 _7 B
  898.   #--------------------------------------------------------------------------
    1 K1 r0 l! c) I8 W2 |" X  d
  899.   def process_back& m9 p2 Y4 I8 V% [
  900.     Sound.play_cancel
    3 K! h9 M" G/ H; T. O/ a
  901.     place = 10  (@digits_max - 1 - @old_window_index)8 T3 j. `6 |$ A8 n, A/ T$ J
  902.     n = (@number  place) % 10
    4 R" n3 c9 l, O
  903.     @number -= n  place, }( R# U% b3 |2 e1 M  C3 I1 g
  904.     @number_proc.call(@number)0 [" h0 D) B7 X! R1 @7 k3 J
  905.     @old_window_index -= 1 if @old_window_index  0
    . w. }4 \7 @; t+ ]- K  ], U
  906.     @index_proc.call(@old_window_index)
    % [9 c. S$ l+ V; M
  907.     @refresh_proc.call4 l6 q: x9 [- y+ Q
  908.   end! `" J7 Q0 p3 I3 X, u2 x
  909.   #--------------------------------------------------------------------------
    0 x* Y( Z) R$ Z5 B
  910.   # ● 按下确定键时的处理) H$ M9 @# s+ t0 q2 j
  911.   #--------------------------------------------------------------------------
    0 n3 y- \5 w/ @  i, ?, O( @
  912.   def process_ok
    5 p: M) x0 Z" F8 U
  913.     if get_number
    9 g% m8 o0 E; v* M. s
  914.       Sound.play_cursor
    . M% M. G' M0 J- _: d
  915.       place = 10  (@digits_max - 1 - @old_window_index)
    " o4 B; H* `! t2 g4 D2 H
  916.       n = get_number - (@number  place) % 10. x7 x2 p* T' s" t8 `
  917.       @number += n  place
    ) K. y7 C- o' r6 g; p! j# ~
  918.       @number_proc.call(@number): f6 Z* i# z' x/ s9 M# @
  919.       @old_window_index += 1 if @old_window_index  @digits_max - 10 ~7 N, J8 o0 C/ L% r% P. }: j
  920.       @index_proc.call(@old_window_index)
    2 y. e0 ^  k2 d+ N1 R% z2 s6 k2 d
  921.       @refresh_proc.call
    # N, h* q# f9 B4 I
  922.     elsif is_delete
    / q  I: y+ p  ]
  923.       process_back
    + }. P: I0 S1 b7 E3 s
  924.     elsif is_ok
    * W2 {  t# E# p4 ?  J2 a  T
  925.       on_input_ok1 G3 V% u# ^7 b& d
  926.     end, [$ `7 C4 k( O' q# |- `9 I
  927.   end- f. p) K& }3 T) S/ s* u# c
  928.   #--------------------------------------------------------------------------! `7 _2 G+ V. F* j( J2 e
  929.   # ● 确定
    / y8 }- s% ^1 H  j1 J% ?
  930.   #--------------------------------------------------------------------------
    ) H8 T* Z( g0 q2 d
  931.   def on_input_ok
      @' ]) E# ^' a3 y
  932.     @index = 04 ?1 ^4 D8 C; w$ p2 }6 \
  933.     @old_window_index = 07 @8 X4 `  k, K2 g
  934.     $game_variables[@variable_id] = @number
    0 u+ I" o0 ~5 S9 t+ g
  935.     Sound.play_ok
    : s: f4 R0 f. L" p- a9 E
  936.     @close_proc.call% X6 _! Q1 N6 H! V
  937.   end; K8 {' Z# J: q* O
  938.   #--------------------------------------------------------------------------
      \2 H1 X& [; w* X# j4 a) \- j* N
  939.   # ● 方向键移动光标时将鼠标移动到对应的光标位置9 Q% e! x6 h$ i% J, u$ O
  940.   #--------------------------------------------------------------------------" ~1 U3 q9 `  A( h  J  ^
  941.   def set_mouse_pos3 B  b9 l8 o! n5 G/ U
  942.     if viewport.nil # necessary!
    9 z  n& ?, w. \! x, z7 M
  943.       vp_x, vp_y = 0, 0
    ) N- |/ ~5 U8 X9 u/ {( G- D0 m
  944.     else! ^# F- n- Y8 f- W, a6 I' u
  945.       vp_x = viewport.rect.x - viewport.ox
    & b4 S; @, s* f
  946.       vp_y = viewport.rect.y - viewport.oy  H" W7 g+ v. ~
  947.     end
    ) I+ S0 E! S, Y
  948.     item_x1 = vp_x + x + standard_padding 0 R. h3 q7 Y2 ^" d6 d* D
  949.     item_y1 = vp_y + y + standard_padding3 V% T. b9 G  [) }+ ?8 d
  950.     get_index = @index  0  0  @index 7 J5 K* w% w- o4 j) \
  951.     new_x = item_x1 + 32  (get_index % 3 + 0.5)
    - p9 q4 u: T7 R  s
  952.     new_y = item_y1 + 24  (get_index  3 + 0.5)
    ! J$ h, m+ s1 S+ j0 \- d
  953.     Mouse.set_mouse_pos(new_x, new_y)
    - ~, Y& s( V; s/ K- n1 d
  954.   end
    . e, Z  b! r) A" Z8 f: x# m8 l
  955. end
    0 f0 }4 ~) F+ k0 b. x/ a

  956. & F( X8 \& B% ?" g3 D" k
  957. #==============================================================================
    $ @  M" }3 h" \! E2 M
  958. # ■ Window_Message% d* _0 E3 L0 q7 r! F+ A
  959. #------------------------------------------------------------------------------
    + f* q, A1 x& X  {
  960. #  显示文字信息的窗口。
    % W, D* G4 }& k* Z' \
  961. #==============================================================================
    " i; {, P5 E9 C
  962. class Window_Message  Window_Base% _$ u2 u$ j0 C, L5 F
  963.   #--------------------------------------------------------------------------! i9 C  _. t, x6 g/ X8 S
  964.   # ● 处理数值的输入(覆盖原方法)$ i- j9 S1 t6 M; P5 X1 }! y
  965.   #--------------------------------------------------------------------------5 B. W& S2 S, U1 V
  966.   def input_number
    2 u( j+ o, b' z7 L% `
  967.     @number_window.start
    ; Y; T- r( f/ E+ {$ {
  968.     Fiber.yield while @number_window.extra_window.active
    ; g  F0 o  f  s
  969.   end- {& w7 b" o1 o9 C0 w& C. c/ m, w
  970. end
    6 }6 f9 B  P3 p" k2 c

  971. + t; ~% _- F8 \2 y: z
  972. #==============================================================================
    0 C$ Q6 l6 d2 C: H; `1 R" Z
  973. # ■ Window_PartyCommand
    4 D9 p  N  ?9 N$ W& c* ?, M- C: D
  974. #------------------------------------------------------------------------------
    4 z0 m) ]6 f& |' w/ G$ q
  975. #  战斗画面中,选择“战斗/撤退”的窗口。! ]/ F: d8 \9 }2 E4 q4 E
  976. #==============================================================================
    ) E' d5 Z6 I; b4 Y# y
  977. class Window_PartyCommand  Window_Command
    8 h# j, ^, Q* `! ?
  978.   #--------------------------------------------------------------------------
    * Z5 `! h5 ^- W( u0 d
  979.   # ● 方向键移动光标时将鼠标移动到对应的光标位置
    2 m3 L5 {. C0 A: R( U
  980.   #--------------------------------------------------------------------------
    % k9 d% z1 Z1 K6 d0 w
  981.   def set_mouse_pos
    0 J$ b$ y; v- `9 |' G  k* I
  982.     if viewport.nil: T, D, c; Y2 I. X2 k0 @5 }
  983.       vp_x, vp_y = 0, 0' Y5 I& Q4 N9 @4 x8 N& ]- a+ w0 d
  984.     else
    / [) e) d  f4 ^* A' k" `
  985.       #vp_x = viewport.rect.x - viewport.ox6 ?2 f5 Q+ L0 u; Q# ]
  986.       vp_y = viewport.rect.y - viewport.oy
    % ?; _* o# P  J7 Y9 f' |1 B, I) V
  987.     end0 e- {  a+ ~5 a8 ]4 F9 ?+ W
  988.     item_x1 = x + standard_padding 0 l" Q- d  M. N: Y7 @7 f
  989.     item_y1 = vp_y + y + standard_padding7 I) T# H. `( D  R
  990.     get_index = @index  0  0  @index
      E2 j. f- p" v  t( Y
  991.     row = get_index  col_max - top_row+ `1 ~: y: m5 A1 N: d. A
  992.     col = get_index % col_max2 m, [; Y8 p. X
  993.     new_x = item_x1 + item_width  (col + 0.5)6 j9 j2 K' M! J6 L5 Z: F. G
  994.     new_y = item_y1 + item_height  (row + 0.5)3 C, F# v+ C% b9 V% h
  995.     Mouse.set_mouse_pos(new_x, new_y)4 E; k( b' T2 H  r8 V9 ]
  996.   end
    / z) F, W7 p- {5 M& E  t1 a0 P
  997. end
    % p4 \7 d8 K$ q% K9 ?  ~

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

  2391. $ }0 K$ `: C3 v3 ?+ x
  2392. $area_responses = []- w' C4 j; ^# T7 \$ h

  2393.   F5 Y" p; ^8 M% C8 l! H/ \# h
  2394. class Scene_Map
      r* F6 b) r5 T# \
  2395.   alias update_mouse_2013421 update_mouse_action2 H: F! V3 ?+ j; T
  2396.   def update_mouse_action
    8 c( }' _4 d& S1 S2 a6 _
  2397.     update_area_response. H/ t) g( t: f2 T1 P( N
  2398.     update_mouse_2013421" e9 V. c  B7 n* q
  2399.   end
    ; B; @! X0 D' a" P0 J
  2400.   def update_area_response6 I8 ^0 t7 }, `* T) t' N* m9 ~) \
  2401.     responses = $area_responses
    & |; x4 F, R3 ?( T: |2 E4 j1 Z) r
  2402.     responses.each {response) J1 `6 E& z3 f; \+ I
  2403.       ox = response.ox5 N4 y2 B7 ^6 j% D1 Y8 y
  2404.       oy = response.oy( X' m5 V1 d4 X+ `) d
  2405.       width = response.width
    6 _6 ]/ ]7 W$ H$ _/ ?
  2406.       height = response.height
    : d! h: G& x. G( H7 t
  2407.       switch_id = response.switch_id2 E; P4 D5 G( g5 R
  2408.       case response.type
    ! o! m& Q2 {2 ]1 p: T
  2409.       when 0
    8 G6 Q( K- J  K0 v. l* V& \& W
  2410.         if mouse_in_area(ox, oy, width, height)
    . i3 U) G7 M9 k! b( K
  2411.           $game_switches[switch_id] = true6 \2 i1 o. N- Z. k7 V( w
  2412.           $area_responses.delete(response)4 i7 U9 C# ^0 j3 R: m
  2413.         end+ a; ]: }$ R3 ^* q9 I/ S
  2414.       when 1
    $ O+ B: A- H5 d* m; F
  2415.         if mouse_in_area(ox, oy, width, height) && Mouse.trigger(0x01)
    ; k  c* i" ]! c
  2416.           $game_switches[switch_id] = true
    - R  s( y& g) [& F5 u
  2417.           $area_responses.delete(response)
    % _( B: w1 v% \9 x" U! B4 c
  2418.         end! v: \( m' I0 l4 J! B
  2419.       when 29 X. ?+ V& J! X% s
  2420.         if mouse_in_area(ox, oy, width, height)% W% C; J' n% r! y# f0 e
  2421.           $game_switches[switch_id] = true8 X2 Y+ X5 _+ c
  2422.         else
    1 T, l% |0 K0 ^' z
  2423.           $game_switches[switch_id] = false
    , V: F# E9 X. @3 q  m3 W
  2424.         end4 `9 t# e5 X  p( ~/ z
  2425.       when 3
    5 r3 T" d" b9 Z, z7 A# I
  2426.         if mouse_in_area((ox - $game_map.display_x)  32 ,4 Q% M$ E2 c) P( Y
  2427.             (oy - $game_map.display_y)  32, width, height)5 A* x. r" [/ P  V  i% B
  2428.           $game_map.events_xy(ox, oy).each {event
    3 F! M2 e, w$ }* ]
  2429.           event.start
    5 w+ _. b' g+ ~2 A- L# c
  2430.           $area_responses.delete(response)8 L' B2 N1 v" e
  2431.           return) b! H# q4 g1 `! l% ~$ R
  2432.           } , T. w! m. T* H; f# M) y" D! u
  2433.         end/ w' h* h! ~+ }( M7 a& c
  2434.       when 4! M9 {) q4 \+ _
  2435.         if mouse_in_area((ox - $game_map.display_x)  32,5 q0 C% v# b* q4 Q: q0 A$ X( M
  2436.             (oy - $game_map.display_y)  32, width, height)$ J: Q; g9 E/ ^3 j, v; C
  2437.           $game_map.events_xy(ox, oy).each {event
    . t- ?, J: @+ h( O8 J
  2438.             event.start
    . k& o0 J. f; s# G- g9 c! {
  2439.             return
    6 h8 z8 a- ]* [# C
  2440.           } 2 [) l+ _* |7 E' N
  2441.         end
    & B# A% }1 |( e/ r
  2442.       end
    ( z8 H6 d7 h, G; ^$ |6 c
  2443.     }0 l* d& U5 s! }3 Q4 I% J+ w
  2444.   end
    3 J3 L9 A$ n% t7 M4 c3 H* J
  2445.   def mouse_in_area(ox, oy, width, height)
    7 o. u. j$ T. t) P- M5 K( Z1 ^8 |4 g
  2446.     Mouse.mouse_x = ox && Mouse.mouse_x = ox + width &&. q& _" Q! K. {
  2447.     Mouse.mouse_y = oy && Mouse.mouse_y = oy + height/ K9 C; f9 Y+ p" [% v+ w" U
  2448.   end
    ( g1 o, g5 w5 a* {. \  G! `$ X1 k  A
  2449. end
    ! y1 ^6 x6 o) R. ~" f% W) |
  2450. class Game_Interpreter5 J, }! p+ l4 x
  2451.   def area_response(arg)* @' ?5 O$ t4 P( F( i* d" D
  2452.     $area_responses.push(Area_Response.new(arg))( x% d* W% a3 r* }0 r8 G
  2453.   end% N* _  S- H6 y* I! Z
  2454. end# P  q7 J1 h+ @* g
复制代码

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

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

GMT+8, 2025-2-19 07:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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